GetChild() 공개 메소드

Returns a child object with a certain name.
public GetChild ( string name ) : GObject
name string Name
리턴 GObject
예제 #1
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>();
    }
예제 #2
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);
    }
예제 #3
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;
    }
예제 #4
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);
        });
    }
예제 #5
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);
        });
    }
예제 #6
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();
    }
예제 #7
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);
    }
예제 #8
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;
    }
예제 #9
0
        void Create(string resourceURL)
        {
            if (resourceURL == null)
            {
                resourceURL = UIConfig.popupMenu;
                if (resourceURL == null)
                {
                    Debug.LogError("FairyGUI: UIConfig.popupMenu not defined");
                    return;
                }
            }

            _contentPane = UIPackage.CreateObjectFromURL(resourceURL).asCom;
            _contentPane.onAddedToStage.Add(__addedToStage);
            _contentPane.onRemovedFromStage.Add(__removeFromStage);
            _contentPane.focusable = false;

            _list = _contentPane.GetChild("list").asList;
            _list.RemoveChildrenToPool();

            _list.AddRelation(_contentPane, RelationType.Width);
            _list.RemoveRelation(_contentPane, RelationType.Height);
            _contentPane.AddRelation(_list, RelationType.Height);

            _list.onClickItem.Add(__clickItem);

            hideOnClickItem = true;
            _showSubMenu    = __showSubMenu;
            _closeSubMenu   = CloseSubMenu;
        }
예제 #10
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;
        }
    }
예제 #11
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;
    }
예제 #12
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(); });
    }
    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);
    }
예제 #15
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);
    }
예제 #16
0
파일: BagMain.cs 프로젝트: yinlei/Fishing
    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(); });
    }
    public void Init()
    {
        _cutSceneView = UIPackage.CreateObject("CutScene", "CutScene").asCom;
        _cutSceneView.SetSize(GRoot.inst.width, GRoot.inst.height);
        _cutSceneView.AddRelation(GRoot.inst, RelationType.Size);

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

        _mainView.GetChild("n0").onClick.Add(() =>
        {
            LoadLevel("scene1");
        });

        _mainView.GetChild("n1").onClick.Add(() =>
        {
            LoadLevel("scene2");
        });
    }
    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();  });
    }
예제 #19
0
    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);
    }
    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);
    }
    void Start()
    {
        Application.targetFrameRate = 60;
        GRoot.inst.SetContentScaleFactor(1136, 640);
        Stage.inst.onKeyDown.Add(OnKeyDown);

        UIPackage.AddPackage("UI/Particles");

        UIObjectFactory.SetPackageItemExtension(UIPackage.GetItemURL("Particles", "CoolComponent"), typeof(CoolComponent));

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

        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
파일: EmojiMain.cs 프로젝트: yinlei/Fishing
    void Start()
    {
        Application.targetFrameRate = 60;
        Stage.inst.onKeyDown.Add(OnKeyDown);

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

        _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);
    }
예제 #23
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);
    }
    void Start()
    {
        Application.targetFrameRate = 60;
        GRoot.inst.SetContentScaleFactor(1136, 640);
        Stage.inst.onKeyDown.Add(OnKeyDown);

        UIPackage.AddPackage("UI/Cooldown");

        _mainView = UIPackage.CreateObject("Cooldown", "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 = "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;
    }
예제 #25
0
파일: ModelMain.cs 프로젝트: yinlei/Fishing
    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));
    }
예제 #26
0
파일: CurveMain.cs 프로젝트: yinlei/Fishing
    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();
    }
