Component
Наследование: GObject
Пример #1
0
    void Start()
    {
        Application.targetFrameRate = 60;
        GRoot.inst.SetContentScaleFactor(1136, 640);
        Stage.inst.onKeyDown.Add(OnKeyDown);

        UIPackage.AddPackage("UI/Emoji");

        UIConfig.verticalScrollBar = UIPackage.GetItemURL("Emoji", "ScrollBar_VT");
        UIConfig.defaultScrollBarDisplay = ScrollBarDisplayType.Auto;

        _mainView = UIPackage.CreateObject("Emoji", "Main").asCom;
        _mainView.fairyBatching = true;
        _mainView.SetSize(GRoot.inst.width, GRoot.inst.height);
        _mainView.AddRelation(GRoot.inst, RelationType.Size);
        GRoot.inst.AddChild(_mainView);

        _list = _mainView.GetChild("list").asList;
        _list.RemoveChildrenToPool();
        _input = _mainView.GetChild("input").asTextInput;
        _input.onKeyDown.Add(__inputKeyDown);

        _itemURL1 = UIPackage.GetItemURL("Emoji", "chatLeft");
        _itemURL2 = UIPackage.GetItemURL("Emoji", "chatRight");

        _mainView.GetChild("btnSend").onClick.Add(__clickSendBtn);
        _mainView.GetChild("btnEmoji").onClick.Add(__clickEmojiBtn);

        _emojiSelectUI = UIPackage.CreateObject("Emoji", "EmojiSelectUI").asCom;
        _emojiSelectUI.fairyBatching = true;
        _emojiSelectUI.GetChild("list").asList.onClickItem.Add(__clickEmoji);
    }
Пример #2
0
    void Start()
    {
        Application.targetFrameRate = 60;
        DontDestroyOnLoad(this.gameObject);

        Stage.Instantiate(5);
        Stage.inst.AddChild(new GRoot().displayObject);
        Stage.inst.camera.clearFlags = CameraClearFlags.Depth;
        Stage.inst.onKeyDown.Add(OnKeyDown);

        //setup custom loader classs
        UIObjectFactory.SetLoaderExtension(typeof(MyGLoader));

        GRoot.inst.SetContentScaleFactor(1136, 640);

        UIPackage.AddPackage("BagDemo");

        _mainView = UIPackage.CreateObject("Bag", "Main").asCom;
        _mainView.SetSize(GRoot.inst.width, GRoot.inst.height);
        _mainView.AddRelation(GRoot.inst, RelationType.Size);
        GRoot.inst.AddChild(_mainView);

        _bagWindow = new BagWindow();

        _mainView.GetChild("bagBtn").onClick.Add(() => { _bagWindow.Show(); });
    }
Пример #3
0
 public Transition(GComponent owner)
 {
     _owner = owner;
     _items = new List<TransitionItem>();
     autoPlayRepeat = 1;
     _timeScale = 1;
 }
    void Start()
    {
        _mainView = this.GetComponent<UIPanel>().ui;

        BlurFilter blurFilter = new BlurFilter();
        blurFilter.blurSize = 2;
        _mainView.GetChild("n21").filter = blurFilter;

        _s0 = _mainView.GetChild("s0").asSlider;
        _s1 = _mainView.GetChild("s1").asSlider;
        _s2 = _mainView.GetChild("s2").asSlider;
        _s3 = _mainView.GetChild("s3").asSlider;
        _s4 = _mainView.GetChild("s4").asSlider;

        _s0.value = 100;
        _s1.value = 100;
        _s2.value = 100;
        _s3.value = 200;
        _s4.value = 20;

        _s0.onChanged.Add(__sliderChanged);
        _s1.onChanged.Add(__sliderChanged);
        _s2.onChanged.Add(__sliderChanged);
        _s3.onChanged.Add(__sliderChanged);
        _s4.onChanged.Add(__sliderChanged);
    }
