示例#1
0
 public override void DoAction(IEventArgs args)
 {
     if (inter)
     {
         if (fd != null)
         {
             fd.freeInventory.StopUseItem(args, fd, inter);
             SimpleProto msg = FreePool.Allocate();
             msg.Key = FreeMessageConstant.ChickenTip;
             msg.Ss.Add("word72," + ip.key.GetName());
             FreeMessageSender.SendMessage(fd.Player, msg);
             PlayerAnimationAction.DoAnimation(args.GameContext, PlayerAnimationAction.Stop, fd.Player);
             //FreeSoundUtil.Stop("use", args, fd);
             PlayerStateUtil.RemoveGameState(EPlayerGameState.InterruptItem, fd.Player.gamePlay);
             PlayerStateUtil.RemoveGameState(EPlayerGameState.UseItem, fd.Player.gamePlay);
         }
     }
     else
     {
         if (ip != null && fd != null)
         {
             UseItem(ip, fd, (ISkillArgs)args);
             fd.freeInventory.StopUseItem(args, fd, inter);
             PlayerAnimationAction.DoAnimation(args.GameContext, PlayerAnimationAction.Interrupt, fd.Player);
             PlayerStateUtil.RemoveGameState(EPlayerGameState.UseItem, fd.Player.gamePlay);
         }
     }
 }
示例#2
0
        public void StartUseItem(IEventArgs args, FreeData fd, ItemPosition ip, int sing, int sound)
        {
            PlayerStateUtil.RemoveGameState(EPlayerGameState.InterruptItem, fd.Player.gamePlay);
            fd.Player.playerMove.InterruptAutoRun();

            SkillTimeTrigger trigger = (SkillTimeTrigger)itemSkill.trigger;

            trigger.SetTime(sing * 1000);
            trigger.Reset();

            UsingItemAction interAction = (UsingItemAction)trigger.interAction;

            interAction.fd = fd;
            interAction.ip = ip;

            UsingItemAction action = (UsingItemAction)itemSkill.GetEffect();

            action.fd = fd;
            action.ip = ip;

            StartCounter(args, sing, fd, true);

            startUse = true;

            FreeSoundUtil.Stop("use", args, fd);

            if (sound > 0)
            {
                FreeSoundUtil.PlayOnce("use", sound, args, fd);
            }
        }
示例#3
0
        public override void DoAction(IEventArgs args)
        {
            if (inter)
            {
                if (fd != null)
                {
                    fd.freeInventory.StopUseItem(args, fd);
                    UseCommonAction use = new UseCommonAction();
                    use.key    = "showBottomTip";
                    use.values = new List <ArgValue>();
                    use.values.Add(new ArgValue("msg", "{desc:10072,{item.name}}"));

                    args.TempUse("current", fd);
                    args.TempUse("item", ip);
                    use.Act(args);
                    args.Resume("current");
                    args.Resume("item");
                    PlayerAnimationAction.DoAnimation(PlayerAnimationAction.Stop, fd.Player);
                    FreeSoundUtil.Stop("use", args, fd);

                    PlayerStateUtil.RemoveGameState(EPlayerGameState.InterruptItem, fd.Player.gamePlay);
                }
            }
            else
            {
                if (ip != null && fd != null)
                {
                    UseItem(ip, fd, (ISkillArgs)args);
                    fd.freeInventory.StopUseItem(args, fd);
                }
            }
        }
示例#4
0
 public void StopUseItem(IEventArgs args, FreeData fd, bool inter)
 {
     startUse = false;
     PlayerStateUtil.RemoveGameState(EPlayerGameState.UseItem, fd.Player.gamePlay);
     if (inter)
     {
         StartCounter(args, 0, fd, false);
     }
 }
示例#5
0
 public void StopAutoMove()
 {
     if (null != _playerMove)
     {
         _playerMove.IsAutoRun = false;
     }
     if (null != _gamePlay)
     {
         PlayerStateUtil.RemoveGameState(EPlayerGameState.InterruptItem, _gamePlay);
     }
 }
示例#6
0
        private void UpdatePlayerState(PlayerEntity player)
        {
            // 窒息状态
            var oxygen = player.oxygenEnergyInterface.Oxygen;

            if (oxygen.InDivingDeffState && !PlayerStateUtil.HasPlayerState(EPlayerGameState.DivingChok, player.gamePlay))
            {
                PlayerStateUtil.AddPlayerState(EPlayerGameState.DivingChok, player.gamePlay);
            }
            else if (PlayerStateUtil.HasPlayerState(EPlayerGameState.DivingChok, player.gamePlay))
            {
                PlayerStateUtil.RemoveGameState(EPlayerGameState.DivingChok, player.gamePlay);
            }
        }
