public void IncreaseStat(Car_Information car, DesignConstStorage.StatList stat, int increaseAmount = 1) { string cName = car.CarName; GetFreshCarStat(); car = Game_Manager.Instance.CarStat[cName]; car.IncreaseStat(stat, increaseAmount); Param param = new Param(); //param.AddCalculation(car.CarName, GameInfoOperator.addition, increaseAmount); //BackendReturnObject bro = Backend.GameInfo.UpdateWithCalculation(DesignConstStorage.tNameCarStat, PInfo.carinDate, param); Dictionary <string, int> status = new Dictionary <string, int>(); status.Add(DesignConstStorage.CarStatDoneName[0], car.TSD); status.Add(DesignConstStorage.CarStatDoneName[1], car.BRD); status.Add(DesignConstStorage.CarStatDoneName[2], car.COD); status.Add(DesignConstStorage.CarStatDoneName[3], car.ACD); param.Add(car.CarName, status); BackendReturnObject bro = Backend.GameInfo.Update(DesignConstStorage.tNameCarStat, PInfo.carinDate, param); if (bro.IsSuccess()) { #if UNITY_EDITOR int temp = 0; switch (stat) { case DesignConstStorage.StatList.accelerating: temp = car.ACD; break; case DesignConstStorage.StatList.brake: temp = car.BRD; break; case DesignConstStorage.StatList.cornering: temp = car.COD; break; case DesignConstStorage.StatList.topspeed: temp = car.TSD; break; } //Debug.Log("업그레이드 성공 !! 현재 업그레이드 횟수 : " + temp); #endif } else { string sCode = bro.GetStatusCode(); //Debug.LogError(sCode); } }
public void GetFreshCarStat() { BackendReturnObject bro = Backend.GameInfo.GetPrivateContents(DesignConstStorage.tNameCarStat); var cStat = bro.GetReturnValuetoJSON()[0][0]; Dictionary <string, Car_Information> cData = new Dictionary <string, Car_Information>(); foreach (var key in cStat.Keys) { string k = key; switch (k) { case "inDate": PInfo.carinDate = cStat[k][0].ToString(); break; case "client_date": case "updatedAt": break; default: Car_Information cInfo = new Car_Information(); var stat = cStat[k][0]; cInfo.CarName = k; foreach (var sKey in stat.Keys) { //Debug.LogError(string.Format("{0} {1}", sKey, stat[sKey][0].ToString())); //cInfo.CarName = sKey; DesignConstStorage.StatList s = DesignConstStorage.StatList.brake; switch (sKey) { case "TSD": s = DesignConstStorage.StatList.topspeed; break; case "ACD": s = DesignConstStorage.StatList.accelerating; break; case "COD": s = DesignConstStorage.StatList.cornering; break; case "BRD": s = DesignConstStorage.StatList.brake; break; case carSizeString: cInfo.SetSize(stat[sKey][0].ToString()); continue; } cInfo.SetDoneInfo(s, Convert.ToInt32(stat[sKey][0].ToString())); } cInfo.SetPurchase(); cData.Add(k, cInfo); break; } ; } foreach (var car in DesignConstStorage.CarDataTable.Rows) { string carName = car.Get <string>("index"); if (!cData.ContainsKey(carName)) { Car_Information cInfo = new Car_Information(); cInfo.CarName = carName; cInfo.SetDoneInfo(DesignConstStorage.StatList.accelerating); cInfo.SetDoneInfo(DesignConstStorage.StatList.brake); cInfo.SetDoneInfo(DesignConstStorage.StatList.cornering); cInfo.SetDoneInfo(DesignConstStorage.StatList.topspeed); cInfo.SetPurchase(false); cData.Add(carName, cInfo); } } Game_Manager.Instance.CarStat = cData; }