예제 #1
0
        /// <summary>
        /// Called via LoLManager when language data is received
        /// </summary>
        public void Load(string langCode, string json)
        {
            mCurLang = langCode;
            if (mCurLang == null) //langCode shouldn't be null
            {
                mCurLang = "";
            }

            //load up the language
            Dictionary <string, object> defs;

            if (!string.IsNullOrEmpty(json))
            {
                defs = Json.Deserialize(json) as Dictionary <string, object>;
            }
            else
            {
                defs = new Dictionary <string, object>();
            }

            mEntries = new Dictionary <string, M8.LocalizeData>(defs.Count);

            foreach (var item in defs)
            {
                string key = item.Key;
                string val = item.Value.ToString();

                M8.LocalizeData dat = new M8.LocalizeData(val, new string[0]);

                mEntries.Add(key, dat);
            }

            Refresh();
        }
예제 #2
0
        protected override bool TryGetData(string key, out M8.LocalizeData data)
        {
#if UNITY_EDITOR
            if (mEntries == null)
            {
                LoadFromReference();
            }
#endif

            if (mEntries == null)
            {
                data = new M8.LocalizeData();
                return(false);
            }

            return(mEntries.TryGetValue(key, out data));
        }