예제 #1
0
        // Toggles plugin visibility.
        private void Toggle()
        {
            if (_visible)
            {
                _visible  = false;
                _showList = false;
                toolbarControl.SetTexture(_btextureOff + "_38", _btextureOff + "_24");
#if false
                if (!ToolbarManager.ToolbarAvailable)
                {
                    return;
                }
                _button.TexturePath = _btextureOff;
                _button.ToolTip     = _tooltipOff;
#endif
            }
            else
            {
                _visible = true;
                toolbarControl.SetTexture(_btextureOn + "_38", _btextureOn + "_24");
#if false
                if (!ToolbarManager.ToolbarAvailable)
                {
                    return;
                }
                _button.TexturePath = _btextureOn;
                _button.ToolTip     = _tooltipOn;
#endif
            }
        }
        /** Called every frame */
        public void FixedUpdate()
        {
            if (statusHasChanged() || timeIsUp())
            {
                StatusUpdate();
            }
            if (possExperiments.Count > 0 && toolbarControl != null && !expGUI)
            {
                toolbarControl.SetTexture(onReady + "-38", onReady + "-24");
            }
            else if (toolbarControl != null)
            {
                toolbarControl.SetTexture(getButtonTexture + "-38", getButtonTexture + "-24");
            }
            expListRect.width  = windowWidth;
            expListRect.height = windowHeight;

            /** Comment out the following code pre release!!! */

            /**
             * if (Input.GetKeyDown(KeyCode.End))
             * {
             *  ResearchAndDevelopment.Instance.CheatAddScience(100000);
             *  Reputation.Instance.AddReputation(100000, TransactionReasons.Cheating);
             *  Funding.Instance.AddFunds(100000, TransactionReasons.Cheating);
             * }
             */
        }
 void RightClick()
 {
     rightClickDisabled = !rightClickDisabled;
     if (rightClickDisabled)
     {
         toolbarControl.SetTexture(TOOLBAR_BTN_disabled_38, TOOLBAR_BTN_disabled_24);
     }
     else
     {
         toolbarControl.SetTexture(TOOLBAR_BTN_38, TOOLBAR_BTN_24);
     }
 }
 static internal void ToggleFocusSetting()
 {
     focusFollowsclick = !focusFollowsclick;
     if (focusFollowsclick)
     {
         clickThroughToggleControl.SetTexture(FFC_38, FFC_24);
     }
     else
     {
         clickThroughToggleControl.SetTexture(FFM_38, FFM_24);
     }
 }
예제 #5
0
        public void SetHoverOn()
        {
            curVsl.controlState   = 1;
            curVsl.targetSelected = false;
            selectingTarget       = false;
            SetWidth(curVsl.theLine, 0, 0);

            toolbarControl.SetTexture("Diazo/RCSLandAid/PluginData/Textures/iconBlue-38", "Diazo/RCSLandAid/PluginData/Textures/iconBlue-24");
            showLAMenu = false;
            //              }
            selectingTarget       = false;
            curVsl.targetSelected = false;
        }
예제 #6
0
 public void InDanger(bool danger)
 {
     if (danger)
     {
         //dangerAlertButton.SetTexture(dangerTexture);
         toolbarControl.SetTexture("DangerAlerts/Icons/dangericon", "DangerAlerts/Icons/dangericon_24");
     }
     else
     {
         //dangerAlertButton.SetTexture(safeTexture);
         toolbarControl.SetTexture("DangerAlerts/Icons/safeicon", "DangerAlerts/Icons/safeicon_24");
     }
 }
예제 #7
0
        protected void SetIconTexture(string texturePath)
        {
#if false
            if (texturePath == null)
            {
                return;
            }

            if (this.ToolbarButton != null)
            {
                this.ToolbarButton.TexturePath = texturePath;
            }

            if (this.AppLauncherButton != null)
            {
                this.VOIDIconTexture = GameDatabase.Instance.GetTexture(texturePath.Replace("icon", "appIcon"), false);

                this.AppLauncherButton.SetTexture(VOIDIconTexture);
            }
#endif
            if (toolbarControl != null)
            {
                toolbarControl.SetTexture(texturePath.Replace("icon", "appIcon"), texturePath);
            }
        }
예제 #8
0
 public void RefreshButtonTexture()
 {
     if (toolbarControl != null)
     {
         toolbarControl.SetTexture(GetTextureName(38), GetTextureName(24));
     }
 }
