Exemplo n.º 1
0
 static public int get_bytes(IntPtr l)
 {
     try {
         Hugula.BytesAsset self = (Hugula.BytesAsset)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.bytes);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 2
0
 static public int constructor(IntPtr l)
 {
     try {
         Hugula.BytesAsset o;
         o = new Hugula.BytesAsset();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 3
0
 static public int set_bytes(IntPtr l)
 {
     try {
         Hugula.BytesAsset self = (Hugula.BytesAsset)checkSelf(l);
         System.Byte[]     v;
         checkArray(l, 2, out v);
         self.bytes = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Load the specified localization dictionary.
        /// </summary>
        static bool LoadDictionary(string value)
        {
            if (value.Equals(SystemLanguage.ChineseSimplified.ToString()))
            {
                value = SystemLanguage.Chinese.ToString();
            }

            string assetName = Common.LANGUAGE_PREFIX + value.ToLower();
            string abName    = CUtils.GetRightFileName(assetName + Common.CHECK_ASSETBUNDLE_SUFFIX);

            CRequest req = CRequest.Get();

            req.relativeUrl = abName;
            req.assetName   = assetName;
            req.assetType   = typeof(BytesAsset);
            req.async       = false;
            var uri = new UriGroup();

            uri.Add(CUtils.GetRealPersistentDataPath(), true);
            uri.Add(CUtils.GetRealStreamingAssetsPath());
            req.uris = uri;

            req.OnComplete += delegate(CRequest req1)
            {
                BytesAsset main = req1.data as BytesAsset; //www.assetBundle.mainAsset as TextAsset;
                byte[]     txt  = main.bytes;
#if UNITY_EDITOR
                Debug.Log(mLanguage + " is loaded " + txt.Length + " " + Time.frameCount);
#endif
                if (txt != null)
                {
                    Load(txt);
                }
                SelectLanguage(mLanguage);
                CacheManager.Unload(req1.keyHashCode);
                localizationHasBeenSet = true;
            };

            req.OnEnd += delegate(CRequest req1)
            {
                if (!value.ToLower().Equals(SystemLanguage.English.ToString().ToLower()))
                {
                    language = SystemLanguage.English.ToString();
                }
            };

            ResourcesLoader.LoadAsset(req);
            return(false);
        }
Exemplo n.º 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        static void LoadDictionaryInEditor(string value)
        {
            string url = "Assets/Config/Lan/" + Common.LANGUAGE_PREFIX + value.ToLower() + ".csv";

            Debug.Log(url);
            Object m = UnityEditor.AssetDatabase.LoadAssetAtPath(url, typeof(BytesAsset));

            BytesAsset main = m as BytesAsset;

            if (main)
            {
                byte[] txt = main.bytes;
                // mLanguage = value;
                // Debug.Log(mLanguage + "   Editor is loaded " + txt.Length);
                //Debug.Log(System.Text.Encoding.UTF8.GetString(txt));
                if (txt != null)
                {
                    Load(txt);
                }
            }
            localizationHasBeenSet = true;
        }