Пример #5
0
    void Start()
    {
        Application.targetFrameRate = 60;
        DontDestroyOnLoad(this.gameObject);

        Stage.Instantiate(5);
        Stage.inst.AddChild(new GRoot().displayObject);
        Stage.inst.camera.clearFlags = CameraClearFlags.Depth;
        Stage.inst.onKeyDown.Add(OnKeyDown);

        GRoot.inst.SetContentScaleFactor(1136, 640);

        UIPackage.AddPackage("UI/JoystickDemo");

        _mainView = UIPackage.CreateObject("Demo", "Main").asCom;
        _mainView.SetSize(GRoot.inst.width, GRoot.inst.height);
        _mainView.AddRelation(GRoot.inst, RelationType.Size);
        GRoot.inst.AddChild(_mainView);

        _joystick = new JoystickModule(_mainView);
        _joystick.onMove.Add(__joystickMove);
        _joystick.onEnd.Add(__joystickEnd);

        _npc = GameObject.Find("npc").transform;
    }
Пример #6
0
    void Start()
    {
        Application.targetFrameRate = 60;
        DontDestroyOnLoad(this.gameObject);

        Stage.Instantiate(5);
        Stage.inst.AddChild(new GRoot().displayObject);
        Stage.inst.camera.clearFlags = CameraClearFlags.Depth;
        Stage.inst.onKeyDown.Add(OnKeyDown);

        GRoot.inst.SetContentScaleFactor(1136, 640);

        UIPackage.AddPackage("UI/CustomMaterialDemo");

        _mainView = UIPackage.CreateObject("Demo", "Main").asCom;
        _mainView.SetSize(GRoot.inst.width, GRoot.inst.height);
        _mainView.AddRelation(GRoot.inst, RelationType.Size);
        GRoot.inst.AddChild(_mainView);

        _btn0 = _mainView.GetChild("b0").asButton;
        _btn0.icon = "k0";
        _time1 = 5;
        _mat0 = new Material(Shader.Find("Cooldown mask"));
        _mat0.SetFloat("_Progress", 0f);
        _mat0.SetTexture("_MaskTex", (Texture)Resources.Load("CooldownMask"));
        _btn0.GetChild("icon").asLoader.material = _mat0;

        _btn1 = _mainView.GetChild("b1").asButton;
        _btn1.icon = "k1";
        _time2 = 10;
        _mat1 = new Material(Shader.Find("Cooldown mask"));
        _mat1.SetFloat("_Progress", 0f);
        _mat1.SetTexture("_MaskTex", (Texture)Resources.Load("CooldownMask"));
        _btn1.GetChild("icon").asLoader.material = _mat1;
    }
    void Start()
    {
        Application.targetFrameRate = 60;
        GRoot.inst.SetContentScaleFactor(1136, 640);
        Stage.inst.onKeyDown.Add(OnKeyDown);

        UIPackage.AddPackage("UI/Transition");

        _mainView = UIPackage.CreateObject("Transition", "Main").asCom;
        _mainView.fairyBatching = true;
        _mainView.SetSize(GRoot.inst.width, GRoot.inst.height);
        _mainView.AddRelation(GRoot.inst, RelationType.Size);
        GRoot.inst.AddChild(_mainView);

        _btnGroup = _mainView.GetChild("g0").asGroup;

        _g1 = UIPackage.CreateObject("Transition", "BOSS").asCom;
        _g2 = UIPackage.CreateObject("Transition", "BOSS_SKILL").asCom;
        _g3 = UIPackage.CreateObject("Transition", "TRAP").asCom;
        _g4 = UIPackage.CreateObject("Transition", "GoodHit").asCom;
        _g5 = UIPackage.CreateObject("Transition", "PowerUp").asCom;
        _g5.GetTransition("t0").SetHook("play_num_now", __playNum);

        _mainView.GetChild("btn0").onClick.Add(() => { __play(_g1); });
        _mainView.GetChild("btn1").onClick.Add(() => { __play(_g2); });
        _mainView.GetChild("btn2").onClick.Add(() => { __play(_g3); });
        _mainView.GetChild("btn3").onClick.Add(__play4);
        _mainView.GetChild("btn4").onClick.Add(__play5);
    }
    IEnumerator LoadUIPackage()
    {
        string url = Application.streamingAssetsPath.Replace("\\", "/") + "/FairyGUI-Examples/bundleusage.ab";
        if (Application.platform != RuntimePlatform.Android)
            url = "file:///" + url;

        WWW www = new WWW(url);
        yield return www;

        if (string.IsNullOrEmpty(www.error))
        {
            AssetBundle bundle = www.assetBundle;
            if (bundle == null)
            {
                Debug.LogWarning("Run Window->Build FairyGUI example Bundles first.");
                yield return 0;
            }
            UIPackage.AddPackage(bundle);

            _mainView = UIPackage.CreateObject("BundleUsage", "Main").asCom;
            _mainView.SetSize(GRoot.inst.width, GRoot.inst.height);
            _mainView.AddRelation(GRoot.inst, RelationType.Size);

            GRoot.inst.AddChild(_mainView);
            _mainView.GetTransition("t0").Play();
        }
        else
            Debug.LogError(www.error);
    }
