public ScrollCommand(ScrollType code, double offset, ThumbTrack thumbtrack) {
            Debug.Assert(code == ScrollType.SetHorizontalOffset
                || code == ScrollType.SetVerticalOffset);

            Code = code;
            Param = new Tuple<double, ThumbTrack>(offset, thumbtrack);
        }
Beispiel #2
0
        protected void SetupOverflowAndScroll(OverflowType overflow, Margin scrollBarMargin,
                                              ScrollType scroll, ScrollBarDisplayType scrollBarDisplay, int flags)
        {
            if (overflow == OverflowType.Hidden)
            {
                container = new Container();
                rootContainer.AddChild(container);
                UpdateMask();
                container.SetXY(_margin.left * GRoot.contentScaleFactor, _margin.top * GRoot.contentScaleFactor);
            }
            else if (overflow == OverflowType.Scroll)
            {
                container = new Container();
                rootContainer.AddChild(container);

                scrollPane = new ScrollPane(this, scroll, _margin, scrollBarMargin, scrollBarDisplay, flags);
            }
            else if (_margin.left != 0 || _margin.top != 0)
            {
                container = new Container();
                rootContainer.AddChild(container);

                container.SetXY(_margin.left * GRoot.contentScaleFactor, _margin.top * GRoot.contentScaleFactor);
            }

            SetBoundsChangedFlag();
        }
    public void Scroll(ScrollType scrollType)
    {
        switch (scrollType)
        {
        case ScrollType.Up:
            _currentPanelIndex += 1;
            break;

        case ScrollType.Down:
            _currentPanelIndex -= 1;
            break;
        }

        _currentPanelIndex = Mathf.Clamp(_currentPanelIndex, 0, _textureAmount - 1);

        if (_currentPanelIndex != _cachedPanelIndex)
        {
            targetPosition = _subPanelArray[_currentPanelIndex].initialInversedPosition;
            OnDetailPanelChanged();
            _cachedPanelIndex = _currentPanelIndex;

            UpdateIndexLabel();
            UpdateButtonVisuals();
        }
    }
Beispiel #4
0
        private static void TargetLoaded(object sender, RoutedEventArgs e)
        {
            var target = sender as Control;

            if (target == null)
            {
                return;
            }

            if (target is ScrollViewer)
            {
                return;
            }

            List <ScrollViewer> viewers = FindScrollViewer(target);

            if (viewers == null || viewers.Count < 1)
            {
                return;
            }

            foreach (ScrollViewer sV in viewers)
            {
                ScrollType parentScrollSetting = GetTouchScroll(target);
                SetTouchScroll(sV, parentScrollSetting);

                sV.CanContentScroll            = false;
                sV.Unloaded                   += TargetUnloaded;
                sV.PreviewMouseLeftButtonDown += TargetPreviewMouseLeftButtonDown;
                sV.PreviewMouseMove           += TargetPreviewMouseMove;
                sV.PreviewMouseLeftButtonUp   += TargetPreviewMouseLeftButtonUp;
                _isTargetUnloaded              = false;
            }
        }
Beispiel #5
0
        public override void Initial(FakeStruct mod, UIElement script)
        {
            base.Initial(mod, script);
            Main = script.transform;
            int c = Main.childCount;

            if (c > 0)
            {
                var it = Main.Find("Item").gameObject;
                HGUIManager.GameBuffer.RecycleGameObject(it);
                var sli = Main.Find("Slider");
                if (sli != null)
                {
                    var ui = sli.GetComponent <UIElement>();
                    Slider = ui.composite as UISlider;
                }
                ItemMod = HGUIManager.FindChild(mod, "Item");
                unsafe
                {
                    ItemSize = ((TransfromData *)ItemMod.ip)->size;
                    var ex = mod.buffer.GetData(((TransfromData *)mod.ip)->ex) as FakeStruct;
                    if (ex != null)
                    {
                        ScrollInfo *tp = (ScrollInfo *)ex.ip;
                        scrollType = tp->scrollType;
                        MinBox     = tp->minBox;
                    }
                }
            }
        }
Beispiel #6
0
        public ScrollCommand(ScrollType code, Size size)
        {
            Debug.Assert(code == ScrollType.SizeChange);

            Code  = code;
            Param = size;
        }
        public void RegisterForKeyboardNotifications(UIView parentView, ScrollType scrollType)
        {
            this.parentView = parentView;
            this.scrollType = scrollType;

            keyboardObserverWillShow = NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.WillShowNotification, KeyboardWillShowNotification);
            keyboardObserverWillHide = NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.WillHideNotification, KeyboardWillHideNotification);
        }
