备份CatanBuilding瘦身独立工程

This commit is contained in:
JSD\13999
2026-05-26 16:15:54 +08:00
commit 2d0e6a61b7
12001 changed files with 2431925 additions and 0 deletions

View File

@@ -0,0 +1,98 @@
using asap.core;
using cfg;
using DG.Tweening;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class BarRoot : MonoBehaviour
{
public Image bar_green;
public Image mid;
public Transform _highlight;
public Image bar_lianji;
public GameObject arrow_guidance;
float barShakeAmp = 1;
List<float> posAmp = new List<float>() { 0, 0 };
List<float> posPeriod = new List<float>() { 0, 0 };
List<float> scaleAmp = new List<float>() { 0, 0 };
List<float> scalePeriod = new List<float>() { 0, 0 };
private void InitAmpAndPeriod()
{
posAmp = new List<float>() { 0, 0 };
posPeriod = new List<float>() { 0, 0 };
scaleAmp = new List<float>() { 0, 0 };
scalePeriod = new List<float>() { 0, 0 };
}
public void ShowTensionBar()
{
InitAmpAndPeriod();
arrow_guidance.gameObject.SetActive(false);
bar_green.DOKill();
UpdateTensionBar(0.5f);
bar_lianji.fillAmount = 0;
}
public void UpdateTensionBar(float power)
{
power = (power * 86 + 2f) / 90;
bar_green.fillAmount = power;
_highlight.localEulerAngles = new Vector3(0, 0, (1 - power) * 90f);
}
public void SetBarCombo(float fillAmount)
{
bar_lianji.fillAmount = 0.3f + (fillAmount * 0.7f);
}
public void BarComboBack(float time)
{
bar_lianji.DOFillAmount(0.3f, time - 0.001f);
}
public void SetTensionBarScale(float MaxZoneScale)
{
mid.fillAmount = MaxZoneScale;
}
public void PlayAni(string aniName, float barShakeAmp)
{
this.barShakeAmp = barShakeAmp;
//ani.Play(aniName);
RodShakeParam rodShakeParam = GContext.container.Resolve<Tables>().TbRodShakeParam.GetOrDefault(aniName);
if (rodShakeParam == null)
{
InitAmpAndPeriod();
}
else
{
posAmp = rodShakeParam.PosAmp;
posPeriod = rodShakeParam.PosPeriod;
scaleAmp = rodShakeParam.ScaleAmp;
scalePeriod = rodShakeParam.ScalePeriod;
}
}
private void Update()
{
float x = 0;
float y = 0;
if (posAmp[0] > 0.0001f)
{
x = Mathf.Sin(Time.time * 2 * Mathf.PI / posPeriod[0]) * posAmp[0] * barShakeAmp;
}
if (posAmp[1] > 0.0001f)
{
y = Mathf.Sin(Time.time * 2 * Mathf.PI / posPeriod[1]) * posAmp[1] * barShakeAmp;
}
transform.localPosition = new Vector3(x, y, 0);
float sx = 1;
float sy = 1;
if (scaleAmp[0] > 0.0001f)
{
sx += Mathf.Sin(Time.time * 2 * Mathf.PI / scalePeriod[0]) * (scaleAmp[0] - 1) * barShakeAmp;
}
if (scaleAmp[1] > 0.0001f)
{
sy += Mathf.Sin(Time.time * 2 * Mathf.PI / scalePeriod[1]) * (scaleAmp[1] - 1) * barShakeAmp;
}
transform.localScale = new Vector3(sx, sy, 1);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c1e5a12fd1b5a2f4085573a0f3f0089a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,89 @@
using GameCore;
using System.Threading.Tasks;
using TMPro;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
public class FishPhotoCaptrue : MonoBehaviour
{
[SerializeField]
private TMP_Text
txt_fishWeight,
txt_fishName;
[SerializeField]
private Camera cam;
[SerializeField]
private UniversalRenderPipelineAsset m_PipelineAsset;
private RenderPipelineAsset m_PreviousPipelineAsset;
private bool m_overrodeQualitySettings;
void OnEnable()
{
UpdatePipeline();
}
void OnDisable()
{
ResetPipeline();
}
private void UpdatePipeline()
{
if (m_PipelineAsset)
{
if (QualitySettings.renderPipeline != null && QualitySettings.renderPipeline != m_PipelineAsset)
{
m_PreviousPipelineAsset = QualitySettings.renderPipeline;
QualitySettings.renderPipeline = m_PipelineAsset;
m_overrodeQualitySettings = true;
}
else if (GraphicsSettings.renderPipelineAsset != m_PipelineAsset)
{
m_PreviousPipelineAsset = GraphicsSettings.renderPipelineAsset;
GraphicsSettings.renderPipelineAsset = m_PipelineAsset;
m_overrodeQualitySettings = false;
}
}
}
private void ResetPipeline()
{
if (m_PreviousPipelineAsset)
{
if (m_overrodeQualitySettings)
{
QualitySettings.renderPipeline = m_PreviousPipelineAsset;
}
else
{
GraphicsSettings.renderPipelineAsset = m_PreviousPipelineAsset;
}
}
}
public void Init(string fishName, float fishWeight)
{
txt_fishName.text = LocalizationMgr.GetFormatTextValue(fishName);
txt_fishWeight.text = LocalizationMgr.GetWeight(fishWeight);
}
public async Task RenderImage(RenderTexture rt)
{
Camera main = Camera.main;
cam.transform.position = main.transform.position;
cam.transform.rotation = main.transform.rotation;
cam.fieldOfView = main.fieldOfView;
await Awaiters.NextFrame;
await Awaiters.EndOfFrame;
var request = new UniversalRenderPipeline.SingleCameraRequest();
request.destination = rt;
RenderPipeline.SubmitRenderRequest(cam, request);
await Awaiters.EndOfFrame;
await Awaiters.NextFrame;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5280ec8fe56a9f94690376d4e8aaf90a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,172 @@
using asap.core;
using cfg;
using DG.Tweening;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class FishingBlood : MonoBehaviour
{
public float barWhiteSpeed = 0.1f;
public float barWhiteSpeedFast = 0.6f;
public float barWhiteSpeedThreshhold = 0.125f;
public Image barRed;
public Image barWhite;
private GameObject textFloatingnumber;
Transform FloatingnumberRoot;
List<GameObject> gameObjects = new List<GameObject>();
List<float> DamageParam;
List<float> ScaleList;
Animation icon_fish_ani;
FishingPanelIconFish icon_fish;
FishingPanelIconFish icon_fish_boss;
GameObject FX_info_1;
GameObject FX_info_2;
GameObject FX_info_3;
GameObject FX_info_4;
public void Init()
{
icon_fish_ani = transform.Find("icon_fish/icon").GetComponent<Animation>();
icon_fish = transform.Find("icon_fish").GetComponent<FishingPanelIconFish>();
icon_fish_boss = transform.Find("icon_fish_boss").GetComponent<FishingPanelIconFish>();
DamageParam = GContext.container.Resolve<Tables>().TbGlobalConfig.BattleFloatingNumberDamageParam;
ScaleList = GContext.container.Resolve<Tables>().TbGlobalConfig.BattleFloatingNumberScaleList;
barRed = transform.Find("bar_red").GetComponent<Image>();
barWhite = transform.Find("bar_white").GetComponent<Image>();
FloatingnumberRoot = transform.Find("floatingnumber");
textFloatingnumber = transform.Find("floatingnumber/text_floatingnumber").gameObject;
FX_info_1 = transform.Find("FX_info_1").gameObject;
FX_info_2 = transform.Find("FX_info_2").gameObject;
FX_info_3 = transform.Find("FX_info_3").gameObject;
FX_info_4 = transform.Find("FX_info_4").gameObject;
}
private void Start()
{
textFloatingnumber.SetActive(false);
gameObjects.Add(textFloatingnumber);
GameObject go;
for (int i = 0; i < 3; i++)
{
go = Instantiate(textFloatingnumber, FloatingnumberRoot);
go.transform.localPosition = textFloatingnumber.transform.localPosition;
gameObjects.Add(go);
}
//ShowFishBossIcon(false);
}
public void SetFishIconDir(bool isLeft)
{
icon_fish_ani.Play(isLeft ? "icon_fish_left" : "icon_fish_right");
}
IEnumerator ShowFloatingNumber(int value, bool isCombo, bool crit)
{
GameObject go = null;
for (int i = 0; i < gameObjects.Count; i++)
{
if (!gameObjects[i].activeSelf)
{
go = gameObjects[i];
break;
}
}
if (go == null)
{
go = Instantiate(textFloatingnumber, FloatingnumberRoot);
gameObjects.Add(go);
}
go.transform.localScale = Vector3.one;
for (int i = 0; i < ScaleList.Count; i++)
{
if (value > DamageParam[i])
{
go.transform.localScale = new Vector3(ScaleList[i], ScaleList[i], 1);
break;
}
}
if (crit)
{
go.transform.localScale *= 1.2f;
}
go.transform.Find("text").GetComponent<TMP_Text>().text = value.ToString("-0");
go.transform.Find("text2").GetComponent<TMP_Text>().text = value.ToString("-0");
go.transform.Find("text3").GetComponent<TMP_Text>().text = value.ToString("-0");
go.SetActive(true);
if (crit)
{
go.GetComponent<Animator>().Play("BattleFloatingNumber3Appear", 0, 0);
}
else
{
go.GetComponent<Animator>().Play(isCombo ? "BattleFloatingNumber2Appear" : "BattleFloatingNumberAppear", 0, 0);
}
yield return new WaitForSeconds(1f);
go.SetActive(false);
}
public void ShowFishInfo(int text, float fishHPScale, bool isCombo, bool crit)
{
if (gameObject.activeInHierarchy)
{
StartCoroutine(ShowFloatingNumber(text, isCombo, crit));
barRed.fillAmount = fishHPScale;
WhiteDOFillAmount(fishHPScale);
}
}
public void WhiteDOFillAmount(float fishHPScale)
{
if (gameObject.activeInHierarchy)
{
barWhite.DOKill();
float offset = barWhite.fillAmount - fishHPScale;
float fillSpeed = barWhiteSpeed;
if (offset > barWhiteSpeedThreshhold)
{
fillSpeed = 1 / (barWhiteSpeedThreshhold / barWhiteSpeed + (offset - barWhiteSpeedThreshhold) / barWhiteSpeedFast);
}
barWhite.DOFillAmount(fishHPScale, fillSpeed).SetSpeedBased();
}
}
public void SetFishHPScale(float fishHPScale)
{
barWhite.DOKill();
barRed.fillAmount = fishHPScale;
barWhite.fillAmount = 1;
}
public bool ShowFishBossIcon(string showName)
{
bool isBoss = icon_fish_boss.name == showName;
icon_fish_boss.gameObject.SetActive(isBoss);
icon_fish.gameObject.SetActive(!isBoss);
return isBoss;
}
public void FXInfoInit()
{
FX_info_1.gameObject.SetActive(false);
FX_info_2.gameObject.SetActive(false);
FX_info_3.gameObject.SetActive(false);
FX_info_4.gameObject.SetActive(false);
}
public void FXInfo(int index)
{
FXInfoInit();
switch (index)
{
case 1:
FX_info_1.SetActive(true);
break;
case 2:
FX_info_2.SetActive(true);
break;
case 3:
FX_info_3.SetActive(true);
break;
case 4:
FX_info_4.SetActive(true);
break;
default:
break;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b041cb102e1800243b2c667a319cf2e3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,202 @@
using asap.core;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using GameCore;
using cfg;
public class FishingFishInfo : MonoBehaviour
{
private TMP_Text _comboText;
public GameObject FX_info_weakly;
public GameObject FX_info_powerful;
public GameObject fx_ui_fishingpanelbar_warm;
public GameObject fx_ui_barlianji_full;
public ParticleSystem fx_ui_hightligt_loop;
public Animation distance_ani;
GameObject start;
GameObject blood;
GameObject mouse;
GameObject distance;
GameObject combo;
public TMP_Text textDistance;
TMP_Text text_distance_tips;
public TMP_Text textDistanceWarning;
public TMP_Text textDistanceRod;
BarRoot fishingBarRoot;
Tables _tables;
Dictionary<string, bool> barShake = new Dictionary<string, bool>();
FishingUpdateSys fishingUpdateSys;
public void InitPanel(FishingUpdateSys fishingUpdateSys)
{
this.fishingUpdateSys = fishingUpdateSys;
_tables = GContext.container.Resolve<Tables>();
start = transform.Find("start").gameObject;
combo = transform.Find("combo").gameObject;
blood = transform.Find("blood").gameObject;
mouse = transform.Find("mouse").gameObject;
distance = transform.Find("distance").gameObject;
distance_ani = distance.GetComponent<Animation>();
textDistance = transform.Find("distance/text_distance").GetComponent<TMP_Text>();
text_distance_tips = transform.Find("distance/text_distance_tips").GetComponent<TMP_Text>();
textDistanceWarning = transform.Find("distance/text_distance_warning").GetComponent<TMP_Text>();
textDistanceRod = transform.Find("distance/text_distance_warning/text_distance_rod").GetComponent<TMP_Text>();
fishingBarRoot = transform.Find("combo/barRoot").GetComponent<BarRoot>();
textDistanceWarning.transform.localScale = Vector3.one * 1.8f;
_comboText = transform.Find("combo/text_combo").GetComponent<TMP_Text>();
fx_ui_barlianji_full = transform.Find("combo/barRoot/bar_lianji/fx_ui_barlianji_full").gameObject;
FX_info_weakly = transform.Find("combo/FX_info_weakly").gameObject;
FX_info_powerful = transform.Find("combo/FX_info_powerful").gameObject;
fx_ui_fishingpanelbar_warm = transform.Find("combo/barRoot/fx_ui_fishingpanelbar_warm").gameObject;
fx_ui_hightligt_loop = transform.Find("combo/barRoot/highlight/fx_ui_hightligt_loop/1").GetComponent<ParticleSystem>();
combo.SetActive(false);
}
public void SetTensionBarScale(float MaxZoneScale)
{
fishingBarRoot.SetTensionBarScale(MaxZoneScale);
}
public void ShowTensionBar()
{
barShake.Clear();
FX_info_weakly.SetActive(false);
FX_info_powerful.SetActive(false);
_comboText.text = "";
fishingBarRoot.ShowTensionBar();
fx_ui_barlianji_full.SetActive(false);
fx_ui_hightligt_loop.Stop();
}
public void ShowState(int value)
{
start.SetActive(value == 0);
combo.SetActive(value == 1);
blood.SetActive(value == 1);
distance.SetActive(value > 0);
mouse.SetActive(value == 2);
}
public void UpdateTensionBar(int type, float power)
{
if (type == 1)
{
fx_ui_hightligt_loop.Play();
}
else
{
fx_ui_hightligt_loop.Stop();
}
bool isWeakly = power <= fishingUpdateSys.FishingFailProgressLeft;
bool isPowerful = power >= 1 - fishingUpdateSys.FishingFailProgressRight && fishingUpdateSys.NeverOvertensionToCrit <= 0;
FX_info_weakly.SetActive(isWeakly);
FX_info_powerful.SetActive(isPowerful);
fx_ui_fishingpanelbar_warm.SetActive(isWeakly || isPowerful);
//_comboText.gameObject.SetActive(!isWeakly && !isPowerful);
//_comboText.gameObject.SetActive(!isWeakly && !isPowerful);
fishingBarRoot.UpdateTensionBar(power);
}
public void UpdateComboMultiplayer(float _curComboMultiplayer)
{
//string comboText = "";
if (_curComboMultiplayer > 0)
{
fishingBarRoot.SetBarCombo(_curComboMultiplayer);
//if (_curComboMultiplayer < 0.99f)
// comboText = LocalizationMgr.GetFormatTextValue("UI_FishingPanel_Advanced_101001", ((int)(_curComboMultiplayer * 100)).ToString());
//else
// comboText = LocalizationMgr.GetText("UI_FishingPanel_Advanced_101002");
}
//_comboText.text = comboText;
}
public void ShowComboTips(bool isShow)
{
fishingBarRoot.arrow_guidance.SetActive(isShow);
}
public void ShowFishInfoPos(Vector3 bobber)
{
Vector3 targetPos = ConvertTools.WorldToScreenPoint(bobber);
float offset = 250.0f;
targetPos.y += offset;
transform.localPosition = targetPos; // 设置位置
}
/// <summary>
/// 距离显示
/// </summary>
/// <param name="fishSwimAreaZFar">远端</param>
/// <param name="fishSwimAreaZNear">近端</param>
/// <param name="curDistance">鱼线长度</param>
/// <param name="maxDistance">最大长度</param>
/// <param name="warning">红色警告</param>
public void OnDrawFishingLine(float fishSwimAreaZFar, float fishSwimAreaZNear, float curDistance, float maxDistance, float warningLineLengthRatio)
{
float warningLine = maxDistance * warningLineLengthRatio;
if (curDistance >= warningLine)
{
textDistanceWarning.gameObject.SetActive(true);
text_distance_tips.gameObject.SetActive(false);
textDistance.gameObject.SetActive(false);
if (curDistance > maxDistance)
{
curDistance = maxDistance;
}
textDistanceWarning.text = LocalizationMgr.GetFormatTextValue("UI_FishingPanel_Advanced_101009", curDistance.ToString("0"));
textDistanceRod.text = LocalizationMgr.GetFormatTextValue("UI_FishingPanel_Advanced_101009", maxDistance.ToString("0"));
}
else if (curDistance > fishSwimAreaZFar)
{
//橙色警告
text_distance_tips.text = LocalizationMgr.GetFormatTextValue("UI_FishingPanel_Advanced_101009", curDistance.ToString("0"));
text_distance_tips.gameObject.SetActive(true);
text_distance_tips.transform.localScale = Vector3.one *
(0.4f * ((curDistance - fishSwimAreaZFar) / (warningLine - fishSwimAreaZFar)) + 1.4f);
textDistance.gameObject.SetActive(false);
textDistanceWarning.gameObject.SetActive(false);
}
else
{
if (warningLine > fishSwimAreaZFar)
{
warningLine = fishSwimAreaZFar;
}
textDistance.text = LocalizationMgr.GetFormatTextValue("UI_FishingPanel_Advanced_101009", curDistance.ToString("0"));
textDistance.gameObject.SetActive(true);
textDistance.transform.localScale = Vector3.one *
(0.4f * ((curDistance - fishSwimAreaZNear) / (warningLine - fishSwimAreaZNear)) + 1f);
text_distance_tips.gameObject.SetActive(false);
textDistanceWarning.gameObject.SetActive(false);
}
}
public void EndFull(bool isStart, float comboTime)
{
_comboText.gameObject.SetActive(!isStart);
_comboText.text = "";
if (isStart)
{
fishingBarRoot.BarComboBack(comboTime);
}
}
public void PlayBarAni(string aniName, bool isShake, float barShakeAmp)
{
barShake[aniName] = isShake;
List<string> BarShakePriority = _tables.TbGlobalConfig.BarShakePriority;
for (int i = 0; i < BarShakePriority.Count; i++)
{
if (barShake.ContainsKey(BarShakePriority[i]) && barShake[BarShakePriority[i]])
{
fishingBarRoot.PlayAni(BarShakePriority[i], barShakeAmp);
return;
}
}
fishingBarRoot.PlayAni(BarShakePriority[^1], barShakeAmp);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 70a81df72dbb2c7448c3f5822287729f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,75 @@
using asap.core;
using System;
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
using UniRx;
using DG.Tweening;
public class UISkillShow
{
public int type;
public float chargingTime;
public float executeTime;
public bool isStart;
}
public class FishingPanelIconFish : MonoBehaviour
{
public Image icon;
public Image icon_bar;
public GameObject fx_sp;
public GameObject fx_escape;
public GameObject fx_fishingpanel_fishboss_glowdown;
IDisposable icon_bar_disposable;
private void OnEnable()
{
fx_sp.SetActive(false);
fx_escape.SetActive(false);
fx_fishingpanel_fishboss_glowdown.SetActive(false);
Init();
icon_bar_disposable = GContext.OnEvent<UISkillShow>().Subscribe(OnUISkillShow);
}
void Init()
{
StopAllCoroutines();
fx_fishingpanel_fishboss_glowdown.SetActive(false);
fx_sp.SetActive(false);
fx_escape.SetActive(false);
icon_bar.DOKill();
icon_bar.fillAmount = 0;
}
void OnUISkillShow(UISkillShow uISkillShow)
{
Init();
if (uISkillShow.isStart)
{
StartCoroutine(StartSkill(uISkillShow.chargingTime, uISkillShow.executeTime, uISkillShow.type));
}
}
IEnumerator StartSkill(float time, float executeTime, int type)
{
icon_bar.DOFillAmount(1, time);
yield return new WaitForSeconds(time);
icon_bar.DOKill();
icon_bar.fillAmount = 1;
fx_sp.SetActive(true);
fx_escape.SetActive(type == 2);
fx_fishingpanel_fishboss_glowdown.SetActive(type == 2);
if (executeTime > 0.001f)
{
yield return new WaitForSeconds(executeTime);
icon_bar.fillAmount = 0;
fx_sp.SetActive(false);
fx_escape.SetActive(false);
fx_fishingpanel_fishboss_glowdown.SetActive(false);
}
}
private void OnDisable()
{
fx_sp.SetActive(false);
fx_escape.SetActive(false);
icon_bar.DOKill();
icon_bar.fillAmount = 0;
icon_bar_disposable?.Dispose();
icon_bar_disposable = null;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c2cf14da51ec345499b8e7ddc80e4f07
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,921 @@
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
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d8c3f32d21252a048b1f5c2efbbbf6e0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,220 @@
using asap.core;
using cfg;
using DG.Tweening;
using Game;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
public class FishingStart : MonoBehaviour
{
public List<Image> barList;
GameObject old_bar;
public Image bar_light;
public List<RectTransform> lineList;
GameObject old_line;
public RectTransform line_light;
public RectTransform lineheight;
public RectTransform zhizhen;
float height;
RodWaitingZone waitingZone;
RodWaitingSequence waitingSequence;
public int curIndex;
List<float> ZoneScale;
[Header("进度条上端空余比例")]
public float top = 0.04784689f;
[Header("进度条下端空余比例")]
public float bottom = 0.05502392f;
[Header("高亮空余比例")]
public float bottomH = 0.07177033f;
private void Awake()
{
height = lineheight.rect.height;
}
public void SetBar(RodWaitingZone waitingZone, List<float> StrengthToScale)
{
IUIService uIService = GContext.container.Resolve<IUIService>();
GContext.Publish(new VibrationData(HapticTypes.Warning));
this.waitingZone = waitingZone;
ZoneScale = new List<float>();
for (int i = 0; i < waitingZone.ZoneScale.Count; i++)
{
ZoneScale.Add(waitingZone.ZoneScale[i] * (1 + StrengthToScale[i]));
}
float allScale = ZoneScale.Sum();
float curScale = 0;
string spriteName;
for (int i = waitingZone.ZoneSequence.Count - 1; i >= 0; i--)
{
curScale += ZoneScale[i];
int index = waitingZone.ZoneSequence[i];
barList[index].transform.SetSiblingIndex(i);
float fillAmount = (curScale / allScale) * (1 - top - bottom) + bottom;
barList[index].fillAmount = fillAmount;
if (index > 0)
{
int a = waitingZone.ZoneSequence[i - 1];
int b = waitingZone.ZoneSequence[i];
if (a > b)
{
spriteName = $"line_battle_start_{b}{a}";
lineList[i - 1].localScale = new Vector3(1, -1, 1);
}
else
{
spriteName = $"line_battle_start_{a}{b}";
lineList[i - 1].localScale = Vector3.one;
}
Image image = lineList[i - 1].GetComponent<Image>();
uIService.SetImageSprite(image, spriteName, "FishingPanel");
lineList[i - 1].gameObject.SetActive(waitingZone.ZoneScale[i] != 0);
lineList[i - 1].anchoredPosition = new Vector2(0, height * fillAmount);
if (index == 3)
{
old_bar = barList[index].gameObject;
old_line = lineList[i - 1].gameObject;
bar_light.transform.SetSiblingIndex(i);
bar_light.fillAmount = fillAmount - bottomH;
spriteName = spriteName + "_light";
if (a > b)
{
line_light.localScale = new Vector3(1, -1, 1);
}
else
{
line_light.localScale = Vector3.one;
}
image = line_light.GetComponent<Image>();
uIService.SetImageSprite(image, spriteName, "FishingPanel");
line_light.gameObject.SetActive(waitingZone.ZoneScale[i] != 0);
line_light.anchoredPosition = new Vector2(0, height * fillAmount);
}
}
}
if (waitingZone.ZoneScale[0] == 0)
{
lineList[0].gameObject.SetActive(false);
}
}
void ShowLight(bool value)
{
old_bar.SetActive(!value);
old_line.SetActive(!value);
bar_light.gameObject.SetActive(value);
line_light.gameObject.SetActive(value);
}
private void OnDisable()
{
StopAllCoroutines();
}
public void StopMove()
{
StopAllCoroutines();
}
public int GetCurPos()
{
float allScale = ZoneScale.Sum();
float curScale = 0;
float zhizhenPos = (zhizhen.anchoredPosition.y - height * bottom) / (height * (1 - top - bottom)) - 0.0001f;
if (zhizhenPos >= 1)
{
zhizhenPos = 0.9999f;
}
for (int i = waitingZone.ZoneSequence.Count - 1; i >= 0; i--)
{
curScale += ZoneScale[i];
if (zhizhenPos <= curScale / allScale)
{
return waitingZone.ZoneSequence[i];
}
}
return waitingZone.ZoneSequence[^1];
}
public void StartMoveCo(List<int> waitingSequenceIDList, float FishVigilanceToTime, float RodVigilanceToTime)
{
StartCoroutine(StartMove(waitingSequenceIDList, FishVigilanceToTime, RodVigilanceToTime));
}
IEnumerator StartMove(List<int> waitingSequenceIDList, float FishVigilanceToTime, float RodVigilanceToTime)
{
ShowLight(false);
int waitingSequenceID = waitingSequenceIDList[Random.Range(0, waitingSequenceIDList.Count)];
zhizhen.DOKill();
zhizhen.anchoredPosition = new Vector2(0, height * (1 - top));
waitingSequence = GContext.container.Resolve<Tables>().TbRodWaitingSequence.GetOrDefault(waitingSequenceID);
List<float> moveTime = new List<float>();
List<float> stayTime = new List<float>();
float VigilanceToTime;
for (int i = 0; i < waitingSequence.MoveTime.Count; i++)
{
VigilanceToTime = (1 - RodVigilanceToTime) / (1 + FishVigilanceToTime);
moveTime.Add(waitingSequence.MoveTime[i] * VigilanceToTime);
stayTime.Add(waitingSequence.StayTime[i] * VigilanceToTime);
}
do
{
for (int i = 0; i < waitingSequence.StayMoveCount.Count; i++)
{
curIndex = (int)waitingSequence.ZoneWeight[i];
float endPos = barList[curIndex].fillAmount;
float startPos = bottom;
int index = waitingZone.ZoneSequence.IndexOf(curIndex);//当前bar在ZoneSequence中的index
if (index < waitingZone.ZoneSequence.Count - 1)
{
index = waitingZone.ZoneSequence[index + 1];//下一层bar的index
startPos = barList[index].fillAmount;
}
float middle = (startPos + endPos) / 2;
float offset = Mathf.Abs(startPos - endPos) / 2 * height;
float target = middle * height;
float moveOutTime = offset / Mathf.Abs(zhizhen.anchoredPosition.y - target) * moveTime[i];
zhizhen.DOAnchorPosY(target, moveTime[i]).SetEase(Ease.Linear);
if (curIndex == 3)
{
yield return new WaitForSeconds(moveTime[i] - moveOutTime);
//交界处
ShowLight(true);
yield return new WaitForSeconds(moveOutTime);
}
else
{
yield return new WaitForSeconds(moveOutTime);
//交界处
ShowLight(false);
yield return new WaitForSeconds(moveTime[i] - moveOutTime);
}
IsShowGuidance isShowGuidance = new IsShowGuidance();
GContext.Publish(isShowGuidance);
if (isShowGuidance.isShow && curIndex == 3)
{
yield break;
}
GContext.Publish(new EventFishingSound(SoundType.audio_fishing_piercing));
GContext.Publish(new VibrationData(HapticTypes.Vibrate));
yield return StartCoroutine(StayTime(stayTime[i], startPos, middle, endPos, (int)waitingSequence.StayMoveCount[i]));
}
zhizhen.DOAnchorPosY(height * (1 - top), 0.5f).SetEase(Ease.Linear);
yield return new WaitForSeconds(0.5f);
} while (waitingZone.ZoneScale[0] == 0);
curIndex = -1;
}
IEnumerator StayTime(float time, float startPos, float middle, float endPos, int count)
{
float pos1 = (endPos - startPos) / 3;
float pos = UnityEngine.Random.Range(startPos, endPos);
for (int i = 0; i < count; i++)
{
if (pos > middle)
pos = UnityEngine.Random.Range(startPos, pos - pos1);
else
pos = UnityEngine.Random.Range(pos + pos1, endPos);
zhizhen.DOAnchorPosY(pos * height, time / count).SetEase(Ease.Linear);
yield return new WaitForSeconds(time / count);
GContext.Publish(new EventFishingSound(SoundType.audio_fishing_piercing));
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fd170a1bc786b8544b1016bb32675214
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,254 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using cfg;
using asap.core;
using UnityEngine.AddressableAssets;
public class FishingWeighBar : MonoBehaviour
{
[Serializable]
public class Medal
{
public float Len;
public float Point {
get {
return _isSpecalMedal? SpPoint:NormalPoint;
}
}
public float NormalPoint;
public float SpPoint;
public string medalName;
public Transform Parent;
private GameObject _go;
public bool _isSpecalMedal;
public void IsSpecialMedal(bool isSpecial)
{
_isSpecalMedal = isSpecial;
}
public async void CreateMedal()
{
if(_go == null)
_go = await Addressables.InstantiateAsync(medalName, Parent.GetChild(0)).Task;
}
public void ActivateVFX()
{
_go.transform.Find("fx_fishingreward_iconrate_glow").gameObject.SetActive(true);
}
}
public List<Medal> _medals = new();
private Tables _tables;
public RectTransform rect_ruler;
public RectTransform rect_medals;
public Dictionary<int, string> MedalPrefabs = new();
[SerializeField]
private Transform
tran_medalParent;
private int curMedalIndex;
public void Init()
{
curMedalIndex = 0;
MedalPrefabs.Add(0, "fishing_rate_d");
MedalPrefabs.Add(1, "fishing_rate_c");
MedalPrefabs.Add(2, "fishing_rate_c+");
MedalPrefabs.Add(3, "fishing_rate_b");
MedalPrefabs.Add(4, "fishing_rate_b+");
MedalPrefabs.Add(5, "fishing_rate_a");
MedalPrefabs.Add(6, "fishing_rate_a+");
MedalPrefabs.Add(7, "fishing_rate_s");
MedalPrefabs.Add(8, "fishing_rate_ss");
MedalPrefabs.Add(9, "fishing_rate_sss");
MedalPrefabs.Add(10, "fishing_rate_x");
MedalPrefabs.Add(11, "fishing_rate_xx");
MedalPrefabs.Add(12, "fishing_rate_xxx");
_tables = GContext.container.Resolve<Tables>();
var ranks = _tables.TbGlobalConfig.Rank;
var spRanks = _tables.TbGlobalConfig.RankForSpFish;
//¸øÃ¿¸ö½±Õ¸³·ÖÊý
for ( int i = 0; i < tran_medalParent.childCount; i++ )
{
var parent = tran_medalParent.GetChild(i);
var rect = parent.GetComponent<RectTransform>();
var medal = new Medal
{
Len = rect.sizeDelta.y / 2 - rect.anchoredPosition.y,
medalName = MedalPrefabs[i],
NormalPoint= ranks[i],
SpPoint = spRanks[i],
Parent = parent,
};
medal.CreateMedal();
// Debug.Log($" {parent.name} {rect.sizeDelta.y} / 2 - {rect.anchoredPosition.y}");
_medals.Add(medal);
}
// _medals[0].CreateMedal();
// _medals[1].CreateMedal();
}
public void IsSpecialSettlement(bool isSpecial)
{
Debug.Log("IsSpecialSettlement :" + isSpecial);
foreach (var medal in _medals)
{
medal.IsSpecialMedal(isSpecial);
}
}
public float GetPointByLen(float curLen,bool isSpecialFish=false)
{
Medal preMedal = null;
Medal nextMedal = null;
float curScore = 0f;
for ( int i = 0; i < _medals.Count - 1; i++ )
{
var lastMedal1 = _medals[i];
var endMedal1 = _medals[i + 1];
if ( lastMedal1.Len >= curLen&&i==0 )
{
preMedal = null;
nextMedal = endMedal1;
break;
}
if ( lastMedal1.Len < curLen && endMedal1.Len >= curLen )
{
preMedal = lastMedal1;
nextMedal = endMedal1;
// Debug.Log("ÄãºÃ");
break;
}
if ( endMedal1.Len <= curLen && i == _medals.Count - 2 )
{
preMedal = endMedal1;
nextMedal = null;
break;
}
}
// if ( _medals[0].Len > curLen )
// {
// nextMedal = _medals[0];
// }
// if ( _medals[_medals.Count - 1].Len < curLen )
// {
// preMedal = _medals[_medals.Count - 1];
// }
if ( preMedal == null )
{
//0-1
curScore = nextMedal.Point * curLen / nextMedal.Len;
}
else if ( nextMedal == null )
{
//max
// Debug.LogError("max!!");
curScore = preMedal.Point+0.01f;
}
else
{
//center
var score = nextMedal.Point - preMedal.Point;
var len = nextMedal.Len - preMedal.Len;
curScore = preMedal.Point + score * ( curLen - preMedal.Len ) / len;
}
return curScore;
}
public float GetLenByPoint(float curScore)
{
Medal preMedal = null;
Medal nextMedal = null;
float curLen = 0f;
for ( int i = 0; i < _medals.Count - 1; i++ )
{
var lastMedal1 = _medals[i];
var endMedal1 = _medals[i + 1];
if ( lastMedal1.Point>= curScore && i == 0 )
{
preMedal = null;
nextMedal = endMedal1;
break;
}
if ( lastMedal1.Point < curScore && endMedal1.Point >= curScore )
{
preMedal = lastMedal1;
nextMedal = endMedal1;
break;
}
if ( endMedal1.Point <= curScore && i == _medals.Count - 2 )
{
preMedal = endMedal1;
nextMedal = null;
break;
}
}
// _medals[curMedalIndex + 1].CreateMedal();
// _medals[curMedalIndex + 2].CreateMedal();
//
// if ( _medals[0].Point >= curScore )
// {
// nextMedal = _medals[0];
// }
// if ( _medals[_medals.Count - 1].Point <= curScore )
// {
// preMedal = _medals[_medals.Count - 1];
// }
if ( preMedal == null )
{
//0-1
curLen = nextMedal.Len * curScore / nextMedal.Point;
}
else if ( nextMedal == null )
{
//max
// Debug.LogError("max!!");
curLen = preMedal.Len+0.1f;
}
else
{
//center
var score = nextMedal.Point - preMedal.Point;
var len = nextMedal.Len - preMedal.Len;
curLen=preMedal.Len + len * ( curScore - preMedal.Point ) / score;
}
return curLen;
}
public void CheckIfTouchScore(float curLen)
{
if ( curLen >= _medals[curMedalIndex].Len-0.01f )
{
_medals[curMedalIndex].ActivateVFX();
curMedalIndex++;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e54eaf0e5f4df484db213add7835bd0c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,13 @@
using TMPro;
using UnityEngine;
public class PiercingInfo : MonoBehaviour
{
public GameObject[] fxInfo;
public TMP_Text[] textBlood;
public void Show(int index)
{
fxInfo[0].SetActive(false);
for (int i = 0; i < fxInfo.Length; i++) { fxInfo[i].SetActive(i == index); }
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 76f49d62b028473409f44ec641074b24
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: