Ejemplo n.º 1
0
 public override bool update(TableManager table, THHGame.TurnStartEventArg eventArg)
 {
     if (!_timer.isStarted)
     {
         _timer.start();
         table.ui.TurnTipImage.display();
         if (eventArg.player == table.player)
         {
             table.ui.TurnTipText.text = "你的回合";
             table.canControl          = true;
         }
         else
         {
             table.ui.TurnTipText.text = "对手的回合";
             table.canControl          = false;
         }
         table.ui.TurnTipImage.GetComponent <Animator>().Play("Display");
         foreach (var player in table.game.players)
         {
             table.setSkill(player == table.player ? table.ui.SelfSkill : table.ui.EnemySkill, player.skill);
             foreach (var card in player.field)
             {
                 var servant = table.getServant(card);
                 table.setServant(servant, card);
             }
         }
     }
     if (!_timer.isExpired())
     {
         return(false);
     }
     table.ui.TurnTipImage.hide();
     table.ui.TurnEndButton.interactable = eventArg.player == table.player;
     return(true);
 }
Ejemplo n.º 2
0
 public override bool update(TableManager table, THHCard.HealEventArg eventArg)
 {
     if (!_timer.isStarted)
     {
         foreach (var card in eventArg.cards)
         {
             if (table.tryGetServant(card, out Servant servant))
             {
                 servant.HealImage.display();
                 servant.HealText.text = "+" + eventArg.infoDic[card].healedValue.ToString();
                 table.setServant(table.getServant(card), card);
             }
         }
         _timer.start();
     }
     foreach (var card in eventArg.cards)
     {
         if (table.tryGetServant(card, out Servant servant))
         {
             servant.HealImage.setAlpha(_timer.progress);
             servant.HealText.setAlpha(_timer.progress);
         }
     }
     if (!_timer.isExpired())
     {
         return(false);
     }
     foreach (var card in eventArg.cards)
     {
         if (table.tryGetServant(card, out Servant servant))
         {
             servant.HealImage.hide();
         }
     }
     return(true);
 }
Ejemplo n.º 3
0
 public override bool update(TableManager table, THHCard.AttackEventArg eventArg)
 {
     if (table.tryGetMaster(eventArg.card, out var attackMaster))
     {
         if (table.tryGetMaster(eventArg.target, out var targetMaster))
         {
             attackMaster.GetComponentInChildren <PositionLerp>().setTarget(targetMaster.rectTransform, targetMaster.rectTransform.sizeDelta.x / 2);
             if (!SimpleAnimHelper.update(table, ref _attackAnim, attackMaster.onAttack, attackMaster.animator))
             {
                 return(false);
             }
             if (!SimpleAnimHelper.update(table, ref _attackedAnim, targetMaster.onAttacked, targetMaster.animator))
             {
                 return(false);
             }
         }
         else if (table.tryGetServant(eventArg.target, out var targetServant))
         {
             attackMaster.GetComponentInChildren <PositionLerp>().setTarget(targetServant.rectTransform, targetServant.rectTransform.sizeDelta.x / 2);
             if (!SimpleAnimHelper.update(table, ref _attackAnim, attackMaster.onAttack, attackMaster.animator))
             {
                 return(false);
             }
             if (!SimpleAnimHelper.update(table, ref _attackedAnim, targetServant.onAttacked, targetServant.animator))
             {
                 return(false);
             }
         }
         table.setMaster(attackMaster, eventArg.card);
     }
     else if (table.getServant(eventArg.card) is Servant attackServant)
     {
         if (table.tryGetMaster(eventArg.target, out var targetMaster))
         {
             attackServant.GetComponentInChildren <PositionLerp>().setTarget(targetMaster.rectTransform, targetMaster.rectTransform.sizeDelta.x / 2);
             if (!SimpleAnimHelper.update(table, ref _attackAnim, attackServant.onAttack, attackServant.animator))
             {
                 return(false);
             }
             if (!SimpleAnimHelper.update(table, ref _attackedAnim, targetMaster.onAttacked, targetMaster.animator))
             {
                 return(false);
             }
         }
         else if (table.tryGetServant(eventArg.target, out var targetServant))
         {
             attackServant.GetComponentInChildren <PositionLerp>().setTarget(targetServant.rectTransform, targetServant.rectTransform.sizeDelta.x / 2);
             if (!SimpleAnimHelper.update(table, ref _attackAnim, attackServant.onAttack, attackServant.animator))
             {
                 return(false);
             }
             if (!SimpleAnimHelper.update(table, ref _attackedAnim, targetServant.onAttacked, targetServant.animator))
             {
                 return(false);
             }
         }
         //if (table.tryGetMaster(eventArg.target, out var targetMaster))
         //{
         //    if (!_timer1.isStarted)
         //        _timer1.start();
         //    attackServant.getChild("Root").position =
         //        Vector3.Lerp(attackServant.rectTransform.position, targetMaster.rectTransform.position,
         //        attackServant.attackAnimationCurve.Evaluate(_timer1.progress));
         //    if (!_timer1.isExpired())
         //        return false;
         //    if (!_timer2.isStarted)
         //        _timer2.start();
         //    attackServant.getChild("Root").position =
         //        Vector3.Lerp(targetMaster.rectTransform.position, attackServant.rectTransform.position,
         //        attackServant.attackAnimationCurve.Evaluate(_timer2.progress));
         //    if (!_timer2.isExpired())
         //        return false;
         //}
         //else if (table.getServant(eventArg.target) is Servant targetServant)
         //{
         //    if (!_timer1.isStarted)
         //        _timer1.start();
         //    attackServant.getChild("Root").position =
         //        Vector3.Lerp(attackServant.rectTransform.position, targetServant.rectTransform.position,
         //        attackServant.attackAnimationCurve.Evaluate(_timer1.progress));
         //    if (!_timer1.isExpired())
         //        return false;
         //    if (!_timer2.isStarted)
         //        _timer2.start();
         //    attackServant.getChild("Root").position =
         //        Vector3.Lerp(targetServant.rectTransform.position, attackServant.rectTransform.position,
         //        attackServant.attackAnimationCurve.Evaluate(_timer2.progress));
         //    if (!_timer2.isExpired())
         //        return false;
         //}
         table.setServant(attackServant, eventArg.card);
     }
     return(true);
 }