Beispiel #8
0
        public ScrollCommand(ScrollType code, double offset, ThumbTrack thumbtrack)
        {
            Debug.Assert(code == ScrollType.SetHorizontalOffset ||
                         code == ScrollType.SetVerticalOffset);

            Code  = code;
            Param = new Tuple <double, ThumbTrack>(offset, thumbtrack);
        }
        public ScrollCommand(ScrollType code, double param) {
            Debug.Assert(code != ScrollType.SizeChange
                && code != ScrollType.SetHorizontalOffset
                && code != ScrollType.SetVerticalOffset);

            Code = code;
            Param = param;
        }
Beispiel #10
0
 public void ScrollChartHorizontal(ScrollType scrollType, int scrollTicks)
 {
     // Scroll the chart (assume AT LEAST one mouse wheel turn).
     for (int i = 0; i < scrollTicks; i++)
     {
         chart1.ChartAreas["ChartAreaMain"].AxisX.ScaleView.Scroll(scrollType);
     }
 }
Beispiel #11
0
        public ScrollCommand(ScrollType code, double param)
        {
            Debug.Assert(code != ScrollType.SizeChange &&
                         code != ScrollType.SetHorizontalOffset &&
                         code != ScrollType.SetVerticalOffset);

            Code  = code;
            Param = param;
        }
    public override void OnDrag(PointerEventData eventData)
    {
        // スクロール対象確認
        ScrollType prevScrollType = scrollType_;

        if (backScrollRect_ == null)
        {
            scrollType_ = ScrollType.Self;
        }
        if (scrollType_ == ScrollType.NotDrag)
        {
            if (vertical == horizontal)
            {
                scrollType_ = ScrollType.Self;
            }
            else if (vertical)
            {
                if (Mathf.Abs(eventData.delta.x) < Mathf.Abs(eventData.delta.y))
                {
                    scrollType_ = ScrollType.Self;
                }
                else
                {
                    scrollType_ = ScrollType.Back;
                }
            }
            else if (horizontal)
            {
                if (Mathf.Abs(eventData.delta.x) > Mathf.Abs(eventData.delta.y))
                {
                    scrollType_ = ScrollType.Self;
                }
                else
                {
                    scrollType_ = ScrollType.Back;
                }
            }
        }

        // 裏をスクロールする場合にScrollRectの値をコピー
        if (prevScrollType == ScrollType.NotDrag && scrollType_ == ScrollType.Back)
        {
            // 裏のScrollRectを強制的にドラッグ開始する
            backScrollRect_.OnBeginDrag(eventData);
        }
        else
        {
            if (scrollType_ == ScrollType.Back)
            {
                backScrollRect_.OnDrag(eventData);
            }
            else
            {
                base.OnDrag(eventData);
            }
        }
    }
Beispiel #13
0
    public void ChangeBase(string basePart)
    {
        foreach (GameObject g in ChairBase)
        {
            g.SetActive(g.name.Equals(basePart));
        }

        scrollType = ScrollType.Base;
    }
Beispiel #14
0
        protected void SetupScroll(Margin scrollBarMargin,
                                   ScrollType scroll, ScrollBarDisplayType scrollBarDisplay, int flags,
                                   String vtScrollBarRes, String hzScrollBarRes)
        {
            container = new Container();
            rootContainer.AddChild(container);

            scrollPane = new ScrollPane(this, scroll, scrollBarMargin, scrollBarDisplay, flags, vtScrollBarRes, hzScrollBarRes);
            UpdateClipRect();
        }
Beispiel #15
0
        private void Initialize(Mobile from, Item item)
        {
            if (m_ScrollType != ScrollType.None)
            {
                return;                 // sanity, should never happen
            }
            if (item is PowerScroll)
            {
                PowerScroll ps = item as PowerScroll;

                m_ScrollType = ScrollType.PowerScroll;
                m_Skill      = ps.Skill;

                switch ((int)ps.Value)
                {
                default:
                case 105: m_Value = 5; m_Required = 8; break;

                case 110: m_Value = 10; m_Required = 12; break;

                case 115: m_Value = 15; m_Required = 10; break;
                }

                OnTargetPowerScroll(from, item);
            }
            else if (item is StatCapScroll)
            {
                StatCapScroll ss = item as StatCapScroll;

                m_ScrollType = ScrollType.StatsScroll;

                switch (ss.Value)
                {
                case 230: m_Value = 5; m_Required = 6; break;

                case 235: m_Value = 10; m_Required = 8; break;

                case 240: m_Value = 15; m_Required = 8; break;

                case 245: m_Value = 20; m_Required = 5; break;
                }

                OnTargetStatsScroll(from, item);
            }
            else if (item is ScrollOfTranscendence)
            {
                ScrollOfTranscendence sot = item as ScrollOfTranscendence;

                m_ScrollType = ScrollType.ScrollOfTranscendence;
                m_Skill      = sot.Skill;
                m_Required   = 20;

                OnTargetSoT(from, item);
            }
        }
