protected override void Execute(IOnlineConnection Sender)
        {
            FightingZone NewGame = new FightingZone(Owner.MapPath, Owner.UseTeams, OnlineServer, CreatedGroup);

            GameRules Rules = new BattleGameRules(Owner, NewGame);

            NewGame.Rules = Rules;

            CreatedGroup.SetGame(NewGame);

            for (int P = 0; P < CreatedGroup.Room.ListOnlinePlayer.Count; P++)
            {
                IOnlineConnection ActiveOnlinePlayer = CreatedGroup.Room.ListOnlinePlayer[P];
                Player            ActivePlayer       = Owner.ListRoomPlayer[P];
                ActivePlayer.OnlineClient = ActiveOnlinePlayer;

                NewGame.AddLocalCharacter(ActivePlayer);

                //Add Game Specific scripts
                Dictionary <string, OnlineScript> DicNewScript = OnlineHelper.GetTripleThunderScriptsServer(CreatedGroup, ActivePlayer);
                ActiveOnlinePlayer.AddOrReplaceScripts(DicNewScript);
            }

            for (int P = 0; P < CreatedGroup.Room.ListOnlinePlayer.Count; P++)
            {
                IOnlineConnection ActiveOnlinePlayer = CreatedGroup.Room.ListOnlinePlayer[P];
                ActiveOnlinePlayer.Send(new CreateGameScriptServer());
            }
        }
Пример #2
0
        protected override void Execute(IOnlineConnection Sender)
        {
            FightingZone NewGame = new FightingZone(Owner.MapPath, Owner.UseTeams, OnlineServer, CreatedGroup);

            GameRules Rules = new MissionGameRules(Owner, NewGame);
            NewGame.Rules = Rules;

            CreatedGroup.SetGame(NewGame);

            for (int P = 0; P < CreatedGroup.Room.ListOnlinePlayer.Count; P++)
            {
                IOnlineConnection ActiveOnlinePlayer = CreatedGroup.Room.ListOnlinePlayer[P];
                Player ActivePlayer = Owner.ListRoomPlayer[P];
                ActivePlayer.OnlineClient = ActiveOnlinePlayer;

                NewGame.AddLocalCharacter(ActivePlayer);

                //Add Game Specific scripts
                Dictionary<string, OnlineScript> DicNewScript = new Dictionary<string, OnlineScript>();
                DicNewScript.Add(FinishedLoadingScriptServer.ScriptName, new FinishedLoadingScriptServer(CreatedGroup));
                DicNewScript.Add(SendPlayerUpdateScriptServer.ScriptName, new SendPlayerUpdateScriptServer(CreatedGroup, ActivePlayer));
                DicNewScript.Add(ShootBulletScriptServer.ScriptName, new ShootBulletScriptServer(CreatedGroup, ActivePlayer));
                DicNewScript.Add(AskTripleThunderGameDataScriptServer.ScriptName, new AskTripleThunderGameDataScriptServer(CreatedGroup));
                ActiveOnlinePlayer.AddOrReplaceScripts(DicNewScript);
            }

            for (int P = 0; P < CreatedGroup.Room.ListOnlinePlayer.Count; P++)
            {
                IOnlineConnection ActiveOnlinePlayer = CreatedGroup.Room.ListOnlinePlayer[P];
                ActiveOnlinePlayer.Send(new CreateGameScriptServer());
            }
        }
Пример #3
0
        protected override void OnJoinRoomLocal(IOnlineConnection Sender, string RoomID, GameClientGroup ActiveGroup)
        {
            RoomInformations JoinedRoom            = (RoomInformations)ActiveGroup.Room;
            List <Player>    ListJoiningPlayerInfo = JoinedRoom.GetOnlinePlayer(Sender);

            foreach (IOnlineConnection ActivePlayer in ActiveGroup.Room.ListOnlinePlayer)
            {
                if (ActivePlayer == Sender)
                {
                    continue;
                }

                ActivePlayer.Send(new PlayerJoinedScriptServer(ListJoiningPlayerInfo));
            }

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

            if (JoinedRoom.RoomType == RoomInformations.RoomTypeMission)
            {
                MissionRoomInformations MissionRoom = (MissionRoomInformations)JoinedRoom;

                DicNewScript.Add(AskStartGameMissionScriptServer.ScriptName, new AskStartGameMissionScriptServer(MissionRoom, (TripleThunderClientGroup)ActiveGroup, Owner));
                DicNewScript.Add(AskChangeRoomExtrasMissionScriptServer.ScriptName, new AskChangeRoomExtrasMissionScriptServer(MissionRoom));
            }
            else if (JoinedRoom.RoomType == RoomInformations.RoomTypeBattle)
            {
                BattleRoomInformations BattleRoom = (BattleRoomInformations)JoinedRoom;

                DicNewScript.Add(AskStartGameMissionScriptServer.ScriptName, new AskStartGameBattleScriptServer(BattleRoom, (TripleThunderClientGroup)ActiveGroup, Owner));
                DicNewScript.Add(AskChangeRoomExtrasBattleScriptServer.ScriptName, new AskChangeRoomExtrasBattleScriptServer(BattleRoom));
            }
            Sender.AddOrReplaceScripts(DicNewScript);

            if (ActiveGroup.CurrentGame != null)
            {
                FightingZone CurrentGame = (FightingZone)ActiveGroup.CurrentGame;

                foreach (Player ActivePlayer in ListJoiningPlayerInfo)
                {
                    CurrentGame.AddLocalCharacter(ActivePlayer);
                    ActivePlayer.OnlineClient = Sender;

                    int LayerIndex;
                    CurrentGame.AddPlayerFromSpawn(ActivePlayer, CurrentGame.NextRobotID + (uint.MaxValue - 100), true, out LayerIndex);

                    //Add Game Specific scripts
                    DicNewScript = OnlineHelper.GetTripleThunderScriptsServer((TripleThunderClientGroup)ActiveGroup, ActivePlayer);
                    Sender.AddOrReplaceScripts(DicNewScript);

                    foreach (IOnlineConnection OtherPlayer in ActiveGroup.Room.ListOnlinePlayer)
                    {
                        if (OtherPlayer == Sender)
                        {
                            continue;
                        }

                        OtherPlayer.Send(new CreatePlayerScriptServer(ActivePlayer, LayerIndex, false));
                    }
                }
            }

            Sender.Send(new JoinRoomLocalScriptServer(RoomID, JoinedRoom.CurrentDifficulty, ListJoiningPlayerInfo, ActiveGroup));
        }