Ejemplo n.º 1
0
    public ByteArray GetProtoBytes(string file)
    {
        if (!_protoBytes.ContainsKey(file))
        {
            if (LGameConfig.GetInstance().isDebug)
            {
                LArchiveBinFile cArc        = new LArchiveBinFile();
                string          strFullPath = LGameConfig.GetInstance().GetLoadUrl(LGameConfig.DATA_CATAGORY_LUA + "/Game/Proto/" + file + ".bytes");

                if (!cArc.Open(strFullPath, System.IO.FileMode.Open, System.IO.FileAccess.Read))
                {
                    return(null);
                }

                if (!cArc.IsValid())
                {
                    return(null);
                }
                int    nContentLength = (int)cArc.GetStream().Length;
                byte[] aContents      = new byte[nContentLength];
                cArc.ReadBuffer(ref aContents, nContentLength);
                cArc.Close();
                _protoBytes.Add(file, new ByteArray(aContents));
            }
            else
            {
                TextAsset asset = LLoadBundle.GetInstance().LoadAsset <TextAsset>("@lua.ab", "@Lua/Game/Proto/" + file + ".bytes");
                _protoBytes.Add(file, new ByteArray(asset.bytes));
            }
        }

        return(_protoBytes[file]);
    }
Ejemplo n.º 2
0
    void Start()
    {
        btn_close.onClick.AddListener(() =>
        {
            LWindowManager wm = LWindowManager.GetInstance();
            wm.popWindow(this);
        });

        gridPageView.cellsSize         = new Vector2(400, 400);
        gridPageView.cellTemplate.node = LLoadBundle.GetInstance().LoadAsset(LGameConfig.PREFAB_BUNDLE, "grid_cell.prefab", typeof(GameObject)) as GameObject;
        //gridPageView.cellTemplate.node = Resources.Load("Prefabs/grid_cell") as GameObject;
        gridPageView.cols           = 4;
        gridPageView.rows           = 4;
        gridPageView.gridCellsCount = 100;
        gridPageView.gridCellsSize  = new Vector2(100, 100);
        gridPageView.onGridDataSourceAdapterHandler = (LGridPageViewCell cell, int idx) =>
        {
            if (cell == null)
            {
                cell      = new LGridPageViewCell();
                cell.node = (GameObject)Instantiate(gridPageView.cellTemplate.node, Vector3.zero, gridPageView.cellTemplate.node.transform.rotation);
            }
            cell.node.GetComponent <Text>().text = idx.ToString();
            cell.node.SetActive(idx != LScrollView.INVALID_INDEX);
            return(cell);
        };
        gridPageView.reloadData();
    }
Ejemplo n.º 3
0
    protected LWindowBase loadWindow(string name)
    {
        LWindowBase ret = null;

        if (cacheWindows.ContainsKey(name))
        {
            ret = cacheWindows[name];
        }
        else if (delayDisposeWindows.ContainsKey(name))
        {
            ret = delayDisposeWindows[name];
        }
        else
        {
            string     abName = LGameConfig.GetABNameWithAtlasPath(name);
            GameObject res    = LLoadBundle.GetInstance().LoadAsset <GameObject>(abName, name);
            GameObject obj    = Instantiate(res);

            obj.name = name;
            obj.GetComponent <RectTransform>().sizeDelta = canvas.GetComponent <RectTransform>().rect.size;
            ret = obj.GetComponent <LWindowBase>();
            if (ret)
            {
                ret.name = obj.name;
            }
        }
        return(ret);
    }
