public void End()
        {
            if (OnEnd != null)
                OnEnd.Invoke();

            OnEnd = null;
        }
Пример #2
0
 public void setEntity(EntityBase entityBase, Entity entity, EventCallback0 onHide = null)
 {
     this.entity       = entity;
     this.entityBase   = entityBase;
     this.hideCallback = onHide;
     refresh();
 }
Пример #3
0
        public void Begin()
        {
            frameId++;
            if (frameId == 0)
            {
                frameId = 1;
            }
            counter               = 0;
            renderingOrder        = 0;
            batchingDepth         = 0;
            rectMaskDepth         = 0;
            stencilReferenceValue = 0;
            alpha  = 1;
            grayed = false;

            clipped = false;
            _clipStack.Clear();

            _tmpBegin = OnBegin;
            OnBegin   = null;

            //允许OnBegin里再次Add,这里没有做死锁检查
            while (_tmpBegin != null)
            {
                _tmpBegin.Invoke();
                _tmpBegin = OnBegin;
            }
        }
Пример #4
0
        public HtmlLink()
        {
            _shape = new SelectionShape();
            _shape.gameObject.name = "HtmlLink";

            _clickHandler = (EventContext context) =>
            {
                _owner.onClickLink.BubbleCall(_element.GetString("href"));
            };
            _rolloverHandler = (EventContext context) =>
            {
                context.CaptureTouch();
                if (_owner.htmlParseOptions.linkHoverBgColor.a > 0)
                {
                    _shape.color = _owner.htmlParseOptions.linkHoverBgColor;
                }
            };
            _rolloutHandler = () =>
            {
                if (_owner.htmlParseOptions.linkHoverBgColor.a > 0)
                {
                    _shape.color = _owner.htmlParseOptions.linkBgColor;
                }
            };
        }
        public void Begin()
        {
            frameId++;
            if (frameId == 0)
                frameId = 1;
            counter = 0;
            renderingOrder = 0;
            batchingDepth = 0;
            rectMaskDepth = 0;
            stencilReferenceValue = 0;
            alpha = 1;
            grayed = false;

            clipped = false;
            _clipStack.Clear();

            _tmpBegin = OnBegin;
            OnBegin = null;

            //允许OnBegin里再次Add,这里没有做死锁检查
            while (_tmpBegin != null)
            {
                _tmpBegin.Invoke();
                _tmpBegin = OnBegin;
            }
        }
Пример #6
0
        /// <summary>
        ///
        /// </summary>
        public void Begin()
        {
            current = this;

            frameId++;
            if (frameId == 0)
            {
                frameId = 1;
            }
            renderingOrder        = 0;
            batchingDepth         = 0;
            rectMaskDepth         = 0;
            stencilReferenceValue = 0;
            alpha  = 1;
            grayed = false;

            clipped = false;
            _clipStack.Clear();

            Stats.ObjectCount   = 0;
            Stats.GraphicsCount = 0;

            _tmpBegin = OnBegin;
            OnBegin   = null;

            //允许OnBegin里再次Add,这里没有做死锁检查
            while (_tmpBegin != null)
            {
                _tmpBegin.Invoke();
                _tmpBegin = OnBegin;
                OnBegin   = null;
            }

            working = true;
        }
Пример #7
0
    public void showGuideTouchable(Vector2 center, int width, EventCallback0 callback, string hint = "write hint here", string arrowPos = "rt")
    {
        if (!init)
        {
            Init();
        }
        _guideLayer.setWindowTouchable(callback);

        GRoot.inst.AddChild(_guideLayer);         //!!Before using TransformRect(or GlobalToLocal), the object must be added first
        //Rect rect = target.TransformRect(new Rect(0, 0, target.width, target.height), _guideLayer);

        _guideLayer.GetChild("mark").SetXY(center.x, center.y);;

        if (arrowPos == "rt")
        {
            _guideLayer.setStyleRt();
        }
        else
        {
            _guideLayer.setStyleLb();
        }



        _guideLayer.setWindow(new Rect(center.x - width, center.y - width, 2 * width, 2 * width));
        _guideLayer.setHint(hint);
    }
