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) { 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; 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; } } }
protected TreeViewItem CreateItem() { TreeViewItem it = queue.Dequeue(); if (it != null) { it.target.activeSelf = true; return(it); } ModelElement mod = new ModelElement(); mod.Load(ItemMod.ModData); mod.SetParent(View); mod.data.localPosition = new Vector3(10000, 10000); mod.data.localScale = Vector3.one; mod.IsChanged = true; TreeViewItem a = new TreeViewItem(); a.target = mod; a.text = mod.GetComponent <TextElement>(); a.callBack = EventCallBack.RegEvent <EventCallBack>(mod); 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 virtual void OnMouseDown(UserAction action) { if (!action.MultiFocus.Contains(this)) { action.MultiFocus.Add(this); } Pressed = true; pressTime = action.EventTicks; RawPosition = action.CanPosition; if (AutoColor) { var g = Context.GetComponent <GraphicE>(); if (graphic != null) { Color a = Color.white; a.r = g_color.r * 0.8f; a.g = g_color.g * 0.8f; a.b = g_color.b * 0.8f; a.a = g_color.a; graphic.color = a; } } if (PointerDown != null) { PointerDown(this, action); } entry = true; FocusAction = action; mVelocity = Vector2.zero; }
public static T RegEvent <T>(ModelElement element) where T : EventCallBack, new() { for (int i = 0; i < events.Count; i++) { if (events[i].Context == element) { T t = events[i] as T; if (t != null) { return(t); } events.RemoveAt(i); break; } } T u = new T(); u.Context = element; u.graphic = element.GetComponent <GraphicE>(); if (u.graphic != null) { u.g_color = u.graphic.color; } element.baseEvent = u; events.Add(u); u.Initial(); return(u); }
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 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 override void Initial(ModelElement mod) { base.Initial(mod); model = mod; raw = model.GetComponent <RawImageElement>(); var size = model.data.sizeDelta; Width = (int)size.x; Height = (int)size.y; HalfW = Width / 2; HalfH = Height / 2; buffer = new Color[Width * Height]; gesture = EventCallBack.RegEvent <GestureEvent>(model); gesture.PointerDown = PointDown; gesture.Drag = Drag; gesture.DragEnd = DragEnd; gesture.AutoColor = false; gesture.TowFingerMove = TowFingerMove; ThreadMission.InvokeToMain(Apply, null); }
public static object RegEvent(ModelElement element, Type type) { for (int i = 0; i < events.Count; i++) { if (events[i].Context == element) { events.RemoveAt(i); break; } } EventCallBack u = Activator.CreateInstance(type) as EventCallBack; u.Context = element; u.graphic = element.GetComponent <GraphicE>(); if (u.graphic != null) { u.g_color = u.graphic.color; } element.baseEvent = u; events.Add(u); u.Initial(); return(u); }
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); } } }