备份CatanBuilding瘦身独立工程
This commit is contained in:
258
Assets/Scripts/GampPlay/FishingB/FishingData.cs
Normal file
258
Assets/Scripts/GampPlay/FishingB/FishingData.cs
Normal file
@@ -0,0 +1,258 @@
|
||||
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 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 FishDash DashStay;
|
||||
public FishStruggle FishStruggle;
|
||||
public FishJump FishJump;
|
||||
public float NextPointNearDistance;
|
||||
public float NextPointFarDistance;
|
||||
//等鱼上钩
|
||||
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;
|
||||
public SupplyDropCtrl 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 bool IsRetry = false;
|
||||
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;
|
||||
}
|
||||
|
||||
public bool IsEact()
|
||||
{
|
||||
return fishEatDataList.Count > 0;
|
||||
}
|
||||
|
||||
//相机相关 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 float FishSkillIncPerform;
|
||||
public float FishSkillDecPerform;
|
||||
public float FishSkillPerformSpeed;//鱼技能表现张力系数
|
||||
public float FishSkillPerformBack;//鱼技能表现张力系数
|
||||
public void SetFishSkillPerformSpeed(float p)
|
||||
{
|
||||
FishSkillPerformSpeed = FishSkillIncPerform + (1 - FishSkillIncPerform) * p;
|
||||
FishSkillPerformBack = FishSkillDecPerform + (1 - FishSkillDecPerform) * p;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
FishingRetryPowerReduction = 1;
|
||||
FishingRetryEscapeReduction = 1;
|
||||
FishingRetryHPReduction = 1;
|
||||
fishItem = null;
|
||||
NewItemID = 0;
|
||||
fixedFishList = null;
|
||||
IsRetry = false;
|
||||
AudioRewardFish = null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user