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); }
static void Clone(string CloneName, byte[] ui, Transform root) { if (ui != null) { if (CloneName != null) { if (CloneName != "") { HGUIManager.Initial(root); HGUIManager.LoadModels(ui, "assTest"); var go = HGUIManager.GameBuffer.Clone(HGUIManager.FindModel("assTest", CloneName)); if (go != null) { var trans = go.transform; trans.SetParent(root); } } } } }
static void Clone(string CloneName, byte[] ui, Transform root) { if (ui != null) { if (CloneName != null) { if (CloneName != "") { HGUIManager.Initial(root); HGUIManager.LoadModels(ui, "assTest"); Initializer initializer = new Initializer(); var go = HGUIManager.Clone(HGUIManager.FindModel("assTest", CloneName), initializer); if (go != null) { var trans = go.transform; trans.SetParent(root); trans.localScale = Vector3.one; trans.localScale = Vector3.one; trans.localRotation = Quaternion.identity; } } } } }