public override void Initial(FakeStruct mod, UIElement script, Initializer initializer) { base.Initial(mod, script, initializer); var trans = Enity.transform; Label = trans.Find("Label").GetComponent <HText>(); callBack = Enity.RegEvent <UserEvent>(); callBack.Click = Show; var scroll = trans.Find("Scroll"); if (scroll != null) { scroll.gameObject.SetActive(false); var ui = scroll.GetComponent <UIElement>(); if (ui != null) { m_scroll = ui.composite as ScrollY; if (m_scroll != null) { m_scroll.SetItemUpdate <PopItemMod, object>(ItemUpdate); m_scroll.eventCall.LostFocus = LostFocus; m_scroll.eventCall.DataContext = this; } } } }
void Show(EventCallBack back, UserAction action) { if (m_scroll != null) { if (ItemMod != null) { m_scroll.ItemMod = ItemMod; } m_scroll.BindingData = BindingData; m_scroll.SetItemUpdate <object, object>(ItemUpdate); m_scroll.eventCall.LostFocus = LostFocus; m_scroll.eventCall.DataContext = this; main.SetAsLastSibling(); Dock(); action.AddFocus(m_scroll.eventCall); } }
public override void Initial(FakeStruct mod, UIElement script, UIInitializer initializer) { base.Initial(mod, script, initializer); Label = Enity.Find("Label") as HText; callBack = Enity.RegEvent <UserEvent>(); callBack.Click = Show; var scroll = Enity.Find("Scroll"); if (scroll != null) { scroll.activeSelf = false; m_scroll = scroll.composite as ScrollY; if (m_scroll != null) { m_scroll.SetItemUpdate <PopItemMod, object>(ItemUpdate); m_scroll.eventCall.LostFocus = LostFocus; m_scroll.eventCall.DataContext = this; } } }
public override void Initial(FakeStruct mod, UIElement element, Initializer initializer) { base.Initial(mod, element, initializer); var mui = Enity.GetComponent <UIElement>(); mui.userEvent.CutRect = true; var mask = Enity.transform; Year = mask.Find("Year").GetComponent <UIElement>().composite as ScrollY; Year.SetItemUpdate <ItemView, int>((o, e, i) => { o.Item.Text = e.ToString(); }); Year.Scroll = Scrolling; Year.ScrollEnd = YearScrollToEnd; Year.ItemDockCenter = true; Year.scrollType = ScrollType.Loop; Month = mask.Find("Month").GetComponent <UIElement>().composite as ScrollY; Month.SetItemUpdate <ItemView, string>((o, e, i) => { o.Item.Text = e; }); Month.Scroll = Scrolling; Month.ScrollEnd = MonthScrollToEnd; Month.ItemDockCenter = true; Month.scrollType = ScrollType.Loop; Day = mask.Find("Day").GetComponent <UIElement>().composite as ScrollY; Day.SetItemUpdate <ItemView, string>((o, e, i) => { o.Item.Text = e; }); Day.Scroll = Scrolling; Day.ScrollEnd = DayScrollToEnd; Day.ItemDockCenter = true; Day.ScrollEnd = DayScrollToEnd; Day.scrollType = ScrollType.Loop; var ex = UITransfromLoader.GetCompositeData(mod); if (ex != null) { StartYear = ex[0]; EndYear = ex[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); }
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); }