using System; using System.Text; using UnityEngine; namespace NBF { [Serializable] public class FPlayerData { public int PlayerID; /// /// 玩家当前装备的钓组 /// public FPlayerGearData currentGear; /// /// 玩家位置 /// public Vector3 position; /// /// 玩家角度 /// public Quaternion rotation; public float currentReelingSpeed; public bool isHandOnHandle; /// /// 线长度 /// public float lineLength; /// /// 收线速度 /// public float reelSpeed; /// /// 打开手电筒 /// public bool openLight; /// /// 打开望远镜 /// public bool openTelescope; /// /// 当前状态 /// public uint state; public float lineCutTimer = 0; public SelectorRodSetting selectorRodSetting = SelectorRodSetting.Speed; } /// /// 玩家钓组数据 /// [Serializable] public class FPlayerGearData { public GearType Type = GearType.Spinning; public FRodData rod; public FReelData reel; public FBobberData bobber; public FHookData hook; public FBaitData bait; public FLureData lure; public FWeightData weight; public FLineData line; public FLeaderData leader; public FFeederData feeder; /// /// 获得唯一id /// /// public int GetUnitId() { int result = 0; if (rod != null) { result += rod.configId; } if (reel != null) { result += reel.configId; } if (bobber != null) { result += bobber.configId; } if (hook != null) { result += hook.configId; } if (bait != null) { result += bait.configId; } if (lure != null) { result += lure.configId; } if (weight != null) { result += weight.configId; } if (line != null) { result += line.configId; } if (leader != null) { result += leader.configId; } if (feeder != null) { result += feeder.configId; } return result; } public void SetBobberLastSetGroundValue(float value) { bobber.lastSetGroundValue = value; } public void SetReelSettings(int setType, float val, bool saveToPrefs = false) { if (setType == 0) { reel.currentSpeed = val; } if (setType == 1) { reel.currentDrag = val; } if (saveToPrefs) { // Instance._playerData.SaveEquipment(ItemType.Reel); } } } [Serializable] public abstract class FGearData { /// /// 唯一id /// public int id; /// /// 配置id /// public int configId; } /// /// 鱼竿数据 /// [Serializable] public class FRodData : FGearData { private GameRods _config; public GameRods Config { get { return _config ??= GameRods.Get(configId); } } } /// /// 线轴数据 /// [Serializable] public class FReelData : FGearData { private GameReels _config; public GameReels Config { get { return _config ??= GameReels.Get(configId); } } public float currentSpeed = 0.5f; public float currentDrag = 0.7f; } /// /// 浮漂数据 /// [Serializable] public class FBobberData : FGearData { private GameFloats _config; public GameFloats Config { get { return _config ??= GameFloats.Get(configId); } } public float lastSetGroundValue; } /// /// 鱼钩数据 /// [Serializable] public class FHookData : FGearData { private GameHooks _config; public GameHooks Config { get { return _config ??= GameHooks.Get(configId); } } } /// /// 鱼饵数据 /// [Serializable] public class FBaitData : FGearData { private GameBaits _config; public GameBaits Config { get { return _config ??= GameBaits.Get(configId); } } } /// /// 鱼饵数据 /// [Serializable] public class FLureData : FGearData { private GameLures _config; public GameLures Config { get { return _config ??= GameLures.Get(configId); } } } /// /// 沉子数据 /// [Serializable] public class FWeightData : FGearData { private GameWeights _config; public GameWeights Config { get { return _config ??= GameWeights.Get(configId); } } } /// /// 线数据 /// [Serializable] public class FLineData : FGearData { private GameLines _config; public GameLines Config { get { return _config ??= GameLines.Get(configId); } } } /// /// 引线数据 /// [Serializable] public class FLeaderData : FGearData { private GameLeaders _config; public GameLeaders Config { get { return _config ??= GameLeaders.Get(configId); } } } /// /// 菲德数据 /// [Serializable] public class FFeederData : FGearData { private GameFeeders _config; public GameFeeders Config { get { return _config ??= GameFeeders.Get(configId); } } } }