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
    public static ModelElement LoadToGame(string mod, object o, Transform parent, string filter = "mod")
    {
        var m = ModelManagerUI.FindModel(mod);

        LoadToGame(m, o, parent, filter);
        return(m);
    }
        void Initialtems()
        {
            int c = max_count;

            for (int i = 0; i < c; i++)
            {
                if (i >= Items.Count)
                {
                    ModelElement mod = new ModelElement();
                    mod.Load(ItemMod.ModData);
                    mod.SetParent(View);
                    mod.data.localScale = new Vector3(1, 1, 1);
                    mod.IsChanged       = true;
                    Item a = new Item();
                    a.target = mod;
                    Items.Add(a);
                }
            }
            for (int i = Items.Count - 1; i >= c; i--)
            {
                var g = Items[i];
                Items.RemoveAt(i);
                ModelManagerUI.RecycleElement(g.target);
            }
        }
Exemplo n.º 4
0
    public override void Initial(ModelElement parent, object dat = null)
    {
        model = ModelManagerUI.CloneModel("baseUI", "layout");
        base.Initial(parent, dat);
        view = model.ComponentReflection <View>();
        var area = view.Layout.MainArea;

        area.auxiliary.AddContent("page0");
        var d       = area.AddArea(LayoutArea.Dock.Down, 0.3f);
        var context = d.auxiliary.AddContent("page1");

        d.model.GetComponent <ImageElement>().color = Color.red;
        var one = d.AddArea(LayoutArea.Dock.Right, 0.4f);

        context = one.auxiliary.AddContent("page2");
        context.LoadPopWindow <GridTestWindow>();
        d.auxiliary.Refresh();

        one.model.GetComponent <ImageElement>().color = Color.green;
        var top = area.AddArea(LayoutArea.Dock.Top, 0.2f);

        top.auxiliary.AddContent("page3");
        top.model.GetComponent <ImageElement>().color = Color.yellow;

        var l = top.AddArea(LayoutArea.Dock.Left, 0.4f);

        l.model.GetComponent <ImageElement>().color = Color.blue;
        l.auxiliary.headDock = LayoutAuxiliary.HeadDock.Down;

        context = l.auxiliary.AddContent("page5");
        context.LoadPopWindow <GridTestWindow2>();
        l.auxiliary.Refresh();
    }
Exemplo n.º 5
0
    public override void Initial(ModelElement parent, object dat = null)
    {
        model = ModelManagerUI.CloneModel("baseUI", "layout");
        base.Initial(parent, dat);
        view = model.ComponentReflection <View>();
        var area = view.Layout.MainContent;

        area.AddContent("page0");
        var d       = area.AddArea(DockpanelArea.Dock.Down, 0.3f);
        var context = d.AddContent("page1");

        d.model.parent.GetComponent <ImageElement>().color = Color.red;
        var one = d.AddArea(DockpanelArea.Dock.Right, 0.4f);

        context = one.AddContent("page2");
        context.LoadPopWindow <GridTestWindow>();
        //d.Refresh();

        one.model.parent.GetComponent <ImageElement>().color = Color.green;
        var top = area.AddArea(DockpanelArea.Dock.Top, 0.2f);

        top.AddContent("page3");

        top.model.parent.GetComponent <ImageElement>().color = Color.yellow;
        var l = top.AddArea(DockpanelArea.Dock.Left, 0.4f);

        l.model.parent.GetComponent <ImageElement>().color = Color.blue;
        l.control.headDock = TabControl.HeadDock.Down;

        context = l.AddContent("page5");
        context.LoadPopWindow <GridTestWindow2>();
        //l.Refresh();
        view.Last.Click = (o, e) => { LoadPage <TestPage>(); };
        view.Next.Click = (o, e) => { LoadPage <DrawPage>(); };
    }
Exemplo n.º 6
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;
            }
        }
 /// <summary>
 /// 释放某个标签和其内容,其对象会被回收
 /// </summary>
 /// <param name="table"></param>
 public void ReleseContent(TableContent table)
 {
     contents.Remove(table);
     table.Content.SetParent(null);
     table.Item.SetParent(null);
     ModelManagerUI.RecycleElement(table.Content);
     ModelManagerUI.RecycleElement(table.Item);
 }