예제 #9
0
        public void SetAppLauncherButtonTexture(rcvrStatus status)
        {
            switch (status)
            {
            case rcvrStatus.OFF:
                tex2d = kgps_button_off;
                break;

            case rcvrStatus.SATS:
                tex2d = kgps_button_on_sat;
                break;

            case rcvrStatus.NOSATS:
                tex2d = kgps_button_on_nosat;
                break;

            case rcvrStatus.NONE:
                tex2d = kgps_button_nogps;
                break;
            }

            // Set new Launcher Button texture
            if (toolbarControl != null)
            {
                if (tex2d != kgps_button_Texture)
                {
                    kgps_button_Texture = tex2d;
                    toolbarControl.SetTexture(tex2d + "-38", tex2d + "-24");
                }
            }
        }
예제 #10
0
        /// <summary>
        /// Is called by Update whenever animation exists to
        /// update animation frame.
        ///
        /// Note: I didn't make this into an actual coroutine
        /// because StopCoroutine seems to sometimes throw
        /// exceptions
        /// </summary>
        /// <returns></returns>
        IEnumerator DoAnimation()
        {
            float elapsed = 0f;

            while (true)
            {
                while (elapsed < 1f / FrameRate)
                {
                    elapsed += Time.deltaTime;
                    yield return(new WaitForSeconds(1f / FrameRate));
                }
                elapsed     -= 1f / FrameRate;
                CurrentFrame = (CurrentFrame + 1) % FrameCount;
                TexturePath  = StarFlaskTextures[CurrentFrame];
                toolbarControl.SetTexture(StarFlaskTextures38[CurrentFrame], StarFlaskTextures[CurrentFrame]);
            }
        }
예제 #11
0
 public void set_WASD_Button_active(bool i)
 {
     if (!active)
     {
         toolbarControl.SetTexture(TEXTURE_DIR + "WASD-disabled-38",
                                   TEXTURE_DIR + "WASD-disabled-24");
     }
     else
     {
         on = i;
         if (!i)
         {
             toolbarControl.SetTexture(TEXTURE_DIR + "WASD-38", TEXTURE_DIR + "WASD-24");
         }
         else
         {
             toolbarControl.SetTexture(TEXTURE_DIR + "WASD-on-38", TEXTURE_DIR + "WASD-on-24");
         }
     }
 }
 internal override void Update()
 {
     base.Update();
     if (ConcernRunner.Instance == null)
     {
         return;
     }
     if (ConcernRunner.Instance.TestsPass)
     {
         Log.Info("Update TestsPass");
         toolbarControl.SetTexture(TestsPassingIconLocation + "-38", TestsPassingIconLocation + "-24");
         EditorLogic.fetch.launchBtn.image.color = Color.green;
     }
     else
     {
         Log.Info("Update TEstsFail");
         toolbarControl.SetTexture(TestsFailIconLocation + "-38", TestsFailIconLocation + "-24");
         EditorLogic.fetch.launchBtn.image.color = Color.red;
     }
 }
예제 #13
0
        void SetTime(EditorTime newTime)
        {
            if (firstTime)
            {
                Setup();
            }
            currentTime = newTime;

//			Debug.Log("LightsOut: Switching to " + newTime + " Mode");

            // Toggle Shaders
//			Debug.Log("LightsOut: Updating Shaders");
            shaderManager.SetShaderMode(newTime);

            // Toggle ambient settings
//			Debug.Log("LightsOut: Updating Ambient Light and Skybox");
            ambientManager.SetAmbientMode(newTime);

            //toggle VAB/SPH lights
//			Debug.Log("LightsOut: Updating VAB/SPH Lights");
            externalLightsManager.SetExternalLightsMode(newTime, FindObjectsOfType(typeof(Light)) as Light[]);

            // Toggle all part lights*/
            SetPartLights(newTime == EditorTime.Night);

            if (newTime == EditorTime.Night)
            {
#if false
                launcherButton.SetTexture((Texture)GameDatabase.Instance.GetTexture(sunIcon, false));
#endif
                toolbarControl.SetTexture(sunIcon + "-38", sunIcon + "-24");
            }
            else
            {
#if false
                launcherButton.SetTexture((Texture)GameDatabase.Instance.GetTexture(munIcon, false));
#endif
                toolbarControl.SetTexture(munIcon + "-38", munIcon + "-24");
            }
        }
