public void DoPlayerConnected(SimPlayer player) { if (!Simulator.EditorMode) return; var editorPlayer = new EditorPlayer(Simulator) { SimPlayer = player, GeneralMenu = GeneralMenu }; editorPlayer.Initialize(); Players.Add(player, editorPlayer); NotifyPlayerConnected(editorPlayer); }
private void NotifyPlayerChanged(EditorPlayer player) { if (PlayerChanged != null) PlayerChanged(player); }
private void NotifyPlayerDisconnected(EditorPlayer player) { if (PlayerDisconnected != null) PlayerDisconnected(player); }
public void DoSelectAction(SimPlayer p) { if (!Simulator.EditorMode) return; var player = Players[p]; player.DoSelectAction(); if (player.ActualSelection.GeneralMenuChoice != EditorGeneralMenuChoice.None) { var menu = GeneralMenu.SubMenus[player.ActualSelection.GeneralMenuChoice]; var choice = menu.GetChoice(player.ActualSelection.GeneralMenuSubMenuIndex); EditorCommand command = GetCommand(choice); command.Owner = player; ExecuteCommand(command); return; } if (OpenedPanel != EditorPanel.None) { var panel = Panels[OpenedPanel]; CurrentOpenedPanelPlayer = player; panel.DoClick(player.Circle); return; } if (Simulator.EditorState == EditorState.Playtest) return; if (player.SimPlayer.ActualSelection.CelestialBody != null) { var choice = EditorGUIPlayers[player].CelestialBodyMenu.Menu.GetCurrentChoice(); var command = GetCommand(choice); command.Owner = player; if (player.SimPlayer.ActualSelection.EditingState != EditorEditingState.None) ExecuteCommand(new EditorCelestialBodyCommand("ShowPathPreview") { Owner = player }); ExecuteCommand(command); return; } }
public void DoPlayerConnected(EditorPlayer p) { EditorGUIPlayer player = new EditorGUIPlayer(Simulator, p.Color); player.GeneralMenu = GeneralMenu; Players.Add(p, player); }
public void DoPlayerChanged(EditorPlayer p) { var player = Players[p]; // Change general menu if (PlayerBrowsingGeneralMenu == null || (player == PlayerBrowsingGeneralMenu && player.SelectedGeneralMenu != p.ActualSelection.GeneralMenuChoice)) { if (PlayerBrowsingGeneralMenu == null) PlayerBrowsingGeneralMenu = player; if (player == PlayerBrowsingGeneralMenu) GeneralMenu.DoMenuChanged(player.SelectedGeneralMenu, p.ActualSelection.GeneralMenuChoice, p.Color); if (player == PlayerBrowsingGeneralMenu && p.ActualSelection.GeneralMenuChoice == EditorGeneralMenuChoice.None) PlayerBrowsingGeneralMenu = null; } // update actual selection player.SelectedGeneralMenu = p.ActualSelection.GeneralMenuChoice; player.GeneralMenuSubMenuIndex = p.ActualSelection.GeneralMenuSubMenuIndex; player.CelestialBodyMenu.Menu.SelectedIndex = p.ActualSelection.CelestialBodyChoice; if (p.SimPlayer.ActualSelection.TurretToPlace != null) return; // synchronize celestial body menu if (p.SimPlayer.ActualSelection.CelestialBody != null && player.CelestialBodyMenu.CelestialBody != p.SimPlayer.ActualSelection.CelestialBody) { player.CelestialBodyMenu.CelestialBody = p.SimPlayer.ActualSelection.CelestialBody; player.CelestialBodyMenu.SyncData(); player.CelestialBodyMenu.Visible = true; } else if (p.SimPlayer.ActualSelection.CelestialBody == null) { player.CelestialBodyMenu.CelestialBody = null; player.CelestialBodyMenu.Visible = false; } player.CelestialBodyMenu.Visible = p.SimPlayer.ActualSelection.EditingState == EditorEditingState.None; }
public void DoPlayerDisconnected(EditorPlayer p) { Players.Remove(p); }