Пример #1
0
        protected ScrollItem CreateItem()
        {
            if (Recycler.Count > 0)
            {
                var it = Recycler[0];
                it.target.SetActive(true);
                it.index = -1;
                Recycler.RemoveAt(0);
                return(it);
            }
            GameObject   go    = null;
            ScrollItem   a     = new ScrollItem();
            ModelElement model = new ModelElement();

            model.Load(ItemMod.ModData);
            model.SetParent(Model);
            if (creator != null)
            {
                if (creator.hotfix)
                {
                    go = ModelManagerUI.LoadToGame(model, null);
                    if (creator.reflect != null)
                    {
                        a.obj = creator.reflect(go);
                    }
                    else
                    {
                        a.obj = go;
                    }
                    a.target = go;
                }
                else
                {
                    a.obj    = creator.Create();
                    go       = ModelManagerUI.LoadToGame(model, a.obj);
                    a.target = go;
                }
            }
            else
            {
                go       = ModelManagerUI.LoadToGame(model, null);
                a.target = go;
                a.obj    = go;
            }
            return(a);
        }
        protected ScrollItem CreateItem(List <ScrollItem> buffer, Constructor con, ModelElement mod, ModelElement parent)
        {
            if (buffer.Count > 0)
            {
                var it = buffer[0];
                it.target.activeSelf = true;
                it.index             = -1;
                buffer.RemoveAt(0);
                return(it);
            }
            ModelElement me = new ModelElement();

            me.Load(mod.ModData);
            me.SetParent(parent);
            ScrollItem a = new ScrollItem();

            a.target = me;
            if (con == null)
            {
                a.obj = me;
            }
            else
            {
                if (con.hotfix)
                {
                    if (con.reflect != null)
                    {
                        a.obj = con.reflect(me);
                    }
                    else
                    {
                        a.obj = me;
                    }
                }
                else
                {
                    a.obj = con.Create();
                    ModelManagerUI.ComponentReflection(me, a.obj);
                }
            }
            return(a);
        }