예제 #1
0
        /// <summary>
        /// 同步加载Prefab文件
        /// </summary>
        /// <returns></returns>
        public GameObject LoadPrefab(string name)
        {
            using (zstring.Block())
            {
                zstring    zname     = name.ToLower();
                zstring    assetName = zstring.Format("{0}.prefab", zname);
                GameObject obj       = LoadAssets <GameObject>(assetName);
                if (obj != null)
                {
#if UNITY_EDITOR
                    Util.ResetShader(obj);
#endif
                    string bundleName;
                    if (assetbundleMap.TryGetValue(zname, out bundleName))
                    {
                        obj.transform.GetOrAddComponent <AssetWatcher>().bundleName = bundleName;
                    }
                    else
                    {
                        Debug.LogErrorFormat("can't find {0} in bundleMap", zname);
                    }
                }
                else
                {
                    Debug.LogWarning(string.Format("load prefab error: {0}, {1}", zname, assetName));
                }
                return(obj);
            }
        }
예제 #2
0
        private IEnumerator _loadBundleAsset <T>(GameObject owner, string goName, string extension, AssetBundle bundle, Action <T> callback)
            where T : UnityEngine.Object
        {
            if (bundle != null)
            {
                using (zstring.Block())
                {
                    zstring assetName = zstring.Format("{0}{1}.{2}", GResource.RuntimeAssetsRoot.ToLower(), goName, extension.TrimStart('.'));
                    var     abcr      = bundle.LoadAssetAsync(assetName);
                    yield return(abcr);

                    var mainAsset = (T)abcr.asset;
                    if (extension == ".asset")
                    {
                        TextAssetWatcher watcher = owner.transform.GetOrAddComponent <TextAssetWatcher>();
                        string           bundleName;
                        if (assetbundleMap.TryGetValue(goName, out bundleName))
                        {
                            watcher.AddBundleName(bundleName);
                        }
                        else
                        {
                            Debug.LogError("can't find " + goName + " in assetbundleMap");
                        }
                    }
                    callback(mainAsset);
                }
            }
            else
            {
                callback(default(T));
            }
        }
예제 #3
0
        /// <summary>
        /// 同步加载资源
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="path"></param>
        /// <returns></returns>
        public T LoadAssets <T>(string path) where T : UnityEngine.Object
        {
            using (zstring.Block())
            {
                zstring assetName = path.ToLower();
                zstring ext       = Path.GetExtension(assetName);
                if (!zstring.IsNullOrEmpty(ext))
                {
                    assetName = assetName.Replace(ext, "");
                }

                AssetBundle bundle = TryGetBundleByFile(assetName);
                if (bundle == null)
                {
                    return(null);
                }

                string assetRoot = GResource.RuntimeAssetsRoot.ToLower();
                if (!assetName.StartsWith(assetRoot))
                {
                    assetName = zstring.Concat(assetRoot, path);
                }

                var asset = bundle.LoadAsset(assetName) as T;
                if (asset == null)
                {
                    Debug.LogWarning(zstring.Format("Cant find ab: {0}", assetName));
                }
                return(asset);
            }
        }