Пример #8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="gameTime"></param>
        public void Update(GameTime gameTime)
        {
            Timers.inst.Update(gameTime);
            TweenManager.Update(gameTime);

            HandleInputCapturer();
            HandleKeyEvents();
            HandleMouseEvents();
            if (_focused is InputTextField)
            {
                HandleTextInput();
            }

            _tempDelegate = beforeUpdate;
            beforeUpdate  = null;

            //允许beforeUpdate里再次Add,这里没有做死锁检查
            while (_tempDelegate != null)
            {
                _tempDelegate.Invoke();
                _tempDelegate = beforeUpdate;
                beforeUpdate  = null;
            }
            _tempDelegate = null;

            Update();

            if (afterUpdate != null)
            {
                afterUpdate.Invoke();
            }

            afterUpdate = null;
        }
Пример #9
0
        public HtmlLink()
        {
            _shape = new SelectionShape();
            _shape.gameObject.name = "HtmlLink";

            _clickHandler = (EventContext context) =>
            {
                _owner.BubbleEvent("onClickLink", _element.GetString("href"));
            };
            _rolloverHandler = (EventContext context) =>
            {
                if (_owner.htmlParseOptions.linkHoverBgColor.a > 0 && _shape != null)
                {
                    _shape.color = _owner.htmlParseOptions.linkHoverBgColor;
                    _shape.alpha = _shape.color.a;
                }
            };
            _rolloutHandler = () =>
            {
                if (_owner.htmlParseOptions.linkHoverBgColor.a > 0 && _shape != null)
                {
                    _shape.color = _owner.htmlParseOptions.linkBgColor;
                    _shape.alpha = _shape.color.a;
                }
            };
        }
Пример #10
0
        public void Begin()
        {
            frameId++;
            if (frameId == 0)
            {
                frameId = 1;
            }
            counter               = 0;
            renderingOrder        = 0;
            batchingDepth         = 0;
            rectMaskDepth         = 0;
            stencilReferenceValue = 0;
            alpha  = 1;
            grayed = false;

            clipped = false;
            _clipStack.Clear();

            if (OnBegin != null)
            {
                OnBegin.Invoke();
            }

            OnBegin = null;
        }
Пример #11
0
        public void Clear()
        {
#if FAIRYGUI_TOLUA
            //DelayDispose�Ĵ���������ȫ��ԭ�������Remove������Add����ôDelayDispose����ɾ������ע�͵����ȴ�tolua�Ľ�
            if (_callback1 != null)
            {
                Delegate[] ds = _callback1.GetInvocationList();
                for (int i = 0; i < ds.Length; i++)
                {
                    LuaDelegate ld = ds[i].Target as LuaDelegate;
                    if (ld != null)
                    {
                        LuaState state = ld.func.GetLuaState();
                        state.DelayDispose(ld.func);
                        if (ld.self != null)
                        {
                            state.DelayDispose(ld.self);
                        }
                    }
                }
            }
#endif
            _callback1       = null;
            _callback0       = null;
            _captureCallback = null;
        }
Пример #12
0
        public void OnRender()
        {
            Global.gEnv.pHardwareMouse.GetHardwareMouseClientPosition(ref _mousePositionX, ref _mousePositionY);
            if ((_mousePositionX < 0 || _mousePositionY < 0 || _mousePositionX >= this.width || _mousePositionY >= this.height) &&
                _touchInfo.began)
            {
                HandleMouseEvents((int)_mousePositionX, (int)_mousePositionY, EHARDWAREMOUSEEVENT.HARDWAREMOUSEEVENT_LBUTTONUP, 0);
            }
            if (_focused is InputTextField)
            {
                HandleTextInput();
            }


            _tempDelegate = beforeVisit;
            beforeVisit   = null;

            //允许beforeVisit里再次Add,这里没有做死锁检查
            while (_tempDelegate != null)
            {
                _tempDelegate.Invoke();
                _tempDelegate = beforeVisit;
                beforeVisit   = null;
            }
            _tempDelegate = null;

            Visit();

            if (afterVisit != null)
            {
                afterVisit.Invoke();
            }

            afterVisit = null;
        }
Пример #13
0
 public GGroup()
 {
     _mainGridIndex   = -1;
     _mainChildIndex  = -1;
     _mainGridMinSize = 50;
     _refreshDelegate = EnsureBoundsCorrect;
 }