Beispiel #16
0
 private void SetScrollOffset(ScrollType scrollType)
 {
     if (scrollType == ScrollType.Vertical)
     {
         this.ScrollOffset = new SizeF(this.ScrollOffset.Width, (float)-this.VScroller.Value);
     }
     else
     {
         this.ScrollOffset = new SizeF((float)-this.HScroller.Value, this.ScrollOffset.Height);
     }
 }
Beispiel #17
0
 /// <summary>
 /// Gibt die SrollBar des Containers zum entsprechenden <see cref="ScrollType"/> zurück.
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public ScrollBar GetScrollBarFromType(ScrollType type)
 {
     if (type == Controls.ScrollType.Vertical)
     {
         return(scrollBars[0]);
     }
     else
     {
         return(scrollBars[1]);
     }
 }
Beispiel #18
0
        RectTransform CreateContent <T>(RectTransform cellRoot, ScrollType scrollType, ArrangementType arrangementType, List <T> dataList, int mainPivotVectorValue, int columnLimit)
        {
            var widgetObject = new GameObject("Content");
            var result       = widgetObject.AddComponent <RectTransform>();

            result.SetParent(cellRoot);
            result.rotation         = cellRoot.rotation;
            result.localScale       = Vector3.one;
            result.localPosition    = Vector3.zero;
            result.gameObject.layer = cellRoot.gameObject.layer;

            switch (arrangementType)
            {
            case ArrangementType.LeftUpToRightDown:
                result.pivot = new Vector2(0.0f, 1.0f);
                break;

            case ArrangementType.LeftDownToRightUp:
                result.pivot = new Vector2(0.0f, 0.0f);
                break;

            case ArrangementType.RightUpToLeftDown:
                result.pivot = new Vector2(1.0f, 1.0f);
                break;

            case ArrangementType.RightDownToLeftUp:
                result.pivot = new Vector2(1.0f, 0.0f);
                break;
            }

            Vector2 size = new Vector2();

            switch (scrollType)
            {
            case ScrollType.Horizontal:
                size.x = Mathf.FloorToInt(_cellSize.x * Mathf.CeilToInt(( float )dataList.Count / _columnLimit));
                size.y = Mathf.FloorToInt(_cellSize.y * _columnLimit);
                result.localPosition = new Vector2(cellRoot.rect.width * 0.5f * -mainPivotVectorValue, size.y * (result.pivot.y - 0.5f));
                break;

            case ScrollType.Vertical:
                size.x = Mathf.FloorToInt(_cellSize.x * _columnLimit);
                size.y = Mathf.FloorToInt(_cellSize.y * Mathf.CeilToInt(( float )dataList.Count / _columnLimit));
                result.localPosition = new Vector2(size.x * (result.pivot.x - 0.5f), cellRoot.rect.height * 0.5f * -mainPivotVectorValue);
                break;

            default:
                throw new Exception(string.Format("ScrollType <{0}> does not exist.", _scrollType));
            }

            result.sizeDelta = size;

            return(result);
        }
Beispiel #19
0
        static float GetNonScrollTypeValue(ScrollType scrollType, Vector2 vector)
        {
            switch (scrollType)
            {
            case ScrollType.Horizontal:
                return(vector.y);

            case ScrollType.Vertical:
                return(vector.x);
            }
            throw new Exception(string.Format("ScrollType <{0}> does not exist.", scrollType));
        }
Beispiel #20
0
        static Vector2 CreateScrollTypeVector(ScrollType scrollType, float arrangementValue, float nonArrangementValue)
        {
            switch (scrollType)
            {
            case ScrollType.Horizontal:
                return(new Vector2(arrangementValue, nonArrangementValue));

            case ScrollType.Vertical:
                return(new Vector2(nonArrangementValue, arrangementValue));
            }
            throw new Exception(string.Format("ScrollType <{0}> does not exist.", scrollType));
        }
    public override void OnEndDrag(PointerEventData eventData)
    {
        base.OnEndDrag(eventData);

        // 裏のScrollRectを強制的にドラッグ解除する
        if (scrollType_ == ScrollType.Back)
        {
            backScrollRect_.OnEndDrag(eventData);
        }

        scrollType_ = ScrollType.NotDrag;
    }
        private bool ShouldRotateAccordingToScrollType(ScrollType scrollType)
        {
            if (scrollType == ScrollType.Horizontal &&
                ScrollBarElement.GradientAngleCorrection == 90 ||
                scrollType == ScrollType.Vertical &&
                ScrollBarElement.GradientAngleCorrection == -90)
            {
                return(true);
            }

            return(false);
        }
