首页 > 代码库 > luaFramework

luaFramework

BeginStaticLibs  参考CustomSettings.cs

 

public static List<Type> staticClassTypes = new List<Type>    {                typeof(UnityEngine.Application),        typeof(UnityEngine.Time),        typeof(UnityEngine.Screen),        typeof(UnityEngine.SleepTimeout),        typeof(UnityEngine.Input),        typeof(UnityEngine.Resources),        typeof(UnityEngine.Physics),        typeof(UnityEngine.RenderSettings),        typeof(UnityEngine.QualitySettings),        typeof(UnityEngine.GL),        typeof(UnityEngine.Graphics),    };

 

 

 

LuaHelper

 

LuaFramework_LuaHelperWrap.cspublic static void Register(LuaState L)    {        L.BeginStaticLibs("LuaHelper");        L.RegFunction("GetType", GetType);        L.RegFunction("GetPanelManager", GetPanelManager);        L.RegFunction("GetResManager", GetResManager);        L.RegFunction("GetNetManager", GetNetManager);        L.RegFunction("GetSoundManager", GetSoundManager);        L.RegFunction("OnCallLuaFunc", OnCallLuaFunc);        L.RegFunction("OnJsonCallFunc", OnJsonCallFunc);        L.EndStaticLibs();    }

 

 

Debugger 

 

LuaInterface_DebuggerWrap.cs
public
static void Register(LuaState L) { L.BeginStaticLibs("Debugger"); L.RegFunction("Log", Log); L.RegFunction("LogWarning", LogWarning); L.RegFunction("LogError", LogError); L.RegFunction("LogException", LogException); L.RegVar("useLog", get_useLog, set_useLog); L.RegVar("threadStack", get_threadStack, set_threadStack); L.RegVar("logger", get_logger, set_logger); L.EndStaticLibs(); }

 

Application . lua中使用->   UnityEngine.Application

 

UnityEngine_ApplicationWrap.cspublic static void Register(LuaState L)    {        L.BeginStaticLibs("Application");        L.RegFunction("Quit", Quit);        L.RegFunction("CancelQuit", CancelQuit);        L.RegFunction("Unload", Unload);        L.RegFunction("GetStreamProgressForLevel", GetStreamProgressForLevel);        L.RegFunction("CanStreamedLevelBeLoaded", CanStreamedLevelBeLoaded);        L.RegFunction("GetBuildTags", GetBuildTags);        L.RegFunction("SetBuildTags", SetBuildTags);        L.RegFunction("HasProLicense", HasProLicense);        L.RegFunction("ExternalCall", ExternalCall);        L.RegFunction("RequestAdvertisingIdentifierAsync", RequestAdvertisingIdentifierAsync);        L.RegFunction("OpenURL", OpenURL);        L.RegFunction("GetStackTraceLogType", GetStackTraceLogType);        L.RegFunction("SetStackTraceLogType", SetStackTraceLogType);        L.RegFunction("RequestUserAuthorization", RequestUserAuthorization);        L.RegFunction("HasUserAuthorization", HasUserAuthorization);        L.RegVar("streamedBytes", get_streamedBytes, null);        L.RegVar("isPlaying", get_isPlaying, null);        L.RegVar("isFocused", get_isFocused, null);        L.RegVar("isEditor", get_isEditor, null);        L.RegVar("isWebPlayer", get_isWebPlayer, null);        L.RegVar("platform", get_platform, null);        L.RegVar("buildGUID", get_buildGUID, null);        L.RegVar("isMobilePlatform", get_isMobilePlatform, null);        L.RegVar("isConsolePlatform", get_isConsolePlatform, null);        L.RegVar("runInBackground", get_runInBackground, set_runInBackground);        L.RegVar("dataPath", get_dataPath, null);        L.RegVar("streamingAssetsPath", get_streamingAssetsPath, null);        L.RegVar("persistentDataPath", get_persistentDataPath, null);        L.RegVar("temporaryCachePath", get_temporaryCachePath, null);        L.RegVar("srcValue", get_srcValue, null);        L.RegVar("absoluteURL", get_absoluteURL, null);        L.RegVar("unityVersion", get_unityVersion, null);        L.RegVar("version", get_version, null);        L.RegVar("installerName", get_installerName, null);        L.RegVar("identifier", get_identifier, null);        L.RegVar("installMode", get_installMode, null);        L.RegVar("sandboxType", get_sandboxType, null);        L.RegVar("productName", get_productName, null);        L.RegVar("companyName", get_companyName, null);        L.RegVar("cloudProjectId", get_cloudProjectId, null);        L.RegVar("targetFrameRate", get_targetFrameRate, set_targetFrameRate);        L.RegVar("systemLanguage", get_systemLanguage, null);        L.RegVar("backgroundLoadingPriority", get_backgroundLoadingPriority, set_backgroundLoadingPriority);        L.RegVar("internetReachability", get_internetReachability, null);        L.RegVar("genuine", get_genuine, null);        L.RegVar("genuineCheckAvailable", get_genuineCheckAvailable, null);        L.RegVar("lowMemory", get_lowMemory, set_lowMemory);        L.RegVar("logMessageReceived", get_logMessageReceived, set_logMessageReceived);        L.RegVar("logMessageReceivedThreaded", get_logMessageReceivedThreaded, set_logMessageReceivedThreaded);        L.RegVar("onBeforeRender", get_onBeforeRender, set_onBeforeRender);        L.RegFunction("AdvertisingIdentifierCallback", UnityEngine_Application_AdvertisingIdentifierCallback);        L.RegFunction("LogCallback", UnityEngine_Application_LogCallback);        L.RegFunction("LowMemoryCallback", UnityEngine_Application_LowMemoryCallback);        L.EndStaticLibs();    }

 

