Наследование: EventDispatcher
Пример #1
0
 public GearBase(GObject owner)
 {
     _owner = owner;
     easeType = Ease.OutQuad;
     tweenTime = 0.3f;
     delay = 0;
 }
Пример #2
0
 public GearBase(GObject owner)
 {
     _owner = owner;
     pageSet = new PageOptionSet();
     easeType = Ease.OutQuad;
     tweenTime = 0.3f;
 }
Пример #3
0
        public override void ConstructFromXML(XML xml)
        {
            base.ConstructFromXML(xml);

            _grip = GetChild("grip");
            if (_grip == null)
            {
                Debug.LogWarning("FairyGUI: " + this.resourceURL + " should define grip");
                return;
            }

            _bar = GetChild("bar");
            if (_bar == null)
            {
                Debug.LogWarning("FairyGUI: " + this.resourceURL + " should define bar");
                return;
            }

            _arrowButton1 = GetChild("arrow1");
            _arrowButton2 = GetChild("arrow2");

            _grip.onMouseDown.Add(__gripMouseDown);
            if (_arrowButton1 != null)
                _arrowButton1.onClick.Add(__arrowButton1Click);
            if (_arrowButton2 != null)
                _arrowButton2.onClick.Add(__arrowButton2Click);
        }
Пример #4
0
 public void ReturnObject(GObject obj)
 {
     string url = obj.resourceURL;
     Queue<GObject> arr;
     if (_pool.TryGetValue(url, out arr))
         arr.Enqueue(obj);
 }
Пример #5
0
        public void AddBeforeMe(GObject target)
        {
            if (parent == null)
                throw new Exception("parent not set");

            int index = parent.GetChildIndex(this);
            parent.AddChildAt(target, index);
        }
Пример #6
0
        public LongPressGesture(GObject host)
        {
            _host = host;
            trigger = TRIGGER;
            interval = INTERVAL;
            Enable(true);

            onBegin = new EventListener(this, "onLongPressBegin");
            onEnd = new EventListener(this, "onLongPressEnd");
            onAction = new EventListener(this, "onLongPressAction");
        }
Пример #7
0
    /// <summary>
    /// 首次进入这个界面
    /// </summary>
    protected override void OnInit()
    {
        eventMgr = new InterchangeableEventListenerMgr(this.OnHandler, 1);
        base.OnInit();
        GObject windObj = UIPackage.CreateObject(this.PackName, this.ResName);

        if (windObj == null)
        {
            throw new System.Exception("不存在包名:" + this.PackName + "/ResName=" + ResName);
        }

        this.contentPane = windObj.asCom;
        this.container.cachedTransform.position   = Vector3.zero;
        this.container.cachedTransform.localScale = Vector3.one;

        if (this.contentPane == null)
        {
            Debug.LogError("创建物体失败");
        }
        this.SetSize(GRoot.inst.width, GRoot.inst.height);


        var obj      = this.contentPane.GetChild(BlackBgName);
        var closeBtn = this.contentPane.GetChild(mCloseBtnName);

        if (closeBtn != null && closeBtn.asButton != null)
        {
            closeBtn.asButton.onClick.Add(this.OnBtnClose);
        }
        //if (obj != null)
        //{
        //    mBlackBg = obj.asImage;
        //    mBlackBg.pivot = GamUtil.CenterPivot;
        //}

        for (int i = 0; i < this.contentPane.numChildren; i++)
        {
            FairyGUI.GObject gObject = this.contentPane.GetChildAt(i);
            UIObjs[gObject.name] = gObject;
            if (gObject.name.StartsWith(btnNameStartsWith))
            {
                gObject.onClick.Add(a =>
                {
                    OnBtnClick(a);
                });
            }
        }

        foreach (Controller ctrl in this.contentPane.Controllers)
        {
            this.UICtrls[ctrl.name] = ctrl;
        }
        this.pivot = GamUtil.CenterPivot;
    }
        public PinchGesture(GObject host)
        {
            _host = host;
            Enable(true);

            _touches = new int[2];

            onBegin = new EventListener(this, "onPinchBegin");
            onEnd = new EventListener(this, "onPinchEnd");
            onAction = new EventListener(this, "onPinchAction");
        }
        public SwipeGesture(GObject host)
        {
            _host = host;
            actionDistance = ACTION_DISTANCE;
            snapping = true;
            Enable(true);

            onBegin = new EventListener(this, "onSwipeBegin");
            onEnd = new EventListener(this, "onSwipeEnd");
            onMove = new EventListener(this, "onSwipeMove");
            onAction = new EventListener(this, "onnSwipeAction");
        }