예제 #14
0
/*************************************************************************************************************************/
        void Start()
        {
            //RenderingManager.AddToPostDrawQueue(3, new Callback(drawGUI));
#if DEBUG
            //if (Debug_Level_1_Active)
            Log.PushStackInfo("FMRS.Start", "entering Start()");
#endif
            if (!_SAVE_Has_Launched)
            {
                _SETTING_Enabled = false;
            }

            if (FlightGlobals.ActiveVessel.situation == Vessel.Situations.PRELAUNCH && HighLogic.CurrentGame.Parameters.CustomParams <FMRS_Settings>().autoactiveAtLaunch)
            {
#if DEBUG
                if (Debug_Active)
                {
                    Log.Info("ActiveVessel is prelaunch");
                }
#endif

                _SETTING_Enabled = true;
                GameEvents.onLaunch.Add(launch_routine);
            }

            if (_SETTING_Enabled)
            {
                flight_scene_start_routine();
                //stb_texture = GameDatabase.Instance.GetTexture("FMRS/icons/tb_st_en", false);
                stockTexture  = "FMRS/icons/tb_st_en";
                blizzyTexture = "FMRS/icons/tb_blz_en";
            }
            else
            {
                stockTexture  = "FMRS/icons/tb_st_di";
                blizzyTexture = "FMRS/icons/tb_blz_di";
            }
            Log.Info("SetTexture 1, stockTexture: " + stockTexture + ",   blizzyTexture:" + blizzyTexture);
            if (toolbarControl != null)
            {
                toolbarControl.SetTexture(stockTexture, blizzyTexture);
            }
#if DEBUG
            // if (Debug_Level_1_Active)
            Log.PopStackInfo("leaving FMRS.Start ()");
#endif
            GameEvents.onShowUI.Add(ShowUI);
            GameEvents.onHideUI.Add(HideUI);
        }
예제 #15
0
        // Toolbar button click handler
        internal static void OnToolbarButtonToggle()
        {
            try
            {
                //if (HighLogic.LoadedScene != GameScenes.SPACECENTER && !HighLogic.LoadedSceneIsFlight)
                //    return;

                WindowSettings.showWindow = !WindowSettings.showWindow;
                toolbarControl.SetTexture(WindowSettings.showWindow ? _stockOn : _stockOff,
                                          WindowSettings.showWindow ? _blizzyOn : _blizzyOff);
            }
            catch (Exception ex)
            {
                Log.Error($"Addon.OnToolbarButtonToggle. Error: {ex}");
            }
        }
예제 #16
0
 internal void Refresh()
 {
     if (toolbarControl != null)
     {
         if (QSettings.Instance.Muted && isFalse)
         {
             toolbarControl.SetTrue(false);
             _isTrue = true;
         }
         if (!QSettings.Instance.Muted && isTrue)
         {
             toolbarControl.SetFalse(false);
             _isTrue = false;
         }
         toolbarControl.SetTexture("QuickMods/" + QTexture.StockTexture, "QuickMods/" + QTexture.BlizzyTexturePath);
     }
     QDebug.Log("QStock.Refresh", "QStockToolbar");
 }
        /// <summary>
        /// Sets up the App launcher button to activate and deactivate PCR
        /// </summary>
        /// <returns>Reference to created button</returns>
        void InitializeApplicationButton()
        {
#if false
            ApplicationLauncherButton Button = null;

            IconActivate   = GameDatabase.Instance.GetTexture("ProbeControlRoom/Icons/ProbeControlRoomToolbarDisabled", false);
            IconDeactivate = GameDatabase.Instance.GetTexture("ProbeControlRoom/Icons/ProbeControlRoomToolbarEnabled", false);


            Button = ApplicationLauncher.Instance.AddModApplication(
                OnAppLauncherTrue,
                OnAppLauncherFalse,
                null,
                null,
                null,
                null,
                ApplicationLauncher.AppScenes.FLIGHT,
                IconActivate);
#endif


            toolbarControl = gameObject.AddComponent <ToolbarControl>();
            toolbarControl.AddToAllToolbars(OnAppLauncherTrue,
                                            OnAppLauncherFalse,
                                            ApplicationLauncher.AppScenes.FLIGHT,
                                            MODID,
                                            "probeControlRoomButton",
                                            IconActivate, IconDeactivate,
                                            enabledTexture, disabledTexture,
                                            MODNAME
                                            );

            if (toolbarControl == null)
            {
                ProbeControlRoomUtils.Logger.debug("InitializeApplicationButton(): Was unable to initialize button");
            }

            if (isActive)
            {
                toolbarControl.SetTexture(IconDeactivate, disabledTexture);
            }
        }
