Exemple #1
0
        void Start()
        {
            fetch = this;
            if (toolbarControl == null)
            {
                toolbarControl = gameObject.AddComponent <ToolbarControl>();
                toolbarControl.AddToAllToolbars(GuiOn, GuiOff,
                                                ApplicationLauncher.AppScenes.SPACECENTER | ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW,
                                                MODID,
                                                "dangerAlertButton",
                                                "ResourceMonitors/PluginData/Icons/icon_38",
                                                "ResourceMonitors/PluginData/Icons/icon_24",
                                                MODNAME
                                                );
            }
            if (soundplayer == null)
            {
                soundplayer = new AlertSoundPlayer();
                soundplayer.Initialize("selection");
            }
            GameEvents.onVesselChange.Add(onVesselChange);
            GameEvents.OnGameSettingsApplied.Add(OnGameSettingsApplied);

            GameEvents.onGamePause.Add(onGamePause);
            GameEvents.onGameUnpause.Add(onGameUnpause);

            GameEvents.onShowUI.Add(ShowUI);
            GameEvents.onHideUI.Add(HideUI);
        }
Exemple #2
0
        public AppLauncher(GameObject gameObject)
        {
            Log.Info("AppLauncher instantiation");
            if (instance == null)
            {
                instance = this;
            }
            Log.Info("iconPathActive: " + iconPathActive + ", iconPath: " + iconPath);
            Log.Info("toolbarIconPathActive: " + toolbarIconPathActive + ", toolbarIconPath: " + toolbarIconPath);


            toolbarControl = gameObject.AddComponent <ToolbarControl>();
            toolbarControl.AddToAllToolbars(onTrue, onFalse,
                                            visibleScenes,
                                            MODID,
                                            "RCSBuildAidButton",
                                            iconPathActive,
                                            iconPath,
                                            toolbarIconPathActive,
                                            toolbarIconPath,
                                            MODNAME
                                            );

            if (RCSBuildAid.Enabled)
            {
                toolbarControl.SetTrue(false);
            }
            Events.PluginEnabled  += onPluginEnable;
            Events.PluginDisabled += onPluginDisable;
        }
Exemple #3
0
        void Start()
        {
#if false
            if (HighLogic.LoadedScene == GameScenes.EDITOR)
            {
                anyresWinRect.x = Screen.width - 272;
                anyresWinRect.y = Screen.height - 231;
            }
            Debug.Log("[AnyRes] Loaded, scene: " + HighLogic.LoadedScene);
#endif


            xString    = GameSettings.SCREEN_RESOLUTION_WIDTH.ToString();
            yString    = GameSettings.SCREEN_RESOLUTION_HEIGHT.ToString();
            fullScreen = GameSettings.FULLSCREEN;

            files = UpdateFilesList();

            Log.Info("SceneLoaded, scene: " + HighLogic.LoadedScene);
            toolbarControl = gameObject.AddComponent <ToolbarControl>();
            toolbarControl.AddToAllToolbars(OnTrue, OnFalse,
                                            ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW |
                                            ApplicationLauncher.AppScenes.SPACECENTER |
                                            ApplicationLauncher.AppScenes.SPH |
                                            ApplicationLauncher.AppScenes.TRACKSTATION | ApplicationLauncher.AppScenes.VAB,
                                            MODID,
                                            "AnyResButton",
                                            "AnyRes/textures/Toolbar_32",
                                            "AnyRes/textures/Toolbar_24",
                                            MODNAME);
        }
Exemple #4
0
        public void Start()
        {
            if (!HighLogic.CurrentGame.Parameters.CustomParams <EI>().allowTestMode)
            {
                return;
            }
#if false
            // this is needed because of a bug in KSP with event onGUIAppLauncherReady.
            if (activeToolbarType == ToolBarSelected.stock)
            {
                OnGUIAppLauncherReady();
            }
#endif
            toolbarControl = gameObject.AddComponent <ToolbarControl>();
            toolbarControl.AddToAllToolbars(ToggleIgnitorActive, ToggleIgnitorActive,
                                            ApplicationLauncher.AppScenes.FLIGHT |
                                            ApplicationLauncher.AppScenes.MAPVIEW,
                                            MODID,
                                            "engineIgnitorButton",
                                            StockToolbarIconInactive,
                                            StockToolbarIconActive,
                                            BlizzyToolbarIconInactive,
                                            BlizzyToolbarIconActive,

                                            MODNAME
                                            );
        }
        void CreateAppButton()
        {
            toolbarControl = gameObject.AddComponent <ToolbarControl>();
            toolbarControl.AddToAllToolbars(MiniOn,
                                            MiniOff,
                                            ApplicationLauncher.AppScenes.VAB | ApplicationLauncher.AppScenes.SPH | ApplicationLauncher.AppScenes.FLIGHT,
                                            MODID,
                                            "wernerCheckerButton",
                                            "WernherChecker/Images/icon-38",
                                            "WernherChecker/Images/icon-24",
                                            MODNAME
                                            );


            if (!minimized)
            {
                toolbarControl.SetTrue(true);
            }
            if (HighLogic.LoadedScene == GameScenes.EDITOR)
            {
                minimized = !HighLogic.CurrentGame.Parameters.CustomParams <WernersSettings>().alwaysOpeninEditor;
            }
            if (HighLogic.LoadedScene == GameScenes.FLIGHT)
            {
                minimized = !HighLogic.CurrentGame.Parameters.CustomParams <WernersSettings>().alwaysOpenInFlight;
            }
        }
