Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

Commit c4c3f1e

Browse files
committed
自动将.lua转为.lua.txt,方便开发与打包同步
1 parent 7313942 commit c4c3f1e

File tree

6 files changed

+82
-2
lines changed

6 files changed

+82
-2
lines changed

Assets/Game/HotFix/Main.lua.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ local Test=require("Test")
22

33
function Start()
44
print("lua start")
5-
Test:Start()
5+
CS.GameMode.Resource.Load("hotfix",)
66
end
77

88
function Update()

Assets/Game/HotFix/Test.lua

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
local M={}
2+
3+
function M.Start()
4+
print("Test lua start。!! ")
5+
end
6+
7+
function Update()
8+
print("lua update...")
9+
end
10+
11+
function Close()
12+
print("lua close")
13+
end
14+
15+
return M

Assets/Game/HotFix/Test.lua.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Game/HotFix/Test.lua.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
local M={}
22

33
function M.Start()
4-
print("Test lua start")
4+
print("Test lua start。!! ")
55
end
66

77
function Update()
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
//-----------------------------------------------------------------------
2+
// <copyright>
3+
// Copyright (c) 2018 Zhang Yang. All rights reserved.
4+
// </copyright>
5+
// <describe> #复制.lua=>.lua.txt# </describe>
6+
// <email> [email protected] </email>
7+
// <time> #2019年2月5日 17点30分# </time>
8+
//-----------------------------------------------------------------------
9+
10+
using System.Collections;
11+
using System.Collections.Generic;
12+
using UnityEditor;
13+
using UnityEngine;
14+
using System.IO;
15+
16+
namespace GameFramework.Taurus
17+
{
18+
[InitializeOnLoad]
19+
public static class HotFixBuildEditor
20+
{
21+
private static string _hotFixPath = "Game/HotFix";
22+
23+
static HotFixBuildEditor()
24+
{
25+
//强制设置unity后台运行
26+
PlayerSettings.runInBackground = true;
27+
28+
string folderPath = Path.Combine(Application.dataPath, _hotFixPath);
29+
30+
FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(folderPath,"*.lua");
31+
fileSystemWatcher.Changed += (sender, e) =>
32+
{
33+
//if (!EditorApplication.isPlayingOrWillChangePlaymode)
34+
{
35+
File.Copy(e.FullPath, e.FullPath + ".txt", true);
36+
AssetDatabase.Refresh();
37+
Debug.Log(".lua==>.lua.txt 转换完成");
38+
}
39+
};
40+
41+
fileSystemWatcher.EnableRaisingEvents = true;
42+
43+
}
44+
45+
46+
}
47+
}

Assets/Game/Scripts/Editor/HotFixBuildEditor.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)