1. 修改 lua 逻辑路径文件:LuaConst.cs
public static string luaDir = Application.dataPath + "/LollipopGo/Lua";
2. 函数入口
文件:Main.lua
文件:Main.cs
using UnityEngine;
using System.Collections;
namespace LuaFramework {
/// <summary>
/// </summary>
public class Main : MonoBehaviour {
void Start() {
AppFacade.Instance.StartUp(); //启动游戏
}
}
}
3. 去除版本废弃函数
文件:CustomSettings.cs
// _GT(typeof(Light)),
// _GT(typeof(QualitySettings)),
4. 修改lua加载路径文件:LuaManager.cs
/// <summary>
/// 初始化Lua代码加载路径
/// </summary>
void InitLuaPath() {
if (AppConst.DebugMode) {
string rootPath = AppConst.FrameworkRoot;
lua.AddSearchPath(rootPath + "/Lua");
lua.AddSearchPath(rootPath + "/ToLua/Lua");
} else {
// lua.AddSearchPath(Util.DataPath + "lua");
lua.AddSearchPath(Application.dataPath+"lua");
}
}
5. C#常量定义
文件:AppConst.cs
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
namespace LuaFramework {
public class AppConst {
public const bool DebugMode = false; //调试模式-用于内部测试
/// <summary>
/// 如果想删掉框架自带的例子,那这个例子模式必须要
/// 关闭,否则会出现一些错误。
/// </summary>
public const bool ExampleMode = true; //例子模式
/// <summary>
/// 如果开启更新模式,前提必须启动框架自带服务器端。
/// 否则就需要自己将StreamingAssets里面的所有内容
/// 复制到自己的Webserver上面,并修改下面的WebUrl。
/// </summary>
public const bool UpdateMode = false; //更新模式-默认关闭
public const bool LuaByteMode = false; //Lua字节码模式-默认关闭
public const bool LuaBundleMode = true; //Lua代码AssetBundle模式
public const int TimerInterval = 1;
public const int GameFrameRate = 30; //游戏帧频
public const string AppName = "LuaFramework"; //应用程序名称
public const string LuaTempDir = "Lua/"; //临时目录
public const string AppPrefix = AppName + "_"; //应用程序前缀
public const string ExtName = ".unity3d"; //素材扩展名
public const string AssetDir = "StreamingAssets"; //素材目录
public const string WebUrl = "http://localhost:6688/"; //测试更新地址
public static string UserId = string.Empty; //用户ID
public static int SocketPort = 0; //Socket服务器端口
public static string SocketAddress = string.Empty; //Socket服务器地址
public static string FrameworkRoot {
get {
return Application.dataPath + "/" + AppName;
}
}
}
}
- run后的结果
7. 去除6步骤实例
文件:AppConst.cs
public const bool ExampleMode = false; //例子模式
8. 官方最新版本下载地址 https://github.com/Golangltd/LuaFramework_UGUI_V2 9. 社区编译通过版本 链接: https://pan.baidu.com/s/1KGMkwLkaSHqI3W4FLiLeqw 提取码: stq3
网友评论