예제 #1
0
        /// <summary>
        /// Called by framework. Do not call directly.
        /// </summary>
        public override void OnAwake()
        {
            base.OnAwake();
            Background.Color = Color.White.WithAlpha(0.5f);
            _scrollArea      = SceneObject.Instantiate <Panel>(this);
            _scrollArea.RectTransform.Alignment = Alignment.Center;

            SBCtrl        = AddComponent <ScrollBarCtrl>();
            CurrentAlpha  = SBCtrl.TargetAlpha;
            SBCtrl.Parent = this;
            IsVertical    = true;

            CurrentAlpha = SBCtrl.TargetAlpha;
        }
예제 #2
0
        public ComboBoxCtrl Ctrl;     ///< Contaons the element's controller.

        /// <summary>
        /// Called by framework. Do not call directly.
        /// </summary>
        public void OnAwake()
        {
            BgPanel = SceneObject.Instantiate <Panel> (this);
            BgPanel.Background.Source       = ResourceManager.ImageFromFile(Application.UIPath + "" + "button.png", false);
            BgPanel.Background.SliceType    = SliceType.Nine;
            BgPanel.Background.Color        = Color.Gray.WithAlpha(0.75f);
            BgPanel.RectTransform.Alignment = Alignment.Stretch;
            BgPanel.RectTransform.Spacing   = new Rect()
            {
                w = 20
            };
            BgPanel.RectTransform.ClampMode = ClampMode.Full;
            Ctrl = AddComponent <ComboBoxCtrl> ();

            _button = SceneObject.Instantiate <Button> (this);
            _button.RectTransform.Alignment = Alignment.Right;
            _button.RectTransform.Size      = new Point(25, 22);
            _button.RectTransform.Padding   = new Padding(-13, 0);
            _button.RectTransform.Spacing   = new Rect()
            {
                x = 6
            };
            _button.RectTransform.ClampMode = ClampMode.Full;
            _button.Image = ResourceManager.ImageFromFile(Application.UIPath + "" + "arrow_dn.png");

            RectTransform.Alignment = Alignment.TopHStretch;
            RectTransform.Size      = new Point(0, 22);
            RectTransform.ClampMode = ClampMode.Full;

            _frame = SceneObject.Instantiate <Panel>(this);
            _frame.Background.Source       = ResourceManager.ImageFromFile(Application.UIPath + "frame.png", false);
            _frame.Background.SliceType    = SliceType.Nine;
            _frame.Background.Color        = Color.SkyBlue;
            _frame.RectTransform.Alignment = Alignment.Stretch;
            _frame.RectTransform.ClampMode = ClampMode.Full;
            _frame.Active = false;
            _frame.RectTransform.Padding = new Padding(2, 2, 3, 2);

            _button.Ctrl.Enabled = false;
            Ctrl.OnFocusEnter   += EnterFocus;
            Ctrl.OnFocusLost    += LeaveFocus;
        }
예제 #3
0
        /// <summary>
        /// Called by framework. Do not call directly.
        /// </summary>
        public override void OnAwake()
        {
            base.OnAwake();
            RectTransform.ClampMode = ClampMode.Full;
            Background.Source       = ResourceManager.ImageFromFile(_backgroundImageUrl, false);
            Background.SliceType    = SliceType.Nine;
            Ctrl = AddComponent <ButtonCtrl>();

            _frame = SceneObject.Instantiate <Panel>(this);
            _frame.Background.Source       = ResourceManager.ImageFromFile(_frameImageUrl, false);
            _frame.Background.SliceType    = SliceType.Nine;
            _frame.Background.Color        = Color.SkyBlue;
            _frame.RectTransform.Alignment = Alignment.Stretch;
            _frame.RectTransform.ClampMode = ClampMode.Full;
            _frame.Active = false;
            _frame.RectTransform.Padding = new Padding(2);

            Ctrl.OnFocusEnter += () =>
            {
                if (ShowPressedFrame)
                {
                    _frame.Active = true;
                }
                SetDown();
            };
            Ctrl.OnFocusLost += () =>
            {
                _frame.Active = false;
                SetUp();
            };
            Ctrl.OnEnterMouse += () =>
            {
                SetOver();
            };
            Ctrl.OnLeaveMouse += () =>
            {
                SetNormal();
            };
        }
예제 #4
0
        }                                                                           ///< Determines whether the horizontal scrollbar is active in a moment.

        /// <summary>
        /// Called by framework. Do not call directly.
        /// </summary>
        public override void OnAwake()
        {
            RectTransform.ClampMode = ClampMode.Full;

            Panel = SceneObject.Instantiate <UIElement>(this);
            Panel.RectTransform.ClampMode = ClampMode.Full;

            _vScrollBar            = SceneObject.Instantiate <ScrollBar>(this);
            _vScrollBar.Scrolling += (ofs) =>
            {
                _sbOfs.y = ofs * (RectTransform.Height - Panel.RectTransform.Height - (HScrollBarActive ? 8 : 0));
                UpdatePanelPadding();
                if (Scrolling != null)
                {
                    Scrolling(_sbOfs.x, _sbOfs.y);
                }
            };
            _hScrollBar            = SceneObject.Instantiate <ScrollBar>(this);
            _hScrollBar.IsVertical = false;
            _hScrollBar.Scrolling += (ofs) =>
            {
                _sbOfs.x = ofs * (RectTransform.Width - Panel.RectTransform.Width - (VScrollBarActive ? 8 : 0));
                UpdatePanelPadding();
                if (Scrolling != null)
                {
                    Scrolling(_sbOfs.x, _sbOfs.y);
                }
            };

            RectTransform.Spacing         = new Rect(1, 1, 1, 1);
            RectTransform.Alignment       = Alignment.Stretch;
            RectTransform.LayoutChanging += () =>
            {
                Panel.RectTransform.Padding = new Padding();
            };
            RectTransform.LayoutChanged += AdaptScrollPanel;
            UpdatePanelPadding();
        }
예제 #5
0
 static SceneManager()
 {
     RootObject = SceneObject.Instantiate(null, "Root");
 }