private Window CreateWindow(WindowMetaInfo metaInfo) { var path = metaInfo.WindowResourcePath; var prefab = ResMgr.Load <GameObject>(path); var winObj = GameObject.Instantiate(prefab); var tr = winObj.transform; tr.SetParent(_windowRootTr); var win = winObj.GetComponent(metaInfo.WindowType) as Window; if (win == null) { Debug.Log(string.Format("cannot get WindowComponent:{0} from window object:{1}", metaInfo.WindowType, path)); win = winObj.AddComponent(metaInfo.WindowType) as Window; if (win == null) { Debug.LogError("cannot add WindowComponent to gameobject:" + metaInfo.WindowType); } } return(win); }
public override void OnInit(WindowMetaInfo winMeta) { base.OnInit(winMeta); RegisterButtonCallback("Close", OnClickClose); RegisterButtonCallback("Buy", OnClickBuy); }
private WindowMetaInfo GetMetaInfoFromAttr(WindowMetaInfoAttribute attr) { var info = new WindowMetaInfo(); info.ControllerType = attr.ControllerTypeEnum; info.WindowResourcePath = attr.WindowResPath; info.WindowType = attr.WindowType; info.WindowControllerCSharpClassType = attr.WindowControllerCSharpType; info.LuaScriptPath = attr.LuaScriptPath; return(info); }
/// <summary> /// WindowController的初始化,此时window并没有创建完成 /// </summary> public virtual void OnInit(WindowMetaInfo winMeta) { _winMetaInfo = winMeta; }
public override void OnInit(WindowMetaInfo winMeta) { base.OnInit(winMeta); RegisterButtonCallback("ShowShop", OnClickShowShop); }
public WindowController Create(WindowMetaInfo metaInfo) { var typ = metaInfo.WindowControllerCSharpClassType; return(System.Activator.CreateInstance(typ) as WindowController); }
private WindowController CreateWindowController(WindowMetaInfo metaInfo) { var ctrl = _winCtrlFactory.Create(metaInfo); return(ctrl); }