Exemplo n.º 8
0
 public override void Initial(ModelElement parent, object dat = null)
 {
     model = ModelManagerUI.CloneModel("baseUI", "tab");
     base.Initial(parent, dat);
     view = HotReflection.ComponentReflection <View>(model);
     view.col.AddContent(ModelElement.CreateNew("test"), "test");
     view.col.AddContent(ModelElement.CreateNew("testB"), "testB");
 }
Exemplo n.º 9
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.º 10
0
 void CloseClick(EventCallBack eventCall, UserAction action)
 {
     Head.SetParent(null);
     ModelManagerUI.RecycleElement(Head);
     model.SetParent(null);
     ModelManagerUI.RecycleElement(model);
     auxiliary.RemoveContent(this);
     auxiliary.panel.IsChanged = true;
 }
Exemplo n.º 11
0
        public LinkerMod CreateUI()
        {
            T         ui  = new T();
            LinkerMod mod = new LinkerMod();

            mod.main = ModelManagerUI.LoadToGame(model, ui);
            mod.UI   = ui;
            return(mod);
        }
    public override void Initial(ModelElement parent, object dat = null)
    {
        model = ModelManagerUI.CloneModel("baseUI", "scrollex");
        base.Initial(parent, dat);
        view = model.ComponentReflection <View>();
        List <ScrollYExtand.DataTemplate> datas = new List <ScrollYExtand.DataTemplate>();

        ScrollYExtand.DataTemplate tmp = new ScrollYExtand.DataTemplate();
        tmp.Title = "test1";
        List <string> list = new List <string>();

        for (int i = 0; i < 22; i++)
        {
            list.Add("tttt" + i.ToString());
        }
        tmp.Hide = true;
        tmp.Data = list;
        datas.Add(tmp);

        tmp       = new ScrollYExtand.DataTemplate();
        tmp.Title = "test2";
        list      = new List <string>();
        for (int i = 0; i < 11; i++)
        {
            list.Add("tttt" + i.ToString());
        }
        tmp.Hide = true;
        tmp.Data = list;
        datas.Add(tmp);

        tmp       = new ScrollYExtand.DataTemplate();
        tmp.Title = "test3";
        list      = new List <string>();
        for (int i = 0; i < 7; i++)
        {
            list.Add("tttt" + i.ToString());
        }
        tmp.Hide = true;
        tmp.Data = list;
        datas.Add(tmp);

        view.scroll.BindingData = datas;
        view.scroll.SetTitleUpdate <TitleItem, ScrollYExtand.DataTemplate>(TitleUpdate);
        view.scroll.SetItemUpdate <SubItem, string>(ItemUpdate);
        view.scroll.Refresh();

        List <string> rr = new List <string>();

        for (int i = 0; i < 33; i++)
        {
            rr.Add(i.ToString());
        }
        view.Dropdown.BindingData = rr;

        view.Last.Click = (o, e) => { LoadPage <DrawPage>(); };
        view.Next.Click = (o, e) => { LoadPage <ChatBoxPage>(); };
    }
 public override void Initial(ModelElement parent, object dat = null)
 {
     model = ModelManagerUI.CloneModel("baseUI", "gif");
     base.Initial(parent, dat);
     view = model.ComponentReflection <View>();
     ThreadMission.InvokeToMain(LoadGif, null);
     view.Last.Click = (o, e) => { LoadPage <AniTestPage>(); };
     view.Next.Click = (o, e) => { LoadPage <TestPage>(); };
 }
Exemplo n.º 14
0
 public override void Initial(ModelElement parent, UIBase ui, object obj = null)
 {
     model = ModelManagerUI.CloneModel("baseUI", "Menu");
     base.Initial(parent, ui, obj);
     view            = model.ComponentReflection <View>();
     view.Menu.Click = (o, e) => {
         UIMenu.Instance.HideMenu();
         Context.Cmd("menu", e);
     };
 }
