Skip to content

Commit bfede83

Browse files
committed
LuaLoader加名字空间
1 parent 8d384c0 commit bfede83

File tree

1 file changed

+25
-21
lines changed

1 file changed

+25
-21
lines changed

unity/Assets/core/upm/Runtime/Src/Loaders/LuaLoader.cs

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,41 @@
77

88
using System.IO;
99

10-
public interface LuaLoader
10+
namespace Puerts
1111
{
12-
// string or ArrrayBuffer
13-
object ReadFile(string filepath, out string debugpath);
14-
}
1512

16-
public class LuaDefaultLoader : LuaLoader
17-
{
13+
public interface LuaLoader
14+
{
15+
// string or ArrrayBuffer
16+
object ReadFile(string filepath, out string debugpath);
17+
}
18+
19+
public class LuaDefaultLoader : LuaLoader
20+
{
1821
#if ENABLE_IL2CPP
1922
[UnityEngine.Scripting.Preserve]
2023
#endif
21-
public virtual object ReadFile(string filepath, out string debugpath)
22-
{
23-
filepath = filepath.Replace('.', '/');
24-
debugpath = filepath;
25-
if (!debugpath.EndsWith(".lua"))
26-
{
27-
debugpath += ".lua";
28-
}
29-
try
24+
public virtual object ReadFile(string filepath, out string debugpath)
3025
{
26+
filepath = filepath.Replace('.', '/');
27+
debugpath = filepath;
28+
if (!debugpath.EndsWith(".lua"))
29+
{
30+
debugpath += ".lua";
31+
}
32+
try
33+
{
3134
#if PUERTS_GENERAL
3235
return File.ReadAllText(debugpath);
3336
#else
34-
UnityEngine.TextAsset file = (UnityEngine.TextAsset)UnityEngine.Resources.Load(filepath);
35-
return (file == null) ? null : file.text;
37+
UnityEngine.TextAsset file = (UnityEngine.TextAsset)UnityEngine.Resources.Load(filepath);
38+
return (file == null) ? null : file.text;
3639
#endif
37-
}
38-
catch
39-
{
40-
return null;
40+
}
41+
catch
42+
{
43+
return null;
44+
}
4145
}
4246
}
4347
}

0 commit comments

Comments
 (0)