Files
MinFt/Client/Assets/Scripts/GampPlay/FishingB/FishingData.cs
2026-04-27 12:07:32 +08:00

273 lines
7.9 KiB
C#

using asap.core;
using cfg;
using GameCore;
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AddressableAssets;
public class FishingData
{
public FishingBehaviorConf fishingBehaviorConf { private set; get; }
cfg.Tables _tables;
// 是否正在遛鱼
public bool IsDrawing;
// 是否正在抓鱼
public bool IsCatchingFish;
// 是否抓到鱼了
public bool IsCaughtFish;
// 是否弹出奖励界面
public bool IsShowRewardPanel;
//public bool AutomaticFishing;
public MapData curMapData;
public int MapId;
public FishData curFishData;
public FixedFishList fixedFishList;
public FishData swimFishData;
public int RodId;
public RodData fishRodData;
public Item fishItem;
//吃鱼相关
public Item swimItem;
//吃鱼序列
public List<FishData> fishEatDataList;
public float fishWeight { get; set; }
public float random { get; set; }
public int CardLevel { get; set; }
public float EventFishDamageMag { get; set; }
public float CardDamageMag { get; set; }
public float WeightIncEvent { get; set; }
public float StrugglingPower { get; set; }//鱼的力量
public float FishingRetryPowerReduction { get; set; } = 1;
public float FishingRetryEscapeReduction { get; set; } = 1;
public float FishEscapeSpeedDec { get; set; } = 0;
public float FishingRetryHPReduction { get; set; } = 1;
public float Speed { get; set; }//鱼的速度
public float Vigilance { get; set; }//鱼的警惕性
public float MaxLinelength;
public float MaxZEscape;
public float MaxYEscape;
public float DashStayTime;
public int FishSkillStaminaState = 0;
public float FishSkillStaminaParam = 0;
public FishDash DashStay;
public FishStruggle FishStruggle;
public FishJump FishJump;
public float NextPointMin;
public float NextPointMax;
public float NextPointEMin;
public float NextPointEMax;
public IFishSpSkillData fishSpSkillData;
public SuperDashSpSkillData superDashSpSkillData;
public DirtyStuckSpSkillData dirtyStuckSpSkillData;
//等鱼上钩
public float EnhancedWaitingTime;
public float ExtraUnderwaterOffset;
public bool isWeather = false;
public int NewItemID = 0;
public int NewIndex = 0;
//public float ClickFishFlapping = 1f;
//public float BottleOpenDelay = 1.95f;
//public float FishFlapping = 3.05f;
//钓鱼结果
public FishingResult fishingResult = FishingResult.Success;
public float FishSpeed; //鱼的速度对移动速度的影响
public List<float> StrengthToScale { get; set; }
public float FishVigilanceToTime { get; set; }
public float RodVigilanceToTime { get; set; }
//目标奖励活动相关
public Vector3 image_extra_pos { set; get; }
public int addCollecting { set; get; }
//目标奖励活动相关
public Transform mainCamera;
public Quaternion startEuler;
public float startTimer;
public float endTimer;
//ui吃鱼的血量比
public float UIEatHpPercent = -1;
//目标奖励活动Buff相关
public bool isMapBuff = false;
public bool isAddTargetBuff;
public bool isAddPiggyBank;
public bool isAddBarginPack;
// [REMOVED] SupplyDropCtrl type no longer exists
// public SupplyDropCtrl supplyDropCtrl;
public object supplyDropCtrl;
public bool IsHideRod => supplyDropCtrl != null || isAddTargetBuff || isAddPiggyBank || isAddBarginPack;
public bool isAwaitTargetBuff;
public bool isShowTargetPanel;
public int jerking_count = 0;
public int stickle_state = 0;
public float FishAnimSpeed = 1;
public bool IsFree = false;
public bool IsDuel = false;
public int RetryCount { get; private set; }
public bool IsRetry
{
get { return RetryCount > 0; }
set
{
if (value)
{
RetryCount++;
}
else
{
RetryCount = 0;
}
Debug.Log($"IsRetry set to {value}, RetryCount is now {RetryCount}");
}
}
public int retry_ways = 0;
//特殊技能结算音效
public string AudioRewardFish;
public DateTime LastCastingTime;
public int rodType;
public async System.Threading.Tasks.Task Init()
{
fishingBehaviorConf = (FishingBehaviorConf)(await Addressables.LoadAssetAsync<object>("FishingBehaviorConf").Task);
_tables = GContext.container.Resolve<cfg.Tables>();
}
public void SetRodData(RodData fishRodData)
{
this.fishRodData = fishRodData;
RodId = fishRodData.ID;
}
public void ChangeFishData(FishData curFishData)
{
this.curFishData = curFishData;
}
public float HoldThreshold()
{
if (fishRodData != null)
{
return fishRodData.HoldThreshold;
}
if (fishRodData != null)
{
return fishRodData.HoldThreshold;
}
return 0;
}
public bool IsNewItemFish()
{
//return NewItemID == fishItem.ID;
return fishItem.Quality > 5;
}
public bool IsEventGameFish()
{
return fishItem.SubType == 11 || fishItem.SubType == 12;
}
public bool IsGeneralFish()
{
return fishItem.SubType == 1;
}
public bool IsKeepsakeFish()
{
return fishItem.SubType == 4;
}
public bool IsPiggyBankFish()
{
return fishItem.SubType == 22;
}
public bool IsBarginPackFish()
{
return fishItem.SubType == 21;
}
public bool IsPackItemFish()
{
return fishItem.SubType == 21 || fishItem.SubType == 22;
}
public List<float> SwimmingAreaX()
{
return curMapData.SwimmingAreaX;
}
public List<float> SwimmingAreaZ()
{
return curMapData.SwimmingAreaZ;
}
public float CameraMaxAngle()
{
return curMapData.CameraMaxAngle;
}
public float FishMaxAngle()
{
return curMapData.FishMaxAngle;
}
//相机相关 SetCamera
public void SetCamera(Transform camera)
{
mainCamera = camera;
camera.localEulerAngles = new Vector3(0, 0, 0);
startEuler = camera.localRotation;
}
public float GetFishingTimer()
{
return endTimer - startTimer;
}
public void StopAuto()
{
GContext.Publish(new StopAutoEvent() { IsDrawing = IsDrawing });
}
public void InitEatHp()
{
UIEatHpPercent = -1;
var fixedFishList = _tables.TbFixedFishList.GetOrDefault(GContext.container.Resolve<PlayerFishData>().GetAnglingCount() + 1);
if (fixedFishList != null && fixedFishList.EatFishType != 0)
{
if (fixedFishList.EatFishType == 1)
{
UIEatHpPercent = fixedFishList.UIEatHpPercent;
}
}
else
{
var EatFishData = _tables.TbFishEatFish.GetOrDefault(swimFishData.EatFishID);
UIEatHpPercent = UnityEngine.Random.Range(0, 1f);
if (EatFishData != null && EatFishData.EatWeight > 0)
{
int weight = EatFishData.UIEatWeight + EatFishData.EatWeight;
int w = UnityEngine.Random.Range(0, weight);
if (w < EatFishData.UIEatWeight)
{
UIEatHpPercent = UnityEngine.Random.Range(EatFishData.UIEatHpPercent[0], EatFishData.UIEatHpPercent[1]);
}
else
{
UIEatHpPercent = -1;
}
}
}
}
public void Reset()
{
FishingRetryPowerReduction = 1;
FishingRetryEscapeReduction = 1;
FishingRetryHPReduction = 1;
fishItem = null;
NewItemID = 0;
fixedFishList = null;
IsRetry = false;
AudioRewardFish = null;
superDashSpSkillData = null;
dirtyStuckSpSkillData = null;
}
}