コード例 #1
0
ファイル: MenuScence.cs プロジェクト: ynhj123/CSharpStudy
 private void HandleKey(char keyChar)
 {
     if ('1' == keyChar)
     {
         ScenceController.curScence = ScenceController.scenceDict["room"];
         MsgListRoom msgListRoom = new MsgListRoom();
         NetManagerEvent.Send(msgListRoom);
     }
     else if ('2' == keyChar)
     {
     }
     else if ('3' == keyChar)
     {
     }
     else if ('4' == keyChar)
     {
     }
     else if ('5' == keyChar)
     {
         ScenceController.isLeavel = true;
         NetManagerEvent.Close();
     }
     else
     {
         Handle();
     }
 }
コード例 #2
0
ファイル: KeywordSystem.cs プロジェクト: ynhj123/CSharpStudy
        private void handleKey(ConsoleKey key)
        {
            switch (key)
            {
            case ConsoleKey.UpArrow:
                player.Velocity.Veloctity = Component.Veloctity.up;
                player.IsMove             = true;
                break;

            case ConsoleKey.DownArrow:
                player.Velocity.Veloctity = Component.Veloctity.down;
                player.IsMove             = true;
                break;

            case ConsoleKey.LeftArrow:
                player.Velocity.Veloctity = Component.Veloctity.left;
                player.IsMove             = true;
                break;

            case ConsoleKey.RightArrow:
                player.Velocity.Veloctity = Component.Veloctity.right;
                player.IsMove             = true;
                break;

            case ConsoleKey.Spacebar:
                player.IsMove = false;
                break;

            case ConsoleKey.A:
                if (player.AttchInterval == 5)
                {
                    MsgAttack msgAttack = new MsgAttack();
                    msgAttack.playId = player.Id;
                    NetManagerEvent.Send(msgAttack);
                    player.AttchInterval = 1;
                }
                break;

            default:
                break;
            }
        }
コード例 #3
0
        public void Execute()
        {
            List <Sprite> players = scence.sprites.Where(spirte => spirte is Player).ToList();

            foreach (Player player in players)
            {
                if (autoPlayer.Contains(player) && player.AttchInterval == 5)
                {
                    MsgAttack msgAttack = new MsgAttack();
                    msgAttack.playId = player.Id;
                    NetManagerEvent.Send(msgAttack);
                    player.AttchInterval = 1;
                }
                else
                {
                    if (player.AttchInterval < 5)
                    {
                        player.AttchInterval += 1;
                    }
                }
            }
        }
コード例 #4
0
        public void Execute()
        {
            var sprites = scence.sprites;
            //碰撞监听
            Player player = (Player)sprites.Where(sprite => sprite.GetType() == typeof(Player) && sprite.Id == ScenceController.user.Userid).FirstOrDefault();

            if (player != null)
            {
                List <Sprite> skills = sprites.Where(sprite => sprite.GetType() == typeof(Skill)).ToList();
                for (int j = skills.Count - 1; j >= 0; j--)
                {
                    if (player.Position.X == skills[j].Position.X && player.Position.Y == skills[j].Position.Y)
                    {
                        SpriteDestorySystem spriteDestorySystem = SpriteDestorySystem.GetSpriteDestorySystem();
                        spriteDestorySystem.sprites.Enqueue(player);
                        MsgLeave msgLeave = new MsgLeave
                        {
                            playId = player.Id
                        };
                        NetManagerEvent.Send(msgLeave);
                    }
                }
            }
        }