Example #1
0
        protected override void Execute(IOnlineConnection Host)
        {
            FightingZone NewGame = new FightingZone(Owner);
            GameRules    Rules   = new MissionGameRules(Room, NewGame);

            NewGame.Rules = Rules;

            NewGame.ListGameScreen = ListGameScreen;
            NewGame.PushScreen(new LoadingScreen(NewGame, Owner));

            Dictionary <string, OnlineScript> DicNewScript = OnlineHelper.GetTripleThunderScriptsClient(Owner);

            Host.AddOrReplaceScripts(DicNewScript);
        }
        protected override void Execute(IOnlineConnection Host)
        {
            OnlineGameClient.RoomID = RoomID;

            Dictionary <string, OnlineScript> DicNewGameServerScript = new Dictionary <string, OnlineScript>();
            IMissionSelect   NewMissionSelectScreen;
            RoomInformations NewRoom;
            FightingZone     NewFightingZone = null;

            if (HasGame)
            {
                NewFightingZone = new FightingZone(OnlineGameClient);
                NewFightingZone.ListGameScreen = ScreenOwner.ListGameScreen;

                DicNewGameServerScript = OnlineHelper.GetTripleThunderScriptsClient(OnlineGameClient);
                Host.IsGameReady       = true;
            }
            if (RoomType == RoomInformations.RoomTypeMission)
            {
                MissionRoomInformations MissionRoom = new MissionRoomInformations(RoomID, RoomName, RoomType, RoomSubtype, CurrentDifficulty, MapPath, ListJoiningPlayerID, RoomData);
                if (HasGame)
                {
                    NewFightingZone.Rules = new MissionGameRules(MissionRoom, NewFightingZone);
                }

                NewRoom = MissionRoom;

                MissionSelect NewMissionSelect = new MissionSelect(OnlineGameClient, OnlineCommunicationClient, MissionRoom);
                NewScreen = NewMissionSelect;
                NewMissionSelectScreen = NewMissionSelect;

                DicNewGameServerScript.Add(CreateGameMissionScriptClient.ScriptName, new CreateGameMissionScriptClient(OnlineGameClient, ScreenOwner.ListGameScreen, MissionRoom));
                DicNewGameServerScript.Add(ChangeRoomExtrasBattleScriptClient.ScriptName, new ChangeRoomExtrasMissionScriptClient(MissionRoom, NewMissionSelect));
            }
            else
            {
                BattleRoomInformations BattleRoom = new BattleRoomInformations(RoomID, RoomName, RoomType, RoomSubtype, CurrentDifficulty, MapPath, ListJoiningPlayerID, RoomData);
                if (HasGame)
                {
                    NewFightingZone.Rules = new BattleGameRules(BattleRoom, NewFightingZone);
                }

                NewRoom = BattleRoom;

                BattleSelect NewBattleSelect = new BattleSelect(OnlineGameClient, OnlineCommunicationClient, BattleRoom);
                NewScreen = NewBattleSelect;
                NewMissionSelectScreen = NewBattleSelect;

                DicNewGameServerScript.Add(CreateGameMissionScriptClient.ScriptName, new CreateGameBattleScriptClient(OnlineGameClient, ScreenOwner.ListGameScreen, BattleRoom));
                DicNewGameServerScript.Add(ChangeRoomExtrasBattleScriptClient.ScriptName, new ChangeRoomExtrasBattleScriptClient(BattleRoom, NewBattleSelect));
            }

            if (HasGame)
            {
                ScreenOwner.PushScreen(new LoadingScreen(NewFightingZone, OnlineGameClient));
            }

            DicNewGameServerScript.Add(PlayerJoinedScriptClient.ScriptName, new PlayerJoinedScriptClient(NewMissionSelectScreen));
            DicNewGameServerScript.Add(PlayerLeftScriptClient.ScriptName, new PlayerLeftScriptClient(NewRoom, OnlineGameClient, NewMissionSelectScreen));
            DicNewGameServerScript.Add(ChangeCharacterScriptClient.ScriptName, new ChangeCharacterScriptClient(NewRoom, NewMissionSelectScreen));
            DicNewGameServerScript.Add(ChangePlayerTypeScriptClient.ScriptName, new ChangePlayerTypeScriptClient(NewRoom, NewMissionSelectScreen));
            DicNewGameServerScript.Add(ChangeTeamScriptClient.ScriptName, new ChangeTeamScriptClient(NewRoom));
            DicNewGameServerScript.Add(ChangeMapScriptClient.ScriptName, new ChangeMapScriptClient(NewRoom, NewMissionSelectScreen));
            DicNewGameServerScript.Add(ChangeRoomSubtypeScriptClient.ScriptName, new ChangeRoomSubtypeScriptClient(NewMissionSelectScreen));

            Host.AddOrReplaceScripts(DicNewGameServerScript);

            if (OnlineCommunicationClient.Host != null)
            {
                OnlineCommunicationClient.Chat.InsertTab(RoomID, "Chat");
                OnlineCommunicationClient.Chat.CloseTab("Global");
                OnlineCommunicationClient.Host.Send(new CreateOrJoinCommunicationGroupScriptClient(RoomID, false));
                OnlineCommunicationClient.Host.Send(new LeaveCommunicationGroupScriptClient("Global"));
            }

            OnlineGameClient.DelayOnlineScript(this);
        }