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); }
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); } }
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(); }
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>(); }; }
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); }
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"); }
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); }
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; }
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>(); }; }
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); }; }
public LinkerMod CreateUI() { LinkerMod mod = new LinkerMod(); mod.main = ModelManagerUI.LoadToGame(model, null); if (ItemCreate != null) { ItemCreate(this, mod); } return(mod); }
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>(); }; }
// 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>(); }; }
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>(); }; }
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); } }
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)); }
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; }
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(); }
public override void Dispose() { if (pops != null) { for (int i = 0; i < pops.Count; i++) { pops[i].Dispose(); } } pops.Clear(); ModelManagerUI.RecycleElement(model); ClearUI(); }
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(); }
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); } }
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; }