Ejemplo n.º 1
0
        public void Initialize()
        {
            // first, set up our panel stuff
            UIView uiv = UIView.GetAView();

            if (uiv == null)
            {
                // log error
                return;
            }

            this.name           = "BetterLoadPanelWrapper";
            this.cachedName     = "BetterLoadPanelWrapper";
            this.stringUserData = "BetterLoadPanelWrapper";

            this.backgroundSprite = "MenuPanel";// or MenuPanel2
            int viewWidth  = (int)uiv.GetScreenResolution().x;
            int viewHeight = (int)uiv.GetScreenResolution().y;

            this.clipChildren = false;

            this.canFocus      = true;
            this.isInteractive = true;
            //this.autoLayout = true;
            //this.autoLayoutDirection = LayoutDirection.Vertical;
            //this.autoLayoutPadding = new RectOffset(0, 0, 1, 1);
            //this.autoLayoutStart = LayoutStart.TopLeft;

            if (CurrentRelativePosition == Vector3.zero)
            {
                this.useCenter = true;
                this.CenterToParent();
                this.useCenter          = false;
                CurrentRelativePosition = this.relativePosition;
            }
            else
            {
                this.relativePosition = CurrentRelativePosition;
            }

            this.minimumSize = new Vector2(1170, 450);

            this.width  = viewWidth * 0.5f;
            this.height = viewHeight * 0.5f;


            //this.SendToBack();

            float inset = 5;

            TitleSubPanel = AddUIComponent <UITitleSubPanel>();
            TitleSubPanel.ParentBetterLoadPanelWrapper = this;
            TitleSubPanel.relativePosition             = Vector3.zero;
            TitleSubPanel.width  = this.width;
            TitleSubPanel.height = 40;

            ListPanel = AddUIComponent <UISortedSavedGamesPanel>();
            ListPanel.ParentBetterLoadPanelWrapper = this;
            ListPanel.relativePosition             = new Vector3(inset, TitleSubPanel.relativePosition.y + TitleSubPanel.height + inset);
            ListPanel.width  = (this.width / 1.75f) - 2f * inset; // was width/2
            ListPanel.height = this.height - ListPanel.relativePosition.y - inset;

            float detailinset = 30;

            DetailsPanel = AddUIComponent <UILoadPanelDetails>();
            DetailsPanel.ParentBetterLoadPanelWrapper = this;
            DetailsPanel.relativePosition             = new Vector3(ListPanel.relativePosition.x + ListPanel.width + detailinset, ListPanel.relativePosition.y + inset, 0);
            DetailsPanel.width  = this.width - ListPanel.width - 2 * detailinset;
            DetailsPanel.height = ListPanel.height - 2 * detailinset;

            ResizeHandle = AddUIComponent <UIResizeHandle>();
            ResizeHandle.AlignTo(this, UIAlignAnchor.BottomRight);
            ResizeHandle.isInteractive    = true;
            ResizeHandle.edges            = UIResizeHandle.ResizeEdge.Right | UIResizeHandle.ResizeEdge.Bottom;
            ResizeHandle.size             = new Vector2(16, 16);
            ResizeHandle.backgroundSprite = "buttonresize";
            ResizeHandle.relativePosition = new Vector3(ResizeHandle.relativePosition.x - 16, ResizeHandle.relativePosition.y - 16, 0);
        }
Ejemplo n.º 2
0
        public override void Start()
        {
            UIView uiv        = UIView.GetAView();
            int    viewWidth  = (int)uiv.GetScreenResolution().x;
            int    viewHeight = (int)uiv.GetScreenResolution().y;

            if (uiv == null)
            {
                Cleanup();
                return;
            }

            this.autoSize         = true;
            this.anchor           = UIAnchorStyle.Top | UIAnchorStyle.CenterHorizontal;
            this.backgroundSprite = "GenericPanel";
            this.color            = new Color32(0, 0, 0, 0xff);
            this.height           = 25.0f;
            this.relativePosition = new Vector3(0f, 0f, 0f);
            //this.opacity = 0.0f;
            this.width       = (viewWidth / 2);
            this.maximumSize = new Vector2(viewWidth, 25f);
            this.minimumSize = new Vector2(27f, 25f);

            UISprite leftCover = this.AddUIComponent <UISprite>();

            leftCover.spriteName = "GenericPanel";
            leftCover.color      = new Color32(0, 0, 0, 0xff);
            //leftCover.AlignTo(this, UIAlignAnchor.BottomRight);
            leftCover.relativePosition = new Vector3(0f, 0f);
            leftCover.size             = new Vector2(26f, 26f);
            //leftCover.BringToFront();
            leftCover.SendToBack();

            UISprite rightCover = this.AddUIComponent <UISprite>();

            rightCover.spriteName = "GenericPanel";
            rightCover.color      = new Color32(0, 0, 0, 0xff);
            rightCover.AlignTo(this, UIAlignAnchor.BottomRight);
            rightCover.size             = new Vector2(26f, 26f);
            rightCover.relativePosition = new Vector3(rightCover.relativePosition.x - 26, rightCover.relativePosition.y - 26, 0);
            //rightCover.BringToFront();
            rightCover.SendToBack();

            UISprite chirpSprite = this.AddUIComponent <UISprite>();

            chirpSprite.spriteName       = "ChirperIcon";
            chirpSprite.relativePosition = new Vector3(-1f, -1f);
            chirpSprite.size             = new Vector2(27f, 27f);
            chirpSprite.BringToFront();

            this.autoLayout   = false;
            this.clipChildren = true;
            this.SendToBack();

            UIDragHandle dh = (UIDragHandle)this.AddUIComponent(typeof(UIDragHandle));

            dh.size             = new Vector2(25f, 25f);
            dh.relativePosition = new Vector3(0f, 0f);

            UIResizeHandle rh = (UIResizeHandle)this.AddUIComponent(typeof(UIResizeHandle));

            rh.backgroundSprite = "buttonresize";
            rh.AlignTo(this, UIAlignAnchor.BottomRight);
            rh.size             = new Vector2(18f, 18f);
            rh.relativePosition = new Vector3(rh.relativePosition.x - 20, rh.relativePosition.y - 20, 0);
            rh.BringToFront();
        }