Exemplo n.º 1
0
        public override void OnAwake()
        {
            this.Log_DebugOnly("OnAwake", "Scene[{0}]", HighLogic.LoadedScene);
            base.OnAwake();

            if (cls == null)
            {
                cls = CLSClient.GetCLS();
            }

            if (mainWindow == null)
            {
                mainWindow = gameObject.AddComponent <MainWindow>();
                mainWindow.Init(this);
            }

            if (logWindow == null)
            {
                logWindow = gameObject.AddComponent <LogWindow>();
                logWindow.Init(this);
            }

            if (configWindow == null)
            {
                configWindow = gameObject.AddComponent <ConfigWindow>();
                configWindow.Init(this);
            }

            if (rosterWindow == null)
            {
                this.Log_DebugOnly("OnAwake", "Constructing rosterWindow");
                rosterWindow = gameObject.AddComponent <RosterWindow>();
                rosterWindow.Init(this);
            }

            if (allVesselsWindow == null)
            {
                this.Log_DebugOnly("OnAwake", "Constructing allVesselsWindow");
                allVesselsWindow = gameObject.AddComponent <AllVesselsWindow>();
                allVesselsWindow.Init(this);
            }



            if (appLauncherButton != null)
            {
                this.Log_DebugOnly("OnAwake", "AppLauncher button already here");
            }
            else
            {
                this.Log_DebugOnly("OnAwake", "Adding AppLauncher button");

                Texture toolbarButtonTexture         = (Texture)GameDatabase.Instance.GetTexture("KeepFit/KeepFit", false);
                ApplicationLauncher.AppScenes scenes = ApplicationLauncher.AppScenes.FLIGHT |
                                                       //ApplicationLauncher.AppScenes.MAPVIEW |
                                                       ApplicationLauncher.AppScenes.SPACECENTER |
                                                       //ApplicationLauncher.AppScenes.SPH |
                                                       //ApplicationLauncher.AppScenes.VAB |
                                                       ApplicationLauncher.AppScenes.TRACKSTATION;

                appLauncherButton = ApplicationLauncher.Instance.AddModApplication(onAppLaunchToggleOn,
                                                                                   onAppLaunchToggleOff,
                                                                                   onAppLaunchHoverOn,
                                                                                   onAppLaunchHoverOff,
                                                                                   onAppLaunchEnable,
                                                                                   onAppLaunchDisable,
                                                                                   scenes,
                                                                                   toolbarButtonTexture);
                ApplicationLauncher.Instance.AddOnRepositionCallback(onAppLauncherReposition);

                if (ToolbarManager.ToolbarAvailable && ToolbarManager.Instance != null)
                {
                    this.Log_DebugOnly("OnAwake", "Adding Toolbar Button");
                    this.toolmodLauncherButton = ToolbarManager.Instance.add("KeepFit", "MainButton");
                    if (this.toolmodLauncherButton != null)
                    {
                        appLauncherButton.VisibleInScenes      = scenes; // TODO
                        this.toolmodLauncherButton.Visibility  = new GameScenesVisibility(new GameScenes[] { GameScenes.SPACECENTER, GameScenes.EDITOR, GameScenes.FLIGHT, GameScenes.TRACKSTATION });
                        this.toolmodLauncherButton.TexturePath = "KeepFit/UIResources/KeepFit";
                        this.toolmodLauncherButton.ToolTip     = "KeepFit Toolbar";
                        this.toolmodLauncherButton.OnClick    += ((e) => this.toolmodButtonToggle());
                    }
                }
            }


            this.Log_DebugOnly("OnAwake", "Adding KeepFitCrewRosterController");
            crewRosterController = gameObject.AddComponent <KeepFitCrewRosterController>();
            crewRosterController.Init(this);

            if (HighLogic.LoadedScene == GameScenes.FLIGHT ||
                HighLogic.LoadedScene == GameScenes.TRACKSTATION ||
                HighLogic.LoadedScene == GameScenes.SPACECENTER)
            {
                this.Log_DebugOnly("OnAwake", "Adding KeepFitCrewFitnessController");
                crewFitnessController = gameObject.AddComponent <KeepFitCrewFitnessController>();
                crewFitnessController.Init(this);
            }

            if (HighLogic.LoadedScene == GameScenes.FLIGHT)
            {
                this.Log_DebugOnly("OnAwake", "Adding KeepFitGeeEffectsController");
                this.geeEffectsController = gameObject.AddComponent <KeepFitGeeEffectsController>();
                this.geeEffectsController.Init(this);
            }
        }