Пример #10
0
        public RotationGesture(GObject host)
        {
            _host = host;
            Enable(true);

            _touches = new int[2];
            snapping = true;

            onBegin = new EventListener(this, "onRotationBegin");
            onEnd = new EventListener(this, "onRotationEnd");
            onAction = new EventListener(this, "onRotationAction");
        }
Пример #11
0
 public void Add(GObject target, RelationType relationType, bool usePercent)
 {
     foreach (RelationItem item in _items)
     {
         if (item.target == target)
         {
             item.Add(relationType, usePercent);
             return;
         }
     }
     RelationItem newItem = new RelationItem(_owner);
     newItem.target = target;
     newItem.Add(relationType, usePercent);
     _items.Add(newItem);
 }
Пример #12
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="target"></param>
 /// <param name="relationType"></param>
 /// <param name="usePercent"></param>
 public void Add(GObject target, RelationType relationType, bool usePercent)
 {
     int cnt = _items.Count;
     for (int i = 0; i < cnt; i++)
     {
         RelationItem item = _items[i];
         if (item.target == target)
         {
             item.Add(relationType, usePercent);
             return;
         }
     }
     RelationItem newItem = new RelationItem(_owner);
     newItem.target = target;
     newItem.Add(relationType, usePercent);
     _items.Add(newItem);
 }
Пример #13
0
        public void ReplaceMe(GObject target)
        {
            if (parent == null)
                throw new Exception("parent not set");

            target.name = this.name;
            target.alpha = this.alpha;
            target.rotation = this.rotation;
            target.visible = this.visible;
            target.touchable = this.touchable;
            target.grayed = this.grayed;
            target.SetXY(this.x, this.y);
            target.SetSize(this.width, this.height);

            int index = parent.GetChildIndex(this);
            parent.AddChildAt(target, index);
            target.relations.CopyFrom(this.relations);

            parent.RemoveChild(this, true);
        }
