Esempio n. 1
0
        public static void SendToAllClient_MonsterState(CharacterState character, State state)
        {
            Packet.GCAckMonsterState packet = new Packet.GCAckMonsterState();
            packet.uniqueID = ((MonsterCharacter)character).UniqueID;
            packet.typeID   = 1;//
            packet.state    = state.ID;
            packet.posX     = character.transform.position.X.ToString();
            packet.posY     = character.transform.position.Y.ToString();
            packet.posZ     = character.transform.position.Z.ToString();
            packet.dirX     = character.transform.forward.X.ToString();
            packet.dirY     = character.transform.forward.Y.ToString();
            packet.dirZ     = character.transform.forward.Z.ToString();

            string jsonPacket = JsonMapper.ToJson(packet);

            try
            {
                lock (GameServer.Program.ms_ClientList)
                {
                    foreach (GameServer.UserObject obj in GameServer.Program.ms_ClientList)
                    {
                        obj.Send(jsonPacket);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Esempio n. 2
0
        public static void SendToAllClient_MonsterState(CharacterState character, State state)
        {
            Packet.GCAckMonsterState packet = new Packet.GCAckMonsterState();
            packet.uniqueID = ((MonsterCharacter)character).UniqueID;
            packet.typeID = 1;//
            packet.state = state.ID;
            packet.posX = character.transform.position.X.ToString();
            packet.posY = character.transform.position.Y.ToString();
            packet.posZ = character.transform.position.Z.ToString();
            packet.dirX = character.transform.forward.X.ToString();
            packet.dirY = character.transform.forward.Y.ToString();
            packet.dirZ = character.transform.forward.Z.ToString();

            string jsonPacket = JsonMapper.ToJson(packet);

            try
            {
                lock (GameServer.Program.ms_ClientList)
                {
                    foreach (GameServer.UserObject obj in GameServer.Program.ms_ClientList)
                    {
                        obj.Send(jsonPacket);
                    }
                }
            }
            catch(Exception ex)
            {
                Console.WriteLine(ex);
            }
        }