예제 #4
0
    // Update is called once per frame
    void Update()
    {
        Vector3    pos      = PlayerController.instance.transform.position;
        Vector3Int curBlock = PlayerController.GetCurrentBlock();

        int chunkX   = Mathf.FloorToInt(curBlock.x / 16f);
        int chunkY   = Mathf.FloorToInt(curBlock.y / 16f);
        int chunkZ   = Mathf.FloorToInt(curBlock.z / 16f);
        int xInChunk = curBlock.x - chunkX * 16;
        int yInChunk = curBlock.y - chunkY * 16;
        int zInChunk = curBlock.z - chunkZ * 16;

        Vector3Int posInt = pos.ToVector3Int();

        NBTHelper.GetLightsByte(posInt.x, posInt.y, posInt.z, out byte skyLight, out byte blockLight);
        byte maxLight = skyLight > blockLight ? skyLight : blockLight;

        UnityEngine.Profiling.Profiler.BeginSample("zstring");
        using (zstring.Block())
        {
            zstring text = zstring.Format(template, Application.version, GetFPS(), pos.x, pos.y, pos.z, curBlock.x, curBlock.y, curBlock.z);
            text += zstring.Format(template2, xInChunk, yInChunk, zInChunk, chunkX, chunkY, chunkZ, maxLight, skyLight, blockLight);
            if (WireFrameHelper.render)
            {
                text += zstring.Format(template3, WireFrameHelper.pos.x, WireFrameHelper.pos.y, WireFrameHelper.pos.z, WireFrameHelper.generator.name, WireFrameHelper.data);
            }
            label.text = text;

            label2.text = ChunkRefresher.GetChunkUpdatesCount() + (zstring)" chunk updates";
        }
        UnityEngine.Profiling.Profiler.EndSample();
    }
예제 #5
0
        private static void Resetzstrings(RealStatePtr L)
        {
            int gen_param_count = LuaAPI.lua_gettop(L);

            for (int index = 3; index <= gen_param_count; index++)
            {
                zstring  zstr = null;
                LuaTypes type = LuaAPI.lua_type(L, index);
                if (LuaAPI.lua_isint64(L, index))
                {
                    zstr = LuaAPI.lua_toint64(L, index);
                }
                else if (LuaAPI.lua_isinteger(L, index))
                {
                    zstr = LuaAPI.xlua_tointeger(L, index);
                }
                else if (LuaAPI.lua_isnumber(L, index))
                {
                    zstr = (float)LuaAPI.lua_tonumber(L, index);
                }
                else if (LuaTypes.LUA_TBOOLEAN == type)
                {
                    zstr = LuaAPI.lua_toboolean(L, index);
                }
                else if (LuaTypes.LUA_TSTRING == type)
                {
                    zstr = lua_tozstring(L, index);
                }
                zstrings[index - 3] = zstr;
            }
        }
예제 #6
0
파일: Test.cs 프로젝트: wpdever/zstring-1
    void Start()
    {
        using (zstring.Block())
        {
            zstring.zstring_block block01 = zstring.g_current_block;
            zstring.zstring_block block02;
            using (zstring.Block())
            {
                block02 = zstring.g_current_block;
            }
            zstring.zstring_block block03 = zstring.g_current_block;

            Debug.Log(object.ReferenceEquals(block01, block02)); //False  False
            Debug.Log(object.ReferenceEquals(block01, block03)); //False  True
            Debug.Log(object.ReferenceEquals(block02, block03)); //True   false
        }
        //zstring a = "hello";
        using (zstring.Block())
        {
            zstring a = "hello";
            zstring b = " 我曹の:-O";
            zstring c = a + b;
            zstring d = c + b;
            Debug.Log(d);
            Debug.Log(zstring.Format("aaa{0}{1}", "我曹", "喔"));
            //testSizeof();
            testSizeof02();
        }
        testSizeof();
    }
예제 #7
0
        public IPromise <GameObject> LoadPrefabAsync(string assetName)
        {
            return(LoadAssetAsync <GameObject>(assetName, "prefab", null).Then((go) =>
            {
                using (zstring.Block())
                {
                    if (go == null)
                    {
                        zstring assetPath = zstring.Concat(GResource.RuntimeAssetsRoot, assetName, ".prefab");
                        throw new Exception(zstring.Format("load prefab error: {0}", assetPath));
                    }
#if UNITY_EDITOR
                    Util.ResetShader(go);
#endif
                    string bundleName;
                    if (assetbundleMap.TryGetValue(assetName, out bundleName))
                    {
                        go.transform.GetOrAddComponent <AssetWatcher>().bundleName = bundleName;
                    }
                    else
                    {
                        Debug.LogErrorFormat("can't find {0} in bundleMap", assetName);
                    }
                }
            }).Catch(e =>
            {
                Debug.LogException(e);
            }));
        }