Exemplo n.º 15
0
        public LinkerMod CreateUI()
        {
            LinkerMod mod = new LinkerMod();

            mod.main = ModelManagerUI.LoadToGame(model, null);
            if (ItemCreate != null)
            {
                ItemCreate(this, mod);
            }
            return(mod);
        }
Exemplo n.º 16
0
 public override void Initial(ModelElement parent, object dat = null)
 {
     model = ModelManagerUI.CloneModel("baseUI", "anitest");
     base.Initial(parent, dat);
     view = model.ComponentReflection <View>();
     view.rocker.Rocking = Rocking;
     view.rocker.Radius  = 100;
     view.render.LoadAsync <RolePage>(null);
     view.Last.Click = (o, e) => { LoadPage <ShareImagePage>(); };
     view.Next.Click = (o, e) => { LoadPage <ShowGifPage>(); };
 }
Exemplo n.º 17
0
    // Start is called before the first frame update
    void Start()
    {
        App.Initial(transform as RectTransform);
        ModelManagerUI.LoadModels(baseUI.bytes, "baseUI");

        ElementAsset.LoadAssetsAsync("picture.unity3d").PlayOver = (o, e) =>
        {
            UIPage.LoadPage <LoadingPage>();
            //ShowPopWindow<PropKeyWin>();
        };
    }
Exemplo n.º 18
0
 public override void Initial(ModelElement parent, object dat = null)
 {
     model = ModelManagerUI.CloneModel("baseUI", "anitest");
     base.Initial(parent, dat);
     view = HotReflection.ComponentReflection <View>(model);
     view.rocker.Rocking = Rocking;
     view.rocker.Radius  = 100;
     view.render.LoadAsync(() => new RolePageH(), null);
     view.Last.Click = (o, e) => { LoadPage <ScrollExTestPageH>(); };
     view.Next.Click = (o, e) => { LoadPage <TestPageH>(); };
 }
 public override void Initial(ModelElement parent, object dat = null)
 {
     model = ModelManagerUI.CloneModel("baseUI", "shareimg");
     base.Initial(parent, dat);
     view              = model.ComponentReflection <View>();
     view.head.Click   = (o, e) => { Debug.Log("head click"); };
     view.body.Click   = (o, e) => { Debug.Log("body click"); };
     view.weapon.Click = (o, e) => { Debug.Log("weapon click"); };
     view.Last.Click   = (o, e) => { LoadPage <ChatBoxPage>(); };
     view.Next.Click   = (o, e) => { LoadPage <AniTestPage>(); };
 }
Exemplo n.º 20
0
    public static void ComponentReflection(ModelElement mod, object obj)
    {
        var r = ObjectFelds(obj);

        ModelManagerUI.LoadToGameR(mod, r, "");
        ReflectionModel[] all = r.All;
        for (int i = 0; i < all.Length; i++)
        {
            all[i].field.SetValue(obj, all[i].Value);
        }
    }
Exemplo n.º 21
0
 public static void InitialUI()
 {
     ModelManagerUI.RegComponent(new ComponentType <RectTransform, ModelElement>(ModelElement.LoadFromObject));
     ModelManagerUI.RegComponent(new ComponentType <Image, ImageElement>(ImageElement.LoadFromObject));
     ModelManagerUI.RegComponent(new ComponentType <EmojiText, TextElement>(TextElement.LoadFromObject));
     ModelManagerUI.RegComponent(new ComponentType <Text, TextElement>(TextElement.LoadFromObject));
     ModelManagerUI.RegComponent(new ComponentType <CustomRawImage, RawImageElement>(RawImageElement.LoadFromObject));
     ModelManagerUI.RegComponent(new ComponentType <RawImage, RawImageElement>(RawImageElement.LoadFromObject));
     ModelManagerUI.RegComponent(new ComponentType <RectMask2D, RectMaskElement>(RectMaskElement.LoadFromObject));
     ModelManagerUI.RegComponent(new ComponentType <Mask, MaskElement>(MaskElement.LoadFromObject));
     ModelManagerUI.RegComponent(new ComponentType <Outline, OutLineElement>(OutLineElement.LoadFromObject));
 }
