chore(m2): 保存功能验收及后续清理前检查点

This commit is contained in:
Liubing\LB
2026-10-10 20:40:27 +08:00
parent d3c5394a55
commit 144e7f739f
110 changed files with 12672 additions and 7514 deletions

View File

@@ -581,8 +581,11 @@ public class DeBugPanel : MonoBehaviour
private void ChangeMMT()
{
var userService = GContext.container.Resolve<game.IUserService>() as game.PlayFabUserService;
if (userService == null) return;
var userService = GContext.container.Resolve<game.IUserService>();
if (userService is not game.PlayFabUserService && userService is not game.KVUserService)
{
return;
}
string mmt = inputField_mmt.text;
List<string> mmts = mmt.ToLower().Select(c => c.ToString()).ToList();
var mmDatas = GContext.container.Resolve<Tables>().TbMMTInit.DataList;
@@ -594,7 +597,14 @@ public class DeBugPanel : MonoBehaviour
value |= 1 << (mmDatas[i].ID - 1001);
}
}
userService.GMMMT(value);
if (userService is game.KVUserService kvUserService)
{
kvUserService.GMMMT(value);
}
else
{
((game.PlayFabUserService)userService).GMMMT(value);
}
}
private string _cfg_ver;

View File

@@ -17,24 +17,6 @@ using UnityEngine.UI;
public class FishingRewardPanel : BasePanel
{
#if UNITY_EDITOR && !SERVICE_HOST
game.PlayerDataStorage.PlayerKVGameplayLoop.FishingRewardAction kvReward;
System.Func<System.Threading.Tasks.Task> kvPresentation;
bool KVRewardViewCurrent() => !game.PlayerDataStorage.PlayerKVGameplayLoop.Enabled ||
(this!=null && isActiveAndEnabled && game.PlayerDataStorage.PlayerKVGameplayLoop.RewardPanelCurrent(kvReward,this));
async System.Threading.Tasks.Task ConfirmKVRewardAsync(game.PlayerDataStorage.PlayerKVEditResult primary)
{
try
{
await game.PlayerDataStorage.PlayerKVGameplayLoop.ConfirmRewardAsync(kvReward,primary);
if(!KVRewardViewCurrent()) return;
game.PlayerDataStorage.PlayerKVGameplayLoop.PresentReward(kvReward,()=>{canvasGroup.alpha=1;canvasGroup.blocksRaycasts=true;canvasGroup.interactable=true;});
if(kvPresentation!=null) await kvPresentation();
}
catch(System.Exception e) { game.PlayerDataStorage.PlayerKVGameplayLoop.Fault(e.Message); }
}
void OnDisable() => game.PlayerDataStorage.PlayerKVGameplayLoop.CancelReward(this,"reward panel disabled");
#endif
Tables _tables;
private CanvasGroup canvasGroup;
private CanvasGroup root_success;
@@ -163,9 +145,6 @@ public class FishingRewardPanel : BasePanel
dragImage = transform.Find("root_success/UIDrag").GetComponent<UIDrag>();
canvasGroup = GetComponent<CanvasGroup>();
#if UNITY_EDITOR && !SERVICE_HOST
if(game.PlayerDataStorage.PlayerKVGameplayLoop.Enabled) { canvasGroup.alpha=0; canvasGroup.blocksRaycasts=false; canvasGroup.interactable=false; }
#endif
root_success = transform.Find("root_success").GetComponent<CanvasGroup>();
@@ -263,9 +242,6 @@ public class FishingRewardPanel : BasePanel
}
if (GContext.container.Resolve<FishingEventData>().IsOpenDrop)
{
#if UNITY_EDITOR && !SERVICE_HOST
if(!game.PlayerDataStorage.PlayerKVGameplayLoop.Enabled)
#endif
CheckResource();
}
}
@@ -284,12 +260,8 @@ public class FishingRewardPanel : BasePanel
fishingData = GContext.container.Resolve<FishingData>();
Magnification = playerData.GetMagnification();
playButton.onClick.AddListener(OnClickInHome);
#if UNITY_EDITOR && !SERVICE_HOST
if(!game.PlayerDataStorage.PlayerKVGameplayLoop.Enabled)
#endif
{
go_fishPhoto.OnBackClick = OnBackClick;
playButton.onClick.AddListener(OnClickInHome);
targetBtn.onClick.AddListener(OnTargetClosePanel);
oneVOneBattleBtn.onClick.AddListener(OnTargetClosePanel);
btn_green.onClick.AddListener(OnSucceed);
@@ -319,7 +291,6 @@ public class FishingRewardPanel : BasePanel
dragImage.OnDragCall += OnDragFish;
dragImage.OnEndDragCall += StartDoRotate;
}
OnShow();
}
void StartDoRotate()
@@ -338,31 +309,6 @@ public class FishingRewardPanel : BasePanel
}
void OnShow()
{
#if UNITY_EDITOR && !SERVICE_HOST
if(game.PlayerDataStorage.PlayerKVGameplayLoop.Enabled)
{
try
{
var bound=game.PlayerDataStorage.PlayerKVGameplayLoop.BindRewardPanel(this);
if(bound==null) return;
kvReward=bound;
game.PlayerDataStorage.PlayerKVEditResult primary;
using(game.PlayerDataStorage.PlayerKVGameplayLoop.BeginRewardSegment("reward"))
{
OnShowCore();
playerFishData.SaveCaughtFishForKVLoop(fishID);
primary=playerData.SaveFishingRewardForKVLoop();
}
_=ConfirmKVRewardAsync(primary);
}
catch(System.Exception e) { game.PlayerDataStorage.PlayerKVGameplayLoop.Fault(e.Message); }
return;
}
#endif
OnShowCore();
}
void OnShowCore()
{
var normalRank = _tables.TbGlobalConfig.Rank;
var spRank = _tables.TbGlobalConfig.RankForSpFish;
@@ -425,23 +371,13 @@ public class FishingRewardPanel : BasePanel
if (fishingData.fishingResult == FishingResult.Success)
{
#if UNITY_EDITOR && !SERVICE_HOST
if(!game.PlayerDataStorage.PlayerKVGameplayLoop.Enabled)
#endif
AudioRewardPanel();
root_fail.SetActive(false);
root_success.gameObject.SetActive(fishingData.IsGeneralFish());
root_target.SetActive(fishingData.IsKeepsakeFish() || fishingData.IsPackItemFish());
root_1v1battle.SetActive(fishingData.fishItem.IsSpinachItem());
float pointBonus = playerFishData.GetRodAscendStats();
#if UNITY_EDITOR && !SERVICE_HOST
if(game.PlayerDataStorage.PlayerKVGameplayLoop.Enabled) kvPresentation=ApplySuccess(pointBonus);
else
#endif
Success(pointBonus);
#if UNITY_EDITOR && !SERVICE_HOST
if(!game.PlayerDataStorage.PlayerKVGameplayLoop.Enabled)
#endif
StartCoroutine(Blur());
#if AGG
@@ -482,9 +418,6 @@ public class FishingRewardPanel : BasePanel
}
#endif
GContext.Publish(new OnEventTriggerGuide(GetType().Name));
#if UNITY_EDITOR && !SERVICE_HOST
if(game.PlayerDataStorage.PlayerKVGameplayLoop.Enabled) game.PlayerDataStorage.PlayerKVGameplayLoop.RecordRewardGuideNotification();
#endif
fishingData.IsRetry = false;
}
else
@@ -548,19 +481,11 @@ public class FishingRewardPanel : BasePanel
//Pulling 结束后
float time = fishingData.fishingBehaviorConf.blurDelay;
yield return new WaitForSeconds(time);
#if UNITY_EDITOR && !SERVICE_HOST
if(!KVRewardViewCurrent()) yield break;
#endif
EnableFishingBlur(true);
}
//钓鱼成功
async void Success(float pointBonus)
{
var present=ApplySuccess(pointBonus);
if(present!=null) await present();
}
System.Func<System.Threading.Tasks.Task> ApplySuccess(float pointBonus)
{
go_info.gameObject.SetActive(false);
GContext.container.Resolve<PlayerData>().SaveFishingFrequency();
@@ -572,9 +497,6 @@ public class FishingRewardPanel : BasePanel
GContext.container.Resolve<PlayerItemData>().AddItemCount(curCollectingID, addCollecting, null);
MaterialChange();
}
#if UNITY_EDITOR && !SERVICE_HOST
if(!game.PlayerDataStorage.PlayerKVGameplayLoop.Enabled)
#endif
PlayAudioRewardFish();
GContext.container.Resolve<BuffDataCenter>().EndCollectionTargetWeight(fishingData.fishItem.ID);
fishingEventData.AddProgress(fishingData.fishItem.Quality, Magnification);
@@ -644,9 +566,6 @@ public class FishingRewardPanel : BasePanel
}
GContext.Publish(new TargetAddData(dropPackageList.DropIDList[1], 0, add));
var isSpecialFish = fishingData.curFishData.GeneralType == FishGeneralType.SpMapFish || fishingData.curFishData.GeneralType == FishGeneralType.EventFish;
#if UNITY_EDITOR && !SERVICE_HOST
if(!game.PlayerDataStorage.PlayerKVGameplayLoop.Enabled)
#endif
SetTextTitleAsync(proficiencyExtra, isSpecialFish);
SetFishWeight(fishingData.fishWeight);
MMTService mmService = GContext.container.Resolve<MMTService>();
@@ -661,28 +580,6 @@ public class FishingRewardPanel : BasePanel
}
}
bonusReward.Show(Magnification);
#if UNITY_EDITOR && !SERVICE_HOST
if(game.PlayerDataStorage.PlayerKVGameplayLoop.Enabled)
return async ()=>
{
if(!KVRewardViewCurrent()) return;
AudioRewardPanel(); PlayAudioRewardFish(); SetTextTitleAsync(proficiencyExtra,isSpecialFish);
_ = StartCoroutine(Blur());
await PresentGeneralRewardAsync(glodBuff);
};
#endif
return ()=>PresentGeneralRewardAsync(glodBuff);
}
else if (fishingData.fishItem.IsSpinachItem())
{
//todo 1v1battle
root_1v1battle_text_info.text=LocalizationMgr.GetText("UI_GiftBargainPopupPanel_8");
}
return null;
}
async System.Threading.Tasks.Task PresentGeneralRewardAsync(float glodBuff)
{
_ = StartCoroutine(AddCash());
//Show Fish Info UI
go_info.gameObject.SetActive(true);
@@ -696,11 +593,7 @@ public class FishingRewardPanel : BasePanel
anim_panel.Play("info_show_2");
await new WaitForSeconds(waitTime1 + duration1 + waitTime2);
if (!isEnable
#if UNITY_EDITOR && !SERVICE_HOST
|| !KVRewardViewCurrent()
#endif
)
if (!isEnable)
{
return;
}
@@ -712,9 +605,6 @@ public class FishingRewardPanel : BasePanel
var addCash = add - newCash;
DOTween.To(() => progress, x => progress = x, 1f, duration2).OnUpdate(() =>
{
#if UNITY_EDITOR && !SERVICE_HOST
if(!KVRewardViewCurrent()) return;
#endif
text_gold_num.text = ConvertTools.GetNumberString2((int)(newCash + addCash * progress));
text_num_buff.text = text_gold_num.text;
}).SetId("AddCash");
@@ -730,14 +620,17 @@ public class FishingRewardPanel : BasePanel
}
VibrationData();
fishingRewardSocial.ShowSocial(isSocial);
}
else if (fishingData.fishItem.IsSpinachItem())
{
//todo 1v1battle
root_1v1battle_text_info.text=LocalizationMgr.GetText("UI_GiftBargainPopupPanel_8");
}
}
async void VibrationData()
{
await Awaiters.Seconds(2.5f);
#if UNITY_EDITOR && !SERVICE_HOST
if(!KVRewardViewCurrent()) return;
#endif
if (curRateIndex >= _tables.TbGlobalConfig.RankVibration.Count)
curRateIndex = _tables.TbGlobalConfig.RankVibration.Count - 1;
int hapticType = _tables.TbGlobalConfig.RankVibration[curRateIndex];
@@ -824,14 +717,8 @@ public class FishingRewardPanel : BasePanel
var progress = 0f;
int cash = add / Magnification;
yield return Awaiters.Seconds(waitTime1);
#if UNITY_EDITOR && !SERVICE_HOST
if(!KVRewardViewCurrent()) yield break;
#endif
DOTween.To(() => progress, x => progress = x, 1, duration1).OnUpdate(() =>
{
#if UNITY_EDITOR && !SERVICE_HOST
if(!KVRewardViewCurrent()) return;
#endif
text_weight_num.text = LocalizationMgr.GetFormatTextValue("UI_FishingRewardPanel_101014",
ConvertTools.GetNumberString2((int)(_fishScore * progress)));
text_pound.text = LocalizationMgr.GetWeight(fishingData.fishWeight * progress, true);
@@ -842,9 +729,6 @@ public class FishingRewardPanel : BasePanel
.SetId("AddCash")
.OnComplete(() =>
{
#if UNITY_EDITOR && !SERVICE_HOST
if(!KVRewardViewCurrent()) return;
#endif
text_pound.text = LocalizationMgr.GetWeight(fishingData.fishWeight);
}
);
@@ -869,10 +753,7 @@ public class FishingRewardPanel : BasePanel
curRate = etor.Current.Key;
}
while (etor.MoveNext());
var rateObject=await Addressables.InstantiateAsync(curRate, icon_rate).Task;
#if UNITY_EDITOR && !SERVICE_HOST
if(!KVRewardViewCurrent() && rateObject!=null) Addressables.ReleaseInstance(rateObject);
#endif
await Addressables.InstantiateAsync(curRate, icon_rate).Task;
}
bool _newRecord;
@@ -1176,10 +1057,6 @@ public class FishingRewardPanel : BasePanel
protected override void OnDestroy()
{
#if UNITY_EDITOR && !SERVICE_HOST
game.PlayerDataStorage.PlayerKVGameplayLoop.CancelReward(this,"reward panel destroyed");
#endif
//ConvertTools.SetFSBlur(false);
EnableFishingBlur(false);
GContext.Publish(new PlayNewItemFxEvent() { type = 2 });
@@ -1276,9 +1153,6 @@ public class FishingRewardPanel : BasePanel
if (!string.IsNullOrEmpty(fishingData.AudioRewardFish))
{
NewItemAudio = await Addressables.LoadAssetAsync<AudioClip>(fishingData.AudioRewardFish).Task;
#if UNITY_EDITOR && !SERVICE_HOST
if(!KVRewardViewCurrent()) { if(NewItemAudio!=null) Addressables.Release(NewItemAudio); NewItemAudio=null; return; }
#endif
PlayNewItemAudio();
fishingData.AudioRewardFish = "";
}
@@ -1340,9 +1214,6 @@ public class FishingRewardPanel : BasePanel
await GContext.container.Resolve<SoundMgr>().PlayFishingSound(fishingData.curFishData.AudioRewardPanel);
}
await Awaiters.NextFrame;
#if UNITY_EDITOR && !SERVICE_HOST
if(!KVRewardViewCurrent()) return;
#endif
if (this != null && !string.IsNullOrEmpty(fishingData.curFishData.AudioRewardPanelLoop))
{
GContext.Publish(new EventBGMSound(fishingData.curFishData.AudioRewardPanelLoop));
@@ -1365,10 +1236,6 @@ public class FishingRewardPanel : BasePanel
string fishName = "0";
private void OnGUI()
{
#if UNITY_EDITOR && !SERVICE_HOST
if(game.PlayerDataStorage.PlayerKVGameplayLoop.Enabled) return;
#endif
int fontSize = 40;
GUI.skin.textField.fontSize = fontSize;
GUI.skin.button.fontSize = fontSize;

View File

@@ -12,7 +12,7 @@ namespace Assets.Scripts.UI.JigsawPuzzle
{
public class JigsawPuzzleManager:IDisposable
{
readonly game.PlayerDataStorage.IPlayerSaveStore saveStore = GContext.container.Resolve<game.PlayerDataStorage.IPlayerSaveStore>();
readonly game.PlayerDataStorage.IPlayerSaveStore saveStore = GContext.container.Resolve<game.PlayerDataStorage.IPlayerSaveStore>();
public const string PriceImgName = "separate_icon_eventjigsawpuzzle_piece_";

View File

@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using asap.core;
using cfg;
using GameCore;
@@ -12,32 +12,13 @@ namespace game
{
[asap.core.Inject] public game.PlayerDataStorage.IPlayerSaveStore SaveStore { get; set; }
private readonly EventPinataPackData _kvTarget;
private EventPinataPackDataManager(EventPinataPackData target) { _kvTarget=target; }
internal static EventPinataPackDataManager CreateForKVLoad()
{
var target=GContext.container.Resolve<EventPinataPackData>();
if(target==null) throw new System.InvalidOperationException("KV Pinata target is not registered.");
return new EventPinataPackDataManager(target);
}
private EventPinataPackData RequireKVTarget()
{
var target=GContext.container.Resolve<EventPinataPackData>();
if(target==null || (_kvTarget!=null && !ReferenceEquals(target,_kvTarget)))
throw new System.InvalidOperationException("KV Pinata target changed.");
return target;
}
internal static PlayerDataStorage.PlayerKVPinataState DecodeForKVLoad(IReadOnlyDictionary<string,string> raw,
PlayerDataStorage.PlayerKVSchemaDiagnostics errors) => PlayerDataStorage.PlayerKVSaveSchema.DecodePinata(raw,errors);
internal void ResetForKVLoad()
{
var target=RequireKVTarget(); target.EventID=0; target.PinataMainID=0; target.PurchasedCount=0;
}
internal void ReplaceFromKVDecoded(PlayerDataStorage.PlayerKVPinataState state)
{
if(state==null) throw new System.ArgumentNullException(nameof(state));
var target=RequireKVTarget(); target.EventID=state.EventID; target.PinataMainID=state.PinataMainID; target.PurchasedCount=state.PurchasedCount;
}
#if UNITY_EDITOR
private bool m_IsCheckCondition = true;
#else

View File

@@ -228,12 +228,7 @@ public partial class FishingRodPanel : BasePanel
fx_rodpanel_upgrade_change.SetActive(false);
}
#if UNITY_EDITOR && !SERVICE_HOST
bool kvEquipInFlight;
async void OnClickEquip()
#else
void OnClickEquip()
#endif
{
if (data.config.ID == GContext.container.Resolve<PlayerData>().equipRodID || data.isLock)
{
@@ -244,17 +239,6 @@ public partial class FishingRodPanel : BasePanel
ToastPanel.Show(LocalizationMgr.GetText("UI_ToastPanel_26"));
return;
}
#if UNITY_EDITOR && !SERVICE_HOST
if(game.PlayerDataStorage.PlayerKVGameplayLoop.Enabled)
{
if(kvEquipInFlight) return;
kvEquipInFlight=true;
try { await GContext.container.Resolve<PlayerData>().SetEquipRodIDForKVLoopAsync(data.config.ID); }
catch(System.Exception e) { Debug.LogException(e); return; }
finally { kvEquipInFlight=false; }
}
else
#endif
GContext.container.Resolve<PlayerData>().SetEquipRodID(data.config.ID);
btn_equip_go.gameObject.SetActive(false);
equipped.SetActive(true);

View File

@@ -8,10 +8,8 @@ public class SettingNotificationsGradePopupPanel : MonoBehaviour
{
public Button btn_ok;
public Button btn_cancel;
ISettingService settings;
ILocalNotificationService notifications;
bool handling;
bool completed;
private ISettingService settings;
private ILocalNotificationService notifications;
private void Start()
{
settings = GContext.container.Resolve<ISettingService>();
@@ -21,34 +19,24 @@ public class SettingNotificationsGradePopupPanel : MonoBehaviour
}
private void OnBtnOk()
{
HandlePrompt(true);
if (this == null)
{
return;
}
(settings as DefaultSettingService)?.RequirePromptOwner();
(notifications as LocalNotificationService)?.RequirePromptOwner(settings);
DestroyUI();
notifications.OpenSettings();
}
void DestroyUI()
{
HandlePrompt(false);
}
async void HandlePrompt(bool openSettings)
{
if (this == null || handling || completed) return;
handling = true;
try
if (this == null)
{
(settings as DefaultSettingService)?.RequirePromptOwner();
(notifications as LocalNotificationService)?.RequirePromptOwner(settings);
settings.ShowNotice = true;
if (openSettings && settings is DefaultSettingService bound && bound.HasKVPromptOwner)
{
await ((LocalNotificationService)notifications).OpenSettingsAsync();
if (this == null) return;
bound.RequirePromptOwner();
}
(settings as DefaultSettingService)?.RequirePromptOwner();
completed = true;
UIManager.Instance.DestroyUI(gameObject.name);
if (openSettings && !(settings is DefaultSettingService kv && kv.HasKVPromptOwner))
notifications.OpenSettings();
return;
}
catch (System.Exception ex) { game.DefaultSettingService.LogPromptFailure(ex); }
finally { handling = false; }
(settings as DefaultSettingService)?.RequirePromptOwner();
(notifications as LocalNotificationService)?.RequirePromptOwner(settings);
settings.ShowNotice = true;
UIManager.Instance.DestroyUI(gameObject.name);
}
}

View File

@@ -7,48 +7,30 @@ public class SettingNotificationsPopupPanel : MonoBehaviour
{
public Button btn_ok;
public Button btn_cancel;
ILocalNotificationService notifications;
bool handling;
bool completed;
private ILocalNotificationService notifications;
private void Start()
{
notifications = GContext.container.Resolve<ILocalNotificationService>();
btn_ok.onClick.AddListener(OnBtnOk);
btn_cancel.onClick.AddListener(DestroyUI);
}
private async void OnBtnOk()
private void OnBtnOk()
{
if (this == null || handling || completed) return;
handling = true;
try
if (this == null)
{
if (notifications is LocalNotificationService local && local.HasKVPromptOwner)
{
local.RequirePromptOwner();
await local.OpenSettingsAsync();
if (this == null) return;
local.RequirePromptOwner();
}
else
{
DestroyUI();
notifications.OpenSettings();
return;
}
DestroyUI();
return;
}
catch (System.Exception ex) { game.DefaultSettingService.LogPromptFailure(ex); }
finally { handling = false; }
(notifications as LocalNotificationService)?.RequirePromptOwner();
DestroyUI();
notifications.OpenSettings();
}
void DestroyUI()
{
if (this == null || completed) return;
try
if (this == null)
{
(notifications as LocalNotificationService)?.RequirePromptOwner();
completed = true;
UIManager.Instance.DestroyUI(gameObject.name);
return;
}
catch (System.Exception ex) { game.DefaultSettingService.LogPromptFailure(ex); }
(notifications as LocalNotificationService)?.RequirePromptOwner();
UIManager.Instance.DestroyUI(gameObject.name);
}
}

View File

@@ -11,8 +11,8 @@ using UnityEngine.UI;
public class SettingPopupPanel : MonoBehaviour
{
ISettingService settingService;
ILocalNotificationService notificationService;
private ISettingService settingService;
private ILocalNotificationService notificationService;
public Button btn_close;
public Button btn_mask;
public BtnSwitch music;
@@ -216,15 +216,20 @@ public class SettingPopupPanel : MonoBehaviour
}
private void OnToggleNotification(bool isOn)
{
try
if (this == null)
{
if (this == null) return;
(settingService as DefaultSettingService)?.RequirePromptOwner();
(notificationService as LocalNotificationService)?.RequirePromptOwner(settingService);
if (isOn) notificationService.OpenSettings();
else UIManager.Instance.ShowUI(new UIType("SettingNotificationsPopupPanel"));
return;
}
(settingService as DefaultSettingService)?.RequirePromptOwner();
(notificationService as LocalNotificationService)?.RequirePromptOwner(settingService);
if (isOn)
{
notificationService.OpenSettings();
}
else
{
UIManager.Instance.ShowUI(new UIType("SettingNotificationsPopupPanel"));
}
catch (System.Exception ex) { game.DefaultSettingService.LogPromptFailure(ex); }
}
private void OnChangeLanguage(ChangeLanguageEvent changeLanguageEvent = null)

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using asap.core;
using cfg;
@@ -12,40 +12,13 @@ public class EventShootingRangeData : IChainPackData
private RawData _data = new RawData();
private bool _kvLoadPresent;
internal bool KVLoadPresent => _kvLoadPresent;
internal static game.PlayerDataStorage.PlayerKVShootingRangeState DecodeForKVLoad(
IReadOnlyDictionary<string, string> raw, game.PlayerDataStorage.PlayerKVSchemaSnapshot snapshot,
game.PlayerDataStorage.PlayerKVSchemaDiagnostics errors) =>
game.PlayerDataStorage.PlayerKVSaveSchema.DecodeShootingRange(raw, snapshot, errors);
internal void ResetForKVLoad()
{
_kvLoadPresent = false;
_data = default(RawData);
}
internal void ReplaceFromKVDecoded(game.PlayerDataStorage.PlayerKVShootingRangeState state)
{
if (state == null) throw new ArgumentNullException(nameof(state));
if (!state.IsPresent) { ResetForKVLoad(); return; }
var replacement = new RawData
{
EventId = state.EventId,
CycleId = state.CycleId,
RedirectId = state.RedirectId,
AmmoCount = state.AmmoCount,
CurrentStageIdx = state.CurrentStageIdx,
ChainProgress = state.ChainProgress,
RewardFlag = state.RewardFlag,
TargetFlag = state.TargetFlag,
HasBeenOpened = state.HasBeenOpened,
Inflation = state.Inflation,
};
_data = replacement;
_kvLoadPresent = true;
}
internal game.PlayerDataStorage.PlayerKVShootingRangeState SnapshotForKVValidation() =>
new game.PlayerDataStorage.PlayerKVShootingRangeState(_kvLoadPresent, _data.EventId, _data.CycleId, _data.RedirectId, _data.AmmoCount, _data.CurrentStageIdx, _data.ChainProgress, _data.RewardFlag, _data.TargetFlag, _data.HasBeenOpened, _data.Inflation);
private readonly Tables _tables = GContext.container.Resolve<Tables>();
private readonly TbPack _pack = GContext.container.Resolve<Tables>().TbPack;
private readonly TbEventPackManager _eventPackManager = GContext.container.Resolve<Tables>().TbEventPackManager;

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Linq;
using asap.core;
using cfg;
@@ -48,10 +48,8 @@ public class BlackFridayCouponData
ZZTimeHelper.UtcNow() <= ActivateTime + TimeSpan.FromSeconds(EventDuration) && !IsBought;
public int Multiplier => GContext.container.Resolve<Tables>().TbEventCoupon[RedirectId].Multiple;
public int EventDuration => GContext.container.Resolve<Tables>().TbEventCoupon[RedirectId].Time;
internal void ResetForKVLoad()
{ ActivateTime=default; EventId=0; RedirectId=0; _isBought=false; DoesPop=true; }
internal void ReplaceFromKVDecoded(game.PlayerDataStorage.PlayerKVCouponState state)
{ if(state==null) throw new ArgumentNullException(nameof(state)); ActivateTime=state.ActivateTime; EventId=state.EventId; RedirectId=state.RedirectId; _isBought=state.Bought; }
public void LoadData(string s)
{

View File

@@ -1,4 +1,4 @@
using asap.core;
using asap.core;
using cfg;
using GameCore;
namespace GameCore
@@ -11,9 +11,7 @@ namespace GameCore
}
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;

View File

@@ -16,8 +16,7 @@ public class GiftNoticePanel : MonoBehaviour
Button btn_watch2;
public RewardItemNew[] rewardItemNews;
private Tables _tables;
ILocalNotificationService notificationService;
bool handlingNotification;
private ILocalNotificationService notificationService;
private void Awake()
{
@@ -61,29 +60,15 @@ public class GiftNoticePanel : MonoBehaviour
PlayerPrefs.SetInt("GiftNoticePanel", 1);
OnClose();
}
async void OnClickYES()
void OnClickYES()
{
if (this == null || handlingNotification) return;
handlingNotification = true;
try
if (this == null)
{
if (notificationService is LocalNotificationService local && local.HasKVPromptOwner)
{
local.RequirePromptOwner();
await local.OpenSettingsAsync();
if (this == null) return;
local.RequirePromptOwner();
}
else
{
OnClose();
notificationService.OpenSettings();
return;
}
OnClose();
return;
}
catch (System.Exception ex) { game.DefaultSettingService.LogPromptFailure(ex); }
finally { handlingNotification = false; }
(notificationService as LocalNotificationService)?.RequirePromptOwner();
OnClose();
notificationService.OpenSettings();
}
void OnClose()
{

View File

@@ -1,4 +1,4 @@
using UnityEngine;
using UnityEngine;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -27,18 +27,10 @@ public class ThanksGivingPackData : IProgressChainPackData
protected Data _data = new Data(0, 0, 0, 0);
internal static game.PlayerDataStorage.PlayerKVProgressPackState DecodeForKVLoad(IReadOnlyDictionary<string,string> raw,
game.PlayerDataStorage.PlayerKVSchemaDiagnostics errors) =>
game.PlayerDataStorage.PlayerKVSaveSchema.DecodeProgressPack(raw,false,errors);
internal void ResetForKVLoad() { _data = null; }
internal void ReplaceFromKVDecoded(game.PlayerDataStorage.PlayerKVProgressPackState state)
{
if (state == null) throw new ArgumentNullException(nameof(state));
_data = state.IsPresent ? new Data(state.EventId,state.RedirectId,state.TokenProgress,state.ChainProgress) : null;
}
internal game.PlayerDataStorage.PlayerKVProgressPackState SnapshotForKVValidation() => _data == null
? new game.PlayerDataStorage.PlayerKVProgressPackState(false,0,0,0,0)
: new game.PlayerDataStorage.PlayerKVProgressPackState(true,_data.EventId,_data.RedirectId,_data.TokenProgress,_data.ChainProgress);
/// <summary>
/// Starts with 0, representing the first unclaimed reward.
/// </summary>

View File

@@ -581,8 +581,8 @@ public class FishingTurntablePanel : BasePanel
}
private async void ConsumeOnPlayfab()
{
var success = (await saveStore.WriteAndConfirmAsync("TurntableRoll",
(_fishingEventData.TurntableCoupon - wheelLevel.CostNumber).ToString())).Confirmed;
var success = await saveStore.SyncDataImmidiate("TurntableRoll",
(_fishingEventData.TurntableCoupon - wheelLevel.CostNumber).ToString());
Debug.Log($"[FishingTurntablePanel::ConsumeOnPlayfab] {success}");
isDataSynced = true;
}