Beispiel #23
0
        /// <summary>
        /// Scrolls axis data scaleView from current position.
        /// </summary>
        /// <param name="scrollType">Direction and size to scroll.</param>
        /// <param name="fireChangeEvents">Fire scaleView position events from this method.</param>
        internal void Scroll(ScrollType scrollType, bool fireChangeEvents)
        {
            // Adjust current position depending on the scroll type
            double newPosition = _position;

            switch (scrollType)
            {
            case (ScrollType.SmallIncrement):
                newPosition += ((axis.IsReversed) ? -1 : 1) * ChartHelper.GetIntervalSize(_position, GetScrollingLineSize(), GetScrollingLineSizeType());
                break;

            case (ScrollType.SmallDecrement):
                newPosition -= ((axis.IsReversed) ? -1 : 1) * ChartHelper.GetIntervalSize(_position, GetScrollingLineSize(), GetScrollingLineSizeType());
                break;

            case (ScrollType.LargeIncrement):
                newPosition += ((axis.IsReversed) ? -1 : 1) * ChartHelper.GetIntervalSize(_position, Size, SizeType);
                break;

            case (ScrollType.LargeDecrement):
                newPosition -= ((axis.IsReversed) ? -1 : 1) * ChartHelper.GetIntervalSize(_position, Size, SizeType);
                break;

            case (ScrollType.First):
                if (!axis.IsReversed)
                {
                    newPosition = (axis.minimum + axis.marginView);
                }
                else
                {
                    newPosition = (axis.maximum - axis.marginView);
                }
                break;

            case (ScrollType.Last):
            {
                double viewSize = ChartHelper.GetIntervalSize(newPosition, Size, SizeType);
                if (!axis.IsReversed)
                {
                    newPosition = (axis.maximum - axis.marginView - viewSize);
                }
                else
                {
                    newPosition = (axis.minimum + axis.marginView + viewSize);
                }
                break;
            }
            }

            // Scroll to the new position
            Scroll(newPosition, fireChangeEvents);
        }
Beispiel #24
0
        protected void SetupScroll(Margin scrollBarMargin,
                                   ScrollType scroll, ScrollBarDisplayType scrollBarDisplay, int flags,
                                   string vtScrollBarRes, string hzScrollBarRes,
                                   string headerRes, string footerRes)
        {
            if (rootContainer == container)
            {
                container = new Container();
                rootContainer.AddChild(container);
            }

            scrollPane = new ScrollPane(this, scroll, scrollBarMargin, scrollBarDisplay, flags, vtScrollBarRes, hzScrollBarRes, headerRes, footerRes);
        }
Beispiel #25
0
    public void MoveToFlag(string id, ScrollType scrollType = ScrollType.Default)
    {
        var _flag = Flags.Find(x => x.NameFlag == id);

        if (_flag != null)
        {
            Move(_flag.NormalizateValue);
        }
        else
        {
            throw new Exception($"Flag {id} is not be find!");
        }
    }
Beispiel #26
0
    /// <summary>
    /// Number flag only > 0
    /// </summary>
    /// <param name="number"></param>
    /// <param name="scrollType"></param>
    public void MoveToFlag(int number, ScrollType scrollType = ScrollType.Default)
    {
        var _flag = Flags[number - 1];

        if (_flag != null)
        {
            Move(_flag.NormalizateValue);
        }
        else
        {
            throw new Exception("Flag is not be find!");
        }
    }
    protected override void OnDisable()
    {
        base.OnDisable();

        // 裏のScrollRectを強制的にドラッグ解除する
        if (scrollType_ == ScrollType.Back)
        {
            PointerEventData eventData = new PointerEventData(null);
            eventData.button = PointerEventData.InputButton.Left;
            backScrollRect_.OnEndDrag(eventData);
            scrollType_ = ScrollType.NotDrag;
        }
    }
Beispiel #28
0
 /// <summary>
 /// ボタンイベントをセットする
 /// </summary>
 private void AddButtonEvent()
 {
     try
     {
         CompButton.OnTagChanged = (BaseButton sender, object obj) => {
             if (obj != null)
             {
                 sender.Text = obj.ToString();
             }
         };
         CompButton.Tag           = ProcessModel.GetEndProcessModel();
         ErrorButton.OnTagChanged = (BaseButton sender, object obj) => {
             if (obj != null)
             {
                 sender.Text = obj.ToString();
             }
         };
         ErrorButton.Tag           = ProcessModel.GetErrorProcessModel();
         ScrollButton.OnTagChanged = (BaseButton sender, object obj) => {
             if (obj != null)
             {
                 sender.Text = obj.ToString();
             }
             ScrollType type = (ScrollType)obj;
             ScrollSpeedTitleLbl.Visible  = !(type == ScrollType.スクロールしない || type == ScrollType.None);
             ScrollSpeedUpDown.Visible    = !(type == ScrollType.スクロールしない || type == ScrollType.None);
             ScrollAmountTitleLbl.Visible = !(type == ScrollType.スクロールしない || type == ScrollType.None);
             ScrollAmountUpDown.Visible   = !(type == ScrollType.スクロールしない || type == ScrollType.None);
         };
         ScrollButton.Tag            = ScrollType.スクロールしない;
         VariableButton.OnTagChanged = (BaseButton sender, object obj) => {
             if (obj != null)
             {
                 sender.Text = obj.ToString();
             }
         };
         VariableButton.Tag           = StringValue.VARIABLE_未設定;
         MoveMouseButton.OnTagChanged = (BaseButton sender, object obj) => {
             if (obj != null)
             {
                 sender.Text = obj.ToString();
             }
         };
         MoveMouseButton.Tag = MoveMouseType.移動しない;
     }
     catch (Exception ex)
     {
         throw Program.ThrowException(ex);
     }
 }
