556 lines
20 KiB
C#
556 lines
20 KiB
C#
#if USE_UNI_LUA
|
|
using LuaAPI = UniLua.Lua;
|
|
using RealStatePtr = UniLua.ILuaState;
|
|
using LuaCSFunction = UniLua.CSharpFunctionDelegate;
|
|
#else
|
|
using LuaAPI = XLua.LuaDLL.Lua;
|
|
using RealStatePtr = System.IntPtr;
|
|
using LuaCSFunction = XLua.LuaDLL.lua_CSFunction;
|
|
#endif
|
|
|
|
using XLua;
|
|
using System.Collections.Generic;
|
|
|
|
|
|
namespace XLua.CSObjectWrap
|
|
{
|
|
using Utils = XLua.Utils;
|
|
public class UnityEngineFontWrap
|
|
{
|
|
public static void __Register(RealStatePtr L)
|
|
{
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
System.Type type = typeof(UnityEngine.Font);
|
|
Utils.BeginObjectRegister(type, L, translator, 0, 3, 7, 3);
|
|
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "HasCharacter", _m_HasCharacter);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetCharacterInfo", _m_GetCharacterInfo);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "RequestCharactersInTexture", _m_RequestCharactersInTexture);
|
|
|
|
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "material", _g_get_material);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "fontNames", _g_get_fontNames);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "dynamic", _g_get_dynamic);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "ascent", _g_get_ascent);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "fontSize", _g_get_fontSize);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "characterInfo", _g_get_characterInfo);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "lineHeight", _g_get_lineHeight);
|
|
|
|
Utils.RegisterFunc(L, Utils.SETTER_IDX, "material", _s_set_material);
|
|
Utils.RegisterFunc(L, Utils.SETTER_IDX, "fontNames", _s_set_fontNames);
|
|
Utils.RegisterFunc(L, Utils.SETTER_IDX, "characterInfo", _s_set_characterInfo);
|
|
|
|
|
|
Utils.EndObjectRegister(type, L, translator, null, null,
|
|
null, null, null);
|
|
|
|
Utils.BeginClassRegister(type, L, __CreateInstance, 6, 0, 0);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "CreateDynamicFontFromOSFont", _m_CreateDynamicFontFromOSFont_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "GetMaxVertsForString", _m_GetMaxVertsForString_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "GetOSInstalledFontNames", _m_GetOSInstalledFontNames_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "GetPathsToOSFonts", _m_GetPathsToOSFonts_xlua_st_);
|
|
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "textureRebuilt", _e_textureRebuilt);
|
|
|
|
|
|
|
|
|
|
|
|
Utils.EndClassRegister(type, L, translator);
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int __CreateInstance(RealStatePtr L)
|
|
{
|
|
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
if(LuaAPI.lua_gettop(L) == 1)
|
|
{
|
|
|
|
var gen_ret = new UnityEngine.Font();
|
|
translator.Push(L, gen_ret);
|
|
|
|
return 1;
|
|
}
|
|
if(LuaAPI.lua_gettop(L) == 2 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING))
|
|
{
|
|
string _name = LuaAPI.lua_tostring(L, 2);
|
|
|
|
var gen_ret = new UnityEngine.Font(_name);
|
|
translator.Push(L, gen_ret);
|
|
|
|
return 1;
|
|
}
|
|
|
|
}
|
|
catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.Font constructor!");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_CreateDynamicFontFromOSFont_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|
|
|
if(gen_param_count == 2&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2))
|
|
{
|
|
string _fontname = LuaAPI.lua_tostring(L, 1);
|
|
int _size = LuaAPI.xlua_tointeger(L, 2);
|
|
|
|
var gen_ret = UnityEngine.Font.CreateDynamicFontFromOSFont( _fontname, _size );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
if(gen_param_count == 2&& translator.Assignable<string[]>(L, 1)&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2))
|
|
{
|
|
string[] _fontnames = (string[])translator.GetObject(L, 1, typeof(string[]));
|
|
int _size = LuaAPI.xlua_tointeger(L, 2);
|
|
|
|
var gen_ret = UnityEngine.Font.CreateDynamicFontFromOSFont( _fontnames, _size );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
return LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.Font.CreateDynamicFontFromOSFont!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_GetMaxVertsForString_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
|
|
|
|
|
|
{
|
|
string _str = LuaAPI.lua_tostring(L, 1);
|
|
|
|
var gen_ret = UnityEngine.Font.GetMaxVertsForString( _str );
|
|
LuaAPI.xlua_pushinteger(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_HasCharacter(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
UnityEngine.Font gen_to_be_invoked = (UnityEngine.Font)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
char _c = (char)LuaAPI.xlua_tointeger(L, 2);
|
|
|
|
var gen_ret = gen_to_be_invoked.HasCharacter( _c );
|
|
LuaAPI.lua_pushboolean(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_GetOSInstalledFontNames_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
var gen_ret = UnityEngine.Font.GetOSInstalledFontNames( );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_GetPathsToOSFonts_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
var gen_ret = UnityEngine.Font.GetPathsToOSFonts( );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_GetCharacterInfo(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
UnityEngine.Font gen_to_be_invoked = (UnityEngine.Font)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|
|
|
if(gen_param_count == 2&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2))
|
|
{
|
|
char _ch = (char)LuaAPI.xlua_tointeger(L, 2);
|
|
UnityEngine.CharacterInfo _info;
|
|
|
|
var gen_ret = gen_to_be_invoked.GetCharacterInfo( _ch, out _info );
|
|
LuaAPI.lua_pushboolean(L, gen_ret);
|
|
translator.Push(L, _info);
|
|
|
|
|
|
|
|
|
|
return 2;
|
|
}
|
|
if(gen_param_count == 3&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2)&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3))
|
|
{
|
|
char _ch = (char)LuaAPI.xlua_tointeger(L, 2);
|
|
UnityEngine.CharacterInfo _info;
|
|
int _size = LuaAPI.xlua_tointeger(L, 3);
|
|
|
|
var gen_ret = gen_to_be_invoked.GetCharacterInfo( _ch, out _info, _size );
|
|
LuaAPI.lua_pushboolean(L, gen_ret);
|
|
translator.Push(L, _info);
|
|
|
|
|
|
|
|
|
|
return 2;
|
|
}
|
|
if(gen_param_count == 4&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2)&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3)&& translator.Assignable<UnityEngine.FontStyle>(L, 4))
|
|
{
|
|
char _ch = (char)LuaAPI.xlua_tointeger(L, 2);
|
|
UnityEngine.CharacterInfo _info;
|
|
int _size = LuaAPI.xlua_tointeger(L, 3);
|
|
UnityEngine.FontStyle _style;translator.Get(L, 4, out _style);
|
|
|
|
var gen_ret = gen_to_be_invoked.GetCharacterInfo( _ch, out _info, _size, _style );
|
|
LuaAPI.lua_pushboolean(L, gen_ret);
|
|
translator.Push(L, _info);
|
|
|
|
|
|
|
|
|
|
return 2;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
return LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.Font.GetCharacterInfo!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_RequestCharactersInTexture(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
UnityEngine.Font gen_to_be_invoked = (UnityEngine.Font)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|
|
|
if(gen_param_count == 2&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING))
|
|
{
|
|
string _characters = LuaAPI.lua_tostring(L, 2);
|
|
|
|
gen_to_be_invoked.RequestCharactersInTexture( _characters );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
if(gen_param_count == 3&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3))
|
|
{
|
|
string _characters = LuaAPI.lua_tostring(L, 2);
|
|
int _size = LuaAPI.xlua_tointeger(L, 3);
|
|
|
|
gen_to_be_invoked.RequestCharactersInTexture( _characters, _size );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
if(gen_param_count == 4&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3)&& translator.Assignable<UnityEngine.FontStyle>(L, 4))
|
|
{
|
|
string _characters = LuaAPI.lua_tostring(L, 2);
|
|
int _size = LuaAPI.xlua_tointeger(L, 3);
|
|
UnityEngine.FontStyle _style;translator.Get(L, 4, out _style);
|
|
|
|
gen_to_be_invoked.RequestCharactersInTexture( _characters, _size, _style );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
return LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.Font.RequestCharactersInTexture!");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_material(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
UnityEngine.Font gen_to_be_invoked = (UnityEngine.Font)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.material);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_fontNames(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
UnityEngine.Font gen_to_be_invoked = (UnityEngine.Font)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.fontNames);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_dynamic(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
UnityEngine.Font gen_to_be_invoked = (UnityEngine.Font)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.lua_pushboolean(L, gen_to_be_invoked.dynamic);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_ascent(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
UnityEngine.Font gen_to_be_invoked = (UnityEngine.Font)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.ascent);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_fontSize(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
UnityEngine.Font gen_to_be_invoked = (UnityEngine.Font)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.fontSize);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_characterInfo(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
UnityEngine.Font gen_to_be_invoked = (UnityEngine.Font)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.characterInfo);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_lineHeight(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
UnityEngine.Font gen_to_be_invoked = (UnityEngine.Font)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.lineHeight);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _s_set_material(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
UnityEngine.Font gen_to_be_invoked = (UnityEngine.Font)translator.FastGetCSObj(L, 1);
|
|
gen_to_be_invoked.material = (UnityEngine.Material)translator.GetObject(L, 2, typeof(UnityEngine.Material));
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _s_set_fontNames(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
UnityEngine.Font gen_to_be_invoked = (UnityEngine.Font)translator.FastGetCSObj(L, 1);
|
|
gen_to_be_invoked.fontNames = (string[])translator.GetObject(L, 2, typeof(string[]));
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _s_set_characterInfo(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
UnityEngine.Font gen_to_be_invoked = (UnityEngine.Font)translator.FastGetCSObj(L, 1);
|
|
gen_to_be_invoked.characterInfo = (UnityEngine.CharacterInfo[])translator.GetObject(L, 2, typeof(UnityEngine.CharacterInfo[]));
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _e_textureRebuilt(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|
System.Action<UnityEngine.Font> gen_delegate = translator.GetDelegate<System.Action<UnityEngine.Font>>(L, 2);
|
|
if (gen_delegate == null) {
|
|
return LuaAPI.luaL_error(L, "#2 need System.Action<UnityEngine.Font>!");
|
|
}
|
|
|
|
|
|
if (gen_param_count == 2 && LuaAPI.xlua_is_eq_str(L, 1, "+")) {
|
|
UnityEngine.Font.textureRebuilt += gen_delegate;
|
|
return 0;
|
|
}
|
|
|
|
|
|
if (gen_param_count == 2 && LuaAPI.xlua_is_eq_str(L, 1, "-")) {
|
|
UnityEngine.Font.textureRebuilt -= gen_delegate;
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.Font.textureRebuilt!");
|
|
}
|
|
|
|
}
|
|
}
|