/// <summary> /// 构造函数 /// </summary> /// <param name="container">模型名称</param> /// <param name="mod">模式数据</param> public UILinker(UIContainer container, FakeStruct mod) { con = container; model = mod; container.linkers.Add(this); initializer = new UIInitializer(TempReflection.ObjectFields(typeof(T))); }
/// <summary> /// 构造函数 /// </summary> /// <param name="container">容器实例</param> /// <param name="mod">模型名称</param> public UILinker(UIContainer container, string mod) { if (container.model == null) { return; } con = container; model = HGUIManager.FindChild(container.model, mod); container.linkers.Add(this); initializer = new UIInitializer(TempReflection.ObjectFields(typeof(T))); }
/// <summary> /// 构造函数 /// </summary> /// <param name="container">模型名称</param> /// <param name="mod">模式数据</param> public UILinker(UIContainer container, UIElement mod) { enityModel = mod; enityModel.activeSelf = false; con = container; model = enityModel.mod; container.linkers.Add(this); initializer = new UIInitializer(TempReflection.ObjectFields(typeof(T))); uiModel = new T(); initializer.ReflectionEnity(uiModel, mod); GetElementCount(mod); }
public T LoadUI <T>(string asset, string name) where T : class, new() { model = HGUIManager.FindModel(asset, name); T t = new T(); UIInitializer iInitializer = new UIInitializer(TempReflection.ObjectFields(typeof(T))); iInitializer.Reset(t); Main = HGUIManager.GameBuffer.Clone(model, iInitializer); var trans = Main.transform; trans.SetParent(Parent); trans.localPosition = Vector3.zero; trans.localScale = Vector3.one; trans.localRotation = Quaternion.identity; return(t); }
/// <summary> /// 创建项目连接器 /// </summary> /// <returns></returns> public override LinkerMod CreateUI() { for (int i = 0; i < buffer.Count; i++) { if (buffer[i].index < 0) { var item = buffer[i]; buffer.RemoveAt(i); return(item); } } LinkerMod mod = new LinkerMod(); T t = new T(); if (initializer == null) { initializer = new UIInitializer(TempReflection.ObjectFields(typeof(T))); } initializer.Reset(t); mod.main = HGUIManager.Clone(model, initializer); mod.UI = t; return(mod); }
/// <summary> /// 构造函数 /// </summary> public Middleware() { initializer = new UIInitializer(TempReflection.ObjectFields(typeof(T))); }
public UIInitializer(object obj) { target = obj; reflections = TempReflection.ObjectFields(obj); feildLenth = reflections.Top; }