public override void Initial(ModelElement mod) { palette = new Palette(); callBackR = EventCallBack.RegEvent <EventCallBack>(mod); callBackR.IsCircular = true; callBackR.Drag = callBackR.DragEnd = DragingR; callBackR.PointerDown = PointDownR; NobA = mod.Find("NobA"); NobB = mod.Find("NobB"); hc = mod.Find("HTemplate"); template = hc.GetComponent <RawImageElement>(); callBackC = EventCallBack.RegEvent <EventCallBack>(hc); callBackC.Drag = callBackC.DragEnd = DragingC; callBackC.PointerDown = PointDownC; htemp = mod.GetComponent <RawImageElement>(); ThreadMission.InvokeToMain((o) => { htemp.Context.texture = Palette.LoadCTemplateAsync(); template.Context.texture = palette.texture; slider.Context.texture = Palette.AlphaTemplate(); }, null); palette.LoadHSVTAsync(1); SelectColor.a = 1; var son = mod.Find("Slider"); slider = son.GetComponent <RawImageElement>(); uISlider = new UISlider(); uISlider.Initial(son); uISlider.OnValueChanged = AlphaChanged; uISlider.Percentage = 1; }
public override void Initial(ModelElement mod) { model = mod; var scr = mod.Find("Scroll"); scroll = new ScrollY(); scroll.Initial(scr); var sli = mod.Find("Slider"); slider = new UISlider(); slider.Initial(sli); scroll.Scroll = (o, e) => { slider.Percentage = 1 - scroll.Pos; if (Scroll != null) { Scroll(o, e); } }; slider.OnValueChanged = (o) => { scroll.Pos = 1 - slider.Percentage; if (OnValueChanged != null) { OnValueChanged(o); } }; }
public LayoutAuxiliary(LayoutArea area) { layoutArea = area; layout = area.layout; model = new ModelElement(); model.Load(area.layout.Auxiliary.ModData); model.SetParent(area.model); model.Instantiate(); head = model.Find("Head"); head.Instantiate(); headHigh = head.data.sizeDelta.y; docker = model.Find("Docker"); docker.Instantiate(); docker.InstantiateChild(); docker.activeSelf = false; content = model.Find("Content"); content.Instantiate(); Item = model.Find("Item"); Item.activeSelf = false; Cover = model.Find("Cover"); Cover.activeSelf = false; panel = new StackPanel(); panel.direction = Direction.Horizontal; panel.Initial(head); InitialDocker(); }
public override void Initial(ModelElement mod) { var fill = mod.Find("FillImage"); if (fill != null) { fill.Instantiate(); FillImage = fill.Context; image = FillImage.GetComponent<Image>(); } var nob = mod.Find("Nob"); if (nob != null) { nob.Instantiate(); Nob = nob.Context; } model = mod.Context; callBack = EventCallBack.RegEvent<EventCallBack>(model); callBack.Drag = callBack.DragEnd = Draging; callBack.PointerDown = PointDown; callBack.AutoColor = false; var fake = mod.GetExtand(); if(fake!=null) { unsafe { info = *(SliderInfo*)fake.ip; } } }
public override void Initial(ModelElement mod) { Model = mod; callBack = EventCallBack.RegEvent <EventCallBack>(Model); callBack.Drag = callBack.DragEnd = Draging; callBack.PointerDown = PointDown; callBack.AutoColor = false; var child = mod.child; FillImage = mod.Find("FillImage"); if (FillImage != null) { image = FillImage.GetComponent <ImageElement>(); } Nob = mod.Find("Nob"); var fake = mod.GetExtand() as FakeStruct; if (fake != null) { unsafe { info = *(SliderInfo *)fake.ip; } } }
public override void Initial(ModelElement model) { base.Initial(model); View = model.Context; eventCall = EventCallBack.RegEvent <EventCallBack>(View); eventCall.Drag = (o, e, s) => { Scrolling(o, s); }; eventCall.DragEnd = (o, e, s) => { Scrolling(o, s); }; eventCall.Scrolling = Scrolling; eventCall.ForceEvent = true; Size = View.sizeDelta; View.anchorMin = View.anchorMax = View.pivot = ScrollContent.Center; eventCall.CutRect = true; Titles = new List <Item>(); Items = new List <Item>(); Tails = new List <Item>(); if (model != null) { TitleMod = model.Find("Title"); if (TitleMod != null) { TitleSize = TitleMod.data.sizeDelta; } ItemMod = model.Find("Item"); if (ItemMod != null) { ItemSize = ItemMod.data.sizeDelta; } TailMod = model.Find("Tail"); if (TailMod != null) { TailSize = TailMod.data.sizeDelta; } } }
public override void Initial(ModelElement model) { View = model; eventCall = EventCallBack.RegEvent <EventCallBack>(model); eventCall.Drag = (o, e, s) => { Scrolling(o, s); }; eventCall.DragEnd = (o, e, s) => { Scrolling(o, s); }; eventCall.Scrolling = Scrolling; eventCall.ForceEvent = true; Size = View.data.sizeDelta; eventCall.CutRect = true; Titles = new List <Item>(); Items = new List <Item>(); Tails = new List <Item>(); if (model != null) { TitleMod = model.Find("Title"); if (TitleMod != null) { TitleSize = TitleMod.data.sizeDelta; TitleMod.activeSelf = false; } ItemMod = model.Find("Item"); if (ItemMod != null) { ItemSize = ItemMod.data.sizeDelta; ItemMod.activeSelf = false; } TailMod = model.Find("Tail"); if (TailMod != null) { TailSize = TailMod.data.sizeDelta; TailMod.activeSelf = false; } } }
void InitialLabel() { Head = new ModelElement(); Head.Load(auxiliary.Item.ModData); Head.SetParent(auxiliary.head); label = Head.Find("Label"); var eve = EventCallBack.RegEvent <EventCallBack>(label); eve.PointerDown = HeadPointDown; eve.Click = HeadClick; eve.Drag = HeadDrag; eve.DragEnd = HeadDragEnd; eve.DataContext = this; var txt = label.GetComponent <TextElement>(); txt.text = name; txt.UseTextSize = true; close = Head.Find("Close"); if (close != null) { clo = EventCallBack.RegEvent <EventCallBack>(close); clo.DataContext = this; clo.Click = CloseClick; } }
public override void Initial(ModelElement mod) { model = mod; LineLevel = mod.Find("LineLevel"); AreaLevel = mod.Find("AreaLevel"); LineMod = mod.Find("Line"); LineMod.activeSelf = false; AreaMod = mod.Find("Area"); AreaMod.activeSelf = false; model.SizeChanged = SizeChanged; InitialFixLine(); InitialArea(); }
public void Initial(DockpanelArea area, ModelElement mod) { dockArea = area; model = mod; docker = model.Find("Docker"); tab = model.Find("TabControl"); Cover = model.Find("Cover"); control = new TabControl(); control.Initial(tab); mod.SetParent(area.model); Cover.activeSelf = false; docker.activeSelf = false; InitialDocker(); }
public override void Initial(ModelElement mod) { contents.Clear(); base.Initial(mod); Auxiliary = mod.Find("Auxiliary"); Auxiliary.activeSelf = false; Drag = mod.Find("Drag"); Drag.activeSelf = false; ModelElement au = new ModelElement(); au.Load(Auxiliary.ModData); MainContent = new DesignedDockContent(this); MainContent.Initial(MainArea, au); contents.Add(MainContent); }
/// <summary> /// 使用默认标签页 /// </summary> /// <param name="model"></param> /// <param name="label"></param> public void AddContent(ModelElement model, string label) { if (Item == null) { return; } TableContent content = new TableContent(); content.Parent = this; ModelElement mod = new ModelElement(); mod.Load(Item.ModData); mod.SetParent(Items); model.SetParent(Content); content.Item = mod; content.Label = mod.Find("Label"); content.Back = mod.Find("Back"); content.Content = model; var txt = mod.Find("Label").GetComponent <TextElement>(); if (txt != null) { txt.text = label; txt.AsyncApplyTextSizeY((o) => { panel.IsChanged = true; }); } mod.RegEvent <EventCallBack>(); mod.baseEvent.Click = ItemClick; mod.baseEvent.PointerEntry = ItemPointEntry; mod.baseEvent.PointerLeave = ItemPointLeave; content.eventCall = mod.baseEvent; content.eventCall.DataContext = content; if (curContent != null) { curContent.Content.activeSelf = false; if (curContent.Back != null) { curContent.Back.activeSelf = false; } } model.SetParent(Content); curContent = content; panel.IsChanged = true; contents.Add(curContent); }
public override void Initial(ModelElement mod) { main = mod; Label = mod.Find("Label"); ShowLabel = Label.GetComponent <TextElement>(); callBack = EventCallBack.RegEvent <EventCallBack>(mod); callBack.Click = Show; var scroll = mod.Find("Scroll"); if (scroll != null) { m_scroll = new ScrollY(); m_scroll.Initial(scroll); scroll.activeSelf = false; } }
public override void Initial(ModelElement element) { view = element; Size = element.data.sizeDelta; element.RegEvent <EventCallBack>(); eventCall = element.baseEvent; eventCall.Drag = (o, e, s) => { Scrolling(o, s); }; eventCall.DragEnd = (o, e, s) => { Scrolling(o, s); o.DecayRateX = 0.998f; o.DecayRateY = 0.998f; }; eventCall.ScrollEndX = OnScrollEndX; eventCall.ScrollEndY = OnScrollEndY; eventCall.Scrolling = Scrolling; eventCall.ForceEvent = true; view.data.anchorMin = view.data.anchorMax = view.data.pivot = new Vector2(0.5f, 0.5f); eventCall.CutRect = true; Content = element.Find("Content"); if (Content != null) { ContentSize = Content.data.sizeDelta; } }
public override void Initial(ModelElement mod) { mod.InstantiateChild(); var rect = mod.Context; palette = new Palette(); callBackR = EventCallBack.RegEvent <EventCallBack>(rect); callBackR.IsCircular = true; callBackR.Drag = callBackR.DragEnd = DragingR; callBackR.PointerDown = PointDownR; NobA = rect.Find("NobA") as RectTransform; NobB = rect.Find("NobB") as RectTransform; hc = rect.Find("HTemplate") as RectTransform; template = hc.GetComponent <RawImage>(); callBackC = EventCallBack.RegEvent <EventCallBack>(hc); callBackC.Drag = callBackC.DragEnd = DragingC; callBackC.PointerDown = PointDownC; htemp = rect.GetComponent <RawImage>(); htemp.texture = Palette.LoadCTemplateAsync(); template.texture = palette.texture; palette.LoadHSVTAsyncM(1); SelectColor.a = 1; var son = mod.Find("Slider"); slider = son.Context.GetComponent <RawImage>(); slider.texture = Palette.AlphaTemplate(); uISlider = new UISlider(); uISlider.Initial(son); uISlider.OnValueChanged = AlphaChanged; uISlider.Percentage = 1; }
public LayoutAuxiliary(DockpanelArea area) { layoutArea = area; layout = area.layout as DesignedDockPanel; model = new ModelElement(); model.Load(layout.Auxiliary.ModData); head = model.Find("Head"); panel = head.GetComponent <LayoutElement>(); headHigh = head.data.sizeDelta.y; docker = model.Find("Docker"); docker.activeSelf = false; content = model.Find("Content"); model.SetParent(area.model); Item = model.Find("Item"); Item.activeSelf = false; Cover = model.Find("Cover"); Cover.activeSelf = false; InitialDocker(); }
public override void Initial(ModelElement mod) { contents = new List <TableContent>(); Model = mod; Head = mod.Find("Head"); Items = Head.Find("Items"); if (Items != null) { panel = Items.GetComponent <LayoutElement>(); headHigh = Items.data.sizeDelta.y; } Item = Head.Find("Item"); if (Item != null) { Item.activeSelf = false; } Content = mod.Find("Content"); mod.SizeChanged = SizeChanged; }
public void ChangeItem(string item) { if (mModel != null) { m_point = 0; ItemMod = mModel.Find(item); if (ItemMod != null) { ItemSize = ItemMod.data.sizeDelta; } } }
public override void Initial(ModelElement mod) { Model = mod; input = EventCallBack.RegEvent <TextInput>(mod); mod_slider = mod.Find("Slider"); if (mod_slider != null) { slider = new UISlider(); slider.Initial(mod_slider); } InitialEvent(); }
public override void Initial(ModelElement mod) { model = mod; callBack = EventCallBack.RegEvent <EventCallBack>(model); callBack.Drag = Draging; callBack.DragEnd = DragEnd; callBack.PointerDown = PointDown; callBack.IsCircular = true; _r = mod.data.sizeDelta.x * 0.5f; _s = _r * _r; Nob = mod.Find("Nob"); }
public ItemContent AddContent(string name) { ModelElement item = new ModelElement(); item.Load(control.Item.ModData); ItemContent con = new ItemContent(); con.Parent = control; con.Item = item; item.RegEvent <EventCallBack>(); item.baseEvent.PointerDown = HeadPointDown; item.baseEvent.Drag = HeadDrag; item.baseEvent.DragEnd = HeadDragEnd; item.baseEvent.DataContext = con; var t = ModelElement.CreateNew(name); t.data.SizeScale = true; t.data.marginType = MarginType.Margin; con.Content = t; con.Back = item.Find("Back"); con.Label = item.Find("Label"); var txt = con.Label.GetComponent <TextElement>(); txt.text = name; txt.AsyncGetTextSizeX((o, e) => { o.model.data.sizeDelta = e; OrderHeadLabel(con); }); con.Close = item.Find("Close"); if (con.Close != null) { con.Close.RegEvent <EventCallBack>(); con.Close.baseEvent.Click = CloseClick; con.Close.baseEvent.DataContext = con; } control.AddContent(con); return(con); }
public override void Initial(ModelElement model) { Model = model; eventCall = EventCallBack.RegEvent <EventCallBack>(model); eventCall.Drag = (o, e, s) => { Scrolling(o, s); }; eventCall.DragEnd = (o, e, s) => { Scrolling(o, s); }; eventCall.ScrollEndY = OnScrollEnd; eventCall.Scrolling = Scrolling; eventCall.ForceEvent = true; Size = Model.data.sizeDelta; eventCall.CutRect = true; ItemParent = ModelElement.CreateNew("Items"); ItemParent.SetParent(model); TitleParent = ModelElement.CreateNew("Titles"); TitleParent.SetParent(model); if (model != null) { TitleMod = model.Find("Title"); if (TitleMod != null) { TitleSize = TitleMod.data.sizeDelta; TitleMod.activeSelf = false; } ItemMod = model.Find("Item"); if (ItemMod != null) { ItemSize = ItemMod.data.sizeDelta; ItemMod.activeSelf = false; } TailMod = model.Find("Tail"); if (TailMod != null) { TailSize = TailMod.data.sizeDelta; TailMod.activeSelf = false; } Body = model.Find("Body"); Body.activeSelf = false; } }
void InitialDocker() { var mod = docker.Find("Center"); var eve = EventCallBack.RegEvent <EventCallBack>(mod); eve.PointerUp = CenterPointUp; eve.PointerEntry = CenterPointEntry; eve.PointerLeave = PointLeave; mod = docker.Find("Left"); eve = EventCallBack.RegEvent <EventCallBack>(mod); eve.PointerUp = PointUp; eve.PointerEntry = LeftPointEntry; eve.PointerLeave = PointLeave; eve.DataContext = DockpanelArea.Dock.Left; mod = docker.Find("Top"); eve = EventCallBack.RegEvent <EventCallBack>(mod); eve.PointerUp = PointUp; eve.PointerEntry = TopPointEntry; eve.PointerLeave = PointLeave; eve.DataContext = DockpanelArea.Dock.Top; mod = docker.Find("Right"); eve = EventCallBack.RegEvent <EventCallBack>(mod); eve.PointerUp = PointUp; eve.PointerEntry = RightPointEntry; eve.PointerLeave = PointLeave; eve.DataContext = DockpanelArea.Dock.Right; mod = docker.Find("Down"); eve = EventCallBack.RegEvent <EventCallBack>(mod); eve.PointerUp = PointUp; eve.PointerEntry = DownPointEntry; eve.PointerLeave = PointLeave; eve.DataContext = DockpanelArea.Dock.Down; }
public UILinker <T, U> RegLinker <T, U>(string ItemName) where T : class, new() where U : class, new() { if (model == null) { return(null); } var mod = model.Find(ItemName); if (mod == null) { return(null); } UILinker <T, U> link = new UILinker <T, U>(this, mod); return(link); }
public override void Initial(ModelElement model) { base.Initial(model); eventCall = EventCallBack.RegEvent <EventCallBack>(model); eventCall.Drag = Draging; eventCall.DragEnd = (o, e, s) => { Scrolling(o, s); if (ItemDockCenter) { CenterScroll(this); } if (ScrollStart != null) { ScrollStart(this); } if (eventCall.VelocityX == 0) { OnScrollEnd(o); } }; eventCall.Scrolling = Scrolling; eventCall.ScrollEndX = OnScrollEnd; eventCall.ForceEvent = true; eventCall.AutoColor = false; Size = Model.data.sizeDelta; eventCall.CutRect = true; if (model != null) { var item = model.Find("Item"); if (item != null) { item.activeSelf = false; ItemMod = item.ModData; ItemSize = item.data.sizeDelta; } } model.SizeChanged = (o) => { Refresh(m_point, 0); }; }
public override void Initial(ModelElement mod) { model = mod; LineLevel = mod.Find("LineLevel"); LineLevel.Instantiate(); AreaLevel = mod.Find("AreaLevel"); AreaLevel.Instantiate(); LineMod = mod.Find("Line"); AreaMod = mod.Find("Area"); Auxiliary = mod.Find("Auxiliary"); Drag = mod.Find("Drag"); model.SizeChanged = SizeChanged; InitialFixLine(); InitialArea(); }
public override void Initial(ModelElement mod) { View = mod; eventCall = EventCallBack.RegEvent <EventCallBack>(mod); eventCall.Drag = (o, e, s) => { Scrolling(o, s); }; eventCall.DragEnd = (o, e, s) => { Scrolling(o, s); }; eventCall.Scrolling = Scrolling; eventCall.ForceEvent = true; eventCall.AutoColor = false; Size = View.data.sizeDelta; eventCall.CutRect = true; if (mod != null) { ItemMod = mod.Find("Item"); if (ItemMod != null) { ItemSize = ItemMod.data.sizeDelta; ItemHigh = ItemSize.y; } } }
public override void Initial(ModelElement model) { View = model.Context; eventCall = EventCallBack.RegEvent <EventCallBack>(View); eventCall.Drag = (o, e, s) => { Scrolling(o, s); }; eventCall.DragEnd = (o, e, s) => { Scrolling(o, s); }; eventCall.Scrolling = Scrolling; eventCall.ForceEvent = true; eventCall.AutoColor = false; Size = View.sizeDelta; View.anchorMin = View.anchorMax = View.pivot = ScrollContent.Center; eventCall.CutRect = true; if (model != null) { ItemMod = model.Find("Item"); if (ItemMod != null) { ItemSize = ItemMod.data.sizeDelta; ItemHigh = ItemSize.y; } } }
void Apply(RectTransform transform, ModelElement model) { ModelElement.LoadToObject(transform, ref model.data, model); var sc = transform.GetComponent <ShareImageChild>(); if (sc != null) { var sce = model.GetComponent <ShareImageChildElement>(); if (sce != null) { sc.color = sce.data.color; } } for (int i = 0; i < transform.childCount; i++) { var c = transform.GetChild(i); var mod = model.Find(c.name); if (mod != null) { Apply(c as RectTransform, mod); } } }
public override void Initial(ModelElement mod) { model = mod; var mask = model.Find("mask"); var y = mask.Find("Year"); Year = new ScrollY(); Year.Initial(y); Year.SetItemUpdate <ItemView, int>((o, e, i) => { o.Item.text = e.ToString() + unitY; }); Year.Scroll = Scrolling; Year.ScrollEnd = YearScrollToEnd; Year.ItemDockCenter = true; Year.scrollType = ScrollType.Loop; Year.eventCall.boxSize = new Vector2(120, 160); Year.eventCall.UseAssignSize = true; var m = mask.Find("Month"); Month = new ScrollY(); Month.Initial(m); Month.SetItemUpdate <ItemView, string>((o, e, i) => { o.Item.text = e + unitM; }); Month.Scroll = Scrolling; Month.ScrollEnd = MonthScrollToEnd; Month.ItemDockCenter = true; Month.scrollType = ScrollType.Loop; Month.eventCall.boxSize = new Vector2(120, 160); Month.eventCall.UseAssignSize = true; var d = mask.Find("Day"); Day = new ScrollY(); Day.Initial(d); Day.SetItemUpdate <ItemView, string>((o, e, i) => { o.Item.text = e + unitD; }); Day.Scroll = Scrolling; Day.ScrollEnd = DayScrollToEnd; Day.ItemDockCenter = true; Day.ScrollEnd = DayScrollToEnd; Day.scrollType = ScrollType.Loop; Day.eventCall.boxSize = new Vector2(120, 160); Day.eventCall.UseAssignSize = true; var fs = mod.GetExtand() as FakeStruct; if (fs != null) { StartYear = fs[0]; EndYear = fs[1]; if (EndYear < StartYear) { EndYear = StartYear; } } year = StartYear; month = 1; day = 1; int len = EndYear - StartYear; ys = new int[len]; int s = StartYear; for (int i = 0; i < len; i++) { ys[i] = s; s++; } Year.BindingData = ys; Year.Refresh(); ms = new string[12]; for (int i = 0; i < 12; i++) { ms[i] = (i + 1).ToString(); } Month.BindingData = ms; Month.Refresh(); Days = new List <string>(); for (int i = 0; i < 31; i++) { Days.Add((i + 1).ToString()); } Day.BindingData = Days; Day.Refresh(); UpdateItems(Year); UpdateItems(Month); UpdateItems(Day); }