예제 #18
0
        /// <summary>
        /// Sets up the App launcher button to activate and deactivate PCR
        /// </summary>
        /// <returns>Reference to created button</returns>
        void InitializeApplicationButton()
        {
            toolbarControl = gameObject.AddComponent <ToolbarControl>();
            toolbarControl.AddToAllToolbars(OnAppLauncherTrue,
                                            OnAppLauncherFalse,
                                            ApplicationLauncher.AppScenes.FLIGHT,
                                            MODID,
                                            "probeControlRoomButton",
                                            IconActivate, IconDeactivate,
                                            enabledTexture, disabledTexture,
                                            MODNAME
                                            );

            if (toolbarControl == null)
            {
                ProbeControlRoomUtils.Logger.debug("InitializeApplicationButton(): Was unable to initialize button");
            }

            if (isActive)
            {
                toolbarControl.SetTexture(IconDeactivate, disabledTexture);
            }
        }
예제 #19
0
        void UpdateToolbarButton()
        {
            string blizzyButtonPath = IconPath + "Biom";
            bool   relevant         = IsRelevant;

            if (relevant)
            {
                blizzyButtonPath += toolbarShowSettings ? "Grey" : "Colour";
                if (!systemOn)
                {
                    blizzyButtonPath += "X";
                }
            }
            else
            {
                blizzyButtonPath += "Unavailable";
            }

            string stockButtonPath;

            if (TechChecker.TechAvailable)
            {
                if (Biomatic.SystemOn)
                {
                    stockButtonPath = (Biomatic.ToolbarShowSettings ? shownOnButton : hiddenOnButton);
                }
                else
                {
                    stockButtonPath = (Biomatic.ToolbarShowSettings ? shownOffButton : hiddenOffButton);
                }
            }
            else
            {
                stockButtonPath = unavailableButton;
            }
            toolbarControl.SetTexture(IconPath + stockButtonPath, blizzyButtonPath);
        }
예제 #20
0
 void SetButtonNormal()
 {
     buttonRed = false;
     toolbarControl.SetTexture(NORMAL_BUTTON_BIG, NORMAL_BUTTON_SML);
 }