Пример #14
0
        public DisplayObject()
        {
            _alpha           = 1;
            _visible         = true;
            _touchable       = true;
            id               = _gInstanceCounter++;
            _blendMode       = BlendMode.Normal;
            _focalLength     = 2000;
            _captureDelegate = Capture;
            _outlineChanged  = true;
            _internal_bounds = new float[4];

            onClick            = new EventListener(this, "onClick");
            onRightClick       = new EventListener(this, "onRightClick");
            onTouchBegin       = new EventListener(this, "onTouchBegin");
            onTouchMove        = new EventListener(this, "onTouchMove");
            onTouchEnd         = new EventListener(this, "onTouchEnd");
            onRollOver         = new EventListener(this, "onRollOver");
            onRollOut          = new EventListener(this, "onRollOut");
            onMouseWheel       = new EventListener(this, "onMouseWheel");
            onAddedToStage     = new EventListener(this, "onAddedToStage");
            onRemovedFromStage = new EventListener(this, "onRemovedFromStage");
            onKeyDown          = new EventListener(this, "onKeyDown");
            onClickLink        = new EventListener(this, "onClickLink");
        }
Пример #15
0
        /// <summary>
        /// 
        /// </summary>
        public void Begin()
        {
            current = this;

            frameId++;
            if (frameId == 0)
                frameId = 1;
            renderingOrder = 0;
            batchingDepth = 0;
            rectMaskDepth = 0;
            stencilReferenceValue = 0;
            alpha = 1;
            grayed = false;

            clipped = false;
            _clipStack.Clear();

            Stats.ObjectCount = 0;
            Stats.GraphicsCount = 0;

            _tmpBegin = OnBegin;
            OnBegin = null;

            //允许OnBegin里再次Add,这里没有做死锁检查
            while (_tmpBegin != null)
            {
                _tmpBegin.Invoke();
                _tmpBegin = OnBegin;
                OnBegin = null;
            }

            working = true;
        }
Пример #16
0
 public void Set(EventCallback0 callback)
 {
     _bridge.Clear();
     if (callback != null)
     {
         _bridge.Add(callback);
     }
 }
Пример #17
0
 public GComponent()
 {
     _children      = new List <GObject>();
     _controllers   = new List <Controller>();
     _transitions   = new List <Transition>();
     _margin        = new Margin();
     _buildDelegate = BuildNativeDisplayList;
 }
Пример #18
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="caption"></param>
        /// <param name="index"></param>
        /// <param name="callback"></param>
        /// <returns></returns>
        public GButton AddItemAt(string caption, int index, EventCallback0 callback)
        {
            GButton item = CreateItem(caption, callback);

            _list.AddChildAt(item, index);

            return(item);
        }
Пример #19
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="caption"></param>
        /// <param name="callback"></param>
        /// <returns></returns>
        public GButton AddItem(string caption, EventCallback0 callback)
        {
            GButton item = CreateItem(caption, callback);

            _list.AddChild(item);

            return(item);
        }
Пример #20
0
        public GLoader()
        {
            _url           = string.Empty;
            _align         = AlignType.Left;
            _verticalAlign = VertAlignType.Top;
            showErrorSign  = true;

            _content2SizeChangedDelegate = onContent2SizeChanged;
        }
Пример #21
0
 public static bool AddOnClick(GObject self, EventCallback0 callBackNoParam)
 {
     if (self != null)
     {
         self.onClick.Add(callBackNoParam);
         return(true);
     }
     return(false);
 }
Пример #22
0
        /// <summary>
        /// 移除对指定事件的监听。
        /// </summary>
        /// <param name="type">事件类型</param>
        /// <param name="callback0">回调委托</param>
        public void RemoveListener(IComparable type, EventCallback0 callback0)
        {
            EventListener listener = null;

            if (m_listeners.TryGetValue(type, out listener))
            {
                listener.Remove(callback0);
            }
        }
Пример #23
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="callback"></param>
        public void Add(EventCallback0 callback)
        {
            if (_bridge == null)
            {
                _bridge = this.owner.GetEventBridge(_type);
            }

            _bridge.Add(callback);
        }
Пример #24
0
 public void AddEventListener_RemoveByFlag(string strType, EventCallback0 updateValue)
 {
     if (_eventDispatcher == null)
     {
         _eventDispatcher = new EventDispatcher();
     }
     _eventDispatcher.AddEventListener(strType, updateValue);
     updateValue();
 }
