Example #1
0
 public bool Deserialize(JSON_VersusRule json)
 {
     if (json == null)
     {
         return(false);
     }
     this.id       = json.id;
     this.mode     = (VS_MODE)json.vsmode;
     this.coin     = json.getcoin;
     this.coinrate = json.rate <= 0 ? 1 : json.rate;
     try
     {
         if (!string.IsNullOrEmpty(json.begin_at))
         {
             this.begin_at = DateTime.Parse(json.begin_at);
         }
         if (!string.IsNullOrEmpty(json.end_at))
         {
             this.end_at = DateTime.Parse(json.end_at);
         }
     }
     catch (Exception ex)
     {
         DebugUtility.LogError(ex.Message);
         return(false);
     }
     return(true);
 }
Example #2
0
 public bool Deserialize(JSON_VersusRankParam json)
 {
     if (json == null)
     {
         return(false);
     }
     this.mId              = json.id;
     this.mVSMode          = (VS_MODE)json.btl_mode;
     this.mName            = json.name;
     this.mLimit           = json.limit;
     this.mWinPointBase    = json.win_pt_base;
     this.mLosePointBase   = json.lose_pt_base;
     this.mHUrl            = json.hurl;
     this.mDisableDateList = new List <DateTime>();
     try
     {
         if (!string.IsNullOrEmpty(json.begin_at))
         {
             this.mBeginAt = DateTime.Parse(json.begin_at);
         }
         if (!string.IsNullOrEmpty(json.end_at))
         {
             this.mEndAt = DateTime.Parse(json.end_at);
         }
         if (json.disabledate != null)
         {
             for (int index = 0; index < json.disabledate.Length; ++index)
             {
                 if (!string.IsNullOrEmpty(json.disabledate[index]))
                 {
                     this.mDisableDateList.Add(DateTime.Parse(json.disabledate[index]));
                 }
             }
         }
     }
     catch (Exception ex)
     {
         DebugUtility.LogError(ex.Message);
         return(false);
     }
     return(true);
 }