public void Patch(TimeWarp timeQuadrant)
        {
            if (mBackup != null)
            {
                throw new InvalidOperationException("Patcher is already in use.");
            }
            ScreenSafeUISlideTab tab = timeQuadrant.timeQuadrantTab;

            mBackup = new Backup()
            {
                TimeQuadrant      = timeQuadrant,
                Texture           = tab.renderer.material.mainTexture,
                Scale             = tab.transform.localScale,
                Center            = ((BoxCollider)tab.collider).center,
                ExpandedPosition  = tab.expandedPos,
                CollapsedPosition = tab.collapsedPos,
            };

            List <Transform> children = new List <Transform>();

            foreach (Transform child in tab.transform)
            {
                children.Add(child);
            }

            foreach (Transform child in children)
            {
                child.parent = tab.transform.parent;
            }

            // Set the new texture
            Texture2D newTexture;

            RTUtil.LoadImage(out newTexture, "texTimeQuadrant.png");
            tab.renderer.material.mainTexture = newTexture;

            // Apply new scale, positions
            tab.transform.localScale = new Vector3(tab.transform.localScale.x,
                                                   tab.transform.localScale.y,
                                                   tab.transform.localScale.z *
                                                   1.3970588235294117647058823529412f);
            tab.collapsedPos += new Vector3(0, -0.013f, 0);
            tab.expandedPos  += new Vector3(0, -0.013f, 0);
            foreach (Transform child in children)
            {
                child.localPosition += new Vector3(0, 0.013f, 0);
            }
            tab.Expand();

            foreach (Transform child in children)
            {
                child.parent = tab.transform;
            }

            ((BoxCollider)tab.collider).center += new Vector3(0, 0, -0.37f);

            ScreenSafeGUIText text =
                tab.transform.FindChild("MET timer").GetComponent <ScreenSafeGUIText>();

            mTextStyle          = new GUIStyle(text.textStyle);
            mTextStyle.fontSize = (int)(text.textSize * ScreenSafeUI.PixelRatio);

            RenderingManager.AddToPostDrawQueue(0, Draw);
        }
Exemplo n.º 2
0
 void Start()
 {
     SSGT          = GameObject.FindObjectOfType <ScreenSafeGUIText>();
     SSGT.textSize = 20;
 }
Exemplo n.º 3
0
 void Start()
 {
     SSGT = GameObject.FindObjectOfType<ScreenSafeGUIText>();
     SSGT.textSize = 20;
 }