Пример #25
0
        public void End()
        {
            if (OnEnd != null)
            {
                OnEnd.Invoke();
            }

            OnEnd = null;
        }
Пример #26
0
    public static GObject FindChildAndAddClick(GComponent parent, string childName, EventCallback0 callBackNoParam)
    {
        GObject child = FindChildByName <GObject>(parent, childName);

        if (child != null)
        {
            child.onClick.Add(callBackNoParam);
        }
        return(child);
    }
Пример #27
0
        public GComponent()
        {
            _children      = new List <GObject>();
            _controllers   = new List <Controller>();
            _transitions   = new List <Transition>();
            _margin        = new Margin();
            _buildDelegate = BuildNativeDisplayList;

            onDrop = new EventListener(this, "onDrop");
        }
Пример #28
0
        public GComponent()
        {
            _children = new List<GObject>();
            _controllers = new List<Controller>();
            _transitions = new List<Transition>();
            _margin = new Margin();
            _buildDelegate = BuildNativeDisplayList;

            onDrop = new EventListener(this, "onDrop");
        }
Пример #29
0
        /// <summary>
        /// 添加对指定事件的监听。
        /// </summary>
        /// <param name="type">事件类型</param>
        /// <param name="callback0">回调委托</param>
        public void AddListener(IComparable type, EventCallback0 callback0, int priority = 1)
        {
            EventListener listener = null;

            if (!m_listeners.TryGetValue(type, out listener))
            {
                listener = new EventListener();
                m_listeners.Add(type, listener);
            }
            listener.Add(callback0, priority);
        }
Пример #30
0
        public MovieClip()
        {
            playState = new PlayState();
            interval = 0.1f;
            _playing = true;

            onPlayEnd = new EventListener(this, "onPlayEnd");
            _playEndDelegate = () => { onPlayEnd.Call(); };

            SetPlaySettings();
        }
Пример #31
0
        /// <summary>
        ///
        /// </summary>
        public MovieClip()
        {
            playState = new PlayState();
            interval  = 0.1f;
            _playing  = true;

            onPlayEnd        = new EventListener(this, "onPlayEnd");
            _playEndDelegate = () => { onPlayEnd.Call(); };

            SetPlaySettings();
        }
Пример #32
0
        /// <summary>
        ///
        /// </summary>
        public void End()
        {
            working = false;

            if (OnEnd != null)
            {
                OnEnd.Invoke();
            }

            OnEnd = null;
        }
Пример #33
0
        public void Add(EventCallback0 callback)
        {
            _callback0 -= callback;
            _callback0 += callback;

            if (!_regsiter)
            {
                _regsiter = true;
                this.owner.RegisterListener(this);
            }
        }
Пример #34
0
        public void Add(EventCallback0 callback)
        {
            _callback0 -= callback;
            _callback0 += callback;

            if (!_regsiter)
            {
                _regsiter = true;
                this.owner.RegisterListener(this);
            }
        }
Пример #35
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="caption"></param>
        /// <param name="callback"></param>
        /// <returns></returns>
        public GButton AddItem(string caption, EventCallback0 callback)
        {
            GButton item = _list.AddItemFromPool().asButton;
            item.title = caption;
            item.data = callback;
            item.grayed = false;
            Controller c = item.GetController("checked");
            if (c != null)
                c.selectedIndex = 0;

            return item;
        }
Пример #36
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="callback"></param>
        public void Set(EventCallback0 callback)
        {
            if (_bridge == null)
            {
                _bridge = this.owner.GetEventBridge(_type);
            }

            _bridge.Clear();
            if (callback != null)
            {
                _bridge.Add(callback);
            }
        }
Пример #37
0
 public HtmlSelect()
 {
     if (resource != null)
     {
         comboBox = UIPackage.CreateObjectFromURL(resource).asComboBox;
         _changeHandler = () =>
         {
             _owner.DispatchEvent(CHANGED_EVENT, null, this);
         };
     }
     else
         Debug.LogWarning("FairyGUI: Set HtmlSelect.resource first");
 }
Пример #38
0
        public void AddEventListener(string strType, EventCallback0 callback)
        {
            if (strType == null)
                throw new Exception("event type cant be null");

            if (_dic == null)
                _dic = new Dictionary<string, EventListener>();

            EventListener listener = null;
            if (!_dic.TryGetValue(strType, out listener))
                listener = new EventListener(this, strType);
            listener.Add(callback);
        }
