public bool Load(string path, AssetBundle nonLocalizedBundle, AssetBundle localizedBundle, string locale)
        {
            string str = string.Concat(path, "NonLocalized/CharShipment.txt");

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

            if (textAsset == null)
            {
                Debug.Log(string.Concat("Unable to load static db ", str));
                return(false);
            }
            string str1 = textAsset.ToString();
            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();
                CharShipmentRec charShipmentRec = new CharShipmentRec();
                charShipmentRec.Deserialize(str2);
                this.m_records.Add(charShipmentRec.ID, charShipmentRec);
                num1 = num + 1;
            }while (num > 0);
            return(true);
        }
예제 #2
0
        public bool Load(string path, AssetBundle nonLocalizedBundle, AssetBundle localizedBundle, string locale)
        {
            string text = path + "NonLocalized/CharShipment.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();
                    CharShipmentRec charShipmentRec = new CharShipmentRec();
                    charShipmentRec.Deserialize(valueLine);
                    this.m_records.Add(charShipmentRec.ID, charShipmentRec);
                    num = num2 + 1;
                }
            }while (num2 > 0);
            return(true);
        }
        public void EnumRecordsByParentID(int parentID, Predicate <CharShipmentRec> callback)
        {
            IEnumerator enumerator = this.m_records.get_Values().GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    CharShipmentRec charShipmentRec = (CharShipmentRec)enumerator.get_Current();
                    if ((ulong)charShipmentRec.ContainerID == (ulong)((long)parentID) && !callback.Invoke(charShipmentRec))
                    {
                        break;
                    }
                }
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
        }
        public void EnumRecords(Predicate <CharShipmentRec> callback)
        {
            IEnumerator enumerator = this.m_records.get_Values().GetEnumerator();

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