Exemple #1
0
        void Update()
        {
            if (showWindow)
            {
                if (HighLogic.LoadedSceneIsFlight)
                {
                    /// TODO: Handle refresh of application launcher when switching ships
                    if (FlightGlobals.ActiveVessel != null)
                    {
                        if (thisVessel == null)
                        {
                            thisVessel = FlightGlobals.ActiveVessel;
                        }
                        if (thisVessel != FlightGlobals.ActiveVessel)
                        {
                            thisVessel = FlightGlobals.ActiveVessel;
                        }
                    }

                    if (toolbarPanel != null && stockToolbarButton != null)
                    {
                        if (toolbarPanel.loopPanel.activeSelf)
                        {
                            toolbarPanel.rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 400f);
                        }

                        toolbarPanel.rect.position = stockToolbarButton.GetAnchorUL() - new Vector3(
                            toolbarPanel.rect.rect.width * UIMasterController.Instance.uiScale,
                            toolbarPanel.rect.rect.height * UIMasterController.Instance.uiScale, 0f);
                    }
                }


                if (HighLogic.LoadedSceneIsEditor)
                {
                    if (stockToolbarButton != null)
                    {
                        //toolbarPanel.rect.localScale = new Vector3(UIMasterController.Instance.appCanvas.scaleFactor,
                        // UIMasterController.Instance.appCanvas.scaleFactor, UIMasterController.Instance.appCanvas.scaleFactor);

                        if (toolbarPanel.loopPanel.activeSelf)
                        {
                            toolbarPanel.rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 400f);
                        }
                        else
                        {
                            toolbarPanel.rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 200f);
                        }

                        toolbarPanel.rect.position = stockToolbarButton.GetAnchorUR() - new Vector3(toolbarPanel.rect.rect.width * UIMasterController.Instance.uiScale, 0f, 0f);
                    }
                }
            }
        }
Exemple #2
0
 void Update()
 {
     if (showWindow && reactorPanel != null)
     {
         if (HighLogic.LoadedSceneIsFlight)
         {
             if (reactorPanel && stockToolbarButton)
             {
                 reactorPanel.rect.position = stockToolbarButton.GetAnchorUL() - new Vector3(
                     reactorPanel.rect.rect.width * UIMasterController.Instance.uiScale,
                     reactorPanel.rect.rect.height * UIMasterController.Instance.uiScale, 0f);
             }
         }
         if (HighLogic.LoadedSceneIsEditor)
         {
             if (stockToolbarButton != null)
             {
                 reactorPanel.rect.position = stockToolbarButton.GetAnchorUL();
                 reactorPanel.rect.position = stockToolbarButton.GetAnchorUR() - new Vector3(reactorPanel.rect.rect.width * UIMasterController.Instance.uiScale, 0, 0);
             }
         }
     }
 }