1757 lines
63 KiB
C#
1757 lines
63 KiB
C#
using System;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Threading.Tasks;
|
||
using asap.core;
|
||
using cfg;
|
||
using DataCenter;
|
||
using DG.Tweening;
|
||
using game;
|
||
using Game;
|
||
using GameCore;
|
||
using HexGrid;
|
||
using Script.RuntimeScript;
|
||
using TMPro;
|
||
using UniRx;
|
||
using UnityEngine;
|
||
using UnityEngine.UI;
|
||
|
||
public class HideHomePanelEvent
|
||
{
|
||
public bool IsHideMap = true;
|
||
}
|
||
public partial class HomePanel : BasePanel
|
||
{
|
||
//拖动选择角度
|
||
Tables _tables;
|
||
FishingEventData _fishingEventData;
|
||
[Header("HomePanel操作相机x=Mathf.Clamp(z,x) y=Mathf.Clamp(w,y)")]
|
||
public float duration = 0.65f;
|
||
|
||
//屏幕拖动比例
|
||
public float dragCameraScale = 0.005f;
|
||
|
||
//重力旋转操作角度限制
|
||
public Vector4 gravityAngleLimit = new Vector4(75, 15, 15, -45);
|
||
|
||
//重力旋转游戏角度限制
|
||
public Vector4 gravityGameAngleLimit = new Vector4(-2, 0.25f, 2, 2);
|
||
|
||
//拖动旋转角度限制
|
||
public Vector4 dragEulerAngleLimit = new Vector4(2, 2, -2, -2);
|
||
[Range(0, 1)] public float gravitySub = 0.2f;
|
||
private CanvasGroup canvasGroup;
|
||
Button btn_mask;
|
||
GameObject mask;
|
||
Animator anim;
|
||
Vector3 _targetEuler;
|
||
Vector3 _offsetEuler;
|
||
|
||
Vector3 _curEuler = new Vector3(0, 0, 0);
|
||
|
||
//private Quaternion startQuaternion;
|
||
|
||
//private Quaternion originalQuaternion;
|
||
|
||
private bool _isMoveing = true;
|
||
bool isMouse = false;
|
||
private Vector3 _curMousePos;
|
||
Button btn_questionmark;
|
||
private UIButton btn_play;
|
||
Animator btn_play_anim;
|
||
GameObject effect_beilv_loop;
|
||
private Button btn_beilv;
|
||
Image btn_beilv_image;
|
||
Image buff_beilv_image;
|
||
private Button btn_beilv_max;
|
||
private Image btn_beilv_max_image;
|
||
private Image buff_beilv_max_image;
|
||
GameObject btn_task_gray;
|
||
GameObject btn_friend_gray;
|
||
private TMP_Text text_beilv;
|
||
private TMP_Text text_beilv_max;
|
||
private TMP_Text text_beilv_show;
|
||
|
||
private CanvasGroup beilvpanel;
|
||
public Transform beilvpanel_max;
|
||
public Transform bg_beilvlpanel;
|
||
private TMP_Text text_beilvpanel_title;
|
||
private TMP_Text text_beilvpanel_content;
|
||
|
||
//体力进度条
|
||
private Image image_slider_energy;
|
||
|
||
//体力当前值/最大值
|
||
private TMP_Text text_energy_value;
|
||
|
||
Timer EnergyTimer;
|
||
public TMP_Text text_energy_time;
|
||
//目标奖励活动====
|
||
Timer ctTimer;
|
||
GameObject MiddlePanel;
|
||
HomeBubbleTask homeBubbleTask;
|
||
|
||
//锁链礼包
|
||
private Button btn_chainschest; // 锁链礼包按钮
|
||
|
||
//=====目标奖励活动礼包
|
||
HomeGiftBtnPanel homeGift;
|
||
//=====目标奖励活动礼包
|
||
//目标奖励活动====
|
||
private RankTargets rankTarget;
|
||
public Queue<RewardItemNew> imageQueue = new Queue<RewardItemNew>();
|
||
public Transform rewardFlyPanel;
|
||
public RewardItemNew rewardItemPrefab;
|
||
public Button btn_rank;
|
||
public Button btn_turntable;
|
||
GameObject btn_fishingduel;
|
||
GameObject btn_fishbowl;
|
||
GameObject btn_event_washing = null; // 洗游艇入口按钮
|
||
|
||
Button btn_battlePass;
|
||
Button btn_sign;
|
||
// private Button btn_chainschest; // 锁链礼包
|
||
public TMP_Text text_turntable_time;
|
||
public TMP_Text txt_battlePassTimer;
|
||
public TMP_Text text_rank_time;
|
||
public TMP_Text text_rank;
|
||
public Image rankIcon;
|
||
Timer rank_timer;
|
||
Timer showdownTimer;
|
||
Timer signTimer;
|
||
public Button btn_friend;
|
||
|
||
UITopArea top_area;
|
||
int addGlodCount = 0;
|
||
private WheelLevel wheelLevel;
|
||
FishingStage fishingStage;
|
||
int Energy;
|
||
HomeBtnRank homeBtnRank;
|
||
|
||
PlayerFishData _playerFishData;
|
||
HomeBuffPanel homeBuffPanel;
|
||
HomeLeftPanel homeLeftPanel;
|
||
HomeRightPanel homeRightPanel;
|
||
|
||
HomeSupplyDropPanel homeSupplyDropPanel;
|
||
bool isFishingPanel = false;
|
||
|
||
FishingData fishingData;
|
||
bool isSuperEnergy = false;
|
||
Canvas RewardFlyPanel;
|
||
UIDrag moveCameraPanel;
|
||
|
||
private void Awake()
|
||
{
|
||
GContext.container.Resolve<PlayerShopData>().InitShopPackData();
|
||
moveCameraPanel = transform.Find("moveCameraPanel").GetComponent<UIDrag>();
|
||
btn_mask = transform.Find("btn_mask").GetComponent<Button>();
|
||
btn_mask.gameObject.SetActive(false);
|
||
mask = transform.Find("mask").gameObject;
|
||
mask.SetActive(false);
|
||
_fishingEventData = GContext.container.Resolve<FishingEventData>();
|
||
_playerFishData = GContext.container.Resolve<PlayerFishData>();
|
||
top_area = transform.Find("top_area").GetComponent<UITopArea>();
|
||
beilvpanel_max = transform.Find("DownMiddlePanel/btn_play/beilvpanel/bg_beilv_max").GetComponent<Transform>();
|
||
bg_beilvlpanel = transform.Find("DownMiddlePanel/btn_play/beilvpanel/bg_beilv").GetComponent<Transform>();
|
||
|
||
text_energy_time = transform.Find("DownMiddlePanel/bar/bg_info/text_info").GetComponent<TMP_Text>();
|
||
|
||
homeSupplyDropPanel = transform.Find("DownMiddlePanel/SupplyDrop").GetComponent<HomeSupplyDropPanel>();
|
||
|
||
MiddlePanel = transform.Find("safearea/MiddlePanel").gameObject;
|
||
homeBubbleTask = MiddlePanel.transform.GetChild(0).GetComponent<HomeBubbleTask>();
|
||
|
||
btn_chainschest = transform.Find("safearea/LeftPanel/layout/btn_offerchainschest").GetComponent<Button>();
|
||
|
||
rewardFlyPanel = transform.Find("RewardFlyPanel").GetComponent<Transform>();
|
||
rewardItemPrefab = transform.Find("RewardFlyPanel/reward").GetComponent<RewardItemNew>();
|
||
rewardItemPrefab.gameObject.SetActive(false);
|
||
btn_questionmark = transform.Find("DownMiddlePanel/bar/btn_questionmark").GetComponent<Button>();
|
||
btn_play = transform.Find("DownMiddlePanel/btn_play").GetComponent<UIButton>();
|
||
btn_play_anim = btn_play.GetComponent<Animator>();
|
||
effect_beilv_loop = transform.Find("DownMiddlePanel/btn_play/beilv/effect_beilv_loop").gameObject;
|
||
btn_beilv = transform.Find("DownMiddlePanel/btn_play/beilv").GetComponent<Button>();
|
||
btn_beilv_max = transform.Find("DownMiddlePanel/btn_play/beilv_max").GetComponent<Button>();
|
||
btn_beilv_image = transform.Find("DownMiddlePanel/btn_play/beilv").GetComponent<Image>();
|
||
buff_beilv_image = transform.Find("DownMiddlePanel/btn_play/beilv/buff_beilv").GetComponent<Image>();
|
||
btn_beilv_max_image = transform.Find("DownMiddlePanel/btn_play/beilv_max").GetComponent<Image>();
|
||
buff_beilv_max_image = transform.Find("DownMiddlePanel/btn_play/beilv_max/buff_beilv").GetComponent<Image>();
|
||
|
||
text_beilv = transform.Find("DownMiddlePanel/btn_play/beilv/text_beilv").GetComponent<TMP_Text>();
|
||
text_beilv_max = transform.Find("DownMiddlePanel/btn_play/beilv_max/text_beilv").GetComponent<TMP_Text>();
|
||
|
||
|
||
canvasGroup = GetComponent<CanvasGroup>();
|
||
anim = GetComponent<Animator>();
|
||
beilvpanel = transform.Find("DownMiddlePanel/btn_play/beilvpanel").GetComponent<CanvasGroup>();
|
||
text_beilvpanel_title =
|
||
transform.Find("DownMiddlePanel/btn_play/beilvpanel/text_title").GetComponent<TMP_Text>();
|
||
text_beilvpanel_content =
|
||
transform.Find("DownMiddlePanel/btn_play/beilvpanel/bg_beilv/text_beilv").GetComponent<TMP_Text>();
|
||
image_slider_energy = transform.Find("DownMiddlePanel/bar/Fill Area/Fill").GetComponent<Image>();
|
||
text_energy_value = transform.Find("DownMiddlePanel/bar/Fill Area/text_progress").GetComponent<TMP_Text>();
|
||
|
||
btn_rank = transform.Find("safearea/RightPanel/layout/btn_rank").GetComponent<Button>();
|
||
text_rank_time = transform.Find("safearea/RightPanel/layout/btn_rank/text_time").GetComponent<TMP_Text>();
|
||
text_rank = transform.Find("safearea/RightPanel/layout/btn_rank/text_rank").GetComponent<TMP_Text>();
|
||
rankIcon = transform.Find("safearea/RightPanel/layout/btn_rank/icon").GetComponent<Image>();
|
||
btn_friend = transform.Find("safearea/DownPanel/btn_friend").GetComponent<Button>();
|
||
|
||
btn_turntable = transform.Find("safearea/RightPanel/layout/btn_event").GetComponent<Button>();
|
||
|
||
btn_fishbowl = transform.Find("safearea/RightPanel/layout/btn_fishbowl").gameObject;
|
||
btn_fishingduel = transform.Find("safearea/RightPanel/layout/btn_fishingduel").gameObject;
|
||
|
||
btn_event_washing = transform.Find("safearea/RightPanel/layout/btn_washing").gameObject; // 洗游艇入口按钮
|
||
|
||
btn_battlePass = transform.Find("safearea/RightPanel/layout/btn_battlePass").GetComponent<Button>();
|
||
txt_battlePassTimer = transform.Find("safearea/RightPanel/layout/btn_battlePass/text_task").GetComponent<TMP_Text>();
|
||
|
||
btn_sign = transform.Find("safearea/RightPanel/layout/btn_sign").GetComponent<Button>();
|
||
text_turntable_time = transform.Find("safearea/RightPanel/layout/btn_event/text_time").GetComponent<TMP_Text>();
|
||
_tables = GContext.container.Resolve<Tables>();
|
||
btn_task_gray = transform.Find("safearea/DownPanel/btn_task/icon_gray").gameObject;
|
||
btn_friend_gray = transform.Find("safearea/DownPanel/btn_friend/icon_gray").gameObject;
|
||
|
||
if (Energy == 0)
|
||
{
|
||
Energy = GContext.container.Resolve<PlayerData>().Energy;
|
||
}
|
||
|
||
homeBtnRank = transform.Find("safearea/RightPanel/layout/btn_rank").GetComponent<HomeBtnRank>();
|
||
homeBuffPanel = transform.Find("safearea/RightPanel/layout/btn_buff").GetComponent<HomeBuffPanel>();
|
||
homeLeftPanel = transform.Find("safearea/LeftPanel/layout").GetComponent<HomeLeftPanel>();
|
||
homeLeftPanel.homePanel = this;
|
||
homeRightPanel = transform.Find("safearea/RightPanel/layout").GetComponent<HomeRightPanel>();
|
||
homeGift = transform.Find("safearea/LeftPanel/layout").GetComponent<HomeGiftBtnPanel>();
|
||
homeGift.Init();
|
||
|
||
dragEulerAngleLimit.y = ConvertTools.CalculateActualRotationAngle(dragEulerAngleLimit.y);
|
||
dragEulerAngleLimit.w = -ConvertTools.CalculateActualRotationAngle(-dragEulerAngleLimit.w);
|
||
}
|
||
|
||
|
||
protected override void Start()
|
||
{
|
||
Input.multiTouchEnabled = false;
|
||
base.Start();
|
||
homeSupplyDropPanel.Init();
|
||
|
||
btn_beilv.onClick.AddListener(OnclickMagnification);
|
||
btn_beilv_max.onClick.AddListener(OnclickMagnification);
|
||
btn_questionmark.onClick.AddListener(Questionmark);
|
||
btn_play.onDown.AddListener(StartAutoTimer);
|
||
btn_play.onUp.AddListener(StopCoroutineTimer);
|
||
btn_play.onClick.AddListener(OnClickPlay);
|
||
|
||
btn_friend.onClick.AddListener(() =>
|
||
{
|
||
if (GContext.container.Resolve<ClubService>().IsOpenClubJoined)
|
||
{
|
||
OnPushPanelOrScene(UITypes.FishingSocialPanel);
|
||
}
|
||
else
|
||
{
|
||
ToastPanel.Show(_fishingEventData.GetTipforUnlocked(GContext.container.Resolve<ClubService>().socialTipforUnlocked));
|
||
}
|
||
});
|
||
btn_rank.onClick.AddListener(async () =>
|
||
{
|
||
btn_rank.enabled = false;
|
||
|
||
await UIManager.Instance.ShowUILoad(UITypes.EventRankPopupPanel);
|
||
btn_rank.enabled = true;
|
||
});
|
||
btn_turntable.onClick.AddListener(() =>
|
||
{
|
||
btn_turntable.enabled = false;
|
||
|
||
OnPushPanelOrScene(UITypes.FishingTurntablePanel);
|
||
btn_turntable.enabled = true;
|
||
});
|
||
|
||
|
||
btn_battlePass.onClick.AddListener(() =>
|
||
{
|
||
btn_battlePass.enabled = false;
|
||
OnPushPanelOrScene(UITypes.BattlePassPanel);
|
||
btn_battlePass.enabled = true;
|
||
});
|
||
btn_sign.onClick.AddListener(async () =>
|
||
{
|
||
btn_sign.enabled = false;
|
||
await UIManager.Instance.GetUIAsync(UITypes.EventSignupPopupPanel);
|
||
btn_sign.enabled = true;
|
||
});
|
||
|
||
dragCameraScale = (dragEulerAngleLimit.x - dragEulerAngleLimit.z) / Screen.width;
|
||
GContext.OnEvent<ResAddEvent>().Subscribe(ResAddEvent).AddTo(disposables);
|
||
GContext.OnEvent<TargetEvent>().Subscribe(FishingEvent).AddTo(disposables);
|
||
GContext.OnEvent<HideHomePanelEvent>().Subscribe(OnHideHomePanelEvent).AddTo(disposables);
|
||
GContext.OnEvent<RewardPanelClose>().Subscribe(OnRewardPanelClose).AddTo(disposables);
|
||
GContext.OnEvent<GetUIAsyncEvent>().Subscribe(OnGetUIAsyncEvent).AddTo(disposables);
|
||
GContext.OnEvent<FaceUICloseEvent>().Subscribe(FaceUIEventClose).AddTo(disposables);
|
||
GContext.OnEvent<EventRankData>().Subscribe(SetRankRank).AddTo(disposables);
|
||
GContext.OnEvent<TriggerPackEvent>().Subscribe(TriggerPackEvent).AddTo(disposables);
|
||
GContext.OnEvent<BuffChangeEvent>().Subscribe(BufChangeEvent).AddTo(disposables);
|
||
//GContext.OnEvent<LackOfResourceCloseEvent>().Subscribe(x =>
|
||
//{
|
||
// if (!x.resultToShop)
|
||
// {
|
||
// ResourceCloseEvent();
|
||
// }
|
||
//}).AddTo(disposables);
|
||
|
||
GContext.OnEvent<ShowRewardPopupTop>().Subscribe(x =>
|
||
{
|
||
x.isHide = true;
|
||
}).AddTo(disposables);
|
||
|
||
transform.SetAsFirstSibling();
|
||
|
||
SetMoveCameraPanel();
|
||
OnStart();
|
||
}
|
||
void SetMoveCameraPanel()
|
||
{
|
||
moveCameraPanel.OnPointerDownCall = () =>
|
||
{
|
||
fishingData.mainCamera.DOKill(false);
|
||
_curMousePos = Input.mousePosition;
|
||
_offsetEuler = Vector3.zero;
|
||
_isMoveing = false;
|
||
isMouse = true;
|
||
};
|
||
moveCameraPanel.OnPointerUpCall = () =>
|
||
{
|
||
if (isMouse)
|
||
{
|
||
_isMoveing = true;
|
||
isMouse = false;
|
||
_offsetEuler = Vector3.zero;
|
||
_targetEuler = fishingData.startEuler.eulerAngles + _curEuler;
|
||
Move();
|
||
}
|
||
};
|
||
moveCameraPanel.OnDragCall = (eventData) =>
|
||
{
|
||
if (isMouse)
|
||
{
|
||
Vector3 ver = Input.mousePosition - _curMousePos;
|
||
_offsetEuler.x = CheckAngle(_offsetEuler.x);
|
||
_offsetEuler.y = CheckAngle(_offsetEuler.y);
|
||
_offsetEuler += new Vector3(-ver.y, ver.x, 0) * dragCameraScale;
|
||
//目标旋转角度
|
||
_offsetEuler.x = Mathf.Clamp(_offsetEuler.x, dragEulerAngleLimit.z, dragEulerAngleLimit.x);
|
||
_offsetEuler.y = Mathf.Clamp(_offsetEuler.y, dragEulerAngleLimit.w, dragEulerAngleLimit.y);
|
||
_curMousePos = Input.mousePosition;
|
||
}
|
||
};
|
||
}
|
||
void BufChangeEvent(BuffChangeEvent bufChangeEvent)
|
||
{
|
||
CheckSuperEnergyBuff();
|
||
SetShowMagnification();
|
||
}
|
||
|
||
//开始下一次钓鱼长按
|
||
void StartAutoTimer()
|
||
{
|
||
btn_play_anim.Play("Pressed", -1, 0);
|
||
}
|
||
void StopCoroutineTimer()
|
||
{
|
||
btn_play_anim.Play("Normal", -1, 0);
|
||
}
|
||
|
||
|
||
void ResAddEvent(ResAddEvent resAddEvent)
|
||
{
|
||
if (resAddEvent.id == 1001)
|
||
{
|
||
EnergyChangeAnim(resAddEvent.addCount);
|
||
}
|
||
else if (resAddEvent.id == 1002)
|
||
{
|
||
GoldChange();
|
||
}
|
||
}
|
||
void GoldChange()
|
||
{
|
||
GContext.container.Resolve<CampDataMM>().SetRedPoint();
|
||
}
|
||
void SetEndTime()
|
||
{
|
||
//显示倒计时
|
||
if (ctTimer == null || ctTimer.isDone)
|
||
{
|
||
DateTime endTime = _fishingEventData.GetCollectingTargetEndTime();
|
||
TimeSpan now = endTime - ZZTimeHelper.UtcNow().UtcNowOffset();
|
||
double seconds = now.TotalSeconds;
|
||
ctTimer = this.AttachTimer((float)seconds, RefreshMiddle,
|
||
(elapsed) =>
|
||
{
|
||
now = endTime - ZZTimeHelper.UtcNow().UtcNowOffset();
|
||
string text_time_text = ConvertTools.ConvertTime2(now.Days, now.Hours, now.Minutes, now.Seconds);
|
||
homeBubbleTask.SetCollectingTargetTime(text_time_text);
|
||
homeGift.SetCollectingTargetTime(text_time_text);
|
||
}, useRealTime: true);
|
||
}
|
||
}
|
||
void RefreshMiddle()
|
||
{
|
||
ctTimer?.Cancel();
|
||
ctTimer = null;
|
||
MiddlePanel.gameObject.SetActive(false);
|
||
homeGift.HideTarget();
|
||
//GContext.container.Resolve<FishingEventData>().GetEventAndInit(3, 2);
|
||
}
|
||
void SetRank()
|
||
{
|
||
rankTarget = _fishingEventData.rankTarget;
|
||
if (rankTarget != null)
|
||
{
|
||
if (rank_timer == null || rank_timer.isDone)
|
||
{
|
||
btn_rank.gameObject.SetActive(true);
|
||
DateTime endTime = _fishingEventData.GetRankEndTime();
|
||
TimeSpan now = endTime - ZZTimeHelper.UtcNow().UtcNowOffset();
|
||
double seconds = now.TotalSeconds;
|
||
rank_timer = this.AttachTimer((float)seconds, RefreshRank,
|
||
(elapsed) =>
|
||
{
|
||
now = endTime - ZZTimeHelper.UtcNow().UtcNowOffset();
|
||
text_rank_time.text = ConvertTools.ConvertTime2(now.Days, now.Hours, now.Minutes, now.Seconds);
|
||
}, useRealTime: true);
|
||
|
||
GContext.container.Resolve<IUIService>().SetImageSprite(rankIcon, _fishingEventData.rankInit.Icon, "HomePanel");
|
||
SetRankRank();
|
||
}
|
||
}
|
||
else
|
||
{
|
||
rank_timer?.Cancel();
|
||
rank_timer = null;
|
||
btn_rank.gameObject.SetActive(false);
|
||
}
|
||
}
|
||
void RefreshRank()
|
||
{
|
||
rank_timer?.Cancel();
|
||
rank_timer = null;
|
||
btn_rank.gameObject.SetActive(false);
|
||
GContext.container.Resolve<FishingEventData>().GetEventAndInit(3, 3);
|
||
//await GContext.container.Resolve<LeadboardData>().GetRewards();
|
||
}
|
||
void SetRankRank(EventRankData data = null)
|
||
{
|
||
if (_fishingEventData.IsOpenRank() && GContext.container.Resolve<LeadboardData>().GetMeRank() > 0)
|
||
{
|
||
text_rank.text = LocalizationMgr.GetFormatTextValue("UI_EventChallengeCrocodilePanel_9",
|
||
GContext.container.Resolve<LeadboardData>().GetMeRank());
|
||
}
|
||
else
|
||
{
|
||
text_rank.text = "--";
|
||
}
|
||
}
|
||
void SetTurntable()
|
||
{
|
||
//wheelLevel = _fishingEventData.wheelLevel;
|
||
if (_fishingEventData.IsShowTurntable())
|
||
{
|
||
btn_turntable.gameObject.SetActive(true);
|
||
// DateTime endTime = _fishingEventData.GetTurntableEndTime();
|
||
// TimeSpan all = endTime - ZZTimeHelper.UtcNow().UtcNowOffset();
|
||
// double seconds = all.TotalSeconds;
|
||
// text_turntable_time.text = LocalizationMgr.GetText("UI_TurntableInfoPopupPanel_17");
|
||
InitTurnTableTimer();
|
||
// yield return new WaitForSeconds((float)seconds);
|
||
// RefreshTurntable();
|
||
}
|
||
else
|
||
{
|
||
btn_turntable.gameObject.SetActive(false);
|
||
}
|
||
// StopCoroutine("StartTurntable");
|
||
// StartCoroutine("StartTurntable");
|
||
}
|
||
|
||
|
||
IDisposable disposable;
|
||
void RefreshBattlePassBtn()
|
||
{
|
||
if (!GContext.container.Resolve<BattlePassDataProvider>().IsActivating)
|
||
{
|
||
//战令结束
|
||
btn_battlePass.gameObject.SetActive(false);
|
||
return;
|
||
}
|
||
btn_battlePass.gameObject.SetActive(true);
|
||
disposable?.Dispose();
|
||
var dataProvider = GContext.container.Resolve<BattlePassDataProvider>();
|
||
DateTime curTimer = ZZTimeHelper.UtcNow().UtcNowOffset();
|
||
DateTime endTime = GContext.container.Resolve<FishingEventData>().GetEventEndTime(dataProvider.Data.BattlePassRecord.ID);
|
||
TimeSpan duration = endTime - curTimer;
|
||
dataProvider.CheckIfRefreshDailyTask();
|
||
dataProvider.CheckIfRefreshWeekTask();
|
||
txt_battlePassTimer.text = ConvertTools.ConvertTime2(duration);
|
||
disposable = Observable.Interval(TimeSpan.FromSeconds(1))
|
||
.TakeWhile(seconds => seconds < duration.TotalSeconds)
|
||
.Subscribe(x =>
|
||
{
|
||
if (dataProvider.IsActivating)
|
||
{
|
||
txt_battlePassTimer.text = ConvertTools.ConvertTime2(endTime - ZZTimeHelper.UtcNow().UtcNowOffset());
|
||
}
|
||
}, RefreshBattlePass);
|
||
GContext.container.Resolve<BattlePassDataProvider>().SetRedPoint();
|
||
|
||
}
|
||
void RefreshBattlePass()
|
||
{
|
||
disposable?.Dispose();
|
||
//GContext.container.Resolve<FishingEventData>().GetEventAndInit(3, 7);
|
||
}
|
||
void RefreshTurntable()
|
||
{
|
||
btn_turntable.gameObject.SetActive(false);
|
||
//GContext.container.Resolve<FishingEventData>().GetEventAndInit(3, 4);
|
||
}
|
||
|
||
void SetSignTimer()
|
||
{
|
||
btn_sign.gameObject.SetActive(GContext.container.Resolve<SigninData>().NewSignEventIsOpen());
|
||
|
||
if (GContext.container.Resolve<SigninData>().NewSignEventIsOpen())
|
||
{
|
||
btn_sign.gameObject.SetActive(true);
|
||
double seconds = GContext.container.Resolve<SigninData>().NewSignEventEndTime().TotalSeconds;
|
||
signTimer = this.AttachTimer((float)seconds, null,
|
||
(elapsed) =>
|
||
{
|
||
double seconds = GContext.container.Resolve<SigninData>().NewSignEventEndTime().TotalSeconds;
|
||
if (seconds < 0)
|
||
{
|
||
RefreshSign();
|
||
}
|
||
}, useRealTime: true);
|
||
}
|
||
else
|
||
{
|
||
signTimer?.Cancel();
|
||
signTimer = null;
|
||
}
|
||
}
|
||
void RefreshSign()
|
||
{
|
||
signTimer?.Cancel();
|
||
signTimer = null;
|
||
btn_sign.gameObject.SetActive(false);
|
||
}
|
||
void OnClickPlay()
|
||
{
|
||
if (GContext.container.Resolve<GuideDataCenter>().curDefine != null &&
|
||
GContext.container.Resolve<GuideDataCenter>().curDefine.fingerType != FingerType.None &&
|
||
GContext.container.Resolve<GuideDataCenter>().curDefine.panelName == "HomePanel")
|
||
{
|
||
return;
|
||
}
|
||
StartFishingPlay();
|
||
}
|
||
public async void PopupStore()
|
||
{
|
||
if (GContext.container.Resolve<PlayerData>().GetCanMagnification() == false)
|
||
{
|
||
await Awaiters.NextFrame;
|
||
if (GContext.container.Resolve<GuideDataCenter>().curDefine != null &&
|
||
GContext.container.Resolve<GuideDataCenter>().curDefine.panelName == "HomePanel")
|
||
{
|
||
return;
|
||
}
|
||
OnPlayFailed();
|
||
}
|
||
}
|
||
async void StartFishingPlay()
|
||
{
|
||
if (isFishingPanel)
|
||
{
|
||
return;
|
||
}
|
||
GContext.Publish(new EventFishingSound(SoundType.audio_ui_btn_cast));
|
||
GContext.Publish(new VibrationData(HapticTypes.Selection));
|
||
|
||
var collectingTargetInit = _fishingEventData.collectingTargetInit;
|
||
if (collectingTargetInit != null)
|
||
{
|
||
int addCollecting = GContext.container.Resolve<CollectingData>().GetAddCollecting();
|
||
if (addCollecting > 0 && !await _fishingEventData.IsDownLoadPkg())
|
||
{
|
||
GameObject go = await UIManager.Instance.ShowUI(UITypes.NoticeConfirmPopupPanel);
|
||
var NoticeConfirmPopupPanel = go.GetComponent<NoticeConfirmPopupPanel>();
|
||
string eventName = LocalizationMgr.GetText(collectingTargetInit.Title_l10n_key);
|
||
string info = LocalizationMgr.GetFormatTextValue("UI_FishingReconnectPanel_101004", eventName);
|
||
string label = LocalizationMgr.GetText("UI_COMMON_confirm");
|
||
string title = LocalizationMgr.GetText("UI_FishingNoticePopupPanel_101001");
|
||
NoticeConfirmPopupPanel.Init(1, title, info, btn_left_text: label);
|
||
return;
|
||
}
|
||
}
|
||
|
||
if (GContext.container.Resolve<PlayerData>().GetCanMagnification() == false)
|
||
{
|
||
GContext.Publish(new VibrationData(HapticTypes.Failure));
|
||
OnPlayFailed();
|
||
#if AGG
|
||
using (var e = GEvent.GameEvent("lack_resources"))
|
||
{
|
||
e.AddContent("item_id", 1001)
|
||
.AddContent("lv", GContext.container.Resolve<PlayerData>().lv);
|
||
}
|
||
#endif
|
||
}
|
||
else
|
||
{
|
||
GContext.Publish(new VibrationData(HapticTypes.MediumImpact));
|
||
DisableBlocksRaycasts();
|
||
isFishingPanel = true;
|
||
await UIManager.Instance.ShowUI(UITypes.FishingPanel);
|
||
UIManager.Instance.DestroyUI(UITypes.HomePanel);
|
||
}
|
||
}
|
||
IDisposable disposable_6;
|
||
void OnPlayFailed()
|
||
{
|
||
GContext.container.Resolve<TriggerPackData>().UpdateTriggerPackData(new ConditionTypeEvent(ConditionType.AccountLevelAfterNoEnergy, 1));
|
||
int curEnergy = GContext.container.Resolve<PlayerData>().Energy;
|
||
if (GContext.container.Resolve<PlayerShopData>().IsShopOpen)
|
||
{
|
||
GContext.container.Resolve<TriggerPackData>().AddTriggerPackData(4000001);
|
||
var triggerPackDic = GContext.container.Resolve<TriggerPackData>().GetTriggerPackList(1);
|
||
if (triggerPackDic.Count == 0)
|
||
{
|
||
//GContext.container.Resolve<TriggerPackData>().AddTriggerPackData(40000011);
|
||
GContext.container.Resolve<TriggerPackData>().UpdateTriggerPackData(new ConditionTypeEvent(ConditionType.OutOfEnergy, 1));
|
||
triggerPackDic = GContext.container.Resolve<TriggerPackData>().GetTriggerPackList(4);
|
||
if (triggerPackDic.Count > 0)
|
||
{
|
||
GContext.container.Resolve<IFaceUIService>().AddGiftFaceUI(triggerPackDic[0].ID, UITypes.GiftPopupPanel_8, triggerPackDic[0].lastID, true);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
GContext.container.Resolve<IFaceUIService>().AddGiftFaceUI(triggerPackDic[0].ID, UITypes.GiftPopupPanel_6, triggerPackDic[0].lastID, true);
|
||
}
|
||
|
||
if (triggerPackDic.Count > 0)
|
||
{
|
||
//添加拍脸
|
||
GContext.Publish(new TriggerPackEvent());
|
||
CurRewardQCount curRewardQCount = new CurRewardQCount();
|
||
GContext.Publish(curRewardQCount);
|
||
if (curRewardQCount.count <= 0)
|
||
{
|
||
int faceCount = GContext.container.Resolve<IFaceUIService>().GetFaceUICount();
|
||
if (faceCount > 0)
|
||
{
|
||
disposable_6?.Dispose();
|
||
disposable_6 = null;
|
||
disposable_6 = GContext.OnEvent<GiftPopupPanelEnergyEvent>().Subscribe(x =>
|
||
{
|
||
disposable_6?.Dispose();
|
||
disposable_6 = null;
|
||
int newEnergy = GContext.container.Resolve<PlayerData>().Energy;
|
||
OnPhysicalBuyFailed(curEnergy == newEnergy);
|
||
});
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
OnPhysicalBuyFailed(true);
|
||
}
|
||
else
|
||
{
|
||
_ = UIManager.Instance.ShowUI(UITypes.LackOfLuresConfirmPopupPanel);
|
||
//GContext.container.Resolve<GuideDataCenter>().TriggerGuide(asap.core.GContext.container.Resolve<Tables>().TbGlobalConfig.FixedGuidance02, "HomePanel");
|
||
}
|
||
}
|
||
async void OnPhysicalBuyFailed(bool isToast)
|
||
{
|
||
if (isToast)
|
||
{
|
||
await UIManager.Instance.ShowUI(UITypes.LackOfResourcePopupPanel);
|
||
}
|
||
//else
|
||
//{
|
||
// OnPhysicalFailed();
|
||
//}
|
||
}
|
||
//void ResourceCloseEvent()
|
||
//{
|
||
// OnPhysicalFailed();
|
||
//}
|
||
|
||
void Questionmark()
|
||
{
|
||
UIManager.Instance.ShowUI(UITypes.SupplyDropInfoPopupPanel);
|
||
}
|
||
|
||
void OnclickMagnification()
|
||
{
|
||
var playerData = GContext.container.Resolve<PlayerData>();
|
||
playerData.magnification += 1;
|
||
if (playerData.magnification >= playerData.MagnificationCount)
|
||
{
|
||
playerData.magnification = 0;
|
||
GContext.Publish(new VibrationData(HapticTypes.RigidImpact));
|
||
}
|
||
else
|
||
{
|
||
GContext.Publish(new VibrationData(HapticTypes.SoftImpact));
|
||
}
|
||
//空投倍率修改
|
||
bool isShow = homeSupplyDropPanel.Show();
|
||
playerData.SetMagnification();
|
||
text_beilv.text = text_beilv_max.text = $"x{playerData.GetMagnification()}";
|
||
SetShowMagnification();
|
||
if (!isShow)
|
||
{
|
||
GContext.Publish(new EventUISound("audio_ui_btn_beilv"));
|
||
beilvpanel.alpha = 1;
|
||
beilvpanel.DOKill();
|
||
beilvpanel.DOFade(0, 2f).SetDelay(1f);
|
||
}
|
||
else
|
||
{
|
||
beilvpanel.DOKill();
|
||
beilvpanel.alpha = 0;
|
||
}
|
||
}
|
||
|
||
void SetShowMagnification()
|
||
{
|
||
bool IsMax = GContext.container.Resolve<PlayerData>().IsMaxMagnification();
|
||
if (!IsMax)
|
||
{
|
||
effect_beilv_loop.SetActive(GContext.container.Resolve<PlayerData>().IsShowEffectBeilvLoop());
|
||
}
|
||
IUIService uIService = GContext.container.Resolve<IUIService>();
|
||
string beilvImage = GContext.container.Resolve<PlayerData>().GetMagnificationIcon();
|
||
uIService.SetImageSprite(btn_beilv_image, beilvImage, "HomePanel");
|
||
btn_beilv.gameObject.SetActive(!IsMax && GContext.container.Resolve<PlayerData>().IsOpenMagnification);
|
||
btn_beilv_max.gameObject.SetActive(IsMax && GContext.container.Resolve<PlayerData>().IsOpenMagnification);
|
||
beilvpanel_max.gameObject.SetActive(IsMax);
|
||
bg_beilvlpanel.gameObject.SetActive(!IsMax);
|
||
text_beilvpanel_content.text = IsMax
|
||
? "MAX"
|
||
: $"x{GContext.container.Resolve<PlayerData>().GetMagnification()}";
|
||
}
|
||
|
||
//体力不足并且没有补充
|
||
//public void OnPhysicalFailed()
|
||
//{
|
||
// PlayerData playerData = GContext.container.Resolve<PlayerData>();
|
||
// int newMagnification = playerData.GetCurMaxMagnification();
|
||
// if (newMagnification < playerData.magnification)
|
||
// {
|
||
// playerData.magnification = newMagnification;
|
||
// //ToastPanel.Show(LocalizationMgr.GetText("UI_ToastPanel_5"));
|
||
// }
|
||
// if (playerData.Energy < playerData.GetMagnification())
|
||
// {
|
||
// playerData.magnification = playerData.SetLittleMagnification();
|
||
// }
|
||
// GContext.container.Resolve<PlayerData>().SetMagnification();
|
||
// text_beilv.text = text_beilv_max.text = $"x{GContext.container.Resolve<PlayerData>().GetMagnification()}";
|
||
// SetShowMagnification();
|
||
//}
|
||
|
||
private void InitPanel()
|
||
{
|
||
beilvpanel.alpha = 0;
|
||
CheckSuperEnergyBuff();
|
||
OnPhysicalChange();
|
||
}
|
||
|
||
void CheckSuperEnergyBuff()
|
||
{
|
||
var buffTimeData = GContext.container.Resolve<BuffDataCenter>().GetWeelyBuffTimeData<SuperEnergyMag>();
|
||
bool curSuperEnergy = buffTimeData != null;
|
||
if (!curSuperEnergy)
|
||
{
|
||
PlayerData playerData = GContext.container.Resolve<PlayerData>();
|
||
playerData.CheckSuperEnergyBuff();
|
||
}
|
||
SetBeiLvImage(curSuperEnergy);
|
||
text_beilv.text = text_beilv_max.text = $"x{GContext.container.Resolve<PlayerData>().GetMagnification()}";
|
||
}
|
||
|
||
void SetBeiLvImage(bool curSuperEnergy)
|
||
{
|
||
if (isSuperEnergy != curSuperEnergy)
|
||
{
|
||
isSuperEnergy = curSuperEnergy;
|
||
buff_beilv_max_image.gameObject.SetActive(isSuperEnergy);
|
||
buff_beilv_image.gameObject.SetActive(isSuperEnergy);
|
||
}
|
||
}
|
||
private void OnPhysicalChange()
|
||
{
|
||
SetShowMagnification();
|
||
SetEnergyTimer();
|
||
ShowEnergy();
|
||
}
|
||
|
||
void ShowEnergy()
|
||
{
|
||
text_energy_value.text = $"{Energy}/{GContext.container.Resolve<PlayerData>().MaxEnergy}";
|
||
image_slider_energy.fillAmount = Energy / (float)GContext.container.Resolve<PlayerData>().MaxEnergy;
|
||
}
|
||
|
||
void SetEnergyTimer()
|
||
{
|
||
EnergyTimer?.Cancel();
|
||
EnergyTimer = null;
|
||
text_energy_time.gameObject.SetActive(false);
|
||
if (EnergyTimer == null)
|
||
{
|
||
PlayerData playerData = GContext.container.Resolve<PlayerData>();
|
||
if (playerData.Energy < playerData.MaxEnergy)
|
||
{
|
||
text_energy_time.gameObject.SetActive(true);
|
||
int EnergyRecover = playerData.EnergyRecover;
|
||
TimeSpan now = playerData.GetEnergyRecoveryTimeMAndS();
|
||
string Time2 = ConvertTools.ConvertTime2(now.Days, now.Hours, now.Minutes, now.Seconds);
|
||
text_energy_time.text = LocalizationMgr.GetFormatTextValue("UI_LackOfResourcePopupPanel_3", EnergyRecover, Time2);
|
||
EnergyTimer = this.AttachTimer((float)now.TotalSeconds, SetEnergyTimer,
|
||
(elapsed) =>
|
||
{
|
||
now = playerData.GetEnergyRecoveryTimeMAndS();
|
||
string Time2 = ConvertTools.ConvertTime2(now.Days, now.Hours, now.Minutes, now.Seconds);
|
||
text_energy_time.text = LocalizationMgr.GetFormatTextValue("UI_LackOfResourcePopupPanel_3", EnergyRecover, Time2);
|
||
if (playerData.Energy >= playerData.MaxEnergy)
|
||
{
|
||
EnergyTimer?.Cancel();
|
||
EnergyTimer = null;
|
||
text_energy_time.gameObject.SetActive(false);
|
||
}
|
||
}, useRealTime: true);
|
||
|
||
}
|
||
else
|
||
{
|
||
text_energy_time.gameObject.SetActive(false);
|
||
}
|
||
}
|
||
}
|
||
|
||
public void EnergyChangeAnim(int addCount)
|
||
{
|
||
int endEnergy = GContext.container.Resolve<PlayerData>().Energy;
|
||
if (addCount > 0)
|
||
{
|
||
endEnergy = Energy + addCount;
|
||
}
|
||
if (Energy == endEnergy)
|
||
{
|
||
return;
|
||
}
|
||
int curEnergy = Energy;
|
||
Energy = endEnergy;
|
||
DOTween.Kill("home_text_energy");
|
||
OnPhysicalChange();
|
||
DOTween.To(() => curEnergy, x => curEnergy = x, endEnergy, 1f).OnUpdate(() =>
|
||
{
|
||
image_slider_energy.fillAmount = curEnergy / (float)GContext.container.Resolve<PlayerData>().MaxEnergy;
|
||
text_energy_value.text = $"{curEnergy}/{GContext.container.Resolve<PlayerData>().MaxEnergy}";
|
||
}).SetId("home_text_energy");
|
||
}
|
||
public async void OnPushPanelOrScene(UIType panelType) //UI的控件触发
|
||
{
|
||
GameObject go = await UIManager.Instance.ShowUILoad(panelType);
|
||
if (go != null)
|
||
{
|
||
OnHideHomePanelEvent(new HideHomePanelEvent());
|
||
}
|
||
}
|
||
void OnHideHomePanelEvent(HideHomePanelEvent e)
|
||
{
|
||
DisableBlocksRaycasts();
|
||
if (!e.IsHideMap)
|
||
{
|
||
isFishingPanel = true;
|
||
}
|
||
canvasGroup.alpha = 0;
|
||
canvasGroup.interactable = false;
|
||
Destroy(homeLeftPanel);
|
||
Destroy(homeBuffPanel);
|
||
Destroy(homeRightPanel);
|
||
Destroy(homeBtnRank);
|
||
Destroy(this);
|
||
|
||
}
|
||
void SetAlpha()
|
||
{
|
||
canvasGroup.alpha = DeBugPanel.isShow ? 1 : 0;
|
||
}
|
||
public async void OnStart()
|
||
{
|
||
fishingData = GContext.container.Resolve<FishingData>();
|
||
GContext.container.Resolve<PlayerShopData>().SetAdvRedPoint();
|
||
GContext.Publish(new MapShowEvent() { isShow = true });
|
||
panelName = "HomePanel";
|
||
fishingStage = GContext.container.ResolveStage("FishingStage") as FishingStage;
|
||
SetAlpha();
|
||
//设置设备陀螺仪的开启/关闭状态,使用陀螺仪功能必须设置为 true
|
||
// Input.gyro.enabled = true;
|
||
// Input.gyro.updateInterval = 0.1f;
|
||
_offsetEuler = Vector3.zero;
|
||
SetTurntable();
|
||
SystemSwitch();
|
||
InitPanel();
|
||
GContext.container.Resolve<ClubService>().GetServiceEvent();
|
||
LeadboardData leadboardData = GContext.container.Resolve<LeadboardData>();
|
||
if (leadboardData.rankItemDatas != null)
|
||
{
|
||
ShowItemCount(leadboardData.rankItemDatas);
|
||
}
|
||
else
|
||
{
|
||
_ = GContext.container.Resolve<LeadboardData>().GetRewards();
|
||
}
|
||
if (_fishingEventData.targetItemDatas != null)
|
||
{
|
||
ShowItemCount(_fishingEventData.targetItemDatas);
|
||
}
|
||
if (_fishingEventData.rankItemDatas != null)
|
||
{
|
||
ShowItemCount(_fishingEventData.rankItemDatas);
|
||
}
|
||
//目标奖励活动和空投buff
|
||
if (fishingData.supplyDropCtrl != null)
|
||
{
|
||
//空投的资源飞入
|
||
TargetAddData targetAddData = fishingData.supplyDropCtrl.targetAddData;
|
||
if (targetAddData.id > 0)
|
||
{
|
||
if (fishingData.isAwaitTargetBuff)
|
||
{
|
||
ShowItemCount(targetAddData);
|
||
EventTargetAdd(targetAddData.id, targetAddData.curCount, targetAddData.addCount, true, fishingData.supplyDropCtrl.targetPos);
|
||
}
|
||
else
|
||
{
|
||
fishingStage.q_TargetAddData.Add(targetAddData);
|
||
}
|
||
}
|
||
if (fishingStage.q_TargetAddData != null)
|
||
{
|
||
ShowItemCount(fishingStage.q_TargetAddData);
|
||
}
|
||
ShowEnergy();
|
||
fishingData.supplyDropCtrl = null;
|
||
await homeBuffPanel.BuffShow();
|
||
}
|
||
else
|
||
{
|
||
if (fishingStage.q_TargetAddData != null)
|
||
{
|
||
ShowItemCount(fishingStage.q_TargetAddData);
|
||
}
|
||
ShowEnergy();
|
||
}
|
||
|
||
///中间插目标奖励活动Buff
|
||
if (fishingData.isAwaitTargetBuff)
|
||
{
|
||
await AddTargetBuff();
|
||
}
|
||
CurRewardQCount curRewardQCount = new CurRewardQCount();
|
||
if (fishingStage.q_TargetAddData.Count > 0)
|
||
{
|
||
PlayTargetAdd();
|
||
}
|
||
else/*if (_fishingEventData.preCollectingTarget == null && _fishingEventData.preRankTarget == null)*/
|
||
{
|
||
//登陆的时候拿到补单数据,奖励显示在这里处理
|
||
GContext.container.Resolve<PlayerShopData>().ReleaseReplenishmentData();
|
||
//礼包拍脸在补单之后处理
|
||
GContext.container.Resolve<TriggerPackData>().SetInitFace();
|
||
var service = GContext.container.Resolve<IDeferredRewardStashService>();
|
||
service.Flush();
|
||
|
||
GContext.Publish(new ShowData());
|
||
}
|
||
//先补单后各种拍脸
|
||
|
||
GContext.Publish(curRewardQCount);
|
||
if (!packDataProgress && curRewardQCount.count <= 0)
|
||
{
|
||
OnNoReward();
|
||
}
|
||
}
|
||
bool PlayTargetAdd(bool isFly = true)
|
||
{
|
||
packDataProgress = false;
|
||
var fishingStage = GContext.container.ResolveStage("FishingStage") as FishingStage;
|
||
int q_count = fishingStage.q_TargetAddData.Count;
|
||
if (q_count > 0)
|
||
{
|
||
//目标奖励活动获得的奖励
|
||
fishingStage.NextToQueue(FishingEventData.NextQueueKey);
|
||
}
|
||
CurRewardQCount curRewardQCount = new CurRewardQCount();
|
||
GContext.Publish(curRewardQCount);
|
||
bool isShowReward = curRewardQCount.count > 0;
|
||
if (isShowReward)
|
||
{
|
||
btn_mask.gameObject.SetActive(true);
|
||
}
|
||
else
|
||
{
|
||
btn_mask.gameObject.SetActive(false);
|
||
}
|
||
|
||
if (q_count > 0)
|
||
{
|
||
int rootCount = fishingStage.q_TargetAddData.Count();
|
||
if (rootCount > 4)
|
||
{
|
||
rootCount = 4;
|
||
}
|
||
Transform flyPosRoot = transform.Find($"RewardFlyPanel/{rootCount}");
|
||
int index = 0;
|
||
for (int i = 0; i < q_count; i++)
|
||
{
|
||
TargetAddData targetAddData = fishingStage.q_TargetAddData[i];
|
||
Vector3 curPos = flyPosRoot.GetChild(index % rootCount).position;
|
||
index++;
|
||
EventTargetAdd(targetAddData.id, targetAddData.curCount, targetAddData.addCount, isFly, curPos);
|
||
}
|
||
fishingStage.q_TargetAddData.Clear();
|
||
}
|
||
return isShowReward;
|
||
}
|
||
HashSet<string> GetUIAsyncEventCount = new HashSet<string>();
|
||
void OnGetUIAsyncEvent(GetUIAsyncEvent data)
|
||
{
|
||
if (data.uIType == UITypes.HomePanel.Name)
|
||
{
|
||
return;
|
||
}
|
||
if (data.show)
|
||
{
|
||
GetUIAsyncEventCount.Add(data.uIType);
|
||
}
|
||
else
|
||
{
|
||
GetUIAsyncEventCount.Remove(data.uIType);
|
||
if (GetUIAsyncEventCount.Count == 0)
|
||
{
|
||
CurRewardQCount curRewardQCount = new CurRewardQCount();
|
||
GContext.Publish(curRewardQCount);
|
||
int faceCount = GContext.container.Resolve<IFaceUIService>().GetFaceUICount();
|
||
if (faceCount == 0 && curRewardQCount.count == 0)
|
||
{
|
||
_ = homeBuffPanel.BuffShow();
|
||
//钓鱼挑战赛 TODO:LF
|
||
// GContext.container.Resolve<FishingChallengeManager>().CheckAutoOpenPanel();
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
void OnRewardPanelClose(RewardPanelClose rewardPanelClose)
|
||
{
|
||
bool isReward = PlayTargetAdd(false);
|
||
if (!isReward)
|
||
{
|
||
OnNoReward();
|
||
}
|
||
}
|
||
void FaceUIEventClose(FaceUICloseEvent faceUICloseEvent)
|
||
{
|
||
bool result = AquariumUpdate();
|
||
if (result)
|
||
{
|
||
return;
|
||
}
|
||
CurRewardQCount curRewardQCount = new CurRewardQCount();
|
||
GContext.Publish(curRewardQCount);
|
||
if (curRewardQCount.count <= 0)
|
||
{
|
||
GContext.container.Resolve<GuideDataCenter>().InspectTriggerGuide("HomePanel");
|
||
|
||
//BuffShow();
|
||
//if (GContext.container.Resolve<ClubService>().IsOpenClubJoined)
|
||
GContext.container.Resolve<ClubService>().ShowHomeReport();
|
||
}
|
||
else
|
||
{
|
||
GContext.Publish(new ShowData());
|
||
}
|
||
}
|
||
|
||
void OnNoReward()
|
||
{
|
||
_playerFishData.SetMapRed();
|
||
|
||
int faceCount = GContext.container.Resolve<IFaceUIService>().GetFaceUICount();
|
||
bool isGuide = GContext.container.Resolve<GuideDataCenter>().InspectTriggerGuide("HomePanel");
|
||
if (!isGuide)
|
||
{
|
||
if (faceCount > 0)
|
||
{
|
||
GContext.container.Resolve<IFaceUIService>().ShowFaceUI();
|
||
}
|
||
else
|
||
{
|
||
//BuffShow();
|
||
//GContext.container.Resolve<FishingChallengeCenter>().IsAutoOpenPanel();
|
||
//钓鱼挑战赛
|
||
GContext.container.Resolve<ClubService>().ShowHomeReport();
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (RewardFlyPanel == null)
|
||
{
|
||
RewardFlyPanel = transform.Find("RewardFlyPanel").gameObject.AddComponent<Canvas>();
|
||
RewardFlyPanel.overrideSorting = true;
|
||
RewardFlyPanel.sortingOrder = 10;
|
||
}
|
||
}
|
||
}
|
||
void TriggerPackEvent(TriggerPackEvent triggerPackEvent)
|
||
{
|
||
SystemSwitch();
|
||
}
|
||
void SystemSwitch()
|
||
{
|
||
CollectingTargetNext();
|
||
SetRank();
|
||
SetSignTimer();
|
||
btn_task_gray.SetActive(!_playerFishData.IsOpenMap);
|
||
GContext.container.Resolve<CampDataMM>().SetRedPoint();
|
||
btn_friend_gray.SetActive(!GContext.container.Resolve<ClubService>().IsOpenClubJoined);
|
||
|
||
RefreshBattlePassBtn();
|
||
if (GContext.container.Resolve<ClubService>().IsOpenClubJoined)
|
||
{
|
||
GContext.container.Resolve<ClubService>().GetSelfClub();
|
||
}
|
||
|
||
}
|
||
|
||
void DisableBlocksRaycasts()
|
||
{
|
||
anim.enabled = false;
|
||
canvasGroup.blocksRaycasts = false;
|
||
}
|
||
|
||
bool isEnterGamePlay = false;
|
||
async void EventPanelWrap(int code)
|
||
{
|
||
if (isEnterGamePlay)
|
||
{
|
||
return;
|
||
}
|
||
isEnterGamePlay = true;
|
||
var eventGamePlayPanel = await UIManager.Instance.GetUIAsync(UITypes.EventGamePlayPanel);
|
||
eventGamePlayPanel.GetComponent<EventGamePlayPanel>().StartGame(code);
|
||
}
|
||
|
||
public void Update()
|
||
{
|
||
#if UNITY_EDITOR
|
||
#region 快捷键
|
||
// Some event that you may want to open, or close, if all works are done.
|
||
if (Input.GetKey(KeyCode.G))
|
||
if (Input.GetKeyDown(KeyCode.C))
|
||
{
|
||
EventGatherCoreAct.Ctx = EventGatherCoreTableContext.GetTestSample();
|
||
GContext.container.Register<EventGatherCoreData>().AsSingleton();
|
||
GContext.container.Resolve<EventGatherCoreData>().InitNew(70100033);
|
||
GContext.Publish(new UnloadActToNextAct { actId = "EventGatherCoreAct" , TransitionPanel = UITypes.CloudTransitionPanel});
|
||
}
|
||
//同时按下G键和数字键1,EventShowDownPanel
|
||
if (Input.GetKey(KeyCode.G))
|
||
{
|
||
//同时按下G键和键F1,EventBankHeistPanel
|
||
if (Input.GetKeyDown(KeyCode.F1))
|
||
{
|
||
EventBankHeistPanel.selectionType = 1;
|
||
EventPanelWrap(11);
|
||
}
|
||
else if (Input.GetKeyDown(KeyCode.F2))
|
||
{
|
||
EventBankHeistPanel.selectionType = 2;
|
||
EventPanelWrap(11);
|
||
}
|
||
else if (Input.GetKeyDown(KeyCode.F3))
|
||
{
|
||
EventBankHeistPanel.selectionType = 3;
|
||
EventPanelWrap(11);
|
||
}
|
||
else //同时按下G键和数字键2,EventBankHeistPanel
|
||
if (Input.GetKeyDown(KeyCode.Alpha2))
|
||
{
|
||
EventBankHeistPanel.selectionType = 0;
|
||
EventPanelWrap(11);
|
||
}
|
||
else
|
||
//同时按下G键和数字键3,EventIslandBombHeistPanel
|
||
if (Input.GetKeyDown(KeyCode.Alpha1))
|
||
{
|
||
EventPanelWrap(12);
|
||
}
|
||
}
|
||
if (Input.GetKey(KeyCode.X) && Input.GetKeyDown(KeyCode.Alpha1))
|
||
{
|
||
DeBugPanel.isShow = !DeBugPanel.isShow;
|
||
SetAlpha();
|
||
}
|
||
|
||
if (Input.GetKey(KeyCode.D))
|
||
{
|
||
// var fcm = GContext.container.Resolve<FishingChallengeManager>();
|
||
// fcm.ClearFishingChallengeData();
|
||
|
||
// var manager = GContext.container.Resolve<OfferChainsChestManager>();
|
||
// manager.ClearOfferChainsData();
|
||
// manager?.Init();
|
||
|
||
var hmdm = GContext.container.Resolve<HexMapDataManager>();
|
||
hmdm.ClearMapData();
|
||
hmdm.Init();
|
||
|
||
}
|
||
|
||
if (Input.GetKey(KeyCode.B))
|
||
{
|
||
//var fcm = GContext.container.Resolve(Hex)
|
||
// HexMapManager
|
||
var fcm = GContext.container.Resolve<FishingChallengeManager>();
|
||
fcm.InitHexMap();
|
||
|
||
}
|
||
#endregion
|
||
#endif
|
||
|
||
if (fishingData.mainCamera == null)
|
||
{
|
||
return;
|
||
}
|
||
|
||
if (isMouse && !_isMoveing)
|
||
{
|
||
if (fishingData.mainCamera != null)
|
||
{
|
||
Quaternion target = Quaternion.Euler(_offsetEuler + _targetEuler);
|
||
fishingData.mainCamera.localRotation = Quaternion.Angle(target, fishingData.mainCamera.localRotation) > 0.1f
|
||
? Quaternion.Lerp(Quaternion.Euler(fishingData.mainCamera.localEulerAngles), target, 0.2f)
|
||
: target;
|
||
}
|
||
}
|
||
}
|
||
|
||
public float CheckAngle(float value)
|
||
{
|
||
float angle = value - 180;
|
||
|
||
if (angle > 0)
|
||
return angle - 180;
|
||
|
||
return angle + 180;
|
||
}
|
||
|
||
void Move()
|
||
{
|
||
fishingData.mainCamera.DOLocalRotate(_targetEuler, duration)
|
||
.OnComplete(() => { _isMoveing = false; })
|
||
.SetEase(Ease.Linear);
|
||
}
|
||
/// <summary>
|
||
/// 所有Event配置控制的主界面按钮
|
||
/// 跨天 或者其他情况玩家在主界面的时候 Event开启或关闭
|
||
/// 一般只有开启需要处理 关闭活动本身相关脚本中就处理了
|
||
/// </summary>
|
||
/// <param name="data"> type == 0 触发礼包 type != 0 event.type</param>
|
||
void FishingEvent(TargetEvent data)
|
||
{
|
||
switch (data.type)
|
||
{
|
||
case 0:
|
||
switch (data.subType)
|
||
{
|
||
case 3:
|
||
homeLeftPanel.SetChainGiftPackTimer();
|
||
break;
|
||
}
|
||
break;
|
||
case 3:
|
||
switch (data.subType)
|
||
{
|
||
case 2:
|
||
CollectingTargetNext();
|
||
break;
|
||
case 3:
|
||
SetRank();
|
||
break;
|
||
case 4:
|
||
SetTurntable();
|
||
break;
|
||
case 6:
|
||
SetSignTimer();
|
||
break;
|
||
case 7:
|
||
RefreshBattlePassBtn();
|
||
break;
|
||
case 10:
|
||
homeLeftPanel.SetChainGiftPackTimer();
|
||
break;
|
||
}
|
||
break;
|
||
case 4:
|
||
switch (data.subType)
|
||
{
|
||
case 3:
|
||
btn_fishbowl.SetActive(true);
|
||
break;
|
||
case 4:
|
||
if (btn_event_washing != null) btn_event_washing.gameObject.SetActive(true);
|
||
break;
|
||
}
|
||
break;
|
||
case 5:
|
||
switch (data.subType)
|
||
{
|
||
case 1:
|
||
btn_fishingduel.SetActive(true);
|
||
break;
|
||
}
|
||
break;
|
||
case 9:
|
||
switch (data.subType)
|
||
{
|
||
case 4:
|
||
btn_chainschest.gameObject.SetActive(true);
|
||
break;
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
void CollectingTargetNext()
|
||
{
|
||
var collectingTarget = _fishingEventData.collectingTarget;
|
||
if (collectingTarget != null)
|
||
{
|
||
homeGift.InitCollectingTarget();
|
||
SetEndTime();
|
||
MiddlePanel.gameObject.SetActive(true);
|
||
homeBubbleTask.CollectingTargetNext();
|
||
}
|
||
else
|
||
{
|
||
ctTimer = null;
|
||
MiddlePanel.gameObject.SetActive(false);
|
||
homeGift.HideTarget();
|
||
}
|
||
}
|
||
|
||
async void PlayGoldAddAnim(Vector3 startPos)
|
||
{
|
||
if (addGlodCount > 1)
|
||
{
|
||
int addGold = addGlodCount;
|
||
addGlodCount = 0;
|
||
|
||
top_area.text_gold.text = ConvertTools.GetNumberString2(top_area.curGold);
|
||
//飞上去
|
||
await GetRewardFly(1002, startPos, addGold);
|
||
}
|
||
}
|
||
void PlayEnergyAdd(int addCount, Vector3 startPos)
|
||
{
|
||
GetRewardFly(1001, startPos, addCount);
|
||
}
|
||
void EventTargetAdd(int id, int curCount, int addCount, bool isFly, Vector3 startPos)
|
||
{
|
||
if (id == 1002)
|
||
{
|
||
addGlodCount = addCount;
|
||
PlayGoldAddAnim(startPos);
|
||
}
|
||
else if (id == 1001)
|
||
{
|
||
PlayEnergyAdd(addCount, startPos);
|
||
}
|
||
else if (_fishingEventData.collectingTarget != null && id == _fishingEventData.collectingTargetInitTokenID)
|
||
{
|
||
PlayEventTargetAdd(id, curCount, addCount, isFly, startPos);
|
||
}
|
||
else if (_fishingEventData.rankInit != null && id == _fishingEventData.rankInit.TokenID)
|
||
{
|
||
PlayEventRankTargetAdd(id, curCount, addCount, startPos);
|
||
}
|
||
//存钱罐
|
||
else if (id == GContext.container.Resolve<PiggyBankPackData>().EventItemId)
|
||
{
|
||
PiggyBankPackAdd(id, curCount, addCount, startPos);
|
||
}
|
||
//砍一刀
|
||
else if (id == GContext.container.Resolve<BargainPackData>().EventItemId)
|
||
{
|
||
BargainPackPack(id, curCount, addCount, startPos);
|
||
}
|
||
else if (id == GContext.container.Resolve<FishingChallengeManager>().EventItemId)
|
||
{
|
||
//GetRewardFly(id, startPos, addCount);
|
||
FishingChallengeAdd(id, addCount, startPos);
|
||
}
|
||
}
|
||
|
||
|
||
|
||
void ShowItemCount(List<TargetAddData> itemDatas)
|
||
{
|
||
if (itemDatas != null)
|
||
{
|
||
for (int i = 0; i < itemDatas.Count; i++)
|
||
{
|
||
ShowItemCount(itemDatas[i]);
|
||
}
|
||
}
|
||
}
|
||
|
||
void ShowItemCount(TargetAddData itemDatas)
|
||
{
|
||
|
||
if (itemDatas.id == 1001)
|
||
{
|
||
Energy = Energy - (int)itemDatas.addCount;
|
||
if (Energy < 0)
|
||
{
|
||
Energy = 0;
|
||
}
|
||
}
|
||
else if (itemDatas.id == 1002)
|
||
{
|
||
ulong curGold = (ulong)itemDatas.addCount;
|
||
if (top_area.curGold > curGold)
|
||
{
|
||
top_area.curGold -= curGold;
|
||
top_area.text_gold.text = ConvertTools.GetNumberString2(top_area.curGold);
|
||
}
|
||
}
|
||
else if (_fishingEventData.collectingTarget != null && itemDatas.id == _fishingEventData.collectingTargetInitTokenID)
|
||
{
|
||
CollectingTargetReward collectingTarget = _fishingEventData.collectingTarget;
|
||
float curCount = itemDatas.curCount;
|
||
if (_fishingEventData.preCollectingTarget != null)
|
||
{
|
||
collectingTarget = _fishingEventData.preCollectingTarget.Peek();
|
||
List<ItemData> itemData = GContext.container.Resolve<PlayerItemData>().GetItemDataByDropId(collectingTarget.DropID);
|
||
if (itemData is { Count: > 0 })
|
||
{
|
||
homeBubbleTask.SetCollectingTargetRewardIcon(itemData);
|
||
}
|
||
}
|
||
homeBubbleTask.bar.fillAmount = curCount / (float)collectingTarget.TokenRequired;
|
||
homeBubbleTask.text_progress.text = $"{curCount}/{collectingTarget.TokenRequired}";
|
||
}
|
||
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// 主界面的钱、体力等显示未添加之前的
|
||
/// </summary>
|
||
/// <param name="itemDatas"></param>
|
||
void ShowItemCount(List<ItemData> itemDatas)
|
||
{
|
||
if (itemDatas != null)
|
||
{
|
||
for (int i = 0; i < itemDatas.Count; i++)
|
||
{
|
||
if (itemDatas[i].id == 1001)
|
||
{
|
||
Energy = Energy - (int)itemDatas[i].count;
|
||
if (Energy < 0)
|
||
{
|
||
Energy = 0;
|
||
}
|
||
}
|
||
else if (itemDatas[i].id == 1002)
|
||
{
|
||
ulong curGold = (ulong)itemDatas[i].count;
|
||
if (top_area.curGold > curGold)
|
||
{
|
||
top_area.curGold -= curGold;
|
||
top_area.text_gold.text = ConvertTools.GetNumberString2(top_area.curGold);
|
||
}
|
||
}
|
||
itemDatas[i].curCount = (ulong)(GContext.container.Resolve<PlayerItemData>().GetItemCount(itemDatas[i].id) - itemDatas[i].count);
|
||
}
|
||
}
|
||
}
|
||
async void PlayEventTargetAdd(int id, int curCount, int addCount, bool isFly, Vector3 startPos)
|
||
{
|
||
//Vector3 startPos = fishingData.image_extra_pos;
|
||
_fishingEventData.targetItemDatas = null;
|
||
CollectingTargetReward collectingTarget = _fishingEventData.collectingTarget;
|
||
if (collectingTarget != null && _fishingEventData.collectingTargetInitTokenID == id)
|
||
{
|
||
int endCount = _fishingEventData.GetCurCollectingTarget();
|
||
if (endCount >= collectingTarget.TokenRequired && _fishingEventData.preCollectingTarget == null)
|
||
{
|
||
btn_mask.gameObject.SetActive(false);
|
||
GContext.Publish(new ShowData());
|
||
return;
|
||
}
|
||
|
||
if (_fishingEventData.preCollectingTarget != null)
|
||
{
|
||
collectingTarget = _fishingEventData.preCollectingTarget.Peek();
|
||
List<ItemData> itemData = GContext.container.Resolve<PlayerItemData>().GetItemDataByDropId(collectingTarget.DropID);
|
||
if (itemData is { Count: > 0 })
|
||
{
|
||
homeBubbleTask.SetCollectingTargetRewardIcon(itemData);
|
||
}
|
||
}
|
||
|
||
homeBubbleTask.bar.fillAmount = curCount / (float)collectingTarget.TokenRequired;
|
||
homeBubbleTask.text_progress.text = $"{curCount}/{collectingTarget.TokenRequired}";
|
||
//飞上去
|
||
if (isFly)
|
||
{
|
||
await GetRewardFly(id, startPos, addCount);
|
||
}
|
||
if (_fishingEventData.preCollectingTarget != null)
|
||
{
|
||
collectingTarget = _fishingEventData.preCollectingTarget.Dequeue();
|
||
endCount = collectingTarget.TokenRequired;
|
||
}
|
||
else
|
||
{
|
||
if (btn_mask != null)
|
||
{
|
||
btn_mask.gameObject.SetActive(false);
|
||
}
|
||
GContext.Publish(new ShowData());
|
||
}
|
||
homeBubbleTask.PlayEventTargetAdd(collectingTarget, curCount, endCount);
|
||
}
|
||
else
|
||
{
|
||
GContext.Publish(new ShowData());
|
||
btn_mask.gameObject.SetActive(false);
|
||
_fishingEventData.preCollectingTarget = null;
|
||
CollectingTargetNext();
|
||
}
|
||
}
|
||
async void PlayEventRankTargetAdd(int id, int curCount, int addCount, Vector3 startPos)
|
||
{
|
||
//Vector3 startPos = GContext.container.Resolve<SmallGameData>().image_extra_pos;
|
||
rankTarget = _fishingEventData.rankTarget;
|
||
bool isUp = _fishingEventData.preRankTarget != null;
|
||
_fishingEventData.rankItemDatas = null;
|
||
if (rankTarget != null && _fishingEventData.rankInit.TokenID == id)
|
||
{
|
||
//飞上去
|
||
await GetRewardFly(id, startPos, addCount);
|
||
if (homeBtnRank == null)
|
||
{
|
||
return;
|
||
}
|
||
homeBtnRank.Init(curCount);
|
||
if (!isUp)
|
||
{
|
||
btn_mask.gameObject.SetActive(false);
|
||
GContext.Publish(new ShowData());
|
||
}
|
||
}
|
||
}
|
||
async void PiggyBankPackAdd(int id, int curCount, int addCount, Vector3 startPos)
|
||
{
|
||
PiggyBankPackData bargainPackData = GContext.container.Resolve<PiggyBankPackData>();
|
||
packDataProgress |= bargainPackData.IsFull;
|
||
if (bargainPackData.IsFull)
|
||
{
|
||
mask.SetActive(true);
|
||
}
|
||
PiggyBankProgressEvent piggyBankProgressEvent = new PiggyBankProgressEvent();
|
||
piggyBankProgressEvent.addProgress = addCount;
|
||
piggyBankProgressEvent.type = 0;
|
||
await Awaiters.NextFrame;
|
||
if (bargainPackData.IsFull)
|
||
{
|
||
mask.SetActive(true);
|
||
}
|
||
GContext.Publish(piggyBankProgressEvent);
|
||
//飞上去
|
||
await GetRewardFly(id, startPos, addCount);
|
||
piggyBankProgressEvent.type = 1;
|
||
GContext.Publish(piggyBankProgressEvent);
|
||
if (bargainPackData.IsFull)
|
||
{
|
||
await Awaiters.Seconds(0.5f);
|
||
if (packDataProgress)
|
||
{
|
||
packDataProgress = false;
|
||
OnNoReward();
|
||
}
|
||
}
|
||
packDataProgress = false;
|
||
if (mask != null)
|
||
{
|
||
mask.SetActive(false);
|
||
}
|
||
}
|
||
bool packDataProgress = false;
|
||
async void BargainPackPack(int id, int curCount, int addCount, Vector3 startPos)
|
||
{
|
||
BargainPackData bargainPackData = GContext.container.Resolve<BargainPackData>();
|
||
packDataProgress |= bargainPackData.IsFull;
|
||
if (bargainPackData.IsFull)
|
||
{
|
||
mask.SetActive(true);
|
||
}
|
||
BargainPackProgressEvent piggyBankProgressEvent = new BargainPackProgressEvent();
|
||
piggyBankProgressEvent.addProgress = addCount;
|
||
piggyBankProgressEvent.type = 0;
|
||
await Awaiters.NextFrame;
|
||
if (bargainPackData.IsFull)
|
||
{
|
||
mask.SetActive(true);
|
||
}
|
||
GContext.Publish(piggyBankProgressEvent);
|
||
//飞上去
|
||
await GetRewardFly(id, startPos, addCount);
|
||
piggyBankProgressEvent.type = 1;
|
||
GContext.Publish(piggyBankProgressEvent);
|
||
if (bargainPackData.IsFull)
|
||
{
|
||
await Awaiters.Seconds(0.5f);
|
||
if (packDataProgress)
|
||
{
|
||
packDataProgress = false;
|
||
OnNoReward();
|
||
}
|
||
}
|
||
packDataProgress = false;
|
||
if (mask != null)
|
||
{
|
||
mask.SetActive(false);
|
||
}
|
||
}
|
||
|
||
private async void FishingChallengeAdd(int id, int addCount, Vector3 startPos)
|
||
{
|
||
await GetRewardFly(id, startPos, addCount);
|
||
|
||
GContext.Publish(new FishingChallengeAddEvent());
|
||
}
|
||
|
||
//获得奖励UI向上飞的方法
|
||
public async System.Threading.Tasks.Task GetRewardFly(int id, Vector3 startPos, int addCount)
|
||
{
|
||
if (imageQueue.Count == 0)
|
||
{
|
||
AddRewardFlyItem();
|
||
}
|
||
RewardItemNew rewardNew = imageQueue.Dequeue();
|
||
rewardNew.transform.localScale = Vector3.one;
|
||
rewardNew.transform.position = startPos;
|
||
rewardNew.gameObject.SetActive(true);
|
||
rewardNew.SetRewardPopupData(new ItemData() { count = addCount, id = id }, false);
|
||
rewardNew.PlayOpen();
|
||
await Awaiters.Seconds(0.4f);
|
||
if (rewardNew == null)
|
||
{
|
||
return;
|
||
}
|
||
await rewardNew.PlayClose();
|
||
await rewardNew.ParticleAttractor();
|
||
if (rewardNew == null)
|
||
{
|
||
return;
|
||
}
|
||
rewardNew.gameObject.SetActive(false);
|
||
imageQueue.Enqueue(rewardNew);
|
||
}
|
||
|
||
public void AddRewardFlyItem()
|
||
{
|
||
for (int i = 0; i < 2; i++)
|
||
{
|
||
GameObject go = Instantiate(rewardItemPrefab.gameObject, rewardFlyPanel, true);
|
||
go.SetActive(false);
|
||
RewardItemNew reward = go.GetComponent<RewardItemNew>();
|
||
imageQueue.Enqueue(reward);
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 没有Buff需要播放或播放完,并且没有体力不足等一系列弹窗,才自动跳转到挑战面板
|
||
/// </summary>
|
||
void IsAutoOpenChallangePanel()
|
||
{
|
||
//if (GContext.container.Resolve<PlayerData>().GetCanMagnification())
|
||
// GContext.container.Resolve<FishingChallengeCenter>().IsAutoOpenPanel();
|
||
}
|
||
//触发目标奖励活动Buff
|
||
async Task AddTargetBuff()
|
||
{
|
||
mask.SetActive(true);
|
||
|
||
fishingData.isAwaitTargetBuff = false;
|
||
await Awaiters.Seconds(3.5f);
|
||
mask.SetActive(false);
|
||
}
|
||
|
||
public void OnDisable()
|
||
{
|
||
if (RewardFlyPanel != null)
|
||
{
|
||
Destroy(RewardFlyPanel);
|
||
}
|
||
disposable?.Dispose();
|
||
disposable = null;
|
||
fishingData.isAddTargetBuff = false;
|
||
fishingData.isAddPiggyBank = false;
|
||
fishingData.isAddBarginPack = false;
|
||
fishingData.isShowTargetPanel = false;
|
||
fishingData.isAwaitTargetBuff = false;
|
||
fishingStage.q_TargetAddData.Clear();
|
||
_fishingEventData.preCollectingTarget = null;
|
||
if (!isFishingPanel)
|
||
{
|
||
GContext.Publish(new MapShowEvent() { isShow = false });
|
||
}
|
||
}
|
||
|
||
private void UpdateTurntableTimer(long _ = 0L)
|
||
{
|
||
DateTime endTime = _fishingEventData.GetTurntableEndTime();
|
||
TimeSpan remainingTime = endTime - ZZTimeHelper.UtcNow().UtcNowOffset();
|
||
text_turntable_time.text = ConvertTools.ConvertTime2(remainingTime);
|
||
if (remainingTime.TotalSeconds <= 0)
|
||
HideTurntableEntranceBtn();
|
||
}
|
||
|
||
private void HideTurntableEntranceBtn()
|
||
{
|
||
if (btn_turntable != null)
|
||
btn_turntable.gameObject.SetActive(false);
|
||
}
|
||
|
||
private void InitTurnTableTimer()
|
||
{
|
||
UpdateTurntableTimer();
|
||
Observable.Interval(TimeSpan.FromSeconds(1f)).Subscribe(UpdateTurntableTimer).AddTo(this);
|
||
}
|
||
}
|