public void SlotClick(BattleSlot battleSlot) { if (_selectBattleSlot == null) { if (_selectBagSlot != null) { _selectBagSlot.Deselect(); _selectBagSlot = null; } _selectBattleSlot = battleSlot; battleSlot.Select(); } else //has selected a battleSlot { if (_selectBattleSlot.Index == battleSlot.Index) //Click the same slot,deselect { battleSlot.Deselect(); _selectBattleSlot = null; } else if (_selectBattleSlot.concreteCard == null) { _selectBattleSlot.Deselect(); _selectBattleSlot = battleSlot; _selectBattleSlot.Select(); } else { _selectBattleSlot.Deselect(); ConcreteCard first = _selectBattleSlot.concreteCard, second = battleSlot.concreteCard; int indexFst = _selectBattleSlot.Index, indexSec = battleSlot.Index; _player.playCardSet [indexFst] = second; _player.playCardSet [indexSec] = first; HOTween.To(_selectBattleSlot.slotBody, _fadeDuration, new TweenParms().Prop("alpha", 0f).Ease(EaseType.Linear).OnStart(() => { _shieldPanel.Activate(); }).OnComplete(() => { if (second != null) { _selectBattleSlot.LoadConcreteCard(second); HOTween.To(_selectBattleSlot.slotBody, _fadeDuration, new TweenParms().Prop("alpha", 1f).Ease(EaseType.Linear).OnComplete(() => { _shieldPanel.Deactivate(); _selectBattleSlot = null; })); } else { _shieldPanel.Deactivate(); _selectBattleSlot.Unload(); _selectBattleSlot = null; } })); HOTween.To(battleSlot.slotBody, _fadeDuration, new TweenParms().Prop("alpha", 0f).Ease(EaseType.Linear).OnStart(() => { _shieldPanel.Activate(); }).OnComplete(() => { battleSlot.LoadConcreteCard(first); HOTween.To(battleSlot.slotBody, _fadeDuration, new TweenParms().Prop("alpha", 1f).Ease(EaseType.Linear).OnComplete(() => { _shieldPanel.Deactivate(); })); })); } } }