示例#1
0
 private void ExecuteItem(IPanelItem obj)
 {
     try
     {
         if (obj.Panel != null)
         {
             if (PanelControl == obj.Panel)
             {
                 PanelControl = null;
                 PanelVisible = false;
                 return;
             }
             PanelControl = obj.Panel;
             PanelVisible = true;
         }
         else
         {
             PanelControl = null;
             PanelVisible = false;
             obj.Execute();
         }
     }
     catch (Exception e)
     {
         Log.Error("Eecute error", e);
     }
 }
 protected virtual void ChoisePanel(Button bu)
 {
     if (bu == lastkey)
     {
         return;
     }
     if (null != lastkey)
     {
         if (guidemap.ContainsKey(lastkey))
         {
             lastkey.GetComponent <Image>().color = Color.white;
             IPanelItem ipi = guidemap[lastkey].gameObject.GetComponent <IPanelItem>();
             if (null != ipi)
             {
                 ipi.OnLeveThisPage();
             }
             guidemap[lastkey].gameObject.SetActive(false);
         }
     }
     if (guidemap.ContainsKey(bu))
     {
         bu.GetComponent <Image>().color = Color.green;
         guidemap[bu].gameObject.SetActive(true);
         titletext.text = bu.GetComponentInChildren <Text>().text;
         IPanelItem ipi = guidemap[bu].gameObject.GetComponent <IPanelItem>();
         if (null != ipi)
         {
             ipi.OnEnterThisPage();
         }
     }
     lastkey = bu;
 }
 /// <summary>
 /// 根据点击的button选择对应的panel
 /// </summary>
 /// <param name="bu">点击button</param>
 protected virtual void ChoisePanel(Button bu)
 {
     if (bu == lastkey)
     {
         return;
     }
     if (null != lastkey)
     {
         if (map.ContainsKey(lastkey))
         {
             lastkey.GetComponent <Image>().color = Color.white;
             IPanelItem ipi = map[lastkey].gameObject.GetComponent <IPanelItem>();
             if (null != ipi)
             {
                 ipi.OnLeveThisPage();
             }
             map[lastkey].gameObject.SetActive(false);
         }
         if (listmap.ContainsKey(lastkey))
         {
             for (int i = 0; i < listmap[lastkey].Count; i++)
             {
                 listmap[lastkey][i].SetActive(false);
             }
         }
     }
     if (map.ContainsKey(bu))
     {
         bu.GetComponent <Image>().color = Color.green;
         map[bu].gameObject.SetActive(true);
         IPanelItem ipi = map[bu].gameObject.GetComponent <IPanelItem>();
         if (null != ipi)
         {
             ipi.OnEnterThisPage();
         }
     }
     if (listmap.ContainsKey(bu))
     {
         for (int i = 0; i < listmap[bu].Count; i++)
         {
             listmap[bu][i].SetActive(true);
         }
     }
     lastkey = bu;
     ChoiseEnd(bu);
 }
示例#4
0
 /// <summary>
 /// Adds the specified <see cref="Adf.Web.UI.IPanelItem"/> object to the end of the list.
 /// </summary>
 /// <param name="panelItem">The <see cref="Adf.Web.UI.IPanelItem"/> to add to the end of the list. The value can be null for reference types.</param>
 public void Add(IPanelItem panelItem)
 {
     panelItems.Add(panelItem);
 }