Beispiel #29
0
        private bool IsScrollOfType(DataModels.UserBankItem item, ScrollType scrollType)
        {
            if (scrollType == ScrollType.Experience)
            {
                return(item.ItemId == expScrollId);
            }

            if (scrollType == ScrollType.Raid)
            {
                return(item.ItemId == raidScrollId);
            }

            return(item.ItemId == dungeonScrollId);
        }
        public void RecalculateOnGradientAngleCorrectionChanged()
        {
            RadScrollBarElement scrollBar = this.ScrollBarElement;

            if (scrollBar == null)
            {
                return;
            }

            if (toRotate.UseNewLayoutSystem)
            {
                if (initialAngle == null)
                {
                    initialAngle = toRotate.AngleTransform;
                }
                if (this.ShouldRotateAccordingToScrollType(scrollBar.ScrollType))
                {
                    int sign = rotateCounterDirection ? -1 : 1;
                    toRotate.AngleTransform = initialAngle.Value + (sign * scrollBar.GradientAngleCorrection);
                }
            }
            else
            {
                ScrollType scrollType = scrollBar.ScrollType;
                if (scrollType != RadScrollBarElement.DefaultScrollType)
                {
                    if (toRotate is FillPrimitive)
                    {
                        ((FillPrimitive)toRotate).GradientAngle += scrollBar.GradientAngleCorrection;
                    }
                    if (toRotate is BorderPrimitive)
                    {
                        ((BorderPrimitive)toRotate).GradientAngle += scrollBar.GradientAngleCorrection;
                    }
                }
                else
                {
                    if (toRotate is FillPrimitive)
                    {
                        ((FillPrimitive)toRotate).GradientAngle -= scrollBar.GradientAngleCorrection;
                    }
                    if (toRotate is BorderPrimitive)
                    {
                        ((BorderPrimitive)toRotate).GradientAngle -= scrollBar.GradientAngleCorrection;
                    }
                }
            }
        }
Beispiel #31
0
    public unsafe override void LoadFromBuffer(FakeStruct fake, Initializer initializer)
    {
        ScrollInfo *info = (ScrollInfo *)fake.ip;

        minBox     = info->minBox;
        scrollType = info->scrollType;
        int id = info->Slider;

        if (id != 0)
        {
            if (initializer != null)
            {
                initializer.AddContextAction(ContextAction, id);
            }
        }
    }
Beispiel #32
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            if (version > 0)
            {
                m_ScrollType = (ScrollType)reader.ReadInt();
                m_Skill      = (SkillName)reader.ReadInt();

                m_Value    = reader.ReadInt();
                m_Required = reader.ReadInt();
                m_Total    = reader.ReadInt();
            }
        }
        // Constructors
        public Parallax(ILevel component_owner, string texture_name, float depth, float speed, ScrollType scroll_type, Color colour)
            : base(component_owner, float.MaxValue)
        {
            // Copy some parameters
            mSpeed = speed;
            mDepth = depth;
            mScrollType = scroll_type;
            mColour = colour;

            // Load the texture
            mTexture = component_owner.Game.Content.GetTexture(texture_name, out mSource);
            mCentre = new Vector2(mSource.Width, mSource.Height) * 0.5f;

            // Calculate the scale
            mScale = new Vector2(component_owner.GraphicsDevice.Viewport.Width / (float)mSource.Width,
                component_owner.GraphicsDevice.Viewport.Height / (float)mSource.Height);
        }