Пример #9
0
    public MainPanel()
    {
        _view = UIPackage.CreateObject("Demo", "Demo").asCom;
        _view.fairyBatching = true;//优化drawcall,可以切换这条语句看效果
        _view.SetSize(GRoot.inst.width, GRoot.inst.height);
        _view.AddRelation(GRoot.inst, RelationType.Size);
        GRoot.inst.AddChild(_view);

        _backBtn = _view.GetChild("btn_Back");
        _backBtn.visible = false;
        _backBtn.onClick.Add(onClickBack);

        _demoContainer = _view.GetChild("container").asCom;
        _cc = _view.GetController("c1");

        int cnt = _view.numChildren;
        for (int i = 0; i < cnt; i++)
        {
            GObject obj = _view.GetChildAt(i);
            if (obj.group != null && obj.group.name == "btns")
                obj.onClick.Add(runDemo);
        }

        _demoObjects = new Dictionary<string, GComponent>();
    }
Пример #10
0
    void Start()
    {
        Application.targetFrameRate = 60;
        Stage.inst.onKeyDown.Add(OnKeyDown);

        _mainView = this.GetComponent<UIPanel>().ui;

        _guideLayer = UIPackage.CreateObject("Guide", "GuideLayer").asCom;
        _guideLayer.SetSize(GRoot.inst.width, GRoot.inst.height);
        _guideLayer.AddRelation(GRoot.inst, RelationType.Size);

        GObject bagBtn = _mainView.GetChild("bagBtn");
        bagBtn.onClick.Add(() =>
        {
            _guideLayer.RemoveFromParent();
        });

        _mainView.GetChild("n2").onClick.Add(() =>
        {
            GRoot.inst.AddChild(_guideLayer); //!!Before using TransformRect(or GlobalToLocal), the object must be added first
            Rect rect = bagBtn.TransformRect(new Rect(0, 0, bagBtn.width, bagBtn.height), _guideLayer);

            GObject window = _guideLayer.GetChild("window");
            window.size = new Vector2((int)rect.size.x, (int)rect.size.y);
            window.TweenMove(new Vector2((int)rect.position.x, (int)rect.position.y), 0.5f);
        });
    }
Пример #11
0
    void Start()
    {
        Application.targetFrameRate = 60;
        GRoot.inst.SetContentScaleFactor(1136, 640);
        Stage.inst.onKeyDown.Add(OnKeyDown);

        UIPackage.AddPackage("UI/Guide");

        _mainView = UIPackage.CreateObject("Guide", "Main").asCom;
        _mainView.fairyBatching = true;
        _mainView.SetSize(GRoot.inst.width, GRoot.inst.height);
        _mainView.AddRelation(GRoot.inst, RelationType.Size);
        GRoot.inst.AddChild(_mainView);

        _guideLayer = UIPackage.CreateObject("Guide", "GuideLayer").asCom;
        _guideLayer.SetSize(GRoot.inst.width, GRoot.inst.height);
        _guideLayer.AddRelation(GRoot.inst, RelationType.Size);

        GObject bagBtn = _mainView.GetChild("bagBtn");
        bagBtn.onClick.Add(() =>
        {
            _guideLayer.RemoveFromParent();
        });

        _mainView.GetChild("n2").onClick.Add(() => {
            Rect rect = bagBtn.LocalToGlobal(new Rect(0, 0, bagBtn.width, bagBtn.height));
            GRoot.inst.AddChild(_guideLayer); //!!Before using GlobalToLocal, the object must be added first
            rect = bagBtn.TransformRect(new Rect(0, 0, bagBtn.width, bagBtn.height), _guideLayer);

            GObject window = _guideLayer.GetChild("window");
            window.size = new Vector2((int)rect.size.x, (int)rect.size.y);
            window.TweenMove(new Vector2((int)rect.position.x, (int)rect.position.y), 0.5f);
        });
    }
