922 lines
30 KiB
C#
922 lines
30 KiB
C#
using asap.core;
|
|
using cfg;
|
|
using DG.Tweening;
|
|
using Game;
|
|
using GameCore;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UniRx;
|
|
using UnityEngine;
|
|
using UnityEngine.AddressableAssets;
|
|
using UnityEngine.EventSystems;
|
|
using UnityEngine.UI;
|
|
public class StopAutoEvent
|
|
{
|
|
public bool IsDrawing;
|
|
}
|
|
public class FishingPanel_Advanced : MonoBehaviour
|
|
{
|
|
public static FishingPanel_Advanced Instance { get; private set; }
|
|
//private GameObject fx_fishing_maxcomboprefab;
|
|
//CanvasGroup MaxComboTip;
|
|
//CanvasGroup MaxComboFx;
|
|
GameObject MaxComboTip;
|
|
GameObject MaxComboFx;
|
|
GameObject btn_draw_combo_down;
|
|
GameObject btn_draw_combo_top;
|
|
GameObject btn_up;
|
|
private Animator _btnAnimator;
|
|
private Animator _sliderAnimator;
|
|
private Animator _sliderAnimator2;
|
|
private CanvasGroup _canvasGroup;
|
|
[HideInInspector]
|
|
public LongPressOrClickEventTrigger drawButton;
|
|
TMP_Text text_play;
|
|
private GameObject _rank_info;
|
|
private GameObject _rank_info1;
|
|
private GameObject _rank_info2;
|
|
GameObject FX_info_combo;
|
|
GameObject FX_info_warning_1;
|
|
GameObject FX_info_warning_2;
|
|
GameObject FX_info_warning_3;
|
|
|
|
FishingPanelDrawAuto btn_draw_auto;
|
|
bool AutomaticFishing;
|
|
|
|
FishingFishInfo fishInfo;
|
|
FishingStart fishingStart;
|
|
FishingBlood fishBlood;
|
|
PiercingInfo piercingInfo;
|
|
float WarningLineLengthRatio = 0.8f;
|
|
List<GameObject> PiercingSuccessFx;
|
|
List<GameObject> PiercingSuccess;
|
|
List<GameObject> MaxComboFxs;
|
|
bool isOpenPiercing = false;
|
|
float maxComboTipFadeTime = 0.5f;
|
|
float maxComboFxFadeTime = 2f;
|
|
string curFishShakeIdle;
|
|
FishingData fishingData;
|
|
FishingUpdateSys fishingUpdateSys;
|
|
RodSkinData rodSkinData;
|
|
/// <summary>
|
|
/// 特殊技能相关
|
|
/// </summary>
|
|
Transform fx_target_bar_bg;
|
|
Image bar_target;
|
|
Transform fx_target_bar;
|
|
|
|
Transform highlight_target;
|
|
Image highlight;
|
|
Transform fx_target_bar_highlight;
|
|
|
|
Transform barFx;
|
|
Transform bloodBossFx;
|
|
Perk perk;
|
|
GameObject perk_go;
|
|
|
|
protected CompositeDisposable disposables = new CompositeDisposable();
|
|
public bool IsDown()
|
|
{
|
|
if (EventSystem.current == null)
|
|
{
|
|
return false;
|
|
}
|
|
PointerEventData pointerEventData = new PointerEventData(EventSystem.current)
|
|
{
|
|
position = Input.mousePosition
|
|
};
|
|
|
|
List<RaycastResult> results = new List<RaycastResult>();
|
|
EventSystem.current.RaycastAll(pointerEventData, results);
|
|
foreach (RaycastResult result in results)
|
|
{
|
|
if (result.gameObject == drawButton.gameObject)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
private void Awake()
|
|
{
|
|
Instance = this;
|
|
transform.SetAsFirstSibling();
|
|
fishingUpdateSys = gameObject.AddComponent<FishingUpdateSys>();
|
|
fishingData = GContext.container.Resolve<FishingData>();
|
|
if (fishingData.IsDuel)
|
|
{
|
|
var fishingDuelManager = GContext.container.Resolve<FishingDuelManager>();
|
|
if (fishingDuelManager != null)
|
|
{
|
|
fishingDuelManager.OnFishingChangeStateEvent(FishingChangeState.Cast, fishingData.fishItem.ID);
|
|
}
|
|
}
|
|
int skindID = GContext.container.Resolve<PlayerFishData>().GetRodSkin(fishingData.RodId);
|
|
rodSkinData = GContext.container.Resolve<Tables>().TbRodSkinData.GetOrDefault(skindID);
|
|
isOpenPiercing = GContext.container.Resolve<PlayerFishData>().IsOpenPiercing;
|
|
GContext.OnEvent<StopAutoEvent>().Subscribe(StopAuto).AddTo(disposables);
|
|
GContext.OnEvent<HideUI>().Subscribe(HideUI).AddTo(disposables);
|
|
|
|
_canvasGroup = GetComponent<CanvasGroup>();
|
|
//换按钮
|
|
btn_draw_combo_down = transform.Find("safearea/middlepanel/btn_draw/btn_draw_combo_down").gameObject;
|
|
btn_draw_combo_top = transform.Find("safearea/middlepanel/btn_draw/btn_draw_combo_top").gameObject;
|
|
text_play = transform.Find("safearea/middlepanel/btn_draw/text_play").GetComponent<TMP_Text>();
|
|
drawButton = transform.Find("safearea/middlepanel/btn_draw").GetComponent<LongPressOrClickEventTrigger>();
|
|
btn_up = transform.Find("safearea/middlepanel/btn_draw/up").gameObject;
|
|
//换按钮
|
|
drawButton.onLongPress.AddListener((() => { SetBtnAnimatorState(BtnAnimatorState.Pressed); }));
|
|
drawButton.onUp.AddListener(OnUpButton);
|
|
drawButton.onDown.AddListener(OnClickButton);
|
|
|
|
drawButton.gameObject.SetActive(false);
|
|
_btnAnimator = drawButton.GetComponent<Animator>();
|
|
_sliderAnimator = drawButton.transform.Find("slider").GetComponent<Animator>();
|
|
_sliderAnimator2 = transform.Find("fish_info/combo/barRoot/icon").GetComponent<Animator>();
|
|
|
|
_rank_info = transform.Find("close_up/FX_info").gameObject;
|
|
_rank_info1 = transform.Find("close_up/FX_info1").gameObject;
|
|
_rank_info2 = transform.Find("close_up/FX_info2").gameObject;
|
|
btn_draw_auto = transform.Find("safearea/middlepanel/btn_draw_auto").GetComponent<FishingPanelDrawAuto>();
|
|
|
|
FX_info_combo = transform.Find("tips/FX_info_combo").gameObject;
|
|
FX_info_warning_1 = transform.Find("tips/FX_info_warning_1").gameObject;
|
|
FX_info_warning_2 = transform.Find("tips/FX_info_warning_2").gameObject;
|
|
FX_info_warning_3 = transform.Find("tips/FX_info_warning_3").gameObject;
|
|
|
|
fx_target_bar_bg = transform.Find("fish_info/combo/barRoot/fx_target_bar_bg").transform;
|
|
fx_target_bar = transform.Find("fish_info/combo/barRoot/bar_target/fx_target_bar").transform;
|
|
bar_target = transform.Find("fish_info/combo/barRoot/bar_target").GetComponent<Image>();
|
|
highlight_target = transform.Find("fish_info/combo/barRoot/highlight_target").transform;
|
|
highlight = transform.Find("fish_info/combo/barRoot/highlight_target/highlight").GetComponent<Image>();
|
|
fx_target_bar_highlight = transform.Find("fish_info/combo/barRoot/highlight_target/fx_target_bar_highlight").transform;
|
|
barFx = transform.Find("fish_info/combo/barRoot/fx_ui_lightning").transform;
|
|
bloodBossFx = transform.Find("fish_info/blood/icon_fish_boss/fx").transform;
|
|
//MaxComboTip = transform.Find("tips/MaxComboTip").GetComponent<CanvasGroup>();
|
|
//MaxComboFx = transform.Find("tips/MaxComboFx").GetComponent<CanvasGroup>();
|
|
fishInfo = transform.Find("fish_info").GetComponent<FishingFishInfo>();
|
|
fishInfo.InitPanel(fishingUpdateSys);
|
|
fishInfo.gameObject.SetActive(false);
|
|
fishingStart = fishInfo.transform.Find("start").GetComponent<FishingStart>();
|
|
fishBlood = fishInfo.transform.Find("blood").GetComponent<FishingBlood>();
|
|
fishBlood.Init();
|
|
piercingInfo = transform.Find("piercing_info").GetComponent<PiercingInfo>();
|
|
piercingInfo.gameObject.SetActive(false);
|
|
if (isOpenPiercing)
|
|
{
|
|
LoadFx();
|
|
}
|
|
maxComboTipFadeTime = fishingData.fishingBehaviorConf.maxComboTipFadeTime;
|
|
maxComboFxFadeTime = fishingData.fishingBehaviorConf.maxComboFxFadeTime;
|
|
perk_go = transform.Find("perk_info/perk_info_1").gameObject;
|
|
perk_go.SetActive(false);
|
|
perk = perk_go.transform.Find("perk").GetComponent<Perk>();
|
|
GContext.OnEvent<RodPerkTriggerEvent>().Subscribe(OnRodPerkTriggerEvent).AddTo(disposables);
|
|
}
|
|
void OnRodPerkTriggerEvent(RodPerkTriggerEvent rodPerkTriggerEvent)
|
|
{
|
|
Debug.Log("OnRodPerkTriggerEvent" + rodPerkTriggerEvent.PerkID + " " + rodPerkTriggerEvent.level);
|
|
perk_go.SetActive(false);
|
|
perk_go.SetActive(true);
|
|
|
|
perk.SetData(rodPerkTriggerEvent.PerkID, rodPerkTriggerEvent.level, fishingData.fishRodData.Quality);
|
|
}
|
|
async void LoadFx()
|
|
{
|
|
var fxNames = rodSkinData.PiercingSuccessFx;
|
|
PiercingSuccessFx = new List<GameObject>();
|
|
PiercingSuccess = new List<GameObject>();
|
|
Transform parent = Camera.main.transform;
|
|
for (int i = 0; i < fxNames.Count; i++)
|
|
{
|
|
var go = await Addressables.LoadAssetAsync<GameObject>(fxNames[i]).Task;
|
|
if (go != null && Instance != null)
|
|
{
|
|
var fx = Instantiate(go, parent);
|
|
fx.SetActive(false);
|
|
//fx.transform.localPosition = Vector3.down * 650;
|
|
PiercingSuccessFx.Add(fx);
|
|
PiercingSuccess.Add(go);
|
|
}
|
|
}
|
|
MaxComboFxs = new List<GameObject>();
|
|
var MaxComboFxParent1 = await Addressables.LoadAssetAsync<GameObject>(rodSkinData.MaxComboFx).Task;
|
|
if (MaxComboFxParent1 != null)
|
|
MaxComboFxs.Add(MaxComboFxParent1);
|
|
var MaxComboParentTip1 = await Addressables.LoadAssetAsync<GameObject>(rodSkinData.MaxComboTip).Task;
|
|
if (MaxComboParentTip1 != null)
|
|
MaxComboFxs.Add(MaxComboParentTip1);
|
|
if (Instance != null)
|
|
{
|
|
if (MaxComboFxParent1 != null)
|
|
MaxComboFx = Instantiate(MaxComboFxParent1, parent);
|
|
if (MaxComboParentTip1 != null)
|
|
MaxComboTip = Instantiate(MaxComboParentTip1, parent);
|
|
MaxComboTip?.SetActive(false);
|
|
MaxComboFx?.SetActive(false);
|
|
}
|
|
}
|
|
void OnUpButton()
|
|
{
|
|
SetBtnAnimatorState(BtnAnimatorState.Normal);
|
|
}
|
|
|
|
|
|
void OnClickButton()
|
|
{
|
|
SetBtnAnimatorState(BtnAnimatorState.Clicked);
|
|
if (fishingData.IsDrawing)
|
|
{
|
|
OnClickSkill();
|
|
return;
|
|
}
|
|
if (isOpenPiercing)
|
|
{
|
|
if (fishingStart.curIndex != -1)
|
|
{
|
|
StopAllCoroutines();
|
|
fishingStart.StopMove();
|
|
PiercingInfo(fishingStart.GetCurPos());
|
|
}
|
|
}
|
|
else
|
|
{
|
|
GContext.Publish(new EventUISound("audio_fishing_piercing_noviceguide"));
|
|
fishingUpdateSys.PiercingFish(100);
|
|
}
|
|
}
|
|
public void SetFishIconDir(bool left)
|
|
{
|
|
fishBlood.SetFishIconDir(left);
|
|
}
|
|
void PiercingInfo(int index)
|
|
{
|
|
fishingUpdateSys.PiercingFish(index);
|
|
piercingInfo.gameObject.SetActive(true);
|
|
piercingInfo.Show(index);
|
|
|
|
if (index > 0 && index <= PiercingSuccessFx.Count)
|
|
{
|
|
PiercingSuccessFx[index - 1].SetActive(true);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 新手引导专用
|
|
/// </summary>
|
|
/// <param name="hideUI"></param>
|
|
void HideUI(HideUI hideUI)
|
|
{
|
|
_canvasGroup.alpha = hideUI.hide ? 0 : 1;
|
|
_canvasGroup.blocksRaycasts = !hideUI.hide;
|
|
}
|
|
|
|
void StopAuto(StopAutoEvent IsDrawing)
|
|
{
|
|
AutomaticFishing = false;
|
|
btn_draw_auto.gameObject.SetActive(false);
|
|
if (IsDrawing.IsDrawing)
|
|
{
|
|
ShowTensionBar();
|
|
drawButton.gameObject.SetActive(true);
|
|
}
|
|
}
|
|
//设置动画状态
|
|
public void SetBtnAnimatorState(BtnAnimatorState state)
|
|
{
|
|
string nameAni = "Normal1";
|
|
string nameAni2 = "Normal1";
|
|
_btnAnimator.SetBool("Normal1", false);
|
|
_btnAnimator.SetBool("Clicked1", false);
|
|
_btnAnimator.SetBool("Pressed1", false);
|
|
_sliderAnimator.SetBool("Normal1", false);
|
|
_sliderAnimator.SetBool("Pressed1", false);
|
|
_sliderAnimator2.SetBool("Normal1", false);
|
|
_sliderAnimator2.SetBool("Pressed1", false);
|
|
switch (state)
|
|
{
|
|
case BtnAnimatorState.Pressed:
|
|
nameAni = "Pressed1";
|
|
nameAni2 = "Pressed1";
|
|
break;
|
|
case BtnAnimatorState.Clicked:
|
|
nameAni = "Clicked1";
|
|
nameAni2 = "Pressed1";
|
|
break;
|
|
}
|
|
|
|
_btnAnimator.SetTrigger(nameAni);
|
|
_sliderAnimator.SetTrigger(nameAni2);
|
|
_sliderAnimator2.SetTrigger(nameAni2);
|
|
}
|
|
|
|
public void OnEnable()
|
|
{
|
|
DoEnable();
|
|
GContext.Publish(new OnSoundStateEvent(1));
|
|
text_play.text = LocalizationMgr.GetText("UI_FishingPanel_Advanced_101021");
|
|
WarningLineLengthRatio = GContext.container.Resolve<Tables>().TbGlobalConfig.WarningLineLengthRatio;
|
|
}
|
|
|
|
private void DoEnable()
|
|
{
|
|
//AutomaticFishing = GContext.container.Resolve<PlayerFishData>().AutomaticFishing;
|
|
|
|
_rank_info.gameObject.SetActive(false);
|
|
_rank_info1.gameObject.SetActive(false);
|
|
_rank_info2.gameObject.SetActive(false);
|
|
drawButton.durationThreshold = fishingData.fishRodData.HoldThreshold;
|
|
|
|
//_comboInfoText.text = "";
|
|
_canvasGroup.alpha = DeBugPanel.isShow ? 1 : 0;
|
|
btn_draw_auto.gameObject.SetActive(AutomaticFishing);
|
|
//MaxComboTip.alpha = 0;
|
|
//MaxComboFx.alpha = 0;
|
|
}
|
|
void SetBoosFish()
|
|
{
|
|
fishBlood.FXInfoInit();
|
|
bool isBoos = fishBlood.ShowFishBossIcon(fishingData.curFishData.BattleAvatar);
|
|
if (!string.IsNullOrEmpty(curFishShakeIdle))
|
|
{
|
|
PlayBarAni(curFishShakeIdle, false);
|
|
}
|
|
curFishShakeIdle = fishingData.curFishData.ShakeIdle;
|
|
if (!string.IsNullOrEmpty(curFishShakeIdle))
|
|
{
|
|
PlayBarAni(curFishShakeIdle, true);
|
|
}
|
|
}
|
|
void ShowFishBlood()
|
|
{
|
|
SetBoosFish();
|
|
fishInfo.ShowState(1);
|
|
}
|
|
//UI吃鱼
|
|
public void UIEatFish()
|
|
{
|
|
//只显示鱼嘴和距离/播放mouse动画
|
|
fishBlood.SetFishHPScale(1);
|
|
}
|
|
public void UIEatFishEnd()
|
|
{
|
|
////开始Boos鱼的一些列相关
|
|
//SetBoosFish();
|
|
//换鱼显示节点
|
|
ShowFishBlood();
|
|
}
|
|
//完美刺鱼
|
|
public async void ExtraDrawingHP(float extraDrawingHP, int waitingZone, float fishHPScale, float damageProtectionTime, bool isEternalDeath)
|
|
{
|
|
text_play.text = LocalizationMgr.GetText("UI_FishingPanel_Advanced_101004");
|
|
fishInfo.ShowState(-1);
|
|
fishBlood.SetFishHPScale(fishHPScale);
|
|
piercingInfo.textBlood[waitingZone - 1].text = extraDrawingHP.ToString("-0");
|
|
if (isEternalDeath)
|
|
{
|
|
HideDrawButton();
|
|
return;
|
|
}
|
|
await new WaitForSeconds(damageProtectionTime);
|
|
if (Instance != null)
|
|
{
|
|
ShowTensionBar();
|
|
fishBlood.WhiteDOFillAmount(fishHPScale);
|
|
fishingUpdateSys.UIEatCheck();
|
|
}
|
|
}
|
|
public async void StartDrawing(float damageProtectionTime)
|
|
{
|
|
text_play.text = LocalizationMgr.GetText("UI_FishingPanel_Advanced_101004");
|
|
fishInfo.ShowState(-1);
|
|
fishBlood.SetFishHPScale(1);
|
|
await new WaitForSeconds(damageProtectionTime);
|
|
if (Instance != null)
|
|
{
|
|
ShowTensionBar();
|
|
}
|
|
}
|
|
//动画吃鱼结束 重置UI
|
|
public void OnEatEnd()
|
|
{
|
|
SetBoosFish();
|
|
btn_up.SetActive(false);
|
|
fishInfo.fx_ui_barlianji_full.SetActive(false);
|
|
//MaxComboTip.alpha = 0;
|
|
MaxComboTip?.SetActive(false);
|
|
ShowTensionBar();
|
|
drawButton.gameObject.SetActive(true);
|
|
fishInfo.gameObject.SetActive(true);
|
|
}
|
|
//鱼脱钩了
|
|
public void FishEscape()
|
|
{
|
|
fishInfo.ShowState(-1);
|
|
HideDrawButton();
|
|
//await new WaitForSeconds(2f);
|
|
//ShowDrawButton();
|
|
}
|
|
void ShowTensionBar()
|
|
{
|
|
if (PiercingSuccessFx != null && PiercingSuccessFx.Count > 0)
|
|
{
|
|
for (int i = 0; i < PiercingSuccessFx.Count; i++)
|
|
{
|
|
PiercingSuccessFx[i].SetActive(false);
|
|
}
|
|
}
|
|
fishInfo.ShowTensionBar();
|
|
fishInfo.SetTensionBarScale(fishingUpdateSys.ComboZone);
|
|
ShowFishBlood();
|
|
}
|
|
public void PlayBarAni(string aniName, bool isShake)
|
|
{
|
|
float barShakeAmp = fishingUpdateSys.GetBarShakeAmp();
|
|
fishInfo.PlayBarAni(aniName, isShake, barShakeAmp);
|
|
}
|
|
public void SetTensionBarScale(float ComboZone)
|
|
{
|
|
fishInfo.SetTensionBarScale(ComboZone);
|
|
}
|
|
public void UpdateTensionBar(int type, float power, float fishSwimAreaZFar, float fishSwimAreaZNear, float linelength)
|
|
{
|
|
fishInfo.OnDrawFishingLine(fishSwimAreaZFar, fishSwimAreaZNear, linelength, fishingData.MaxLinelength, WarningLineLengthRatio);
|
|
fishInfo.UpdateTensionBar(type, power);
|
|
}
|
|
|
|
|
|
public void UpdateComboMultiplayer(float _curComboMultiplayer, bool isMaxZone)
|
|
{
|
|
// 全力收线按钮
|
|
if (btn_up != null)
|
|
{
|
|
btn_up.SetActive(isMaxZone);
|
|
}
|
|
fishInfo.fx_ui_barlianji_full.SetActive(isMaxZone);
|
|
fishInfo.UpdateComboMultiplayer(_curComboMultiplayer);
|
|
}
|
|
public void ShowComboTips(bool isShow)
|
|
{
|
|
fishInfo.ShowComboTips(isShow);
|
|
}
|
|
Transform finger;
|
|
public void ShowFinger()
|
|
{
|
|
if (GuidancePanel.Instance)
|
|
{
|
|
var go = GuidancePanel.Instance.finger;
|
|
finger = Instantiate(go, drawButton.transform);
|
|
finger.localPosition = new Vector3(0, 0, 0);
|
|
finger.gameObject.SetActive(true);
|
|
finger.GetComponent<Animator>().Play("finger_loop2");
|
|
}
|
|
}
|
|
public void HideFinger()
|
|
{
|
|
if (finger)
|
|
{
|
|
Destroy(finger.gameObject);
|
|
finger = null;
|
|
}
|
|
}
|
|
public void ShowFishInfo(int text, float fishHPScale, bool isCombo, bool crit)
|
|
{
|
|
fishBlood.ShowFishInfo(text, fishHPScale, isCombo, crit);
|
|
}
|
|
|
|
public void ShowFishInfoPos(Vector3 bobber)
|
|
{
|
|
fishInfo.ShowFishInfoPos(bobber);
|
|
}
|
|
public void HideFishInfo()
|
|
{
|
|
fishInfo.gameObject.SetActive(false);
|
|
//MaxComboFx.alpha = 0;
|
|
//MaxComboTip.alpha = 0;
|
|
MaxComboTip?.SetActive(false);
|
|
MaxComboFx?.SetActive(false);
|
|
btn_draw_combo_down.SetActive(false);
|
|
btn_draw_combo_top.SetActive(false);
|
|
}
|
|
|
|
public void ShowDrawButton()
|
|
{
|
|
if (AutomaticFishing)
|
|
{
|
|
PiercingInfo(1);
|
|
btn_draw_auto.StartAuto();
|
|
}
|
|
else
|
|
{
|
|
drawButton.gameObject.SetActive(true);
|
|
}
|
|
fishInfo.gameObject.SetActive(true);
|
|
if (isOpenPiercing)
|
|
{
|
|
fishInfo.ShowState(0);
|
|
List<int> waitingSequence = fishingUpdateSys.WaitingSequence;
|
|
var waitingZone = GContext.container.Resolve<Tables>().TbRodWaitingZone.GetOrDefault(fishingUpdateSys.WaitingZone);
|
|
if (waitingZone == null)
|
|
{
|
|
waitingSequence = fishingData.fishRodData.WaitingSequence;
|
|
waitingZone = GContext.container.Resolve<Tables>().TbRodWaitingZone.GetOrDefault(fishingData.fishRodData.WaitingZone);
|
|
Debug.LogError("waitingZone==null" + fishingData.fishRodData.WaitingZone);
|
|
}
|
|
fishingStart.SetBar(waitingZone, fishingData.StrengthToScale);
|
|
fishingStart.StopMove();
|
|
fishingStart.StartMoveCo(waitingSequence, fishingData.FishVigilanceToTime, fishingData.RodVigilanceToTime);
|
|
//StartCoroutine(StartMove());
|
|
}
|
|
else
|
|
{
|
|
fishInfo.ShowState(-1);
|
|
}
|
|
if (GContext.container.Resolve<PlayerFishData>().GetAnglingCount() != 5)
|
|
{
|
|
GContext.Publish(new OnEventTriggerGuide(GetType().Name));
|
|
}
|
|
}
|
|
//IEnumerator StartMove()
|
|
//{
|
|
// yield return fishingStart.StartCoroutine(fishingStart.StartMove(fishingUpdateSys.WaitingSequence, fishingData.FishVigilanceToTime, fishingData.RodVigilanceToTime));
|
|
// if (fishingStart.curIndex == -1)
|
|
// {
|
|
// //失败
|
|
// PiercingInfo(0);
|
|
// }
|
|
//}
|
|
public void HideDrawButton()
|
|
{
|
|
SetBtnAnimatorState(BtnAnimatorState.Normal);
|
|
drawButton.gameObject.SetActive(false);
|
|
btn_draw_auto.gameObject.SetActive(false);
|
|
}
|
|
public void ShowState(int state)
|
|
{
|
|
fishInfo.ShowState(state);
|
|
}
|
|
public void ShowRankInfo()
|
|
{
|
|
FishData curFishData = fishingData.curFishData;
|
|
if (!AutomaticFishing && curFishData.FishCardID > 0)
|
|
{
|
|
GContext.Publish(new EventUISound(SoundType.audio_fishing_welldone));
|
|
|
|
if (curFishData.Quality <= 2)
|
|
{
|
|
_rank_info.SetActive(curFishData.Quality <= 2);//WELL DONE!
|
|
return;
|
|
}
|
|
else if (curFishData.Quality >= 4)
|
|
{
|
|
bool isNew = GContext.container.Resolve<PlayerFishData>().IsNewFish(curFishData.ID);
|
|
float max = GContext.container.Resolve<PlayerFishData>().GetDataMaxWeight(curFishData.ID);
|
|
if (isNew || fishingData.fishWeight > max)
|
|
{
|
|
_rank_info2.SetActive(true);//incredible!
|
|
return;
|
|
}
|
|
}
|
|
_rank_info1.SetActive(true);//unbelievable!
|
|
}
|
|
}
|
|
|
|
//动画状态枚举
|
|
public enum BtnAnimatorState
|
|
{
|
|
None = 0,
|
|
Normal = 1,
|
|
Pressed = 2,
|
|
Clicked = 3
|
|
}
|
|
private void OnDisable()
|
|
{
|
|
disposables.Dispose();
|
|
}
|
|
private void OnDestroy()
|
|
{
|
|
Destroy(MaxComboTip);
|
|
Destroy(MaxComboFx);
|
|
Instance = null;
|
|
SkillRelease();
|
|
if (PiercingSuccessFx != null)
|
|
{
|
|
for (int i = 0; i < PiercingSuccessFx.Count; i++)
|
|
{
|
|
Destroy(PiercingSuccessFx[i]);
|
|
}
|
|
PiercingSuccessFx.Clear();
|
|
}
|
|
if (PiercingSuccess != null)
|
|
{
|
|
for (int i = 0; i < PiercingSuccess.Count; i++)
|
|
{
|
|
Addressables.Release(PiercingSuccess[i]);
|
|
}
|
|
PiercingSuccess.Clear();
|
|
}
|
|
if (MaxComboFxs != null)
|
|
{
|
|
for (int i = 0; i < MaxComboFxs.Count; i++)
|
|
{
|
|
Addressables.Release(MaxComboFxs[i]);
|
|
}
|
|
MaxComboFxs.Clear();
|
|
}
|
|
}
|
|
public void ShowFX_info_combo(bool isStart)
|
|
{
|
|
if (isStart)
|
|
{
|
|
CloseMaxComboTip();
|
|
ShowMaxComboFx();
|
|
}
|
|
else
|
|
{
|
|
CloseMaxComboFx();
|
|
}
|
|
btn_draw_combo_down.SetActive(isStart);
|
|
btn_draw_combo_top.SetActive(isStart);
|
|
FX_info_combo.SetActive(isStart);
|
|
btn_up.SetActive(false);
|
|
fishInfo.fx_ui_barlianji_full.SetActive(false);
|
|
fishInfo.EndFull(isStart, fishingData.fishRodData.ComboTime);
|
|
}
|
|
void ShowMaxComboFx()
|
|
{
|
|
if (MaxComboFx != null)
|
|
{
|
|
MaxComboFx.transform.DOKill();
|
|
MaxComboFx.transform.localScale = Vector3.one;
|
|
MaxComboFx.SetActive(true);
|
|
}
|
|
}
|
|
async void CloseMaxComboFx()
|
|
{
|
|
if (MaxComboFx != null)
|
|
{
|
|
MaxComboFx.transform.DOKill();
|
|
MaxComboFx.transform.DOScaleX(2f, 0.5f);
|
|
MaxComboFx.transform.DOScaleY(2f, 0.5f);
|
|
|
|
await Awaiters.Seconds(0.5f);
|
|
MaxComboFx?.SetActive(false);
|
|
}
|
|
}
|
|
public void ShowMaxComboTip()
|
|
{
|
|
//MaxComboTip.DOKill();
|
|
//MaxComboTip.DOFadeAlpha(1, maxComboTipFadeTime).SetEase(Ease.Linear);
|
|
MaxComboTip?.SetActive(true);
|
|
}
|
|
public void CloseMaxComboTip()
|
|
{
|
|
//MaxComboTip.DOKill();
|
|
//MaxComboTip.DOFadeAlpha(0, maxComboTipFadeTime).SetEase(Ease.Linear);
|
|
MaxComboTip?.SetActive(false);
|
|
}
|
|
public void ShowWarning(string warning)
|
|
{
|
|
//警告
|
|
FX_info_warning_1.SetActive(FX_info_warning_1.name == warning);
|
|
FX_info_warning_2.SetActive(FX_info_warning_2.name == warning);
|
|
FX_info_warning_3.SetActive(FX_info_warning_3.name == warning);
|
|
}
|
|
public void FXInfo(int index)
|
|
{
|
|
fishBlood.FXInfo(index);
|
|
}
|
|
|
|
public void PlayDistance()
|
|
{
|
|
fishInfo.distance_ani.Play();
|
|
}
|
|
public void StopDistance()
|
|
{
|
|
fishInfo.distance_ani.Stop();
|
|
}
|
|
#region 特殊技能相关
|
|
int FreezeSkill = 0;
|
|
public bool UISpSkill => FreezeSkill > 0;
|
|
GameObject FxScreenWarning;
|
|
GameObject FxScreen;
|
|
GameObject FxBtn;
|
|
GameObject FxClick;
|
|
GameObject FxBreak;
|
|
GameObject FxBar;
|
|
GameObject FxFishIcon;
|
|
|
|
GameObject FxTargetBarBg;
|
|
GameObject FxTargetBar;
|
|
GameObject FxTargetBarHighlight;
|
|
|
|
string AudioClick;
|
|
string AudioBreak;
|
|
public void SetImageSprite(BarTarget barTarget)
|
|
{
|
|
if (!string.IsNullOrEmpty(barTarget.bar_target))
|
|
{
|
|
GContext.container.Resolve<IUIService>().SetImageSprite(bar_target, barTarget.bar_target);
|
|
}
|
|
if (!string.IsNullOrEmpty(barTarget.highlight))
|
|
{
|
|
GContext.container.Resolve<IUIService>().SetImageSprite(highlight, barTarget.highlight);
|
|
}
|
|
}
|
|
public async void PlaySpKillFx(IFishSpSkillData fishSpSkillData)
|
|
{
|
|
BarTarget barTarget = fishSpSkillData.GetBarTarget();
|
|
if (barTarget != null)
|
|
{
|
|
if (!string.IsNullOrEmpty(barTarget.fx_target_bar_bg) && FxTargetBarBg == null)
|
|
{
|
|
FxTargetBarBg = await Addressables.InstantiateAsync(barTarget.fx_target_bar_bg, fx_target_bar_bg).Task;
|
|
}
|
|
if (!string.IsNullOrEmpty(barTarget.fx_target_bar) && FxTargetBar == null)
|
|
{
|
|
FxTargetBar = await Addressables.InstantiateAsync(barTarget.fx_target_bar, fx_target_bar).Task;
|
|
}
|
|
if (!string.IsNullOrEmpty(barTarget.fx_target_bar_highlight) && FxTargetBarHighlight == null)
|
|
{
|
|
FxTargetBarHighlight = await Addressables.InstantiateAsync(barTarget.fx_target_bar_highlight, fx_target_bar_highlight).Task;
|
|
}
|
|
if (!string.IsNullOrEmpty(barTarget.fxScreenWarning))
|
|
{
|
|
FxScreenWarning = await Addressables.InstantiateAsync(barTarget.fxScreenWarning, transform).Task;
|
|
FxScreenWarning?.SetActive(false);
|
|
}
|
|
|
|
}
|
|
//界面特效
|
|
if (FxScreen == null && !string.IsNullOrEmpty(fishSpSkillData.FxScreen()))
|
|
{
|
|
FxScreen = await Addressables.InstantiateAsync(fishSpSkillData.FxScreen(), transform).Task;
|
|
}
|
|
if (FxBar == null && !string.IsNullOrEmpty(fishSpSkillData.FxBar()))
|
|
{
|
|
FxBar = await Addressables.InstantiateAsync(fishSpSkillData.FxBar(), barFx).Task;
|
|
}
|
|
if (FxFishIcon == null && !string.IsNullOrEmpty(fishSpSkillData.FxFishIcon()))
|
|
{
|
|
FxFishIcon = await Addressables.InstantiateAsync(fishSpSkillData.FxFishIcon(), bloodBossFx).Task;
|
|
}
|
|
if (Instance == null)
|
|
{
|
|
SkillRelease();
|
|
return;
|
|
}
|
|
FxScreen?.SetActive(true);
|
|
FxBar?.SetActive(true);
|
|
FxTargetBarBg?.SetActive(true);
|
|
FxTargetBar?.SetActive(true);
|
|
FxTargetBarHighlight?.SetActive(true);
|
|
}
|
|
|
|
public void ShowFxScreenWarning(bool isWarning)
|
|
{
|
|
FxScreen?.SetActive(!isWarning);
|
|
FxScreenWarning?.SetActive(isWarning);
|
|
}
|
|
|
|
public void UpdateTargetBar(float bar_target_p)
|
|
{
|
|
float bar_target_fill = (bar_target_p * 86 + 2f) / 90;
|
|
bar_target.fillAmount = bar_target_fill;
|
|
highlight_target.localEulerAngles = new Vector3(0, 0, (1 - bar_target_fill) * 90f);
|
|
bar_target.gameObject.SetActive(bar_target_p > 0.01f);
|
|
highlight_target.gameObject.SetActive(bar_target_p > 0.01f);
|
|
}
|
|
public void StopFxSpKill()
|
|
{
|
|
//界面特效
|
|
FxScreen?.SetActive(false);
|
|
FxScreenWarning?.SetActive(false);
|
|
FxBar?.SetActive(false);
|
|
FxTargetBarBg?.SetActive(false);
|
|
FxTargetBarHighlight?.SetActive(false);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 显示冰冻界面
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public async void ShowFreezeSkill(Freeze freeze)
|
|
{
|
|
FreezeSkill = freeze.ClickCount;
|
|
AudioClick = freeze.AudioClick;
|
|
AudioBreak = freeze.AudioBreak;
|
|
//界面特效
|
|
if (FxScreen == null)
|
|
{
|
|
FxScreen = await Addressables.InstantiateAsync(freeze.FxScreen, transform).Task;
|
|
}
|
|
GContext.Publish(new EventUISound(freeze.AudioScreen));
|
|
//按钮特效
|
|
if (FxBtn == null)
|
|
{
|
|
FxBtn = await Addressables.InstantiateAsync(freeze.FxBtn, drawButton.transform).Task;
|
|
}
|
|
if (FxClick == null)
|
|
{
|
|
FxClick = await Addressables.InstantiateAsync(freeze.FxClick, drawButton.transform).Task;
|
|
}
|
|
if (FxBreak == null)
|
|
{
|
|
FxBreak = await Addressables.InstantiateAsync(freeze.FxBreak, transform).Task;
|
|
}
|
|
if (Instance == null)
|
|
{
|
|
SkillRelease();
|
|
return;
|
|
}
|
|
FxClick?.SetActive(false);
|
|
FxBreak?.SetActive(false);
|
|
FxScreen?.SetActive(true);
|
|
FxBtn?.SetActive(true);
|
|
}
|
|
void OnClickSkill()
|
|
{
|
|
if (FreezeSkill > 0)
|
|
{
|
|
FreezeSkill--;
|
|
|
|
if (FreezeSkill == 0)
|
|
{
|
|
//技能结束
|
|
FxBreak?.SetActive(true);
|
|
FxScreen?.SetActive(false);
|
|
FxBtn?.SetActive(false);
|
|
GContext.Publish(new EventUISound(AudioBreak));
|
|
}
|
|
else
|
|
{
|
|
GContext.Publish(new EventUISound(AudioClick));
|
|
}
|
|
//else if (FxClick != null)
|
|
//{
|
|
//点击特效
|
|
FxClick?.SetActive(false);
|
|
FxClick?.SetActive(true);
|
|
//}
|
|
}
|
|
}
|
|
public void SkillRelease()
|
|
{
|
|
if (FxScreen != null)
|
|
{
|
|
Addressables.ReleaseInstance(FxScreen);
|
|
FxScreen = null;
|
|
}
|
|
if (FxScreenWarning != null)
|
|
{
|
|
Addressables.ReleaseInstance(FxScreenWarning);
|
|
FxScreenWarning = null;
|
|
}
|
|
if (FxBtn != null)
|
|
{
|
|
Addressables.ReleaseInstance(FxBtn);
|
|
FxBtn = null;
|
|
}
|
|
if (FxClick != null)
|
|
{
|
|
Addressables.ReleaseInstance(FxClick);
|
|
FxClick = null;
|
|
}
|
|
if (FxBreak != null)
|
|
{
|
|
Addressables.ReleaseInstance(FxBreak);
|
|
FxBreak = null;
|
|
}
|
|
if (FxBar != null)
|
|
{
|
|
Addressables.ReleaseInstance(FxBar);
|
|
FxBar = null;
|
|
}
|
|
if (FxFishIcon != null)
|
|
{
|
|
Addressables.ReleaseInstance(FxFishIcon);
|
|
FxFishIcon = null;
|
|
}
|
|
if (FxTargetBarBg != null)
|
|
{
|
|
Addressables.ReleaseInstance(FxTargetBarBg);
|
|
FxTargetBarBg = null;
|
|
}
|
|
if (FxTargetBar != null)
|
|
{
|
|
Addressables.ReleaseInstance(FxTargetBar);
|
|
FxTargetBar = null;
|
|
}
|
|
|
|
if (FxTargetBarHighlight != null)
|
|
{
|
|
Addressables.ReleaseInstance(FxTargetBarHighlight);
|
|
FxTargetBarHighlight = null;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
}
|