Exemple #6
0
        private void InitializeButton()
        {
#if false
            if (this.button != null)
            {
                KillButton();
            }
            if (canHail)
            {
                this.button = ApplicationLauncher.Instance.AddModApplication(
                    this.OnTrue,
                    this.OnFalse,
                    null,
                    null,
                    null,
                    null,
                    ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW,
                    ESLDButtonOn);
            }
#endif
            if (toolbarControl == null)
            {
                toolbarControl = gameObject.AddComponent <ToolbarControl>();
                toolbarControl.AddToAllToolbars(this.OnTrue,
                                                this.OnFalse,
                                                ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW,
                                                MODID,
                                                "esldButton",
                                                "ESLDBeacons/PluginData/Textures/launcher-38",
                                                "ESLDBeacons/PluginData/Textures/launcher-24",
                                                MODNAME
                                                );
            }
        }
        internal void InitializeToolbar(GameObject go)
        {
            ApplicationLauncher.AppScenes spaceCenter = 0;

            Log.info("InitializeToolbar");
            if (toolbarControl == null)
            {
                if (!Settings1.Instance.hideSpaceCenterButton)
                {
                    spaceCenter = ApplicationLauncher.AppScenes.SPACECENTER;
                }
                toolbarControl = go.AddComponent <ToolbarControl>();
                toolbarControl.AddToAllToolbars(
                    ShowWindow,
                    hideAll,
                    OnHoverOn,
                    OnHoverOff,
                    null,
                    null,
                    (
                        spaceCenter |
                        ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.SPH | ApplicationLauncher.AppScenes.VAB | ApplicationLauncher.AppScenes.MAPVIEW),
                    RegisterToolbar.MODID,
                    "stageControlButton",
                    File.Asset.Solve("Icons", "icon-38"),
                    File.Asset.Solve("Icons", "icon-24"),
                    RegisterToolbar.MODNAME
                    );
            }
        }
Exemple #8
0
        //int scaler;
        //public void OnGUI()
        //{
        //	if (_extraScaleNodes != null && _extraScaleNodes.Count > 0)
        //	{
        //		Debugger.advancedDebug("Pre - " + _extraScaleNodes[0].transform.localScale.x + " - " + _extraScaleNodes[0].transform.localScale.y + " - " + _extraScaleNodes[0].transform.localScale.z, true);
        //		scaler = (int)GUI.HorizontalSlider(new Rect(500, 500, 500, 50), scaler, 1, 5);
        //		if (Input.GetKey(KeyCode.Return))
        //		{
        //			_extraScaleNodes[0].transform.localScale = new Vector3(scaler, scaler, scaler);
        //		}
        //		Debugger.advancedDebug("Post - " + _extraScaleNodes[0].transform.localScale.x + " - " + _extraScaleNodes[0].transform.localScale.y + " - " + _extraScaleNodes[0].transform.localScale.z, true);
        //	}
        //}


        /// <summary>
        /// public method to load the icons into the stock toolbar button.
        /// </summary>
        public void loadToolbarButton()
        {
            if (_extendIcon == null)
            {
                _extendIcon = GameDatabase.Instance.GetTexture(Constants.extentIconFileName + "_38", false);
            }
            if (_shrinkIcon == null)
            {
                _shrinkIcon = GameDatabase.Instance.GetTexture(Constants.shrinkIconFileName + "_38", false);
            }
#if false
            if (_toolbarButton == null)
            {
                _toolbarButton = ApplicationLauncher.Instance.AddModApplication(() => StartCoroutine(toggleScaling()), () => StartCoroutine(toggleScaling()),
                                                                                null, null, null, null, ApplicationLauncher.AppScenes.VAB | ApplicationLauncher.AppScenes.SPH, _extendIcon);
                Debugger.advancedDebug("Applauncher loading complete", true);
            }
#endif
            toolbarControl = gameObject.AddComponent <ToolbarControl>();
            toolbarControl.AddToAllToolbars(ToggleScalingRoutine, ToggleScalingRoutine,
                                            ApplicationLauncher.AppScenes.VAB | ApplicationLauncher.AppScenes.SPH,
                                            MODID,
                                            "fsEditorExtenderButton",
                                            Constants.extentIconFileName + "_38",
                                            Constants.extentIconFileName + "_24",
                                            MODNAME
                                            );
            //toolbarControl.UseBlizzy(HighLogic.CurrentGame.Parameters.CustomParams<HangerExtender>().useBlizzy);
        }
