private void button_admin_Clicked(Button sender) { NetOutgoingMessage message = _netMgr.CreateMessage(); message.Write((byte) NetMessage.RequestAdminPlayerlist); _netMgr.SendMessage(message, NetDeliveryMethod.ReliableUnordered); Dispose(); }
private void UnbanButtonClicked(Button sender) { NetOutgoingMessage msg = _networkManager.CreateMessage(); msg.Write((byte) NetMessage.RequestBanList); _networkManager.SendMessage(msg, NetDeliveryMethod.ReliableUnordered); Dispose(); }
private void BuildList(Banlist banList) { int yOffset = 40; foreach (BanEntry entry in banList.List) { var line = new Label("IP: " + entry.ip + "\tReason: " + entry.reason + "\tTemporary: " + entry.tempBan + "\tExpires: " + entry.expiresAt.ToString("d/M/yyyy HH:mm:ss"), "CALIBRI", _resourceManager) {Position = new Point(5, yOffset + 5)}; components.Add(line); var unbanButton = new Button("Unban", _resourceManager) { Position = new Point(line.ClientArea.Right + 10, yOffset + (int) (line.ClientArea.Height/3f)) }; components.Add(unbanButton); unbanButton.UserData = entry.ip; unbanButton.Clicked += UnbanButtClicked; unbanButton.Update(0); yOffset += 35; } }
private void button_tile_Clicked(Button sender) { _userInterfaceManager.DisposeAllComponents<TileSpawnPanel>(); //Remove old ones. _userInterfaceManager.AddComponent(new TileSpawnPanel(new Size(350, 410), _resMgr, _placeMgr)); //Create a new one. Dispose(); }
private void OkayButtonClicked(Button sender) { if (_textboxPassword.Text.Length <= 1 || string.IsNullOrWhiteSpace(_textboxPassword.Text)) return; TryAdminLogin(_textboxPassword.Text); _textboxPassword.Text = string.Empty; }
private void UnbanButtClicked(Button sender) { NetOutgoingMessage msg = _networkManager.CreateMessage(); msg.Write((byte) NetMessage.RequestAdminUnBan); msg.Write((string) sender.UserData); _networkManager.SendMessage(msg, NetDeliveryMethod.ReliableUnordered); Dispose(); }
public void Startup() { UserInterfaceManager.DisposeAllComponents(); NetworkManager.MessageArrived += NetworkManagerMessageArrived; _lobbyChat = new Chatbox(ResourceManager, UserInterfaceManager, KeyBindingManager); _lobbyChat.TextSubmitted += LobbyChatTextSubmitted; _lobbyChat.Update(0); UserInterfaceManager.AddComponent(_lobbyChat); _lobbyText = new TextSprite("lobbyText", "", ResourceManager.GetFont("CALIBRI")) { Color = Color.Black, ShadowColor = Color.DimGray, Shadowed = true, ShadowOffset = new Vector2D(1, 1) }; NetOutgoingMessage message = NetworkManager.CreateMessage(); message.Write((byte) NetMessage.WelcomeMessage); //Request Welcome msg. NetworkManager.SendMessage(message, NetDeliveryMethod.ReliableOrdered); NetworkManager.SendClientName(ConfigurationManager.GetPlayerName()); //Send name. NetOutgoingMessage playerListMsg = NetworkManager.CreateMessage(); playerListMsg.Write((byte) NetMessage.PlayerList); //Request Playerlist. NetworkManager.SendMessage(playerListMsg, NetDeliveryMethod.ReliableOrdered); _playerListTime = DateTime.Now.AddSeconds(PlayerListRefreshDelaySec); NetOutgoingMessage jobListMsg = NetworkManager.CreateMessage(); jobListMsg.Write((byte) NetMessage.JobList); //Request Joblist. NetworkManager.SendMessage(jobListMsg, NetDeliveryMethod.ReliableOrdered); var joinButton = new Button("Join Game", ResourceManager) {mouseOverColor = Color.LightSteelBlue}; joinButton.Position = new Point(605 - joinButton.ClientArea.Width - 5, 200 - joinButton.ClientArea.Height - 5); joinButton.Clicked += JoinButtonClicked; UserInterfaceManager.AddComponent(joinButton); _jobButtonContainer = new ScrollableContainer("LobbyJobCont", new Size(375, 400), ResourceManager) { Position = new Point(630, 10) }; UserInterfaceManager.AddComponent(_jobButtonContainer); Gorgon.CurrentRenderTarget.Clear(); }
public DisconnectedScreenBlocker(IStateManager stateManager, IUserInterfaceManager userInterfaceManager, IResourceManager resourceManager, string message = "Connection closed.") { _stateManager = stateManager; _resourceManager = resourceManager; _userInterfaceManager = userInterfaceManager; _userInterfaceManager.DisposeAllComponents(); _message = new Label(message, "CALIBRI", _resourceManager); _mainMenuButton = new Button("Main Menu", _resourceManager); _mainMenuButton.Clicked += MainMenuButtonClicked; _mainMenuButton.Label.Color = Color.WhiteSmoke; _message.Text.Color = Color.WhiteSmoke; }
public AdminUnbanPanel(Size size, Banlist banlist, INetworkManager networkManager, IResourceManager resourceManager) : base("Admin UnBan Panel", size, resourceManager) { _networkManager = networkManager; _resourceManager = resourceManager; BuildList(banlist); var closeButton = new Button("Close", _resourceManager) {Position = new Point(5, 5)}; closeButton.Clicked += CloseButtonClicked; components.Add(closeButton); Position = new Point((int) (Gorgon.CurrentRenderTarget.Width/2f) - (int) (ClientArea.Width/2f), (int) (Gorgon.CurrentRenderTarget.Height/2f) - (int) (ClientArea.Height/2f)); }
public AdminPasswordDialog(Size size, INetworkManager networkManager, IResourceManager resourceManager) : base("Admin Login", size, resourceManager) { _networkManager = networkManager; _resourceManager = resourceManager; _textboxPassword = new Textbox((int) (size.Width/2f), _resourceManager); _okayButton = new Button("Submit", _resourceManager); _okayButton.Clicked += OkayButtonClicked; _okayButton.mouseOverColor = Color.LightSkyBlue; _textboxPassword.OnSubmit += textboxPassword_OnSubmit; components.Add(_textboxPassword); components.Add(_okayButton); Position = new Point((int) (Gorgon.CurrentRenderTarget.Width/2f) - (int) (ClientArea.Width/2f), (int) (Gorgon.CurrentRenderTarget.Height/2f) - (int) (ClientArea.Height/2f)); }
private void BuildList(NetIncomingMessage message) { byte playerCount = message.ReadByte(); int yOffset = 40; for (int i = 0; i < playerCount; i++) { string name = message.ReadString(); var status = (SessionStatus) message.ReadByte(); string job = message.ReadString(); string ip = message.ReadString(); bool isAdmin = message.ReadBoolean(); var line = new Label("Name: " + name + " Status: " + status + " Job: " + job + " IP: " + ip, "CALIBRI", _resourceManager) { Position = new Point(5, yOffset + 5), Text = {Color = isAdmin ? Color.DarkCyan : Color.Black} }; components.Add(line); var kickButton = new Button("Kick", _resourceManager) { Position = new Point(line.ClientArea.Right + 10, yOffset + (int) (line.ClientArea.Height/3f)) }; components.Add(kickButton); kickButton.UserData = ip; kickButton.Clicked += KickButtonClicked; kickButton.Update(0); var banButt = new Button("Ban", _resourceManager) { Position = new Point(kickButton.ClientArea.Right + 5, yOffset + (int) (line.ClientArea.Height/3f)) }; components.Add(banButt); banButt.UserData = ip; banButt.Clicked += BanButtonClicked; yOffset += 35; } }
public AdminPlayerPanel(Size size, INetworkManager networkManager, IResourceManager resourceManager, NetIncomingMessage message) : base("Admin Player Panel", size, resourceManager) { _networkManager = networkManager; _resourceManager = resourceManager; BuildList(message); var closeButton = new Button("Close", _resourceManager) {Position = new Point(5, 5)}; closeButton.Clicked += CloseButtonClicked; components.Add(closeButton); var unbanButton = new Button("Unban", _resourceManager) {Position = new Point(closeButton.ClientArea.Right + 10, 5)}; unbanButton.Clicked += UnbanButtonClicked; components.Add(unbanButton); Position = new Point((int) (Gorgon.CurrentRenderTarget.Width/2f) - (int) (ClientArea.Width/2f), (int) (Gorgon.CurrentRenderTarget.Height/2f) - (int) (ClientArea.Height/2f)); }
public MenuWindow() : base("Menu", new Size(140, 130), IoCManager.Resolve<IResourceManager>()) { Position = new Point((int) (Gorgon.CurrentRenderTarget.Width/2f) - (int) (ClientArea.Width/2f), (int) (Gorgon.CurrentRenderTarget.Height/2f) - (int) (ClientArea.Height/2f)); button_actions = new Button("Player Actions", _resMgr); button_actions.Clicked += button_actions_Clicked; button_actions.Position = new Point(5, 5); button_actions.Update(0); components.Add(button_actions); button_entity = new Button("Spawn Entities", _resMgr); button_entity.Clicked += button_entity_Clicked; button_entity.Position = new Point(5, button_actions.ClientArea.Bottom + 5); button_entity.Update(0); components.Add(button_entity); button_tile = new Button("Spawn Tiles", _resMgr); button_tile.Clicked += button_tile_Clicked; button_tile.Position = new Point(5, button_entity.ClientArea.Bottom + 5); button_tile.Update(0); components.Add(button_tile); button_admin = new Button("Admin Panel", _resMgr); button_admin.Clicked += button_admin_Clicked; button_admin.Position = new Point(5, button_tile.ClientArea.Bottom + 5); button_admin.Update(0); components.Add(button_admin); button_quit = new Button("Quit", _resMgr); button_quit.Clicked += button_quit_Clicked; button_quit.Position = new Point(5, button_admin.ClientArea.Bottom + 20); button_quit.Update(0); components.Add(button_quit); }
private void KickButtonClicked(Button sender) { NetOutgoingMessage msg = _networkManager.CreateMessage(); msg.Write((byte) NetMessage.RequestAdminKick); msg.Write((string) sender.UserData); //ip _networkManager.SendMessage(msg, NetDeliveryMethod.ReliableUnordered); }
private void JoinButtonClicked(Button sender) { PlayerManager.SendVerb("joingame", 0); }
private void MainMenuButtonClicked(Button sender) { _stateManager.RequestStateChange<MainScreen>(); }
private void button_actions_Clicked(Button sender) { _userInterfaceManager.DisposeAllComponents<PlayerActionsWindow>(); //Remove old ones. var actComp = (PlayerActionComp) _playerManager.ControlledEntity.GetComponent(ComponentFamily.PlayerActions); if (actComp != null) _userInterfaceManager.AddComponent(new PlayerActionsWindow(new Size(150, 150), _resMgr, actComp)); //Create a new one. Dispose(); }
private void CloseButtonClicked(Button sender) { Dispose(); }
private void button_quit_Clicked(Button sender) { _netMgr.Disconnect(); _stateManager.RequestStateChange<MainScreen>(); Dispose(); }