12 this.source = e.source;
14 this.act =
ACT.Create(this.source);
17 Debug.Log(this.source.alias);
19 Sprite iconType = this.act.TargetType.IconType;
20 this.imageType.SetActive(iconType);
21 this.imageType.sprite = iconType;
22 this.act.SetImage(this.icon);
23 if (
EClass.game.altAbility)
25 this.textStock.SetActive(e is
Spell);
26 this.textStock.text = (e.vPotential.ToString() ??
"");
27 this.onRightClick = delegate()
39 this.mainText.SetText(e.Name);
41 base.SetTooltip(
"note", delegate(UITooltip t)
43 e.WriteNote(t.note,
this.chara.elements, delegate(UINote n)
45 e._WriteNote(t.note,
this.chara,
this.act);
48 this.RefreshFavIcon();
52 public void OnDrag(PointerEventData data)
54 if (this.dragParent ==
null)
58 if (data.button != PointerEventData.InputButton.Left)
65 this.dragParent.OnStartDrag(
this);
66 base.OnPointerUpOnDrag(data);
69 this.dragParent.OnDrag(
this);
73 public override void OnPointerUp(PointerEventData eventData)
78 this.dragParent.OnEndDrag(
this,
false);
81 base.OnPointerUp(eventData);
92 if (this.CanAutoUse(this.act))
96 EClass.player.EndTurn(
true);
107 public static bool TryUse(
Act act,
Card tg =
null,
Point pos =
null,
Card catalyst =
null,
bool first =
true,
bool mouse =
true)
116 pos =
EClass.pc.pos.Copy();
118 if (first && EInput.GetHotkey() != -1)
121 ButtonAbility.hotkeyTimer = 0f;
122 Debug.Log(EInput.GetHotkey());
124 if (act.HaveLongPressAction)
126 if ((mouse && EInput.rightMouse.pressedLong) || (!mouse &&
ButtonAbility.hotkeyTimer >= 0.45f))
128 EInput.rightMouse.Consume();
130 ButtonAbility.hotkeyTimer = 1f;
132 if ((mouse && EInput.rightMouse.pressing) || (!mouse && EInput.GetHotkey() != -1 &&
ButtonAbility.hotkeyTimer < 1f))
134 ButtonAbility.hotkeyTimer += Core.delta;
135 EClass.core.actionsNextFrame.Add(delegate
141 EClass.core.actionsNextFrame.Add(delegate
143 EInput.rightMouse.down =
false;
144 EInput.rightMouse.consumed =
false;
145 EInput.rightMouse.pressing =
true;
146 EInput.rightMouse.usedMouse =
true;
154 EClass.player.EndTurn(
true);
156 else if (
EClass.pc.UseAbility(act.source.alias, tg, pos, flag))
158 EClass.player.EndTurn(
true);
160 if (catalyst !=
null)
168 public static bool SpecialHoldAction(
Act act)
176 if (
id == 8230 ||
id == 8232)
187 if (
EClass.pc.mana.value < e.GetCost(
EClass.pc).cost && !first)
191 if (e.vPotential <= 0)
199 if (t.rarity >= Rarity.Mythical && e.id == 8230)
203 EClass.pc.UseAbility(act.source.alias, t,
EClass.pc.pos,
false);
204 Debug.Log(t.IsIdentified.ToString() +
"/" + ((t !=
null) ? t.ToString() :
null));
211 Msg.Say(
"identify_nothing");
219 public void HoldAbility()
226 public bool CanAutoUse(
Act _act)
228 return _act.TargetType.CanSelectSelf && (!EClass._zone.IsRegion || !_act.LocalAct);
232 public bool ShowMouseHintLeft()
238 public string GetTextMouseHintLeft()
244 public bool ShowMouseHintRight()
246 return this.CanAutoUse(
ACT.Create(
this.source));
250 public string GetTextMouseHintRight()
252 return "actUse".lang();
256 public override bool CanMiddleClick()
258 return EClass.ui.AllowInventoryInteractions;
262 public override void OnMiddleClick()
264 if (EInput.middleMouse.clicked)
268 EInput.middleMouse.pressedLongAction = delegate()
270 if (
EClass.ui.AllowInventoryInteractions)
273 EInput.Consume(
false, 1);
279 public void ToggleFav()
281 if (
EClass.player.favAbility.Contains(
this.source.id))
283 EClass.player.favAbility.Remove(this.source.id);
288 EClass.player.favAbility.Add(this.source.id);
291 this.RefreshFavIcon();
296 public void RefreshFavIcon()
298 bool enable =
EClass.player.favAbility.Contains(this.source.id);
299 this.imageFav.SetActive(enable);
306 public IDragParent dragParent;
309 public UIText textStock;
312 public Image imageType;
315 public Image imageFav;
318 public Transform attach;
321 public Transform transFav;
334 public static float hotkeyTimer;