예제 #8
0
 public void SetCodeTextZ(int id, zstring z1)
 {
     using (zstring.Block())
     {
         UICodeText text = UICodeTextAsset.Get(id);
         SetText(zstring.Format(text.Text, z1), false);
     }
 }
예제 #9
0
        /// <summary>
        /// 从Atlas集合中加载Sprite对象
        /// </summary>
        /// <param name="spriteName">精灵图片名称</param>
        /// <param name="atlasName">图集名称:Atlas/common/common-0</param>
        /// <returns></returns>
        public static Sprite LoadSpriteFromAtlasBundle(GameObject owener, string spriteName, string atlasName)
        {
            if (AppConst.AssetBundleMode)
            {
                return(AssetBundleManager.Instance.LoadSprite(owener, spriteName, atlasName));
            }
#if UNITY_EDITOR
            using (zstring.Block())
            {
                if (atlasName.Contains("-"))
                {
                    Debug.LogErrorFormat("atlas name contains \'-\', please check your code: [sprite]{0}, [atlas]{1}", spriteName, atlasName);
                }
                zstring dir = Path.GetDirectoryName(atlasName);

                zstring extension = Path.GetExtension(spriteName);
                if (!zstring.IsNullOrEmpty(extension))
                {
                    spriteName = spriteName.Replace(extension, "");
                }

                UIAtlasCache atlas = null;
                if (!atlasMap.TryGetValue(dir, out atlas))
                {
                    zstring       rootDir      = RuntimeAssetsRoot + dir;
                    string[]      textureGuids = AssetDatabase.FindAssets("t:Texture", new string[] { rootDir });
                    List <Sprite> sprites      = new List <Sprite>();
                    for (int i = 0; i < textureGuids.Length; i++)
                    {
                        zstring relativePath = AssetDatabase.GUIDToAssetPath(textureGuids[i]);
                        zstring childDir     = Path.GetDirectoryName(relativePath);
                        if (!childDir.Equals(rootDir))
                        {
                            continue;                            //只遍历顶层目录
                        }
                        var assets = AssetDatabase.LoadAllAssetsAtPath(relativePath);

                        foreach (var asset in assets)
                        {
                            if (asset is Sprite)
                            {
                                sprites.Add(asset as Sprite);
                            }
                        }
                    }
                    atlas         = new UIAtlasCache(sprites.ToArray());
                    atlasMap[dir] = atlas;
                }

                return(atlas.GetSprite(spriteName));
            }
#endif
            return(null);
        }
예제 #10
0
 /// <summary>
 /// 加载字节数组
 /// </summary>
 /// <param name="path">无.bytes后缀的路径</param>
 /// <returns></returns>
 public byte[] LoadBytes(string path)
 {
     using (zstring.Block())
     {
         zstring   zpath   = path.ToLower();
         TextAsset textAss = LoadAssets <TextAsset>(zstring.Format("{0}.bytes", zpath));
         if (textAss != null)
         {
             return(textAss.bytes);
         }
         return(null);
     }
 }
예제 #11
0
        public Sprite LoadSprite(GameObject owner, string spriteName, string atlasName)
        {
            using (zstring.Block())
            {
                zstring assetName = atlasName.ToLower();
                zstring ext       = Path.GetExtension(assetName);
                if (!string.IsNullOrEmpty(ext))
                {
                    assetName = assetName.Replace(ext, "");
                }

                string bundleRelativePath = assetName;
                if (!assetbundleMap.TryGetValue(assetName, out bundleRelativePath))
                {
                    Debug.LogWarning(zstring.Format("{0} has no assetbundle resource", assetName));
                    return(null);
                }

                UIAtlasCache atlasCache = null;
                if (!atlasMap.TryGetValue(bundleRelativePath, out atlasCache))
                {
                    AssetBundle bundle = TryGetBundleByFile(assetName);
                    if (bundle == null)
                    {
                        return(null);
                    }

                    var assets = bundle.LoadAllAssets <Sprite>();
                    if (assets == null)
                    {
                        Debug.LogWarning(zstring.Format("Cant find sprite: {0} in bundle {1}", spriteName, bundleRelativePath));
                    }

                    atlasCache = new UIAtlasCache(assets);
                    atlasMap[bundleRelativePath] = atlasCache;
                }

                Sprite         sprite  = atlasCache.GetSprite(spriteName);
                TextureWatcher watcher = owner.transform.GetOrAddComponent <TextureWatcher>();
                watcher.AddBundleName(bundleRelativePath);

                return(sprite);
            }
        }
