Files
ft/Client/Assets/Scripts/UI/Shop/ChainPackWithProgressData.cs

37 lines
1.6 KiB
C#

using asap.core;
using cfg;
using GameCore;
namespace GameCore
{
public partial class FishingEventData
{
public readonly ChainPackWithProgressMigrationData ChainPackWithProgressMigrationData = new ChainPackWithProgressMigrationData();
}
}
public class ChainPackWithProgressMigrationData : ThanksGivingPackData
{
internal new static game.PlayerDataStorage.PlayerKVProgressPackState DecodeForKVLoad(System.Collections.Generic.IReadOnlyDictionary<string,string> raw,
game.PlayerDataStorage.PlayerKVSchemaDiagnostics errors) =>
game.PlayerDataStorage.PlayerKVSaveSchema.DecodeProgressPack(raw,true,errors);
public new const string Key = "ThanksGivingPackMigrationData";
public override string RedPointKey => "thanks_giving";
protected override string key => Key;
public void UpdateData(int eventId, int packId)
{
// Debug.Log($"<color=#f18c0a>Updatedata {e.ID}, {e.RedirectID}, {TokenProgress}, {ChainProgress}</color>");
if (eventId == 0 || packId == 0)
return;
var oldData = GContext.container.Resolve<FishingEventData>().ThanksGivingPackData;
if (!GContext.container.Resolve<Tables>().TbFishingEvent.DataMap.ContainsKey(oldData.EventId)
&& oldData.PackId == packId)
{
_data = new Data(eventId: eventId, redirectId: packId, tokenProgress: oldData.TokenProgress, chainProgress: oldData.ChainProgress);
PlayFabMgr.Instance.UpdateUserDataValue(ThanksGivingPackData.Key, "");
}
else
_data = new Data(eventId: eventId, redirectId: packId, tokenProgress: 0, chainProgress: 0);
}
}