Skip to content

Commit 705636a

Browse files
committed
2018兼容
1 parent 8884b7e commit 705636a

File tree

3 files changed

+37
-25
lines changed

3 files changed

+37
-25
lines changed

unity/upms/core/Editor/Src/CJSImporter.cs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,24 @@
1313
using UnityEditor.Experimental.AssetImporters;
1414
#endif
1515
using UnityEngine;
16-
17-
[ScriptedImporter(1, "cjs")]
18-
public class CJSImporter : ScriptedImporter
16+
17+
namespace Puerts.Editor
1918
{
20-
public override void OnImportAsset(AssetImportContext ctx)
19+
[ScriptedImporter(1, "cjs")]
20+
public class CJSImporter : ScriptedImporter
2121
{
22-
TextAsset subAsset = new TextAsset(File.ReadAllText(ctx.assetPath));
23-
ctx.AddObjectToAsset("text", subAsset);
24-
ctx.SetMainObject(subAsset);
22+
public override void OnImportAsset(AssetImportContext ctx)
23+
{
24+
TextAsset subAsset = new TextAsset(File.ReadAllText(ctx.assetPath));
25+
ctx.AddObjectToAsset("text", subAsset);
26+
ctx.SetMainObject(subAsset);
2527

26-
#if ENABLE_CJS_AUTO_RELOAD
27-
Puerts.JsEnv.ClearAllModuleCaches();
28-
#endif
28+
#if ENABLE_CJS_AUTO_RELOAD
29+
Puerts.JsEnv.ClearAllModuleCaches();
30+
#endif
31+
}
2932
}
33+
3034
}
3135

3236
#endif

unity/upms/core/Editor/Src/LuaImporter.cs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,20 @@
1313
using UnityEditor.Experimental.AssetImporters;
1414
#endif
1515
using UnityEngine;
16-
17-
[ScriptedImporter(1, "lua")]
18-
public class LuaImporter : ScriptedImporter
16+
17+
namespace Puerts.Editor
1918
{
20-
public override void OnImportAsset(AssetImportContext ctx)
19+
[ScriptedImporter(1, "lua")]
20+
public class LuaImporter : ScriptedImporter
2121
{
22-
TextAsset subAsset = new TextAsset(File.ReadAllText(ctx.assetPath));
23-
ctx.AddObjectToAsset("text", subAsset);
24-
ctx.SetMainObject(subAsset);
22+
public override void OnImportAsset(AssetImportContext ctx)
23+
{
24+
TextAsset subAsset = new TextAsset(File.ReadAllText(ctx.assetPath));
25+
ctx.AddObjectToAsset("text", subAsset);
26+
ctx.SetMainObject(subAsset);
27+
}
2528
}
29+
2630
}
2731

2832
#endif

unity/upms/core/Editor/Src/MJSImporter.cs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,24 @@
1313
using UnityEditor.Experimental.AssetImporters;
1414
#endif
1515
using UnityEngine;
16-
17-
[ScriptedImporter(1, "mjs")]
18-
public class MJSImporter : ScriptedImporter
16+
17+
namespace Puerts.Editor
1918
{
20-
public override void OnImportAsset(AssetImportContext ctx)
19+
[ScriptedImporter(1, "mjs")]
20+
public class MJSImporter : ScriptedImporter
2121
{
22-
TextAsset subAsset = new TextAsset(File.ReadAllText(ctx.assetPath));
23-
ctx.AddObjectToAsset("text", subAsset);
24-
ctx.SetMainObject(subAsset);
22+
public override void OnImportAsset(AssetImportContext ctx)
23+
{
24+
TextAsset subAsset = new TextAsset(File.ReadAllText(ctx.assetPath));
25+
ctx.AddObjectToAsset("text", subAsset);
26+
ctx.SetMainObject(subAsset);
2527

2628
#if ENABLE_CJS_AUTO_RELOAD
27-
Puerts.JsEnv.ClearAllModuleCaches();
29+
Puerts.JsEnv.ClearAllModuleCaches();
2830
#endif
31+
}
2932
}
33+
3034
}
3135

3236
#endif

0 commit comments

Comments
 (0)