TestProtol(在CustomSetting.cs 中注册即可使用)

 

TestProtolWrap.cspublic static void Register(LuaState L)    {        L.BeginStaticLibs("TestProtol");        L.RegVar("data", get_data, set_data);        L.EndStaticLibs();    }

 

TestStack

 

TestLuaStack.cs Instance = this;        new LuaResLoader();        testGo = gameObject;                        state = new LuaState();        state.Start();        LuaBinder.Bind(state);                state.BeginModule(null);        state.RegFunction("TestArgError", TestArgError);        state.RegFunction("TestTableInCo", TestTableInCo);        state.RegFunction("TestCycle", TestCycle);        state.RegFunction("TestNull", TestNull);        state.RegFunction("TestAddComponent", TestAddComponent);        state.RegFunction("TestOutOfBound", TestOutOfBound);        state.RegFunction("TestMulStack", TestMulStack);                    state.BeginStaticLibs("TestStack");        state.RegFunction("Test1", Test1);        state.RegFunction("PushLuaError", PushLuaError);        state.RegFunction("Test3", Test3);        state.RegFunction("Test4", Test4);        state.RegFunction("Test5", Test5);        state.RegFunction("Test6", Test6);                    state.EndStaticLibs();        state.EndModule();

 

Input

 

UnityEngine_InputWrap.cspublic static void Register(LuaState L)    {        L.BeginStaticLibs("Input");        L.RegFunction("GetAxis", GetAxis);        L.RegFunction("GetAxisRaw", GetAxisRaw);        L.RegFunction("GetButton", GetButton);        L.RegFunction("GetButtonDown", GetButtonDown);        L.RegFunction("GetButtonUp", GetButtonUp);        L.RegFunction("GetKey", GetKey);        L.RegFunction("GetKeyDown", GetKeyDown);        L.RegFunction("GetKeyUp", GetKeyUp);        L.RegFunction("GetJoystickNames", GetJoystickNames);        L.RegFunction("GetMouseButton", GetMouseButton);        L.RegFunction("GetMouseButtonDown", GetMouseButtonDown);        L.RegFunction("GetMouseButtonUp", GetMouseButtonUp);        L.RegFunction("ResetInputAxes", ResetInputAxes);        L.RegFunction("GetAccelerationEvent", GetAccelerationEvent);        L.RegFunction("GetTouch", GetTouch);        L.RegVar("compensateSensors", get_compensateSensors, set_compensateSensors);        L.RegVar("gyro", get_gyro, null);        L.RegVar("mousePosition", get_mousePosition, null);        L.RegVar("mouseScrollDelta", get_mouseScrollDelta, null);        L.RegVar("mousePresent", get_mousePresent, null);        L.RegVar("simulateMouseWithTouches", get_simulateMouseWithTouches, set_simulateMouseWithTouches);        L.RegVar("anyKey", get_anyKey, null);        L.RegVar("anyKeyDown", get_anyKeyDown, null);        L.RegVar("inputString", get_inputString, null);        L.RegVar("acceleration", get_acceleration, null);        L.RegVar("accelerationEvents", get_accelerationEvents, null);        L.RegVar("accelerationEventCount", get_accelerationEventCount, null);        L.RegVar("touches", get_touches, null);        L.RegVar("touchCount", get_touchCount, null);        L.RegVar("touchPressureSupported", get_touchPressureSupported, null);        L.RegVar("stylusTouchSupported", get_stylusTouchSupported, null);        L.RegVar("touchSupported", get_touchSupported, null);        L.RegVar("multiTouchEnabled", get_multiTouchEnabled, set_multiTouchEnabled);        L.RegVar("location", get_location, null);        L.RegVar("compass", get_compass, null);        L.RegVar("deviceOrientation", get_deviceOrientation, null);        L.RegVar("imeCompositionMode", get_imeCompositionMode, set_imeCompositionMode);        L.RegVar("compositionString", get_compositionString, null);        L.RegVar("imeIsSelected", get_imeIsSelected, null);        L.RegVar("compositionCursorPos", get_compositionCursorPos, set_compositionCursorPos);        L.RegVar("backButtonLeavesApp", get_backButtonLeavesApp, set_backButtonLeavesApp);        L.EndStaticLibs();    }

 

