Beispiel #1
0
    public void CloseUI(string uiName)
    {
        if (!DataManager.UITable.ContainsKey(uiName))
        {
            GameDebug.Log("没有找到UI :" + uiName);
            return;
        }

        UITableItem item = DataManager.UITable[uiName] as UITableItem;

        if (!string.IsNullOrEmpty(item.hideLayer))
        {
            string[] layers = item.hideLayer.Split(new char[] { '|' });
            foreach (string layer in layers)
            {
                ShowLayer(System.Convert.ToUInt32(layer));
            }
        }

        if (mCacheWindows[item.resID] != null)
        {
            UIWindow obj = mCacheWindows[item.resID];

            if (obj != null && obj.IsOpened())
            {
                obj.Close();
            }
        }

        // CheckQueueUI(uiName);
    }
Beispiel #2
0
    /// <summary>
    /// 获取当前界面在uiconfig表中的id;
    /// </summary>
    /// <returns></returns>
    public int GetResId()
    {
        UITableItem item = WindowManager.Instance.GetUIRes(GetName());

        if (item != null)
        {
            return(-1);
        }
        return(item.resID);
    }
Beispiel #3
0
    private bool IsLockMove()
    {
        UITableItem item = WindowManager.Instance.GetUIRes(GetName());

        if (item != null)
        {
            return(item.lockMove);
        }
        return(false);
    }
Beispiel #4
0
    /// <summary>
    /// 根据预设名判断是否是UI界面;
    /// uiName 表示预设名字对应的界面名;
    /// </summary>
    public bool IsUIByPrefabName(string prefabName, ref string uiName)
    {
        bool   res  = false;
        string name = "";

        string[] sep              = new string[] { "/" };
        string[] temp             = null;
        IDictionaryEnumerator itr = DataManager.UITable.GetEnumerator();

        while (itr.MoveNext())
        {
            UITableItem item = itr.Value as UITableItem;
            if (item == null)
            {
                continue;
            }

            //			if(string.Equals(prefabName , item.prefab))
            temp = item.prefab.Split(sep, System.StringSplitOptions.None);
            if ((temp == null) || (temp.Length < 1))
            {
                break;
            }

            name = temp[temp.Length - 1];
            if (string.Equals(name, prefabName))
            {
                uiName = item.name;
                res    = true;
                break;
            }
        }
//      foreach(UITableItem item in DataManager.UITable.Values)
//      {
//          if(item == null)
//              continue;
//
// //			if(string.Equals(prefabName , item.prefab))
//          temp = item.prefab.Split(sep , System.StringSplitOptions.None);
//          if((temp == null) || (temp.Length < 1))
//          {
//              break;
//          }
//
//          name = temp[temp.Length - 1];
//          if(string.Equals(name , prefabName))
//          {
//              uiName = item.name;
//              res = true;
//              break;
//          }
//      }

        return(res);
    }
Beispiel #5
0
    /// <summary>
    /// 判断界面是否打开
    /// </summary>
    /// <param name="uiname"></param>
    /// <returns></returns>
    public bool IsOpen(string uiname)
    {
        if (!DataManager.UITable.ContainsKey(uiname))
        {
            return(false);
        }
        UITableItem item = DataManager.UITable[uiname] as UITableItem;

        if (mCacheWindows[item.resID] == null)
        {
            return(false);
        }

        UIWindow uiObj = mCacheWindows[item.resID];

        return(uiObj.IsOpened());
    }
Beispiel #6
0
    //打开翻牌界面
    public void OnOpenUI(string uiName)
    {
        if (!DataManager.UITable.ContainsKey(uiName))
        {
            GameDebug.Log("OnOpenUI 没有找到UI :" + uiName);
            return;
        }
        int condtion = -1;

        if (uiName == "quest")
        {
            UIQuestForm quest = WindowManager.Instance.GetUI(uiName) as UIQuestForm;
            condtion = quest.GetCurrentID();
        }
        else if (uiName == "stagelist")
        {
            UIStageList stagelist = WindowManager.Instance.GetUI(uiName) as UIStageList;
            condtion = stagelist.GetCurrentID();
        }

        //else if (uiName == "mainmap")
        //{
        //     WorldMapModule mWorldMapModule = ModuleManager.Instance.FindModule<WorldMapModule>();
        //     if (mWorldMapModule!= null)
        //         condtion = mWorldMapModule.GuideResId;
        //}
        UITableItem item = DataManager.UITable[uiName] as UITableItem;

        if (!mGuides.ContainsKey(GUIDE_TYPE.GUIDE_OPEN_UI))
        {
            return;
        }
        List <GuideTableItem> childs = mGuides[GUIDE_TYPE.GUIDE_OPEN_UI];

        for (int i = 0; i < childs.Count; ++i)
        {
            if (childs[i].param == item.resID)
            {
                if (CheckAndBeginGuide(childs[i], condtion))
                {
                    LogOut("打开界面 name = " + uiName + " 触发引导ID= " + childs[i].id.ToString());
                    return;
                }
            }
        }
    }
