//解析TextAsset返回实体模型列表 public virtual bool Analysis(out List <AVGModel> modelList, TextAsset textAsset) { try { modelList = new List <AVGModel>(); string[] split = textAsset.text.Split('\n'); foreach (string s in split) { AVGModel model = null; if (s[0] == '#' || s[0] == '\n' || s[0] == ' ') { continue; } //省略注释 else if (s[0].ToString().ToLower().Equals("c")) { model = DealwithCommand(s); if (model == null) { throw new Exception("Command analysis error!"); } } else if (s[0].ToString().ToLower().Equals("t")) { model = DealwithText(s); if (model == null) { throw new Exception("Text analysis error!"); } } else if (s[0].ToString().ToLower().Equals("b")) { model = DealwithChooseButton(s); if (model == null) { throw new Exception("Choose analysis error!"); } } else if (s[0].ToString().ToLower().Equals("a")) { model = DealwithAnimation(s); if (model == null) { throw new Exception("Animation analysis error!"); } } else { throw new Exception("Model analysis error at index 0!"); } AddModel(modelList, model); } return(true); } catch (Exception e) { Debug.LogError(e.Message + " at Analysis() at AVGLoader.cs\n" + e.StackTrace); modelList = null; return(false); } }
//添加模型 private void AddModel(List <AVGModel> modelList, AVGModel model) { modelList.Add(model); }