RenderSettings

 

UnityEngine_RenderSettingsWrap.cspublic static void Register(LuaState L)    {        L.BeginStaticLibs("RenderSettings");        L.RegFunction("__eq", op_Equality);        L.RegVar("fog", get_fog, set_fog);        L.RegVar("fogMode", get_fogMode, set_fogMode);        L.RegVar("fogColor", get_fogColor, set_fogColor);        L.RegVar("fogDensity", get_fogDensity, set_fogDensity);        L.RegVar("fogStartDistance", get_fogStartDistance, set_fogStartDistance);        L.RegVar("fogEndDistance", get_fogEndDistance, set_fogEndDistance);        L.RegVar("ambientMode", get_ambientMode, set_ambientMode);        L.RegVar("ambientSkyColor", get_ambientSkyColor, set_ambientSkyColor);        L.RegVar("ambientEquatorColor", get_ambientEquatorColor, set_ambientEquatorColor);        L.RegVar("ambientGroundColor", get_ambientGroundColor, set_ambientGroundColor);        L.RegVar("ambientLight", get_ambientLight, set_ambientLight);        L.RegVar("ambientIntensity", get_ambientIntensity, set_ambientIntensity);        L.RegVar("ambientProbe", get_ambientProbe, set_ambientProbe);        L.RegVar("subtractiveShadowColor", get_subtractiveShadowColor, set_subtractiveShadowColor);        L.RegVar("reflectionIntensity", get_reflectionIntensity, set_reflectionIntensity);        L.RegVar("reflectionBounces", get_reflectionBounces, set_reflectionBounces);        L.RegVar("haloStrength", get_haloStrength, set_haloStrength);        L.RegVar("flareStrength", get_flareStrength, set_flareStrength);        L.RegVar("flareFadeSpeed", get_flareFadeSpeed, set_flareFadeSpeed);        L.RegVar("skybox", get_skybox, set_skybox);        L.RegVar("sun", get_sun, set_sun);        L.RegVar("defaultReflectionMode", get_defaultReflectionMode, set_defaultReflectionMode);        L.RegVar("defaultReflectionResolution", get_defaultReflectionResolution, set_defaultReflectionResolution);        L.RegVar("customReflection", get_customReflection, set_customReflection);        L.EndStaticLibs();    }

 

Resources

 

UnityEngine_ResourcesWrap.cspublic static void Register(LuaState L)    {        L.BeginStaticLibs("Resources");        L.RegFunction("FindObjectsOfTypeAll", FindObjectsOfTypeAll);        L.RegFunction("Load", Load);        L.RegFunction("LoadAsync", LoadAsync);        L.RegFunction("LoadAll", LoadAll);        L.RegFunction("GetBuiltinResource", GetBuiltinResource);        L.RegFunction("UnloadAsset", UnloadAsset);        L.RegFunction("UnloadUnusedAssets", UnloadUnusedAssets);        L.EndStaticLibs();    }

 

Screen

 