Beispiel #34
0
        private void Initialize( Mobile from, Item item )
        {
            if ( m_ScrollType != ScrollType.None )
                return; // sanity, should never happen

            if ( item is PowerScroll )
            {
                PowerScroll ps = item as PowerScroll;

                m_ScrollType = ScrollType.PowerScroll;
                m_Skill = ps.Skill;

                switch ( (int) ps.Value )
                {
                    default:
                    case 105: m_Value = 5; m_Required = 8; break;
                    case 110: m_Value = 10; m_Required = 12; break;
                    case 115: m_Value = 15; m_Required = 10; break;
                }

                OnTargetPowerScroll( from, item );
            }
            else if ( item is StatCapScroll )
            {
                StatCapScroll ss = item as StatCapScroll;

                m_ScrollType = ScrollType.StatsScroll;

                switch ( ss.Value )
                {
                    case 230: m_Value = 5; m_Required = 6; break;
                    case 235: m_Value = 10; m_Required = 8; break;
                    case 240: m_Value = 15; m_Required = 8; break;
                    case 245: m_Value = 20; m_Required = 5; break;
                }

                OnTargetStatsScroll( from, item );
            }
            else if ( item is ScrollOfTranscendence )
            {
                ScrollOfTranscendence sot = item as ScrollOfTranscendence;

                m_ScrollType = ScrollType.ScrollOfTranscendence;
                m_Skill = sot.Skill;
                m_Required = 20;

                OnTargetSoT( from, item );
            }
        }
Beispiel #35
0
		public void Scroll (ScrollType scrollType)
		{
			throw new NotImplementedException();
		}
Beispiel #36
0
        protected void SetupOverflowAndScroll(OverflowType overflow, Margin scrollBarMargin,
			ScrollType scroll, ScrollBarDisplayType scrollBarDisplay, int flags)
        {
            if (overflow == OverflowType.Hidden)
            {
                container = new Container();
                rootContainer.AddChild(container);
                UpdateMask();
                container.SetXY(_margin.left * GRoot.contentScaleFactor, _margin.top * GRoot.contentScaleFactor);
            }
            else if (overflow == OverflowType.Scroll)
            {
                container = new Container();
                rootContainer.AddChild(container);

                scrollPane = new ScrollPane(this, scroll, _margin, scrollBarMargin, scrollBarDisplay, flags);
            }
            else if (_margin.left != 0 || _margin.top != 0)
            {
                container = new Container();
                rootContainer.AddChild(container);

                container.SetXY(_margin.left * GRoot.contentScaleFactor, _margin.top * GRoot.contentScaleFactor);
            }

            SetBoundsChangedFlag();
        }
Beispiel #37
0
        public ScrollPane(GComponent owner,
            ScrollType scrollType,
            Margin scrollBarMargin,
            ScrollBarDisplayType scrollBarDisplay,
            int flags,
            string vtScrollBarRes,
            string hzScrollBarRes)
        {
            onScroll = new EventListener(this, "onScroll");
            _refreshDelegate = Refresh;

            _throwTween = new ThrowTween();
            _owner = owner;
            _container = _owner.rootContainer;

            _maskHolder = new Container();
            _container.AddChild(_maskHolder);

            _maskContentHolder = _owner.container;
            _maskContentHolder.x = 0;
            _maskContentHolder.y = 0;
            _maskHolder.AddChild(_maskContentHolder);

            _scrollBarMargin = scrollBarMargin;
            _scrollType = scrollType;
            _scrollSpeed = UIConfig.defaultScrollSpeed;
            _mouseWheelSpeed = _scrollSpeed * 2;
            _softnessOnTopOrLeftSide = UIConfig.allowSoftnessOnTopOrLeftSide;

            _displayOnLeft = (flags & 1) != 0;
            _snapToItem = (flags & 2) != 0;
            _displayInDemand = (flags & 4) != 0;
            _pageMode = (flags & 8) != 0;
            if ((flags & 16) != 0)
                _touchEffect = true;
            else if ((flags & 32) != 0)
                _touchEffect = false;
            else
                _touchEffect = UIConfig.defaultScrollTouchEffect;
            if ((flags & 64) != 0)
                _bouncebackEffect = true;
            else if ((flags & 128) != 0)
                _bouncebackEffect = false;
            else
                _bouncebackEffect = UIConfig.defaultScrollBounceEffect;

            _xPerc = 0;
            _yPerc = 0;
            _aniFlag = true;
            _scrollBarVisible = true;
            _mouseWheelEnabled = true;
            _holdAreaPoint = new Vector2();
            _pageSize = Vector2.one;

            if (scrollBarDisplay == ScrollBarDisplayType.Default)
            {
                if (Application.isMobilePlatform)
                    scrollBarDisplay = ScrollBarDisplayType.Auto;
                else
                    scrollBarDisplay = UIConfig.defaultScrollBarDisplay;
            }

            if (scrollBarDisplay != ScrollBarDisplayType.Hidden)
            {
                if (_scrollType == ScrollType.Both || _scrollType == ScrollType.Vertical)
                {
                    string res = string.IsNullOrEmpty(vtScrollBarRes) ? UIConfig.verticalScrollBar : vtScrollBarRes;
                    if (!string.IsNullOrEmpty(res))
                    {
                        _vtScrollBar = UIPackage.CreateObjectFromURL(res) as GScrollBar;
                        if (_vtScrollBar == null)
                            Debug.LogWarning("FairyGUI: cannot create scrollbar from " + res);
                        else
                        {
                            _vtScrollBar.SetScrollPane(this, true);
                            _container.AddChild(_vtScrollBar.displayObject);
                        }
                    }
                }
                if (_scrollType == ScrollType.Both || _scrollType == ScrollType.Horizontal)
                {
                    string res = string.IsNullOrEmpty(hzScrollBarRes) ? UIConfig.horizontalScrollBar : hzScrollBarRes;
                    if (!string.IsNullOrEmpty(res))
                    {
                        _hzScrollBar = UIPackage.CreateObjectFromURL(res) as GScrollBar;
                        if (_hzScrollBar == null)
                            Debug.LogWarning("FairyGUI: cannot create scrollbar from " + res);
                        else
                        {
                            _hzScrollBar.SetScrollPane(this, false);
                            _container.AddChild(_hzScrollBar.displayObject);
                        }
                    }
                }

                _scrollBarDisplayAuto = scrollBarDisplay == ScrollBarDisplayType.Auto;
                if (_scrollBarDisplayAuto)
                {
                    if (_vtScrollBar != null)
                        _vtScrollBar.displayObject.visible = false;
                    if (_hzScrollBar != null)
                        _hzScrollBar.displayObject.visible = false;
                    _scrollBarVisible = false;

                    _container.onRollOver.Add(__rollOver);
                    _container.onRollOut.Add(__rollOut);
                }
            }
            else
                _mouseWheelEnabled = false;

            SetSize(owner.width, owner.height);

            _container.onMouseWheel.Add(__mouseWheel);
            _container.onTouchBegin.Add(__touchBegin);
        }
 internal void EnqueueCommand(ScrollType code, Size size) {
     _scrollCommands.Add(new ScrollCommand(code, size));
 }