예제 #12
0
        public IEnumerator LoadSceneDependency(string sceneBundleName)
        {
            var deps = GetAllDependencies(sceneBundleName);

            for (int i = 0; i < deps.Count; ++i)
            {
                if (deps[i].Contains("tmp/"))
                {
                    continue;
                }
                while (bundleLoadingQueue.Contains(deps[i]))
                {
                    yield return(Yielders.EndOfFrame);
                }
                BundleInfo bundleInfo;
                if (GetBundleInfo(deps[i], out bundleInfo))
                {
                    bundleInfo.refCount++;
                }
                else
                {
                    using (zstring.Block())
                    {
                        zstring depPath = Util.DataPath + deps[i];
                        if (File.Exists(depPath))
                        {
                            bundleLoadingQueue.Add(deps[i]);
                            var abcr = AssetBundle.LoadFromFileAsync(depPath);
                            yield return(abcr);

                            bundleLoadingQueue.Remove(deps[i]);
                            AddBundleToLoaded(deps[i], abcr.assetBundle);
                            //bundleLoaded.Add(deps[i], new BundleInfo(abcr.assetBundle, deps[i]));
                        }
                        else
                        {
                            Debug.LogWarning(zstring.Format("{0} not exists", depPath));
                        }
                    }
                }
            }
        }
예제 #13
0
        private static unsafe zstring lua_tozstring(RealStatePtr L, int index)
        {
            RealStatePtr strlen;
            IntPtr       str = LuaAPI.lua_tolstring(L, index, out strlen);

            if (str != IntPtr.Zero)
            {
                int byteLen   = strlen.ToInt32();
                int strLength = Encoding.UTF8.GetCharCount((byte *)str, byteLen);
                //从zstring对象池中获取string
                zstring zstr = zstring.get(strLength);
                string  ret  = zstr;
                fixed(char *chars = ret)
                {
                    Encoding.UTF8.GetChars((byte *)str, byteLen, chars, strLength);
                }

                return(zstr);
            }
            return(null);
        }
예제 #14
0
        public Texture LoadTexture(GameObject owner, string assetPath)
        {
            using (zstring.Block())
            {
                zstring assetName = assetPath.ToLower();
                zstring ext       = Path.GetExtension(assetName);
                if (!zstring.IsNullOrEmpty(ext))
                {
                    assetName = assetName.Replace(ext, "");
                }

                AssetBundle bundle = TryGetBundleByFile(assetName);
                if (bundle == null)
                {
                    return(null);
                }

                TextureWatcher watcher = owner.transform.GetOrAddComponent <TextureWatcher>();
                string         bundleName;
                if (assetbundleMap.TryGetValue(assetName, out bundleName))
                {
                    watcher.AddBundleName(bundleName);
                }

                string assetRoot = GResource.RuntimeAssetsRoot.ToLower();
                if (!assetName.StartsWith(assetRoot))
                {
                    assetName = zstring.Concat(assetRoot, assetPath);
                }

                var asset = bundle.LoadAsset(assetName) as Texture;
                if (asset == null)
                {
                    Debug.LogWarning(zstring.Format("Cant find ab: {0}", assetName));
                }
                return(asset);
            }
        }