UnityEngine_ScreenWrap.cspublic static void Register(LuaState L)    {        L.BeginStaticLibs("Screen");        L.RegFunction("SetResolution", SetResolution);        L.RegVar("resolutions", get_resolutions, null);        L.RegVar("currentResolution", get_currentResolution, null);        L.RegVar("width", get_width, null);        L.RegVar("height", get_height, null);        L.RegVar("dpi", get_dpi, null);        L.RegVar("fullScreen", get_fullScreen, set_fullScreen);        L.RegVar("autorotateToPortrait", get_autorotateToPortrait, set_autorotateToPortrait);        L.RegVar("autorotateToPortraitUpsideDown", get_autorotateToPortraitUpsideDown, set_autorotateToPortraitUpsideDown);        L.RegVar("autorotateToLandscapeLeft", get_autorotateToLandscapeLeft, set_autorotateToLandscapeLeft);        L.RegVar("autorotateToLandscapeRight", get_autorotateToLandscapeRight, set_autorotateToLandscapeRight);        L.RegVar("orientation", get_orientation, set_orientation);        L.RegVar("sleepTimeout", get_sleepTimeout, set_sleepTimeout);        L.EndStaticLibs();    }

 

SleepTimeout

 

UnityEngine_SleepTimeoutWrap.cspublic static void Register(LuaState L)    {        L.BeginStaticLibs("SleepTimeout");        L.RegConstant("NeverSleep", -1);        L.RegConstant("SystemSetting", -2);        L.EndStaticLibs();    }

 

Time

 

UnityEngine_TimeWrap.cspublic static void Register(LuaState L)    {        L.BeginStaticLibs("Time");        L.RegVar("time", get_time, null);        L.RegVar("timeSinceLevelLoad", get_timeSinceLevelLoad, null);        L.RegVar("deltaTime", get_deltaTime, null);        L.RegVar("fixedTime", get_fixedTime, null);        L.RegVar("unscaledTime", get_unscaledTime, null);        L.RegVar("fixedUnscaledTime", get_fixedUnscaledTime, null);        L.RegVar("unscaledDeltaTime", get_unscaledDeltaTime, null);        L.RegVar("fixedUnscaledDeltaTime", get_fixedUnscaledDeltaTime, null);        L.RegVar("fixedDeltaTime", get_fixedDeltaTime, set_fixedDeltaTime);        L.RegVar("maximumDeltaTime", get_maximumDeltaTime, set_maximumDeltaTime);        L.RegVar("smoothDeltaTime", get_smoothDeltaTime, null);        L.RegVar("maximumParticleDeltaTime", get_maximumParticleDeltaTime, set_maximumParticleDeltaTime);        L.RegVar("timeScale", get_timeScale, set_timeScale);        L.RegVar("frameCount", get_frameCount, null);        L.RegVar("renderedFrameCount", get_renderedFrameCount, null);        L.RegVar("realtimeSinceStartup", get_realtimeSinceStartup, null);        L.RegVar("captureFramerate", get_captureFramerate, set_captureFramerate);        L.RegVar("inFixedTimeStep", get_inFixedTimeStep, null);        L.EndStaticLibs();    }

 

Physics

 

UnityEngine_PhysicsWrap.cspublic static void Register(LuaState L)    {        L.BeginStaticLibs("Physics");        L.RegFunction("Raycast", Raycast);        L.RegFunction("RaycastAll", RaycastAll);        L.RegFunction("RaycastNonAlloc", RaycastNonAlloc);        L.RegFunction("Linecast", Linecast);        L.RegFunction("OverlapSphere", OverlapSphere);        L.RegFunction("OverlapSphereNonAlloc", OverlapSphereNonAlloc);        L.RegFunction("OverlapCapsule", OverlapCapsule);        L.RegFunction("OverlapCapsuleNonAlloc", OverlapCapsuleNonAlloc);        L.RegFunction("CapsuleCast", CapsuleCast);        L.RegFunction("SphereCast", SphereCast);        L.RegFunction("CapsuleCastAll", CapsuleCastAll);        L.RegFunction("CapsuleCastNonAlloc", CapsuleCastNonAlloc);        L.RegFunction("SphereCastAll", SphereCastAll);        L.RegFunction("SphereCastNonAlloc", SphereCastNonAlloc);        L.RegFunction("CheckSphere", CheckSphere);        L.RegFunction("CheckCapsule", CheckCapsule);        L.RegFunction("CheckBox", CheckBox);        L.RegFunction("OverlapBox", OverlapBox);        L.RegFunction("OverlapBoxNonAlloc", OverlapBoxNonAlloc);        L.RegFunction("BoxCastAll", BoxCastAll);        L.RegFunction("BoxCastNonAlloc", BoxCastNonAlloc);        L.RegFunction("BoxCast", BoxCast);        L.RegFunction("IgnoreCollision", IgnoreCollision);        L.RegFunction("IgnoreLayerCollision", IgnoreLayerCollision);        L.RegFunction("GetIgnoreLayerCollision", GetIgnoreLayerCollision);        L.RegFunction("ComputePenetration", ComputePenetration);        L.RegFunction("ClosestPoint", ClosestPoint);        L.RegFunction("Simulate", Simulate);        L.RegConstant("IgnoreRaycastLayer", 4);        L.RegConstant("DefaultRaycastLayers", -5);        L.RegConstant("AllLayers", -1);        L.RegVar("gravity", get_gravity, set_gravity);        L.RegVar("defaultContactOffset", get_defaultContactOffset, set_defaultContactOffset);        L.RegVar("bounceThreshold", get_bounceThreshold, set_bounceThreshold);        L.RegVar("defaultSolverIterations", get_defaultSolverIterations, set_defaultSolverIterations);        L.RegVar("defaultSolverVelocityIterations", get_defaultSolverVelocityIterations, set_defaultSolverVelocityIterations);        L.RegVar("sleepThreshold", get_sleepThreshold, set_sleepThreshold);        L.RegVar("queriesHitTriggers", get_queriesHitTriggers, set_queriesHitTriggers);        L.RegVar("queriesHitBackfaces", get_queriesHitBackfaces, set_queriesHitBackfaces);        L.RegVar("autoSimulation", get_autoSimulation, set_autoSimulation);        L.EndStaticLibs();    }

 

