public static bool Prefix(HMotionEyeNeckMale __instance, string _assetpath, string _file) { Debug.Log($"男性表情:加载AB资源 路径:{_assetpath} 名称:{_file}"); nowABPath = _assetpath; nowList = _file; if (TryLoadConfigCSVToNow(false, __instance)) { return(false); } return(true); }
public static void Postfix(HMotionEyeNeckMale __instance) { if (nowOverrideData != null) { //检查全局覆盖 var lst = Traverse.Create(__instance).Field("lstEyeNeck").GetValue <List <HMotionEyeNeckMale.EyeNeck> >(); if (lst != null) { for (int i = 0; i < lst.Count; i++) { MaleNeckData n = new MaleNeckData(lst[i]); lst[i] = nowOverrideData.OverrideMaleNeckData(n).ToEyeNeck(); } } } }
/// <summary> /// 尝试读取配置到当前表情 /// </summary> /// <returns></returns> public static bool TryLoadConfigCSVToNow(bool refresh, HMotionEyeNeckMale male = null) { if (Directory.Exists($"{Paths.PluginPath}/AIMaleExpression/")) { string[] vs = null; //先加载全局重写CSV LoadOverrideData(); List <HMotionEyeNeckMale.EyeNeck> list = null; if (refresh) { list = lst; } else { list = Traverse.Create(male).Field("lstEyeNeck").GetValue <List <HMotionEyeNeckMale.EyeNeck> >(); } //尝试加载姿势CSV if (File.Exists($"{Paths.PluginPath}/AIMaleExpression/{nowList}.csv")) { var lines = File.ReadAllLines($"{Paths.PluginPath}/AIMaleExpression/{nowList}.csv"); if (lines != null) { if (!refresh) { list.Clear(); } for (int i = 1; i < lines.Length; i++) { if (!string.IsNullOrEmpty(lines[i])) { vs = lines[i].Split(','); if (refresh) { lst[i - 1] = ParseEyeNeckFromValues(vs); } else { list.Add(ParseEyeNeckFromValues(vs)); } } } } if (refresh) { OverrideData(); } Debug.Log("男性表情插件:已读取插件配置覆盖原表情数据"); return(true); } //尝试加载MonoBehaviour文本 else if (File.Exists($"{Paths.PluginPath}/AIMaleExpression/{nowList}.MonoBehaviour")) { var lines = File.ReadAllLines($"{Paths.PluginPath}/AIMaleExpression/{nowList}.csv"); if (lines != null) { if (!refresh) { list.Clear(); } for (int i = 3; i < lines.Length; i++) { if (!string.IsNullOrEmpty(lines[i])) { string line = lines[i].Replace("><", ","); line = line.Replace("<", ""); line = line.Replace(">", ""); vs = line.Split(','); if (refresh) { lst[i - 3] = ParseEyeNeckFromValues(vs); } else { list.Add(ParseEyeNeckFromValues(vs)); } } } } if (refresh) { OverrideData(); } Debug.Log("男性表情插件:已读取插件配置覆盖原表情数据"); return(true); } if (refresh) { OverrideData(); } } return(false); }