Esempio n. 1
0
 private void addDb(Type mType, DbBase mSheet)
 {
     if (!mDbDic.ContainsKey(mType))
     {
         mDbDic.Add(mType, new List <DbBase>());
     }
     mDbDic[mType].Add(mSheet);
 }
Esempio n. 2
0
        public IEnumerator initDbSystem()
        {
            AssetInfo mSheetIfo = ResourceABsFolder.Instance.getAsseetInfo("sheet", "DB");

            yield return(AssetBundleManager.Instance.AsyncLoadAsset(mSheetIfo));

            TextAsset   mXml         = AssetBundleManager.Instance.LoadAsset(mSheetIfo) as TextAsset;
            XmlDocument mXmlDocument = new XmlDocument();

            mXmlDocument.LoadXml(mXml.text);
            foreach (XmlNode xn1 in mXmlDocument.ChildNodes)
            {
                if (xn1.Name == "Client")
                {
                    uint addPro = 0;
                    if (xn1.ChildNodes.Count > 0)
                    {
                        addPro = (uint)Mathf.CeilToInt(90f / xn1.ChildNodes.Count);
                    }
                    foreach (XmlNode xn2 in xn1.ChildNodes)
                    {
                        foreach (XmlNode xn3 in xn2.ChildNodes)
                        {
                            Dictionary <string, string> mlist = new Dictionary <string, string>();
                            foreach (XmlNode xe in xn3.ChildNodes)
                            {
                                XmlElement xe1 = xe as XmlElement;
                                mlist.Add(xe1.Attributes[0].Name, xe1.Attributes[0].InnerText);
                            }
                            Type   mType  = System.Type.GetType("xk_System.Db." + xn3.Name);
                            DbBase mSheet = Activator.CreateInstance(mType) as DbBase;
                            mSheet.SetDbValue(mlist);

                            addDb(mType, mSheet);
                        }
                        yield return(0);
                    }
                    break;
                }
            }
        }