コード例 #1
0
 public void updateForGUI()
 {
     // reset the cache since maybe the sice in GUI will be used ahead
     casheSizeInGUI.x = -1f;
     // locate GUI element according new screen size (or whatever event fire this method)
     GUIScreenLayoutManager.locateForGUI(transform, getSizeInPixels());
 }
コード例 #2
0
    public void updateForGUI()
    {
        // if using offset as proportion then convert it as pixels
        if (!xAsPixels)
        {
            offsetInPixels.x = offset.x * Screen.width;
        }
        else
        {
            offsetInPixels.x = offset.x;
        }

        // if using offset as propportion then convert it as pixels
        if (!yAsPixels)
        {
            offsetInPixels.y = offset.y * Screen.height;
        }
        else
        {
            offsetInPixels.y = offset.y;
        }

        // then apply position correction
        GUIScreenLayoutManager.adjustPos(transform, guiElem, offsetInPixels, layout);
    }
コード例 #3
0
    private void locateInScreen()
    {
        Vector2 sizeInPixels;

        sizeInPixels.x = sizeFactor.x * Screen.width;
        sizeInPixels.y = sizeFactor.y * Screen.height;
        GUIScreenLayoutManager.locateForGUI(transform, sizeInPixels);
    }
コード例 #4
0
ファイル: OptionQuit.cs プロジェクト: fabri1983/marioBadClone
 public Rect getScreenBoundsAA()
 {
     // checks if the cached size has changed
     if (_screenBounds.x == -1f)
     {
         _screenBounds = GUIScreenLayoutManager.getPositionInScreen(guiElem);
     }
     return(_screenBounds);
 }
コード例 #5
0
 public Rect getScreenBoundsAA()
 {
     if (_screenBounds.x == -1f)
     {
         // here I suppose this game object has attached a GUICustomElement
         _screenBounds = GUIScreenLayoutManager.positionInScreen(GetComponent <GUICustomElement>());
     }
     return(_screenBounds);
 }
コード例 #6
0
 /// <summary>
 /// Gets the size in GUI space.
 /// </summary>
 /// <returns>
 /// The size in GUI space
 /// </returns>
 public Vector2 getSizeInGUI()
 {
     // if size was not calculated yet then proceed and cache it
     if (casheSizeInGUI.x == -1f)
     {
         Vector2 sizeInPixels = getSizeInPixels();
         casheSizeInGUI = GUIScreenLayoutManager.sizeInGUI(sizeInPixels);
     }
     return(casheSizeInGUI);
 }
コード例 #7
0
ファイル: OptionQuit.cs プロジェクト: memsyi/marioBadClone
    public Rect getScreenBoundsAA()
    {
        // This method called only once if the gameobject is a non destroyable game object

        // if used with a Unity's GUITexture
        if (guiTexture != null)
        {
            return(guiTexture.GetScreenRect(Camera.main));
        }
        // here I suppose this game object has attached a GUICustomElement
        else
        {
            return(GUIScreenLayoutManager.positionInScreen(GetComponent <GUICustomElement>()));
        }
    }
コード例 #8
0
    void OnDestroy()
    {
        for (int i = 0, c = listeners.Length; i < c; ++i)
        {
            listeners[i] = null;
        }
        listeners = null;

        // this is to avoid nullifying or destroying static variables. Instance variables can be destroyed before this check
        if (duplicated)
        {
            duplicated = false;             // reset the flag for next time
            return;
        }
        instance = null;
    }
コード例 #9
0
    public void updateForGUI()
    {
        // if using offset as percentage then convert it as pixels
        if (asProportion)
        {
            offsetCalculation.x = offset.x * Screen.width;
            offsetCalculation.y = offset.y * Screen.height;
        }
        else
        {
            offsetCalculation.x = offset.x;
            offsetCalculation.y = offset.y;
        }

        // then apply position correction
        GUIScreenLayoutManager.adjustPos(transform, guiElem, offsetCalculation, layout);
    }
コード例 #10
0
 void Awake()
 {
     if (instance != null && instance != this)
     {
         duplicated = true;
                     #if UNITY_EDITOR
         DestroyImmediate(this.gameObject);
                     #else
         Destroy(this.gameObject);
                     #endif
     }
     else
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
         initialize();
     }
 }
コード例 #11
0
 public void updateForGUI()
 {
     GUIScreenLayoutManager.locateForGUI(transform, getSizeInPixels());
 }
コード例 #12
0
 /// <summary>
 /// Gets the size in GUI space.
 /// </summary>
 /// <returns>
 /// The size in GUI space
 /// </returns>
 public Vector2 getSizeInGUI()
 {
     return(GUIScreenLayoutManager.sizeInGUI(getSizeInPixels()));
 }