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 UnbanButtonClicked(Button sender) { NetOutgoingMessage msg = _networkManager.CreateMessage(); msg.Write((byte) NetMessage.RequestBanList); _networkManager.SendMessage(msg, NetDeliveryMethod.ReliableUnordered); 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 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_admin_Clicked(Button sender) { NetOutgoingMessage message = _netMgr.CreateMessage(); message.Write((byte) NetMessage.RequestAdminPlayerlist); _netMgr.SendMessage(message, NetDeliveryMethod.ReliableUnordered); Dispose(); }
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(); }
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 Vector2i(150, 150), _resMgr, actComp)); //Create a new one. 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.Transparent, Shadowed = true, //TODO CluwneSprite ShadowOffset // ShadowOffset = new Vector2(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 = System.Drawing.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); CluwneLib.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 = new SFML.Graphics.Color(245, 245, 245); _message.Text.Color = new SFML.Graphics.Color(245, 245, 245); }
public AdminUnbanPanel(Vector2i 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 Vector2i(5, 5)}; closeButton.Clicked += CloseButtonClicked; components.Add(closeButton); Position = new Vector2i((int) (CluwneLib.CurrentRenderTarget.Size.X/2f) - (int) (ClientArea.Width/2f), (int) (CluwneLib.CurrentRenderTarget.Size.Y/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) ( CluwneLib.CurrentRenderTarget.Size.X/2f) - (int) (ClientArea.Width/2f), (int) (CluwneLib.CurrentRenderTarget.Size.Y/2f) - (int) (ClientArea.Height/2f)); }
public AdminPasswordDialog(Vector2i size, INetworkManager networkManager, IResourceManager resourceManager) : base("Admin Login", size, resourceManager) { _networkManager = networkManager; _textboxPassword = new Textbox((int) (size.X/2f), _resourceManager); _okayButton = new Button("Submit", _resourceManager); _okayButton.Clicked += OkayButtonClicked; _okayButton.mouseOverColor = new SFML.Graphics.Color(135, 206, 250); _textboxPassword.OnSubmit += textboxPassword_OnSubmit; _textboxPassword.ClearOnSubmit = false; // We dispose on submit so if it clears after disposal it'll nullref. components.Add(_textboxPassword); components.Add(_okayButton); Position = new Vector2i((int) ( CluwneLib.CurrentRenderTarget.Size.X/2f) - (int) (ClientArea.Width/2f), (int) (CluwneLib.CurrentRenderTarget.Size.Y/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(Vector2i 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 Vector2i(5, 5)}; closeButton.Clicked += CloseButtonClicked; components.Add(closeButton); var unbanButton = new Button("Unban", _resourceManager) {Position = new Vector2i(closeButton.ClientArea.Right() + 10, 5)}; unbanButton.Clicked += UnbanButtonClicked; components.Add(unbanButton); Position = new Vector2i((int) (CluwneLib.CurrentRenderTarget.Size.X/2f) - (int) (ClientArea.Width/2f), (int) (CluwneLib.CurrentRenderTarget.Size.Y/2f) - (int) (ClientArea.Height/2f)); }
public MenuWindow() : base("Menu", new Size(140, 130), IoCManager.Resolve<IResourceManager>()) { Position = new Point((int) (CluwneLib.CurrentRenderTarget.Size.X/2f) - (int) (ClientArea.Width/2f), (int) (CluwneLib.CurrentRenderTarget.Size.Y/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 JoinButtonClicked(Button sender) { PlayerManager.SendVerb("joingame", 0); }
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 CloseButtonClicked(Button sender) { Dispose(); }
private void MainMenuButtonClicked(Button sender) { _stateManager.RequestStateChange<MainScreen>(); }
private void button_entity_Clicked(Button sender) { _userInterfaceManager.DisposeAllComponents<EntitySpawnPanel>(); //Remove old ones. _userInterfaceManager.AddComponent(new EntitySpawnPanel(new Vector2i(350, 410), _resMgr, _placeMgr)); //Create a new one. Dispose(); }
private void button_quit_Clicked(Button sender) { _netMgr.Disconnect(); _stateManager.RequestStateChange<MainScreen>(); Dispose(); }