public void CloseAllFrames() { LoggerManager.Instance().LogProcessFormat("CloseAllFrames ..."); var iter = mKey2Frames.GetEnumerator(); while (iter.MoveNext()) { IFrame frame = iter.Current.Value as IFrame; if (null != frame) { frame.Close(); } } mKey2Frames.Clear(); }
public IFrame OpenFrame(int typeId, object userData = null, int frameId = -1, GameObject root = null) { var frameItem = TableManager.Instance().GetTableItem <ProtoTable.FrameTypeTable>(typeId); if (null == frameItem) { Debug.LogErrorFormat("OpenFrame Failed for typeId = {0} can not be found in FrameTypeTable ...", frameItem); return(null); } int key = GetFrameKey(typeId, frameId); if (mKey2Frames.ContainsKey(key)) { IFrame frame = mKey2Frames[key] as IFrame; if (null != frame) { frame.Close(); frame.Create(userData); frame.Open(typeId, frameId, frameItem.ModuleId, frameItem.Layer, root); return(frame); } else { Debug.LogErrorFormat("open frame failed typeId = {0} frameId = {1}", typeId, frame); return(null); } } else { var assembly = typeof(ClientFrame).Assembly; var frame = assembly.CreateInstance(frameItem.ClassName) as IFrame; if (null != frame) { frame.Create(userData); frame.Open(typeId, frameId, frameItem.ModuleId, frameItem.Layer, root); mKey2Frames.Add(key, frame); } return(frame); } }