/// <summary> /// 初始化 /// </summary> /// <param name="fake">数据模型</param> /// <param name="script">元素主体</param> public override void Initial(FakeStruct fake, UIElement script, Initializer initializer) { base.Initial(fake, script, initializer); items = new List <Item>(); eventCall = Enity.RegEvent <UserEvent>(); eventCall.AutoColor = false; eventCall.ForceEvent = true; eventCall.Drag = (o, e, s) => { Scrolling(o, s); }; eventCall.DragEnd = (o, e, s) => { if (o.VelocityY == 0) { OnScrollEnd(o); } else { Scrolling(o, s); } }; eventCall.Scrolling = Scrolling; eventCall.ScrollEndY = OnScrollEnd; eventCall.MouseWheel = (o, e) => { Move(e.MouseWheelDelta * 100); }; model = fake; var trans = Enity.transform; HGUIManager.GameBuffer.RecycleChild(trans.gameObject); }
/// <summary> /// 初始化 /// </summary> /// <param name="fake">数据模型</param> /// <param name="element">主体元素</param> public override void Initial(FakeStruct fake, UIElement element, Initializer initializer) { base.Initial(fake, element, initializer); element.SizeChanged = (o) => { Refresh(); }; eventCall = Enity.RegEvent <UserEvent>(); 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 = Enity.SizeDelta; eventCall.CutRect = true; var trans = element.transform; BodyParent = trans.Find("Bodys"); TitleParent = trans.Find("Titles"); HGUIManager.GameBuffer.RecycleChild(Enity.gameObject, new string[] { "Bodys", "Titles" }); TitleMod = HGUIManager.FindChild(fake, "Title"); ItemMod = HGUIManager.FindChild(fake, "Item"); TailMod = HGUIManager.FindChild(fake, "Tail"); Body = HGUIManager.FindChild(fake, "Body"); unsafe { ItemSize = ((UITransfromData *)ItemMod.ip)->size; TitleSize = ((UITransfromData *)TitleMod.ip)->size; if (TailMod != null) { TailSize = ((UITransfromData *)TailMod.ip)->size; } } }
/// <summary> /// 初始化 /// </summary> /// <param name="fake">数据模型</param> /// <param name="element">主体元素</param> public override void Initial(FakeStruct fake, UIElement element, UIInitializer initializer) { base.Initial(fake, element, initializer); element.SizeChanged = (o) => { Refresh(); }; eventCall = Enity.RegEvent <UserEvent>(); eventCall.PointerDown = (o, e) => { UpdateVelocity = false; }; eventCall.Drag = (o, e, s) => { Scrolling(o, s); }; eventCall.DragEnd = OnDragEnd; eventCall.MouseWheel = (o, e) => { Point += BounceBack((e.MouseWheelDelta * 100)); Order(); UpdateVelocity = true; }; eventCall.ForceEvent = true; Size = Enity.SizeDelta; eventCall.CutRect = true; BodyParent = element.Find("Bodys"); TitleParent = element.Find("Titles"); HGUIManager.RecycleChild(Enity, new string[] { "Bodys", "Titles" }); TitleMod = HGUIManager.FindChild(fake, "Title"); ItemMod = HGUIManager.FindChild(fake, "Item"); TailMod = HGUIManager.FindChild(fake, "Tail"); Body = HGUIManager.FindChild(fake, "Body"); ItemSize = UIElementLoader.GetSize(ItemMod); TitleSize = UIElementLoader.GetSize(TitleMod); if (TailMod != null) { TailSize = UIElementLoader.GetSize(TailMod); } }
/// <summary> /// 初始化 /// </summary> /// <param name="fake">数据模型</param> /// <param name="script">元素主体</param> public override void Initial(FakeStruct fake, UIElement script, Initializer initializer) { base.Initial(fake, script, initializer); Size = Enity.SizeDelta; eventCall = Enity.RegEvent <UserEvent>(); 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; eventCall.CutRect = true; var chi = Enity.transform.Find("Content"); if (chi != null) { Content = chi.GetComponent <UIElement>(); if (Content != null) { ContentSize = Content.SizeDelta; } } }
public override void Initial(FakeStruct mod, UIElement script) { base.Initial(mod, script); var trans = script.transform; callBack = Enity.RegEvent <UserEvent>(); callBack.Drag = callBack.DragEnd = Draging; callBack.PointerDown = PointDown; callBack.AutoColor = false; var tmp = trans.Find("FillImage"); if (tmp != null) { FillImage = tmp.GetComponent <HImage>(); } tmp = trans.Find("Nob"); Nob = tmp.GetComponent <HImage>(); unsafe { var ex = mod.buffer.GetData(((TransfromData *)mod.ip)->ex) as FakeStruct; if (ex != null) { info = *(SliderInfo *)ex.ip; } } }
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; } } } }
public override void Initial(FakeStruct mod, UIElement script, Initializer initializer) { base.Initial(mod, script, initializer); var trans = script.transform; callBack = Enity.RegEvent <UserEvent>(); callBack.Drag = Draging; callBack.DragEnd = DragEnd; callBack.PointerDown = PointDown; callBack.AutoColor = false; var tmp = trans.Find("FillImage"); if (tmp != null) { FillImage = tmp.GetComponent <HImage>(); } tmp = trans.Find("Nob"); Nob = tmp.GetComponent <HImage>(); unsafe { var ex = UITransfromLoader.GetCompositeData(mod); if (ex != null) { info = *(SliderInfo *)ex.ip; } } }
/// <summary> /// 初始化 /// </summary> /// <param name="fake">数据模型</param> /// <param name="script">元素主体</param> public override void Initial(FakeStruct fake, UIElement script, UIInitializer initializer) { base.Initial(fake, script, initializer); items = new List <Item>(); eventCall = Enity.RegEvent <UserEvent>(); eventCall.AutoColor = false; eventCall.ForceEvent = true; eventCall.PointerDown = (o, e) => { UpdateVelocity = false; }; eventCall.Drag = (o, e, s) => { Scrolling(o, s); }; eventCall.DragEnd = OnDragEnd; //eventCall.Scrolling = Scrolling; //eventCall.ScrollEndY = OnScrollEnd; eventCall.MouseWheel = (o, e) => { Move(e.MouseWheelDelta * 100); UpdateVelocity = true; }; model = fake; HGUIManager.RecycleChild(Enity); }
public override void Initial(FakeStruct mod, UIElement script, UIInitializer initializer) { base.Initial(mod, script, initializer); callBack = Enity.RegEvent <UserEvent>(); callBack.Drag = Draging; callBack.DragEnd = DragEnd; callBack.PointerDown = PointDown; callBack.AutoColor = false; FillImage = script.Find("FillImage") as HImage; Nob = script.Find("Nob") as HImage; unsafe { var ex = UIElementLoader.GetCompositeData(mod); if (ex != null) { info = *(SliderInfo *)ex.ip; } } }
public override void Initial(FakeStruct fake, UIElement script, UIInitializer initializer) { base.Initial(fake, script, initializer); raw = Enity as HImage; raw.MainColor = Color.white; var size = Enity.SizeDelta; Width = (int)size.x; Height = (int)size.y; HalfW = Width / 2; HalfH = Height / 2; buffer = new Color[Width * Height]; gesture = Enity.RegEvent <GestureEvent>(); gesture.PointerDown = PointDown; gesture.Drag = Drag; gesture.DragEnd = DragEnd; gesture.AutoColor = false; gesture.TowFingerMove = TowFingerMove; Apply(null); }
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; } } }
/// <summary> /// 初始化 /// </summary> /// <param name="fake">数据模型</param> /// <param name="script">元素主体</param> public override void Initial(FakeStruct fake, UIElement script, UIInitializer initializer) { base.Initial(fake, script, initializer); Size = Enity.m_sizeDelta; eventCall = Enity.RegEvent <UserEvent>(); eventCall.PointerDown = (o, e) => { UpdateVelocity = false; }; eventCall.Drag = (o, e, s) => { Size = Enity.m_sizeDelta; Scrolling(o, s); }; eventCall.DragEnd = OnDragEnd; eventCall.ForceEvent = true; eventCall.AutoColor = false; eventCall.CutRect = true; Content = Enity.Find("Content"); if (Content != null) { Move(Vector2.zero); } }