コード例 #1
0
 void StartEach()
 {
     if (CoroutineEach != null)
     {
         return;
     }
     CoroutineEach = QGoTo.Instance.StartCoroutine(UpdateEach());
     QuickGoTo.Log("StartEach", "QBlizzyToolbar");
 }
コード例 #2
0
 void RestartEach()
 {
     if (CoroutineEach == null)
     {
         return;
     }
     StopEach();
     StartEach();
     QuickGoTo.Log("RestartEach", "QBlizzyToolbar");
 }
コード例 #3
0
 void StopEach()
 {
     if (CoroutineEach == null)
     {
         return;
     }
     QGoTo.Instance.StopCoroutine(UpdateEach());
     CoroutineEach = null;
     QuickGoTo.Log("StopEach", "QBlizzyToolbar");
 }
コード例 #4
0
 internal void Reset()
 {
     if (Enabled)
     {
         Init();
     }
     else
     {
         Destroy();
     }
     QuickGoTo.Log("Reset", "QBlizzyToolbar");
 }
コード例 #5
0
        IEnumerator UpdateEach()
        {
            yield return(new WaitForSeconds(1));

            Coroutine _coroutine = CoroutineEach;

            QuickGoTo.Log("StartUpdateEach " + _coroutine.GetHashCode(), "QBlizzyToolbar");
            while (_coroutine == CoroutineEach)
            {
                Update();
                yield return(new WaitForSeconds(1));
            }
            QuickGoTo.Log("EndUpdateEach " + _coroutine.GetHashCode(), "QBlizzyToolbar");
        }
コード例 #6
0
 internal void Destroy()
 {
     if (!isAvailable)
     {
         return;
     }
     if (Button != null)
     {
         Button.Destroy();
         Button = null;
     }
     if (ButtonConf != null)
     {
         ButtonConf.Destroy();
         ButtonConf = null;
     }
     if (ButtonMain != null)
     {
         ButtonMain.Destroy();
         ButtonMain = null;
     }
     if (ButtonSett != null)
     {
         ButtonSett.Destroy();
         ButtonSett = null;
     }
     if (ButtonSC != null)
     {
         ButtonSC.Destroy();
         ButtonSC = null;
     }
     if (ButtonVAB != null)
     {
         ButtonVAB.Destroy();
         ButtonVAB = null;
     }
     if (ButtonSPH != null)
     {
         ButtonSPH.Destroy();
         ButtonSPH = null;
     }
     if (ButtonTS != null)
     {
         ButtonTS.Destroy();
         ButtonTS = null;
     }
     if (ButtonMI != null)
     {
         ButtonMI.Destroy();
         ButtonMI = null;
     }
     if (ButtonAstr != null)
     {
         ButtonAstr.Destroy();
         ButtonAstr = null;
     }
     if (ButtonAdmi != null)
     {
         ButtonAdmi.Destroy();
         ButtonAdmi = null;
     }
     if (ButtonRnD != null)
     {
         ButtonRnD.Destroy();
         ButtonRnD = null;
     }
     if (ButtonRv != null)
     {
         ButtonRv.Destroy();
         ButtonRv = null;
     }
     if (ButtonRvED != null)
     {
         ButtonRvED.Destroy();
         ButtonRvED = null;
     }
     if (ButtonRvSC != null)
     {
         ButtonRvSC.Destroy();
         ButtonRvSC = null;
     }
     if (ButtonRc != null)
     {
         ButtonRc.Destroy();
         ButtonRc = null;
     }
     if (ButtonLves != null)
     {
         ButtonLves.Destroy();
         ButtonLves = null;
     }
     StopEach();
     QuickGoTo.Log("Destroy", "QBlizzyToolbar");
 }