Пример #14
0
    static int _CreateFairyGUI_Relations(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1)
            {
                FairyGUI.GObject   arg0 = (FairyGUI.GObject)ToLua.CheckObject(L, 1, typeof(FairyGUI.GObject));
                FairyGUI.Relations obj  = new FairyGUI.Relations(arg0);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: FairyGUI.Relations.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Пример #15
0
        /// <summary>
        /// Display a modal layer and a waiting sign in the front.
        /// 显示一个半透明层和一个等待标志在最前面。半透明层的颜色可以通过UIConfig.modalLayerColor设定。
        /// 等待标志的资源可以通过UIConfig.globalModalWaiting。等待标志组件会设置为屏幕大小,请内部做好关联。
        /// </summary>
        public void ShowModalWait()
        {
            if (UIConfig.globalModalWaiting != null)
            {
                if (_modalWaitPane == null)
                {
                    _modalWaitPane = UIPackage.CreateObjectFromURL(UIConfig.globalModalWaiting);
                    _modalWaitPane.SetHome(this);
                }
                _modalWaitPane.SetSize(this.width, this.height);
                _modalWaitPane.AddRelation(this, RelationType.Size);

                AddChild(_modalWaitPane);
            }
        }
Пример #16
0
 public GLoaderSub(UIBase uiBase, FairyGUI.GObject o)
 {
     this.uiBase  = uiBase;
     this.gObject = o as FairyGUI.GLoader;
 }
Пример #17
0
 /// <summary>
 /// Close a popup.
 /// </summary>
 /// <param name="popup"></param>
 public void HidePopup(GObject popup)
 {
     if (popup != null)
     {
         int k = _popupStack.IndexOf(popup);
         if (k != -1)
         {
             for (int i = _popupStack.Count - 1; i >= k; i--)
             {
                 int last = _popupStack.Count - 1;
                 ClosePopup(_popupStack[last]);
                 _popupStack.RemoveAt(last);
             }
         }
     }
     else
     {
         foreach (GObject obj in _popupStack)
             ClosePopup(obj);
         _popupStack.Clear();
     }
 }
Пример #18
0
        protected void LoadFromPackage(string itemURL)
        {
            _contentItem = UIPackage.GetItemByURL(itemURL);

            if (_contentItem != null)
            {
                _contentItem         = _contentItem.getBranch();
                _contentSourceWidth  = _contentItem.width;
                _contentSourceHeight = _contentItem.height;
                _contentItem         = _contentItem.getHighResolution();
                _contentItem.Load();

                if (_contentItem.type == PackageItemType.Image)
                {
                    _content.texture        = _contentItem.texture;
                    _content.scale9Grid     = _contentItem.scale9Grid;
                    _content.scaleByTile    = _contentItem.scaleByTile;
                    _content.tileGridIndice = _contentItem.tileGridIndice;

                    UpdateLayout();
                }
                else if (_contentItem.type == PackageItemType.MovieClip)
                {
                    _content.interval    = _contentItem.interval;
                    _content.swing       = _contentItem.swing;
                    _content.repeatDelay = _contentItem.repeatDelay;
                    _content.frames      = _contentItem.frames;

                    UpdateLayout();
                }
                else if (_contentItem.type == PackageItemType.Component)
                {
                    GObject obj = UIPackage.CreateObjectFromURL(itemURL);
                    if (obj == null)
                    {
                        SetErrorState();
                    }
                    else if (!(obj is GComponent))
                    {
                        obj.Dispose();
                        SetErrorState();
                    }
                    else
                    {
                        _content2 = (GComponent)obj;
                        ((Container)displayObject).AddChild(_content2.displayObject);
                        UpdateLayout();
                    }
                }
                else
                {
                    if (_autoSize)
                    {
                        this.SetSize(_contentItem.width, _contentItem.height);
                    }

                    SetErrorState();

                    Debug.LogWarning("Unsupported type of GLoader: " + _contentItem.type);
                }
            }
            else
            {
                SetErrorState();
            }
        }
Пример #19
0
        internal void ChildStateChanged(GObject child)
        {
            if (_buildingDisplayList)
            {
                return;
            }

            int cnt = _children.Count;

            if (child is GGroup)
            {
                for (int i = 0; i < cnt; ++i)
                {
                    GObject g = _children[i];
                    if (g.group == child)
                    {
                        ChildStateChanged(g);
                    }
                }
                return;
            }

            if (child.displayObject == null)
            {
                return;
            }

            if (child.finalVisible)
            {
                if (child.displayObject.parent == null)
                {
                    if (_childrenRenderOrder == ChildrenRenderOrder.Ascent)
                    {
                        int index = 0;
                        for (int i = 0; i < cnt; i++)
                        {
                            GObject g = _children[i];
                            if (g == child)
                            {
                                break;
                            }

                            if (g.displayObject != null && g.displayObject.parent != null)
                            {
                                index++;
                            }
                        }
                        container.AddChildAt(child.displayObject, index);
                    }
                    else if (_childrenRenderOrder == ChildrenRenderOrder.Descent)
                    {
                        int index = 0;
                        for (int i = cnt - 1; i >= 0; i--)
                        {
                            GObject g = _children[i];
                            if (g == child)
                            {
                                break;
                            }

                            if (g.displayObject != null && g.displayObject.parent != null)
                            {
                                index++;
                            }
                        }
                        container.AddChildAt(child.displayObject, index);
                    }
                    else
                    {
                        container.AddChild(child.displayObject);

                        UpdateContext.OnBegin -= _buildDelegate;
                        UpdateContext.OnBegin += _buildDelegate;
                    }
                }
            }
            else
            {
                if (child.displayObject.parent != null)
                {
                    container.RemoveChild(child.displayObject);
                    if (_childrenRenderOrder == ChildrenRenderOrder.Arch)
                    {
                        UpdateContext.OnBegin -= _buildDelegate;
                        UpdateContext.OnBegin += _buildDelegate;
                    }
                }
            }
        }
Пример #20
0
 /// <summary>
 /// If a popup is showing, then close it; otherwise, open it.
 /// </summary>
 /// <param name="popup"></param>
 public void TogglePopup(GObject popup)
 {
     TogglePopup(popup, null, null);
 }
Пример #21
0
 public GearXY(GObject owner)
     : base(owner)
 {
 }
Пример #22
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="target"></param>
 /// <param name="relationType"></param>
 public void Add(GObject target, RelationType relationType)
 {
     Add(target, relationType, false);
 }
Пример #23
0
        internal void ResizeChildren(float dw, float dh)
        {
            if (_layout == GroupLayoutType.None || (_updating & 2) != 0 || parent == null)
            {
                return;
            }

            _updating |= 2;

            if (_boundsChanged)
            {
                _boundsChanged = false;
                if (!_autoSizeDisabled)
                {
                    UpdateBounds();
                    return;
                }
            }

            int cnt = parent.numChildren;

            if (!_percentReady)
            {
                _percentReady   = true;
                _numChildren    = 0;
                _totalSize      = 0;
                _mainChildIndex = -1;

                int j = 0;
                for (int i = 0; i < cnt; i++)
                {
                    GObject child = parent.GetChildAt(i);
                    if (child.group != this)
                    {
                        continue;
                    }

                    if (!_excludeInvisibles || child.internalVisible3)
                    {
                        if (j == _mainGridIndex)
                        {
                            _mainChildIndex = i;
                        }

                        _numChildren++;

                        if (_layout == GroupLayoutType.Horizontal)
                        {
                            _totalSize += child.width;
                        }
                        else
                        {
                            _totalSize += child.height;
                        }
                    }

                    j++;
                }

                if (_mainChildIndex != -1)
                {
                    if (_layout == GroupLayoutType.Horizontal)
                    {
                        GObject child = parent.GetChildAt(_mainChildIndex);
                        _totalSize += _mainGridMinSize - child.width;
                        child._sizePercentInGroup = _mainGridMinSize / _totalSize;
                    }
                    else
                    {
                        GObject child = parent.GetChildAt(_mainChildIndex);
                        _totalSize += _mainGridMinSize - child.height;
                        child._sizePercentInGroup = _mainGridMinSize / _totalSize;
                    }
                }

                for (int i = 0; i < cnt; i++)
                {
                    GObject child = parent.GetChildAt(i);
                    if (child.group != this)
                    {
                        continue;
                    }

                    if (i == _mainChildIndex)
                    {
                        continue;
                    }

                    if (_totalSize > 0)
                    {
                        child._sizePercentInGroup = (_layout == GroupLayoutType.Horizontal ? child.width : child.height) / _totalSize;
                    }
                    else
                    {
                        child._sizePercentInGroup = 0;
                    }
                }
            }

            float remainSize    = 0;
            float remainPercent = 1;
            bool  priorHandled  = false;

            if (_layout == GroupLayoutType.Horizontal)
            {
                remainSize = this.width - (_numChildren - 1) * _columnGap;
                if (_mainChildIndex != -1 && remainSize >= _totalSize)
                {
                    GObject child = parent.GetChildAt(_mainChildIndex);
                    child.SetSize(remainSize - (_totalSize - _mainGridMinSize), child._rawHeight + dh, true);
                    remainSize    -= child.width;
                    remainPercent -= child._sizePercentInGroup;
                    priorHandled   = true;
                }

                float curX = this.x;
                for (int i = 0; i < cnt; i++)
                {
                    GObject child = parent.GetChildAt(i);
                    if (child.group != this)
                    {
                        continue;
                    }

                    if (_excludeInvisibles && !child.internalVisible3)
                    {
                        child.SetSize(child._rawWidth, child._rawHeight + dh, true);
                        continue;
                    }

                    if (!priorHandled || i != _mainChildIndex)
                    {
                        child.SetSize(Mathf.Round(child._sizePercentInGroup / remainPercent * remainSize), child._rawHeight + dh, true);
                        remainPercent -= child._sizePercentInGroup;
                        remainSize    -= child.width;
                    }

                    child.xMin = curX;
                    if (child.width != 0)
                    {
                        curX += child.width + _columnGap;
                    }
                }
            }
            else
            {
                remainSize = this.height - (_numChildren - 1) * _lineGap;
                if (_mainChildIndex != -1 && remainSize >= _totalSize)
                {
                    GObject child = parent.GetChildAt(_mainChildIndex);
                    child.SetSize(child._rawWidth + dw, remainSize - (_totalSize - _mainGridMinSize), true);
                    remainSize    -= child.height;
                    remainPercent -= child._sizePercentInGroup;
                    priorHandled   = true;
                }

                float curY = this.y;
                for (int i = 0; i < cnt; i++)
                {
                    GObject child = parent.GetChildAt(i);
                    if (child.group != this)
                    {
                        continue;
                    }

                    if (_excludeInvisibles && !child.internalVisible3)
                    {
                        child.SetSize(child._rawWidth + dw, child._rawHeight, true);
                        continue;
                    }

                    if (!priorHandled || i != _mainChildIndex)
                    {
                        child.SetSize(child._rawWidth + dw, Mathf.Round(child._sizePercentInGroup / remainPercent * remainSize), true);
                        remainPercent -= child._sizePercentInGroup;
                        remainSize    -= child.height;
                    }

                    child.yMin = curY;
                    if (child.height != 0)
                    {
                        curY += child.height + _lineGap;
                    }
                }
            }

            _updating &= 1;
        }
Пример #24
0
 public GearLook(GObject owner)
     : base(owner)
 {
 }
Пример #25
0
 public Relations(GObject owner)
 {
     _owner = owner;
     _items = new List <RelationItem>();
 }
Пример #26
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="target"></param>
        /// <param name="downward"></param>
        public void Show(GObject target, object downward)
        {
            GRoot r = target != null ? target.root : GRoot.inst;

            r.ShowPopup(this.contentPane, (target is GRoot) ? null : target, downward);
        }
 void ReleaseRefTarget(GObject target)
 {
     target.onPositionChanged.Remove(__targetXYChanged);
     target.onSizeChanged.Remove(__targetSizeChanged);
 }
 public RelationItem(GObject owner)
 {
     _owner = owner;
     _defs  = new List <RelationDef>();
 }
Пример #29
0
 /// <summary>
 /// Show a popup object along with the specific target object.
 /// 显示一个popup。将popup显示在指定对象的上边或者下边。
 /// popup的特点是点击popup对象外的区域,popup对象将自动消失。
 /// </summary>
 /// <param name="popup"></param>
 /// <param name="target"></param>
 public void ShowPopup(GObject popup, GObject target)
 {
     ShowPopup(popup, target, null);
 }
Пример #30
0
 public GearSize(GObject owner)
     : base(owner)
 {
 }
Пример #31
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="msg"></param>
        public void ShowTooltips(string msg)
        {
            if (_defaultTooltipWin == null)
            {
                string resourceURL = UIConfig.tooltipsWin;
                if (string.IsNullOrEmpty(resourceURL))
                {
                    Debug.LogWarning("FairyGUI: UIConfig.tooltipsWin not defined");
                    return;
                }

                _defaultTooltipWin = UIPackage.CreateObjectFromURL(resourceURL);
                _defaultTooltipWin.SetHome(this);
                _defaultTooltipWin.touchable = false;
            }

            _defaultTooltipWin.text = msg;
            ShowTooltipsWin(_defaultTooltipWin);
        }
Пример #32
0
 /// <summary>
 /// Show a  popup object.
 /// 显示一个popup。
 /// popup的特点是点击popup对象外的区域,popup对象将自动消失。
 /// </summary>
 /// <param name="popup"></param>
 public void ShowPopup(GObject popup)
 {
     ShowPopup(popup, null, null);
 }
Пример #33
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="popup"></param>
        /// <param name="target"></param>
        /// <param name="downward"></param>
        public void TogglePopup(GObject popup, GObject target, object downward)
        {
            if (_justClosedPopups.IndexOf(popup) != -1)
                return;

            ShowPopup(popup, target, downward);
        }
Пример #34
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="popup"></param>
 /// <param name="target"></param>
 /// <param name="dir"></param>
 public void TogglePopup(GObject popup, GObject target, PopupDirection dir)
 {
     TogglePopup(popup, target, dir, false);
 }
Пример #35
0
 public GearDisplay(GObject owner)
     : base(owner)
 {
 }
Пример #36
0
 public void TogglePopup(GObject popup, GObject target, object downward)
 {
     TogglePopup(popup, target,
                 downward == null ? PopupDirection.Auto : ((bool)downward == true ? PopupDirection.Down : PopupDirection.Up),
                 false);
 }
Пример #37
0
        void BuildNativeDisplayList()
        {
            if (displayObject == null || displayObject.isDisposed)
            {
                return;
            }

            int cnt = _children.Count;

            if (cnt == 0)
            {
                return;
            }

            switch (_childrenRenderOrder)
            {
            case ChildrenRenderOrder.Ascent:
            {
                for (int i = 0; i < cnt; i++)
                {
                    GObject child = _children[i];
                    if (child.displayObject != null && child.finalVisible)
                    {
                        container.AddChild(child.displayObject);
                    }
                }
            }
            break;

            case ChildrenRenderOrder.Descent:
            {
                for (int i = cnt - 1; i >= 0; i--)
                {
                    GObject child = _children[i];
                    if (child.displayObject != null && child.finalVisible)
                    {
                        container.AddChild(child.displayObject);
                    }
                }
            }
            break;

            case ChildrenRenderOrder.Arch:
            {
                for (int i = 0; i < _apexIndex; i++)
                {
                    GObject child = _children[i];
                    if (child.displayObject != null && child.finalVisible)
                    {
                        container.AddChild(child.displayObject);
                    }
                }
                for (int i = cnt - 1; i >= _apexIndex; i--)
                {
                    GObject child = _children[i];
                    if (child.displayObject != null && child.finalVisible)
                    {
                        container.AddChild(child.displayObject);
                    }
                }
            }
            break;
            }
        }
Пример #38
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="popup"></param>
 /// <param name="target"></param>
 public void TogglePopup(GObject popup, GObject target)
 {
     TogglePopup(popup, target, PopupDirection.Auto, false);
 }
Пример #39
0
        int _SetChildIndex(GObject child, int oldIndex, int index)
        {
            int cnt = _children.Count;

            if (index > cnt)
            {
                index = cnt;
            }

            if (oldIndex == index)
            {
                return(oldIndex);
            }

            _children.RemoveAt(oldIndex);
            if (index >= cnt)
            {
                _children.Add(child);
            }
            else
            {
                _children.Insert(index, child);
            }

            if (child.inContainer)
            {
                int displayIndex = 0;
                if (_childrenRenderOrder == ChildrenRenderOrder.Ascent)
                {
                    for (int i = 0; i < index; i++)
                    {
                        GObject g = _children[i];
                        if (g.inContainer)
                        {
                            displayIndex++;
                        }
                    }
                    container.SetChildIndex(child.displayObject, displayIndex);
                }
                else if (_childrenRenderOrder == ChildrenRenderOrder.Descent)
                {
                    for (int i = cnt - 1; i > index; i--)
                    {
                        GObject g = _children[i];
                        if (g.inContainer)
                        {
                            displayIndex++;
                        }
                    }
                    container.SetChildIndex(child.displayObject, displayIndex);
                }
                else
                {
                    UpdateContext.OnBegin -= _buildDelegate;
                    UpdateContext.OnBegin += _buildDelegate;
                }

                SetBoundsChangedFlag();
            }

            return(index);
        }
Пример #40
0
 /// <summary>
 /// If a popup is showing, then close it; otherwise, open it.
 /// </summary>
 /// <param name="popup"></param>
 public void TogglePopup(GObject popup)
 {
     TogglePopup(popup, null, PopupDirection.Auto, false);
 }
Пример #41
0
 /// <summary>
 /// Returns the index of a child within the container, or "-1" if it is not found.
 /// </summary>
 /// <param name="child">A child object</param>
 /// <returns>Index of the child. -1 If not found.</returns>
 public int GetChildIndex(GObject child)
 {
     return(_children.IndexOf(child));
 }
Пример #42
0
 public void ScrollToView(GObject obj)
 {
     ScrollToView(obj, false);
 }
Пример #43
0
 /// <summary>
 /// 
 /// </summary>
 public void HideTooltips()
 {
     if (_tooltipWin != null)
     {
         if (_tooltipWin.parent != null)
             RemoveChild(_tooltipWin);
         _tooltipWin = null;
     }
 }
Пример #44
0
 /// <summary>
 /// Removes a child from the component. If the object is not a child, nothing happens.
 /// </summary>
 /// <param name="child">A child object</param>
 /// <returns>GObject</returns>
 public GObject RemoveChild(GObject child)
 {
     return(RemoveChild(child, false));
 }
Пример #45
0
 /// <summary>
 /// Show a  popup object.
 /// 显示一个popup。
 /// popup的特点是点击popup对象外的区域,popup对象将自动消失。
 /// </summary>
 /// <param name="popup"></param>
 public void ShowPopup(GObject popup)
 {
     ShowPopup(popup, null, null);
 }
Пример #46
0
 public Vector2 GetPoupPosition(GObject popup, GObject target, object downward)
 {
     return(GetPoupPosition(popup, target,
                            downward == null ? PopupDirection.Auto : ((bool)downward == true ? PopupDirection.Down : PopupDirection.Up)));
 }
Пример #47
0
        /// <summary>
        /// Show a popup object along with the specific target object.
        /// 显示一个popup。将popup显示在指定对象的上边或者下边。
        /// popup的特点是点击popup对象外的区域,popup对象将自动消失。
        /// </summary>
        /// <param name="popup"></param>
        /// <param name="target"></param>
        /// <param name="downward">True to display downwards, false to display upwards, null to display automatically.</param>
        public void ShowPopup(GObject popup, GObject target, object downward)
        {
            if (_popupStack.Count > 0)
            {
                int k = _popupStack.IndexOf(popup);
                if (k != -1)
                {
                    for (int i = _popupStack.Count - 1; i >= k; i--)
                    {
                        int last = _popupStack.Count - 1;
                        ClosePopup(_popupStack[last]);
                        _popupStack.RemoveAt(last);
                    }
                }
            }
            _popupStack.Add(popup);

            AddChild(popup);
            AdjustModalLayer();

            if ((popup is Window) && target == null && downward == null)
                return;

            Vector2 pos = GetPoupPosition(popup, target, downward);
            popup.xy = pos;
        }
Пример #48
0
 public GGraphSub(UIBase uiBase, FairyGUI.GObject o)
 {
     this.uiBase  = uiBase;
     this.gObject = o.asGraph;
 }
Пример #49
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="tooltipWin"></param>
        public void ShowTooltipsWin(GObject tooltipWin)
        {
            HideTooltips();

            _tooltipWin = tooltipWin;
            Timers.inst.Add(0.1f, 1, __showTooltipsWin);
        }
Пример #50
0
 public GMoviceSub(UIBase uiBase, FairyGUI.GObject o)
 {
     this.uiBase  = uiBase;
     this.gObject = o.asMovieClip;
 }
Пример #51
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="popup"></param>
 /// <param name="target"></param>
 public void TogglePopup(GObject popup, GObject target)
 {
     TogglePopup(popup, target, null);
 }
Пример #52
0
 /// <summary>
 /// Show a popup object along with the specific target object.
 /// 显示一个popup。将popup显示在指定对象的上方或者下方。
 /// popup的特点是点击popup对象外的区域,popup对象将自动消失。
 /// </summary>
 /// <param name="popup"></param>
 /// <param name="target"></param>
 /// <param name="dir"></param>
 public void ShowPopup(GObject popup, GObject target, PopupDirection dir)
 {
     ShowPopup(popup, target, dir, false);
 }
Пример #53
0
 void ClosePopup(GObject target)
 {
     if (target.parent != null)
     {
         if (target is Window)
             ((Window)target).Hide();
         else
             RemoveChild(target);
     }
 }
Пример #54
0
 /// <summary>
 /// Show a popup object along with the specific target object.
 /// 显示一个popup。将popup显示在指定对象的上边或者下边。
 /// popup的特点是点击popup对象外的区域,popup对象将自动消失。
 /// </summary>
 /// <param name="popup"></param>
 /// <param name="target"></param>
 public void ShowPopup(GObject popup, GObject target)
 {
     ShowPopup(popup, target, PopupDirection.Auto, false);
 }
Пример #55
0
        /// <summary>
        /// Display a modal waiting sign in the front.
        /// 显示一个等待标志在最前面。等待标志的资源可以通过UIConfig.windowModalWaiting。等待标志组件会设置为屏幕大小,请内部做好关联。
        /// 还可以设定一个requestingCmd作为等待的命令字,在CloseModalWait里传入相同的命令字ModalWait将结束,否则CloseModalWait无效。
        /// </summary>
        /// <param name="requestingCmd"></param>
        public void ShowModalWait(int requestingCmd)
        {
            if (requestingCmd != 0)
                _requestingCmd = requestingCmd;

            if (UIConfig.windowModalWaiting != null)
            {
                if (_modalWaitPane == null)
                    _modalWaitPane = UIPackage.CreateObjectFromURL(UIConfig.windowModalWaiting);

                LayoutModalWaitPane();

                AddChild(_modalWaitPane);
            }
        }
Пример #56
0
 /// <summary>
 /// Show a  popup object.
 /// 显示一个popup。
 /// popup的特点是点击popup对象外的区域,popup对象将自动消失。
 /// </summary>
 /// <param name="popup"></param>
 public void ShowPopup(GObject popup)
 {
     ShowPopup(popup, null, PopupDirection.Auto, false);
 }
Пример #57
0
        public bool IsChildInView(GObject obj)
        {
            if (_vScroll)
            {
                float top = _yPerc * (_contentHeight - _maskHeight);
                float bottom = top + _maskHeight;
                if (obj.y + obj.height < top || obj.y > bottom)
                    return false;
            }
            if (_hScroll)
            {
                float left = _xPerc * (_contentWidth - _maskWidth);
                float right = left + _maskWidth;
                if (obj.x + obj.width < left || obj.x > right)
                    return false;
            }

            return true;
        }
Пример #58
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="tooltipWin"></param>
 public void ShowTooltipsWin(GObject tooltipWin)
 {
     ShowTooltipsWin(tooltipWin, 0.1f);
 }
Пример #59
0
        public void ScrollToView(GObject obj, bool ani)
        {
            _owner.EnsureBoundsCorrect();
            if (Timers.inst.Exists(Refresh))
                Refresh(null);

            if (_vScroll)
            {
                float top = _yPerc * (_contentHeight - _maskHeight);
                float bottom = top + _maskHeight;
                if (obj.y < top)
                    SetPosY(obj.y, ani);
                else if (obj.y + obj.height > bottom)
                {
                    if (obj.y + obj.height * 2 >= top)
                        SetPosY(obj.y + obj.height * 2 - _maskHeight, ani);
                    else
                        SetPosY(obj.y + obj.height - _maskHeight, ani);
                }
            }
            if (_hScroll)
            {
                float left = _xPerc * (_contentWidth - _maskWidth);
                float right = left + _maskWidth;
                if (obj.x < left)
                    SetPosX(obj.x, ani);
                else if (obj.x + obj.width > right)
                {
                    if (obj.x + obj.width * 2 >= left)
                        SetPosX(obj.x + obj.width * 2 - _maskWidth, ani);
                    else
                        SetPosX(obj.x + obj.width - _maskWidth, ani);
                }
            }

            if (!ani && Timers.inst.Exists(Refresh))
                Refresh(null);
        }
Пример #60
0
 /// <summary>
 /// Add a child to the component. It will be at the frontmost position.
 /// </summary>
 /// <param name="child">A child object</param>
 /// <returns>GObject</returns>
 public GObject AddChild(GObject child)
 {
     AddChildAt(child, _children.Count);
     return(child);
 }