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.cs
public 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.cspublic 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.cs
public 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.cs
public 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.cs
public 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.cs
public 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.cs
public 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.cs
public 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.cs
public static void Register(LuaState L)
    {
        L.BeginStaticLibs("SleepTimeout");
        L.RegConstant("NeverSleep", -1);
        L.RegConstant("SystemSetting", -2);
        L.EndStaticLibs();
    }

Time

UnityEngine_TimeWrap.cs
public 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.cs
public 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.cs
public 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();
    }
时间: 2024-11-05 06:05:54

luaFramework的相关文章

[Unity热更新]tolua# &amp; LuaFramework(十):扩展工具包

这个工具包有以下功能: 1.提供一个资源打包工具.因为LuaFramework默认对例子中的资源进行打包,不具有通用性,因此要有这样一个工具,详细的见系列二. 2.提供一个工具简化编写lua文件的步骤.按照LuaFramework的规定,如果要添加一个Panel,那么就要编写对应的Controller.View,以及修改三个框架自带的lua文件,比较繁琐,因此要有这样一个工具提高效率. 3.提供一个小型的UI框架.这个框架是针对热更新而设计的,提供c#和lua的实现,规范c#代码的编写.优点是对

toLua消息监听和发送(LuaframeWork)

基于uLua/toLua的Luaframework的lua框架的事件系统 github地址:https://github.com/jarjin/LuaFramework_NGUI Luaframework为了我写好了消息的监听和发送,也就是观察者模式的使用方式. 如下图: eventlib是消息处理的一个库. enents是作者为使我们更方便,仿造的C#的消息模式. 我们去调用这个事件系统的使用方式如下: local EventTest = require "events" funct

toLua消息监听和发送(区别于LuaframeWork框架自带的Events.lua)

基于uLua/toLua的Luaframework的lua框架的事件系统 github地址:https://github.com/jarjin/LuaFramework_NGUI 用法与Luaframework框架自带的Events.lua的用法一致,解决了回调时报错不抛错误的问题. local _Events = {} local EventDispatcher = {} function EventDispatcher:ctor( ) _Events = {} end --[[ 表结构 {

LuaFramework的网络连接、消息分发

服务端 --接收到消息,原样返回 using System; using System.Net; using System.Net.Sockets; namespace LuaFramework_UGUI_master_Server { class Program { static void Main(string[] args) { Socket listenfd = new Socket(AddressFamily.InterNetwork, SocketType.Stream, Proto

Unity3D热更新之LuaFramework篇[02]--用Lua创建自己的面板

在上篇文章 Unity3D热更新之LuaFramework篇[01]--从零开始 中,我们了解了怎么获得一个可用的LuaFramework框架. 本篇将我会先介绍一下如何配置Lua开发环境,然后分析在此框架中加载面板的流程,以及如何创建自己的面板. 1.配置Lua开发环境 有一点要说明的是,使用此种方式(ToLua+LuaFramework)做热更新,则意味着你的大部分逻辑都需要改用Lua语言来编写. 因此,开发前得先得配置好Lua开发环境.毕竟,工欲善其事,必先利其器. 环境配置大概分以下三个

Unity3D热更新之LuaFramework篇[04]--自定义UI监听方法

时隔一个多月我又回来啦! 坚持真的是很难的一件事,其它事情稍忙,就很容易说服自己把写博客的计划给推迟了. 好在终于克服了自己的惰性,今天又开始了. 本篇继续我的Luaframework学习之路. 一.规范开发模式 此前的示例中,动态加载的panel都默认以GuiCamera为父节点,且面板的大小设置得有些随意,为方便后续开发,现做一些调整和规范. 1.设定本项目的开发分辨率为1334x750(Game视图分辨率也设置为这个大小): 2.调整相机,将原有的GuiCamera从Canvas下拖离出来

Unity3D热更新之LuaFramework篇[05]--Lua脚本调用c#以及如何在Lua中使用Dotween

在上一篇文章 Unity3D热更新之LuaFramework篇[04]--自定义UI监听方法 中,我对LuaBehaviour脚本进行了扩展,添加了两个新的UI监听方法,也提到最好能单写一个脚本处理此事.本篇文章就来继续这个工作. 从Lua中调用C#代码 1.创建UI监听脚本 打开之前的工程,在Assets/LuaFrameworks/Scripts/Common下,创建一个UIEventEx.cs脚本,将LuaBehaviour.cs中的AddButtonClick以及AddInputFiel

Unity3D热更新之LuaFramework篇[06]--Lua中是怎么实现脚本生命周期的

前言 用c#开发的时候,新建的脚本都默认继承自Monobehaviour, 因此脚本才有了自己的生命周期函数,如Awake,Start, Update, OnDestroy等. 在相应的方法中实现游戏逻辑,引擎会适时调用. 而Lua在这里做为c#的一个外延语言,自然是不受Unity管理的. 不过,在前几篇文章中能看到,在XxxPanel和XxxCtrl中确实又有生命周期的影子,比如在MessagePanel.lua脚本中就存在MessagePanel.Awake和MessagePanel.OnD

Lua监听AniamtionEvent

using System; using UnityEngine; //using LuaInterface; //using UnityEngine.Events; using System.Collections.Generic; namespace LuaFramework { [RequireComponent(typeof(Animator))] public class AnimEventListener : MonoBehaviour { private Animator anima