Ejemplo n.º 4
0
        public void loadTexture()
        {
            //load textures
            string atlasPath = System.IO.Path.GetDirectoryName(path);
            string assetName = System.IO.Path.GetFileNameWithoutExtension(path);

            Sprite[] sprites = LLoadBundle.GetInstance().GetSpritesByName(atlasPath, assetName);
            Dictionary <string, Sprite> dic = new Dictionary <string, Sprite>();

            foreach (Sprite s in sprites)
            {
                if (s.name.StartsWith(assetName))
                {
                    dic.Add(s.name, s);
                }
            }
            int           idx  = 1;
            List <Sprite> list = new List <Sprite>();

            while (dic.ContainsKey(assetName + idx.ToString("D2")))
            {
                list.Add(dic[assetName + idx.ToString("D2")]);
                idx++;
            }
            _frameLenght = list.Count;
            _spriteArr   = list.ToArray();
        }
Ejemplo n.º 5
0
 void OnLevelWasLoaded(int level)
 {
     //remove first textures
     LLoadBundle.GetInstance().UnloadBundles(new string[] {
         "atlas-face_png.ab"
     });
 }
Ejemplo n.º 6
0
    protected LWindowBase loadWindow(string name)
    {
        LWindowBase ret = null;

        if (cacheWindows.ContainsKey(name))
        {
            ret = cacheWindows[name];
        }
        else if (delayDisposeWindows.ContainsKey(name))
        {
            ret = delayDisposeWindows[name];
        }
        else
        {
            GameObject res = LLoadBundle.GetInstance().LoadAsset(LGameConfig.PREFAB_BUNDLE, name, typeof(GameObject)) as GameObject;
            GameObject obj = Instantiate(res);
            //string[] split_names = name.Split('/');
            //obj.name = split_names[split_names.Length-1];
            obj.name = name;
            obj.GetComponent <RectTransform>().sizeDelta = canvas.GetComponent <RectTransform>().rect.size;
            ret = obj.GetComponent <LWindowBase>();
            if (ret)
            {
                ret.name = obj.name;
            }
        }
        return(ret);
    }
Ejemplo n.º 7
0
    public void LoadData(string atlasName)
    {
        string    atlasTxt;
        Texture2D tex2d = LLoadBundle.GetInstance().LoadAtlas(atlasName, out atlasTxt).texture;
        string    key   = atlasName;

        if (_atlasTexture.ContainsKey(key))
        {
            return;
        }

        _atlasTexture.Add(key, tex2d);

        string[] lineArray = atlasTxt.Split(new char[] { '\n' });

        List <FrameInfo> frameInfos = new List <FrameInfo>();

        for (int i = 0; i < lineArray.Length; i++)
        {
            if ((lineArray[i].IndexOf('#') == -1) && (lineArray[i].IndexOf(':') == -1))
            {
                lineArray[i] = lineArray[i].Replace("\r", "");
                if ((lineArray[i] != ""))
                {
                    string[]  strArray  = lineArray[i].Split(new char[] { ';' });
                    FrameInfo frameInfo = new FrameInfo(strArray);
                    frameInfos.Add(frameInfo);
                    Sprite sp = Sprite.Create(tex2d, frameInfo.rect, frameInfo.vec2);
                    sp.name = frameInfo.name;
                    _sprites.Add(atlasName + "_" + frameInfo.name, sp);
                }
            }
        }
        _atlasData.Add(key, frameInfos);
    }
Ejemplo n.º 8
0
 protected void loadTexture()
 {
     Sprite[] sprites = LLoadBundle.GetInstance().LoadAllAsset <Sprite>(LGameConfig.WINDOW_BUNDLE, path);
     for (int i = 0; i < sprites.Length; i++)
     {
         _spriteMap.Add(sprites[i].name, sprites[i]);
     }
 }
Ejemplo n.º 9
0
 public void reload()
 {
     if (text != "")
     {
         sprites = LLoadBundle.GetInstance().GetSpritesByName(atlas, "");
         loadTexture();
         render();
     }
 }
Ejemplo n.º 10
0
        void makeImage(GameObject img, LRenderElement elem)
        {
            Image comImage = img.GetComponent <Image>();

            if (comImage != null)
            {
                Sprite sp = LLoadBundle.GetInstance().LoadAsset(LGameConfig.WINDOW_BUNDLE, elem.path, typeof(Sprite)) as Sprite;
                comImage.sprite = sp;
            }
        }