Beispiel #7
0
    public bool InitCaches(DataTable table)
    {
        IDictionaryEnumerator itr = table.GetEnumerator();

        while (itr.MoveNext())
        {
            UITableItem item = itr.Value as UITableItem;
            if (item != null)
            {
                mNameToID.Add(item.name, item.resID);
            }
        }
        int uiNumber = mNameToID.Count;

        mCacheWindows = new UIWindow[uiNumber];

        return(true);
    }
Beispiel #8
0
    void initShowType()
    {
        UITableItem item = WindowManager.Instance.GetUIRes(mParant.GetName());

        if (item == null)
        {
            return;
        }

        if (string.IsNullOrEmpty(item.barFlag))
        {
            mGo.SetActive(false);

            return;
        }
        string[] flags = item.barFlag.Split(new string[] { "|" }, System.StringSplitOptions.RemoveEmptyEntries);
        if (flags.Length != 6)
        {
            Debug.LogError("uiconfig表的右上角MoneyBar列,数据错误。id=" + item.resID);
            return;
        }

        bool allFalse = true;

        for (int i = 0; i < 6; i++)
        {
            GameObject go = getGameobjectBySortid(i);
            int        c  = System.Convert.ToInt32(flags[i]);

            if (c != 0)
            {
                allFalse = false;
            }
            go.SetActive(c != 0);
        }

        if (allFalse)
        {
            mGo.gameObject.SetActive(false);
        }

        grid.repositionNow = true;
    }
Beispiel #9
0
    private void DestroyFlowWindow(UI_FLOW_TYPE flowType)
    {
        for (int i = 0; i < mCacheWindows.Length; ++i)
        {
            UIWindow win = mCacheWindows[i];
            if (win == null)
            {
                continue;
            }
            UITableItem item = DataManager.UITable[win.GetName()] as UITableItem;
            //全局 无销毁
            if (item == null || item.flow <= (int)UI_FLOW_TYPE.UI_FLOW_INVAID)
            {
                continue;
            }
            if (item.flow == (int)mFlowType)
            {
                win.Destroy();

                mCacheWindows[i] = null;
            }
        }
    }
Beispiel #10
0
    public bool OpenUI(string uiName, object param = null, object preOpenParam = null, string returnUI = null)
    {
        if (!DataManager.UITable.ContainsKey(uiName))
        {
            GameDebug.Log("没有找到UI :" + uiName);
            return(false);
        }
        UITableItem item = DataManager.UITable[uiName] as UITableItem;

        if (item.openSound != -1)
        {
            SoundManager.Instance.Play(item.openSound);
        }

        if (!string.IsNullOrEmpty(item.hideLayer))
        {
            string[] layers = item.hideLayer.Split(new char[] { '|' });
            foreach (string layer in layers)
            {
                HideLayer(System.Convert.ToUInt32(layer));
            }
        }

        UIWindow window = null;

        //常驻内存的界面
        if (mCacheWindows[item.resID] != null)
        {
            window = mCacheWindows[item.resID];

            if (!window.IsOpened())
            {
                window.SetPreOpenParam(preOpenParam);
                window.SetParam(param);
                window.Open();
            }
        }
        else
        {
            window = CreateUI(uiName);
            window.SetPreOpenParam(preOpenParam);
            window.SetParam(param);
            window.SetName(uiName);

            if (!window.Load(item.prefab))
            {
                return(false);
            }
            window.SetLayer(item.layer, item.is3D);
            //设置层级
            SetDepth(window, item.depth);


            mCacheWindows[item.resID] = window;

            window.Open();
        }

        window.SetReturnWinName(returnUI);

        return(true);
    }
Beispiel #11
0
 public virtual void Init(UITemplate template, UITableItem item)
 {
     Template = template;
     Item     = item;
     InitModel();
 }
Beispiel #12
0
 public virtual void Init(UITableItem item)
 {
     Item = item;
     InitTemplate();
 }