/// <summary> /// 外部推送ui数据 /// </summary> /// <param name="uiIndex"></param> /// <param name="data"></param> public void SendMessage(int Index, WindowData data) { var uiIndex = Index.GetHashCode(); if (windowMap.ContainsKey(uiIndex)) { var ui = windowMap[uiIndex]; if (ui.IsLoad) { ui.SendMessage(data); return; } } //存入缓存 List <WindowData> list = null; uiDataCacheMap.TryGetValue(uiIndex, out list); // if (list == null) { list = new List <WindowData>(); uiDataCacheMap[uiIndex] = list; } list.Add(data); }
/// <summary> /// 合并数据 /// </summary> /// <param name="data"></param> public void MergeData(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(WindowData data) { Action <WindowData> action = null; callbackMap.TryGetValue(data.Name, out action); if (action != null) { action(data); } }
/// <summary> /// 打开 /// </summary> /// <param name="name"></param> protected void OpenSubWindow(string name, WindowData windowData = null) { SubWindow subwin = null; if (this.subWindowsDictionary.TryGetValue(name, out subwin)) { subwin.Open(windowData); } else { BDebug.LogError("不存在子窗口:" + name); } }
public override void Open(WindowData data = null) { base.Open(); this.Transform.gameObject.SetActive(true); }
/// <summary> /// 打开窗口 /// </summary> /// <param name="data"></param> virtual public void Open(WindowData data = null) { //this.TempData.MergeData(data); IsClose = false; this.Transform.gameObject.SetActive(true); }