コード例 #7
0
 internal void Init()
 {
     if (!HighLogic.LoadedSceneIsGame || !isAvailable || !Enabled)
     {
         return;
     }
     if (Button != null)
     {
         Button             = ToolbarManager.Instance.add(RegisterToolbar.MOD, RegisterToolbar.MOD);
         Button.TexturePath = TexturePath;
         Button.ToolTip     = RegisterToolbar.MOD;
         Button.OnClick    += (e) => OnClick();
     }
     if ((QSettings.Instance.EnableSettings || HighLogic.LoadedScene == GameScenes.SPACECENTER) && ButtonConf == null)
     {
         ButtonConf             = ToolbarManager.Instance.add(RegisterToolbar.MOD + "Conf", RegisterToolbar.MOD + "Conf");
         ButtonConf.TexturePath = Conf_TexturePath;
         ButtonConf.ToolTip     = QGoTo.Instance.GetText(QGoTo.GoTo.Configurations);
         ButtonConf.OnClick    += (e) => QGoTo.Instance.Settings();
     }
     if (QSettings.Instance.EnableGoToMainMenu && ButtonMain == null)
     {
         ButtonMain             = ToolbarManager.Instance.add(RegisterToolbar.MOD + "Main", RegisterToolbar.MOD + "Main");
         ButtonMain.TexturePath = Main_TexturePath;
         ButtonMain.ToolTip     = QGoTo.Instance.GetText(QGoTo.GoTo.MainMenu);
         ButtonMain.OnClick    += (e) => QGoTo.Instance.mainMenu();
     }
     if (QSettings.Instance.EnableGoToSettings && ButtonSett == null)
     {
         ButtonSett             = ToolbarManager.Instance.add(RegisterToolbar.MOD + "Sett", RegisterToolbar.MOD + "Sett");
         ButtonSett.TexturePath = Sett_TexturePath;
         ButtonSett.ToolTip     = QGoTo.Instance.GetText(QGoTo.GoTo.Settings);
         ButtonSett.OnClick    += (e) => QGoTo.Instance.settings();
     }
     if (QSettings.Instance.EnableGoToSpaceCenter && ButtonSC == null)
     {
         ButtonSC             = ToolbarManager.Instance.add(RegisterToolbar.MOD + "SC", RegisterToolbar.MOD + "SC");
         ButtonSC.TexturePath = SC_TexturePath;
         ButtonSC.ToolTip     = QGoTo.Instance.GetText(QGoTo.GoTo.SpaceCenter);
         ButtonSC.Enabled     = HighLogic.LoadedScene != GameScenes.SPACECENTER;
         ButtonSC.OnClick    += (e) => QGoTo.Instance.spaceCenter();
     }
     if (QSettings.Instance.EnableGoToVAB && ButtonVAB == null && !HighLogic.LoadedSceneIsEditor)
     {
         ButtonVAB             = ToolbarManager.Instance.add(RegisterToolbar.MOD + "VAB", RegisterToolbar.MOD + "VAB");
         ButtonVAB.TexturePath = VAB_TexturePath;
         ButtonVAB.ToolTip     = QGoTo.Instance.GetText(QGoTo.GoTo.VAB);
         ButtonVAB.OnClick    += (e) => QGoTo.Instance.VAB();
     }
     if (QSettings.Instance.EnableGoToSPH && ButtonSPH == null && !HighLogic.LoadedSceneIsEditor)
     {
         ButtonSPH             = ToolbarManager.Instance.add(RegisterToolbar.MOD + "SPH", RegisterToolbar.MOD + "SPH");
         ButtonSPH.TexturePath = SPH_TexturePath;
         ButtonSPH.ToolTip     = QGoTo.Instance.GetText(QGoTo.GoTo.SPH);
         ButtonSPH.OnClick    += (e) => QGoTo.Instance.SPH();
     }
     if (QSettings.Instance.EnableGoToTrackingStation && ButtonTS == null)
     {
         ButtonTS             = ToolbarManager.Instance.add(RegisterToolbar.MOD + "TS", RegisterToolbar.MOD + "TS");
         ButtonTS.TexturePath = TS_TexturePath;
         ButtonTS.ToolTip     = QGoTo.Instance.GetText(QGoTo.GoTo.TrackingStation);
         ButtonTS.Enabled     = HighLogic.LoadedScene != GameScenes.TRACKSTATION;
         ButtonTS.OnClick    += (e) => QGoTo.Instance.trackingStation();
     }
     if (QSettings.Instance.EnableGoToRevert && ButtonRv == null)
     {
         ButtonRv             = ToolbarManager.Instance.add(RegisterToolbar.MOD + "Rv", RegisterToolbar.MOD + "Rv");
         ButtonRv.TexturePath = Rv_TexturePath;
         ButtonRv.ToolTip     = QGoTo.Instance.GetText(QGoTo.GoTo.Revert);
         ButtonRv.Visibility  = new GameScenesVisibility(GameScenes.FLIGHT);
         ButtonRv.OnClick    += (e) => QGoTo.Instance.Revert();
     }
     if (QSettings.Instance.EnableGoToRevertToEditor && ButtonRvED == null)
     {
         ButtonRvED             = ToolbarManager.Instance.add(RegisterToolbar.MOD + "RvED", RegisterToolbar.MOD + "RvED");
         ButtonRvED.TexturePath = RvED_TexturePath;
         ButtonRvED.ToolTip     = QGoTo.Instance.GetText(QGoTo.GoTo.RevertToEditor);
         ButtonRvED.Visibility  = new GameScenesVisibility(GameScenes.FLIGHT);
         ButtonRvED.OnClick    += (e) => QGoTo.Instance.RevertToEditor();
     }
     if (QSettings.Instance.EnableGoToRevertToSpaceCenter && ButtonRvSC == null)
     {
         ButtonRvSC             = ToolbarManager.Instance.add(RegisterToolbar.MOD + "RvSC", RegisterToolbar.MOD + "RvSC");
         ButtonRvSC.TexturePath = RvSC_TexturePath;
         ButtonRvSC.ToolTip     = QGoTo.Instance.GetText(QGoTo.GoTo.RevertToSpaceCenter);
         ButtonRvSC.Visibility  = new GameScenesVisibility(GameScenes.FLIGHT);
         ButtonRvSC.OnClick    += (e) => QGoTo.Instance.RevertToSpaceCenter();
     }
     if (QSettings.Instance.EnableGoToRevert && ButtonRc == null)
     {
         ButtonRc             = ToolbarManager.Instance.add(RegisterToolbar.MOD + "Rc", RegisterToolbar.MOD + "Rc");
         ButtonRc.TexturePath = Rc_TexturePath;
         ButtonRc.ToolTip     = QGoTo.Instance.GetText(QGoTo.GoTo.Recover);
         ButtonRc.Visibility  = new GameScenesVisibility(GameScenes.FLIGHT);
         ButtonRc.OnClick    += (e) => QGoTo.Instance.Recover();
     }
     if (QSettings.Instance.EnableGoToRnD && ButtonRnD == null)
     {
         ButtonRnD             = ToolbarManager.Instance.add(RegisterToolbar.MOD + "RnD", RegisterToolbar.MOD + "RnD");
         ButtonRnD.TexturePath = RnD_TexturePath;
         ButtonRnD.ToolTip     = QGoTo.Instance.GetText(QGoTo.GoTo.RnD);
         ButtonRnD.Visible     = QGoTo.Instance.CanScienceBuilding;
         ButtonRnD.OnClick    += (e) => QGoTo.Instance.RnD();
     }
     if (QSettings.Instance.EnableGoToMissionControl && ButtonMI == null)
     {
         ButtonMI             = ToolbarManager.Instance.add(RegisterToolbar.MOD + "MI", RegisterToolbar.MOD + "MI");
         ButtonMI.TexturePath = MI_TexturePath;
         ButtonMI.ToolTip     = QGoTo.Instance.GetText(QGoTo.GoTo.MissionControl);
         ButtonMI.Visible     = QGoTo.Instance.CanFundBuilding;
         ButtonMI.OnClick    += (e) => QGoTo.Instance.missionControl();
     }
     if (QSettings.Instance.EnableGoToAstronautComplex && ButtonAstr == null)
     {
         ButtonAstr             = ToolbarManager.Instance.add(RegisterToolbar.MOD + "Astr", RegisterToolbar.MOD + "Astr");
         ButtonAstr.TexturePath = Astr_TexturePath;
         ButtonAstr.ToolTip     = QGoTo.Instance.GetText(QGoTo.GoTo.AstronautComplex);
         ButtonAstr.OnClick    += (e) => QGoTo.Instance.astronautComplex();
     }
     if (QSettings.Instance.EnableGoToAdministration && ButtonAdmi == null)
     {
         ButtonAdmi             = ToolbarManager.Instance.add(RegisterToolbar.MOD + "Admi", RegisterToolbar.MOD + "Admi");
         ButtonAdmi.TexturePath = Admi_TexturePath;
         ButtonAdmi.ToolTip     = QGoTo.Instance.GetText(QGoTo.GoTo.Administration);
         ButtonAdmi.Visible     = QGoTo.Instance.CanFundBuilding;
         ButtonAdmi.OnClick    += (e) => QGoTo.Instance.administration();
     }
     if (QSettings.Instance.EnableGoToLastVessel && ButtonLves == null)
     {
         ButtonLves             = ToolbarManager.Instance.add(RegisterToolbar.MOD + "Lves", RegisterToolbar.MOD + "Lves");
         ButtonLves.TexturePath = Lves_TexturePath;
         ButtonLves.ToolTip     = QGoTo.Instance.GetText(QGoTo.GoTo.LastVessel);
         ButtonLves.OnClick    += (e) => QGoTo.Instance.LastVessel();
     }
     if (HighLogic.LoadedSceneIsFlight)
     {
         StartEach();
     }
     QuickGoTo.Log("Init", "QBlizzyToolbar");
 }