Пример #1
0
        public DisplayObject()
        {
            _alpha = 1;
            _x = 0;
            _y = 0;
            _visible = true;
            _scaleX = 1;
            _scaleY = 1;
            _rotation = 0;
            _touchable = true;
            internalIndex = _gInstanceCounter++;

            gameObject = new GameObject(this.GetType().Name);
            gameObject.layer = Stage.defaultLayer;
            gameObject.hideFlags = HideFlags.HideInHierarchy;
            cachedTransform = gameObject.transform;
            gameObject.SetActive(false);
            UnityEngine.Object.DontDestroyOnLoad(gameObject);

            onClick = new EventListener(this, "onClick");
            onRightClick = new EventListener(this, "onRightClick");
            onMouseDown = new EventListener(this, "onMouseDown");
            onMouseUp = new EventListener(this, "onMouseUp");
            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");
        }
Пример #2
0
        public GSlider()
        {
            _value = 50;
            _max = 100;

            onChanged = new EventListener(this, "onChanged");
        }
Пример #3
0
        public InputTextField()
        {
            gameObject.name = "InputTextField";

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

            maxLength = int.MaxValue;
            editable = true;

            /* 因为InputTextField定义了ClipRect,而ClipRect是四周缩进了2个像素的(GUTTER),默认的点击测试
             * 是使用ClipRect的,那会造成无法点击四周的空白区域。所以这里自定义了一个HitArea
             */
            this.hitArea = new RectHitTest();
            this.touchChildren = false;

            _touchMoveDelegate = __touchMove;

            onFocusIn.Add(__focusIn);
            onFocusOut.AddCapture(__focusOut);
            onKeyDown.AddCapture(__keydown);
            onTouchBegin.AddCapture(__touchBegin);
            onTouchEnd.AddCapture(__touchEnd);
        }
    static int RemoveCapture(IntPtr L)
    {
        try
        {
            ToLua.CheckArgsCount(L, 2);
            FairyGUI.EventListener  obj  = (FairyGUI.EventListener)ToLua.CheckObject(L, 1, typeof(FairyGUI.EventListener));
            FairyGUI.EventCallback1 arg0 = null;
            LuaTypes funcType2           = LuaDLL.lua_type(L, 2);

            if (funcType2 != LuaTypes.LUA_TFUNCTION)
            {
                arg0 = (FairyGUI.EventCallback1)ToLua.CheckObject(L, 2, typeof(FairyGUI.EventCallback1));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 2);
                arg0 = DelegateFactory.CreateDelegate(typeof(FairyGUI.EventCallback1), func) as FairyGUI.EventCallback1;
            }

            obj.RemoveCapture(arg0);
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
    static int BubbleCall(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(FairyGUI.EventListener)))
            {
                FairyGUI.EventListener obj = (FairyGUI.EventListener)ToLua.ToObject(L, 1);
                bool o = obj.BubbleCall();
                LuaDLL.lua_pushboolean(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(FairyGUI.EventListener), typeof(object)))
            {
                FairyGUI.EventListener obj = (FairyGUI.EventListener)ToLua.ToObject(L, 1);
                object arg0 = ToLua.ToVarObject(L, 2);
                bool   o    = obj.BubbleCall(arg0);
                LuaDLL.lua_pushboolean(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.EventListener.BubbleCall"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
 static public int BroadcastCall(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 1)
         {
             FairyGUI.EventListener self = (FairyGUI.EventListener)checkSelf(l);
             var ret = self.BroadcastCall();
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (argc == 2)
         {
             FairyGUI.EventListener self = (FairyGUI.EventListener)checkSelf(l);
             System.Object          a1;
             checkType(l, 2, out a1);
             var ret = self.BroadcastCall(a1);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
        public GTextField()
            : base()
        {
            _textFormat = new TextFormat();
            _textFormat.font = UIConfig.defaultFont;
            _textFormat.size = 12;
            _textFormat.color = Color.black;
            _textFormat.lineSpacing = 3;
            _textFormat.letterSpacing = 0;

            TextFormat tf = _textField.textFormat;
            tf.CopyFrom(_textFormat);
            _textField.textFormat = tf;

            _text = string.Empty;
            _autoSize = AutoSizeType.Both;
            _widthAutoSize = true;
            _heightAutoSize = true;
            _textField.autoSize = true;
            _textField.wordWrap = false;

            gearColor = new GearColor(this);

            onFocusIn = new EventListener(this, "onFocusIn");
            onFocusOut = new EventListener(this, "onFocusOut");
            onChanged = new EventListener(this, "onChanged");
        }
 static public int Remove(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (matchType(l, argc, 2, typeof(FairyGUI.EventCallback0)))
         {
             FairyGUI.EventListener  self = (FairyGUI.EventListener)checkSelf(l);
             FairyGUI.EventCallback0 a1;
             LuaDelegation.checkDelegate(l, 2, out a1);
             self.Remove(a1);
             pushValue(l, true);
             return(1);
         }
         else if (matchType(l, argc, 2, typeof(FairyGUI.EventCallback1)))
         {
             FairyGUI.EventListener  self = (FairyGUI.EventListener)checkSelf(l);
             FairyGUI.EventCallback1 a1;
             LuaDelegation.checkDelegate(l, 2, out a1);
             self.Remove(a1);
             pushValue(l, true);
             return(1);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #9
0
        public GMovieClip()
        {
            gearAnimation = new GearAnimation(this);
            gearColor = new GearColor(this);

            onPlayEnd = new EventListener(this, "onPlayEnd");
        }
Пример #10
0
    static int BroadcastCall(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1)
            {
                FairyGUI.EventListener obj = (FairyGUI.EventListener)ToLua.CheckObject <FairyGUI.EventListener>(L, 1);
                bool o = obj.BroadcastCall();
                LuaDLL.lua_pushboolean(L, o);
                return(1);
            }
            else if (count == 2)
            {
                FairyGUI.EventListener obj = (FairyGUI.EventListener)ToLua.CheckObject <FairyGUI.EventListener>(L, 1);
                object arg0 = ToLua.ToVarObject(L, 2);
                bool   o    = obj.BroadcastCall(arg0);
                LuaDLL.lua_pushboolean(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.EventListener.BroadcastCall"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
    static int Add(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes <FairyGUI.EventCallback0>(L, 2))
            {
                FairyGUI.EventListener  obj  = (FairyGUI.EventListener)ToLua.CheckObject <FairyGUI.EventListener>(L, 1);
                FairyGUI.EventCallback0 arg0 = (FairyGUI.EventCallback0)ToLua.ToObject(L, 2);
                obj.Add(arg0);
                return(0);
            }
            else if (count == 2 && TypeChecker.CheckTypes <FairyGUI.EventCallback1>(L, 2))
            {
                FairyGUI.EventListener  obj  = (FairyGUI.EventListener)ToLua.CheckObject <FairyGUI.EventListener>(L, 1);
                FairyGUI.EventCallback1 arg0 = (FairyGUI.EventCallback1)ToLua.ToObject(L, 2);
                obj.Add(arg0);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.EventListener.Add"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Пример #12
0
        public GTextField()
            : base()
        {
            underConstruct = true;

            _textFormat = new TextFormat();
            _textFormat.font = UIConfig.defaultFont;
            _textFormat.size = 12;
            _textFormat.color = Color.black;
            _textFormat.lineSpacing = 3;
            _textFormat.letterSpacing = 0;
            _strokeColor = new Color(0, 0, 0, 1);
            UpdateTextFormat();

            _text = string.Empty;
            _align = AlignType.Left;
            _verticalAlign = VertAlignType.Top;

            this.autoSize = AutoSizeType.Both;

            underConstruct = false;

            gearColor = new GearColor(this);

            onFocusIn = new EventListener(this, "onFocusIn");
            onFocusOut = new EventListener(this, "onFocusOut");
            onChanged = new EventListener(this, "onChanged");
        }
Пример #13
0
        public MovieClip()
        {
            playState = new PlayState();
            interval = 0.1f;
            _playing = true;

            onPlayEnd = new EventListener(this, "onPlayEnd");
        }
Пример #14
0
        public Stage()
            : base()
        {
            _inst = this;
            soundVolume = 1;

            _updateContext = new UpdateContext();
            stageWidth = Screen.width;
            stageHeight = Screen.height;
            _frameGotHitTarget = -1;

            touchScreen = Input.touchSupported;

            _touches = new TouchInfo[5];
            for (int i = 0; i < _touches.Length; i++)
                _touches[i] = new TouchInfo();

            if (!touchScreen)
                _touches[0].touchId = 0;

            _rollOutChain = new List<DisplayObject>();
            _rollOverChain = new List<DisplayObject>();

            onStageResized = new EventListener(this, "onStageResized");
            onTouchMove = new EventListener(this, "onTouchMove");
            onCopy = new EventListener(this, "onCopy");
            onPaste = new EventListener(this, "onPaste");

            StageEngine engine = GameObject.FindObjectOfType<StageEngine>();
            if (engine != null)
                this.gameObject = engine.gameObject;
            else
            {
                int layer = LayerMask.NameToLayer(StageCamera.LayerName);

                this.gameObject = new GameObject("Stage");
                this.gameObject.hideFlags = HideFlags.None;
                this.gameObject.layer = layer;
                this.gameObject.AddComponent<StageEngine>();
                this.gameObject.AddComponent<UIContentScaler>();
            }
            this.cachedTransform = gameObject.transform;
            this.cachedTransform.localScale = new Vector3(StageCamera.UnitsPerPixel, StageCamera.UnitsPerPixel, StageCamera.UnitsPerPixel);
            this.gameObject.SetActive(true);
            UnityEngine.Object.DontDestroyOnLoad(this.gameObject);

            EnableSound();

            inputCaret = new InputCaret();
            highlighter = new Highlighter();

            Timers.inst.Add(5, 0, RunTextureCollector);

            #if UNITY_WEBPLAYER || UNITY_WEBGL || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_EDITOR
            CopyPastePatch.Apply();
            #endif
        }
Пример #15
0
        public Controller()
        {
            _pageIds = new List<string>();
            _pageNames = new List<string>();
            _selectedIndex = -1;
            _previousIndex = -1;

            onChanged = new EventListener(this, "onChanged");
        }
Пример #16
0
        public GList()
            : base()
        {
            _pool = new GObjectPool();
            _trackBounds = true;
            autoResizeItem = true;

            onClickItem = new EventListener(this, "onClickItem");
        }
Пример #17
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");
        }
Пример #18
0
        public GComboBox()
        {
            visibleItemCount = UIConfig.defaultComboBoxVisibleItemCount;
            _itemsUpdated = true;
            _selectedIndex = -1;
            _items = new string[0];
            _values = new string[0];

            onChanged = new EventListener(this, "onChanged");
        }
Пример #19
0
        public GTextInput()
        {
            onFocusIn = new EventListener(this, "onFocusIn");
            onFocusOut = new EventListener(this, "onFocusOut");
            onChanged = new EventListener(this, "onChanged");

            this.focusable = true;
            _textField.autoSize = AutoSizeType.None;
            _textField.wordWrap = false;
        }
Пример #20
0
        public GComponent()
        {
            _children = new List<GObject>();
            _controllers = new List<Controller>();
            _transitions = new List<Transition>();
            _margin = new Margin();
            this.opaque = true;

            onScroll = new EventListener(this, "onScroll");
        }
Пример #21
0
        public GButton()
        {
            pageOption = new PageOption();

            sound = UIConfig.buttonSound;
            soundVolumeScale = UIConfig.buttonSoundVolumeScale;
            changeStateOnClick = true;

            onChanged = new EventListener(this, "onChanged");
        }
Пример #22
0
        public GSlider()
        {
            _value = 50;
            _max = 100;

            onChanged = new EventListener(this, "onChanged");
            onGripTouchEnd = new EventListener(this, "onGripTouchEnd");

            _touchMoveDelegate = __gripTouchMove;
        }
Пример #23
0
        public MovieClip()
        {
            playState = new PlayState();
            interval = 0.1f;
            _playing = true;

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

            SetPlaySettings();
        }
        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");
        }
    static int Set(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(FairyGUI.EventListener), typeof(FairyGUI.EventCallback1)))
            {
                FairyGUI.EventListener  obj  = (FairyGUI.EventListener)ToLua.ToObject(L, 1);
                FairyGUI.EventCallback1 arg0 = null;
                LuaTypes funcType2           = LuaDLL.lua_type(L, 2);

                if (funcType2 != LuaTypes.LUA_TFUNCTION)
                {
                    arg0 = (FairyGUI.EventCallback1)ToLua.ToObject(L, 2);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 2);
                    arg0 = DelegateFactory.CreateDelegate(typeof(FairyGUI.EventCallback1), func) as FairyGUI.EventCallback1;
                }

                obj.Set(arg0);
                return(0);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(FairyGUI.EventListener), typeof(FairyGUI.EventCallback0)))
            {
                FairyGUI.EventListener  obj  = (FairyGUI.EventListener)ToLua.ToObject(L, 1);
                FairyGUI.EventCallback0 arg0 = null;
                LuaTypes funcType2           = LuaDLL.lua_type(L, 2);

                if (funcType2 != LuaTypes.LUA_TFUNCTION)
                {
                    arg0 = (FairyGUI.EventCallback0)ToLua.ToObject(L, 2);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 2);
                    arg0 = DelegateFactory.CreateDelegate(typeof(FairyGUI.EventCallback0), func) as FairyGUI.EventCallback0;
                }

                obj.Set(arg0);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.EventListener.Set"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Пример #26
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");
        }
        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");
        }
Пример #28
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");
        }
Пример #29
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");
        }
 static public int get_isDispatching(IntPtr l)
 {
     try {
         FairyGUI.EventListener self = (FairyGUI.EventListener)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.isDispatching);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int Clear(IntPtr l)
 {
     try {
         FairyGUI.EventListener self = (FairyGUI.EventListener)checkSelf(l);
         self.Clear();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #32
0
        public void AddEventListener(string strType, EventCallback1 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);
        }
Пример #33
0
 static int Clear(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         FairyGUI.EventListener obj = (FairyGUI.EventListener)ToLua.CheckObject <FairyGUI.EventListener>(L, 1);
         obj.Clear();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static public int RemoveCapture(IntPtr l)
 {
     try {
         FairyGUI.EventListener  self = (FairyGUI.EventListener)checkSelf(l);
         FairyGUI.EventCallback1 a1;
         LuaDelegation.checkDelegate(l, 2, out a1);
         self.RemoveCapture(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #35
0
 static int RemoveCapture(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         FairyGUI.EventListener  obj  = (FairyGUI.EventListener)ToLua.CheckObject <FairyGUI.EventListener>(L, 1);
         FairyGUI.EventCallback1 arg0 = (FairyGUI.EventCallback1)ToLua.CheckDelegate <FairyGUI.EventCallback1>(L, 2);
         obj.RemoveCapture(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Пример #36
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="list"></param>
        public TreeView(GList list)
        {
            this.list = list;
            list.onClickItem.Add(__clickItem);
            list.RemoveChildrenToPool();

            root = new TreeNode(true);
            root.SetTree(this);
            root.cell = list;
            root.expanded = true;

            indent = 30;

            onClickNode = new EventListener(this, "onClickNode");
        }
    static int get_onPullUpRelease(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.ScrollPane    obj = (FairyGUI.ScrollPane)o;
            FairyGUI.EventListener ret = obj.onPullUpRelease;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index onPullUpRelease on a nil value" : e.Message));
        }
    }
    static int get_onGripTouchEnd(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.GSlider       obj = (FairyGUI.GSlider)o;
            FairyGUI.EventListener ret = obj.onGripTouchEnd;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index onGripTouchEnd on a nil value"));
        }
    }
    static int get_onChanged(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.GButton       obj = (FairyGUI.GButton)o;
            FairyGUI.EventListener ret = obj.onChanged;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index onChanged on a nil value" : e.Message));
        }
    }
Пример #40
0
    static int get_onFocusIn(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.GTextInput    obj = (FairyGUI.GTextInput)o;
            FairyGUI.EventListener ret = obj.onFocusIn;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index onFocusIn on a nil value"));
        }
    }
Пример #41
0
    static int get_onAction(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.LongPressGesture obj = (FairyGUI.LongPressGesture)o;
            FairyGUI.EventListener    ret = obj.onAction;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index onAction on a nil value"));
        }
    }
Пример #42
0
    static int get_type(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.EventListener obj = (FairyGUI.EventListener)o;
            string ret = obj.type;
            LuaDLL.lua_pushstring(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index type on a nil value"));
        }
    }
Пример #43
0
    static int get_isDispatching(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.EventListener obj = (FairyGUI.EventListener)o;
            bool ret = obj.isDispatching;
            LuaDLL.lua_pushboolean(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index isDispatching on a nil value"));
        }
    }
 static public int constructor(IntPtr l)
 {
     try {
         FairyGUI.EventListener   o;
         FairyGUI.EventDispatcher a1;
         checkType(l, 2, out a1);
         System.String a2;
         checkType(l, 3, out a2);
         o = new FairyGUI.EventListener(a1, a2);
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #45
0
    static int get_onClose(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.PopupMenu     obj = (FairyGUI.PopupMenu)o;
            FairyGUI.EventListener ret = obj.onClose;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index onClose on a nil value"));
        }
    }
Пример #46
0
        public GRoot()
        {
            inst = this;

            this.name = "GRoot";
            this.rootContainer.gameObject.name = "GRoot";
            nativeStage = Stage.inst;

            if (RichTextField.objectFactory == null)
                RichTextField.objectFactory = new RichTextObjectFactory();

            _popupStack = new List<GObject>();
            _justClosedPopups = new List<GObject>();

            onFocusChanged = new EventListener(this, "onFocusChanged");

            displayObject.onAddedToStage.Add(__addedToStage);
        }
Пример #47
0
        public GObject()
        {
            _width = 0;
            _height = 0;
            _alpha = 1;
            _rotation = 0;
            _visible = true;
            _touchable = true;
            _scaleX = 1;
            _scaleY = 1;
            _internalVisible = 1;
            id = "_n" + _gInstanceCounter++;
            name = string.Empty;

            CreateDisplayObject();

            relations = new Relations(this);

            gearDisplay = new GearDisplay(this);
            gearXY = new GearXY(this);
            gearSize = new GearSize(this);
            gearLook = new GearLook(this);

            onClick = new EventListener(this, "onClick");
            onRightClick = new EventListener(this, "onRightClick");
            onMouseDown = new EventListener(this, "onMouseDown");
            onMouseUp = new EventListener(this, "onMouseUp");
            onRollOver = new EventListener(this, "onRollOver");
            onRollOut = new EventListener(this, "onRollOut");
            onAddedToStage = new EventListener(this, "onAddedToStage");
            onRemovedFromStage = new EventListener(this, "onRemovedFromStage");
            onKeyDown = new EventListener(this, "onKeyDown");
            onClickLink = new EventListener(this, "onClickLink");

            onXYChanged = new EventListener(this, "onXYChanged");
            onSizeChanged = new EventListener(this, "onSizeChanged");
            onDragStart = new EventListener(this, "onDragStart");
            onDragEnd = new EventListener(this, "onDragEnd");
        }
Пример #48
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");
        }
Пример #49
0
    static int Add(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2)
            {
                FairyGUI.EventListener  obj  = (FairyGUI.EventListener)ToLua.CheckObject <FairyGUI.EventListener>(L, 1);
                FairyGUI.EventCallback1 arg0 = (FairyGUI.EventCallback1)ToLua.CheckDelegate <FairyGUI.EventCallback1>(L, 2);
                obj.Add(arg0);
                return(0);
            }
            else if (count == 3 && TypeChecker.CheckTypes <LuaInterface.LuaTable>(L, 3))
            {
                FairyGUI.EventListener obj  = (FairyGUI.EventListener)ToLua.CheckObject <FairyGUI.EventListener>(L, 1);
                LuaFunction            arg0 = ToLua.CheckLuaFunction(L, 2);
                LuaTable arg1 = ToLua.ToLuaTable(L, 3);
                obj.Add(arg0, arg1);
                return(0);
            }
            else if (count == 3 && TypeChecker.CheckTypes <FairyGUI.GComponent>(L, 3))
            {
                FairyGUI.EventListener obj  = (FairyGUI.EventListener)ToLua.CheckObject <FairyGUI.EventListener>(L, 1);
                LuaFunction            arg0 = ToLua.CheckLuaFunction(L, 2);
                FairyGUI.GComponent    arg1 = (FairyGUI.GComponent)ToLua.ToObject(L, 3);
                obj.Add(arg0, arg1);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.EventListener.Add"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Пример #50
0
        public TextField()
        {
            _textFormat = new TextFormat();
            _textFormat.size = 12;
            _textFormat.lineSpacing = 3;
            _fontScale = 1;
            _strokeColor = new Color(0, 0, 0, 1);

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

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

            quadBatch = new QuadBatch(gameObject);

            onFocusIn = new EventListener(this, "onFocusIn");
            onFocusOut = new EventListener(this, "onFocusOut");
            onChanged = new EventListener(this, "onChanged");
        }
Пример #51
0
    static int _CreateFairyGUI_EventListener(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2)
            {
                FairyGUI.EventDispatcher arg0 = (FairyGUI.EventDispatcher)ToLua.CheckObject <FairyGUI.EventDispatcher>(L, 1);
                string arg1 = ToLua.CheckString(L, 2);
                FairyGUI.EventListener obj = new FairyGUI.EventListener(arg0, arg1);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: FairyGUI.EventListener.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Пример #52
0
        public GMovieClip()
        {
            _sizeImplType = 1;

            onPlayEnd = new EventListener(this, "onPlayEnd");
        }
Пример #53
0
        public Stage()
            : base()
        {
            _inst       = this;
            soundVolume = 1;

            _updateContext     = new UpdateContext();
            stageWidth         = Screen.width;
            stageHeight        = Screen.height;
            _frameGotHitTarget = -1;

            if (Application.platform == RuntimePlatform.WindowsPlayer ||
                Application.platform == RuntimePlatform.WindowsPlayer ||
                Application.platform == RuntimePlatform.OSXPlayer ||
                Application.platform == RuntimePlatform.OSXEditor)
            {
                touchScreen = false;
            }
            else
            {
                touchScreen = Input.touchSupported;
            }

            _touches = new TouchInfo[5];
            for (int i = 0; i < _touches.Length; i++)
            {
                _touches[i] = new TouchInfo();
            }

            if (!touchScreen)
            {
                _touches[0].touchId = 0;
            }

            _rollOutChain  = new List <DisplayObject>();
            _rollOverChain = new List <DisplayObject>();

            onStageResized = new EventListener(this, "onStageResized");
            onTouchMove    = new EventListener(this, "onTouchMove");

            StageEngine engine = GameObject.FindObjectOfType <StageEngine>();

            if (engine != null)
            {
                this.gameObject = engine.gameObject;
            }
            else
            {
                int layer = LayerMask.NameToLayer(StageCamera.LayerName);

                this.gameObject           = new GameObject("Stage");
                this.gameObject.hideFlags = HideFlags.None;
                this.gameObject.layer     = layer;
                this.gameObject.AddComponent <StageEngine>();
                this.gameObject.AddComponent <UIContentScaler>();
            }
            this.cachedTransform            = gameObject.transform;
            this.cachedTransform.localScale = new Vector3(StageCamera.UnitsPerPixel, StageCamera.UnitsPerPixel, StageCamera.UnitsPerPixel);
            this.gameObject.SetActive(true);
            UnityEngine.Object.DontDestroyOnLoad(this.gameObject);

            EnableSound();

            if (touchScreen)
            {
#if !(UNITY_WEBPLAYER || UNITY_WEBGL || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_EDITOR)
                _keyboard     = new FairyGUI.TouchScreenKeyboard();
                keyboardInput = true;
#endif
            }

            Timers.inst.Add(5, 0, RunTextureCollector);

#if UNITY_5_4_OR_NEWER
            SceneManager.sceneLoaded += SceneManager_sceneLoaded;
#endif
            _focusRemovedDelegate = OnFocusRemoved;
        }
Пример #54
0
        public Stage()
            : base()
        {
            _inst       = this;
            soundVolume = 1;

            _updateContext     = new UpdateContext();
            stageWidth         = Screen.width;
            stageHeight        = Screen.height;
            _frameGotHitTarget = -1;

            touchScreen = Input.touchSupported;

            _touches = new TouchInfo[5];
            for (int i = 0; i < _touches.Length; i++)
            {
                _touches[i] = new TouchInfo();
            }

            if (!touchScreen)
            {
                _touches[0].touchId = 0;
            }

            _rollOutChain  = new List <DisplayObject>();
            _rollOverChain = new List <DisplayObject>();

            onStageResized = new EventListener(this, "onStageResized");
            onTouchMove    = new EventListener(this, "onTouchMove");
            onCopy         = new EventListener(this, "onCopy");
            onPaste        = new EventListener(this, "onPaste");

            StageEngine engine = GameObject.FindObjectOfType <StageEngine>();

            if (engine != null)
            {
                this.gameObject = engine.gameObject;
            }
            else
            {
                int layer = LayerMask.NameToLayer(StageCamera.LayerName);

                this.gameObject           = new GameObject("Stage");
                this.gameObject.hideFlags = HideFlags.None;
                this.gameObject.layer     = layer;
                this.gameObject.AddComponent <StageEngine>();
                this.gameObject.AddComponent <UIContentScaler>();
            }
            this.cachedTransform            = gameObject.transform;
            this.cachedTransform.localScale = new Vector3(StageCamera.UnitsPerPixel, StageCamera.UnitsPerPixel, StageCamera.UnitsPerPixel);
            this.gameObject.SetActive(true);
            UnityEngine.Object.DontDestroyOnLoad(this.gameObject);

            EnableSound();

            inputCaret  = new InputCaret();
            highlighter = new Highlighter();

            Timers.inst.Add(5, 0, RunTextureCollector);

#if UNITY_WEBPLAYER || UNITY_WEBGL || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_EDITOR
            CopyPastePatch.Apply();
#endif
        }
Пример #55
0
        public GObject()
        {
            _width = 0;
            _height = 0;
            _alpha = 1;
            _visible = true;
            _touchable = true;
            _scaleX = 1;
            _scaleY = 1;
            _internalVisible = 1;
            id = "_n" + _gInstanceCounter++;
            name = string.Empty;

            CreateDisplayObject();

            relations = new Relations(this);
            _gears = new GearBase[8];

            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");
            onAddedToStage = new EventListener(this, "onAddedToStage");
            onRemovedFromStage = new EventListener(this, "onRemovedFromStage");
            onKeyDown = new EventListener(this, "onKeyDown");
            onClickLink = new EventListener(this, "onClickLink");

            onPositionChanged = new EventListener(this, "onPositionChanged");
            onSizeChanged = new EventListener(this, "onSizeChanged");
            onDragStart = new EventListener(this, "onDragStart");
            onDragMove = new EventListener(this, "onDragMove");
            onDragEnd = new EventListener(this, "onDragEnd");

            OnGearStop = new EventListener(this, "OnGearStop");
        }
Пример #56
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;
		}