예제 #1
0
        /// <summary>
        /// load lua bytes
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        private byte[] LoadLuaBytes(string name)
        {
            byte[] ret = null;
            var    txt = ResLoader.LoadAsset <TextAsset> (name);

            if (txt != null)
            {
                ret = txt.bytes;
                // ResLoader.Release(txt);
            }

            return(ret);
        }
예제 #2
0
        string LoadResource(string name)
        {
            // var textAsset = (TextAsset)Resources.Load("proto/" + name);
            var textAsset = ResLoader.LoadAsset <TextAsset>(name);

            if (textAsset != null)
            {
                var ret = textAsset.text;
                // Resources.UnloadAsset(textAsset);
                return(ret);
            }
            else
            {
                return(null);
            }
        }
예제 #3
0
        /// <summary>
        /// Load the specified localization dictionary.
        /// </summary>
        static async void LoadDictionary(string value)
        {
            if (value.Equals(SystemLanguage.ChineseSimplified.ToString()))
            {
                value = SystemLanguage.Chinese.ToString();
            }

            string assetName = Common.LANGUAGE_PREFIX + value.ToLower();

            var   task = ResLoader.LoadAssetAsyncTask <BytesAsset>(assetName);
            await task;
            var   main = task.Result;

            if (main != null)
            {
                byte[] txt = main.bytes;
#if UNITY_EDITOR
                Debug.Log(mLanguage + " is loaded " + txt.Length + " " + Time.frameCount);
#endif
                if (txt != null)
                {
                    Load(txt);
                }
                // CacheManager.Subtract(abName);
                // ResLoader.Subtract(abName);
                localizationHasBeenSet = true;
            }
            else
            {
                if (!value.ToLower().Equals(SystemLanguage.English.ToString().ToLower()))
                {
                    language = SystemLanguage.English.ToString();
                }
            }

            // return false;
        }