예제 #21
0
        /// <summary>
        /// method to update the camera bounds and scale the scene
        /// </summary>
        /// <returns></returns>
        private IEnumerator <YieldInstruction> toggleScaling()        // code taken from NathanKell, https://github.com/NathanKell/RealSolarSystem/blob/master/Source/CameraFixer.cs
        {
            Debugger.advancedDebug("Attempting work area scaling", _advancedDebug);
            while ((object)EditorBounds.Instance == null)
            {
                yield return(null);
            }
            if ((object)(EditorBounds.Instance) != null)
            {
                if (_sceneScaled)
                {
                    Debugger.advancedDebug("shrink scene", _advancedDebug);

                    EditorBounds.Instance.constructionBounds = new Bounds(EditorBounds.Instance.constructionBounds.center, (_originalConstructionBoundExtends));
                    EditorBounds.Instance.cameraOffsetBounds = new Bounds(EditorBounds.Instance.cameraOffsetBounds.center, (_originalCameraOffsetBoundExtends));
                    EditorBounds.Instance.cameraMaxDistance /= _scalingFactor;
                    Debugger.advancedDebug("Bounds scaled", _advancedDebug);


                    sceneCamera.farClipPlane /= _scalingFactor * 2;
                    for (int i = 0; i < sceneCamera.layerCullDistances.Length; i++)
                    {
                        sceneCamera.layerCullDistances[i] /= _scalingFactor * 2;
                    }
                    foreach (VABCamera c in _vabCameras)
                    {
                        c.maxHeight   /= _scalingFactor;
                        c.maxDistance /= _scalingFactor;
                    }
                    Debugger.advancedDebug("vabCameras scaled", _advancedDebug);
                    foreach (SPHCamera c in _sphCameras)
                    {
                        c.maxHeight    /= _scalingFactor;
                        c.maxDistance  /= _scalingFactor;
                        c.maxDisplaceX /= _scalingFactor;
                        c.maxDisplaceZ /= _scalingFactor;
                    }
                    Debugger.advancedDebug("sphCameras scaled", _advancedDebug);


                    RenderSettings.fogStartDistance /= _scalingFactor;
                    RenderSettings.fogEndDistance   /= _scalingFactor;

                    Debugger.advancedDebug("scale Hangars", _advancedDebug);
                    if (_hangarNodes != null && _hangarNodes.Count > 0)
                    {
                        foreach (Node n in _hangarNodes)
                        {
                            n.transform.localScale = n.defaultScaling;
                            Debugger.advancedDebug("scaleing Hangar" + n.transform.name, _advancedDebug);
                        }
                    }
                    //Debugger.advancedDebug("scale Scene", _advancedDebug);
                    //if (_sceneNodes != null && _sceneNodes.Count > 0)
                    //{
                    //	foreach (Node n in _sceneNodes)
                    //	{
                    //		n.transform.localScale = n.defaultScaling;
                    //		Debugger.advancedDebug("scaleing Scene" + n.transform.name, _advancedDebug);
                    //	}
                    //}
                    Debugger.advancedDebug("attach Nodes", _advancedDebug);
                    if (_nonScalingNodes != null && _nonScalingNodes.Count > 0)
                    {
                        foreach (Node n in _nonScalingNodes)
                        {
                            n.transform.parent     = n.originalParent;
                            n.transform.localScale = n.defaultScaling;
                            Debugger.advancedDebug("Reattaching Node" + n.transform.name, _advancedDebug);
                        }
                    }
                    Debugger.advancedDebug("scale lights", _advancedDebug);
                    if (_sceneLights != null && _sceneLights.Count > 0)
                    {
                        foreach (Light l in _sceneLights)
                        {
                            if (l != null)
                            {
                                if (l.type == LightType.Spot)
                                {
                                    l.range /= _scalingFactor;
                                    Debugger.advancedDebug("scaling light", _advancedDebug);
                                }
                            }
                        }
                    }

                    if (HighLogic.CurrentGame.Parameters.CustomParams <HangerExtender>().hideHangars)
                    {
                        Debugger.advancedDebug("hide Hangars", _advancedDebug);
                        if (_hangarNodes != null && _hangarNodes.Count > 0)
                        {
                            foreach (Node n in _hangarNodes)
                            {
                                List <SkinnedMeshRenderer> skinRenderers = new List <SkinnedMeshRenderer>();
                                n.transform.GetComponentsInChildren <SkinnedMeshRenderer>(skinRenderers);
                                foreach (SkinnedMeshRenderer r in skinRenderers)
                                {
                                    r.enabled = true;
                                }
                                List <MeshRenderer> renderers = new List <MeshRenderer>();
                                n.transform.GetComponentsInChildren <MeshRenderer>(renderers);
                                foreach (MeshRenderer r in renderers)
                                {
                                    r.enabled = true;
                                }
                            }
                        }
                        Debugger.advancedDebug("hide Hangars complete", _advancedDebug);
                    }

                    Debugger.advancedDebug("update Button", _advancedDebug);
#if false
                    if (_toolbarButton != null && _extendIcon != null)
                    {
                        _toolbarButton.SetTexture(_extendIcon);
                    }
#endif
                    if (toolbarControl != null)
                    {
                        toolbarControl.SetTexture(Constants.extentIconFileName + "_38", Constants.extentIconFileName + "_24");
                    }
                    Debugger.advancedDebug("shrink scene complete", _advancedDebug);
                }
                else
                {
                    Debugger.advancedDebug("extend scene", _advancedDebug);

                    EditorBounds.Instance.constructionBounds = new Bounds(EditorBounds.Instance.constructionBounds.center, (_originalConstructionBoundExtends * _scalingFactor));
                    EditorBounds.Instance.cameraOffsetBounds = new Bounds(EditorBounds.Instance.cameraOffsetBounds.center, (_originalCameraOffsetBoundExtends * _scalingFactor));
                    EditorBounds.Instance.cameraMaxDistance *= _scalingFactor;
                    Debugger.advancedDebug("Bounds scaled", _advancedDebug);


                    sceneCamera.farClipPlane *= _scalingFactor * 2;
                    for (int i = 0; i < sceneCamera.layerCullDistances.Length; i++)
                    {
                        sceneCamera.layerCullDistances[i] *= _scalingFactor * 2;
                    }
                    foreach (VABCamera c in _vabCameras)
                    {
                        c.maxHeight   *= _scalingFactor;
                        c.maxDistance *= _scalingFactor;
                    }
                    Debugger.advancedDebug("vabCameras scaled", _advancedDebug);
                    foreach (SPHCamera c in _sphCameras)
                    {
                        c.maxHeight    *= _scalingFactor;
                        c.maxDistance  *= _scalingFactor;
                        c.maxDisplaceX *= _scalingFactor;
                        c.maxDisplaceZ *= _scalingFactor;
                    }
                    Debugger.advancedDebug("sphCameras scaled", _advancedDebug);


                    RenderSettings.fogStartDistance *= _scalingFactor;
                    RenderSettings.fogEndDistance   *= _scalingFactor;

                    if (HighLogic.CurrentGame.Parameters.CustomParams <HangerExtender>().hideHangars)
                    {
                        Debugger.advancedDebug("hide Hangars", _advancedDebug);
                        if (_hangarNodes != null && _hangarNodes.Count > 0)
                        {
                            foreach (Node n in _hangarNodes)
                            {
                                List <SkinnedMeshRenderer> skinRenderers = new List <SkinnedMeshRenderer>();
                                n.transform.GetComponentsInChildren <SkinnedMeshRenderer>(skinRenderers);
                                foreach (SkinnedMeshRenderer r in skinRenderers)
                                {
                                    r.enabled = false;
                                }
                                List <MeshRenderer> renderers = new List <MeshRenderer>();
                                n.transform.GetComponentsInChildren <MeshRenderer>(renderers);
                                foreach (MeshRenderer r in renderers)
                                {
                                    r.enabled = false;
                                }
                            }
                        }
                        Debugger.advancedDebug("hide Hangars complete", _advancedDebug);
                    }
                    Debugger.advancedDebug("Detach Nodes", _advancedDebug);
                    if (_nonScalingNodes != null && _nonScalingNodes.Count > 0)
                    {
                        foreach (Node n in _nonScalingNodes)
                        {
                            n.transform.parent     = _tempParent;
                            n.transform.localScale = n.defaultScaling;
                            Debugger.advancedDebug("Dettaching Node - " + n.transform.name, _advancedDebug);
                        }
                    }
                    Debugger.advancedDebug("scale Hangar", _advancedDebug);
                    if (_hangarNodes != null && _hangarNodes.Count > 0)
                    {
                        foreach (Node n in _hangarNodes)
                        {
                            n.transform.localScale = n.defaultScaling * _scalingFactor;
                            Debugger.advancedDebug("scaleing HangarNode - " + n.transform.name, _advancedDebug);
                        }
                    }
                    //Debugger.advancedDebug("scale Scene", _advancedDebug);
                    //if (_sceneNodes != null && _sceneNodes.Count > 0)
                    //{
                    //	foreach (Node n in _sceneNodes)
                    //	{
                    //		n.transform.localScale = n.defaultScaling * _scalingFactor;
                    //		Debugger.advancedDebug("scaling SceneNode - "+n.transform.name, _advancedDebug);
                    //	}
                    //}

                    Debugger.advancedDebug("scale lights", _advancedDebug);
                    if (_sceneLights != null && _sceneLights.Count > 0)
                    {
                        foreach (Light l in _sceneLights)
                        {
                            if (l != null)
                            {
                                if (l.type == LightType.Spot)
                                {
                                    l.range *= _scalingFactor;
                                    Debugger.advancedDebug("scaling light", _advancedDebug);
                                }
                            }
                        }
                    }

                    Debugger.advancedDebug("update Button", _advancedDebug);
#if false
                    if (_toolbarButton != null && _shrinkIcon != null)
                    {
                        _toolbarButton.SetTexture(_shrinkIcon);
                    }
#endif
                    if (toolbarControl != null)
                    {
                        toolbarControl.SetTexture(Constants.shrinkIconFileName + "_38", Constants.shrinkIconFileName + "_24");
                    }
                    Debugger.advancedDebug("extend scene complete", _advancedDebug);
                }
                _sceneScaled = !_sceneScaled;
            }
            Debugger.advancedDebug("Attempting work area scaling complete", _advancedDebug);
            Debugger.advancedDebug("Editor camera set to Min = " + EditorBounds.Instance.cameraMinDistance + " Max = " + EditorBounds.Instance.cameraMaxDistance + " Start = " + EditorBounds.Instance.cameraStartDistance, _advancedDebug);
            Debugger.advancedDebug("EditorBounds.Instance.constructionBounds.center = " + EditorBounds.Instance.constructionBounds.center + " EditorBounds.Instance.constructionBounds.extents = (" + EditorBounds.Instance.constructionBounds.extents.x + " , " + EditorBounds.Instance.constructionBounds.extents.y + " , " + EditorBounds.Instance.constructionBounds.extents.z + ")", _advancedDebug);
            Debugger.advancedDebug("EditorBounds.Instance.cameraOffsetBounds.center = " + EditorBounds.Instance.cameraOffsetBounds.center + " EditorBounds.Instance.cameraOffsetBounds.extents = (" + EditorBounds.Instance.cameraOffsetBounds.extents.x + " , " + EditorBounds.Instance.cameraOffsetBounds.extents.y + " , " + EditorBounds.Instance.cameraOffsetBounds.extents.z + ")", _advancedDebug);
        }
