chore(m2): 保存功能验收及后续清理前检查点
This commit is contained in:
@@ -7,7 +7,6 @@ using GameCore;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using UniRx;
|
||||
using UnityEngine;
|
||||
@@ -25,52 +24,6 @@ public class ShowHandEvent
|
||||
[DefaultExecutionOrder(10000)]
|
||||
public partial class FishingBehaviorB : MonoBehaviour
|
||||
{
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
game.PlayerDataStorage.PlayerKVGameplayLoop.FishingAction kvFishingAction;
|
||||
bool KVFishingCurrent()
|
||||
{
|
||||
if(!game.PlayerDataStorage.PlayerKVGameplayLoop.Enabled) return true;
|
||||
return this!=null && isActiveAndEnabled && game.PlayerDataStorage.PlayerKVGameplayLoop.FishingCurrent(kvFishingAction);
|
||||
}
|
||||
void CancelKVFishing(string reason) => game.PlayerDataStorage.PlayerKVGameplayLoop.CancelFishing(kvFishingAction,reason);
|
||||
void TrackKVCastTween(Tween tween)
|
||||
{
|
||||
if(!game.PlayerDataStorage.PlayerKVGameplayLoop.Enabled) return;
|
||||
var action=kvFishingAction;
|
||||
bool completed=false;
|
||||
tween.onComplete+=()=>completed=true;
|
||||
tween.onKill+=()=> { if(!completed) game.PlayerDataStorage.PlayerKVGameplayLoop.CancelFishing(action,"cast tween killed"); };
|
||||
}
|
||||
async Task ConsumeBaitOnKVAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
if(!KVFishingCurrent()) return;
|
||||
if(!game.PlayerDataStorage.PlayerKVGameplayLoop.ClaimFishingConsumption(kvFishingAction)) return;
|
||||
if(fishingData.fishItem==null || !fishingData.IsGeneralFish() || fishingData.IsFree || fishingData.IsRetry ||
|
||||
fishingData.IsDuel || fishingData.IsPackItemFish() || fishingData.curFishData==null)
|
||||
throw game.PlayerDataStorage.PlayerKVGameplayLoop.Stop("Only one ordinary paid fishing action is permitted. fishItem.ID="+(fishingData.fishItem==null?"null":fishingData.fishItem.ID.ToString())+", fishItem.SubType="+(fishingData.fishItem==null?"null":fishingData.fishItem.SubType.ToString())+", curFishData.ID="+(fishingData.curFishData==null?"null":fishingData.curFishData.ID.ToString())+", IsFree="+fishingData.IsFree+", IsRetry="+fishingData.IsRetry+", IsDuel="+fishingData.IsDuel);
|
||||
if(Application.internetReachability==NetworkReachability.NotReachable)
|
||||
throw game.PlayerDataStorage.PlayerKVGameplayLoop.Stop("Fishing stopped before consumption: offline.");
|
||||
if(_tables.TbFishingEvent.DataList.Any(e=>e.ConditionList.Any(c=>c.Condition==ConditionType.ConsumeEnergy)))
|
||||
throw game.PlayerDataStorage.PlayerKVGameplayLoop.Stop("ConsumeEnergy activity activation requires separate review.");
|
||||
var player=GContext.container.Resolve<PlayerData>();
|
||||
int mag=player.magnification;
|
||||
if(mag<0 || mag>=_tables.TbEnergyDef.DataList.Count)
|
||||
throw game.PlayerDataStorage.PlayerKVGameplayLoop.Stop("Invalid fishing magnification.");
|
||||
int fish=fishingData.curFishData.ID, rod=fishingData.RodId, map=player.lastMapId;
|
||||
int cost=_tables.TbEnergyDef.DataList[mag].Mag;
|
||||
game.PlayerDataStorage.PlayerKVGameplayLoop.PrepareFishingReward(kvFishingAction,fishingData);
|
||||
await player.ConsumeEnergyForKVLoopAsync(cost,kvFishingAction);
|
||||
if(!KVFishingCurrent()) return;
|
||||
if(fishingData.curFishData==null || fishingData.curFishData.ID!=fish || fishingData.RodId!=rod ||
|
||||
player.lastMapId!=map || (int)player.magnification!=mag || fishingData.IsFree || fishingData.IsRetry || fishingData.IsDuel)
|
||||
throw game.PlayerDataStorage.PlayerKVGameplayLoop.Stop("Fishing context changed during confirmation.");
|
||||
game.PlayerDataStorage.PlayerKVGameplayLoop.ContinueFishing(kvFishingAction,WaitForFishBiteED);
|
||||
}
|
||||
catch(Exception e) { game.PlayerDataStorage.PlayerKVGameplayLoop.Fault(e.Message); }
|
||||
}
|
||||
#endif
|
||||
IPlayerSaveStore saveStore;
|
||||
Tables _tables;
|
||||
[Header("RELATED OBJECT SETTINGS")]
|
||||
@@ -762,25 +715,9 @@ public partial class FishingBehaviorB : MonoBehaviour
|
||||
//开始抛鱼线
|
||||
public async void CastLineBehavior()
|
||||
{
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
if(game.PlayerDataStorage.PlayerKVGameplayLoop.Enabled)
|
||||
{
|
||||
try
|
||||
{
|
||||
var action=game.PlayerDataStorage.PlayerKVGameplayLoop.BeginFishing(this);
|
||||
if(action==null) return;
|
||||
kvFishingAction=action;
|
||||
if(!KVFishingCurrent()) return;
|
||||
}
|
||||
catch(Exception e) { game.PlayerDataStorage.PlayerKVGameplayLoop.Fault(e.Message); return; }
|
||||
}
|
||||
#endif
|
||||
//计算主画布分辨率下的宽高和屏幕的宽高的比列:
|
||||
fishingData.mainCamera.DOLocalRotateQuaternion(Quaternion.identity, 0.1f);
|
||||
await Awaiters.NextFrame;
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
if(!KVFishingCurrent()) return;
|
||||
#endif
|
||||
|
||||
CastBait();
|
||||
//播放抛竿动画
|
||||
@@ -791,18 +728,12 @@ public partial class FishingBehaviorB : MonoBehaviour
|
||||
rodHandleAni.SetBool("_idle", false);
|
||||
rodHandleAni.SetTrigger("_drawing");
|
||||
await Awaiters.Seconds(fishingBehaviorConf.audioDelay);
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
if(!KVFishingCurrent()) return;
|
||||
#endif
|
||||
GContext.Publish(new EventFishingSound(SoundType.ThrowingAudio));
|
||||
GContext.Publish(new VibrationData(1));
|
||||
}
|
||||
|
||||
private void ConsumeBait()
|
||||
{
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
if(game.PlayerDataStorage.PlayerKVGameplayLoop.Enabled) { _=ConsumeBaitOnKVAsync(); return; }
|
||||
#endif
|
||||
if (fishingData.IsFree)
|
||||
{
|
||||
WaitForFishBiteED();
|
||||
@@ -855,8 +786,8 @@ public partial class FishingBehaviorB : MonoBehaviour
|
||||
{
|
||||
GContext.Publish(new ConditionTypeEvent(ConditionType.ConsumeEnergy, energy));
|
||||
}
|
||||
var success = (await saveStore.WriteAndConfirmAsync("NewPlayerDataDic",
|
||||
Newtonsoft.Json.JsonConvert.SerializeObject(commonDatas))).Confirmed;
|
||||
var success = await saveStore.SyncDataImmidiate("NewPlayerDataDic",
|
||||
Newtonsoft.Json.JsonConvert.SerializeObject(commonDatas));
|
||||
Debug.Log($"[FishBehaviourB::ConsumeBaitOnPlayfab] {success}");
|
||||
}
|
||||
|
||||
@@ -1004,9 +935,6 @@ public partial class FishingBehaviorB : MonoBehaviour
|
||||
}
|
||||
public void BaitMove()
|
||||
{
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
if(!KVFishingCurrent()) return;
|
||||
#endif
|
||||
flyEndPosTrue = _bait.transform.position;
|
||||
|
||||
GContext.Publish(new EventFishingSound(SoundType.audio_fishing_throwing_baitintowater));
|
||||
@@ -1017,12 +945,9 @@ public partial class FishingBehaviorB : MonoBehaviour
|
||||
var fishEffect = _effectDic["fx_fishing_splashloopwaiting"];
|
||||
float z = WaitingZ();
|
||||
float timer = Mathf.Lerp(fishingBehaviorConf.waitingLineDrawMinTime, fishingBehaviorConf.waitingLineDrawMaxTime, Random.value);
|
||||
var waitingTween=_bait.transform.DOLocalMoveZ(z, timer).OnUpdate(
|
||||
_bait.transform.DOLocalMoveZ(z, timer).OnUpdate(
|
||||
(() =>
|
||||
{
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
if(!KVFishingCurrent()) return;
|
||||
#endif
|
||||
flyEndPosTrue = _bait.transform.position;
|
||||
if (fishEffect)
|
||||
{
|
||||
@@ -1031,9 +956,6 @@ public partial class FishingBehaviorB : MonoBehaviour
|
||||
fishEffect.transform.position = vector;
|
||||
}
|
||||
})); ;
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
TrackKVCastTween(waitingTween);
|
||||
#endif
|
||||
StartCoroutine(WaitForFishBite(timer));
|
||||
}
|
||||
IEnumerator PlayWaitingFx()
|
||||
@@ -1056,9 +978,6 @@ public partial class FishingBehaviorB : MonoBehaviour
|
||||
}
|
||||
private IEnumerator WaitForFishBite(float timer)
|
||||
{
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
if(!KVFishingCurrent()) yield break;
|
||||
#endif
|
||||
EventFishingSound eventFishingSound1 = new EventFishingSound(SoundType.audio_fishing_waiting);
|
||||
EventFishingSound eventFishingSound2 = new EventFishingSound(SoundType.ReelingAudio, loop: true);
|
||||
|
||||
@@ -1068,9 +987,6 @@ public partial class FishingBehaviorB : MonoBehaviour
|
||||
timer += Mathf.Lerp(fishingBehaviorConf.waitingMinTime, fishingBehaviorConf.waitingMaxTime, Random.value) * (1 - EnhancedWaitingTime);
|
||||
|
||||
yield return new WaitForSeconds(timer);
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
if(!KVFishingCurrent()) yield break;
|
||||
#endif
|
||||
|
||||
if (eventFishingSound2.Sound != null)
|
||||
{
|
||||
@@ -1194,27 +1110,18 @@ public partial class FishingBehaviorB : MonoBehaviour
|
||||
}
|
||||
private async void CastBait()
|
||||
{
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
if(!KVFishingCurrent()) return;
|
||||
#endif
|
||||
InitEffect();
|
||||
if (fishingBehaviorConf.fishFreeControlTime > 0f)
|
||||
{
|
||||
await new WaitForSeconds(fishingBehaviorConf.fishFreeControlTime);
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
if(!KVFishingCurrent()) return;
|
||||
#endif
|
||||
_isCastLine = true;
|
||||
_bait.transform.SetParent(transform);
|
||||
var castX=_bait.transform.DOMoveX(0, fishingBehaviorConf.flyToWaterTime);
|
||||
var castZ=_bait.transform.DOMoveZ(fishingBehaviorConf.flyDistance, fishingBehaviorConf.flyToWaterTime).SetEase(fishingBehaviorConf.flyForwardCurve);
|
||||
_bait.transform.DOMoveX(0, fishingBehaviorConf.flyToWaterTime);
|
||||
_bait.transform.DOMoveZ(fishingBehaviorConf.flyDistance, fishingBehaviorConf.flyToWaterTime).SetEase(fishingBehaviorConf.flyForwardCurve);
|
||||
_cameraAnimator.SetTrigger("_waiting");
|
||||
var castY=_bait.transform.DOMoveY(_waterHeight, fishingBehaviorConf.flyToWaterTime)
|
||||
_bait.transform.DOMoveY(_waterHeight, fishingBehaviorConf.flyToWaterTime)
|
||||
.SetEase(fishingBehaviorConf.flyDownCurve).OnComplete((() =>
|
||||
{
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
if(!KVFishingCurrent()) return;
|
||||
#endif
|
||||
fishingRodAnimator.SetTrigger("_waiting");
|
||||
GContext.Publish(ERightState.Waiting);
|
||||
LoadEffect("fx_fishing_splashinto");
|
||||
@@ -1224,25 +1131,16 @@ public partial class FishingBehaviorB : MonoBehaviour
|
||||
BaitMove();
|
||||
_bait.SetActive(false);
|
||||
}));
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
TrackKVCastTween(castX); TrackKVCastTween(castZ); TrackKVCastTween(castY);
|
||||
#endif
|
||||
AddLinePos();
|
||||
}
|
||||
else
|
||||
{
|
||||
await new WaitForSeconds(1.15f);
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
if(!KVFishingCurrent()) return;
|
||||
#endif
|
||||
//当前动画_fishingRodAnimator播放时间
|
||||
float time = fishingRodAnimator.GetCurrentAnimatorStateInfo(0).normalizedTime;
|
||||
_isCastLine = true;
|
||||
_cameraAnimator.SetTrigger("_waiting");
|
||||
await new WaitForSeconds(time);
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
if(!KVFishingCurrent()) return;
|
||||
#endif
|
||||
_bait.transform.SetParent(transform);
|
||||
_bait.SetActive(false);
|
||||
//鱼漂位置
|
||||
@@ -2023,9 +1921,6 @@ public partial class FishingBehaviorB : MonoBehaviour
|
||||
_cameraAnimator.SetBool("_reeling", false);
|
||||
fishingRodAnimator.SetBool("_pulling", false);
|
||||
CameraPullingEnd();
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
if(game.PlayerDataStorage.PlayerKVGameplayLoop.Enabled && (!KVFishingCurrent() || !game.PlayerDataStorage.PlayerKVGameplayLoop.RewardCanAdvance)) yield break;
|
||||
#endif
|
||||
fishingData.IsCaughtFish = true;
|
||||
PlayCollectingEffect();
|
||||
if (fx_fishing_splashwaveloop != null)
|
||||
@@ -2438,9 +2333,6 @@ public partial class FishingBehaviorB : MonoBehaviour
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
CancelKVFishing("disabled");
|
||||
#endif
|
||||
CloseAllEffect();
|
||||
}
|
||||
public void CloseAllEffect()
|
||||
@@ -2464,9 +2356,6 @@ public partial class FishingBehaviorB : MonoBehaviour
|
||||
}
|
||||
private void OnDestroy()
|
||||
{
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
CancelKVFishing("destroyed");
|
||||
#endif
|
||||
disposables?.Dispose();
|
||||
disposables = null;
|
||||
foreach (var o in _effectDic)
|
||||
|
||||
@@ -522,22 +522,6 @@ public class FishingUpdateSys : MonoBehaviour
|
||||
int isFailCount = 0;
|
||||
// 按了收线按钮
|
||||
public void PiercingFish(int waitingZone)
|
||||
{
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
if(game.PlayerDataStorage.PlayerKVGameplayLoop.Enabled)
|
||||
{
|
||||
try
|
||||
{
|
||||
if(!game.PlayerDataStorage.PlayerKVGameplayLoop.BeginRewardDrawing(this)) return;
|
||||
using(game.PlayerDataStorage.PlayerKVGameplayLoop.BeginRewardSegment("strike")) PiercingFishCore(waitingZone);
|
||||
}
|
||||
catch(System.Exception e) { game.PlayerDataStorage.PlayerKVGameplayLoop.Fault(e.Message); }
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
PiercingFishCore(waitingZone);
|
||||
}
|
||||
void PiercingFishCore(int waitingZone)
|
||||
{
|
||||
//waitingZone==100表示鱼没有开启刺鱼
|
||||
if (!fishingData.IsDrawing)
|
||||
@@ -639,9 +623,6 @@ public class FishingUpdateSys : MonoBehaviour
|
||||
if (piercingToComboB > 0)
|
||||
{
|
||||
await Awaiters.Seconds(damageProtectionTime);
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
if(!game.PlayerDataStorage.PlayerKVGameplayLoop.RewardCanAdvance) return;
|
||||
#endif
|
||||
_comboMultiplayer += Random.Range(piercingToComboA, piercingToComboB);
|
||||
//新技能生效 刺鱼触发全力收线进度
|
||||
PublishPerkEvent(RodPerkType.BattlePerk_PiercingToCombo);
|
||||
@@ -651,9 +632,6 @@ public class FishingUpdateSys : MonoBehaviour
|
||||
public async void EternalDeath()
|
||||
{
|
||||
await Awaiters.Seconds(damageProtectionTime);
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
if(!game.PlayerDataStorage.PlayerKVGameplayLoop.RewardCanAdvance) return;
|
||||
#endif
|
||||
|
||||
StopAllCoroutines();
|
||||
OnFishingIsOver();
|
||||
@@ -1064,10 +1042,6 @@ public class FishingUpdateSys : MonoBehaviour
|
||||
|
||||
private void Update()
|
||||
{
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
if(!game.PlayerDataStorage.PlayerKVGameplayLoop.RewardCanAdvance) return;
|
||||
#endif
|
||||
|
||||
if (fishingData.IsDrawing)
|
||||
{
|
||||
Vector3 fishPos = fishingBehavior.GetFishPos();
|
||||
@@ -1245,34 +1219,6 @@ public class FishingUpdateSys : MonoBehaviour
|
||||
}
|
||||
|
||||
void FishEnd()
|
||||
{
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
if(game.PlayerDataStorage.PlayerKVGameplayLoop.Enabled)
|
||||
{
|
||||
try
|
||||
{
|
||||
if(!game.PlayerDataStorage.PlayerKVGameplayLoop.BeginRewardEnding(this,fishingData.IsCaughtFish && !isFail)) return;
|
||||
using(game.PlayerDataStorage.PlayerKVGameplayLoop.BeginRewardSegment("ending")) FishEndCore();
|
||||
_=ShowKVRewardPanelAsync();
|
||||
}
|
||||
catch(System.Exception e) { game.PlayerDataStorage.PlayerKVGameplayLoop.Fault(e.Message); }
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
FishEndCore();
|
||||
}
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
async Task ShowKVRewardPanelAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
var panel=await UIManager.Instance.ShowUI(UITypes.FishingRewardPanel);
|
||||
if(!game.PlayerDataStorage.PlayerKVGameplayLoop.RewardRunCurrent && panel!=null) Destroy(panel);
|
||||
}
|
||||
catch(System.Exception e) { game.PlayerDataStorage.PlayerKVGameplayLoop.Fault(e.Message); }
|
||||
}
|
||||
#endif
|
||||
void FishEndCore()
|
||||
{
|
||||
if (isFail)
|
||||
{
|
||||
@@ -1351,9 +1297,6 @@ public class FishingUpdateSys : MonoBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
if(game.PlayerDataStorage.PlayerKVGameplayLoop.Enabled) return; // Wrapper opens UI after S2 disposal.
|
||||
#endif
|
||||
_ = UIManager.Instance.ShowUI(UITypes.FishingRewardPanel);
|
||||
}
|
||||
}
|
||||
@@ -1803,15 +1746,6 @@ public class FishingUpdateSys : MonoBehaviour
|
||||
//全力收线
|
||||
public async void FullCombo()
|
||||
{
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
if(game.PlayerDataStorage.PlayerKVGameplayLoop.Enabled)
|
||||
{
|
||||
if(!game.PlayerDataStorage.PlayerKVGameplayLoop.RewardCanAdvance) return;
|
||||
try { game.PlayerDataStorage.PlayerKVGameplayLoop.CheckRewardGuide(); }
|
||||
catch(System.Exception e) { game.PlayerDataStorage.PlayerKVGameplayLoop.Fault(e.Message); return; }
|
||||
}
|
||||
#endif
|
||||
|
||||
if (_isCombo == 1 && curFishingStateName != FishingStateName.UIEating)
|
||||
{
|
||||
if (comboToExDmg > 0 && comboToExDmgCount < curComboToExDmgCount)
|
||||
@@ -1852,9 +1786,6 @@ public class FishingUpdateSys : MonoBehaviour
|
||||
}
|
||||
}
|
||||
await Awaiters.Seconds(0.2f);
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
if(!game.PlayerDataStorage.PlayerKVGameplayLoop.RewardCanAdvance) return;
|
||||
#endif
|
||||
lockCombo = false;
|
||||
}
|
||||
}
|
||||
@@ -3199,10 +3130,6 @@ public class FishingUpdateSys : MonoBehaviour
|
||||
}
|
||||
private void OnDisable()
|
||||
{
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
game.PlayerDataStorage.PlayerKVGameplayLoop.CancelReward(this,"controller disabled");
|
||||
#endif
|
||||
|
||||
StopSoundCombo();
|
||||
StopRodAudio();
|
||||
StopNotReeling();
|
||||
@@ -3249,10 +3176,6 @@ public class FishingUpdateSys : MonoBehaviour
|
||||
}
|
||||
private void OnDestroy()
|
||||
{
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
game.PlayerDataStorage.PlayerKVGameplayLoop.CancelReward(this,"controller destroyed");
|
||||
#endif
|
||||
|
||||
disposables?.Dispose();
|
||||
_comboDisposable?.Dispose();
|
||||
_hpcoroutine = null;
|
||||
|
||||
Reference in New Issue
Block a user