QualitySettings

 

UnityEngine_QualitySettingsWrap.cspublic static void Register(LuaState L)    {        L.BeginStaticLibs("QualitySettings");        L.RegFunction("GetQualityLevel", GetQualityLevel);        L.RegFunction("SetQualityLevel", SetQualityLevel);        L.RegFunction("IncreaseLevel", IncreaseLevel);        L.RegFunction("DecreaseLevel", DecreaseLevel);        L.RegFunction("__eq", op_Equality);        L.RegVar("names", get_names, null);        L.RegVar("pixelLightCount", get_pixelLightCount, set_pixelLightCount);        L.RegVar("shadows", get_shadows, set_shadows);        L.RegVar("shadowProjection", get_shadowProjection, set_shadowProjection);        L.RegVar("shadowCascades", get_shadowCascades, set_shadowCascades);        L.RegVar("shadowDistance", get_shadowDistance, set_shadowDistance);        L.RegVar("shadowResolution", get_shadowResolution, set_shadowResolution);        L.RegVar("shadowNearPlaneOffset", get_shadowNearPlaneOffset, set_shadowNearPlaneOffset);        L.RegVar("shadowCascade2Split", get_shadowCascade2Split, set_shadowCascade2Split);        L.RegVar("shadowCascade4Split", get_shadowCascade4Split, set_shadowCascade4Split);        L.RegVar("shadowmaskMode", get_shadowmaskMode, set_shadowmaskMode);        L.RegVar("masterTextureLimit", get_masterTextureLimit, set_masterTextureLimit);        L.RegVar("anisotropicFiltering", get_anisotropicFiltering, set_anisotropicFiltering);        L.RegVar("lodBias", get_lodBias, set_lodBias);        L.RegVar("maximumLODLevel", get_maximumLODLevel, set_maximumLODLevel);        L.RegVar("particleRaycastBudget", get_particleRaycastBudget, set_particleRaycastBudget);        L.RegVar("softParticles", get_softParticles, set_softParticles);        L.RegVar("softVegetation", get_softVegetation, set_softVegetation);        L.RegVar("realtimeReflectionProbes", get_realtimeReflectionProbes, set_realtimeReflectionProbes);        L.RegVar("billboardsFaceCameraPosition", get_billboardsFaceCameraPosition, set_billboardsFaceCameraPosition);        L.RegVar("maxQueuedFrames", get_maxQueuedFrames, set_maxQueuedFrames);        L.RegVar("vSyncCount", get_vSyncCount, set_vSyncCount);        L.RegVar("antiAliasing", get_antiAliasing, set_antiAliasing);        L.RegVar("desiredColorSpace", get_desiredColorSpace, null);        L.RegVar("activeColorSpace", get_activeColorSpace, null);        L.RegVar("blendWeights", get_blendWeights, set_blendWeights);        L.RegVar("asyncUploadTimeSlice", get_asyncUploadTimeSlice, set_asyncUploadTimeSlice);        L.RegVar("asyncUploadBufferSize", get_asyncUploadBufferSize, set_asyncUploadBufferSize);        L.RegVar("resolutionScalingFixedDPIFactor", get_resolutionScalingFixedDPIFactor, set_resolutionScalingFixedDPIFactor);        L.EndStaticLibs();    }

 

luaFramework