Example #1
0
    void OnEnable()
    {
		Screen.orientation = ScreenOrientation.LandscapeLeft;
        Screen.autorotateToPortrait = false;
        Screen.autorotateToPortraitUpsideDown = false;
        Screen.autorotateToLandscapeLeft = true;
        Screen.autorotateToLandscapeRight = true;
		Screen.orientation = ScreenOrientation.AutoRotation;

        transform.localPosition = Vector3.zero;
        side = GameObject.Find("Anchor").GetComponent<UIAnchor>().side;
        GameObject.Find("Anchor").GetComponent<UIAnchor>().side = UIAnchor.Side.Center;
        GameObject.Find("TheMovie").transform.localScale = new Vector3(2256.0f, 1256.0f, 0);
    }
    public void Start()
    {
        var entDB=GameObject.FindGameObjectWithTag("LevelController");
        playerManager=entDB.GetComponent<PlayerManager>();
        gameController=entDB.GetComponent<GameController>();

        playerActivatorMenu.setPlayer (playerData);
        _Camera.verticalAxisName="L_YAxis_"+playerData.controllerNumber;
        _Camera.horizontalAxisName="L_XAxis_"+playerData.controllerNumber;

        //set side
        UIAnchor.Side[] Sides=new UIAnchor.Side[]{UIAnchor.Side.TopLeft,UIAnchor.Side.TopRight,UIAnchor.Side.BottomLeft,UIAnchor.Side.BottomRight};
        anchor.side=Sides[playerData.controllerNumber-1];

        AbilityBarGrid.UpdateGrid ();
        AbilityPanelGrid.UpdateGrid ();
        UpgradeGrid.UpdateGrid ();

        if (playerData.state==PlayerState.ready)
            state=AbilityMenuState.Bar;
        changeState (state);
    }
Example #3
0
    public static void ScreenOrigin(UIAnchor.Side side, float xMin, float xMax, float yMin, float yMax, UIAnchor.Flags flags, out float x, out float y)
    {
        float single;
        float single1;
        float single2;
        float single3;

        switch ((byte)(flags & (!UIAnchor.Info.isWindows ? UIAnchor.Flags.CameraIsOrthographic : UIAnchor.Flags.CameraIsOrthographic | UIAnchor.Flags.HalfPixelOffset)))
        {
        case 1:
        {
            UIAnchor.ScreenOrigin(side, xMin, xMax, yMin, yMax, out single, out single1);
            x = Mathf.Round(single);
            y = Mathf.Round(single1);
            break;
        }

        case 2:
        {
            UIAnchor.ScreenOrigin(side, xMin, xMax, yMin, yMax, out x, out y);
            break;
        }

        case 3:
        {
            UIAnchor.ScreenOrigin(side, xMin, xMax, yMin, yMax, out single2, out single3);
            x = Mathf.Round(single2) - 0.5f;
            y = Mathf.Round(single3) + 0.5f;
            break;
        }

        default:
        {
            goto case 2;
        }
        }
    }
Example #4
0
 public Target(string name, int manualSize, UIAnchor.Side side) : this(name, false, manualSize, side)
 {
 }
Example #5
0
 public Target(string name, UIAnchor.Side side) : this(name, true, 1000, side)
 {
 }
Example #6
0
        public void SetViewPosition(ViewPosition position)
        {
            UIAnchor.Side side      = UIAnchor.Side.Center;
            int           widthAdd  = 0;
            int           heightAdd = 0;

            if (this.position != position)
            {
                switch (position)
                {
                case ViewPosition.TopLeft:
                    side      = UIAnchor.Side.TopLeft;
                    widthAdd  = Width / 2;
                    heightAdd = -Height / 2;
                    break;

                case ViewPosition.Top:
                    side      = UIAnchor.Side.Top;
                    heightAdd = -Height / 2;
                    break;

                case ViewPosition.TopRight:
                    side      = UIAnchor.Side.TopRight;
                    widthAdd  = -Width / 2;
                    heightAdd = -Height / 2;
                    break;

                case ViewPosition.Left:
                    side     = UIAnchor.Side.Left;
                    widthAdd = Width / 2;
                    break;

                case ViewPosition.Center:
                    break;

                case ViewPosition.Right:
                    side     = UIAnchor.Side.Right;
                    widthAdd = -Width / 2;
                    break;

                case ViewPosition.BottomLeft:
                    side      = UIAnchor.Side.BottomLeft;
                    widthAdd  = Width / 2;
                    heightAdd = Height / 2;
                    break;

                case ViewPosition.Bottom:
                    side      = UIAnchor.Side.Bottom;
                    heightAdd = Height / 2;
                    break;

                case ViewPosition.BottomRight:
                    side      = UIAnchor.Side.BottomRight;
                    widthAdd  = -Width / 2;
                    heightAdd = Height / 2;
                    break;
                }

                if (uiAnchor != null)
                {
                    uiAnchor.side = side;
                }

                if (uiPanel != null)
                {
                    uiPanel.transform.localPosition += new Vector3(widthAdd, heightAdd, 0);
                }
            }
        }
Example #7
0
 private Target(string name, bool automatic, int manualSize, UIAnchor.Side side)
 {
     this.automatic = automatic;
     this.manualSize = manualSize;
     this.name = name;
     this.side = side;
     this._root = null;
     this._anchor = null;
 }
Example #8
0
    public static void ScreenOrigin(UIAnchor.Side side, float xMin, float xMax, float yMin, float yMax, out float x, out float y)
    {
        switch (side)
        {
        case UIAnchor.Side.BottomLeft:
        {
            x = xMin;
            y = yMin;
            break;
        }

        case UIAnchor.Side.Left:
        {
            x = xMin;
            y = (yMin + yMax) / 2f;
            break;
        }

        case UIAnchor.Side.TopLeft:
        {
            x = xMin;
            y = yMax;
            break;
        }

        case UIAnchor.Side.Top:
        {
            x = (xMin + xMax) / 2f;
            y = yMax;
            break;
        }

        case UIAnchor.Side.TopRight:
        {
            x = xMax;
            y = yMax;
            break;
        }

        case UIAnchor.Side.Right:
        {
            x = xMax;
            y = (yMin + yMax) / 2f;
            break;
        }

        case UIAnchor.Side.BottomRight:
        {
            x = xMax;
            y = yMin;
            break;
        }

        case UIAnchor.Side.Bottom:
        {
            x = (xMin + xMax) / 2f;
            y = yMin;
            break;
        }

        case UIAnchor.Side.Center:
        {
            x = (xMin + xMax) / 2f;
            y = (yMin + yMax) / 2f;
            break;
        }

        default:
        {
            throw new ArgumentOutOfRangeException();
        }
        }
    }
Example #9
0
 public UIAnchor GetAnchor(UIAnchor.Side side)
 {
     return(GetAnchor(side, this.forePanel.gameObject));
 }
Example #10
0
 public void Place(GameObject instance, eUIType type, UIAnchor.Side side)
 {
     Place(instance, ResolvePosition(type, side));
 }