//递归查找excel里面的帧事件 private static void addEvent(List <string> vals, int index, ref animEventTotal allEvent) { if (vals.Count <= index) { return; } if (vals[index].StartsWith("play")) { animEvent e = new animEvent(); e.clipName = vals[0]; e.eventName = vals[index]; e.frame = float.Parse(vals[index + 1]); e.args = vals[index + 2]; allEvent.eventLst.Add(e); addEvent(vals, index + 3, ref allEvent); } }
private static void getEvent(string eventPath, ref Dictionary <string, animEventTotal> events) { Dictionary <int, List <string> > dict = new Dictionary <int, List <string> >(); getExcelByPath(eventPath, ref dict); foreach (var item in dict) { List <string> vals = item.Value; animEventTotal allEvent = new animEventTotal(); addEvent(vals, 1, ref allEvent); animEvent enterEvent = new animEvent(); enterEvent.clipName = vals[0]; enterEvent.eventName = "enterState"; enterEvent.frame = 0; enterEvent.args = vals[0]; allEvent.eventLst.Add(enterEvent); events.Add(vals[0], allEvent); } }