示例#1
0
文件: UIMgr.cs 项目: vampire801/anhui
        /// <summary>
        /// Remove the user interface panel.
        /// it will be remove from the m_UIPanels, and add to m_DelPanels.
        /// it will delete server frames later.
        /// </summary>
        /// <returns>
        /// success or not
        /// </returns>
        /// <param name='uiid'>
        /// Panel's ID
        /// </param>
        public bool RemoveUIPanel(ushort uiid)
        {
            DEBUG.Gui("Remove UI Panel: " + UIConstant.UIIdToString(uiid));

            //Debug.LogError("移除面板:" + uiid);

            if (UIPanels.ContainsKey(uiid))
            {
                if (IsActive(uiid))
                {
                    if ((GameObject)UIPanels[uiid] != null)
                    {
                        DoClosePanel(uiid);
                    }
                }

                if ((GameObject)UIPanels[uiid] != null)
                {
                    ((GameObject)UIPanels[uiid]).SetActive(false);
                    delPanels.Add(uiid, (UIPanels[uiid] as GameObject));
                }
                UIPanels.Remove(uiid);
                delDelayFrame = DEL_PANEL_FRAME;

                return(true);
            }

            return(false);
        }
示例#2
0
        /// <summary>
        /// Regists the user interface panel.
        /// </summary>
        /// <returns>
        /// success or not
        /// </returns>
        /// <param name='uiid'>
        /// Panel's ID
        /// </param>
        public bool RegistUIPanel(ushort uiid)
        {
            DEBUG.Gui("Regist UI Panel: " + UIConstant.UIIdToString(uiid));

            GameObject panel;

            for (int i = 0; i < UIPanelPrefabs.Length; ++i)
            {
                if (UIPanelPrefabs[i] == null)
                {
                    DEBUG.Gui(UIConstant.UIIdToString(uiid) + " is NULL", LogType.Error);
                    continue;
                }

                BaseUI prefabUI = UIPanelPrefabs[i].GetComponent <BaseUI>();
                if (prefabUI == null)
                {
                    DEBUG.Gui(UIConstant.UIIdToString(uiid) + " does NOT have BaseUI component", LogType.Error);
                    continue;
                }

                if (prefabUI.GetID() == uiid)
                {
                    if (RootAnchor == null)
                    {
                        continue;
                    }

                    panel = (GameObject)Instantiate(UIPanelPrefabs[i]);
                    panel.transform.SetParent(RootAnchor.transform);
                    panel.transform.localPosition = Vector3.zero;
                    panel.transform.localRotation = RootAnchor.transform.localRotation;
                    panel.name = UIPanelPrefabs[i].name;
                    BaseUI ui = panel.GetComponent <BaseUI>();


                    if (ui != null)
                    {
                        if (!UIPanels.ContainsKey(ui.GetID()))
                        {
                            UIPanels.Add(ui.GetID(), panel);

                            return(true);
                        }
                        DEBUG.Gui(UIConstant.UIIdToString(ui.GetID()) + " is already exist!", LogType.Error);
                        return(false);
                    }
                    DEBUG.Gui("There's no BaseUI module in " + UIPanelPrefabs[i].name, LogType.Error);
                    return(false);
                }
            }

            return(false);
        }
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     return(UIConstant.Logic2AbsX(((Vector2)value).X));
     //throw new NotImplementedException();
 }