|
@@ -67,14 +67,15 @@ public class DogProperty
|
|
|
|
|
|
public class DogBreed
|
|
|
{
|
|
|
- public string breed { get; set; }
|
|
|
+ public string breed { get; set; }
|
|
|
public Dictionary<string, string> name { get; set; }
|
|
|
public Dictionary<string, string> description { get; set; }
|
|
|
public DateTime createDate { get; set; }
|
|
|
public DateTime lastDpdate { get; set; }
|
|
|
- public int cost { get; set; }
|
|
|
- public string prefab { get; set; }
|
|
|
+ public int cost { get; set; }
|
|
|
+ public string prefab { get; set; }
|
|
|
public string[] skin { get; set; }
|
|
|
+ public Dictionary<string, string> animation_controller { get; set; }
|
|
|
}
|
|
|
|
|
|
public class DogBreedController
|
|
@@ -82,7 +83,6 @@ public class DogBreedController
|
|
|
// 读取狗的数据并放入EnviromentSetting.dogBreeds
|
|
|
public static void LoadDogBreed()
|
|
|
{
|
|
|
-
|
|
|
string filePath = EnviromentSetting.dogDBFilePath;
|
|
|
//string jsonText = File.ReadAllText(filePath);
|
|
|
// 正确的方式(跨平台工作)
|
|
@@ -102,6 +102,28 @@ public class DogBreedController
|
|
|
string json2 = dogDB["dogDB"].ToString();
|
|
|
EnviromentSetting.dogBreeds = JsonConvert.DeserializeObject<DogBreed[]>(json2);
|
|
|
}
|
|
|
+
|
|
|
+ // 根据狗的品种和anmiation类型获取动画控制器
|
|
|
+ public static string GetDogAnimationController(string breed, string animationType)
|
|
|
+ {
|
|
|
+ foreach (var dogBreed in EnviromentSetting.dogBreeds)
|
|
|
+ {
|
|
|
+ if (dogBreed.breed == breed)
|
|
|
+ {
|
|
|
+ if (dogBreed.animation_controller != null && dogBreed.animation_controller.ContainsKey(animationType))
|
|
|
+ {
|
|
|
+ return dogBreed.animation_controller[animationType];
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Debug.LogWarning($"动画类型 '{animationType}' 在品种 '{breed}' 中未找到。");
|
|
|
+ return string.Empty;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Debug.LogWarning($"品种 '{breed}' 未找到。");
|
|
|
+ return string.Empty;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|