/// <summary> /// 注册界面(Layout)函数 /// </summary> /// <param name="parent_layout_name">父界面名称</param> /// <param name="parent_widget_name">挂载在父界面的具体哪一个UI控件之下</param> /// <param name="layout_name">你为这个界面起的名字(会作为后面界面操作的索引关键字)</param> /// <param name="file_name">这个界面的.layout文件名</param> /// <param name="delay_load">是否延时加载</param> /// <param name="visible">是否默认可见</param> public static ExecuteResult RegisterLayout(FString parent_layout_name, FString parent_widget_name, FString layout_name, String file_name, bool delay_load, bool visible) { if (sRegWinTable.ContainKey(layout_name)) { return(setResult(ExecuteResult.ReregError)); } Layout parent_layout = null; Widget parent_widget = null; if (sRegWinTable.GetLayout(parent_layout_name, out parent_layout)) { if (!parent_layout.IsLoaded) { parent_layout.Load(); } if (null == parent_widget_name) { parent_widget = parent_layout.Root; } else { parent_layout.FindWidget(parent_widget_name, out parent_widget); } Layout layout = new Layout(parent_widget, layout_name, file_name, visible); sRegWinTable.Add(layout); if (!delay_load) { layout.Load(); } } return(setResult(ExecuteResult.Success)); }
internal static ExecuteResult FindWidget(FString layout_name, FString widget_name, out Widget widget) { Layout layout = null; widget = null; ExecuteResult ret = ExecuteResult.Success; if (sRegWinTable.GetLayout(layout_name, out layout)) { if (!layout.IsLoaded) { layout.Load(); } if (!layout.FindWidget(widget_name, out widget)) { ret = ExecuteResult.WidgetNotExist; } } else { ret = ExecuteResult.LayoutNotExist; } return(setResult(ret)); }