Inheritance: GObject
示例#1
0
 void CreateModalLayer()
 {
     _modalLayer = new GGraph();
     _modalLayer.DrawRect(this.width, this.height, 0, Color.White, UIConfig.modalLayerColor);
     _modalLayer.AddRelation(this, RelationType.Size);
     _modalLayer.name = "ModalLayer";
 }
示例#2
0
    public RenderImage(GGraph holder)
    {
        _width = (int)holder.width;
        _height = (int)holder.height;
        _cacheTexture = true;

        this._image = new Image();
        holder.SetNativeObject(this._image);

        if (_camera == null)
            CreateCamera();

        this._root = new GameObject("render_image" + _gid++).transform;
        Object.DontDestroyOnLoad(this._root.gameObject);
        this._root.SetParent(_camera.transform, false);
        SetLayer(this._root.gameObject, HIDDEN_LAYER);

        this.modelRoot = new GameObject("model_root").transform;
        Object.DontDestroyOnLoad(this.modelRoot.gameObject);
        this.modelRoot.SetParent(this._root, false);

        this._background = new GameObject("background").transform;
        Object.DontDestroyOnLoad(this._background.gameObject);
        this._background.SetParent(this._root, false);

        this._image.onAddedToStage.Add(OnAddedToStage);
        this._image.onRemovedFromStage.Add(OnRemoveFromStage);

        if (this._image.stage != null)
            OnAddedToStage();
    }
示例#3
0
    public RenderImage(GGraph holder)
    {
        _width = (int)holder.width;
        _height = (int)holder.height;
        _cacheTexture = true;

        this._image = new Image();
        holder.SetNativeObject(this._image);

        Object prefab = Resources.Load("RenderTexture/RenderImageCamera");
        GameObject go = (GameObject)Object.Instantiate(prefab);
        _camera = go.GetComponent<Camera>();
        _camera.transform.position = new Vector3(0, 1000, 0);
        _camera.cullingMask = 1 << RENDER_LAYER;
        _camera.enabled = false;
        Object.DontDestroyOnLoad(_camera.gameObject);

        this._root = new GameObject("RenderImage").transform;
        this._root.SetParent(_camera.transform, false);
        SetLayer(this._root.gameObject, HIDDEN_LAYER);

        this.modelRoot = new GameObject("model_root").transform;
        this.modelRoot.SetParent(this._root, false);

        this._background = new GameObject("background").transform;
        this._background.SetParent(this._root, false);

        this._image.onAddedToStage.Add(OnAddedToStage);
        this._image.onRemovedFromStage.Add(OnRemoveFromStage);

        if (this._image.stage != null)
            OnAddedToStage();
        else
            _camera.gameObject.SetActive(false);
    }
示例#4
0
        public GGraph CreateModalLayer()
        {
            var modal = new GGraph();

            modal.DrawRect(this.width, this.height, 0, Color.white, UIConfig.modalLayerColor);
            modal.AddRelation(this, RelationType.Size);
            modal.name = modal.gameObjectName = "ModalLayer";
            modal.SetHome(this);
            return(modal);
        }
