回答編集履歴
2
続き①のタイトルを追記
test
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
続き①です
|
2
|
+
|
3
|
+
|
4
|
+
|
1
5
|
以下、手札からボードにカードを召喚する箇所と思しきソースコード
|
2
6
|
|
3
7
|
```C#
|
1
操作ミスにより重複の内容が投稿されていたため修正
test
CHANGED
@@ -1,295 +1,285 @@
|
|
1
|
-
|
1
|
+
以下、手札からボードにカードを召喚する箇所と思しきソースコード
|
2
2
|
|
3
3
|
```C#
|
4
4
|
|
5
|
-
u
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
//
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
{
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
//
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
A
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
}
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
re
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
//
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
{
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
}
|
280
|
-
|
281
|
-
}
|
282
|
-
|
283
|
-
|
5
|
+
public void PlayCard(CardView card)
|
6
|
+
|
7
|
+
{
|
8
|
+
|
9
|
+
if (card.CanBePlayed(this))
|
10
|
+
|
11
|
+
{
|
12
|
+
|
13
|
+
gameUI.endTurnButton.SetEnabled(false);
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
var gameConfig = GameManager.Instance.config;
|
18
|
+
|
19
|
+
var libraryCard = gameConfig.GetCard(card.card.cardId);
|
20
|
+
|
21
|
+
//スペルかミニオンか
|
22
|
+
|
23
|
+
var cardType = gameConfig.cardTypes.Find(x => x.id == libraryCard.cardTypeId);
|
24
|
+
|
25
|
+
if (cardType.name == "Creature")
|
26
|
+
|
27
|
+
{
|
28
|
+
|
29
|
+
//ミニオンをボード上にプレハブ化
|
30
|
+
|
31
|
+
var boardCreature = Instantiate(boardCreaturePrefab);
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
var board = GameObject.Find("PlayerBoard");
|
36
|
+
|
37
|
+
boardCreature.tag = "PlayerOwned";
|
38
|
+
|
39
|
+
boardCreature.transform.parent = board.transform;
|
40
|
+
|
41
|
+
boardCreature.transform.position = new Vector2(1.9f * playerBoardCards.Count, 0);
|
42
|
+
|
43
|
+
boardCreature.GetComponent<BoardCreature>().ownerPlayer = this;
|
44
|
+
|
45
|
+
boardCreature.GetComponent<BoardCreature>().PopulateWithInfo(card.card);
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
//手札からプレイしたカードを消す
|
50
|
+
|
51
|
+
playerHandCards.Remove(card);
|
52
|
+
|
53
|
+
RearrangeHand();
|
54
|
+
|
55
|
+
playerBoardCards.Add(boardCreature.GetComponent<BoardCreature>());
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
//手札のカードのオブジェクトを削除
|
60
|
+
|
61
|
+
Destroy(card.gameObject);
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
currentCreature = boardCreature.GetComponent<BoardCreature>();
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
//ボードの描画処理
|
70
|
+
|
71
|
+
RearrangeBottomBoard(() =>{var triggeredAbilities = libraryCard.abilities.FindAll(x => x is TriggeredAbility);
|
72
|
+
|
73
|
+
TriggeredAbility targetableAbility = null;
|
74
|
+
|
75
|
+
foreach (var ability in triggeredAbilities)
|
76
|
+
|
77
|
+
{
|
78
|
+
|
79
|
+
var triggeredAbility = ability as TriggeredAbility;
|
80
|
+
|
81
|
+
var trigger = triggeredAbility.trigger as OnCardEnteredZoneTrigger;
|
82
|
+
|
83
|
+
if (trigger != null && trigger.zoneId == boardZone.zoneId && triggeredAbility.target is IUserTarget)
|
84
|
+
|
85
|
+
{
|
86
|
+
|
87
|
+
targetableAbility = triggeredAbility;
|
88
|
+
|
89
|
+
break;
|
90
|
+
|
91
|
+
}
|
92
|
+
|
93
|
+
}
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
// Preemptively move the card so that the effect solver can properly check the availability of targets
|
98
|
+
|
99
|
+
// by also taking into account this card (that is trying to be played).
|
100
|
+
|
101
|
+
//プレイしようとしているカードも考慮して、エフェクトソルバーがターゲットの使用可能性を適切にチェックできるように、先制してカードを移動します。
|
102
|
+
|
103
|
+
playerInfo.namedZones["Hand"].RemoveCard(card.card);
|
104
|
+
|
105
|
+
playerInfo.namedZones["Board"].AddCard(card.card);
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
//ターゲットを取るアビリティがあり、且つターゲットがいる場合
|
110
|
+
|
111
|
+
if (targetableAbility != null && effectSolver.AreTargetsAvailable(targetableAbility.effect, card.card, targetableAbility.target))
|
112
|
+
|
113
|
+
{
|
114
|
+
|
115
|
+
var targetingArrow = Instantiate(spellTargetingArrowPrefab).GetComponent<SpellTargetingArrow>();
|
116
|
+
|
117
|
+
boardCreature.GetComponent<BoardCreature>().abilitiesTargetingArrow = targetingArrow;
|
118
|
+
|
119
|
+
targetingArrow.effectTarget = targetableAbility.target;
|
120
|
+
|
121
|
+
targetingArrow.targetType = targetableAbility.target.GetTarget();
|
122
|
+
|
123
|
+
targetingArrow.onTargetSelected += () =>
|
124
|
+
|
125
|
+
{
|
126
|
+
|
127
|
+
PlayCreatureCard(card.card, targetingArrow.targetInfo);
|
128
|
+
|
129
|
+
effectSolver.MoveCard(netId, card.card, "Hand", "Board", targetingArrow.targetInfo);
|
130
|
+
|
131
|
+
currentCreature = null;
|
132
|
+
|
133
|
+
gameUI.endTurnButton.SetEnabled(true);
|
134
|
+
|
135
|
+
};
|
136
|
+
|
137
|
+
targetingArrow.Begin(boardCreature.transform.localPosition);
|
138
|
+
|
139
|
+
}
|
140
|
+
|
141
|
+
else
|
142
|
+
|
143
|
+
{
|
144
|
+
|
145
|
+
PlayCreatureCard(card.card);
|
146
|
+
|
147
|
+
effectSolver.MoveCard(netId, card.card, "Hand", "Board");
|
148
|
+
|
149
|
+
currentCreature = null;
|
150
|
+
|
151
|
+
gameUI.endTurnButton.SetEnabled(true);
|
152
|
+
|
153
|
+
}
|
154
|
+
|
155
|
+
boardCreature.GetComponent<BoardCreature>().fightTargetingArrowPrefab = fightTargetingArrowPrefab;
|
156
|
+
|
157
|
+
});
|
158
|
+
|
159
|
+
}
|
160
|
+
|
161
|
+
//スペルの場合
|
162
|
+
|
163
|
+
else if (cardType.name == "Spell")
|
164
|
+
|
165
|
+
{
|
166
|
+
|
167
|
+
var spellsPivot = GameObject.Find("PlayerSpellsPivot");
|
168
|
+
|
169
|
+
var sequence = DOTween.Sequence();
|
170
|
+
|
171
|
+
sequence.Append(card.transform.DOMove(spellsPivot.transform.position, 0.5f));
|
172
|
+
|
173
|
+
sequence.Insert(0, card.transform.DORotate(Vector3.zero, 0.2f));
|
174
|
+
|
175
|
+
sequence.Play().OnComplete(() =>
|
176
|
+
|
177
|
+
{
|
178
|
+
|
179
|
+
card.GetComponent<SortingGroup>().sortingLayerName = "BoardCards";
|
180
|
+
|
181
|
+
card.GetComponent<SortingGroup>().sortingOrder = 1000;
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
var boardSpell = card.gameObject.AddComponent<BoardSpell>();
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
var triggeredAbilities = libraryCard.abilities.FindAll(x => x is TriggeredAbility);
|
190
|
+
|
191
|
+
TriggeredAbility targetableAbility = null;
|
192
|
+
|
193
|
+
foreach (var ability in triggeredAbilities)
|
194
|
+
|
195
|
+
{
|
196
|
+
|
197
|
+
var triggeredAbility = ability as TriggeredAbility;
|
198
|
+
|
199
|
+
var trigger = triggeredAbility.trigger as OnCardEnteredZoneTrigger;
|
200
|
+
|
201
|
+
//トリガーがあり、ボードに入ることがトリガーで、且つユーザーがターゲットを指定している場合
|
202
|
+
|
203
|
+
if (trigger != null && trigger.zoneId == boardZone.zoneId && triggeredAbility.target is IUserTarget)
|
204
|
+
|
205
|
+
{
|
206
|
+
|
207
|
+
targetableAbility = triggeredAbility;
|
208
|
+
|
209
|
+
break;
|
210
|
+
|
211
|
+
}
|
212
|
+
|
213
|
+
}
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
currentSpellCard = card;
|
218
|
+
|
219
|
+
//ターゲットを取るアビリティがあり、且つターゲットがいる場合、ターゲットを指定してスペルの処理をする
|
220
|
+
|
221
|
+
if (targetableAbility != null && effectSolver.AreTargetsAvailable(targetableAbility.effect, card.card, targetableAbility.target))
|
222
|
+
|
223
|
+
{
|
224
|
+
|
225
|
+
var targetingArrow = Instantiate(spellTargetingArrowPrefab).GetComponent<SpellTargetingArrow>();
|
226
|
+
|
227
|
+
boardSpell.targetingArrow = targetingArrow;
|
228
|
+
|
229
|
+
targetingArrow.effectTarget = targetableAbility.target;
|
230
|
+
|
231
|
+
targetingArrow.targetType = targetableAbility.target.GetTarget();
|
232
|
+
|
233
|
+
targetingArrow.onTargetSelected += () =>
|
234
|
+
|
235
|
+
{
|
236
|
+
|
237
|
+
PlaySpellCard(card.card, targetingArrow.targetInfo);
|
238
|
+
|
239
|
+
effectSolver.MoveCard(netId, card.card, "Hand", "Board", targetingArrow.targetInfo);
|
240
|
+
|
241
|
+
currentSpellCard = null;
|
242
|
+
|
243
|
+
gameUI.endTurnButton.SetEnabled(true);
|
244
|
+
|
245
|
+
};
|
246
|
+
|
247
|
+
targetingArrow.Begin(boardSpell.transform.localPosition);
|
248
|
+
|
249
|
+
}
|
250
|
+
|
251
|
+
else
|
252
|
+
|
253
|
+
//そうでなければそのまま処理
|
254
|
+
|
255
|
+
{
|
256
|
+
|
257
|
+
PlaySpellCard(card.card);
|
258
|
+
|
259
|
+
effectSolver.MoveCard(netId, card.card, "Hand", "Board");
|
260
|
+
|
261
|
+
currentSpellCard = null;
|
262
|
+
|
263
|
+
gameUI.endTurnButton.SetEnabled(true);
|
264
|
+
|
265
|
+
}
|
266
|
+
|
267
|
+
});
|
268
|
+
|
269
|
+
}
|
270
|
+
|
271
|
+
}
|
272
|
+
|
273
|
+
else
|
274
|
+
|
275
|
+
{
|
276
|
+
|
277
|
+
card.GetComponent<HandCard>().ResetToInitialPosition();
|
278
|
+
|
279
|
+
}
|
280
|
+
|
281
|
+
}
|
284
282
|
|
285
283
|
```
|
286
284
|
|
287
|
-
|
288
|
-
|
289
|
-
### 聞きたいこと
|
290
|
-
|
291
|
-
|
285
|
+
上記メソッドの引数となっているCarViewクラスは、GUIでマウス左クリック時にぶつかったobjectを判定することによって値を取得してきているため、GUI描画のない、デッキやハンドの外からトークンBを選択することは出来ません。
|
292
|
-
|
293
|
-
慣れない質問で要領を得ない書き方になっているかもしれませんが、何卒よろしくお願い致します。
|
294
|
-
|
295
|
-
不足している情報があればコメントお願いします。
|