Beispiel #39
0
        public ScrollCommand(ScrollType code, Size size) {
            Debug.Assert(code == ScrollType.SizeChange);

            Code = code;
            Param = size;
        }
 internal void EnqueueCommand(ScrollType code, double param) {
     _scrollCommands.Add(new ScrollCommand(code, param));
 }
 private bool IsRepeating(List<ScrollCommand> commands, int index, ScrollType[] scrollTypes) {
     return commands[index].Code == commands[index + 1].Code && scrollTypes.Contains(commands[index].Code);
 }
Beispiel #42
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            if ( version > 0 )
            {
                m_ScrollType = (ScrollType) reader.ReadInt();
                m_Skill = (SkillName) reader.ReadInt();

                m_Value = reader.ReadInt();
                m_Required = reader.ReadInt();
                m_Total = reader.ReadInt();
            }
        }
    private void CreateNewChunk()
    {
        LevelChunkSettings last, newOb = Instantiate(SortNewChunk()) as LevelChunkSettings;
        Vector3 pos;

        //currentSkillLevel += chunksLoaded[0].skillAwarded;
        Destroy(chunksLoaded[0].gameObject);
        chunksLoaded.RemoveAt(0);
        last = chunksLoaded[chunksLoaded.Count-1];
        pos = last.transform.position + (Vector3.up * last.height);
        newOb.transform.position = pos;
        last.transform.parent = transform;
        chunksLoaded.Add(newOb);

        if(scrollType == ScrollType.ScrollToNextPiece && waitingForChunks > 0){
            waitingForChunks--;
            //Here we make it scroll only one piece for the tutorial part
            if(waitingForChunks == 0)scrollType = ScrollType.Static;
        }
    }
 public WTScrollContainer(ScrollType scrollType = ScrollType.Vertical)
 {
     this.scrollType = scrollType;
 }
 internal ScrollCommand(ScrollType code, Size size) {
     Code = code;
     Param = double.NaN;
     Size = size;
 }
Beispiel #46
0
        protected void SetupScroll(Margin scrollBarMargin,
            ScrollType scroll, ScrollBarDisplayType scrollBarDisplay, int flags,
            String vtScrollBarRes, String hzScrollBarRes)
        {
            if (rootContainer == container)
            {
                container = new Container();
                rootContainer.AddChild(container);
            }

            scrollPane = new ScrollPane(this, scroll, scrollBarMargin, scrollBarDisplay, flags, vtScrollBarRes, hzScrollBarRes);
        }
 internal void EnqueueCommand(ScrollType code, double offset, ThumbTrack track) {
     _scrollCommands.Add(new ScrollCommand(code, offset, track));
 }
        internal ScrollCommand(ScrollType code, double param) {
            Debug.Assert(code != ScrollType.SizeChange);

            Code = code;
            Param = param;
            Size = Size.Empty;
        }