Exemplo n.º 22
0
 static void CloneAll(byte[] ui, Transform root)
 {
     if (ui != null)
     {
         LoadBundle();
         InitialUI();
         var          all     = ModelManagerUI.LoadModels(ui, "assTest");
         ModelElement element = new ModelElement();
         element.Load(all.models.ModData);
         element.Apply();
     }
 }
    // Start is called before the first frame update
    void Start()
    {
        App.Initial(transform as RectTransform);
        ModelManagerUI.LoadModels(baseUI.bytes, "baseUI");
#if UNITY_EDITOR
        AssetBundle.UnloadAllAssetBundles(true);
#endif
        ElementAsset.LoadAssetsAsync("base.unity3d").PlayOver = (o, e) =>
        {
            UIPage.LoadPage <TestPage>();
        };
    }
        public void SetTailUpdate <T, U>(Action <T, U, int> action) where T : class, new()
        {
            for (int i = 0; i < Tails.Count; i++)
            {
                ModelManagerUI.RecycleElement(Tails[i].target);
            }
            Tails.Clear();
            var m = new Middleware <T, U>();

            m.Invoke    = action;
            TailCreator = m;
        }
Exemplo n.º 25
0
 public void Dispose()
 {
     for (int i = 0; i < Titles.Count; i++)
     {
         ModelManagerUI.RecycleGameObject(Titles[i].target);
     }
     for (int i = 0; i < Items.Count; i++)
     {
         ModelManagerUI.RecycleGameObject(Items[i].target);
     }
     Titles.Clear();
     Items.Clear();
 }
Exemplo n.º 26
0
 public override void Dispose()
 {
     if (pops != null)
     {
         for (int i = 0; i < pops.Count; i++)
         {
             pops[i].Dispose();
         }
     }
     pops.Clear();
     ModelManagerUI.RecycleElement(model);
     ClearUI();
 }
Exemplo n.º 27
0
 public void Clear()
 {
     for (int i = 0; i < items.Count; i++)
     {
         ModelManagerUI.RecycleElement(items[i].main);
     }
     items.Clear();
     point = 0;
     start = 0;
     end   = 0;
     ch    = 0;
     datas.Clear();
 }
Exemplo n.º 28
0
 public void Dispose()
 {
     if (Left.realLine | Right.realLine | Top.realLine | Down.realLine)
     {
         Left.Right.Remove(this);
         Right.Left.Remove(this);
         Top.Down.Remove(this);
         Down.Top.Remove(this);
         model.SetParent(null);
         MergeArea();
         ModelManagerUI.RecycleElement(model);
         layout.areas.Remove(this);
     }
 }
Exemplo n.º 29
0
        void Order()
        {
            float vy = View.data.sizeDelta.y;
            int   c  = items.Count - 1;
            int   ss = 0;

            for (int i = c; i >= 0; i--)
            {
                var   item = items[i];
                float sy   = item.offset;
                float ey   = sy + item.high;
                if (sy - point > vy)
                {
                    ModelManagerUI.RecycleElement(item.main);
                    items.RemoveAt(i);
                }
                else if (ey < point)
                {
                    ModelManagerUI.RecycleElement(item.main);
                    items.RemoveAt(i);
                }
                else
                {
                    float oy = 0.5f * vy - sy + point;
                    item.pos.y = oy;
                    item.main.data.localPosition = new Vector3(0, oy, 0);
                    item.main.IsChanged          = true;
                    ss = item.Index;
                }
            }
            ss -= 10;
            if (ss < 0)
            {
                ss = 0;
            }
            float over = point + vy;

            for (; ss < datas.Count; ss++)
            {
                var item = datas[ss];
                if (item.offset > over)
                {
                    break;
                }
                if (item.offset + item.high > point)
                {
                    UpdateItem(item, ss);
                }
            }
        }
        public void SetTailUpdate(Action <object, object, int> action, Func <ModelElement, object> reflect)
        {
            for (int i = 0; i < Items.Count; i++)
            {
                ModelManagerUI.RecycleElement(Items[i].target);
            }
            Tails.Clear();
            var m = new Middleware <ModelElement, object>();

            m.Update    = action;
            m.hotfix    = true;
            m.reflect   = reflect;
            TailCreator = m;
        }