Пример #1
0
        public bool LoadData(string strFilename)
        {
            Debuger.Log("dbuiwnd LoadData::" + strFilename + "/" + m_dicUIWnd.Count);
            XmlDocument xmlDoc    = new XmlDocument();
            TextAsset   textAsset = (TextAsset)Resources.Load(strFilename, typeof(TextAsset));

            //GameRes res = new GameRes(strFilename);
            //res.m_eCatchType = GameRes.eCatchType.CT_None;
            //res = ResourcesManager.LoadObj(res);
            //TextAsset textAsset = (TextAsset)res.m_Object;
            if (textAsset == null)
            {
                Debuger.LogError("Load UIWnd DB Failed!");
                return(false);
            }
            xmlDoc.Load(new StringReader(textAsset.text));
            XmlElement xmlRoot = xmlDoc.DocumentElement;
            //Debuger.Log("1111111111111111111111111111");
            XmlNodeList nodeList = xmlRoot.ChildNodes;

            foreach (XmlNode node in nodeList)
            {
                if (!(node is XmlElement))
                {
                    Debuger.LogError("UIWnd have a node which is not a XmlElement!");
                    continue;
                }

                XmlElement xmlElem = (XmlElement)node;

                int       nID  = XmlConvert.ToInt32(xmlElem.GetAttribute("ID"));
                UIWndData data = new UIWndData();

                data.WndName      = xmlElem.GetAttribute("Name");
                data.PrefabPath   = xmlElem.GetAttribute("PrefabPath");
                data.Mutex        = XmlConvert.ToBoolean(xmlElem.GetAttribute("Mutex"));
                data.Model        = XmlConvert.ToBoolean(xmlElem.GetAttribute("Model"));
                data.BlurEffect   = XmlConvert.ToBoolean(xmlElem.GetAttribute("BlurEffect"));
                data.CanCharMove  = XmlConvert.ToBoolean(xmlElem.GetAttribute("CanCharMove"));
                data.WndAnimation = XmlConvert.ToBoolean(xmlElem.GetAttribute("WndAnimation"));
                // 对于重复配置的,用后面的覆盖前面的
                if (m_dicUIWnd.ContainsKey(nID))
                {
                    if (data.WndName != "LoadingWnd")
                    {
                        Debuger.LogWarning("<Wnd Config Warning!> Two wnd have the same name: " + data.WndName);
                    }
                    m_dicUIWnd.Remove(nID);
                }
                m_dicUIWnd.Add(nID, data);
            }
            //Debuger.Log("2222222222222222222222222222222222222");
            Debuger.Log("dbuiwnd LoadData::" + strFilename + "/" + m_dicUIWnd.Count);
            return(true);
        }
Пример #2
0
        private static string strMutexWnd;   //存储当前互斥窗口


        /// <summary>
        /// 初始化窗口默认参数
        /// </summary>
        /// <param name="strWndName"></param>
        public virtual void Init(UIWndData data)
        {
            m_strWndName    = data.WndName;
            m_strPrefabPath = data.PrefabPath;
            m_bMutex        = data.Mutex;
            m_bModel        = data.Model;
            m_bBlurEffect   = data.BlurEffect;
            m_bCanCharMove  = data.CanCharMove;
            m_bWndAnimation = data.WndAnimation;
            // Debuger.Log(m_strWndName);
        }
Пример #3
0
 public bool GetUIWndDataByID(int nID, out UIWndData data)
 {
     return(m_dicUIWnd.TryGetValue(nID, out data));
 }