示例#1
0
        internal static MainMenuGui Create(MonoBehaviour owner)
        {
            MainMenuGui r = owner.gameObject.AddComponent <MainMenuGui>();

            r.owner = owner;
            return(r);
        }
示例#2
0
        public void Update()
        {
            if (this.gui == null)
            {
                Log.dbg("this.gui == null");
                this.gui = MainMenuGui.Create(this);
                this.gui.SetVisible(false);
                RegisterEvents();
            }

            if (changeCallbacks)
            {
                Log.dbg("Update - changeCallbacks: {0}", changeCallbacks);
                RegisterEvents();
            }

            if (Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftControl))
            {
                if (Input.GetKeyDown(KeyCode.F6))
                {
                    Log.dbg("KeyCode: CTRL-F6 pressed");
                    AS.configuration.autoSave = !AS.configuration.autoSave;
                    Log.trace("AutoSave: {0}", AS.configuration.autoSave);
                    this.gui.updateButtonStatus();
                }
            }
            else if (Input.GetKeyDown(activeKeycode))
            {
                Log.dbg("KeyCode: {0} pressed at GameScene: {1}", activeKeycode, HighLogic.LoadedScene);
                if (HighLogic.LoadedScene != GameScenes.MAINMENU)
                {
                    doSnapshots = !doSnapshots;
                    if (!doSnapshots && screenshotTaken && configuration.noGUIOnScreenshot && wasUIVisible)
                    {
                        GameEvents.onShowUI.Fire();
                    }
                }
                else
                {
                    doSnapshots = false;
                }

                Log.dbg("LoadedScene = {0}  doSnapshots: {1}", HighLogic.LoadedScene, doSnapshots);
                this.gui.updateButtonStatus();
            }
        }
