TuJian
This commit is contained in:
@@ -26,29 +26,34 @@ public class FishResourcesData
|
||||
/// </summary>
|
||||
public List<int> dieAudio;
|
||||
/// <summary>
|
||||
/// 爆奖音效
|
||||
/// 爆奖音效
|
||||
/// </summary>
|
||||
public Dictionary<string, int> dieGlodAduio;
|
||||
|
||||
const string prefabFish_AALabel="FishPrefab";
|
||||
const string dieSpine_AALabel = "DieSpine";
|
||||
const string Sprite_AALabel = "TuJian";
|
||||
|
||||
|
||||
|
||||
private static Dictionary<string,int> FishResourcesPrefabsDic ;//prefabpath--id
|
||||
private static Dictionary<string,int> FishResourcesSpineDieDic ;//dieSpinepath--id
|
||||
static FishResourcesData()
|
||||
private static Dictionary<string,int> FishResourcesSpriteDic;//Spritepath--id
|
||||
static FishResourcesData()
|
||||
{
|
||||
string prefabFishPath = Resources.Load<TextAsset>("tbfishresources").text;
|
||||
var v = JsonConvert.DeserializeObject<List<FishResourcesData>>(prefabFishPath);
|
||||
FishResourcesPrefabsDic=new Dictionary<string, int>();
|
||||
fishResourcesDatasDic = new Dictionary<int, FishResourcesData>();
|
||||
FishResourcesSpineDieDic = new Dictionary<string, int>();
|
||||
FishResourcesSpriteDic = new Dictionary<string, int>();
|
||||
foreach (var item in v)
|
||||
{
|
||||
if (item.prefabFishResourcesPath!=null&& item.prefabFishResourcesPath != "")
|
||||
{
|
||||
Debug.Log($"添加鱼资源数据: {item.fishNumber} - {item.prefabFishResourcesPath}");
|
||||
FishResourcesPrefabsDic.Add(item.prefabFishResourcesPath, item.fishNumber);
|
||||
FishResourcesSpriteDic.Add(item.prefabFishResourcesPath, item.fishNumber);
|
||||
if (item.dieEffectAssets!=null&&item.dieEffectAssets!="")
|
||||
{
|
||||
FishResourcesSpineDieDic.Add(item.dieEffectAssets, item.fishNumber);
|
||||
@@ -57,6 +62,7 @@ public class FishResourcesData
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +70,7 @@ public class FishResourcesData
|
||||
|
||||
private static Dictionary<int, GameObject> fishPrefabDic;//id--prefabs
|
||||
public static Dictionary<int, FishResourcesData> fishResourcesDatasDic;//id--FishResourcesData
|
||||
public static Dictionary<int, Sprite> fishResourcesSpritesDic;//id--Sprite
|
||||
private static Dictionary<int, SkeletonDataAsset> diePrefabDic;//id--SkeletonDataAsset
|
||||
|
||||
public static async void LoadFishAssetsData()
|
||||
@@ -73,6 +80,8 @@ public class FishResourcesData
|
||||
|
||||
fishPrefabDic = new Dictionary<int, GameObject>();
|
||||
diePrefabDic= new Dictionary<int, SkeletonDataAsset>();
|
||||
fishResourcesSpritesDic = new Dictionary<int, Sprite>();
|
||||
|
||||
|
||||
var keys = new List<string> { prefabFish_AALabel, GameManager.Instance.gameData.currGameType.ToString() };
|
||||
await Addressables.LoadAssetsAsync<GameObject>(keys, prefab =>
|
||||
@@ -83,14 +92,25 @@ public class FishResourcesData
|
||||
prefab.GetComponent<MonsterContral>().fishTypeID = FishResourcesPrefabsDic[prefab.name];
|
||||
}
|
||||
}, MergeMode.Intersection).Task;
|
||||
keys = new List<string> {dieSpine_AALabel,/* GameManager.Instance.gameData.currGameType.ToString()*/"XJMH" };
|
||||
Debug.Log($"加载完成,共 {fishPrefabDic.Count} 个鱼Prefab");
|
||||
keys = new List<string> {dieSpine_AALabel,/* GameManager.Instance.gameData.currGameType.ToString()*/GameManager.Instance.gameData.currGameType.ToString() };
|
||||
await Addressables.LoadAssetsAsync<SkeletonDataAsset>(keys, data =>
|
||||
{
|
||||
if (FishResourcesSpineDieDic.ContainsKey(data.name))
|
||||
{
|
||||
diePrefabDic.Add(FishResourcesSpineDieDic[data.name], data); }
|
||||
},MergeMode.Intersection).Task;
|
||||
Debug.Log($"加载完成,共 {fishPrefabDic.Count} 个鱼Prefab");
|
||||
Debug.Log($"加载完成,共 {diePrefabDic.Count} 个鱼死亡动效");
|
||||
|
||||
keys = new List<string> { Sprite_AALabel,/* GameManager.Instance.gameData.currGameType.ToString()*/GameManager.Instance.gameData.currGameType.ToString() };
|
||||
await Addressables.LoadAssetsAsync<Sprite>(keys, data =>
|
||||
{
|
||||
if (FishResourcesSpriteDic.ContainsKey(data.name))
|
||||
{
|
||||
fishResourcesSpritesDic.Add(FishResourcesSpriteDic[data.name], data);
|
||||
}
|
||||
}, MergeMode.Intersection).Task;
|
||||
Debug.Log($"加载完成,共 {fishResourcesSpritesDic.Count} 个鱼Sprite");
|
||||
}
|
||||
public static GameObject GetFishPrefab(int fishNumber)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user