Пример #12
0
    void Start()
    {
        Application.targetFrameRate = 60;
        Stage.inst.onKeyDown.Add(OnKeyDown);

        _mainView = this.GetComponent<UIPanel>().ui;

        _list = _mainView.GetChild("mailList").asList;
        for (int i = 0; i < 10; i++)
        {
            MailItem item = (MailItem)_list.AddItemFromPool();
            item.setFetched(i % 3 == 0);
            item.setRead(i % 2 == 0);
            item.setTime("5 Nov 2015 16:24:33");
            item.title = "Mail title here";
        }

        _list.EnsureBoundsCorrect();
        float delay = 0f;
        for (int i = 0; i < 10; i++)
        {
            MailItem item = (MailItem)_list.GetChildAt(i);
            if (_list.IsChildInView(item))
            {
                item.PlayEffect(delay);
                delay += 0.2f;
            }
            else
                break;
        }
    }
    public EmitManager()
    {
        hurtFont1 = UIPackage.GetItemURL("EmitNumbers", "number1");
        hurtFont2 = UIPackage.GetItemURL("EmitNumbers", "number2");
        criticalSign = UIPackage.GetItemURL("EmitNumbers", "critical");

        view = new GComponent();
        GRoot.inst.AddChild(view);
    }
Пример #14
0
    void Start()
    {
        Application.targetFrameRate = 60;
        Stage.inst.onKeyDown.Add(OnKeyDown);
        GRoot.inst.SetContentScaleFactor(1136, 640);
        _mainView = this.GetComponent<UIPanel>().ui;

        _bagWindow = new BagWindow();
        _mainView.GetChild("bagBtn").onClick.Add(() => { _bagWindow.Show(); });
    }
    void Start()
    {
        Application.targetFrameRate = 60;
        Stage.inst.onKeyDown.Add(OnKeyDown);

        _mainView = this.GetComponent<UIPanel>().ui;

        _testWin = new Window3();

        _mainView.GetChild("n2").onClick.Add(() => { _testWin.Show();  });
    }
Пример #16
0
    void Start()
    {
        _mainView = this.GetComponent<UIPanel>().ui;

        _te1 = new TypingEffect(_mainView.GetChild("n5").asTextField);
        _te1.Start();
        Timers.inst.StartCoroutine(_te1.Print(0.050f));

        _te2 = new TypingEffect(_mainView.GetChild("n12").asTextField);
        _te2.Start();
    }
 void __play(GComponent target)
 {
     _btnGroup.visible = false;
     GRoot.inst.AddChild(target);
     Transition t = target.GetTransition("t0");
     t.Play(() =>
     {
         _btnGroup.visible = true;
         GRoot.inst.RemoveChild(target);
     });
 }
    public EmitManager()
    {
        hurtFont1 = UIPackage.GetItemURL("EmitNumbers", "number1");
        hurtFont2 = UIPackage.GetItemURL("EmitNumbers", "number2");
        criticalSign = UIPackage.GetItemURL("EmitNumbers", "critical");

        view = new GComponent();
        GRoot.inst.AddChild(view);

        mainCamera = GameObject.Find("Main Camera").GetComponent<Camera>();
    }