예제 #22
0
        /// <summary>
        /// Sets up IVA and activates it
        /// </summary>
        /// <returns>True if successful, False on error</returns>
        public bool startIVA()
        {
            if (FlightGlobals.ActiveVessel == null)
            {
                ProbeControlRoomUtils.Logger.debug("startIVA() - return ACTIVE VESSEL NULL");
                return(false);
            }
            ProbeControlRoomUtils.Logger.debug("startIVA()");
            Transform actualTransform;

            if (FlightGlobals.ActiveVessel.packed)
            {
                ProbeControlRoomUtils.Logger.debug("startIVA() - return vessel still packed!");
                return(false);
            }

            if (canStockIVA || FlightGlobals.ActiveVessel.evaController != null)
            {
                ProbeControlRoomUtils.Logger.debug("startIVA() - return EVA or IVA");
                return(false);
            }

            //Verify active room available
            if (!canPCRIVA)
            {
                ProbeControlRoomUtils.Logger.message("startIVA() - Refresh rooms said there were no IVAs available! Can't start.");
                return(false);
            }

            //Ensure part still exists
            if (aPart == null)
            {
                ProbeControlRoomUtils.Logger.message("startIVA() Lost our part, refreshing");
                refreshVesselRooms();
            }
            if (aPart == null)
            {
                ProbeControlRoomUtils.Logger.message("startIVA() Can't find a part. DIE.");
                return(false);
            }

            //Setup module for transforms
            if (aPart.FindModulesImplementing <ProbeControlRoomPart>().Count == 0)
            {
                ProbeControlRoomUtils.Logger.error("startIVA() a module was not found on the part now, exiting");
                return(false);
            }
            aModule = aPart.FindModulesImplementing <ProbeControlRoomPart>()[0];

            //Make the PCR part the focused part
            aPart.MakeReferencePart();

            //Setup camera transform for internal seat
            actualTransform = aPart.internalModel.FindModelTransform(aModule.seatTransformName);
            if (Transform.Equals(actualTransform, null))
            {
                ProbeControlRoomUtils.Logger.error("startIVA(Part) - NULL on actualTransform-seatTransformName, using fallback...");
                actualTransform = aPart.internalModel.FindModelTransform("Seat");
            }
            else
            {
                ProbeControlRoomUtils.Logger.message("startIVA(Part) - Seat: " + aModule.seatTransformName.ToString());
            }

            ProbeControlRoomUtils.Logger.debug("startIVA() - fire up IVA");


            //disable sound
            shipVolumeBackup     = GameSettings.SHIP_VOLUME;
            ambianceVolumeBackup = GameSettings.AMBIENCE_VOLUME;
            if (ProbeControlRoomSettings.Instance.DisableSounds)
            {
                ProbeControlRoomUtils.Logger.message("startIVA() - DisableSounds");
                GameSettings.SHIP_VOLUME     = 0f;
                GameSettings.AMBIENCE_VOLUME = 0;
                GameSettings.MUSIC_VOLUME    = 0;
                GameSettings.UI_VOLUME       = 0;
                GameSettings.VOICE_VOLUME    = 0;
            }

            //disable camera wobble
            cameraWobbleBackup     = GameSettings.FLT_CAMERA_WOBBLE;
            cameraFXInternalBackup = GameSettings.CAMERA_FX_INTERNAL;
            cameraFXExternalBackup = GameSettings.CAMERA_FX_EXTERNAL;

            if (ProbeControlRoomSettings.Instance.DisableWobble)
            {
                ProbeControlRoomUtils.Logger.message("startIVA() - DisableWobble");
                GameSettings.FLT_CAMERA_WOBBLE  = 0;
                GameSettings.CAMERA_FX_INTERNAL = 0;
                GameSettings.CAMERA_FX_EXTERNAL = 0;
            }
            // TODO: create cfg file with cached vars, on crash to be restored

            //Prevent user from turning on vessel labels
            if (!HasCachedVesselLabelsSetting)
            {
                HasCachedVesselLabelsSetting = true;
                CachedVesselLabelsSetting    = GameSettings.FLT_VESSEL_LABELS;
            }
            if (!VesselLabelKeyDisabled)
            {
                VesselLabelKeyDisabled               = true;
                CachedLabelPrimaryKey                = GameSettings.TOGGLE_LABELS.primary;
                CachedLabelSecondaryKey              = GameSettings.TOGGLE_LABELS.secondary;
                GameSettings.TOGGLE_LABELS.primary   = new KeyCodeExtended(KeyCode.None);
                GameSettings.TOGGLE_LABELS.secondary = new KeyCodeExtended(KeyCode.None);
            }
            SetVesselLabelsValue(false);


            //Highlighters
            if (!HasCachedHighlightInFlightSetting)
            {
                HasCachedHighlightInFlightSetting = true;
                CachedHighlightInFlightSetting    = GameSettings.INFLIGHT_HIGHLIGHT;
            }
            GameSettings.INFLIGHT_HIGHLIGHT = false;


            //Unsure of this purpose at the moment
            FlightCamera.fetch.EnableCamera();
            FlightCamera.fetch.DeactivateUpdate();
            FlightCamera.fetch.gameObject.SetActive(true);

            //Move internal camera to the correct position and enable
            InternalCamera.Instance.SetTransform(actualTransform, true);
            InternalCamera.Instance.EnableCamera();

            if (UIPartActionController.Instance != null)
            {
                UIPartActionController.Instance.Deactivate();
            }

            //Activate internal camera
            CameraManager.Instance.SetCameraInternal(aPart.internalModel, actualTransform);

            ProbeControlRoomUtils.Logger.debug("startIVA() - DONE");

            //GUI may not be started yet.
            if (toolbarControl != null)
            {
                //Change app launcher button icon
                toolbarControl.SetTexture(IconActivate, enabledTexture);
            }

            if (hassavedlookangles && field_set_internalcamera_currentPitch != null && field_set_internalcamera_currentRot != null && field_set_internalcamera_currentZoom != null)
            {
                ProbeControlRoomUtils.Logger.debug(string.Format("startIVA() - Restoring pitch and rot. {0}, {1}", savedpitch, savedrot));

                field_set_internalcamera_currentPitch(InternalCamera.Instance, savedpitch);
                field_set_internalcamera_currentRot(InternalCamera.Instance, savedrot);
                field_set_internalcamera_currentZoom(InternalCamera.Instance, savedzoom);
                InternalCamera.Instance.Update();
            }

            //Disable sun effects inside of IVA
            SetSun(false);

            ProbeControlRoomUtils.Logger.debug("startIVA() - REALLY DONE");

            isActive = true;

            return(true);
        }