Exemple #9
0
        public void Start()
        {
            Log.Info("OnStart");
            if (Instance != null)
            {
                // Reloading of GameDatabase causes another copy of addon to spawn at next opportunity. Suppress it.
                // see: https://forum.kerbalspaceprogram.com/index.php?/topic/7542-x/&do=findComment&comment=3574980
                Destroy(gameObject);
                return;
            }

            audioSource = GetComponent <AudioSource>();

            toolbarControl = gameObject.AddComponent <ToolbarControl>();
            toolbarControl.AddToAllToolbars(
                OnClick, OnClick,
                ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW,
                MODID,
                "biomaticButton",
                IconPath + "BiomaticUnavailable",
                MODNAME
                );

            GameEvents.onHideUI.Add(this.HideUIAction);
            GameEvents.onShowUI.Add(this.ShowUIAction);
            GameEvents.onGamePause.Add(this.HideUIWhenPaused);
            GameEvents.onGameUnpause.Add(this.ShowUIwhenPaused);

            if (ElectricChargeID == default(int))
            {
                ElectricChargeID = PartResourceLibrary.Instance.GetDefinition("ElectricCharge").id;
            }
        }
Exemple #10
0
        private void OnGUIAppLauncherReady()
        {
            //Log.Info("OnGUIAppLauncherReady");
            // Setup PW Stock Toolbar button
            bool hidden = false;

#if false
            if (ApplicationLauncher.Ready && !ApplicationLauncher.Instance.Contains(tacAtomicClockButton, out hidden))
            {
                tacAtomicClockButton = ApplicationLauncher.Instance.AddModApplication(
                    ToggleToolbarButton,
                    ToggleToolbarButton,
                    null, null, null, null,
                    ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.SPACECENTER | ApplicationLauncher.AppScenes.TRACKSTATION,

                    (Texture)GameDatabase.Instance.GetTexture(StockToolbarIcon, false));
            }
#endif
            toolbarControl = gameObject.AddComponent <ToolbarControl>();
            toolbarControl.AddToAllToolbars(ToggleToolbarButton, ToggleToolbarButton,
                                            ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.SPACECENTER | ApplicationLauncher.AppScenes.TRACKSTATION,
                                            MODID,
                                            "atomicClockButton",
                                            StockToolbarIcon,
                                            BlizzyToolbarIcon,
                                            MODNAME
                                            );
        }
Exemple #11
0
        void AddButton()
        {
            if (toolbarControl != null) // || ! ApplicationLauncher.Ready)
            {
                return;
            }

            ApplicationLauncher.AppScenes scenes = ApplicationLauncher.AppScenes.VAB | ApplicationLauncher.AppScenes.SPH;
            if (showInFlight)
            {
                scenes |= ApplicationLauncher.AppScenes.FLIGHT;
            }

            toolbarControl = gameObject.AddComponent <ToolbarControl>();
            toolbarControl.AddToAllToolbars(ShowWindowTrue, ShowWindowFalse,
                                            scenes,
                                            VAB_MODID,
                                            "vabSmartStageButton",
                                            "SmartStage/SmartStage38-active",
                                            "SmartStage/SmartStage38",
                                            "SmartStage/SmartStage24-active",
                                            "SmartStage/SmartStage24",
                                            MODNAME
                                            );
        }
Exemple #12
0
 private void MakeButton()
 {
     if (toolbarControl == null)
     {
         toolbarControl = gameObject.AddComponent <ToolbarControl>();
         toolbarControl.AddToAllToolbars(ProximityHide, ProximityShow,
                                         ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW,
                                         MODID,
                                         "proximityButton",
                                         GetTextureName(38),
                                         GetTextureName(24),
                                         MODNAME
                                         );
         toolbarControl.AddLeftRightClickCallbacks(null, ToggleOnRightClick);
     }
     toolbarControl.buttonActive = true;
     if (!Proximity.ToolbarShowSettings)
     {
         toolbarControl.SetTrue(false);
     }
     else
     {
         toolbarControl.SetFalse(false);
     }
 }