Exemplo n.º 1
0
        protected TreeViewItem CreateItem()
        {
            TreeViewItem it = queue.Dequeue();

            if (it != null)
            {
                it.target.SetActive(true);
                return(it);
            }
            GameObject g = ModelManagerUI.LoadToGame(ItemMod, null);
            var        t = g.transform;

            t.SetParent(View);
            t.localPosition    = new Vector3(10000, 10000);
            t.localScale       = Vector3.one;
            t.localEulerAngles = Vector3.zero;
            TreeViewItem a = new TreeViewItem();

            a.target         = g;
            a.text           = g.GetComponent <Text>();
            a.callBack       = EventCallBack.RegEvent <EventCallBack>(g.transform as RectTransform);
            a.callBack.Click = (o, e) => {
                var item = o.DataContext as TreeViewItem;
                if (item.node != null)
                {
                    item.node.extand = !item.node.extand;
                    Refresh();
                }
            };
            a.callBack.DataContext = a;
            return(a);
        }
Exemplo n.º 2
0
        void InitialLabel()
        {
            Head = new ModelElement();
            Head.Load(auxiliary.Item.ModData);
            Head.SetParent(auxiliary.head);
            ModelManagerUI.LoadToGame(Head, null);

            label = Head.Find("Label");
            var eve = EventCallBack.RegEvent <EventCallBack>(label.Context);

            eve.PointerDown = HeadPointDown;
            eve.Click       = HeadClick;
            eve.Drag        = HeadDrag;
            eve.DragEnd     = HeadDragEnd;
            eve.DataContext = this;
            var txt = label.Main.GetComponent <Text>();

            txt.text = name;

            close = Head.Find("Close");
            if (close != null)
            {
                clo             = EventCallBack.RegEvent <EventCallBack>(close.Context);
                clo.DataContext = this;
                clo.Click       = CloseClick;
            }
        }
Exemplo n.º 3
0
    public T LoadUI <T>(string asset, string name) where T : class, new()
    {
        model = ModelManagerUI.CloneModel(asset, name);
        T t = new T();

        ModelManagerUI.LoadToGame(model, t);
        return(t);
    }
Exemplo n.º 4
0
        public LinkerMod CreateUI()
        {
            T         ui  = new T();
            LinkerMod mod = new LinkerMod();

            mod.main = ModelManagerUI.LoadToGame(model, ui);
            mod.UI   = ui;
            return(mod);
        }
Exemplo n.º 5
0
        public LinkerMod CreateUI()
        {
            LinkerMod mod = new LinkerMod();

            mod.main = ModelManagerUI.LoadToGame(model, null);
            if (ItemCreate != null)
            {
                ItemCreate(this, mod);
            }
            return(mod);
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
0
 Item GetTail(int index)
 {
     while (index >= Tails.Count)
     {
         Item i = new Item();
         if (TailMod != null)
         {
             i.target = ModelManagerUI.LoadToGame(TailMod, null);
             var t = i.target.transform;
             t.SetParent(View);
             t.localScale = new Vector3(1, 1, 1);
         }
         Tails.Add(i);
     }
     Tails[index].target.SetActive(true);
     return(Tails[index]);
 }
Exemplo n.º 8
0
    public override void LoadTestPage()
    {
        Application.targetFrameRate = 60;
#if UNITY_IPHONE || UNITY_ANDROID
        //Scale.DpiScale = true;
#endif
        //UIPage.LoadPage<DrawPage>();
        //UIPage.LoadPage<LayoutTestPage>();
        //UIPage.LoadPage<TestPage>();
        win = new WinForm("tool");
        win.SetCanvas(canvas.transform as RectTransform);
        win.BindingCamera(camera, canvas);
        var page  = win.AddNode("page");
        var model = ModelManagerUI.CloneModel("baseUI", "testpage");
        view = new View();
        ModelManagerUI.LoadToGame(model, view);
        model.SetParent(page);
        view.but.Click = (o, e) => { Debug.Log("click is ok"); };
    }
Exemplo n.º 9
0
        void Initialtems()
        {
            int c = max_count;

            for (int i = 0; i < c; i++)
            {
                if (i >= Items.Count)
                {
                    GameObject g = ModelManagerUI.LoadToGame(ItemMod, null);
                    var        t = g.transform;
                    t.SetParent(View);
                    t.localScale = new Vector3(1, 1, 1);
                    Item a = new Item();
                    a.target = g;
                    Items.Add(a);
                }
            }
            for (int i = Items.Count - 1; i >= c; i--)
            {
                var g = Items[i];
                Items.RemoveAt(i);
                ModelManagerUI.RecycleGameObject(g.target);
            }
        }