feat(upserver): 接入认证与KV存档并完成限定钓鱼闭环
This commit is contained in:
@@ -17,6 +17,24 @@ 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;
|
||||
@@ -145,6 +163,9 @@ 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>();
|
||||
|
||||
@@ -242,6 +263,9 @@ public class FishingRewardPanel : BasePanel
|
||||
}
|
||||
if (GContext.container.Resolve<FishingEventData>().IsOpenDrop)
|
||||
{
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
if(!game.PlayerDataStorage.PlayerKVGameplayLoop.Enabled)
|
||||
#endif
|
||||
CheckResource();
|
||||
}
|
||||
}
|
||||
@@ -260,8 +284,12 @@ public class FishingRewardPanel : BasePanel
|
||||
fishingData = GContext.container.Resolve<FishingData>();
|
||||
|
||||
Magnification = playerData.GetMagnification();
|
||||
go_fishPhoto.OnBackClick = OnBackClick;
|
||||
playButton.onClick.AddListener(OnClickInHome);
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
if(!game.PlayerDataStorage.PlayerKVGameplayLoop.Enabled)
|
||||
#endif
|
||||
{
|
||||
go_fishPhoto.OnBackClick = OnBackClick;
|
||||
targetBtn.onClick.AddListener(OnTargetClosePanel);
|
||||
oneVOneBattleBtn.onClick.AddListener(OnTargetClosePanel);
|
||||
btn_green.onClick.AddListener(OnSucceed);
|
||||
@@ -291,6 +319,7 @@ public class FishingRewardPanel : BasePanel
|
||||
dragImage.OnDragCall += OnDragFish;
|
||||
dragImage.OnEndDragCall += StartDoRotate;
|
||||
|
||||
}
|
||||
OnShow();
|
||||
}
|
||||
void StartDoRotate()
|
||||
@@ -309,6 +338,31 @@ 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;
|
||||
@@ -371,13 +425,23 @@ 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
|
||||
@@ -418,6 +482,9 @@ 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
|
||||
@@ -481,11 +548,19 @@ 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();
|
||||
@@ -497,6 +572,9 @@ 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);
|
||||
@@ -566,6 +644,9 @@ 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>();
|
||||
@@ -580,6 +661,28 @@ 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);
|
||||
@@ -593,7 +696,11 @@ public class FishingRewardPanel : BasePanel
|
||||
anim_panel.Play("info_show_2");
|
||||
|
||||
await new WaitForSeconds(waitTime1 + duration1 + waitTime2);
|
||||
if (!isEnable)
|
||||
if (!isEnable
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
|| !KVRewardViewCurrent()
|
||||
#endif
|
||||
)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -605,6 +712,9 @@ 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");
|
||||
@@ -620,17 +730,14 @@ 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];
|
||||
@@ -717,8 +824,14 @@ 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);
|
||||
@@ -729,6 +842,9 @@ public class FishingRewardPanel : BasePanel
|
||||
.SetId("AddCash")
|
||||
.OnComplete(() =>
|
||||
{
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
if(!KVRewardViewCurrent()) return;
|
||||
#endif
|
||||
text_pound.text = LocalizationMgr.GetWeight(fishingData.fishWeight);
|
||||
}
|
||||
);
|
||||
@@ -753,7 +869,10 @@ public class FishingRewardPanel : BasePanel
|
||||
curRate = etor.Current.Key;
|
||||
}
|
||||
while (etor.MoveNext());
|
||||
await Addressables.InstantiateAsync(curRate, icon_rate).Task;
|
||||
var rateObject=await Addressables.InstantiateAsync(curRate, icon_rate).Task;
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
if(!KVRewardViewCurrent() && rateObject!=null) Addressables.ReleaseInstance(rateObject);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool _newRecord;
|
||||
@@ -1057,6 +1176,10 @@ 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 });
|
||||
@@ -1153,6 +1276,9 @@ 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 = "";
|
||||
}
|
||||
@@ -1214,6 +1340,9 @@ 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));
|
||||
@@ -1236,6 +1365,10 @@ 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;
|
||||
|
||||
@@ -60,6 +60,7 @@ public class HomeBtnBattlepass : EventButtonResource
|
||||
}
|
||||
void RefreshBattlePassBtn()
|
||||
{
|
||||
disposable?.Dispose();
|
||||
var dataProvider = GContext.container.Resolve<BattlePassDataProvider>();
|
||||
btn_battlePass.transform.Find("lock").gameObject.SetActive(!dataProvider.IsActivating);
|
||||
if (!dataProvider.IsActivating)
|
||||
|
||||
@@ -987,12 +987,15 @@ public partial class HomePanel : BasePanel
|
||||
{
|
||||
try
|
||||
{
|
||||
var showFishBuffIds = GContext.container.Resolve<BuffDataCenter>().showFishBuffIds;
|
||||
if (this == null) return;
|
||||
var container = GContext.container;
|
||||
var showFishBuffIds = container.Resolve<BuffDataCenter>().showFishBuffIds;
|
||||
if (showFishBuffIds.Count == 0)
|
||||
{
|
||||
//Buff 之后的拍脸
|
||||
await Awaiters.Seconds(0.5f);
|
||||
GContext.container.Resolve<IFaceUIService>().ShowPostFaceUI();
|
||||
if (this == null || !ReferenceEquals(container, GContext.container)) return;
|
||||
container.Resolve<IFaceUIService>().ShowPostFaceUI();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -10,6 +10,32 @@ namespace game
|
||||
{
|
||||
public class EventPinataPackDataManager:IOrderReplenishment,IOrderSuccess
|
||||
{
|
||||
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
|
||||
@@ -173,4 +199,4 @@ namespace game
|
||||
data?.AddPurchasedCount(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,7 +228,12 @@ 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)
|
||||
{
|
||||
@@ -239,6 +244,17 @@ 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);
|
||||
|
||||
@@ -9,6 +9,41 @@ using GameCore;
|
||||
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;
|
||||
@@ -357,4 +392,4 @@ public class EventShootingRangeData : IChainPackData
|
||||
public bool HasBeenOpened;
|
||||
public float Inflation;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,11 @@ 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)
|
||||
{
|
||||
int[] tokens = s.Split(',').Select(int.Parse).ToArray();
|
||||
|
||||
@@ -11,6 +11,9 @@ 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;
|
||||
|
||||
@@ -19,6 +19,19 @@ namespace GameCore
|
||||
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>
|
||||
|
||||
@@ -97,7 +97,7 @@ class ApplyItem : MonoBehaviour
|
||||
//entityKey = data.entityKey;
|
||||
//head.SetData(data.avatarUrl);
|
||||
IUserService userService = GContext.container.Resolve<IUserService>();
|
||||
if (data.playFabId == userService.UserId)
|
||||
if (data.playFabId == userService.ApiPlayerId)
|
||||
{
|
||||
text_name.text = userService.DisplayName;
|
||||
head.SetData(userService.AvatarUrl);
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ClubChooseHeirPopupPanel : MonoBehaviour
|
||||
for (int i = 0; i < datas.Count; i++)
|
||||
{
|
||||
SocialInfoItemData clubPlayerInfoData = datas[i];
|
||||
if (clubPlayerInfoData.playFabId == userService.UserId)
|
||||
if (clubPlayerInfoData.playFabId == userService.ApiPlayerId)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ public class ClubInfoPopupPanel : MonoBehaviour
|
||||
for (int i = 0; i < data.Count; i++)
|
||||
{
|
||||
bool isMore = showMore;
|
||||
if (data[i].playFabId != userService.UserId)
|
||||
if (data[i].playFabId != userService.ApiPlayerId)
|
||||
{
|
||||
if (_socialData.memberRole == EMemberRole.Vice)
|
||||
{
|
||||
@@ -170,8 +170,8 @@ public class ClubInfoPopupPanel : MonoBehaviour
|
||||
more_tips.transform.position = memberItem.btn_more.transform.position;
|
||||
more_tips.SetActive(true);
|
||||
|
||||
btn_leave.transform.parent.gameObject.SetActive(curSocialInfoItemData.playFabId == userService.UserId);
|
||||
bool iskickout = curSocialInfoItemData.playFabId != userService.UserId;/*_socialData.ClubItemData.id == _socialData.myClubInfo.id*/;
|
||||
btn_leave.transform.parent.gameObject.SetActive(curSocialInfoItemData.playFabId == userService.ApiPlayerId);
|
||||
bool iskickout = curSocialInfoItemData.playFabId != userService.ApiPlayerId;/*_socialData.ClubItemData.id == _socialData.myClubInfo.id*/;
|
||||
bool isPromote = false;
|
||||
bool isDemote = false;
|
||||
EMemberRole role = curSocialInfoItemData.role;
|
||||
|
||||
@@ -171,9 +171,9 @@ public class SocialClubJoined : MonoBehaviour
|
||||
void SetSignCD()
|
||||
{
|
||||
var timer = ZZTimeHelper.UtcNow().UtcNowOffset();
|
||||
btn_sign.gameObject.SetActive(_socialData.signTime?.DayOfYear != timer.DayOfYear);
|
||||
sign_cd.SetActive(_socialData.signTime?.DayOfYear == timer.DayOfYear);
|
||||
if (_socialData.signTime?.DayOfYear == timer.DayOfYear)
|
||||
btn_sign.gameObject.SetActive(_socialData.signTime?.Date != timer.Date);
|
||||
sign_cd.SetActive(_socialData.signTime?.Date == timer.Date);
|
||||
if (_socialData.signTime?.Date == timer.Date)
|
||||
{
|
||||
StartTimer();
|
||||
}
|
||||
@@ -258,11 +258,21 @@ public class SocialClubJoined : MonoBehaviour
|
||||
{
|
||||
emojio_tips.SetActive(!emojio_tips.activeSelf);
|
||||
}
|
||||
void OnSign()
|
||||
async void OnSign()
|
||||
{
|
||||
//签到
|
||||
_socialData.ClubSingin();
|
||||
SetSignCD();
|
||||
if (!btn_sign.interactable) return;
|
||||
var version = _socialData.customServerMgr.SessionVersion;
|
||||
btn_sign.interactable = false;
|
||||
try { await _socialData.ClubSingin(); }
|
||||
catch (Exception ex) { Debug.LogException(ex); }
|
||||
finally
|
||||
{
|
||||
if (this != null && version == _socialData.customServerMgr.SessionVersion)
|
||||
{
|
||||
btn_sign.interactable = true;
|
||||
SetSignCD();
|
||||
}
|
||||
}
|
||||
}
|
||||
void ClickHelpEnergyGray()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user