/// <summary> /// 外部推送ui数据 /// </summary> /// <param name="uiIndex"></param> /// <param name="data"></param> public void SendMessage(int Index, M_WindowData data) { var uiIndex = Index.GetHashCode(); if (windowMap.ContainsKey(uiIndex)) { var ui = windowMap[uiIndex]; if (ui.IsLoad) { ui.SendMessage(data); return; } } //存入缓存 List <M_WindowData> list = null; uiDataCacheMap.TryGetValue(uiIndex, out list); // if (list == null) { list = new List <M_WindowData>(); uiDataCacheMap[uiIndex] = list; } list.Add(data); }
public M_AWindow(Transform transform) { this.Transform = transform; this.TempData = M_WindowData.Create(); subWindowsDictionary = new Dictionary <string, M_SubWindow>(); M_UITools.AutoSetTransformPath(this); }
/// <summary> /// 合并数据 /// </summary> /// <param name="data"></param> public void MergeData(M_WindowData data) { if(data!= null) foreach (var d in data.DataMap) { this.DataMap[d.Key] = d.Value; } }
/// <summary> /// 更新UI使用的数据 /// </summary> /// <param name="data">数据</param> public void SendMessage(M_WindowData data) { foreach (var key in data.DataMap.Keys) { Action <object> action = null; callbackMap.TryGetValue(key, out action); if (action != null) { action(data.DataMap[key]); } } }
/// <summary> /// 打开 /// </summary> /// <param name="name"></param> protected void OpenSubWindow(string name, M_WindowData mWindowData = null) { M_SubWindow subwin = null; if (this.subWindowsDictionary.TryGetValue(name, out subwin)) { subwin.Open(mWindowData); } else { BDebug.LogError("不存在子窗口:" + name); } }
public override void Open(M_WindowData data = null) { base.Open(); this.Transform.gameObject.SetActive(true); }
/// <summary> /// 打开窗口 /// </summary> /// <param name="data"></param> virtual public void Open(M_WindowData data = null) { this.TempData.MergeData(data); IsClose = false; this.Transform.gameObject.SetActive(true); }
public M_AWindow(string path) { resourcePath = path; this.TempData = M_WindowData.Create(); subWindowsDictionary = new Dictionary <string, M_SubWindow>(); }