static int _m_SetTextColor_xlua_st_(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); { Game.UIText _text = (Game.UIText)translator.GetObject(L, 1, typeof(Game.UIText)); float _x = (float)LuaAPI.lua_tonumber(L, 2); float _y = (float)LuaAPI.lua_tonumber(L, 3); float _z = (float)LuaAPI.lua_tonumber(L, 4); Game.UIUtil.SetTextColor(_text, _x, _y, _z); return(0); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
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)); } }