chore(m2): 保存功能验收及后续清理前检查点
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using asap.core;
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using CodeStage.AntiCheat.ObscuredTypes;
|
||||
using game;
|
||||
@@ -133,43 +133,10 @@ namespace GameCore
|
||||
Dictionary<int, int> advertCount = new Dictionary<int, int>();
|
||||
#endregion
|
||||
|
||||
internal static game.PlayerDataStorage.PlayerKVShopState DecodeForKVLoad(IReadOnlyDictionary<string,string> raw,
|
||||
game.PlayerDataStorage.PlayerKVSchemaSnapshot snapshot,game.PlayerDataStorage.PlayerKVSchemaDiagnostics errors)
|
||||
=> game.PlayerDataStorage.PlayerKVSaveSchema.DecodeShop(raw,snapshot,errors);
|
||||
internal void ResetForKVLoad()
|
||||
{
|
||||
shopPackDailyBuyCount=new Dictionary<string,int>(StringComparer.Ordinal); shopAllPackBuyCount=new Dictionary<int,int>();
|
||||
shopGiftBuyCount=new Dictionary<int,int>(); buyData=new List<float>(); advertCount=new Dictionary<int,int>();
|
||||
Voucher=0; ChainPackData=null; VIPAdPackData=null; TurntableAdData=null;
|
||||
_diamondShopItemRecords=new Dictionary<int,ItemShopRecord>(); _diamondShopRefreshCount=0; _diamondShopRefreshTime=default;
|
||||
CouponData.ResetForKVLoad();
|
||||
}
|
||||
static DailySignEvent KVDaily(game.PlayerDataStorage.PlayerKVDailyValue value) => value==null ? null :
|
||||
new DailySignEvent { ID=value.Id,index=value.Index,lastID=value.LastId,time=value.Time };
|
||||
internal void ReplaceFromKVDecoded(game.PlayerDataStorage.PlayerKVShopState state)
|
||||
{
|
||||
if(state==null) throw new ArgumentNullException(nameof(state));
|
||||
shopPackDailyBuyCount=state.Daily.ToDictionary(p=>p.Key,p=>p.Value,StringComparer.Ordinal);
|
||||
shopAllPackBuyCount=state.All.ToDictionary(p=>p.Key,p=>p.Value); shopGiftBuyCount=state.Gift.ToDictionary(p=>p.Key,p=>p.Value);
|
||||
advertCount=state.Advert.ToDictionary(p=>p.Key,p=>p.Value); buyData=new List<float>(state.Buy); Voucher=state.Voucher;
|
||||
ChainPackData=KVDaily(state.Chain); TurntableAdData=KVDaily(state.Turntable);
|
||||
VIPAdPackData=state.Vip==null ? null : new AdvertData { ID=state.Vip.Id,index=state.Vip.Index,day=state.Vip.Day,cdTime=state.Vip.Time,isOpen=state.Vip.Open };
|
||||
_diamondShopItemRecords=state.Items.ToDictionary(p=>p.Key,p=>new ItemShopRecord(p.Value.Id,p.Value.Discount,p.Value.Bought));
|
||||
_diamondShopRefreshCount=state.RefreshCount; _diamondShopRefreshTime=state.RefreshTime; CouponData.ReplaceFromKVDecoded(state.Coupon);
|
||||
}
|
||||
#if UNITY_EDITOR
|
||||
internal game.PlayerDataStorage.PlayerKVShopState SnapshotForKVValidation()
|
||||
{
|
||||
game.PlayerDataStorage.PlayerKVDailyValue Daily(DailySignEvent v) => v==null ? null : new game.PlayerDataStorage.PlayerKVDailyValue(v.ID,v.index,v.lastID,v.time);
|
||||
return new game.PlayerDataStorage.PlayerKVShopState(shopPackDailyBuyCount,shopAllPackBuyCount,shopGiftBuyCount,advertCount,
|
||||
_diamondShopItemRecords.ToDictionary(p=>p.Key,p=>new game.PlayerDataStorage.PlayerKVShopItemValue(p.Value.ItemID,p.Value.Discount,p.Value.hasBought)),
|
||||
buyData,Voucher,_diamondShopRefreshCount,_diamondShopRefreshTime,Daily(ChainPackData),Daily(TurntableAdData),
|
||||
VIPAdPackData==null ? null : new game.PlayerDataStorage.PlayerKVAdvertValue(VIPAdPackData.ID,VIPAdPackData.index,VIPAdPackData.day,VIPAdPackData.cdTime,VIPAdPackData.isOpen),
|
||||
new game.PlayerDataStorage.PlayerKVCouponState(CouponData.ActivateTime,CouponData.EventId,CouponData.RedirectId,CouponData.IsBought));
|
||||
}
|
||||
internal void MutateCollectionsForKVValidation()
|
||||
{ buyData.Clear(); advertCount.Clear(); _diamondShopItemRecords.Values.First().Discount=99; }
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void InitData(Dictionary<string, string> userDatas)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user