Exemplo n.º 2
0
        public override void OnAwake()
        {
            this.Log_DebugOnly("OnAwake", "Scene[{0}]", HighLogic.LoadedScene);
            base.OnAwake();

            if (mainWindow == null)
            {
                mainWindow = gameObject.AddComponent <MainWindow>();
                mainWindow.Init(this);
            }

            if (logWindow == null)
            {
                logWindow = gameObject.AddComponent <LogWindow>();
                logWindow.Init(this);
            }

            if (configWindow == null)
            {
                configWindow = gameObject.AddComponent <ConfigWindow>();
                configWindow.Init(this);
            }

            if (rosterWindow == null)
            {
                this.Log_DebugOnly("OnAwake", "Constructing rosterWindow");
                rosterWindow = gameObject.AddComponent <RosterWindow>();
                rosterWindow.Init(this);
            }

            if (allVesselsWindow == null)
            {
                this.Log_DebugOnly("OnAwake", "Constructing allVesselsWindow");
                allVesselsWindow = gameObject.AddComponent <AllVesselsWindow>();
                allVesselsWindow.Init(this);
            }


            if (appLauncherButton != null)
            {
                this.Log_DebugOnly("OnAwake", "AppLauncher button already here");
            }
            else
            {
                this.Log_DebugOnly("OnAwake", "Adding AppLauncher button");

                Texture toolbarButtonTexture         = (Texture)GameDatabase.Instance.GetTexture("Timmers/KeepFit/KeepFit", false);
                ApplicationLauncher.AppScenes scenes = ApplicationLauncher.AppScenes.FLIGHT |
                                                       ApplicationLauncher.AppScenes.MAPVIEW |
                                                       ApplicationLauncher.AppScenes.SPACECENTER |
                                                       ApplicationLauncher.AppScenes.SPH |
                                                       ApplicationLauncher.AppScenes.VAB |
                                                       ApplicationLauncher.AppScenes.TRACKSTATION;

                appLauncherButton = ApplicationLauncher.Instance.AddModApplication(onAppLaunchToggleOn,
                                                                                   onAppLaunchToggleOff,
                                                                                   onAppLaunchHoverOn,
                                                                                   onAppLaunchHoverOff,
                                                                                   onAppLaunchEnable,
                                                                                   onAppLaunchDisable,
                                                                                   scenes,
                                                                                   toolbarButtonTexture);
                ApplicationLauncher.Instance.AddOnRepositionCallback(onAppLauncherReposition);
            }


            this.Log_DebugOnly("OnAwake", "Adding KeepFitCrewRosterController");
            crewRosterController = gameObject.AddComponent <KeepFitCrewRosterController>();
            crewRosterController.Init(this);

            if (HighLogic.LoadedScene == GameScenes.FLIGHT ||
                HighLogic.LoadedScene == GameScenes.TRACKSTATION ||
                HighLogic.LoadedScene == GameScenes.SPACECENTER)
            {
                this.Log_DebugOnly("OnAwake", "Adding KeepFitCrewFitnessController");
                crewFitnessController = gameObject.AddComponent <KeepFitCrewFitnessController>();
                crewFitnessController.Init(this);
            }

            if (HighLogic.LoadedScene == GameScenes.FLIGHT)
            {
                this.Log_DebugOnly("OnAwake", "Adding KeepFitGeeEffectsController");
                this.geeEffectsController = gameObject.AddComponent <KeepFitGeeEffectsController>();
                this.geeEffectsController.Init(this);
            }
        }
Exemplo n.º 3
0
        public override void OnAwake()
        {
            this.Log_DebugOnly("OnAwake", "Scene[{0}]", HighLogic.LoadedScene);
            base.OnAwake();

            if (cls == null)
            {
                cls = CLSClient.GetCLS();
            }

            if (mainWindow == null)
            {
                mainWindow = gameObject.AddComponent<MainWindow>();
                mainWindow.Init(this);
            }

            if (logWindow == null)
            {
                logWindow = gameObject.AddComponent<LogWindow>();
                logWindow.Init(this);
            }

            if (configWindow == null)
            {
                configWindow = gameObject.AddComponent<ConfigWindow>();
                configWindow.Init(this);
            }

            if (rosterWindow == null)
            {
                this.Log_DebugOnly("OnAwake", "Constructing rosterWindow");
                rosterWindow = gameObject.AddComponent<RosterWindow>();
                rosterWindow.Init(this);
            }

            if (allVesselsWindow == null)
            {
                this.Log_DebugOnly("OnAwake", "Constructing allVesselsWindow");
                allVesselsWindow = gameObject.AddComponent<AllVesselsWindow>();
                allVesselsWindow.Init(this);
            }

            if (appLauncherButton != null)
            {
                this.Log_DebugOnly("OnAwake", "AppLauncher button already here");
            }
            else
            {
                this.Log_DebugOnly("OnAwake", "Adding AppLauncher button");

                Texture toolbarButtonTexture = (Texture)GameDatabase.Instance.GetTexture("KeepFit/KeepFit", false);
                ApplicationLauncher.AppScenes scenes = ApplicationLauncher.AppScenes.FLIGHT |
                                                       ApplicationLauncher.AppScenes.MAPVIEW |
                                                       ApplicationLauncher.AppScenes.SPACECENTER |
                                                       ApplicationLauncher.AppScenes.SPH |
                                                       ApplicationLauncher.AppScenes.VAB |
                                                       ApplicationLauncher.AppScenes.TRACKSTATION;

                appLauncherButton = ApplicationLauncher.Instance.AddModApplication(onAppLaunchToggleOn,
                                                               onAppLaunchToggleOff,
                                                               onAppLaunchHoverOn,
                                                               onAppLaunchHoverOff,
                                                               onAppLaunchEnable,
                                                               onAppLaunchDisable,
                                                               scenes,
                                                               toolbarButtonTexture);
                ApplicationLauncher.Instance.AddOnRepositionCallback(onAppLauncherReposition);
            }

            this.Log_DebugOnly("OnAwake", "Adding KeepFitCrewRosterController");
            crewRosterController = gameObject.AddComponent<KeepFitCrewRosterController>();
            crewRosterController.Init(this);

            if (HighLogic.LoadedScene == GameScenes.FLIGHT ||
                HighLogic.LoadedScene == GameScenes.TRACKSTATION ||
                HighLogic.LoadedScene == GameScenes.SPACECENTER)
            {
                this.Log_DebugOnly("OnAwake", "Adding KeepFitCrewFitnessController");
                crewFitnessController = gameObject.AddComponent<KeepFitCrewFitnessController>();
                crewFitnessController.Init(this);
            }

            if (HighLogic.LoadedScene == GameScenes.FLIGHT)
            {
                this.Log_DebugOnly("OnAwake", "Adding KeepFitGeeEffectsController");
                this.geeEffectsController = gameObject.AddComponent<KeepFitGeeEffectsController>();
                this.geeEffectsController.Init(this);
            }
        }