Пример #19
0
    void Start()
    {
        _mainView = this.GetComponent<UIPanel>().ui;

        _c0 = (Card)_mainView.GetChild("c0");

        _c1 = (Card)_mainView.GetChild("c1");
        _c1.SetPerspective();

        _c0.onClick.Add(__clickCard);
        _c1.onClick.Add(__clickCard);
    }
Пример #20
0
    void Start()
    {
        Application.targetFrameRate = 60;
        Stage.inst.onKeyDown.Add(OnKeyDown);

        _mainView = this.GetComponent<UIPanel>().ui;

        _text = _mainView.GetChild("n9").asTextField;

        _joystick = new JoystickModule(_mainView);
        _joystick.onMove.Add(__joystickMove);
        _joystick.onEnd.Add(__joystickEnd);
    }
Пример #21
0
    void Start()
    {
        Application.targetFrameRate = 60;
        Stage.inst.onKeyDown.Add(OnKeyDown);

        _mainView = this.GetComponent<UIPanel>().ui;

        Object prefab = Resources.Load("Flame");
        GameObject go = (GameObject)Object.Instantiate(prefab);
        _mainView.GetChild("holder").asGraph.SetNativeObject(new GoWrapper(go));

        _mainView.GetChild("c0").draggable = true;
        _mainView.GetChild("c1").draggable = true;
    }
Пример #22
0
    void Start()
    {
        Application.targetFrameRate = 60;
        Stage.inst.onKeyDown.Add(OnKeyDown);

        _mainView = this.GetComponent<UIPanel>().ui;

        Object prefab = Resources.Load("Role/npc");
        GameObject go = (GameObject)Object.Instantiate(prefab);
        go.transform.localPosition = new Vector3(61, -89, 1000); //set z to far from UICamera is important!
        go.transform.localScale = new Vector3(180, 180, 180);
        go.transform.localEulerAngles = new Vector3(0, 100, 0);
        _mainView.GetChild("holder").asGraph.SetNativeObject(new GoWrapper(go));
    }