示例#5
0
        private void AdjustModalLayer()
        {
            if (_modalLayer == null)
            {
                _modalLayer = new GGraph();
                _modalLayer.DrawRect(this.width, this.height, 0, Color.white, UIConfig.modalLayerColor);
                _modalLayer.AddRelation(this, RelationType.Size);
            }

            int  cnt             = this.numChildren;
            bool modalLayerIsTop = false;

            if (_modalWaitPane != null && _modalWaitPane.parent != null)
            {
                SetChildIndex(_modalWaitPane, cnt - 1);
            }

            for (int i = cnt - 1; i >= 0; i--)
            {
                GObject g = this.GetChildAt(i);
                if (g == _modalLayer)
                {
                    modalLayerIsTop = true;
                }
                else if ((g is Window) && (g as Window).modal)
                {
                    if (_modalLayer.parent == null)
                    {
                        AddChildAt(_modalLayer, i);
                    }
                    else if (i > 0)
                    {
                        if (modalLayerIsTop)
                        {
                            SetChildIndex(_modalLayer, i);
                        }
                        else
                        {
                            SetChildIndex(_modalLayer, i - 1);
                        }
                    }
                    else
                    {
                        AddChildAt(_modalLayer, 0);
                    }
                    return;
                }
            }

            if (_modalLayer.parent != null)
            {
                RemoveChild(_modalLayer);
            }
        }
 static public int get_shape(IntPtr l)
 {
     try {
         FairyGUI.GGraph self = (FairyGUI.GGraph)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.shape);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#7
0
        void __addedToStage()
        {
            nativeStage.onStageResized.Add(__winResize);
            nativeStage.onMouseDown.AddCapture(__stageMouseDown);

            __winResize();

            _modalLayer = new GGraph();
            _modalLayer.DrawRect(this.width, this.height, 0, Color.white, UIConfig.modalLayerColor);
            _modalLayer.shape.name = "test";
            _modalLayer.AddRelation(this, RelationType.Size);
        }
 static public int constructor(IntPtr l)
 {
     try {
         FairyGUI.GGraph o;
         o = new FairyGUI.GGraph();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int SetNativeObject(IntPtr l)
 {
     try {
         FairyGUI.GGraph        self = (FairyGUI.GGraph)checkSelf(l);
         FairyGUI.DisplayObject a1;
         checkType(l, 2, out a1);
         self.SetNativeObject(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int AddAfterMe(IntPtr l)
 {
     try {
         FairyGUI.GGraph  self = (FairyGUI.GGraph)checkSelf(l);
         FairyGUI.GObject a1;
         checkType(l, 2, out a1);
         self.AddAfterMe(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int Setup_BeforeAdd(IntPtr l)
 {
     try {
         FairyGUI.GGraph    self = (FairyGUI.GGraph)checkSelf(l);
         FairyGUI.Utils.XML a1;
         checkType(l, 2, out a1);
         self.Setup_BeforeAdd(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#12
0
 static int AddBeforeMe(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         FairyGUI.GGraph  obj  = (FairyGUI.GGraph)ToLua.CheckObject(L, 1, typeof(FairyGUI.GGraph));
         FairyGUI.GObject arg0 = (FairyGUI.GObject)ToLua.CheckObject(L, 2, typeof(FairyGUI.GObject));
         obj.AddBeforeMe(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#13
0
 static int SetNativeObject(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         FairyGUI.GGraph        obj  = (FairyGUI.GGraph)ToLua.CheckObject <FairyGUI.GGraph>(L, 1);
         FairyGUI.DisplayObject arg0 = (FairyGUI.DisplayObject)ToLua.CheckObject <FairyGUI.DisplayObject>(L, 2);
         obj.SetNativeObject(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#14
0
 static int Setup_BeforeAdd(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         FairyGUI.GGraph    obj  = (FairyGUI.GGraph)ToLua.CheckObject(L, 1, typeof(FairyGUI.GGraph));
         FairyGUI.Utils.XML arg0 = (FairyGUI.Utils.XML)ToLua.CheckObject(L, 2, typeof(FairyGUI.Utils.XML));
         obj.Setup_BeforeAdd(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#15
0
 static int AddAfterMe(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         FairyGUI.GGraph  obj  = (FairyGUI.GGraph)ToLua.CheckObject <FairyGUI.GGraph>(L, 1);
         FairyGUI.GObject arg0 = (FairyGUI.GObject)ToLua.CheckObject <FairyGUI.GObject>(L, 2);
         obj.AddAfterMe(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#16
0
 static int Setup_BeforeAdd(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         FairyGUI.GGraph           obj  = (FairyGUI.GGraph)ToLua.CheckObject <FairyGUI.GGraph>(L, 1);
         FairyGUI.Utils.ByteBuffer arg0 = (FairyGUI.Utils.ByteBuffer)ToLua.CheckObject <FairyGUI.Utils.ByteBuffer>(L, 2);
         int arg1 = (int)LuaDLL.luaL_checknumber(L, 3);
         obj.Setup_BeforeAdd(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
    static int get_modalLayer(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.GRoot  obj = (FairyGUI.GRoot)o;
            FairyGUI.GGraph ret = obj.modalLayer;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index modalLayer on a nil value"));
        }
    }
示例#18
0
    static int get_color(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.GGraph   obj = (FairyGUI.GGraph)o;
            UnityEngine.Color ret = obj.color;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index color on a nil value"));
        }
    }
示例#19
0
    static int set_color(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.GGraph   obj  = (FairyGUI.GGraph)o;
            UnityEngine.Color arg0 = ToLua.ToColor(L, 2);
            obj.color = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index color on a nil value"));
        }
    }
示例#20
0
    static int get_shape(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.GGraph obj = (FairyGUI.GGraph)o;
            FairyGUI.Shape  ret = obj.shape;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index shape on a nil value"));
        }
    }
示例#21
0
 static int DrawEllipse(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 4);
         FairyGUI.GGraph   obj  = (FairyGUI.GGraph)ToLua.CheckObject <FairyGUI.GGraph>(L, 1);
         float             arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
         float             arg1 = (float)LuaDLL.luaL_checknumber(L, 3);
         UnityEngine.Color arg2 = ToLua.ToColor(L, 4);
         obj.DrawEllipse(arg0, arg1, arg2);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static public int DrawEllipse(IntPtr l)
 {
     try {
         FairyGUI.GGraph self = (FairyGUI.GGraph)checkSelf(l);
         System.Single   a1;
         checkType(l, 2, out a1);
         System.Single a2;
         checkType(l, 3, out a2);
         UnityEngine.Color a3;
         checkType(l, 4, out a3);
         self.DrawEllipse(a1, a2, a3);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#23
0
 static int DrawPolygon(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 5);
         FairyGUI.GGraph       obj  = (FairyGUI.GGraph)ToLua.CheckObject <FairyGUI.GGraph>(L, 1);
         float                 arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
         float                 arg1 = (float)LuaDLL.luaL_checknumber(L, 3);
         UnityEngine.Vector2[] arg2 = ToLua.CheckStructArray <UnityEngine.Vector2>(L, 4);
         UnityEngine.Color     arg3 = ToLua.ToColor(L, 5);
         obj.DrawPolygon(arg0, arg1, arg2, arg3);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
    private void PlayDepth()
    {
        GComponent obj = _demoObjects["Depth"];
        GComponent testContainer = obj.GetChild("n22").asCom;
        GObject fixedObj = testContainer.GetChild("n0");
        fixedObj.sortingOrder = 100;
        fixedObj.draggable = true;

        int numChildren = testContainer.numChildren;
        int i = 0;
        while (i < numChildren)
        {
            GObject child = testContainer.GetChildAt(i);
            if (child != fixedObj)
            {
                testContainer.RemoveChildAt(i);
                numChildren--;
            }
            else
                i++;
        }
        startPos = new Vector2(fixedObj.x, fixedObj.y);

        obj.GetChild("btn0").onClick.Add(() =>
        {
            GGraph graph = new GGraph();
            startPos.x += 10;
            startPos.y += 10;
            graph.xy = startPos;
            graph.DrawRect(150, 150, 1, Color.black, Color.red);
            obj.GetChild("n22").asCom.AddChild(graph);
        });

        obj.GetChild("btn1").onClick.Add(() =>
        {
            GGraph graph = new GGraph();
            startPos.x += 10;
            startPos.y += 10;
            graph.xy = startPos;
            graph.DrawRect(150, 150, 1, Color.black, Color.green);
            graph.sortingOrder = 200;
            obj.GetChild("n22").asCom.AddChild(graph);
        });
    }
示例#25
0
 static int DrawRect(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 6);
         FairyGUI.GGraph   obj  = (FairyGUI.GGraph)ToLua.CheckObject(L, 1, typeof(FairyGUI.GGraph));
         float             arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
         float             arg1 = (float)LuaDLL.luaL_checknumber(L, 3);
         int               arg2 = (int)LuaDLL.luaL_checknumber(L, 4);
         UnityEngine.Color arg3 = ToLua.ToColor(L, 5);
         UnityEngine.Color arg4 = ToLua.ToColor(L, 6);
         obj.DrawRect(arg0, arg1, arg2, arg3, arg4);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#26
0
        private void AdjustModalLayer()
        {
            if (_modalLayer == null)
            {
                _modalLayer = new GGraph();
                _modalLayer.DrawRect(this.width, this.height, 0, Color.white, UIConfig.modalLayerColor);
                _modalLayer.AddRelation(this, RelationType.Size);
                _modalLayer.gameObjectName = "ModalLayer";
                _modalLayer.SetHome(this);
            }

            int cnt = this.numChildren;

            if (_modalWaitPane != null && _modalWaitPane.parent != null)
            {
                SetChildIndex(_modalWaitPane, cnt - 1);
            }

            for (int i = cnt - 1; i >= 0; i--)
            {
                GObject g = this.GetChildAt(i);
                if ((g is Window) && (g as Window).modal)
                {
                    if (_modalLayer.parent == null)
                    {
                        AddChildAt(_modalLayer, i);
                    }
                    else
                    {
                        SetChildIndexBefore(_modalLayer, i);
                    }
                    return;
                }
            }

            if (_modalLayer.parent != null)
            {
                RemoveChild(_modalLayer);
            }
        }
示例#27
0
    static int _CreateFairyGUI_GGraph(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                FairyGUI.GGraph obj = new FairyGUI.GGraph();
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: FairyGUI.GGraph.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
示例#28
0
    static int DrawPolygon(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 5)
            {
                FairyGUI.GGraph obj  = (FairyGUI.GGraph)ToLua.CheckObject <FairyGUI.GGraph>(L, 1);
                float           arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
                float           arg1 = (float)LuaDLL.luaL_checknumber(L, 3);
                System.Collections.Generic.IList <UnityEngine.Vector2> arg2 = (System.Collections.Generic.IList <UnityEngine.Vector2>)ToLua.CheckObject <System.Collections.Generic.IList <UnityEngine.Vector2> >(L, 4);
                UnityEngine.Color arg3 = ToLua.ToColor(L, 5);
                obj.DrawPolygon(arg0, arg1, arg2, arg3);
                return(0);
            }
            else if (count == 7)
            {
                FairyGUI.GGraph obj  = (FairyGUI.GGraph)ToLua.CheckObject <FairyGUI.GGraph>(L, 1);
                float           arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
                float           arg1 = (float)LuaDLL.luaL_checknumber(L, 3);
                System.Collections.Generic.IList <UnityEngine.Vector2> arg2 = (System.Collections.Generic.IList <UnityEngine.Vector2>)ToLua.CheckObject <System.Collections.Generic.IList <UnityEngine.Vector2> >(L, 4);
                UnityEngine.Color arg3 = ToLua.ToColor(L, 5);
                float             arg4 = (float)LuaDLL.luaL_checknumber(L, 6);
                UnityEngine.Color arg5 = ToLua.ToColor(L, 7);
                obj.DrawPolygon(arg0, arg1, arg2, arg3, arg4, arg5);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.GGraph.DrawPolygon"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
示例#29
0
        void __addedToStage()
        {
            nativeStage.onStageResized.Add(__winResize);
            nativeStage.onMouseDown.AddCapture(__stageMouseDown);

            __winResize();

            _modalLayer = new GGraph();
            _modalLayer.DrawRect(this.width, this.height, 0, Color.white, UIConfig.modalLayerColor);
            _modalLayer.shape.name = "test";
            _modalLayer.AddRelation(this, RelationType.Size);
        }
示例#30
0
 public GGraphSub(UIBase uiBase, FairyGUI.GObject o)
 {
     this.uiBase  = uiBase;
     this.gObject = o.asGraph;
 }
示例#31
0
        private void AdjustModalLayer()
        {
            if (_modalLayer == null)
            {
                _modalLayer = new GGraph();
                _modalLayer.DrawRect(this.width, this.height, 0, Color.white, UIConfig.modalLayerColor);
                _modalLayer.AddRelation(this, RelationType.Size);
                _modalLayer.gameObjectName = "ModalLayer";
                _modalLayer.SetHome(this);
            }

            int cnt = this.numChildren;

            if (_modalWaitPane != null && _modalWaitPane.parent != null)
                SetChildIndex(_modalWaitPane, cnt - 1);

            for (int i = cnt - 1; i >= 0; i--)
            {
                GObject g = this.GetChildAt(i);
                if ((g is Window) && (g as Window).modal)
                {
                    if (_modalLayer.parent == null)
                        AddChildAt(_modalLayer, i);
                    else
                        SetChildIndexBefore(_modalLayer, i);
                    return;
                }
            }

            if (_modalLayer.parent != null)
                RemoveChild(_modalLayer);
        }
示例#32
0
文件: GRoot.cs 项目: yinlei/Fishing
        private void AdjustModalLayer()
        {
            if (_modalLayer == null)
            {
                _modalLayer = new GGraph();
                _modalLayer.DrawRect(this.width, this.height, 0, Color.white, UIConfig.modalLayerColor);
                _modalLayer.AddRelation(this, RelationType.Size);
            }

            int cnt = this.numChildren;
            bool modalLayerIsTop = false;

            if (_modalWaitPane != null && _modalWaitPane.parent != null)
                SetChildIndex(_modalWaitPane, cnt - 1);

            for (int i = cnt - 1; i >= 0; i--)
            {
                GObject g = this.GetChildAt(i);
                if (g == _modalLayer)
                    modalLayerIsTop = true;
                else if ((g is Window) && (g as Window).modal)
                {
                    if (_modalLayer.parent == null)
                        AddChildAt(_modalLayer, i);
                    else if (i > 0)
                    {
                        if (modalLayerIsTop)
                            SetChildIndex(_modalLayer, i);
                        else
                            SetChildIndex(_modalLayer, i - 1);
                    }
                    else
                        AddChildAt(_modalLayer, 0);
                    return;
                }
            }

            if (_modalLayer.parent != null)
                RemoveChild(_modalLayer);
        }
        public static void UpdateSimulateTouch()
        {
            if (simulateTouchPoint == null)
            {
                GGraph holder = new GGraph();
                holder.SetSize(10, 10);
                holder.DrawEllipse(10, 10, Color.yellow);
                simulateTouchPoint          = GRoot._inst.AddChild(holder);
                simulateTouchPoint.position = new Vector2(Screen.width / 2f, Screen.height / 2f);
                simulateTouchPoint.visible  = simulateOn;
            }

            bool moved = false;

            if (Input.GetKey("w"))
            {
                simulateTouchPoint.position = simulateTouchPoint.position + Vector3.down * simulateTouchPointSpeed;
                moved = true;
            }

            if (Input.GetKey("s"))
            {
                simulateTouchPoint.position = simulateTouchPoint.position + Vector3.up * simulateTouchPointSpeed;
                moved = true;
            }

            if (Input.GetKey("a"))
            {
                simulateTouchPoint.position = simulateTouchPoint.position + Vector3.left * simulateTouchPointSpeed;
                moved = true;
            }

            if (Input.GetKey("d"))
            {
                simulateTouchPoint.position = simulateTouchPoint.position + Vector3.right * simulateTouchPointSpeed;
                moved = true;
            }

            if (moved && Input.GetKey("z"))
            {
                Stage.inst.onTouchMove.BubbleCall(new InputEvent()
                {
                    touchId = simulateTouchPointId, x = simulateTouchPoint.position.x, y = simulateTouchPoint.position.y
                });
            }


            if (Input.GetKeyDown("z"))
            {
                Stage.inst.AddTouchCount(1);
                Stage.inst.onTouchBegin.BubbleCall(new InputEvent()
                {
                    touchId = simulateTouchPointId, x = simulateTouchPoint.position.x, y = simulateTouchPoint.position.y
                });
            }

            if (Input.GetKeyUp("z"))
            {
                Stage.inst.AddTouchCount(-1);
                Stage.inst.onTouchEnd.BubbleCall(new InputEvent()
                {
                    touchId = simulateTouchPointId, x = simulateTouchPoint.position.x, y = simulateTouchPoint.position.y
                });
            }
        }