コード例 #1
0
        private void OnButtonEnter(UIComponent component, UIMouseEventParameter eventParam)
        {
            float diameter = component.name is "ResizeItControlPanelResizeSprite" ? 36f : 26.25f;

            _hoverSprite.size = new Vector3(diameter, diameter);
            _hoverSprite.AlignTo(component, UIAlignAnchor.TopLeft);
            _hoverSprite.relativePosition = new Vector3(0 - ((diameter - component.width) / 2f), 0 - ((diameter - component.height) / 2f));
            _hoverSprite.isVisible        = true;
        }
コード例 #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();
        }