示例#3
0
        public void Update()
        {
            if (this.gui == null)
            {
                Log.Info("this.gui == null");
                this.gui = this.gameObject.AddComponent <MainMenuGui> ();
                this.gui.SetVisible(false);
                RegisterEvents();
            }

            if (HighLogic.LoadedScene == GameScenes.MAINMENU)
            {
                if (!configuration.BlizzyToolbarIsAvailable || !configuration.useBlizzyToolbar)
                {
                    gui.OnGUIHideApplicationLauncher();
                }
            }
            else
            {
                if (!configuration.BlizzyToolbarIsAvailable || !configuration.useBlizzyToolbar)
                {
                    if (MainMenuGui.AS_Button == null)
                    {
                        GameEvents.onGUIApplicationLauncherReady.Add(gui.OnGUIApplicationLauncherReady);
                    }
                    gui.OnGUIShowApplicationLauncher();
                }
                else
                {
                    setToolbarButtonVisibility(true);
                }
            }

            if (changeCallbacks)
            {
                Log.Info("Update - changeCallbacks: " + changeCallbacks.ToString());
                RegisterEvents();
            }

            if ((Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftControl)) &&
                Input.GetKeyDown(KeyCode.F5))
            {
                AS.configuration.autoSave = !AS.configuration.autoSave;
                this.gui.set_AS_Button_active();
                ToolBarBusy(AS.configuration.autoSave, AS.doSnapshots);
                Log.Info("AutoSave: " + AS.configuration.autoSave.ToString());
            }

            if (Input.GetKeyDown(activeKeycode))
            {
                Log.Info("Update:     GameScene: " + HighLogic.LoadedScene.ToString());
                if (HighLogic.LoadedScene != GameScenes.MAINMENU)
                {
                    Log.Info("KeyCode: " + activeKeycode.ToString() + " pressed");
                    if (!doSnapshots)
                    {
                        if (!configuration.BlizzyToolbarIsAvailable || !configuration.useBlizzyToolbar)
                        {
                            Log.Info("Before MainMenuGui.AS_Button.SetTexture on");
                            MainMenuGui.AS_Button.SetTexture(MainMenuGui.AS_button_config);

                            Log.Info("After MainMenuGui.AS_Button.SetTexture");
                        }
                        else
                        {
                            ToolBarActive(true);
                        }
                    }
                    else
                    {
                        if (!configuration.BlizzyToolbarIsAvailable || !configuration.useBlizzyToolbar)
                        {
                            Log.Info("MainMenuGui.AS_Button.SetTexture off");
                            MainMenuGui.AS_Button.SetTexture(MainMenuGui.AS_button_off);
                            Log.Info("After MainMenuGui.AS_Button.SetTexture");
                        }
                        else
                        {
                            ToolBarActive(false);
                        }
                    }

                    doSnapshots = !doSnapshots;
                    if (!doSnapshots && screenshotTaken && configuration.noGUIOnScreenshot == true && wasUIVisible)
                    {
                        GameEvents.onShowUI.Fire();
                    }
                    this.gui.set_AS_Button_active();
                    ToolBarBusy(AS.configuration.autoSave, AS.doSnapshots);
                    Log.Info("LoadedScene   doSnapshots: " + doSnapshots.ToString());
                }
                else if (HighLogic.LoadedScene == GameScenes.MAINMENU)
                {
                    Log.Info("LoadedScene = MAINMENU   doSnapshots: " + doSnapshots.ToString());
                    doSnapshots = false;
                }
            }
        }
        public void Update()
        {
            if (this.gui == null) {
                Log.Info ("this.gui == null");
                this.gui = this.gameObject.AddComponent<MainMenuGui> ();
                this.gui.SetVisible (false);
                RegisterEvents ();

            }

            if (HighLogic.LoadedScene == GameScenes.MAINMENU) {
                if (!configuration.BlizzyToolbarIsAvailable || !configuration.useBlizzyToolbar)
                    gui.OnGUIHideApplicationLauncher ();
            } else {
                if (!configuration.BlizzyToolbarIsAvailable || !configuration.useBlizzyToolbar) {
                    if (MainMenuGui.AS_Button == null)
                        GameEvents.onGUIApplicationLauncherReady.Add (gui.OnGUIApplicationLauncherReady);
                    gui.OnGUIShowApplicationLauncher ();
                } else {
                    setToolbarButtonVisibility (true);
                }
            }

            if (changeCallbacks) {
                Log.Info ("Update - changeCallbacks: " + changeCallbacks.ToString ());
                RegisterEvents ();
            }

            if ((Input.GetKey (KeyCode.RightControl) || Input.GetKey (KeyCode.LeftControl)) &&
                Input.GetKeyDown (KeyCode.F6)) {
                AS.configuration.autoSave = !AS.configuration.autoSave;
                this.gui.set_AS_Button_active ();
                ToolBarBusy (AS.configuration.autoSave, AS.doSnapshots);
                Log.Info ("AutoSave: " + AS.configuration.autoSave.ToString ());
            }

            if (Input.GetKeyDown (activeKeycode) && !(Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftControl)))
            {
                Log.Info ("Update:     GameScene: " + HighLogic.LoadedScene.ToString ());
                if (HighLogic.LoadedScene != GameScenes.MAINMENU) {
                    Log.Info ("KeyCode: " + activeKeycode.ToString () + " pressed");
                    if (!doSnapshots) {
                        if (!configuration.BlizzyToolbarIsAvailable || !configuration.useBlizzyToolbar) {
                            Log.Info ("Before MainMenuGui.AS_Button.SetTexture on");
                            MainMenuGui.AS_Button.SetTexture (MainMenuGui.AS_button_config);

                            Log.Info ("After MainMenuGui.AS_Button.SetTexture");
                        } else {
                            ToolBarActive (true);

                        }
                    } else {
                        if (!configuration.BlizzyToolbarIsAvailable || !configuration.useBlizzyToolbar) {
                            Log.Info ("MainMenuGui.AS_Button.SetTexture off");
                            MainMenuGui.AS_Button.SetTexture (MainMenuGui.AS_button_off);
                            Log.Info ("After MainMenuGui.AS_Button.SetTexture");
                        } else {
                            ToolBarActive (false);
                        }
                    }

                    doSnapshots = !doSnapshots;
                    if (!doSnapshots && screenshotTaken && configuration.noGUIOnScreenshot == true && wasUIVisible)
                        GameEvents.onShowUI.Fire ();
                    this.gui.set_AS_Button_active ();
                    ToolBarBusy (AS.configuration.autoSave, AS.doSnapshots);
                    Log.Info ("LoadedScene   doSnapshots: " + doSnapshots.ToString ());
                } else if (HighLogic.LoadedScene == GameScenes.MAINMENU) {
                    Log.Info ("LoadedScene = MAINMENU   doSnapshots: " + doSnapshots.ToString ());
                    doSnapshots = false;
                }
            }
        }
示例#5
0
 internal MainMenuGui()
 {
     Instance = this;
     blizzyToolbarInstalled = ToolbarManager.ToolbarAvailable;
 }