コード例 #1
0
ファイル: FantasyFighterPlayer.cs プロジェクト: d3x0r/xperdex
 void Dispose()
 {
     arena   = null;
     fighter = null;
     socket  = null;
     client  = null;
     buffer  = null;
     reader  = null;
 }
コード例 #2
0
ファイル: FantasyArenaList.cs プロジェクト: d3x0r/xperdex
        internal static FantasyArena CreateArena(string name)
        {
            FantasyArena arena = GetArena(name);

            if (arena == null)
            {
                arena = new FantasyArena(name);
                arenas.Add(arena);
            }
            return(arena);
        }
コード例 #3
0
ファイル: FantasyArenaList.cs プロジェクト: d3x0r/xperdex
        public static FantasyArena JoinArena(FantasyFighterPlayer fighter, string name)
        {
            FantasyArena arena = GetArena(name);

            if (arena != null)
            {
                arena.Add(fighter);
                FantasyServer.lobby_fighters.Remove(fighter);
            }
            return(arena);
        }
コード例 #4
0
ファイル: FantasyFighterPlayer.cs プロジェクト: d3x0r/xperdex
        void HandleMessage(MessageCommon msg)
        {
            switch (msg.message_type)
            {
            case MessageCommon.FantasyFighterMessage.Login:
                fighter.name = (msg as FantasyLoginMessage).username;
                events(fighter.name + " connected");
                //MessageBox.Show( (msg as FantasyLoginMessage).username + " connected" );
                break;

            case MessageCommon.FantasyFighterMessage.ChangeWeapon:
                fighter.weapon = (msg as FantasyFighterWeapon).weapon;
                arena.NotifyPeers(this);
                events(fighter.name + " new weapon " + fighter.weapon);
                break;

            case MessageCommon.FantasyFighterMessage.ChangeStance:
                fighter.stance = (msg as FantasyFighterStance).stance;
                arena.NotifyPeers(this);
                events(fighter.name + " new stance " + fighter.weapon);
                break;

            case MessageCommon.FantasyFighterMessage.CreateArena:
                FantasyArena      created = FantasyArenaList.CreateArena((msg as FantasyArenaCreate).arena_name);
                FantasyArenaAdded added   = new FantasyArenaAdded(created.name);
                Byte[]            output  = added.Serialize();
                foreach (FantasyFighterPlayer player in FantasyServer.lobby_fighters)
                {
                    player.Send(output);
                }
                break;

            case MessageCommon.FantasyFighterMessage.JoinArena:
                arena = FantasyArenaList.JoinArena(this, (msg as FantasyArenaJoin).arena_name);

                {
                    FantasyFighterProtocol.FantasyArenaJoined send = new FantasyFighterProtocol.FantasyArenaJoined(arena.name);
                    Send(send.Serialize());
                }
                break;

            case MessageCommon.FantasyFighterMessage.ListArenas:
            {
                FantasyFighterProtocol.FantasyArenaList send = new FantasyFighterProtocol.FantasyArenaList(FantasyArenaList.GetNames());
                Send(send.Serialize());
            }
            break;
            }
        }