예제 #23
0
 private void AchieveButtonOn()
 {
     toggleAchievementsWindow();
     toolbarControl.SetTexture("Achievements/PluginData/Textures/button-highlight-38", "Achievements/PluginData/Textures/button-highlight-24");
 }
예제 #24
0
/*************************************************************************************************************************/
        void Start()
        {
            //RenderingManager.AddToPostDrawQueue(3, new Callback(drawGUI));
#if DEBUG
            //if (Debug_Level_1_Active)
            Log.PushStackInfo("FMRS.Start", "entering Start()");
#endif
            if (!_SAVE_Has_Launched)
            {
                _SETTING_Enabled = false;
            }

            if (FlightGlobals.ActiveVessel.situation == Vessel.Situations.PRELAUNCH && HighLogic.CurrentGame.Parameters.CustomParams <FMRS_Settings>().autoactiveAtLaunch)
            {
#if DEBUG
                if (Debug_Active)
                {
                    Log.Info("ActiveVessel is prelaunch");
                }
#endif

                _SETTING_Enabled = true;
                GameEvents.onLaunch.Add(launch_routine);
            }
#if false
            if (ToolbarManager.ToolbarAvailable)
            {
                Toolbar_Button = ToolbarManager.Instance.add("FMRS", "FMRSbutton");

                blz_toolbar_available = true;

                if (_SETTING_Enabled)
                {
                    Toolbar_Button.TexturePath = "FMRS/icons/tb_blz_en";
                }
                else
                {
                    Toolbar_Button.TexturePath = "FMRS/icons/tb_blz_di";
                }

                Toolbar_Button.ToolTip    = "Flight Manager for Reusable Stages";
                Toolbar_Button.Visibility = new GameScenesVisibility(GameScenes.FLIGHT);
                Toolbar_Button.OnClick   += (e) => toolbar_button_clicked();
            }
#endif
            if (_SETTING_Enabled)
            {
                flight_scene_start_routine();
                //stb_texture = GameDatabase.Instance.GetTexture("FMRS/icons/tb_st_en", false);
                stockTexture  = "FMRS/icons/tb_st_en";
                blizzyTexture = "FMRS/icons/tb_blz_en";
            }
            else
            {
                stockTexture  = "FMRS/icons/tb_st_di";
                blizzyTexture = "FMRS/icons/tb_blz_di";
            }
            Log.Info("SetTexture 1, stockTexture: " + stockTexture + ",   blizzyTexture:" + blizzyTexture);
            if (toolbarControl != null)
            {
                toolbarControl.SetTexture(stockTexture, blizzyTexture);
            }
#if DEBUG
            // if (Debug_Level_1_Active)
            Log.PopStackInfo("leaving FMRS.Start ()");
#endif
            GameEvents.onShowUI.Add(ShowUI);
            GameEvents.onHideUI.Add(HideUI);
        }