Пример #39
0
        public GButton()
        {
            pageOption = new PageOption();

            sound              = UIConfig.buttonSound;
            soundVolumeScale   = UIConfig.buttonSoundVolumeScale;
            changeStateOnClick = true;
            _downEffectValue   = 0.8f;
            _title             = string.Empty;

            onChanged         = new EventListener(this, "onChanged");
            _touchEndDelegate = __touchEnd;
        }
Пример #40
0
        public RichTextField()
        {
            gameObject.name = "RichTextField";
            this.opaque = true;

            htmlPageContext = HtmlPageContext.inst;
            htmlParseOptions = new HtmlParseOptions();

            this.textField = new TextField();
            textField.EnableRichSupport(this);
            AddChild(textField);

            _refreshObjectsDelegate = InternalRefreshObjects;
        }
Пример #41
0
        public GButton AddItemAt(string caption, int index, EventCallback0 callback)
        {
            GObject obj = _list.GetFromPool(_list.defaultItem);
            _list.AddChildAt(obj, index);

            GButton item = (GButton)obj;
            item.title = caption;
            item.data = callback;
            item.menuItemGrayed = false;
            Controller c = item.GetController("checked");
            if (c != null)
                c.selectedIndex = 0;

            return item;
        }
Пример #42
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="strType"></param>
        /// <param name="callback"></param>
        public void AddEventListener(string strType, EventCallback0 callback)
        {
            if (strType == null)
                throw new Exception("event type cant be null");

            if (_dic == null)
                _dic = new Dictionary<string, EventBridge>();

            EventBridge bridge = null;
            if (!_dic.TryGetValue(strType, out bridge))
            {
                bridge = new EventBridge(this);
                _dic[strType] = bridge;
            }
            bridge.Add(callback);
        }
Пример #43
0
 public HtmlLink()
 {
     shape = new Shape();
     _clickHandler = (EventContext context) =>
     {
         _owner.onClickLink.Call(_element.GetString("href"));
     };
     _rolloverHandler = (EventContext context) =>
     {
         context.CaptureTouch();
         if (_owner.htmlParseOptions.linkHoverBgColor.a > 0)
             shape.graphics.Tint(_owner.htmlParseOptions.linkHoverBgColor);
     };
     _rolloutHandler = () =>
     {
         if (_owner.htmlParseOptions.linkBgColor.a > 0)
             shape.graphics.Tint(_owner.htmlParseOptions.linkBgColor);
     };
 }
Пример #44
0
        public void Begin()
        {
            frameId++;
            if (frameId == 0)
                frameId = 1;
            counter = 0;
            renderingOrder = 0;
            batchingDepth = 0;
            rectMaskDepth = 0;
            stencilReferenceValue = 0;
            alpha = 1;
            grayed = false;

            clipped = false;
            _clipStack.Clear();

            if (OnBegin != null)
                OnBegin.Invoke();

            OnBegin = null;
        }
Пример #45
0
        public HtmlLink()
        {
            _shape = new SelectionShape();
            _shape.gameObject.name = "HtmlLink";

            _clickHandler = (EventContext context) =>
            {
                _owner.onClickLink.BubbleCall(_element.GetString("href"));
            };
            _rolloverHandler = (EventContext context) =>
            {
                context.CaptureTouch();
                if (_owner.htmlParseOptions.linkHoverBgColor.a > 0)
                    _shape.color = _owner.htmlParseOptions.linkHoverBgColor;
            };
            _rolloutHandler = () =>
            {
                if (_owner.htmlParseOptions.linkHoverBgColor.a > 0)
                    _shape.color = _owner.htmlParseOptions.linkBgColor;
            };
        }
Пример #46
0
        public DisplayObject()
        {
            _alpha = 1;
            _visible = true;
            _touchable = true;
            id = _gInstanceCounter++;
            _blendMode = BlendMode.Normal;
            _focalLength = 2000;
            _captureDelegate = Capture;

            onClick = new EventListener(this, "onClick");
            onRightClick = new EventListener(this, "onRightClick");
            onTouchBegin = new EventListener(this, "onTouchBegin");
            onTouchEnd = new EventListener(this, "onTouchEnd");
            onRollOver = new EventListener(this, "onRollOver");
            onRollOut = new EventListener(this, "onRollOut");
            onMouseWheel = new EventListener(this, "onMouseWheel");
            onAddedToStage = new EventListener(this, "onAddedToStage");
            onRemovedFromStage = new EventListener(this, "onRemovedFromStage");
            onKeyDown = new EventListener(this, "onKeyDown");
            onClickLink = new EventListener(this, "onClickLink");
        }