예제 #27
0
 static public int GetChild(IntPtr l)
 {
     try {
         FairyGUI.GComponent self = (FairyGUI.GComponent)checkSelf(l);
         System.String       a1;
         checkType(l, 2, out a1);
         var ret = self.GetChild(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #28
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/EmojiDemo");

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

        _mainView = UIPackage.CreateObject("Demo", "Main").asCom;
        _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("Demo", "chatLeft");
        _itemURL2 = UIPackage.GetItemURL("Demo", "chatRight");

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

        _emojiSelectUI = UIPackage.CreateObject("Demo", "EmojiSelectUI").asCom;
        _emojiSelectUI.GetChild("list").asList.onClickItem.Add(__clickEmoji);
    }
예제 #29
0
 static int GetChild(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         FairyGUI.GComponent obj = (FairyGUI.GComponent)ToLua.CheckObject(L, 1, typeof(FairyGUI.GComponent));
         string           arg0   = ToLua.CheckString(L, 2);
         FairyGUI.GObject o      = obj.GetChild(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #30
0
        override protected void ConstructExtension(ByteBuffer buffer)
        {
            buffer.Seek(0, 6);

            _buttonController = GetController("button");
            _titleObject      = GetChild("title");
            _iconObject       = GetChild("icon");

            string str = buffer.ReadS();

            if (str != null)
            {
                dropdown = UIPackage.CreateObjectFromURL(str) as GComponent;
                if (dropdown == null)
                {
                    Debug.LogWarning("FairyGUI: " + this.resourceURL + " should be a component.");
                    return;
                }

                if (string.IsNullOrEmpty(dropdown.name))
                {
                    var itemName = dropdown.packageItem.name;
                    itemName      = itemName.Split("_LTR".ToCharArray())[0];
                    dropdown.name = string.Format("{0}_{1}", dropdown.packageItem.owner.name, itemName);
                }
                _list = dropdown.GetChild("list") as GList;
                if (_list == null)
                {
                    Debug.LogWarning("FairyGUI: " + this.resourceURL + ": should container a list component named list.");
                    return;
                }
                _list.onClickItem.Add(__clickItem);

                _list.AddRelation(dropdown, RelationType.Width);
                _list.RemoveRelation(dropdown, RelationType.Height);

                dropdown.AddRelation(_list, RelationType.Height);
                dropdown.RemoveRelation(_list, RelationType.Width);

                dropdown.SetHome(this);
            }

            displayObject.onRollOver.Add(__rollover);
            displayObject.onRollOut.Add(__rollout);
            displayObject.onTouchBegin.Add(__touchBegin);
            displayObject.onTouchEnd.Add(__touchEnd);
        }
    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();  });
    }
예제 #32
0
        override public void ConstructFromXML(XML cxml)
        {
            base.ConstructFromXML(cxml);

            XML xml = cxml.GetNode("ComboBox");

            string str;

            _buttonController = GetController("button");
            _titleObject      = GetChild("title");
            _iconObject       = GetChild("icon");

            str = xml.GetAttribute("dropdown");
            if (str != null && str.Length > 0)
            {
                dropdown = UIPackage.CreateObjectFromURL(str) as GComponent;
                if (dropdown == null)
                {
                    Debug.LogWarning("FairyGUI: " + this.resourceURL + " should be a component.");
                    return;
                }

                _list = dropdown.GetChild("list") as GList;
                if (_list == null)
                {
                    Debug.LogWarning("FairyGUI: " + this.resourceURL + ": should container a list component named list.");
                    return;
                }
                _list.onClickItem.Add(__clickItem);

                _list.AddRelation(dropdown, RelationType.Width);
                _list.RemoveRelation(dropdown, RelationType.Height);

                dropdown.AddRelation(_list, RelationType.Height);
                dropdown.RemoveRelation(_list, RelationType.Width);

                dropdown.SetHome(this);
            }

            displayObject.onRollOver.Add(__rollover);
            displayObject.onRollOut.Add(__rollout);
            displayObject.onTouchBegin.Add(__touchBegin);
            displayObject.onTouchEnd.Add(__touchEnd);
        }
    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);
    }
예제 #34
0
    void Start()
    {
        Application.targetFrameRate = 60;
        GRoot.inst.SetContentScaleFactor(1136, 640);
        Stage.inst.onKeyDown.Add(OnKeyDown);

        //Register custom loader class
        UIObjectFactory.SetLoaderExtension(typeof(MyGLoader));

        UIPackage.AddPackage("UI/Bag");

        _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(); });
    }
    void Start()
    {
        Application.targetFrameRate = 60;
        GRoot.inst.SetContentScaleFactor(1136, 640);
        Stage.inst.onKeyDown.Add(OnKeyDown);

        UIPackage.AddPackage("UI/Joystick");

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

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

        _joystick = new JoystickModule(_mainView);
        _joystick.onMove.Add(__joystickMove);
        _joystick.onEnd.Add(__joystickEnd);
    }
예제 #36
0
        override protected void ConstructExtension(ByteBuffer buffer)
        {
            buffer.Seek(0, 6);

            _buttonController = GetController("button");
            _titleObject      = GetChild("title");
            _iconObject       = GetChild("icon");

            string str = buffer.ReadS();

            if (str != null)
            {
                dropdown = UIPackage.CreateObjectFromURL(str) as GComponent;
                if (dropdown == null)
                {
                    Log.Warning("FairyGUI: " + this.resourceURL + " should be a component.");
                    return;
                }

                _list = dropdown.GetChild("list") as GList;
                if (_list == null)
                {
                    Log.Warning("FairyGUI: " + this.resourceURL + ": should container a list component named list.");
                    return;
                }
                _list.onClickItem.Add(__clickItem);

                _list.AddRelation(dropdown, RelationType.Width);
                _list.RemoveRelation(dropdown, RelationType.Height);

                dropdown.AddRelation(_list, RelationType.Height);
                dropdown.RemoveRelation(_list, RelationType.Width);
            }

            displayObject.onRollOver.Add(__rollover);
            displayObject.onRollOut.Add(__rollout);
            displayObject.onTouchBegin.Add(__touchBegin);
            displayObject.onTouchEnd.Add(__touchEnd);
        }
예제 #37
0
        void Create(string resourceURL)
        {
            if (resourceURL == null)
            {
                resourceURL = UIConfig.popupMenu;
                if (resourceURL == null)
                {
                    Log.Error("FairyGUI: UIConfig.popupMenu not defined");
                    return;
                }
            }

            _contentPane = UIPackage.CreateObjectFromURL(resourceURL).asCom;
            _contentPane.onAddedToStage.Add(__addedToStage);

            _list = _contentPane.GetChild("list").asList;
            _list.RemoveChildrenToPool();

            _list.AddRelation(_contentPane, RelationType.Width);
            _list.RemoveRelation(_contentPane, RelationType.Height);
            _contentPane.AddRelation(_list, RelationType.Height);

            _list.onClickItem.Add(__clickItem);
        }