少年修仙传客户端代码仓库
leonard Wu
2018-08-03 6d47b679599509990947f046b16f2b9eb8e5e3b4
添加lua脚本
7个文件已添加
104 ■■■■■ 已修改文件
Lua.meta 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Lua/LuaLaunch.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Lua/LuaLaunch.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Lua/LuaLoader.cs 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Lua/LuaLoader.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Lua/LuaUtility.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Lua/LuaUtility.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Lua.meta
New file
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 721b752538034ae47ba4f5d730c93524
folderAsset: yes
timeCreated: 1533301968
licenseType: Pro
DefaultImporter:
  userData:
  assetBundleName:
  assetBundleVariant:
Lua/LuaLaunch.cs
New file
@@ -0,0 +1,13 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LuaLaunch : MonoBehaviour
{
    void Awake()
    {
        LuaLoader.Init();
    }
}
Lua/LuaLaunch.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: a1c7a84d58094b247ac2f6da3b5b224f
timeCreated: 1533283530
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
Lua/LuaLoader.cs
New file
@@ -0,0 +1,34 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using XLua;
using System.IO;
public class LuaLoader
{
    static LuaLoader()
    {
        LuaUtility.env.AddLoader(new LuaEnv.CustomLoader(OnLoadFile));
    }
    public static void Init()
    {
        Load("custom.ButtonUtil");
        Load("global.logex");
    }
    public static void Load(string _file)
    {
        var command = string.Format("require '{0}'", _file);
        LuaUtility.env.DoString(command);
    }
    private static byte[] OnLoadFile(ref string _fileName)
    {
        _fileName = _fileName.Replace('.', '/');
        var path = Application.dataPath + "/Lua/" + _fileName + ".lua.txt";
        var bytes = System.Text.Encoding.UTF8.GetBytes(File.ReadAllText(path));
        return bytes;
    }
}
Lua/LuaLoader.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 4ceb42d1dda6d6a47923ef8608e3771e
timeCreated: 1533282621
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
Lua/LuaUtility.cs
New file
@@ -0,0 +1,12 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using XLua;
public class LuaUtility
{
    internal static LuaEnv env = new LuaEnv();
}
Lua/LuaUtility.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 1cda39260931b2f4690636dbfa36287a
timeCreated: 1533282695
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant: