chore(m2): 保存功能验收及后续清理前检查点
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user