예제 #15
0
        static int _m_SetCodeTextZ(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                Game.UIText gen_to_be_invoked = (Game.UIText)translator.FastGetCSObj(L, 1);



                {
                    int     _id = LuaAPI.xlua_tointeger(L, 2);
                    zstring _z1 = (zstring)translator.GetObject(L, 3, typeof(zstring));

                    gen_to_be_invoked.SetCodeTextZ(_id, _z1);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
예제 #16
0
        public IEnumerator TryToGetBundleAsync(string fileName, Action <AssetBundle> callback)
        {
            using (zstring.Block())
            {
                AssetBundle bundle = null;
                string      key;
                if (!assetbundleMap.TryGetValue(fileName, out key))
                {
                    Debug.LogError(zstring.Format("{0} has no assetbundle resource", fileName));
                }
                else
                {
                    while (bundleLoadingQueue.Contains(key))
                    {
                        yield return(Yielders.EndOfFrame);
                    }
                    bundle = GetBundleFromLoaded(key);
                    if (bundle == null)
                    {
                        bundleLoadingQueue.Add(key);
                        var deps = GetAllDependencies(key);
                        for (int i = 0; i < deps.Count; ++i)
                        {
                            if (string.IsNullOrEmpty(deps[i]) || deps[i].Contains("tmp/"))
                            {
                                continue;
                            }

                            while (bundleLoadingQueue.Contains(deps[i]))
                            {
                                yield return(Yielders.EndOfFrame);
                            }
                            var depBundle = GetBundleFromLoaded(deps[i]);
                            if (depBundle == null)
                            {
                                zstring depPath = Util.DataPath + deps[i];
                                if (File.Exists(depPath))
                                {
                                    bundleLoadingQueue.Add(deps[i]);
                                    var abcr = AssetBundle.LoadFromFileAsync(depPath);
                                    yield return(abcr);

                                    bundleLoadingQueue.Remove(deps[i]);
                                    AddBundleToLoaded(deps[i], abcr.assetBundle);
                                    //bundleLoaded.Add(deps[i], new BundleInfo(abcr.assetBundle, deps[i]));
                                }
                                else
                                {
                                    Debug.LogWarning(zstring.Format("{0} not exists", depPath));
                                }
                            }
                        }
                        zstring path = Util.DataPath + key;
                        if (File.Exists(path))
                        {
                            var mainAbcr = AssetBundle.LoadFromFileAsync(path);
                            yield return(mainAbcr);

                            bundle = mainAbcr.assetBundle;
                            AddBundleToLoaded(key, bundle);
                            //if (!bundleLoaded.ContainsKey(key))
                            //    bundleLoaded.Add(key, new BundleInfo(bundle, key));
                        }
                        else
                        {
                            Debug.LogWarning(zstring.Format("{0} not exists", path));
                        }
                        bundleLoadingQueue.Remove(key);
                    }
                }
                if (callback != null)
                {
                    callback(bundle);
                }
            }
        }
예제 #17
0
        public AssetBundle TryGetBundle(string bundleName)
        {
            AssetBundle bundle = null;

            try
            {
                using (zstring.Block())
                {
                    zstring key = bundleName;
                    bundle = GetBundleFromLoaded(key);
                    if (bundle == null)
                    {
                        if (bundleLoadingQueue.Contains(key))
                        {
                            Debug.LogWarning(zstring.Format("资源正在异步加载中: {0}", key));
                            return(null);
                        }
                        else
                        {
                            var deps = GetAllDependencies(key);
                            for (int i = 0; i < deps.Count; ++i)
                            {
                                if (deps[i].Contains("tmp/"))
                                {
                                    continue;
                                }
                                var depBundle = GetBundleFromLoaded(deps[i]);
                                if (depBundle == null)
                                {
                                    if (bundleLoadingQueue.Contains(deps[i]))
                                    {
                                        Debug.LogWarning(zstring.Format("资源正在异步加载中: {0}", key));
                                        return(null);
                                    }
                                    else
                                    {
                                        zstring depPath = Util.DataPath + deps[i];
                                        if (File.Exists(depPath))
                                        {
                                            var temp = AssetBundle.LoadFromFile(depPath);
                                            AddBundleToLoaded(deps[i], temp);
                                            //bundleLoaded.Add(deps[i], new BundleInfo(temp, deps[i]));
                                        }
                                        else
                                        {
                                            throw new FileNotFoundException(zstring.Format("File {0} not exists", depPath));
                                        }
                                    }
                                }
                            }
                            zstring path = Util.DataPath + key;
                            if (File.Exists(path))
                            {
                                if (!IsBundleLoaded(key))
                                {
                                    bundle = AssetBundle.LoadFromFile(path);
                                    AddBundleToLoaded(key, bundle);
                                    //bundleLoaded.Add(key, new BundleInfo(bundle, key));
                                }
                                else
                                {
                                    throw new ArgumentException(zstring.Format("key {0} is already exist in bundleLoaded", key));
                                }
                            }
                            else
                            {
                                throw new FileNotFoundException(zstring.Format("File {0} not exists", path));
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Debug.LogWarning(string.Format("Get Assetbundle Exception, Name: {0}", bundleName));
                Debug.LogException(e);
                return(null);
            }
            return(bundle);
        }
예제 #18
0
파일: Test.cs 프로젝트: wpdever/zstring-1
    void zstringTest()
    {
        using (profiler.Sample("zstring"))
        {
            using (zstring.Block())
            {
                using (profiler.Sample("Format"))
                {
                    zstring gf = zstring.Format("Number = {0}, Float = {1} String = {2}", 123, 3.148f, "Text");
                    int     x  = 10;
                }

                using (profiler.Sample("Concat"))
                {
                    zstring it = zstring.Concat("That's ", "a lot", " of", " strings", " to ", "concat");
                    int     x  = 10;
                }

                using (profiler.Sample("Substring + IndexOf + LastIndexOf"))
                {
                    zstring path   = "Path/To/Some/File.txt";
                    int     period = path.IndexOf('.');
                    var     ext    = path.Substring(period + 1);
                    var     file   = path.Substring(path.LastIndexOf('/') + 1, 4);
                    int     x      = 10;
                }

                using (profiler.Sample("Replace (char)"))
                {
                    zstring input       = "This is some sort of text";
                    zstring replacement = input.Replace('o', '0').Replace('i', '1');
                    int     x           = 10;
                }

                using (profiler.Sample("Replace (string)"))
                {
                    zstring input       = "m_This is the is is form of text";
                    zstring replacement = input.Replace("m_", "").Replace("is", "si");
                    int     x           = 10;
                }
                using (profiler.Sample("Concat + Intern"))
                {
                    for (int i = 0; i < 4; i++)
                    {
                        dict[zstring.Concat("Item", i).Intern()] = i;
                    }
                    outsideString1 = zstring.Concat("I'm ", "long ", "gone ", "by ", "the ", "end ", "of ", "this ", "gstring block");
                    outsideString  = zstring.Concat("I'll ", "be ", "still ", "around ", "here").Intern();
                    int x = 10;
                }

                using (profiler.Sample("ToUpper + ToLower"))
                {
                    zstring s1 = "Hello";
                    zstring s2 = s1.ToUpper();
                    zstring s3 = s2 + s1.ToLower();
                    int     x  = 10;
                }
                //using (profiler.Sample("Intern"))
                //{
                //    zstring s1 = "hello world";
                //    zstring s2 = s1 + UnityEngine.Random.Range(0, 10000);
                //    string a = s2.Intern();
                //}
                if (!bigStringTest)
                {
                    return;
                }
                using (profiler.Sample("BigStringEval"))
                {
                    zstring s1 = bigString;
                    zstring s2 = s1 + "hello";
                }
            }
        }
    }
예제 #19
0
        private static int SetText(RealStatePtr L)
        {
            try
            {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
                int gen_param_count         = LuaAPI.lua_gettop(L);
                if (gen_param_count >= 2 && gen_param_count <= 12)
                {
                    if (!translator.Assignable <Game.UIText>(L, 1))
                    {
                        return(LuaAPI.luaL_error(L, "invalid arguments to Game.GameUtil.SetText!"));
                    }
                    //获取Text
                    Game.UIText _uIText = (Game.UIText)translator.GetObject(L, 1, typeof(Game.UIText));

                    //当第二个参数是string时,表示要直接赋值
                    if (LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)
                    {
                        using (zstring.Block())
                        {
                            zstring text = lua_tozstring(L, 2);
                            _uIText.SetText(text, false);
                        }
                        return(0);
                    }
                    //第二个参数是int,表示要到UICodeText取值,如果参数数量大于3, 表示要需要格式化
                    else if (LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TNUMBER)
                    {
                        int        _id      = LuaAPI.xlua_tointeger(L, 2);
                        UICodeText codeText = UICodeTextAsset.Get(_id);
                        if (gen_param_count == 2)
                        {
                            _uIText.SetText(codeText.Text, false);
                        }
                        //参数大于等于3,使用zstring格式化
                        else
                        {
                            using (zstring.Block())
                            {
                                Resetzstrings(L);
                                zstring text = null;
                                if (gen_param_count == 3)
                                {
                                    text = zstring.Format(codeText.Text, zstrings[0]);
                                }
                                if (gen_param_count == 4)
                                {
                                    text = zstring.Format(codeText.Text, zstrings[0], zstrings[1]);
                                }
                                if (gen_param_count == 5)
                                {
                                    text = zstring.Format(codeText.Text, zstrings[0], zstrings[1], zstrings[2]);
                                }
                                if (gen_param_count == 6)
                                {
                                    text = zstring.Format(codeText.Text, zstrings[0], zstrings[1], zstrings[2], zstrings[3]);
                                }
                                if (gen_param_count == 7)
                                {
                                    text = zstring.Format(codeText.Text, zstrings[0], zstrings[1], zstrings[2], zstrings[3], zstrings[4]);
                                }
                                if (gen_param_count == 8)
                                {
                                    text = zstring.Format(codeText.Text, zstrings[0], zstrings[1], zstrings[2], zstrings[3], zstrings[4], zstrings[5]);
                                }
                                if (gen_param_count == 9)
                                {
                                    text = zstring.Format(codeText.Text, zstrings[0], zstrings[1], zstrings[2], zstrings[3], zstrings[4], zstrings[5], zstrings[6]);
                                }
                                if (gen_param_count == 10)
                                {
                                    text = zstring.Format(codeText.Text, zstrings[0], zstrings[1], zstrings[2], zstrings[3], zstrings[4], zstrings[5], zstrings[6], zstrings[7]);
                                }
                                if (gen_param_count == 11)
                                {
                                    text = zstring.Format(codeText.Text, zstrings[0], zstrings[1], zstrings[2], zstrings[3], zstrings[4], zstrings[5], zstrings[6], zstrings[7], zstrings[8]);
                                }
                                if (gen_param_count == 12)
                                {
                                    text = zstring.Format(codeText.Text, zstrings[0], zstrings[1], zstrings[2], zstrings[3], zstrings[4], zstrings[5], zstrings[6], zstrings[7], zstrings[8], zstrings[9]);
                                }

                                if (text != null)
                                {
                                    _uIText.SetText(text, false);
                                }
                            }
                        }

                        return(0);
                    }
                    else
                    {
                        return(LuaAPI.luaL_error(L, "invalid arguments to Game.GameUtil.SetText!"));
                    }
                }
                else
                {
                    return(LuaAPI.luaL_error(L, "invalid arguments to Game.GameUtil.SetText!"));
                }
            }
            catch (System.Exception gen_e)
            {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }