コード例 #1
0
ファイル: CI.cs プロジェクト: linuxgurugamer/CraftImport
        /*
         * static CI ()
        {
        }
        */
        //        public CI ()
        //        {
        //            Log.Info ("New instance of Craft Import: CI constructor");
        //        }
        //        public void Awake ()
        //        {
        //            uiVisiblity = new UICLASS ();
        //            uiVisiblity.Awake ();
        //        }
        public void Start()
        {
            //DontDestroyOnLoad (this);
            configuration = new Configuration ();
            configuration.Load ();
            #if (DEBUG)
            Log.SetLevel (Log.LEVEL.INFO);
            #else
            Log.SetLevel (configuration.logLevel);
            #endif

            if (this.gui == null) {
                this.gui = this.gameObject.AddComponent<MainMenuGui> ();
                //gui.UpdateToolbarStock ();
                gui.thisCI = this;
                gui.SetVisible (false);

            }

            configuration.BlizzyToolbarIsAvailable = ToolbarManager.ToolbarAvailable;
            Log.Info ("BlizzyToolbarIsAvailable: " + configuration.BlizzyToolbarIsAvailable.ToString ());
            if (configuration.BlizzyToolbarIsAvailable) {
                InitToolbarButton ();
                if (configuration.useBlizzyToolbar) {
                    setToolbarButtonVisibility (true);
                } else {
                    gui.UpdateToolbarStock ();
                    setToolbarButtonVisibility (false);
                }
            }
            else
                gui.UpdateToolbarStock ();
        }
コード例 #2
0
ファイル: CI.cs プロジェクト: linuxgurugamer/CraftImport
        public void Start()
        {
            Instance = this;
            //DontDestroyOnLoad (this);
            configuration = new Configuration();
            configuration.Load();
#if (DEBUG)
            Log.SetLevel(Log.LEVEL.INFO);
#else
            Log.SetLevel(configuration.logLevel);
#endif

            if (this.gui == null)
            {
                this.gui = this.gameObject.AddComponent <MainMenuGui> ();
                //gui.UpdateToolbarStock ();
                gui.thisCI = this;
                gui.SetVisible(false);
            }
        }
コード例 #3
0
ファイル: CI_gui.cs プロジェクト: linuxgurugamer/CraftImport
 internal MainMenuGui()
 {
     Instance = this;
     blizzyToolbarInstalled = ToolbarManager.ToolbarAvailable;
 }
コード例 #4
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;
					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
        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;
                    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;
                }
            }
        }