//protected async override Task OnInitializedAsync() //{ // var finalizedCallback = new UICallBack(this, GetType(), typeof(LobbyQuery)); // await base.OnInitializedAsync(); // await _appState.Subscribe<LobbyQuery>(finalizedCallback, "General Chat"); //} public async Task ReadLobby <T>(object query) { var queryResponse = (LobbyList)query; this.Lobbies = queryResponse; StateHasChanged(); }
// Private Methods private void updateLobbyListControl(LobbyList lobbyList) { // update room name this.lblRoomName.Text = lobbyList.RoomName; this.lvwPlayers.Items.Clear(); foreach (var i in lobbyList.Items) { var tileSize = this.lvwPlayers.TileSize; var item = new ListViewItem(i.PlayerName, 0); if (i.State == State.LobbyReady) { item.Font = new System.Drawing.Font("Consolas", 10.0f, System.Drawing.FontStyle.Underline); } else if (i.State == State.Game) { item.Font = new System.Drawing.Font("Consolas", 10.0f, System.Drawing.FontStyle.Underline); item.ForeColor = System.Drawing.Color.LightBlue; } //item.Position = new System.Drawing.Point((this.lvwPlayers.Width/2) - (tileSize.Width/2), (this.lvwPlayers.Height / 2) - (tileSize.Height / 2)); //item.Position = new System.Drawing.Point(100, 100); this.lvwPlayers.Items.Add(item); } }
private void JoinSelLobbyButton_Click(object sender, EventArgs e) { if (LobbyList.SelectedIndex != -1) { Send(new JoinLobbyPacket(LobbyList.GetItemText(LobbyList.SelectedItem))); waitingLobby = new WaitingLobby(writer, this, chat); } }
public bool Run(NetworkStream stream, string input) { var proto = new LobbyList(); stream.Write(proto.ProtobufTypeAsBytes, 0, 2); ProtoBuf.Serializer.SerializeWithLengthPrefix(stream, proto, ProtoBuf.PrefixStyle.Fixed32); return(true); }
public void OnEnable() { Debug.Log("LobbyList Singleton created"); singleton = this; layout = lobbyPlayerParent.GetComponent <VerticalLayoutGroup>(); }
public async Task GetCurrentLobbies() { var list = new LobbyList().Lobbies; var settings = new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.All }; var jsonList = JsonConvert.SerializeObject(list, Formatting.Indented, settings); await Clients.Caller.SendAsync("ReceiveCurrentLobbies", jsonList); }
private void FindeSession() { //RequestServerAboutSessions if (true) { if (!LobbyList.Contains("Keine erstellten Lobbys")) { LobbyList.Add("Keine erstellten Lobbys"); } } }
private void listView_Click(object sender, RoutedEventArgs e) { LobbyList item = (LobbyList)lvLobby.SelectedItem; if (item != null) { SingletonClient.Singleton.getClient().SendData(SingletonClient.Singleton.ConvertStringToBytes("JOIN_CHATROOM " + item.Lobby)); Lobby lobby = new Lobby(); NavigationService navService = NavigationService.GetNavigationService(this); navService.Navigate(lobby); } }
public bool Run(NetworkStream stream, string input) { var proto = new LobbyList { LobbyInfos = new List <LobbyInfo>() }; foreach (var lobby in Server.Singleton.LobbyList) { proto.LobbyInfos.Add(lobby.Info); } stream.Write(proto.ProtobufTypeAsBytes, 0, 2); ProtoBuf.Serializer.SerializeWithLengthPrefix(stream, proto, ProtoBuf.PrefixStyle.Fixed32); return(true); }
public void RemovePlayer(GPlayer player) { LobbyList.HandleRemoveLobbyPlayer(player); GameBase GameHandle = player.Game; if (GameHandle != null) { GameHandle.RemovePlayer(player); } if (player.InLobby) { LeaveMultiplayerGamesList(player); } }
private LobbyList getLobbyList(RoomInfo roomInfo) { var players = this.getPlayersInLobbyAndGame(roomInfo); LobbyList lobbyList = new LobbyList(); lobbyList.RoomName = roomInfo.Name; foreach (var player in players) { var u = player.UserData as ClientUserData; lobbyList.Items.Add(new LobbyListItem { PlayerName = u.PlayerName, State = u.State }); } return(lobbyList); }
public override void RunCommand(string[] Command) { string ReadCommand; GPlayer P; if (Command.Length > 1) { ReadCommand = Command[1]; } else { ReadCommand = ""; } switch (Command[0]) { case "cls": case "limpar": case "clear": { Console.Clear(); } break; case "kickuid": { P = (GPlayer)GetPlayerByUID(uint.Parse(ReadCommand.ToString())); if (P == null) { WriteConsole.WriteLine("[SYSTEM_COMMAND]: THIS UID IS NOT ONLINE!", ConsoleColor.Red); break; } DisconnectPlayer(P); } break; case "kickname": { P = (GPlayer)GetPlayerByNickname(ReadCommand); if (P == null) { WriteConsole.WriteLine("[SYSTEM_COMMAND]: THIS NICKNAME IS NOT ONLINE!", ConsoleColor.Red); return; } DisconnectPlayer(P); } break; case "kickuser": { P = (GPlayer)GetPlayerByUsername(ReadCommand); if (P == null) { WriteConsole.WriteLine("[SYSTEM_COMMAND]: THIS USERNAME IS NOT ONLINE!", ConsoleColor.Red); return; } DisconnectPlayer(P); } break; case "topnotice": { if (ReadCommand.Length > 0) { Notice(ReadCommand); } } break; case "lobby": case "listalobby": case "canais": case "listacanais": case "showlobby": case "showchannel": { LobbyList.ShowChannel(); } break; case "comandos": case "commands": case "ajuda": case "help": { ShowHelp(); } break; case "reload": case "reconfigurar": case "reconfig": { Ini = new IniFile(ConfigurationManager.AppSettings["ServerConfig"]); Data = new ServerSettings { Name = Ini.ReadString("Config", "Name", "Pippin"), Version = Ini.ReadString("Config", "Version", "SV_GS_Release_2.0"), UID = Ini.ReadUInt32("Config", "UID", 20201), MaxPlayers = Ini.ReadUInt32("Config", "MaxPlayers", 3000), Port = Ini.ReadUInt32("Config", "Port", 20201), IP = Ini.ReadString("Config", "IP", "127.0.0.1"), Property = Ini.ReadUInt32("Config", "Property", 2048), BlockFunc = Ini.ReadInt64("Config", "BlockFuncSystem", 0), EventFlag = Ini.ReadInt16("Config", "EventFlag", 0), ImgNo = Ini.ReadInt16("Config", "Icon", 1), GameVersion = "824.00", Type = AuthClientTypeEnum.GameServer, AuthServer_Ip = Ini.ReadString("Config", "AuthServer_IP", "127.0.0.1"), AuthServer_Port = Ini.ReadInt32("Config", "AuthServer_Port", 7997), Key = "3493ef7ca4d69f54de682bee58be4f93" }; ShowLog = Ini.ReadBool("Config", "PacketLog", false); Messenger_Active = Ini.ReadBool("Config", "Messenger_Server", false); var packet = new AuthPacket() { ID = AuthPacketEnum.SERVER_UPDATE, Message = new { _data = Data } }; this.AuthServer.Send(packet); } break; default: { WriteConsole.WriteLine("[SYSTEM_COMMAND]: Sorry Unknown Command, type 'help' to get the list of commands", ConsoleColor.Red); } break; } }
public void OnEnable() { _instance = this; _layout = playerListContentTransform.GetComponent <VerticalLayoutGroup>(); }
public void RunCommand(string[] Command) { string ReadCommand; GPlayer P; if (Command.Length > 1) { ReadCommand = Command[1]; } else { ReadCommand = ""; } switch (Command[0]) { case "cls": case "limpar": case "clear": { Console.Clear(); } break; case "kickuid": { P = (GPlayer)GetPlayerByUID(uint.Parse(ReadCommand.ToString())); if (P == null) { WriteConsole.WriteLine("[SYSTEM_COMMAND]: THIS UID IS NOT ONLINE!", ConsoleColor.Red); break; } DisconnectPlayer(P); } break; case "kickname": { P = (GPlayer)GetPlayerByNickname(ReadCommand); if (P == null) { WriteConsole.WriteLine("[SYSTEM_COMMAND]: THIS NICKNAME IS NOT ONLINE!", ConsoleColor.Red); return; } DisconnectPlayer(P); } break; case "kickuser": { P = (GPlayer)GetPlayerByUsername(ReadCommand); if (P == null) { WriteConsole.WriteLine("[SYSTEM_COMMAND]: THIS USERNAME IS NOT ONLINE!", ConsoleColor.Red); return; } DisconnectPlayer(P); } break; case "topnotice": { if (ReadCommand.Length > 0) { Notice(ReadCommand); } } break; case "lobby": case "listalobby": case "canais": case "listacanais": case "showlobby": case "showchannel": { LobbyList.ShowChannel(); } break; case "comandos": case "commands": case "ajuda": case "help": { ShowHelp(); } break; default: { WriteConsole.WriteLine("[SYSTEM_COMMAND]: Sorry Unknown Command, type 'help' to get the list of commands", ConsoleColor.Red); } break; } }
void PlayerRequestInfo(GPlayer PL, string ServerVersion) { #region HandlePlayer PangyaBinaryWriter Reply; var Inventory = PL.Inventory; #region PlayerLogin PL.SendMainPacket(ServerVersion); #endregion #region PlayerCharacterInfo PL.SendResponse(Inventory.ItemCharacter.Build()); #endregion #region PlayerCaddieInfo PL.SendResponse(Inventory.ItemCaddie.Build()); #endregion #region PlayerWarehouseInfo PL.SendResponse(Inventory.ItemWarehouse.Build()); #endregion #region PlayerMascotsInfo PL.SendResponse(Inventory.ItemMascot.Build()); #endregion #region PlayerToolBarInfo PL.SendResponse(Inventory.GetToolbar()); #endregion #region PlayerLobbyListInfo PL.SendResponse(LobbyList.Build(true)); #endregion #region Map Rate PL.SendResponse(ShowLoadMap()); #endregion #region PlayerAchievement PL.ReloadAchievement(); PL.SendAchievementCounter(); PL.SendAchievement(); #endregion #region PlayerCardInfo PL.SendResponse(Inventory.ItemCard.Build()); PL.SendResponse(new byte[] { 0x36, 0x01 }); #endregion #region PlayerCardEquipInfo PL.SendResponse(Inventory.ItemCardEquip.Build()); PL.SendResponse(new byte[] { 0x81, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 }); #endregion #region PlayerCookies PL.SendCookies(); #endregion #region TROPHY //normal PL.SendResponse(Inventory.ItemTrophies.Build(5)); PL.SendResponse(Inventory.ItemTrophies.Build(0)); //especial PL.SendResponse(Inventory.ItemTrophySpecial.Build(5)); PL.SendResponse(Inventory.ItemTrophySpecial.Build(0)); //Grand Prix PL.SendResponse(Inventory.ItemTrophyGP.Build(5)); PL.SendResponse(Inventory.ItemTrophyGP.Build(0)); #endregion #region StatisticInfo Reply = new PangyaBinaryWriter(); Reply.Write(new byte[] { 0x58, 01, 0x00 }); Reply.Write(PL.GetUID); Reply.Write(PL.Statistic()); PL.SendResponse(Reply.GetBytes()); #endregion #region MailGiftBox PL.SendMailPopup(); #endregion #region ChatOffLine PL.SendChatOffline(); #endregion #region Check Exist Item 467664918 if (PL.Inventory.GetQuantity(467664918) == 1) { PL.Assist = 1; } #endregion #region PlayerGetMessengerServerInfo new MessengerServerCoreSystem().PlayerConnectMessengerServer(PL); #endregion #endregion }
public void PlayerSelectLobby(GPlayer player, Packet packet, bool RequestJoinGameList = false) { var lp = player.Lobby; //Lê Id do Lobby if (!packet.ReadByte(out byte lobbyId)) { return; } var lobby = LobbyList.GetLobby(lobbyId); if (lp != null) { lobby.RemovePlayer(player); } //Caso o lobby não existir if (lobby == null) { player.SendResponse(new byte[] { 0x95, 0x00, 0x02, 0x01, 0x00 }); throw new Exception("Player Select Invalid Lobby"); } //Se estiver lotado if (lobby.IsFull) { player.SendResponse(new byte[] { 0x4E, 0x00, 0x02 }); throw new Exception("Player Selected Lobby Full"); } // ## add player if (lobby.AddPlayer(player)) { try { if (RequestJoinGameList == false) { // player.SendResponse(new byte[] { 0x95, 0x00, 0x02, 0x01, 0x00 }); player.SendResponse(ShowEnterLobby(1)); player.SendResponse(new byte[] { 0xF6, 0x01, 0x00, 0x00, 0x00, 0x00 }); } if (lp == null) { int Year = DateTime.Now.Year; int Month = DateTime.Now.Month; int Day = DateTime.Now.Day; var _db = new PangyaEntities(); var LoginReg = _db.Pangya_Item_Daily_Log.FirstOrDefault(c => c.UID == player.GetUID); if (LoginReg == null) { new LoginDailyRewardSystem().PlayerDailyLoginCheck(player, 0); } else { if (LoginReg.RegDate.Year == Year && LoginReg.RegDate.Month == Month && Day == LoginReg.RegDate.Day) { new LoginDailyRewardSystem().PlayerDailyLoginCheck(player, 1); } else { new LoginDailyRewardSystem().PlayerDailyLoginCheck(player, 0); } } } // ## if request join lobby if (RequestJoinGameList) { //player.SendResponse(new byte[] { 0x95, 0x00, 0x02, 0x01, 0x00 }); player.SendResponse(ShowEnterLobby(1)); player.SendResponse(new byte[] { 0xF6, 0x01, 0x00, 0x00, 0x00, 0x00 }); lobby.JoinMultiplayerGamesList(player); } } finally { } } }
public void PlayerGetLobbyInfo(GPlayer player) { player.Response.Write(LobbyList.GetBuildServerInfo()); player.SendResponse(); }
public Channel this[GPlayer player] => LobbyList.GetLobby(player.Lobby);
void OnEnable() { instance = this; }
private void Client_ObjectReceived(object sender, AdvancedNetworkLib.ObjectReceivedEventArgs e) { var obj = e.Object; if (obj is RandomPlayerName) { this.txtName.Text = (obj as RandomPlayerName).Name; } else if (obj is LobbyList) { LobbyList lobbyList = obj as LobbyList; this.updateLobbyListControl(lobbyList); } else if (obj is Success) { var success = obj as Success; if (success.Job == Job.NameChange) { if (this.Host) { this.btnChangeName.Text = "Namen ändern"; this.btnChangeName.Enabled = true; } else { this.btnReady.Text = "Bereit"; } } else if (success.Job == Job.GameStart) { Client.ConnectionChanged -= Client_ConnectionChanged; Client.ErrorOccurred -= Client_ErrorOccurred; Client.ObjectReceived -= Client_ObjectReceived; this.Parent.closeCurrentPageAndOpenNewPage(new PageGame(new ClientUserData { Host = true, PlayerName = this.txtName.Text })); } } else if (obj is Error) { var error = obj as Error; if (error.Job == Job.NameChange) { MessageBox.Show("Dieser Name ist bereits vergeben!"); if (this.Host) { this.btnChangeName.Text = "Namen ändern"; this.btnChangeName.Enabled = true; } else { this.btnReady.Text = "Bereit"; this.btnReady.Enabled = true; } } else if (error.Job == Job.GameStart) { if (this.lvwPlayers.Items.Count == 1) { MessageBox.Show("Du kannst nicht alleine spielen!"); } else { MessageBox.Show("Es sind noch nicht alle Spieler bereit!"); } this.btnReady.Text = "Starten"; this.btnReady.Enabled = true; } } else if (obj is StartGame) { Client.ConnectionChanged -= Client_ConnectionChanged; Client.ErrorOccurred -= Client_ErrorOccurred; Client.ObjectReceived -= Client_ObjectReceived; this.Parent.closeCurrentPageAndOpenNewPage(new PageGame(new ClientUserData { Host = false, PlayerName = this.txtName.Text })); } }