Initial commit: Client Doc docs Server Tools
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,387 @@
|
||||
#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 = XLuaBase.lua_CSFunction;
|
||||
#endif
|
||||
|
||||
using XLua;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
||||
namespace XLua.CSObjectWrap
|
||||
{
|
||||
using Utils = XLua.Utils;
|
||||
public class UnityEnginePlayerPrefsWrap
|
||||
{
|
||||
public static void __Register(RealStatePtr L)
|
||||
{
|
||||
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
||||
System.Type type = typeof(UnityEngine.PlayerPrefs);
|
||||
Utils.BeginObjectRegister(type, L, translator, 0, 0, 0, 0);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Utils.EndObjectRegister(type, L, translator, null, null,
|
||||
null, null, null);
|
||||
|
||||
Utils.BeginClassRegister(type, L, __CreateInstance, 11, 0, 0);
|
||||
Utils.RegisterFunc(L, Utils.CLS_IDX, "SetInt", _m_SetInt_xlua_st_);
|
||||
Utils.RegisterFunc(L, Utils.CLS_IDX, "GetInt", _m_GetInt_xlua_st_);
|
||||
Utils.RegisterFunc(L, Utils.CLS_IDX, "SetFloat", _m_SetFloat_xlua_st_);
|
||||
Utils.RegisterFunc(L, Utils.CLS_IDX, "GetFloat", _m_GetFloat_xlua_st_);
|
||||
Utils.RegisterFunc(L, Utils.CLS_IDX, "SetString", _m_SetString_xlua_st_);
|
||||
Utils.RegisterFunc(L, Utils.CLS_IDX, "GetString", _m_GetString_xlua_st_);
|
||||
Utils.RegisterFunc(L, Utils.CLS_IDX, "HasKey", _m_HasKey_xlua_st_);
|
||||
Utils.RegisterFunc(L, Utils.CLS_IDX, "DeleteKey", _m_DeleteKey_xlua_st_);
|
||||
Utils.RegisterFunc(L, Utils.CLS_IDX, "DeleteAll", _m_DeleteAll_xlua_st_);
|
||||
Utils.RegisterFunc(L, Utils.CLS_IDX, "Save", _m_Save_xlua_st_);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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.PlayerPrefs();
|
||||
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.PlayerPrefs constructor!");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
||||
static int _m_SetInt_xlua_st_(RealStatePtr L)
|
||||
{
|
||||
try {
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
string _key = LuaAPI.lua_tostring(L, 1);
|
||||
int _value = LuaAPI.xlua_tointeger(L, 2);
|
||||
|
||||
UnityEngine.PlayerPrefs.SetInt( _key, _value );
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
} catch(System.Exception gen_e) {
|
||||
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
||||
static int _m_GetInt_xlua_st_(RealStatePtr L)
|
||||
{
|
||||
try {
|
||||
|
||||
|
||||
|
||||
int gen_param_count = LuaAPI.lua_gettop(L);
|
||||
|
||||
if(gen_param_count == 1&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING))
|
||||
{
|
||||
string _key = LuaAPI.lua_tostring(L, 1);
|
||||
|
||||
var gen_ret = UnityEngine.PlayerPrefs.GetInt( _key );
|
||||
LuaAPI.xlua_pushinteger(L, gen_ret);
|
||||
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
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 _key = LuaAPI.lua_tostring(L, 1);
|
||||
int _defaultValue = LuaAPI.xlua_tointeger(L, 2);
|
||||
|
||||
var gen_ret = UnityEngine.PlayerPrefs.GetInt( _key, _defaultValue );
|
||||
LuaAPI.xlua_pushinteger(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.PlayerPrefs.GetInt!");
|
||||
|
||||
}
|
||||
|
||||
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
||||
static int _m_SetFloat_xlua_st_(RealStatePtr L)
|
||||
{
|
||||
try {
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
string _key = LuaAPI.lua_tostring(L, 1);
|
||||
float _value = (float)LuaAPI.lua_tonumber(L, 2);
|
||||
|
||||
UnityEngine.PlayerPrefs.SetFloat( _key, _value );
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
} catch(System.Exception gen_e) {
|
||||
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
||||
static int _m_GetFloat_xlua_st_(RealStatePtr L)
|
||||
{
|
||||
try {
|
||||
|
||||
|
||||
|
||||
int gen_param_count = LuaAPI.lua_gettop(L);
|
||||
|
||||
if(gen_param_count == 1&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING))
|
||||
{
|
||||
string _key = LuaAPI.lua_tostring(L, 1);
|
||||
|
||||
var gen_ret = UnityEngine.PlayerPrefs.GetFloat( _key );
|
||||
LuaAPI.lua_pushnumber(L, gen_ret);
|
||||
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
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 _key = LuaAPI.lua_tostring(L, 1);
|
||||
float _defaultValue = (float)LuaAPI.lua_tonumber(L, 2);
|
||||
|
||||
var gen_ret = UnityEngine.PlayerPrefs.GetFloat( _key, _defaultValue );
|
||||
LuaAPI.lua_pushnumber(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.PlayerPrefs.GetFloat!");
|
||||
|
||||
}
|
||||
|
||||
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
||||
static int _m_SetString_xlua_st_(RealStatePtr L)
|
||||
{
|
||||
try {
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
string _key = LuaAPI.lua_tostring(L, 1);
|
||||
string _value = LuaAPI.lua_tostring(L, 2);
|
||||
|
||||
UnityEngine.PlayerPrefs.SetString( _key, _value );
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
} catch(System.Exception gen_e) {
|
||||
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
||||
static int _m_GetString_xlua_st_(RealStatePtr L)
|
||||
{
|
||||
try {
|
||||
|
||||
|
||||
|
||||
int gen_param_count = LuaAPI.lua_gettop(L);
|
||||
|
||||
if(gen_param_count == 1&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING))
|
||||
{
|
||||
string _key = LuaAPI.lua_tostring(L, 1);
|
||||
|
||||
var gen_ret = UnityEngine.PlayerPrefs.GetString( _key );
|
||||
LuaAPI.lua_pushstring(L, gen_ret);
|
||||
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
if(gen_param_count == 2&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING))
|
||||
{
|
||||
string _key = LuaAPI.lua_tostring(L, 1);
|
||||
string _defaultValue = LuaAPI.lua_tostring(L, 2);
|
||||
|
||||
var gen_ret = UnityEngine.PlayerPrefs.GetString( _key, _defaultValue );
|
||||
LuaAPI.lua_pushstring(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.PlayerPrefs.GetString!");
|
||||
|
||||
}
|
||||
|
||||
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
||||
static int _m_HasKey_xlua_st_(RealStatePtr L)
|
||||
{
|
||||
try {
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
string _key = LuaAPI.lua_tostring(L, 1);
|
||||
|
||||
var gen_ret = UnityEngine.PlayerPrefs.HasKey( _key );
|
||||
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_DeleteKey_xlua_st_(RealStatePtr L)
|
||||
{
|
||||
try {
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
string _key = LuaAPI.lua_tostring(L, 1);
|
||||
|
||||
UnityEngine.PlayerPrefs.DeleteKey( _key );
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
} catch(System.Exception gen_e) {
|
||||
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
||||
static int _m_DeleteAll_xlua_st_(RealStatePtr L)
|
||||
{
|
||||
try {
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
|
||||
UnityEngine.PlayerPrefs.DeleteAll( );
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
} catch(System.Exception gen_e) {
|
||||
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
||||
static int _m_Save_xlua_st_(RealStatePtr L)
|
||||
{
|
||||
try {
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
|
||||
UnityEngine.PlayerPrefs.Save( );
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
} catch(System.Exception gen_e) {
|
||||
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user