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()); } }
protected override void Execute(IOnlineConnection Host) { foreach (Player JoiningPlayer in ListJoiningPlayer) { NewMissionSelectScreen.AddPlayer(JoiningPlayer); } }
protected override void Execute(IOnlineConnection Sender) { for (int P = 0; P < ActiveGroup.Room.ListOnlinePlayer.Count; P++) { ActiveGroup.Room.ListOnlinePlayer[P].Send(new MoveCursorScriptServer(CursorPositionX, CursorPositionY)); } }
protected override void Execute(IOnlineConnection Host) { if (Owner.lstRoomPlayers.InvokeRequired) { Owner.lstRoomPlayers.Invoke(new SafeCallDelegate(Execute), new object[] { Host }); } else { Owner.txtRoomID.Text = RoomID.ToString(); Owner.lstRoomPlayers.Items.Clear(); for (int P = 0; P < ListPlayer.Count; ++P) { Owner.lstRoomPlayers.Items.Add(ListPlayer[P]); } if (HasGame) { Owner.ActiveGame = new TextGame(ArrayGameData); Owner.GamePlayer = Owner.ActiveGame.DicPlayerByID[PlayerID]; Owner.UpdateGame(); Owner.UpdateGameUI(); } } }
protected override void OnJoinRoomLocal(IOnlineConnection Sender, string RoomID, GameClientGroup ActiveGroup) { PVPRoomInformations JoinedRoom = (PVPRoomInformations)ActiveGroup.Room; List <BattleMapPlayer> 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); DicNewScript.Add(AskStartGameBattleScriptServer.ScriptName, new AskStartGameBattleScriptServer(JoinedRoom, (Online.BattleMapClientGroup)ActiveGroup, Owner)); DicNewScript.Add(AskChangeRoomExtrasMissionScriptServer.ScriptName, new AskChangeRoomExtrasMissionScriptServer(JoinedRoom)); Sender.AddOrReplaceScripts(DicNewScript); if (ActiveGroup.CurrentGame != null) { } Sender.Send(new JoinRoomLocalScriptServer(RoomID, JoinedRoom.CurrentDifficulty, ListJoiningPlayerInfo, ActiveGroup)); }
protected override void Execute(IOnlineConnection Host) { Owner.Host.IsGameReady = false; Layer ActiveLayer = Owner.TripleThunderGame.ListLayer[0]; ActiveLayer.DelayOnlineScript(this); }
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()); } }
public bool JoinHost(IPAddress HostAddress) { StopListening(); for (int P = 0; P < ListPlayerClient.Count; P++) { // Shutdown and end connection ListPlayerClient[P].Close(); } ListPlayerClient.Clear(); IPEndPoint HostEndPoint = new IPEndPoint(HostAddress, 2312); TcpClient UserClient = new TcpClient(); UserClient.NoDelay = true; UserClient.Connect(HostEndPoint); // Get a client stream for reading and writing. NetworkStream HostStream = UserClient.GetStream(); Host = new OnlineConnection(UserClient, HostStream, null); return(UserClient.Connected); }
protected internal override void Execute(IOnlineConnection Sender) { IOnlineConnection ClientToInvite; if (OnlineServer.DicPlayerByID.TryGetValue(ClientToInviteID, out ClientToInvite)) { if (!OnlineServer.DicCommunicationGroup.ContainsKey(GroupID)) { OnlineServer.CreateOrJoinCommunicationGroup(GroupID, true, Sender); } OnlineServer.JoinCommunicationGroup(GroupID, ClientToInvite); ClientToInvite.Send(new ReceiveGroupInviteScriptServer(GroupID, GroupName)); } else { //cross server string CommunicationServerIP; int CommunicationServerPort; OnlineServer.Database.GetPlayerCommunicationIP(ClientToInviteID, out CommunicationServerIP, out CommunicationServerPort); if (OnlineServer.IP != CommunicationServerIP || OnlineServer.Port != CommunicationServerPort) { Sender.Send(new ReceiveRemoteGroupInviteScriptServer(GroupID, GroupName, Sender.ID, Sender.Name, ClientToInviteID, CommunicationServerIP, CommunicationServerPort)); } } }
public BattleMapPlayer(BattleMapPlayer Clone) { if (Clone == null) { Team = -1; OnlinePlayerType = PlayerTypeNA; return; } ConnectionID = Clone.ConnectionID; Name = Clone.Name; Guild = Clone.Guild; License = Clone.License; Ranking = Clone.Ranking; IsOnline = Clone.IsOnline; Team = Clone.Team; Level = Clone.Level; Money = Clone.Money; IsPlayerControlled = Clone.IsPlayerControlled; Color = Clone.Color; GameplayType = Clone.GameplayType; InputManager = Clone.InputManager; LocalPlayerIndex = Clone.LocalPlayerIndex; OnlinePlayerType = Clone.OnlinePlayerType; OnlineClient = Clone.OnlineClient; Inventory = Clone.Inventory; }
protected override void Execute(IOnlineConnection Host) { ActionPanelPhaseChange PhaseEnd = new ActionPanelPhaseChange(Map); Map.ListActionMenuChoice.Add(PhaseEnd); PhaseEnd.OnSelect(); }
protected override void Execute(IOnlineConnection Sender) { TextGame NewGame = new TextGame(CreatedGroup); CreatedGroup.CurrentGame = NewGame; foreach (IOnlineConnection ActivePlayer in CreatedGroup.Room.ListOnlinePlayer) { ActivePlayer.Send(new CreateGameScriptServer()); } foreach (IOnlineConnection ActivePlayer in CreatedGroup.Room.ListOnlinePlayer) { PlayerWithID NewGamePlayer = NewGame.AddPlayer(); //Add Game Specific scripts Dictionary <string, OnlineScript> DicNewScript = new Dictionary <string, OnlineScript>(); DicNewScript.Add(SendSquareScriptServer.ScriptName, new SendSquareScriptServer(CreatedGroup, NewGamePlayer)); DicNewScript.Add(SendCircleScriptServer.ScriptName, new SendCircleScriptServer(CreatedGroup, NewGamePlayer)); DicNewScript.Add(FinishedLoadingScriptServer.ScriptName, new FinishedLoadingScriptServer(CreatedGroup, NewGamePlayer)); ActivePlayer.AddOrReplaceScripts(DicNewScript); //Send created Player to all Players. foreach (IOnlineConnection ActivePlayerInRoom in CreatedGroup.Room.ListOnlinePlayer) { ActivePlayerInRoom.Send(new CreatePlayerScriptServer(NewGamePlayer.ID, ActivePlayer == ActivePlayerInRoom)); } } }
private void WaitForConnections() { while (!CancelToken.IsCancellationRequested) { if (ClientsListener.Pending()) { TcpClient ConnectingClient = ClientsListener.AcceptTcpClient(); ConnectingClient.NoDelay = true; NetworkStream ClientStream = ConnectingClient.GetStream(); IOnlineConnection NewConnection = CreateNewConnection(ConnectingClient, ClientStream); OnClientConnected(NewConnection); } if (MastersListener.Pending() && ListOtherMaster.Count == 0) { TcpClient ConnectingMaster = MastersListener.AcceptTcpClient(); ConnectingMaster.NoDelay = true; NetworkStream MasterStream = ConnectingMaster.GetStream(); IOnlineConnection NewConnection = CreateNewConnection(ConnectingMaster, MasterStream); OnMasterConnected(NewConnection); } } ClientsListener.Stop(); ClientsListener = null; MastersListener.Stop(); MastersListener = null; }
protected override void Execute(IOnlineConnection Host) { lock (Owner.ListRoomPlayer) { for (int P = 0; P < Owner.ListRoomPlayer.Count; ++P) { if (Owner.ListRoomPlayer[P].ConnectionID == RoomPlayerID) { Owner.ListRoomPlayer.RemoveAt(P); } } } if (Client.BattleMapGame == null) { MissionSelectScreen.UpdateReadyOrHost(); } else { /*for (int P = Client.BattleMapGame.ListLocalPlayer.Count - 1; P >= 0; P--) * { * if (Client.BattleMapGame.ListLocalPlayer[P].InGameRobot.ID == InGamePlayerID) * { * Client.BattleMapGame.ListLocalPlayer.RemoveAt(P); * break; * } * }*/ } }
protected internal override void Execute(IOnlineConnection Sender) { IRoomInformations CreatedRoom = Owner.Database.GenerateNewRoom(RoomName, "", Owner.IP, Owner.Port); CreatedGroup = new ClientGroup(CreatedRoom); CreatedGroup.Room.AddPlayer(Sender); Owner.DicLocalRoom.Add(CreatedRoom.RoomID, CreatedGroup); Owner.DicAllRoom.Add(CreatedRoom.RoomID, CreatedRoom); Owner.ListPlayerToRemove.Add(Sender); Owner.SharedWriteBuffer.ClearWriteBuffer(); Owner.SharedWriteBuffer.WriteScript(new RoomListScriptServer(Owner, new List <IRoomInformations>() { CreatedRoom })); foreach (IOnlineConnection ActivePlayer in Owner.ListPlayer) { if (ActivePlayer == Sender) { continue; } ActivePlayer.SendWriteBuffer(); } Sender.Send(new SendRoomIDScriptServer(CreatedRoom.RoomID)); }
protected override void Execute(IOnlineConnection Host) { RemoteServer.OnClientConnected(RemoteServerToClientConnection); Owner.ChangeHost(ClientToServerConnection); ClientToServerConnection.Send(new AskJoinRoomScriptClient(RoomID)); }
protected override void Execute(IOnlineConnection Sender) { base.Execute(Sender); RoomInformations NewRoom = (RoomInformations)CreatedGroup.Room; foreach (IOnlineConnection ActivePlayer in CreatedGroup.Room.ListOnlinePlayer) { //Add Game Specific scripts Dictionary <string, OnlineScript> DicNewScript = new Dictionary <string, OnlineScript>(); if (NewRoom.RoomType == RoomInformations.RoomTypeMission) { MissionRoomInformations MissionRoom = (MissionRoomInformations)NewRoom; DicNewScript.Add(AskStartGameMissionScriptServer.ScriptName, new AskStartGameMissionScriptServer(MissionRoom, (TripleThunderClientGroup)CreatedGroup, Owner)); DicNewScript.Add(AskChangeRoomExtrasMissionScriptServer.ScriptName, new AskChangeRoomExtrasMissionScriptServer(MissionRoom)); } else if (NewRoom.RoomType == RoomInformations.RoomTypeBattle) { BattleRoomInformations BattleRoom = (BattleRoomInformations)NewRoom; DicNewScript.Add(AskStartGameMissionScriptServer.ScriptName, new AskStartGameBattleScriptServer(BattleRoom, (TripleThunderClientGroup)CreatedGroup, Owner)); DicNewScript.Add(AskChangeRoomExtrasBattleScriptServer.ScriptName, new AskChangeRoomExtrasBattleScriptServer(BattleRoom)); } DicNewScript.Add(AskChangeCharacterScriptServer.ScriptName, new AskChangeCharacterScriptServer(NewRoom)); DicNewScript.Add(AskChangePlayerTypeScriptServer.ScriptName, new AskChangePlayerTypeScriptServer(NewRoom)); DicNewScript.Add(AskChangeTeamScriptServer.ScriptName, new AskChangeTeamScriptServer(NewRoom)); DicNewScript.Add(AskChangeMapScriptServer.ScriptName, new AskChangeMapScriptServer(NewRoom, Owner)); DicNewScript.Add(AskChangeRoomSubtypeScriptServer.ScriptName, new AskChangeRoomSubtypeScriptServer(NewRoom)); DicNewScript.Add(LeaveRoomScriptServer.ScriptName, new LeaveRoomScriptServer(NewRoom, Owner)); ActivePlayer.AddOrReplaceScripts(DicNewScript); } }
protected override void Execute(IOnlineConnection Host) { OnlineGameClient.RoomID = RoomID; RoomInformations NewRoom; Dictionary <string, OnlineScript> DicNewGameServerScript = new Dictionary <string, OnlineScript>(); IMissionSelect NewMissionSelectScreen; if (RoomType == RoomInformations.RoomTypeMission) { MissionRoomInformations MissionRoom = new MissionRoomInformations(RoomID, RoomName, RoomType, RoomSubtype, MinNumberOfPlayer, MaxNumberOfPlayer); 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(ChangeRoomExtrasMissionScriptClient.ScriptName, new ChangeRoomExtrasMissionScriptClient(MissionRoom, NewMissionSelectScreen)); } else { BattleRoomInformations BattleRoom = new BattleRoomInformations(RoomID, RoomName, RoomType, RoomSubtype, MinNumberOfPlayer, MaxNumberOfPlayer); 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, NewMissionSelectScreen)); } 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) { Dictionary <string, OnlineScript> DicNewCommunicationServerScript = new Dictionary <string, OnlineScript>(); DicNewCommunicationServerScript.Add(ReceiveGroupMessageScriptClient.ScriptName, new ReceiveGroupMessageScriptClient(OnlineCommunicationClient)); OnlineCommunicationClient.Host.AddOrReplaceScripts(DicNewCommunicationServerScript); OnlineCommunicationClient.Chat.InsertTab(RoomID, "Chat"); OnlineCommunicationClient.Chat.CloseTab("Global"); OnlineCommunicationClient.Host.Send(new CreateOrJoinCommunicationGroupScriptClient(RoomID, false)); OnlineCommunicationClient.Host.Send(new LeaveCommunicationGroupScriptClient("Global")); } ScreenOwner.RemoveScreen(ScreenOwner); OnlineGameClient.DelayOnlineScript(this); }
public GamePlayer(uint PlayerID, IOnlineConnection ActiveOnlinePlayer, int LayerIndex, Vector2 PlayerPosition, Player PlayerInfo) { this.PlayerID = PlayerID; this.ActiveOnlinePlayer = ActiveOnlinePlayer; this.LayerIndex = LayerIndex; this.PlayerPosition = PlayerPosition; this.PlayerInfo = PlayerInfo; }
protected internal override void Execute(IOnlineConnection ActivePlayer) { PlayerPOCO PlayerInfo = Owner.Database.LogInPlayer(Login, Password, Owner.IP, Owner.Port); ActivePlayer.ID = PlayerInfo.ID; ActivePlayer.Name = PlayerInfo.Name; ActivePlayer.Send(new LoginSuccessScriptServer(PlayerInfo)); }
protected override void Execute(IOnlineConnection Sender) { if (ActiveGroup.CurrentGame.HasGameStarted) { Sender.Send(new StartGameScriptServer()); } Owner.HasFinishedLoadingGame = true; }
public void AddFriend(IOnlineConnection Sender, string ClientID) { FilterDefinition <BsonDocument> filter = Builders <BsonDocument> .Filter.Eq("_id", new ObjectId(Sender.ID)); UpdateDefinition <BsonDocument> update = Builders <BsonDocument> .Update.AddToSet("Friends", new ObjectId(ClientID)); PlayersCollection.UpdateOneAsync(filter, update); }
protected override void Execute(IOnlineConnection Sender) { if (Sender.IsGameReady) { Layer ActiveLayer = ActiveGame.ListLayer[LayerIndex]; ActiveLayer.DelayOnlineScript(this); } }
protected override void Execute(IOnlineConnection Sender) { Owner.DicLocalRoom[RoomID].CurrentGame = new DummyGame(); foreach (IOnlineConnection ActivePlayer in Owner.DicLocalRoom[RoomID].Room.ListOnlinePlayer) { ActivePlayer.Send(new StartGameScriptServer()); } }
protected override void Execute(IOnlineConnection Host) { Map.CursorControl(); Map.CursorPosition.X = CursorPositionX; Map.CursorPosition.Y = CursorPositionY; Map.CameraPosition.X = CameraPositionX; Map.CameraPosition.Y = CameraPositionY; }
protected override void Execute(IOnlineConnection Host) { Owner.RoomID = RoomID; if (HasGame) { Owner.CurrentGame = new DummyGame(); } }
protected override void Execute(IOnlineConnection Host) { Map.BattleMenuCursorIndex = BattleMenuCursorIndex; Map.BattleMenuCursorIndexSecond = BattleMenuCursorIndexSecond; Map.ActiveSquad.CurrentLeader.AttackIndex = ActiveSquadAttackIndex; Map.TargetSquad.CurrentLeader.AttackIndex = TargetSquadAttackIndex; Map.BattleMenuStage = BattleMenuStage; Constants.ShowAnimation = ShowAnimation; }
protected override void Execute(IOnlineConnection Host) { Map.ActiveSquad.CurrentLeader.AttackIndex = 0; if (Map.ActiveSquad.CurrentLeader.ListAttack.Count != WeaponCount) { throw new Exception("Error while opening Weapon panel."); } }
public void OnMasterConnected(IOnlineConnection NewMaster) { if (Master != null) { Master.Close(); } Master = NewMaster; }
protected internal override void Execute(IOnlineConnection Host) { IniFile ConnectionInfo = IniFile.ReadFromFile("ConnectionInfo.ini"); string Username = ConnectionInfo.ReadField("PlayerInfo", "Username"); string Password = ConnectionInfo.ReadField("PlayerInfo", "Password"); Host.Send(new AskRoomListScriptClient()); Host.Send(new AskLoginScriptClient(Username, Password)); }