コード例 #1
0
        public void EnumRecords(Predicate <SpellTooltipRec> callback)
        {
            IEnumerator enumerator = this.m_records.Values.GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    object          obj  = enumerator.Current;
                    SpellTooltipRec obj2 = (SpellTooltipRec)obj;
                    if (!callback(obj2))
                    {
                        break;
                    }
                }
            }
            finally
            {
                IDisposable disposable;
                if ((disposable = (enumerator as IDisposable)) != null)
                {
                    disposable.Dispose();
                }
            }
        }
コード例 #2
0
        public bool Load(string path, AssetBundle nonLocalizedBundle, AssetBundle localizedBundle, string locale)
        {
            string text = string.Concat(new string[]
            {
                path,
                locale,
                "/SpellTooltip_",
                locale,
                ".txt"
            });

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

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

            this.m_records = new Hashtable();
            int num = 0;
            int num2;

            do
            {
                num2 = text2.IndexOf('\n', num);
                if (num2 >= 0)
                {
                    string          valueLine       = text2.Substring(num, num2 - num + 1).Trim();
                    SpellTooltipRec spellTooltipRec = new SpellTooltipRec();
                    spellTooltipRec.Deserialize(valueLine);
                    this.m_records.Add(spellTooltipRec.ID, spellTooltipRec);
                    num = num2 + 1;
                }
            }while (num2 > 0);
            return(true);
        }
コード例 #3
0
        public bool Load(string path, AssetBundle nonLocalizedBundle, AssetBundle localizedBundle, string locale)
        {
            string str = string.Concat(new string[] { path, locale, "/SpellTooltip_", locale, ".txt" });

            if (this.m_records != null)
            {
                Debug.Log(string.Concat("Already loaded static db ", str));
                return(false);
            }
            TextAsset textAsset = localizedBundle.LoadAsset <TextAsset>(str);

            if (textAsset == null)
            {
                Debug.Log(string.Concat("Unable to load static db ", str));
                return(false);
            }
            string str1 = textAsset.ToString();

            this.m_records = new Hashtable();
            int num  = 0;
            int num1 = 0;

            do
            {
                num = str1.IndexOf('\n', num1);
                if (num < 0)
                {
                    continue;
                }
                string          str2            = str1.Substring(num1, num - num1 + 1).Trim();
                SpellTooltipRec spellTooltipRec = new SpellTooltipRec();
                spellTooltipRec.Deserialize(str2);
                this.m_records.Add(spellTooltipRec.ID, spellTooltipRec);
                num1 = num + 1;
            }while (num > 0);
            return(true);
        }
コード例 #4
0
        public void EnumRecords(Predicate <SpellTooltipRec> callback)
        {
            IEnumerator enumerator = this.m_records.get_Values().GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    SpellTooltipRec spellTooltipRec = (SpellTooltipRec)enumerator.get_Current();
                    if (!callback.Invoke(spellTooltipRec))
                    {
                        break;
                    }
                }
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
        }