Ejemplo n.º 1
0
 public void ReadJson(Dictionary <string, object> _jsonObj)
 {
     if (_jsonObj.ContainsKey("mTotalTime"))
     {
         mTotalTime = int.Parse(_jsonObj["mTotalTime"].ToString());
     }
     mEvents.Clear();
     if (_jsonObj.ContainsKey("mEvents"))
     {
         List <object> lst = _jsonObj["mEvents"] as List <object>;
         if (lst != null)
         {
             for (int i = 0; i < lst.Count; i++)
             {
                 Dictionary <string, object> action_json = lst[i] as Dictionary <string, object>;
                 ActionObject.ActionType     actioinType = ActionObject.ActionType.DoNothing;
                 if (action_json.ContainsKey("mActionType"))
                 {
                     actioinType = (ActionObject.ActionType) int.Parse(action_json["mActionType"].ToString());
                 }
                 ActionEvent ev = ActionFactory.CreateActionEvent(actioinType);
                 if (ev != null)
                 {
                     ev.ReadJson(action_json);
                 }
                 mEvents.Add(ev);
             }
         }
     }
 }