Ejemplo n.º 11
0
        void makeImage(GameObject img, LRenderElement elem)
        {
            Image comImage = img.GetComponent <Image>();

            if (comImage != null)
            {
                string atlas  = System.IO.Path.GetDirectoryName(elem.path);
                string spname = System.IO.Path.GetFileName(elem.path);
                Sprite sp     = LLoadBundle.GetInstance().GetSpriteByName(atlas, spname);
                comImage.sprite = sp;
            }
        }
Ejemplo n.º 12
0
 static public int GetInstance_s(IntPtr l)
 {
     try {
         var ret = LLoadBundle.GetInstance();
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 13
0
    void complete()
    {
        if (LGameConfig.GetInstance().isShowFps)
        {
            LFPSView.Show();
        }

        if (!LGameConfig.GetInstance().isDebug) //生产环境
        {
            if (LGameConfig.GetInstance().isHotFix)
            {
                GameObject canvas    = GameObject.Find("Canvas");
                Text       lab_unzip = null;
                if (canvas.transform.Find("prog"))
                {
                    canvas.transform.Find("prog").gameObject.SetActive(true);
                    lab_unzip = canvas.transform.Find("prog/lab_unzip").GetComponent <Text>();
                }

                GameObject obj = new GameObject();
                obj.name = "ResUpdate";
                LResUpdate resUpdate = obj.AddComponent <LResUpdate> ();
                resUpdate.onUnzipProgressHandler = (int step) => {
                    if (lab_unzip)
                    {
                        lab_unzip.text = step.ToString();
                    }
                    Debug.Log(" unzip " + step);
                };
                resUpdate.onCompleteHandler = () => {
                    Destroy(obj);
                    LLoadBundle.GetInstance().LoadAllBundles(new string[] { "@lua.ab", "@luaconfig.ab" }, () =>
                    {
                        _l.start("main");
                    });
                };
                resUpdate.checkUpdate();
            }
            else
            {
                LLoadBundle.GetInstance().LoadAllBundles(new string[] { "@lua.ab", "@luaconfig.ab" }, () =>
                {
                    _l.start("main");
                });
            }
        }
        else //PC端开发
        {
            _l.start("main");
        }
    }
Ejemplo n.º 14
0
    protected byte[] loadLuaWithAb(string strFile)
    {
        string    ext   = LGameConfig.GetInstance().isEncrypt ? ".bytes" : ".txt";
        TextAsset asset = LLoadBundle.GetInstance().LoadAsset <TextAsset>("@lua.ab", "@Lua/" + strFile + ext);

        if (asset == null)
        {
            return(null);
        }
        //if (LGameConfig.GetInstance().isEncrypt)
        //    return LUtil.AESDecrypt(asset.bytes, LGameConfig.EncryptKey32, LGameConfig.EncryptKey16);
        //else
        return(asset.bytes);
    }
Ejemplo n.º 15
0
    public void RemoveTexture(string atlasName)
    {
        string key = atlasName;

        if (_atlasData.ContainsKey(key))
        {
            LLoadBundle.GetInstance().UnloadBundles(new string[] { atlasName });

            List <FrameInfo> list = _atlasData[key];
            for (int i = 0; i < list.Count; i++)
            {
                _sprites.Remove(atlasName + "_" + list[i].name);
            }
            _atlasData.Remove(key);
            _atlasTexture.Remove(key);
        }
    }
Ejemplo n.º 16
0
    void Start()
    {
        _wm        = LWindowManager.GetInstance();
        _teddyAnim = GameObject.Find("Teddy").GetComponent <Animator>();

        btn_msg.onClick.AddListener(() =>
        {
            LLoadBundle.GetInstance().LoadAllBundles(new string[] {
                "prefabs-msgbox_prefab.ab",
                "atlas-face_png.ab"
            }, () =>
            {
                _wm.runWindow("Prefabs/MsgBox.prefab", WindowHierarchy.Normal);
            });
        });

        btn_trans.onClick.AddListener(() =>
        {
            LLoadBundle.GetInstance().LoadAllBundles(new string[] {
                "atlas-face_png.ab"
            }, () =>
            {
                _wm.LoadScene("first");
            });
        });

        btn_anim.onClick.AddListener(() =>
        {
            _teddyAnim.SetBool("run_idle", false);
            _teddyAnim.SetBool("idle_run", true);
        });

        btn_clean.onClick.AddListener(() =>
        {
            _teddyAnim.SetBool("idle_run", false);
            _teddyAnim.SetBool("run_idle", true);
        });

        touch_view.onClickHandler2D = (GameObject obj) => {
            Debug.Log(obj.name);
        };
    }
Ejemplo n.º 17
0
    void complete()
    {
        if (LGameConfig.GetInstance().isShowFps)
        {
            LFPSView.Show();
        }

        if (!LGameConfig.GetInstance().isDebug) //生产环境
        {
            if (LGameConfig.GetInstance().isHotFix)
            {
                GameObject obj = new GameObject();
                obj.name = "ResUpdate";
                LResUpdate resUpdate = obj.AddComponent <LResUpdate> ();
                resUpdate.onCompleteHandler = () => {
                    Destroy(obj);
                    LLoadBundle.GetInstance().LoadAllBundles(new string[] { "@lua.ab" }, () =>
                    {
                        _l.start("main");
                    });
                };
                resUpdate.checkUpdate();
            }
            else
            {
                LLoadBundle.GetInstance().LoadAllBundles(new string[] { "@lua.ab" }, () =>
                {
                    _l.start("main");
                });
            }
        }
        else //PC端开发
        {
            _l.start("main");
        }
    }
Ejemplo n.º 18
0
        public void reloadData()
        {
            this.removeAllElements();

            RectTransform rtran = this.GetComponent <RectTransform>();

            //align
            if (alignType == RichAlignType.DESIGN_CENTER)
            {
                rtran.GetComponent <RectTransform>().pivot = new Vector2(0.5f, 0.5f);
            }
            else if (alignType == RichAlignType.LEFT_TOP)
            {
                rtran.GetComponent <RectTransform>().pivot = new Vector2(0f, 1f);
            }

            foreach (LRichElement elem in _richElements)
            {
                if (elem.type == RichType.TEXT)
                {
                    LRichElementText elemText = elem as LRichElementText;
                    char[]           _charArr = elemText.txt.ToCharArray();
                    TextGenerator    gen      = new TextGenerator();

                    foreach (char strChar in _charArr)
                    {
                        LRenderElement rendElem = new LRenderElement();
                        rendElem.type         = RichType.TEXT;
                        rendElem.strChar      = strChar.ToString();
                        rendElem.isOutLine    = elemText.isOutLine;
                        rendElem.isUnderLine  = elemText.isUnderLine;
                        rendElem.outLineColor = elemText.outLineColor;
                        rendElem.font         = this.font;
                        rendElem.fontSize     = elemText.fontSize;
                        rendElem.data         = elemText.data;
                        rendElem.color        = elemText.color;

                        TextGenerationSettings setting = new TextGenerationSettings();
                        setting.font               = this.font;
                        setting.fontSize           = elemText.fontSize;
                        setting.lineSpacing        = 1;
                        setting.scaleFactor        = 1;
                        setting.verticalOverflow   = VerticalWrapMode.Overflow;
                        setting.horizontalOverflow = HorizontalWrapMode.Overflow;

                        rendElem.width  = (int)gen.GetPreferredWidth(rendElem.strChar, setting);
                        rendElem.height = (int)gen.GetPreferredHeight(rendElem.strChar, setting);
                        _elemRenderArr.Add(rendElem);
                    }
                }
                else if (elem.type == RichType.IMAGE)
                {
                    LRichElementImage elemImg  = elem as LRichElementImage;
                    LRenderElement    rendElem = new LRenderElement();
                    rendElem.type = RichType.IMAGE;
                    rendElem.path = elemImg.path;
                    rendElem.data = elemImg.data;

                    string atlas  = System.IO.Path.GetDirectoryName(rendElem.path);
                    string spname = System.IO.Path.GetFileName(rendElem.path);

                    Sprite sp = LLoadBundle.GetInstance().GetSpriteByName(atlas, spname);
                    rendElem.width  = (int)sp.rect.size.x;
                    rendElem.height = (int)sp.rect.size.y;
                    _elemRenderArr.Add(rendElem);
                }
                else if (elem.type == RichType.ANIM)
                {
                    LRichElementAnim elemAnim = elem as LRichElementAnim;
                    LRenderElement   rendElem = new LRenderElement();
                    rendElem.type = RichType.ANIM;
                    rendElem.path = elemAnim.path;
                    rendElem.data = elemAnim.data;
                    rendElem.fs   = elemAnim.fs;

                    string atlas  = System.IO.Path.GetDirectoryName(rendElem.path);
                    string spname = System.IO.Path.GetFileName(rendElem.path);

                    Sprite sp = LLoadBundle.GetInstance().GetSpriteByName(atlas, spname);
                    rendElem.width  = (int)sp.rect.size.x;
                    rendElem.height = (int)sp.rect.size.y;
                    _elemRenderArr.Add(rendElem);
                }
                else if (elem.type == RichType.NEWLINE)
                {
                    LRenderElement rendElem = new LRenderElement();
                    rendElem.isNewLine = true;
                    _elemRenderArr.Add(rendElem);
                }
            }

            _richElements.Clear();

            formatRenderers();
        }
Ejemplo n.º 19
0
 public void loadTexture()
 {
     //load textures
     _spriteArr   = LLoadBundle.GetInstance().LoadAllAsset <Sprite>(LGameConfig.WINDOW_BUNDLE, path);
     _frameLenght = _spriteArr.Length;
 }
Ejemplo n.º 20
0
        public void reloadData()
        {
            this.removeAllElements();

            RectTransform rtran = this.GetComponent <RectTransform>();

            //align
            if (alignType == RichAlignType.DESIGN_CENTER)
            {
                rtran.GetComponent <RectTransform>().pivot = new Vector2(0.5f, 0.5f);
            }
            else if (alignType == RichAlignType.LEFT_TOP)
            {
                rtran.GetComponent <RectTransform>().pivot = new Vector2(0f, 1f);
            }

            foreach (LRichElement elem in _richElements)
            {
                if (elem.type == RichType.TEXT)
                {
                    LRichElementText elemText = elem as LRichElementText;
                    char[]           _charArr = elemText.txt.ToCharArray();
                    TextGenerator    gen      = new TextGenerator();

                    foreach (char strChar in _charArr)
                    {
                        LRenderElement rendElem = new LRenderElement();
                        rendElem.type        = RichType.TEXT;
                        rendElem.strChar     = strChar.ToString();
                        rendElem.isOutLine   = elemText.isOutLine;
                        rendElem.isUnderLine = elemText.isUnderLine;
                        rendElem.font        = this.font;
                        rendElem.fontSize    = elemText.fontSize;
                        rendElem.data        = elemText.data;
                        rendElem.color       = elemText.color;

                        TextGenerationSettings setting = new TextGenerationSettings();
                        setting.font               = this.font;
                        setting.fontSize           = elemText.fontSize;
                        setting.lineSpacing        = 1;
                        setting.scaleFactor        = 1;
                        setting.verticalOverflow   = VerticalWrapMode.Overflow;
                        setting.horizontalOverflow = HorizontalWrapMode.Overflow;

                        rendElem.width  = (int)gen.GetPreferredWidth(rendElem.strChar, setting);
                        rendElem.height = (int)gen.GetPreferredHeight(rendElem.strChar, setting);
                        _elemRenderArr.Add(rendElem);
                    }
                }
                else if (elem.type == RichType.IMAGE)
                {
                    LRichElementImage elemImg  = elem as LRichElementImage;
                    LRenderElement    rendElem = new LRenderElement();
                    rendElem.type = RichType.IMAGE;
                    rendElem.path = elemImg.path;
                    rendElem.data = elemImg.data;
                    Sprite sp = LLoadBundle.GetInstance().LoadAsset(LGameConfig.WINDOW_BUNDLE, rendElem.path, typeof(Sprite)) as Sprite;
                    // Sprite sp = Resources.Load(rendElem.path,typeof(Sprite)) as Sprite;
                    rendElem.width  = sp.texture.width;
                    rendElem.height = sp.texture.height;
                    _elemRenderArr.Add(rendElem);
                }
                else if (elem.type == RichType.ANIM)
                {
                    LRichElementAnim elemAnim = elem as LRichElementAnim;
                    LRenderElement   rendElem = new LRenderElement();
                    rendElem.type = RichType.ANIM;
                    rendElem.path = elemAnim.path;
                    rendElem.data = elemAnim.data;
                    rendElem.fs   = elemAnim.fs;

                    Sprite sp = LLoadBundle.GetInstance().LoadAsset(LGameConfig.WINDOW_BUNDLE, rendElem.path + "/1", typeof(Sprite)) as Sprite;
                    // Sprite sp = Resources.Load(rendElem.path+"/1",typeof(Sprite)) as Sprite;
                    rendElem.width  = sp.texture.width;
                    rendElem.height = sp.texture.height;
                    _elemRenderArr.Add(rendElem);
                }
                else if (elem.type == RichType.NEWLINE)
                {
                    LRenderElement rendElem = new LRenderElement();
                    rendElem.isNewLine = true;
                    _elemRenderArr.Add(rendElem);
                }
            }

            _richElements.Clear();

            formarRenderers();
        }
Ejemplo n.º 21
0
    void Start()
    {
        _wm = LWindowManager.GetInstance();

        btn_grid.onClick.AddListener(() =>
        {
            ArrayList list = new ArrayList();
            list.Add(123);
            list.Add("测试内容");
            _wm.runWindow("WindowGridView.prefab", WindowHierarchy.Normal, list);
        });

        btn_trans.onClick.AddListener(() =>
        {
            _wm.LoadSceneAsync("second", (float p) =>
            {
                Debug.Log("进度 " + p);
            });
        });

        btn_guide.onClick.AddListener(() =>
        {
            bool isBlock = panel_root.GetComponent <CanvasGroup>().blocksRaycasts;
            panel_root.GetComponent <CanvasGroup>().blocksRaycasts = !isBlock;
            Text textComp = btn_guide.transform.FindChild("Text").gameObject.GetComponent <Text>();
            textComp.text = isBlock ? "关闭遮罩" : "开启遮罩";
        });

        ctrlView.onControlHandler = (float ox, float oy, bool isFinish) =>
        {
            //Debug.Log(string.Format("offsetX={0} offsetY={1}", ox, oy));
        };

        scrolView.onMoveCompleteHandler = () =>
        {
            Debug.Log(" scrolView.onMoveCompleteHandler ");
        };

        tblView.cellsSize         = new Vector2(150, 40);
        tblView.cellTemplate.node = LLoadBundle.GetInstance().LoadAsset(LGameConfig.PREFAB_BUNDLE, "tbl_cell.prefab", typeof(GameObject)) as GameObject;
        //tblView.cellTemplate.node = Resources.Load("Prefabs/tbl_cell") as GameObject;
        tblView.GetComponent <RectTransform>().sizeDelta = new Vector2(150, 40 * 5);
        tblView.cellsCount = 100;
        tblView.onDataSourceAdapterHandler = (LTableViewCell cell, int idx) =>
        {
            if (cell == null)
            {
                cell      = new LTableViewCell();
                cell.node = (GameObject)Instantiate(tblView.cellTemplate.node);
            }
            cell.node.GetComponent <Text>().text = idx.ToString();
            return(cell);
        };
        tblView.reloadData();

        //rtfView.insertElement("hello world!!", Color.blue, 25, true, false, Color.blue, "数据");
        //rtfView.insertElement("测试文本内容!!", Color.red, 15, false, true, Color.blue, "");
        //rtfView.insertElement("face01", 5f, "");
        //rtfView.insertElement("The article comes from the point of the examination", Color.green, 15, true, false, Color.blue, "");
        //rtfView.insertElement("face02/1", "");
        //rtfView.insertElement(1);
        //rtfView.insertElement("outline and newline", Color.yellow, 20, false, true, Color.blue, "");
        rtfView.parseRichDefaultString("<lab txt=\"hello world!!\" color=#ffff00 data=数据 /><lab txt=\"测试文本内容\" isUnderLine=true size=40/><anim path=face01 fps=5.0/><newline /><img path=face02/1.png/><lab txt=\"The article comes from the point of the examination\" color=#ff0000 />");
        rtfView.onClickHandler = (string data) =>
        {
            Debug.Log("data " + data);
        };
        //rtfView.reloadData();

        pageView.cellsSize         = new Vector2(150, 100);
        pageView.cellTemplate.node = LLoadBundle.GetInstance().LoadAsset(LGameConfig.PREFAB_BUNDLE, "page_cell.prefab", typeof(GameObject)) as GameObject;
        //pageView.cellTemplate.node = Resources.Load("Prefabs/page_cell") as GameObject;
        pageView.cellsCount = 14;
        pageView.onDataSourceAdapterHandler = (LTableViewCell cell, int idx) =>
        {
            if (cell == null)
            {
                cell      = new LTableViewCell();
                cell.node = (GameObject)Instantiate(pageView.cellTemplate.node, Vector3.zero, pageView.cellTemplate.node.transform.rotation);
            }
            cell.node.transform.FindChild("Text").GetComponent <Text>().text = idx.ToString();
            return(cell);
        };
        pageView.onPageChangedHandler = (int pageIdx) =>
        {
            Debug.Log("page " + pageIdx);
        };
        pageView.reloadData();

        //listView.itemTemplate = Resources.Load("Prefabs/list_cell") as GameObject;
        listView.itemTemplate = LLoadBundle.GetInstance().LoadAsset(LGameConfig.PREFAB_BUNDLE, "list_cell.prefab", typeof(GameObject)) as GameObject;
        listView.limitNum     = 10; //not must to set limitNum
        for (int i = 0; i < 30; i++)
        {
            GameObject item = listView.dequeueItem();
            item.GetComponent <RectTransform>().sizeDelta = new Vector2(100, 40 + Random.Range(0, 40));
            item.GetComponent <Text>().text = i.ToString();
            listView.insertNodeAtLast(item);
        }
        listView.reloadData();

        gridView.cellsSize         = new Vector2(100, 100);
        gridView.cellTemplate.node = LLoadBundle.GetInstance().LoadAsset(LGameConfig.PREFAB_BUNDLE, "grid_cell.prefab", typeof(GameObject)) as GameObject;
        //gridView.cellTemplate.node = Resources.Load("Prefabs/grid_cell") as GameObject;
        gridView.cols       = 4;
        gridView.cellsCount = 100;
        gridView.onDataSourceAdapterHandler = (LGridViewCell cell, int idx) =>
        {
            if (cell == null)
            {
                cell      = new LGridViewCell();
                cell.node = (GameObject)Instantiate(gridView.cellTemplate.node);
            }
            cell.node.GetComponent <Text>().text = idx.ToString();
            return(cell);
        };
        gridView.reloadData();
    }