GetChildAt() публичный Метод

Returns a child object at a certain index. If index out of bounds, exception raised.
public GetChildAt ( int index ) : GObject
index int Index
Результат 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
 static public int GetChildAt(IntPtr l)
 {
     try {
         FairyGUI.GComponent self = (FairyGUI.GComponent)checkSelf(l);
         System.Int32        a1;
         checkType(l, 2, out a1);
         var ret = self.GetChildAt(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #3
0
 static int GetChildAt(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         FairyGUI.GComponent obj = (FairyGUI.GComponent)ToLua.CheckObject(L, 1, typeof(FairyGUI.GComponent));
         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));
     }
 }
Пример #4
0
    void Start()
    {
        Application.targetFrameRate = 60;
        Stage.inst.onKeyDown.Add(OnKeyDown);

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

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

        _demoContainer = _mainView.GetChild("container").asCom;
        _viewController = _mainView.GetController("c1");

        _demoObjects = new Dictionary<string, GComponent>();

        int cnt = _mainView.numChildren;
        for (int i = 0; i < cnt; i++)
        {
            GObject obj = _mainView.GetChildAt(i);
            if (obj.group != null && obj.group.name == "btns")
                obj.onClick.Add(runDemo);
        }
    }
Пример #5
0
        static void GetChildEventBridges(string strType, GComponent container, List<EventBridge> bridges)
        {
            EventBridge bridge = container.TryGetEventBridge(strType);
            if (bridge != null)
                bridges.Add(bridge);

            int count = container.numChildren;
            for (int i = 0; i < count; ++i)
            {
                GObject obj = container.GetChildAt(i);
                if (obj is GComponent)
                    GetChildEventBridges(strType, (GComponent)obj, bridges);
                else
                {
                    bridge = obj.TryGetEventBridge(strType);
                    if (bridge != null)
                        bridges.Add(bridge);
                }
            }
        }
Пример #6
0
        static void GetChildEventListeners(string strType, GComponent container, List<EventListener> listeners)
        {
            EventListener listener = container.GetEventListener(strType);
            if (listener != null)
                listeners.Add(listener);

            int count = container.numChildren;
            for (int i = 0; i < count; ++i)
            {
                GObject obj = container.GetChildAt(i);
                if (obj is GComponent)
                    GetChildEventListeners(strType, (GComponent)obj, listeners);
                else
                {
                    listener = obj.GetEventListener(strType);
                    if (listener != null)
                        listeners.Add(listener);
                }
            }
        }
    void Start()
    {
        #if UNITY_WEBPLAYER || UNITY_WEBGL || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_EDITOR
        CopyPastePatch.Apply();
        #endif

        Application.targetFrameRate = 60;
        GRoot.inst.SetContentScaleFactor(1136, 640);
        Stage.inst.onKeyDown.Add(OnKeyDown);

        UIPackage.AddPackage("UI/Basics");

        #if UNITY_5
        //Use the font names directly
        UIConfig.defaultFont = "Droid Sans,Droid Sans Fallback,Microsoft YaHei";
        #else
        //Need to put a ttf file into Resources folder. Here is the file name of the ttf file.
        UIConfig.defaultFont = "afont";
        #endif

        UIConfig.verticalScrollBar = UIPackage.GetItemURL("Basics", "ScrollBar_VT");
        UIConfig.horizontalScrollBar = UIPackage.GetItemURL("Basics", "ScrollBar_HZ");
        UIConfig.popupMenu = UIPackage.GetItemURL("Basics", "PopupMenu");
        UIConfig.buttonSound = (AudioClip)UIPackage.GetItemAsset("Basics", "click");

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

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

        _demoContainer = _mainView.GetChild("container").asCom;
        _viewController = _mainView.GetController("c1");

        _demoObjects = new Dictionary<string, GComponent>();

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