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

Commit 425de3c

Browse files
committed
扩展ResourceManager
1 parent a1d3f99 commit 425de3c

File tree

127 files changed

+163
-29262
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+163
-29262
lines changed

Assets/Game/HotFix/Main.lua.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
require('mobdebug').start()
2+
require('test002')
3+
require('Resource')
24

35
local Test=require("Test")
46
local q=10
@@ -7,6 +9,8 @@ function Start()
79
q=1000
810
print("lua start")
911
print(q)
12+
Res:LoadAsset("xx","sss");
13+
test002:hello()
1014
--CS.GameMode.Resource.Load("hotfix",)
1115
end
1216

Assets/Game/HotFix/Resource.lua.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Res={}
2+
3+
local gameMode=CS.GameFramework.Taurus.GameMode
4+
5+
function Res:LoadAsset(ab,path)
6+
local tx=CS.UnityEngine.TextAsset()
7+
tx=gameMode.Resource:HotFixLoadAsset(tx,"hotfix","Assets/Game/HotFix/Test.lua.txt")
8+
print(tx.text)
9+
end

Assets/ThirdParty/XLua/Gen/link.xml.meta renamed to Assets/Game/HotFix/Resource.lua.txt.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Game/HotFix/test002.lua.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
test002={}
2+
3+
function test002:hello()
4+
print("test0002 hello")
5+
end
6+

Assets/Game/HotFix/test002.lua.txt.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/Scripts/Lua/Main.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
require('mobdebug').start()
2+
require('test002')
3+
require('Resource')
24

35
local Test=require("Test")
46
local q=10
@@ -7,6 +9,8 @@ function Start()
79
q=1000
810
print("lua start")
911
print(q)
12+
Res:LoadAsset("xx","sss");
13+
test002:hello()
1014
--CS.GameMode.Resource.Load("hotfix",)
1115
end
1216

Assets/Game/Scripts/Lua/Resource.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Res={}
2+
3+
local gameMode=CS.GameFramework.Taurus.GameMode
4+
5+
function Res:LoadAsset(ab,path)
6+
local tx=CS.UnityEngine.TextAsset()
7+
tx=gameMode.Resource:HotFixLoadAsset(tx,"hotfix","Assets/Game/HotFix/Test.lua.txt")
8+
print(tx.text)
9+
end

Assets/Game/Scripts/Lua/Resource.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/Scripts/Lua/test002.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
test002={}
2+
3+
function test002:hello()
4+
print("test0002 hello")
5+
end
6+

Assets/Game/Scripts/Lua/test002.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/ThirdParty/XLua/Gen.meta renamed to Assets/GameFramework/HotFix/Extensions.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//-----------------------------------------------------------------------
2+
// <copyright>
3+
// Copyright (c) 2018 Zhang Yang. All rights reserved.
4+
// </copyright>
5+
// <describe> #Resource模块的热更新接口扩展# </describe>
6+
// <email> [email protected] </email>
7+
// <time> #2019年2月6日 19点09分# </time>
8+
//-----------------------------------------------------------------------
9+
10+
using UnityEngine;
11+
using System.Collections;
12+
using System.Collections.Generic;
13+
14+
namespace GameFramework.Taurus
15+
{
16+
[XLua.LuaCallCSharp]
17+
public static class ResourceExtensions
18+
{
19+
/// <summary>
20+
/// 加载资源
21+
/// </summary>
22+
/// <typeparam name="T"></typeparam>
23+
/// <param name="resManager"></param>
24+
/// <param name="result"></param>
25+
/// <param name="assetBundleName"></param>
26+
/// <param name="assetName"></param>
27+
/// <returns></returns>
28+
public static T HotFixLoadAsset<T>(this ResourceManager resManager,T result, string assetBundleName, string assetName) where T : UnityEngine.Object
29+
{
30+
Debug.Log($"HotFixLoadAsset--ResourceManager--{typeof(T)}");
31+
result = resManager.LoadAsset<T>(assetBundleName, assetName);
32+
return result;
33+
}
34+
35+
}
36+
}

