//选择按钮指令: B/事件名称/选项1/选项2/.../ (不定长) //exp: B/DoWhat/Study/Shop/ private AVGModel DealwithChooseButton(string s) { try { string[] split = s.Split('/'); ChooseModel res = new ChooseModel(ParamUtil.StringNotNull(split[1])); for (int i = 2; i < split.Length - 1; i++) { res.Chooses.Add(new Choose(ParamUtil.StringNotNull(split[i]), i - 1)); } return(res); } catch (Exception e) { Debug.LogError(e.Message + " at DealwithChooseButton at AVGLoader.cs\n" + e.StackTrace); return(null); } }
/** * 系统指令: C/角色img/img位置/x偏移/y偏移/背景img/背景audio/ * x,y偏移默认为0,区分正负 * img位置只能填入0 1 2, 0-靠左,1-居中,2-靠右 * 只有audio相关需带上文件后缀 */ private AVGModel DealwithCommand(string s) { try { string[] split = s.Split('/'); return(new CommandModel( ParamUtil.StringNotNull(split[1]), ParamUtil.ParseString2Int(split[2], 1), ParamUtil.ParseString2Int(split[3], 0), ParamUtil.ParseString2Int(split[4], 0), ParamUtil.StringNotNull(split[5]), ParamUtil.StringNotNull(split[6]) )); } catch (Exception e) { Debug.LogError(e.Message + " at DealwithCommand() at AVGLoader.cs\n" + e.StackTrace); return(null); } }
//文本指令: T/角色名/对话文本/语音/延迟索引:延迟时间/.../ (不定长) //exp: T/Jack/Hello/Jack01.mp3/2:0.5/ (在播放到e时候延迟0.5s) private AVGModel DealwithText(string s) { try { string[] split = s.Split('/'); List <TextModel.TextDelay> delayList = new List <TextModel.TextDelay>(); for (int i = 4; i < split.Length - 1; i++) { string[] delaySplit = split[i].Split(':'); if (delaySplit.Length == 2) { delayList.Add(new TextModel.TextDelay( ParamUtil.ParseString2Float(delaySplit[1], 0), ParamUtil.ParseString2Int(delaySplit[0], 0))); } else { if (delaySplit[0] == "") { continue; } Debug.LogError("Text Delay Format Error: " + i + ": " + split[i]); } } return(new TextModel( ParamUtil.StringNotNull(split[1]), ParamUtil.StringNotNull(split[2]), ParamUtil.StringNotNull(split[3]), delayList)); } catch (Exception e) { Debug.LogError(e.Message + " at DealwithText at AVGLoader.cs\n" + e.StackTrace); return(null); } }