Example #1
0
        public bool Load(string path, AssetBundle nonLocalizedBundle, AssetBundle localizedBundle, string locale)
        {
            string text = path + "NonLocalized/SpellEffect.txt";

            if (this.m_records.Count > 0)
            {
                Debug.Log("Already loaded static db " + text);
                return(false);
            }
            TextAsset textAsset = nonLocalizedBundle.LoadAsset <TextAsset>(text);

            if (textAsset == null)
            {
                Debug.Log("Unable to load static db " + text);
                return(false);
            }
            string text2 = textAsset.ToString();
            int    num   = 0;
            int    num2;

            do
            {
                num2 = text2.IndexOf('\n', num);
                if (num2 >= 0)
                {
                    string         valueLine      = text2.Substring(num, num2 - num + 1).Trim();
                    SpellEffectRec spellEffectRec = new SpellEffectRec();
                    spellEffectRec.Deserialize(valueLine);
                    this.m_records.Add(spellEffectRec.ID, spellEffectRec);
                    num = num2 + 1;
                }
            }while (num2 > 0);
            return(true);
        }
        public void EnumRecordsByParentID(int parentID, Predicate <SpellEffectRec> callback)
        {
            IEnumerator enumerator = this.m_records.get_Values().GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    SpellEffectRec spellEffectRec = (SpellEffectRec)enumerator.get_Current();
                    if (spellEffectRec.SpellID == parentID && !callback.Invoke(spellEffectRec))
                    {
                        break;
                    }
                }
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
        }