Beispiel #1
0
        public void OnGuiCreation(object sender, EventGui e)
        {
            if (e.Type == EventGui.GuiType.Action)
            {
                // We check if the selected module is a landing pad
                Selectable selected = Phi.Instance.GetSelection();
                if (selected is Module)
                {
                    Module module = (Module) selected;
                    if (Phi.Instance.ModuleManager.GetModuleType(module) is ModuleTypeLandingPad)
                    {
                        // The player has selected a Landing Pad, we add the button !
                        // First, we need to retrieve the callback that opens
                        // the GuiLandingPermissions when we click the button
                        GameStateGame gameState = Phi.Instance.GetGameManager().getGameState() as GameStateGame;
                        GuiDefinitions.Callback callback = gameState.toggleWindow<GuiLandingPermissions>;

                        // We now add the button
                        e.GuiMenu.addItem(
                            new GuiMenuItem(
                                ResourceList.getInstance().Icons.LandingPermissions,
                                StringList.get("landing_permissions"),
                                callback
                            )
                        );
                    }
                }
            }
        }
Beispiel #2
0
 public void OnGuiCreation(object sender, EventGui e)
 {
     if (e.Type == EventGui.GuiType.BuildExterior)
     {
         e.GuiMenu.addItem(new GuiMenuItem(ResourceList.getInstance().Icons.BuildExterior, "Test button", new GuiDefinitions.Callback(this.OnButtonClick)));
     }
 }