Assets/ThirdParty/XLua/Gen/EnumWrap.cs.meta renamed to Assets/GameFramework/HotFix/Extensions/ResourceExtensions.cs.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/ThirdParty/XLua/Editor/xLua.Editor.asmdef

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
"xLua"
55
],
66
"optionalUnityReferences": [],
7-
"includePlatforms": [],
7+
"includePlatforms": [
8+
"Editor"
9+
],
810
"excludePlatforms": [],
911
"allowUnsafeCode": false
1012
}
Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
1-
using System;
2-
using UnityEditor;
3-
using UnityEngine;
4-
using CSObjectWrapEditor;
5-
using XLua;
1+
//using System;
2+
//using UnityEditor;
3+
//using UnityEngine;
4+
//using CSObjectWrapEditor;
5+
//using XLua;
66

7-
public static class BuildFromCLI
8-
{
9-
/// <summary>
10-
/// 此方法通过Unity菜单调用。
11-
/// </summary>
12-
[MenuItem("XLua/Examples/13_BuildFromCLI")]
13-
public static void BuildFromUnityMenu()
14-
{
15-
var outputDir = Application.dataPath.Substring(0, Application.dataPath.Length - "/Assets".Length) + "/output";
16-
var packageName = "xLuaGame.exe";
17-
build(outputDir, packageName);
18-
}
7+
//public static class BuildFromCLI
8+
//{
9+
// /// <summary>
10+
// /// 此方法通过Unity菜单调用。
11+
// /// </summary>
12+
// [MenuItem("XLua/Examples/13_BuildFromCLI")]
13+
// public static void BuildFromUnityMenu()
14+
// {
15+
// var outputDir = Application.dataPath.Substring(0, Application.dataPath.Length - "/Assets".Length) + "/output";
16+
// var packageName = "xLuaGame.exe";
17+
// build(outputDir, packageName);
18+
// }
1919

20-
/// <summary>
21-
/// 此方法通过命令行调用。
22-
/// </summary>
23-
public static void Build()
24-
{
25-
var outputDir = Application.dataPath.Substring(0, Application.dataPath.Length - "/Assets".Length) + "/output";
26-
var packageName = "xLuaGame.exe";
27-
build(outputDir, packageName);
28-
}
20+
// /// <summary>
21+
// /// 此方法通过命令行调用。
22+
// /// </summary>
23+
// public static void Build()
24+
// {
25+
// var outputDir = Application.dataPath.Substring(0, Application.dataPath.Length - "/Assets".Length) + "/output";
26+
// var packageName = "xLuaGame.exe";
27+
// build(outputDir, packageName);
28+
// }
2929

30-
private static void build(string outputDir,string packageName)
31-
{
32-
Debug.Log("构建开始:输出目录 " + outputDir);
33-
DelegateBridge.Gen_Flag = true;
34-
Generator.ClearAll();
35-
Generator.GenAll();
30+
// private static void build(string outputDir,string packageName)
31+
// {
32+
// Debug.Log("构建开始:输出目录 " + outputDir);
33+
// DelegateBridge.Gen_Flag = true;
34+
// Generator.ClearAll();
35+
// Generator.GenAll();
3636

37-
var levels = new string[0];
38-
var locationPathName = string.Format("{0}/{1}", outputDir, packageName);
39-
var target = BuildTarget.StandaloneWindows64;
40-
var options = BuildOptions.None;
41-
BuildPipeline.BuildPlayer(levels,locationPathName,target,options);
42-
Debug.Log("构建完成");
43-
}
44-
}
37+
// var levels = new string[0];
38+
// var locationPathName = string.Format("{0}/{1}", outputDir, packageName);
39+
// var target = BuildTarget.StandaloneWindows64;
40+
// var options = BuildOptions.None;
41+
// BuildPipeline.BuildPlayer(levels,locationPathName,target,options);
42+
// Debug.Log("构建完成");
43+
// }
44+
//}

0 commit comments

Comments
 (0)