Beispiel #49
0
        public ScrollPane(GComponent owner,
                                    ScrollType scrollType,
                                    Margin margin,
                                    Margin scrollBarMargin,
                                    ScrollBarDisplayType scrollBarDisplay,
                                    int flags)
        {
            _throwTween = new ThrowTween();

            _owner = owner;
            _container = _owner.rootContainer;

            _maskHolder = new Container();
            _container.AddChild(_maskHolder);

            _maskContentHolder = _owner.container;
            _maskContentHolder.x = 0;
            _maskContentHolder.y = 0;
            _maskHolder.AddChild(_maskContentHolder);

            if (Stage.touchScreen)
                _holdArea = 20;
            else
                _holdArea = 5;
            _holdAreaPoint = new Vector2();
            _margin = margin;
            _scrollBarMargin = scrollBarMargin;
            _bouncebackEffect = UIConfig.defaultScrollBounceEffect;
            _touchEffect = UIConfig.defaultScrollTouchEffect;
            _xPerc = 0;
            _yPerc = 0;
            _aniFlag = true;
            _scrollBarVisible = true;
            _scrollSpeed = UIConfig.defaultScrollSpeed;
            _mouseWheelSpeed = _scrollSpeed * 2;
            _displayOnLeft = (flags & 1) != 0;
            _snapToItem = (flags & 2) != 0;
            _displayInDemand = (flags & 4) != 0;
            _scrollType = scrollType;
            _mouseWheelEnabled = true;

            if (scrollBarDisplay == ScrollBarDisplayType.Default)
                scrollBarDisplay = UIConfig.defaultScrollBarDisplay;

            if (scrollBarDisplay != ScrollBarDisplayType.Hidden)
            {
                if (_scrollType == ScrollType.Both || _scrollType == ScrollType.Vertical)
                {
                    if (UIConfig.verticalScrollBar != null)
                    {
                        _vtScrollBar = UIPackage.CreateObjectFromURL(UIConfig.verticalScrollBar) as GScrollBar;
                        if (_vtScrollBar == null)
                            Debug.LogError("FairyGUI: cannot create scrollbar from " + UIConfig.verticalScrollBar);
                        else
                        {
                            _vtScrollBar.SetScrollPane(this, true);
                            _container.AddChild(_vtScrollBar.displayObject);
                        }
                    }
                }
                if (_scrollType == ScrollType.Both || _scrollType == ScrollType.Horizontal)
                {
                    if (UIConfig.horizontalScrollBar != null)
                    {
                        _hzScrollBar = UIPackage.CreateObjectFromURL(UIConfig.horizontalScrollBar) as GScrollBar;
                        if (_hzScrollBar == null)
                            Debug.LogError("FairyGUI: cannot create scrollbar from " + UIConfig.horizontalScrollBar);
                        else
                        {
                            _hzScrollBar.SetScrollPane(this, false);
                            _container.AddChild(_hzScrollBar.displayObject);
                        }
                    }
                }

                _scrollBarDisplayAuto = scrollBarDisplay == ScrollBarDisplayType.Auto;
                if (_scrollBarDisplayAuto)
                {
                    if (_vtScrollBar != null)
                        _vtScrollBar.displayObject.visible = false;
                    if (_hzScrollBar != null)
                        _hzScrollBar.displayObject.visible = false;
                    _scrollBarVisible = false;

                    _container.onRollOver.Add(__rollOver);
                    _container.onRollOut.Add(__rollOut);
                }
            }
            else
                _mouseWheelEnabled = false;

            if (_displayOnLeft && _vtScrollBar != null)
                _maskHolder.x = Mathf.FloorToInt((_margin.left + _vtScrollBar.width) * GRoot.contentScaleFactor);
            else
                _maskHolder.x = Mathf.FloorToInt(_margin.left * GRoot.contentScaleFactor);
            _maskHolder.y = Mathf.FloorToInt(_margin.top * GRoot.contentScaleFactor);

            SetSize(owner.width, owner.height);
            SetContentSize(owner.Bounds.width, owner.Bounds.height);

            _container.onMouseWheel.Add(__mouseWheel);
            _container.onMouseDown.Add(__mouseDown);
        }
        protected void SetupScroll(Margin scrollBarMargin,
            ScrollType scroll, ScrollBarDisplayType scrollBarDisplay, int flags,
            String vtScrollBarRes, String hzScrollBarRes)
        {
            container = new Container();
            rootContainer.AddChild(container);

            scrollPane = new ScrollPane(this, scroll, scrollBarMargin, scrollBarDisplay, flags, vtScrollBarRes, hzScrollBarRes);
            UpdateClipRect();
            SetBoundsChangedFlag();
        }