示例#7
0
        public void StartUseItem(IEventArgs args, FreeData fd, ItemPosition ip, int sing, int sound)
        {
            PlayerStateUtil.RemoveGameState(EPlayerGameState.InterruptItem, fd.Player.gamePlay);
            fd.Player.autoMoveInterface.PlayerAutoMove.StopAutoMove();

            SkillTimeTrigger trigger = (SkillTimeTrigger)itemSkill.trigger;

            trigger.SetTime(sing * 1000);
            trigger.Reset();

            itemSkill.inter       = null;
            itemSkill.interAction = null;
            if (ip.key.GetClickSkill() != null)
            {
                PlayerActionSkill skill = ip.key.GetClickSkill() as PlayerActionSkill;
                if (skill != null && skill.inter != null)
                {
                    itemSkill.inter       = skill.inter;
                    itemSkill.interAction = skill.interAction;
                }
            }

            UsingItemAction interAction = (UsingItemAction)trigger.interAction;

            interAction.fd = fd;
            interAction.ip = ip;

            UsingItemAction action = (UsingItemAction)itemSkill.GetEffect();

            action.fd = fd;
            action.ip = ip;

            StartCounter(args, sing, fd, true);
            startUse = true;
            SetCurrentItem(ip, (ISkillArgs)args);
            SimpleProto data = FreePool.Allocate();

            data.Key = FreeMessageConstant.PlaySound;
            data.Ks.Add(0);
            data.Ins.Add(FreeUtil.ReplaceInt("{item.itemId}", args));
            fd.Player.network.NetworkChannel.SendReliable((int)EServer2ClientMessage.FreeData, data);
            PlayerStateUtil.AddPlayerState(EPlayerGameState.UseItem, fd.Player.gamePlay);
        }
示例#8
0
        public void AutoRemove(IEventArgs args, long serverTime)
        {
            Dictionary <int, List <long> > .Enumerator uiTimerIt = uiTimer.GetEnumerator();
            while (uiTimerIt.MoveNext())
            {
                List <long> times = uiTimerIt.Current.Value;
                int         count = times.Count;
                for (int i = count - 1; i >= 0; i--)
                {
                    if (times[i] < serverTime)
                    {
                        times.Remove(times[i]);
                        count--;
                    }
                }
                if (count == 0)
                {
                    PlayerStateUtil.RemoveUIState((EPlayerUIState)uiTimerIt.Current.Key, player.gamePlay);
                }
            }

            Dictionary <int, List <long> > .Enumerator gameTimerIt = gameTimer.GetEnumerator();
            while (gameTimerIt.MoveNext())
            {
                List <long> times = gameTimerIt.Current.Value;
                int         count = times.Count;
                for (int i = count - 1; i >= 0; i--)
                {
                    if (times[i] < serverTime)
                    {
                        times.Remove(times[i]);
                        count--;
                    }
                }
                if (count == 0)
                {
                    PlayerStateUtil.RemoveGameState((EPlayerGameState)gameTimerIt.Current.Key, player.gamePlay);
                }
            }
        }
        public override void DoAction(IEventArgs args)
        {
            EPlayerGameState uiState = (EPlayerGameState)FreeUtil.ReplaceInt(state, args);
            FreeData         p       = GetPlayer(args);

            if (p != null)
            {
                if (remove)
                {
                    PlayerStateUtil.RemoveGameState(uiState, p.Player.gamePlay);
                }
                else
                {
                    int realTime = FreeUtil.ReplaceInt(time, args);
                    if (realTime > 0)
                    {
                        p.StateTimer.AddGameStateTime(uiState, realTime + args.Rule.ServerTime);
                    }
                    PlayerStateUtil.AddPlayerState(uiState, p.Player.gamePlay);
                }
            }
        }
示例#10
0
        public void AutoRemove(IEventArgs args, long serverTime)
        {
            foreach (int key in uiTimer.Keys)
            {
                List <long> times = uiTimer[key];
                for (int i = times.Count - 1; i >= 0; i--)
                {
                    if (times[i] < serverTime)
                    {
                        times.Remove(times[i]);
                    }
                }

                if (times.Count == 0)
                {
                    PlayerStateUtil.RemoveUIState((EPlayerUIState)key, player.gamePlay);
                }
            }

            foreach (int key in gameTimer.Keys)
            {
                List <long> times = gameTimer[key];
                for (int i = times.Count - 1; i >= 0; i--)
                {
                    if (times[i] < serverTime)
                    {
                        times.Remove(times[i]);
                    }
                }

                if (times.Count == 0)
                {
                    PlayerStateUtil.RemoveGameState((EPlayerGameState)key, player.gamePlay);
                }
            }
        }