Пример #23
0
    void Start()
    {
        Application.targetFrameRate = 60;
        Stage.inst.onKeyDown.Add(OnKeyDown);

        _mainView = this.GetComponent<UIPainter>().ui;

        _list = _mainView.GetChild("list").asList;
        _list.SetVirtualAndLoop();
        _list.itemRenderer = RenderListItem;
        _list.numItems = 5;
        _list.scrollPane.onScroll.Add(DoSpecialEffect);

        DoSpecialEffect();
    }
 static int AddChild(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         FairyGUI.GComponent obj  = (FairyGUI.GComponent)ToLua.CheckObject <FairyGUI.GComponent>(L, 1);
         FairyGUI.GObject    arg0 = (FairyGUI.GObject)ToLua.CheckObject <FairyGUI.GObject>(L, 2);
         FairyGUI.GObject    o    = obj.AddChild(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Пример #25
0
 static int SwapChildrenAt(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         FairyGUI.GComponent obj = (FairyGUI.GComponent)ToLua.CheckObject <FairyGUI.GComponent>(L, 1);
         int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
         int arg1 = (int)LuaDLL.luaL_checknumber(L, 3);
         obj.SwapChildrenAt(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Пример #26
0
 static int GetChildIndex(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         FairyGUI.GComponent obj  = (FairyGUI.GComponent)ToLua.CheckObject <FairyGUI.GComponent>(L, 1);
         FairyGUI.GObject    arg0 = (FairyGUI.GObject)ToLua.CheckObject <FairyGUI.GObject>(L, 2);
         int o = obj.GetChildIndex(arg0);
         LuaDLL.lua_pushinteger(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Пример #27
0
 static int GetTransition(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         FairyGUI.GComponent obj = (FairyGUI.GComponent)ToLua.CheckObject <FairyGUI.GComponent>(L, 1);
         string arg0             = ToLua.CheckString(L, 2);
         FairyGUI.Transition o   = obj.GetTransition(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Пример #28
0
 static int IsChildInView(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         FairyGUI.GComponent obj  = (FairyGUI.GComponent)ToLua.CheckObject <FairyGUI.GComponent>(L, 1);
         FairyGUI.GObject    arg0 = (FairyGUI.GObject)ToLua.CheckObject <FairyGUI.GObject>(L, 2);
         bool o = obj.IsChildInView(arg0);
         LuaDLL.lua_pushboolean(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Пример #29
0
 static int Setup_AfterAdd(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         FairyGUI.GComponent       obj  = (FairyGUI.GComponent)ToLua.CheckObject <FairyGUI.GComponent>(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_AfterAdd(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static public int SwapChildrenAt(IntPtr l)
 {
     try {
         FairyGUI.GComponent self = (FairyGUI.GComponent)checkSelf(l);
         System.Int32        a1;
         checkType(l, 2, out a1);
         System.Int32 a2;
         checkType(l, 3, out a2);
         self.SwapChildrenAt(a1, a2);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static int AddClick(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         LuaFramework.LuaBehaviour obj  = (LuaFramework.LuaBehaviour)ToLua.CheckObject <LuaFramework.LuaBehaviour>(L, 1);
         FairyGUI.GComponent       arg0 = (FairyGUI.GComponent)ToLua.CheckObject <FairyGUI.GComponent>(L, 2);
         LuaFunction arg1 = ToLua.CheckLuaFunction(L, 3);
         obj.AddClick(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int GetChildAt(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         FairyGUI.GComponent obj = (FairyGUI.GComponent)ToLua.CheckObject <FairyGUI.GComponent>(L, 1);
         int arg0           = (int)LuaDLL.luaL_checknumber(L, 2);
         FairyGUI.GObject o = obj.GetChildAt(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Пример #33
0
 static int Contains(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         System.Collections.Generic.Stack <FairyGUI.GComponent> obj = (System.Collections.Generic.Stack <FairyGUI.GComponent>)ToLua.CheckObject <System.Collections.Generic.Stack <FairyGUI.GComponent> >(L, 1);
         FairyGUI.GComponent arg0 = (FairyGUI.GComponent)ToLua.CheckObject <FairyGUI.GComponent>(L, 2);
         bool o = obj.Contains(arg0);
         LuaDLL.lua_pushboolean(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Пример #34
0
 static int GetLayer(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         LayersMgr           obj  = (LayersMgr)ToLua.CheckObject(L, 1, typeof(LayersMgr));
         LayerTag            arg0 = (LayerTag)ToLua.CheckObject(L, 2, typeof(LayerTag));
         FairyGUI.GComponent o    = obj.GetLayer(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Пример #35
0
    void Start()
    {
        Application.targetFrameRate = 60;
        Stage.inst.onKeyDown.Add(OnKeyDown);

        _mainView = this.GetComponent<UIPanel>().ui;
        _mainView.GetChild("n6").onClick.Add(() => { _list.AddSelection(500, true); });
        _mainView.GetChild("n7").onClick.Add(() => { _list.scrollPane.ScrollTop(); });
        _mainView.GetChild("n8").onClick.Add(() => { _list.scrollPane.ScrollBottom(); });

        _list = _mainView.GetChild("mailList").asList;
        _list.SetVirtual();

        _list.itemRenderer = RenderListItem;
        _list.numItems = 1000;
    }
    void Start()
    {
        Application.targetFrameRate = 60;
        GRoot.inst.SetContentScaleFactor(1136, 640);
        Stage.inst.onKeyDown.Add(OnKeyDown);

        UIPackage.AddPackage("UI/HitTest");

        _mainView = UIPackage.CreateObject("HitTest", "Main").asCom;
        _mainView.SetSize(GRoot.inst.width, GRoot.inst.height);
        _mainView.AddRelation(GRoot.inst, RelationType.Size);
        GRoot.inst.AddChild(_mainView);

        cube = GameObject.Find("Cube").transform;
        Stage.inst.onTouchBegin.Add(OnTouchBegin);
    }
Пример #37
0
    static int get_contentPane(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.Window     obj = (FairyGUI.Window)o;
            FairyGUI.GComponent ret = obj.contentPane;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index contentPane on a nil value"));
        }
    }
Пример #38
0
 static int SetChildIndexBefore(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         FairyGUI.GComponent obj  = (FairyGUI.GComponent)ToLua.CheckObject(L, 1, typeof(FairyGUI.GComponent));
         FairyGUI.GObject    arg0 = (FairyGUI.GObject)ToLua.CheckObject(L, 2, typeof(FairyGUI.GObject));
         int arg1 = (int)LuaDLL.luaL_checknumber(L, 3);
         int o    = obj.SetChildIndexBefore(arg0, arg1);
         LuaDLL.lua_pushinteger(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
    void Start()
    {
        Application.targetFrameRate = 60;
        GRoot.inst.SetContentScaleFactor(1136, 640);
        Stage.inst.onKeyDown.Add(OnKeyDown);

        UIPackage.AddPackage("UI/RenderTexture");

        _mainView = UIPackage.CreateObject("RenderTexture", "Main").asCom;
        _mainView.SetSize(GRoot.inst.width, GRoot.inst.height);
        _mainView.AddRelation(GRoot.inst, RelationType.Size);
        GRoot.inst.AddChild(_mainView);

        _testWin = new Window3();

        _mainView.GetChild("n2").onClick.Add(() => { _testWin.Show();  });
    }
Пример #40
0
    static int set_fairyBatching(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.GComponent obj = (FairyGUI.GComponent)o;
            bool arg0 = LuaDLL.luaL_checkboolean(L, 2);
            obj.fairyBatching = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index fairyBatching on a nil value" : e.Message));
        }
    }
Пример #41
0
    static int get_viewHeight(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.GComponent obj = (FairyGUI.GComponent)o;
            float ret = obj.viewHeight;
            LuaDLL.lua_pushnumber(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index viewHeight on a nil value" : e.Message));
        }
    }
Пример #42
0
    static int get_clipSoftness(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.GComponent obj = (FairyGUI.GComponent)o;
            UnityEngine.Vector2 ret = obj.clipSoftness;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index clipSoftness on a nil value" : e.Message));
        }
    }
Пример #43
0
    static int get_numChildren(IntPtr L)
    {
        object o = null;

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

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.GComponent obj = (FairyGUI.GComponent)o;
            System.Collections.Generic.List <FairyGUI.Controller> ret = obj.Controllers;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Controllers on a nil value" : e.Message));
        }
    }
Пример #45
0
    static int get_childrenRenderOrder(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.GComponent          obj = (FairyGUI.GComponent)o;
            FairyGUI.ChildrenRenderOrder ret = obj.childrenRenderOrder;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index childrenRenderOrder on a nil value" : e.Message));
        }
    }
Пример #46
0
    static int get_opaque(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.GComponent obj = (FairyGUI.GComponent)o;
            bool ret = obj.opaque;
            LuaDLL.lua_pushboolean(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index opaque on a nil value" : e.Message));
        }
    }
Пример #47
0
    static int get_onDrop(IntPtr L)
    {
        object o = null;

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

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

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

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.GComboBox  obj  = (FairyGUI.GComboBox)o;
            FairyGUI.GComponent arg0 = (FairyGUI.GComponent)ToLua.CheckObject(L, 2, typeof(FairyGUI.GComponent));
            obj.dropdown = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index dropdown on a nil value" : e.Message));
        }
    }
    static int get_owner(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.ScrollPane obj = (FairyGUI.ScrollPane)o;
            FairyGUI.GComponent ret = obj.owner;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index owner on a nil value" : e.Message));
        }
    }
Пример #52
0
 static int GetChildInGroup(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         FairyGUI.GComponent obj  = (FairyGUI.GComponent)ToLua.CheckObject(L, 1, typeof(FairyGUI.GComponent));
         FairyGUI.GGroup     arg0 = (FairyGUI.GGroup)ToLua.CheckObject(L, 2, typeof(FairyGUI.GGroup));
         string           arg1    = ToLua.CheckString(L, 3);
         FairyGUI.GObject o       = obj.GetChildInGroup(arg0, arg1);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Пример #53
0
    static int get_frame(IntPtr L)
    {
        object o = null;

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

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.Window     obj  = (FairyGUI.Window)o;
            FairyGUI.GComponent arg0 = (FairyGUI.GComponent)ToLua.CheckObject(L, 2, typeof(FairyGUI.GComponent));
            obj.contentPane = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index contentPane on a nil value" : e.Message));
        }
    }
    static int get_fixedRoot(IntPtr L)
    {
        object o = null;

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

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyRoot           obj  = (FairyRoot)o;
            FairyGUI.GComponent arg0 = (FairyGUI.GComponent)ToLua.CheckObject <FairyGUI.GComponent>(L, 2);
            obj.WaitingRoot = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index WaitingRoot on a nil value"));
        }
    }
    void Start()
    {
        Application.targetFrameRate = 60;

        Stage.inst.onKeyDown.Add(OnKeyDown);

        _mainView = this.gameObject.GetComponent<UIPanel>().ui;

        _btn0 = _mainView.GetChild("b0").asButton;
        _btn0.icon = "Cooldown/k0";
        _time1 = 5;
        _mask0 = _btn0.GetChild("mask").asImage;

        _btn1 = _mainView.GetChild("b1").asButton;
        _btn1.icon = "Cooldown/k1";
        _time2 = 10;
        _mask1 = _btn1.GetChild("mask").asImage;
    }
    public JoystickModule(GComponent mainView)
    {
        onMove = new EventListener(this, "onMove");
        onEnd = new EventListener(this, "onEnd");

        _button = mainView.GetChild("joystick").asButton;
        _button.changeStateOnClick = false;
        _thumb = _button.GetChild("thumb");
        _touchArea = mainView.GetChild("joystick_touch");
        _center = mainView.GetChild("joystick_center");

        _InitX = _center.x + _center.width / 2;
        _InitY = _center.y + _center.height / 2;
        touchId = -1;
        radius = 150;

        _touchArea.onTouchBegin.Add(this.onTouchDown);
    }
    void Start()
    {
        _mainView = this.GetComponent<UIPanel>().ui;

        _folderURL1 = UIPackage.GetItemURL("TreeView", "folder_closed");
        _folderURL2 = UIPackage.GetItemURL("TreeView", "folder_opened");
        _fileURL = UIPackage.GetItemURL("TreeView", "file");

        _treeView = new TreeView(_mainView.GetChild("tree").asList);
        _treeView.onClickNode.Add(__clickNode);
        _treeView.treeNodeRender = RenderTreeNode;

        TreeNode topNode = new TreeNode(true);
        topNode.data = "I'm a top node";
        _treeView.root.AddChild(topNode);
        for (int i = 0; i < 5; i++)
        {
            TreeNode node = new TreeNode(false);
            node.data = "Hello " + i;
            topNode.AddChild(node);
        }

        TreeNode aFolderNode = new TreeNode(true);
        aFolderNode.data = "A folder node";
        topNode.AddChild(aFolderNode);
        for (int i = 0; i < 5; i++)
        {
            TreeNode node = new TreeNode(false);
            node.data = "Good " + i;
            aFolderNode.AddChild(node);
        }

        for (int i = 0; i < 3; i++)
        {
            TreeNode node = new TreeNode(false);
            node.data = "World " + i;
            topNode.AddChild(node);
        }

        TreeNode anotherTopNode = new TreeNode(false);
        anotherTopNode.data = new string[] { "I'm a top node too", UIPackage.GetItemURL("TreeView", "heart") };
        _treeView.root.AddChild(anotherTopNode);
    }
Пример #60
0
    void Start()
    {
        _mainView = this.GetComponent<UIPanel>().ui;

        _s0 = _mainView.GetChild("s0").asSlider;
        _s1 = _mainView.GetChild("s1").asSlider;
        _s2 = _mainView.GetChild("s2").asSlider;
        _s3 = _mainView.GetChild("s3").asSlider;

        _s0.value = 100;
        _s1.value = 100;
        _s2.value = 100;
        _s3.value = 200;

        _s0.onChanged.Add(__sliderChanged);
        _s1.onChanged.Add(__sliderChanged);
        _s2.onChanged.Add(__sliderChanged);
        _s3.onChanged.Add(__sliderChanged);
    }