-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
60 changed files
with
1,791 additions
and
323 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
68 changes: 0 additions & 68 deletions
68
.idea/.idea.UnityResourceManagement/.idea/contentModel.xml
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
.idea/.idea.UnityResourceManagement/.idea/projectSettingsUpdater.xml
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,135 @@ | ||
using System.Collections; | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using YKFramwork.ResMgr; | ||
|
||
public class Example : MonoBehaviour | ||
{ | ||
private DefResLoadCfg cfg; | ||
// Start is called before the first frame update | ||
void Start() | ||
{ | ||
// var rep = ResMgr.Instance.LoadGroup("test", a => | ||
// { | ||
// GameObject.Instantiate(ResMgr.Instance.GetRes("Cube_prefab")); | ||
// },null); | ||
cfg = ResMgr.Instance.cfg as DefResLoadCfg; | ||
cfg.Init(() => | ||
{ | ||
Debug.LogError("初始化配置成功"); | ||
}); | ||
} | ||
|
||
// Update is called once per frame | ||
void Update() | ||
{ | ||
|
||
} | ||
|
||
private GameObject mCubePrefab; | ||
private GameObject mp3; | ||
private GameObject mCubeRed; | ||
private void OnGUI() | ||
{ | ||
var stH = GUILayout.Height(50); | ||
var stW = GUILayout.Width(200); | ||
GUILayout.BeginHorizontal(); | ||
if (GUILayout.Button("load test group",stH,stW)) | ||
{ | ||
TestLoadGroup(); | ||
} | ||
|
||
if (GUILayout.Button("del",stH,stW)) | ||
{ | ||
if (mCubePrefab) | ||
{ | ||
GameObject.Destroy(mCubePrefab); | ||
mCubePrefab = null; | ||
} | ||
} | ||
GUILayout.EndHorizontal(); | ||
|
||
GUILayout.BeginHorizontal(); | ||
if (GUILayout.Button("get test Group Mp3 ",stH,stW)) | ||
{ | ||
TestGetRes(); | ||
} | ||
|
||
if (GUILayout.Button("del",stH,stW)) | ||
{ | ||
if (mp3) | ||
{ | ||
GameObject.Destroy(mp3); | ||
mp3 = null; | ||
} | ||
} | ||
GUILayout.EndHorizontal(); | ||
|
||
GUILayout.BeginHorizontal(); | ||
if (GUILayout.Button("get async by url",stH,stW)) | ||
{ | ||
TestResAsyncByUrl(); | ||
} | ||
if (GUILayout.Button("del",stH,stW)) | ||
{ | ||
if (mCubeRed) | ||
{ | ||
GameObject.Destroy(mCubeRed); | ||
mCubeRed = null; | ||
} | ||
} | ||
GUILayout.EndHorizontal(); | ||
|
||
GUILayout.BeginHorizontal(); | ||
if (GUILayout.Button("UnLoad",stH,stW)) | ||
{ | ||
TestUnLoad(); | ||
} | ||
GUILayout.EndHorizontal(); | ||
|
||
} | ||
|
||
|
||
public void TestLoadGroup() | ||
{ | ||
var rep = ResMgr.Instance.LoadGroup("test", a => | ||
{ | ||
if(mCubePrefab == null) | ||
mCubePrefab = GameObject.Instantiate(ResMgr.Instance.GetRes("Cube_prefab")) as GameObject; | ||
},null); | ||
} | ||
|
||
public void TestGetRes() | ||
{ | ||
if(mp3 != null) return; | ||
var rep = ResMgr.Instance.GetRes("AchievementUnlocked_mp3"); | ||
if (rep == null) | ||
{ | ||
Debug.LogError("请先加载资源再同步获取资源"); | ||
return; | ||
} | ||
mp3 = new GameObject("mp3"); | ||
var audioSource = mp3.AddComponent<AudioSource>(); | ||
audioSource.clip = rep as AudioClip; | ||
audioSource.loop = true; | ||
audioSource.Play(); | ||
} | ||
|
||
public void TestResAsyncByUrl() | ||
{ | ||
if(mCubeRed != null) return; | ||
ResMgr.Instance.GetResAsyncByUrl("e://New Folder 2/New Folder/Cube_Red.prefab", cubeRed => | ||
{ | ||
if (cubeRed == null) | ||
{ | ||
Debug.LogError("e://New Folder 2/New Folder/Cube_Red.prefab"); | ||
} | ||
else | ||
{ | ||
mCubeRed = GameObject.Instantiate(cubeRed) as GameObject; | ||
} | ||
}); | ||
} | ||
|
||
public void TestUnLoad() | ||
{ | ||
ResMgr.Instance.UnloadUnused(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
using System.Net; | ||
using UnityEngine; | ||
using UnityEngine.Networking; | ||
using YKFramwork.ResMgr; | ||
|
||
public class ExampleVersion:MonoBehaviour | ||
{ | ||
private void Start() | ||
{ | ||
var getUrl = UnityWebRequest.Get(ResMgr.Instance.cfg.RootABPath + "/version"); | ||
getUrl.SendWebRequest().completed += op => | ||
{ | ||
UnityWebRequestAsyncOperation wepop = op as UnityWebRequestAsyncOperation; | ||
if (string.IsNullOrEmpty(wepop.webRequest.error)) | ||
{ | ||
var ver = new YKFramwork.ResMgr.VersionCtrl.Version(wepop.webRequest.downloadHandler.data); | ||
Debug.Log(ver.version); | ||
foreach (var abInfo in ver.AllAB) | ||
{ | ||
Debug.Log("name:"+abInfo.name+"/sha1:"+abInfo.sha1+"/size:"+abInfo.size); | ||
} | ||
} | ||
}; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.