Пример #47
0
        /// <summary>
        /// 
        /// </summary>
        public void CreateUI()
        {
            if (_ui != null)
            {
                _ui.Dispose();
                _ui = null;
                DestroyTexture();
            }

            _created = true;

            if (string.IsNullOrEmpty(packageName) || string.IsNullOrEmpty(componentName))
                return;

            _ui = (GComponent)UIPackage.CreateObject(packageName, componentName);
            if (_ui != null)
            {
                this.container.AddChild(_ui.displayObject);
                ((MeshColliderHitTest)this.container.hitArea).SetArea(0, 0, _ui.width, _ui.height);
                this.container.size = _ui.size;
                _texture = CaptureCamera.CreateRenderTexture(Mathf.RoundToInt(_ui.width), Mathf.RoundToInt(_ui.height), false);
                _renderer = this.GetComponent<Renderer>();
                if (_renderer != null)
                {
                    _renderer.sharedMaterial.mainTexture = _texture;
                    _captureDelegate = Capture;
                    if (_renderer.sharedMaterial.renderQueue == 3000) //Set in transpare queue only
                    {
                        this.container.onUpdate = () =>
                        {
                            UpdateContext.OnEnd += _captureDelegate;
                        };
                    }
                }
            }
            else
                Debug.LogError("Create " + componentName + "@" + packageName + " failed!");
        }
Пример #48
0
        public void RemoveEventListener(string strType, EventCallback0 callback)
        {
            if (_dic == null)
                return;

            EventListener listener = null;
            if (_dic.TryGetValue(strType, out listener))
                listener.Remove(callback);
        }
Пример #49
0
		public TextField()
		{
			_optimizeNotTouchable = true;

			_textFormat = new TextFormat();
			_textFormat.size = 12;
			_textFormat.lineSpacing = 3;
			_strokeColor = new Color(0, 0, 0, 1);

			_wordWrap = true;
			_displayAsPassword = false;
			_maxLength = int.MaxValue;
			_text = string.Empty;

			_elements = new List<HtmlElement>(1);
			_lines = new List<LineInfo>(1);

			CreateGameObject("TextField");
			graphics = new NGraphics(gameObject);

			onFocusIn = new EventListener(this, "onFocusIn");
			onFocusOut = new EventListener(this, "onFocusOut");
			onChanged = new EventListener(this, "onChanged");

			_touchMoveDelegate = __touchMove;
			_onChangedDelegate = OnChanged;
		}
Пример #50
0
 public void Remove(EventCallback0 callback)
 {
     _callback0 -= callback;
 }
Пример #51
0
 public void Clear()
 {
     _callback1 = null;
     _callback0 = null;
     _captureCallback = null;
 }
Пример #52
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="strType"></param>
        /// <param name="callback"></param>
        public void RemoveEventListener(string strType, EventCallback0 callback)
        {
            if (_dic == null)
                return;

            EventBridge bridge = null;
            if (_dic.TryGetValue(strType, out bridge))
                bridge.Remove(callback);
        }
Пример #53
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="callback"></param>
        public void Add(EventCallback0 callback)
        {
            if (_bridge == null)
                _bridge = this.owner.GetEventBridge(_type);

            _bridge.Add(callback);
        }
Пример #54
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="callback"></param>
        public void Set(EventCallback0 callback)
        {
            if (_bridge == null)
                _bridge = this.owner.GetEventBridge(_type);

            _bridge.Clear();
            if (callback != null)
                _bridge.Add(callback);
        }
Пример #55
0
        /// <summary>
        /// 
        /// </summary>
        public void End()
        {
            working = false;

            if (OnEnd != null)
                OnEnd.Invoke();

            OnEnd = null;
        }
Пример #56
0
 public void Add(EventCallback0 callback)
 {
     _callback0 -= callback;
     _callback0 += callback;
 }
Пример #57
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);
        }