/// <summary> /// /// </summary> /// <param name="panel"></param> /// <param name="action"></param> /// <param name="bo"></param> /// <param name="cancel"></param> internal void OnBeforeActionExecutingRaised(IBasePanel panel, ActionMetaItem action, IObject bo, ref bool cancel) { if (OnBeforeActionExecuting != null) { OnBeforeActionExecuting(panel, action, bo, ref cancel); } }
//实例化当前场景所有面板,并存入字典.因为它这个其实是切换场景以后,清空字典并重新添加面板 public void InitDict() { foreach (var item in mUIManager.currentScenePanelDict) { //注意这个地方的item是一个键值对,不是单纯的string,是字典的一个完整元素,包含了string和gameObject item.Value.transform.SetParent(canvasTransform); item.Value.transform.localPosition = Vector3.zero; item.Value.transform.localScale = Vector3.one; IBasePanel basePanel = item.Value.GetComponent <IBasePanel>(); if (basePanel == null) { Debug.Log("获取UI面板:" + item + "的脚本失败"); } //else //{ // Debug.Log("成功获取UI面板:" + item ); //} basePanel.InitPanel(); currentScenePanelDict.Add(item.Key, basePanel);//存储面板上面的脚本 if (item.Key == StringManager.HelpPanel) { //Debug.Log("帮助面板已添加"); } } }
/// <summary> /// /// </summary> /// <param name="panel"></param> /// <param name="action"></param> /// <param name="bo"></param> internal void OnAfterActionExecutedRaised(IBasePanel panel, ActionMetaItem action, IObject bo) { if (OnAfterActionExecuted != null) { OnAfterActionExecuted(panel, action, bo); } }
private void ProcessStartUpParameters(IBasePanel basePanel, LayoutAdvanced layout) { if (basePanel.StartUpParameters != null && basePanel.StartUpParameters.ContainsKey("TipText") && !bv.common.Core.Utils.IsEmpty(basePanel.StartUpParameters["TipText"])) { layout.TipText.Text = (string)basePanel.StartUpParameters["TipText"]; } }
/// <summary> /// /// </summary> public virtual void Init(IBasePanel basePanel) { //TODO придумать куда его поместить, чтобы принудительно этот метод не надо было вызывать ParentBasePanel = basePanel; //изначально контейнеры для ActionPanel не видны; они отображаются только в момент добавления соответствующих ActionPanel //panelBottom.Visible = false; //создаём панели CreateActionPanels(); }
/// <summary> /// /// </summary> /// <param name="basePanel"></param> public override void Init(IBasePanel basePanel) { base.Init(basePanel); var baseListPanel = basePanel as IBaseListPanel; if ((baseListPanel != null) && (baseListPanel.SearchPanel != null)) { AddSearchPanel((BaseSearchPanel)baseListPanel.SearchPanel); } }
/// <summary> /// /// </summary> /// <param name="basePanel"></param> public override void Init(IBasePanel basePanel) { base.Init(basePanel); //TODO добавить Search Panel var baseListPanel = basePanel as IBaseListPanel; if (baseListPanel != null) { AddSearchPanel((Control)baseListPanel.CreateSearchPanel(TopActionPanel, null, basePanel.AdjustObject), basePanel.Collapsed); ProcessStartUpParameters(basePanel, this); } }
/// <summary> /// /// </summary> /// <param name="basePanel"></param> /// <param name="id"></param> public void AddActions(IBasePanel basePanel, object id) { IObject bo; using (var manager = DbManagerFactory.Factory.Create(ModelUserContext.Instance)) { var objectSelectDetail = ObjectAccessor.SelectDetailInterface(basePanel.GetBusinessObjectType()); bo = objectSelectDetail.SelectDetail(manager, id); //в случае нового объекта он будет создан тут } AddActions(basePanel, bo); }
public void Show(UIPanelName panelName) { IBasePanel panel = GetPanel(panelName); panel.rootUI.transform.SetAsLastSibling(); panel.OnShow(); if (!panelShowDict.ContainsKey(panelName)) { panelShowDict.Add(panelName, panel); } }
/// <summary> /// /// </summary> /// <param name="basePanel"></param> /// <param name="bo"></param> public void AddActions(IBasePanel basePanel, IObject bo) { //ObjectAccessor.MetaInterface(typeBO); var objectMeta = ObjectAccessor.MetaInterface(bo.GetType()); if (objectMeta != null) { var layout = basePanel.GetLayout(); if (layout != null) { layout.AddActions(objectMeta.Actions); } } }
/// <summary> /// 根据面板类型得到实例化面板 /// </summary> private IBasePanel GetPanel(string panelName) { if (panelDict == null) { panelDict = new Dictionary <string, IBasePanel>(); } IBasePanel panel = panelDict.TryGet(panelName); if (panel == null) { //如果找不到 就实例 UIPanelInfo pInfo = panelInfoDict.TryGet(panelName); if (pInfo == null) { Debug.LogError("没有该面板的信息" + panelName); return(null); } GameObject instPanel = GetPanelGameObject(panelName, pInfo.path); switch (pInfo.layer) { case UILayer.Background: instPanel.transform.SetParent(BGTransform, false); break; case UILayer.Common: instPanel.transform.SetParent(CommonTransform, false); break; case UILayer.Top: instPanel.transform.SetParent(TopTransform, false); break; default: Debug.LogError(pInfo.panelName + "没有设置层级"); break; } instPanel.transform.ResetLocal(); panel = UIBusiness.GetPanelBusiness(panelName); panel.rootUI = instPanel; panelDict.Add(panelName, panel); panel.Init(); } return(panel); }
// 实例化当前场景下的UIPanel并存入字典 public void InitUIPanelDict() { foreach (var item in mUIManager.currentScenePanelDict) { item.Value.transform.SetParent(canvas); item.Value.transform.localPosition = Vector3.zero; item.Value.transform.localScale = Vector3.one; IBasePanel basePanel = item.Value.GetComponent <IBasePanel>(); if (basePanel == null) { Debug.LogWarning(string.Format("{0}上的IBasePanel脚本丢失!", item.Key)); } basePanel.InitPanel(); // UIPanel初始化UI currentScenePanelDict.Add(item.Key, basePanel); // 将该场景下的UIPanel身上的Panel脚本添加进字典中 } }
public void InitDict() { foreach (var item in mUIManager.currentScenePanelDict) { item.Value.transform.SetParent(canvasTransform); item.Value.transform.localPosition = Vector3.zero; item.Value.transform.localScale = Vector3.one; IBasePanel basePanel = item.Value.GetComponent <IBasePanel>(); if (basePanel == null) { Debug.Log("获取Ibasepanel脚本失败,该物体为" + item.Value.name); } basePanel.InitPanel(); currentScenePanelDict.Add(item.Key, basePanel); } }
/// <summary> /// 实例化当前场景的所有面板并存入字典 /// </summary> public void InitDict() { foreach (KeyValuePair <string, GameObject> item in mUIManager.currentScenePanelDict) { item.Value.transform.SetParent(canvasTrans); item.Value.transform.localPosition = Vector3.zero; item.Value.transform.localScale = Vector3.one; IBasePanel basePanel = item.Value.GetComponent <IBasePanel>(); if (basePanel == null) { Debug.Log("获取UI面板上IBasePanel脚本失败"); } basePanel.InitPanel(); currentScenePanelDict.Add(item.Key, basePanel); } }
public void Hide(UIPanelName panelName) { if (panelShowDict.Count <= 0) { return; } IBasePanel panel = panelShowDict.TryGet(panelName); if (panel == null) { return; } panel.OnHide(); panelShowDict.Remove(panelName); }
public void Show(string panelName) { if (panelShowDict == null) { panelShowDict = new Dictionary <string, IBasePanel>(); } IBasePanel panel = GetPanel(panelName); panel.rootUI.transform.SetAsLastSibling(); panel.OnShow(); if (!panelShowDict.ContainsKey(panelName)) { panelShowDict.Add(panelName, panel); } }
//实例化当前场景所有面板(在UIManager中),并存入字典 public void InitPanel() { foreach (var item in uiManager.currentScenePanelDict) { item.Value.transform.SetParent(canvasTransform); item.Value.transform.localPosition = Vector3.zero; item.Value.transform.localScale = Vector3.one; IBasePanel basePanel = item.Value.GetComponent <IBasePanel>(); //Debug.Log(item.Key); if (basePanel == null) { Debug.Log("获取面板上IBasePanel脚本失败: " + item.Key); } basePanel.InitPanel(); //调用Panel初始化方法 currentScenePanelDict.Add(item.Key, basePanel); } }
/// <summary> /// 实例化当前场景所有面板,并存入字典 /// </summary> public void InitDict() { foreach (var gameObject in uiManger.currentScenePanelDict) { gameObject.Value.transform.SetParent(canvasTransform); gameObject.Value.transform.localPosition = Vector3.zero; gameObject.Value.transform.localScale = Vector3.one; IBasePanel basePanel = gameObject.Value.GetComponent <IBasePanel>(); if (basePanel == null) { Debug.Log("获取面板脚本失败"); } else { basePanel.InitPanel(); currentScenePanelDict.Add(gameObject.Key, basePanel); } } }
/// <summary> /// 根据面板类型得到实例化面板 /// </summary> private IBasePanel GetPanel(UIPanelName panelName) { IBasePanel panel = panelDict.TryGet(panelName); if (panel == null) { //如果找不到 就实例 UIPanelInfo pInfo = UIPanelHelper.GetPanelInfo(panelName); GameObject instPanel = GetPanelGO(panelName, pInfo.path); switch (pInfo.Layer) { case UILayer.Bottom: instPanel.transform.SetParent(BGTransform, false); break; case UILayer.Common: instPanel.transform.SetParent(CommonTransform, false); break; case UILayer.Top: instPanel.transform.SetParent(TopTransform, false); break; default: Debug.LogError(pInfo.Name + "没有设置层级"); break; } instPanel.transform.SetParent(CommonTransform, false); instPanel.transform.ResetLocal(); panel = UIPanelHelper.GetPanelBusiness(panelName); panel.rootUI = instPanel; panelDict.Add(panelName, panel); panel.Init(); } return(panel); }
public void Hide(string panelName) { if (panelShowDict == null) { panelShowDict = new Dictionary <string, IBasePanel>(); } if (panelShowDict.Count <= 0) { return; } IBasePanel panel = panelShowDict.TryGet(panelName); if (panel == null) { return; } panel.OnHide(); panelShowDict.Remove(panelName); }