コード例 #1
0
ファイル: BagManagement.cs プロジェクト: xxl534/CardProject
 public void SlotClick(BagSlot bagSlot)
 {
     if (_selectBattleSlot == null)
     {
         if (_selectBagSlot != null)
         {
             _selectBagSlot.Deselect();
         }
         _selectBagSlot = bagSlot;
         _selectBagSlot.Select();
     }
     else
     {
         _selectBattleSlot.Deselect();
         ConcreteCard first = _selectBattleSlot.concreteCard, second = bagSlot.concreteCard;
         int          index = _selectBattleSlot.Index;
         _player.playCardSet [index] = second;
         _player.cardBag.Remove(second);
         if (first != null)
         {
             _player.cardBag.Add(first);
         }
         HOTween.To(_selectBattleSlot.slotBody, _fadeDuration, new TweenParms().Prop("alpha", 0f).Ease(EaseType.Linear).OnStart(() => {
             _shieldPanel.Activate();
         }).OnComplete(() => {
             _selectBattleSlot.LoadConcreteCard(second);
             HOTween.To(_selectBattleSlot.slotBody, _fadeDuration, new TweenParms().Prop("alpha", 1f).Ease(EaseType.Linear).OnComplete(() => {
                 _shieldPanel.Deactivate();
                 _selectBattleSlot = null;
             }));
         }));
         Debug.Log(bagSlot.slotBody == null);
         HOTween.To(bagSlot.slotBody, _fadeDuration, new TweenParms().Prop("alpha", 0f).Ease(EaseType.Linear).OnStart(() => {
             _shieldPanel.Activate();
         }).OnComplete(() => {
             if (first != null)
             {
                 bagSlot.LoadConcreteCard(first);
                 HOTween.To(bagSlot.slotBody, _fadeDuration, new TweenParms().Prop("alpha", 1f).Ease(EaseType.Linear).OnComplete(() => {
                     _shieldPanel.Deactivate();
                 }));
             }
             else
             {
                 _shieldPanel.Deactivate();
                 _grid.RemoveChild(bagSlot.transform);
                 _bagSlots.Remove(bagSlot);
                 Destroy(bagSlot.gameObject);
             }
         }));
     }
 }