Exemplo n.º 1
0
 private DialogInfo getDialogInfo()
 {
     JsonData jdDialog = this.curJson ["data"][this.curId];
     DialogInfo di = new DialogInfo ();
     di.setId (this.curId);
     if (int.Parse(jdDialog ["type"].ToString()) == 1) {
         di.setType (DialogType.Select);
         JsonData jdo = jdDialog["select"];
         for (int i=0;i<jdo.Count;i++){
             Option op = new Option();
             op.setSubfield(Utils.PathURL + jdo[i]["subfield"].ToString());
             op.setTarId(int.Parse(jdo[i]["tarId"].ToString()));
             op.setOption(jdo[i]["option"].ToString());
             di.addOption(op);
         }
     } else {
         di.setType (DialogType.Dialog);
         di.setContent (jdDialog ["content"].ToString());
         try{
             di.setVoice(jdDialog["voice"].ToString());
         }catch(Exception ex){
             di.setVoice(string.Empty);
         }
     }
     try{
         di.setDelay(long.Parse(jdDialog["delay"].ToString()));
     }catch(Exception ex){
         di.setDelay(0);
     }
     return di;
 }