316 lines
6.4 KiB
C#
316 lines
6.4 KiB
C#
using System;
|
|
using System.Text;
|
|
using UnityEngine;
|
|
|
|
namespace NBF
|
|
{
|
|
[Serializable]
|
|
public class FPlayerData
|
|
{
|
|
public int PlayerID;
|
|
|
|
/// <summary>
|
|
/// 玩家当前装备的钓组
|
|
/// </summary>
|
|
public FPlayerGearData currentGear;
|
|
|
|
/// <summary>
|
|
/// 玩家位置
|
|
/// </summary>
|
|
public Vector3 position;
|
|
|
|
/// <summary>
|
|
/// 玩家角度
|
|
/// </summary>
|
|
public Quaternion rotation;
|
|
|
|
public float currentReelingSpeed;
|
|
public bool isHandOnHandle;
|
|
|
|
/// <summary>
|
|
/// 线长度
|
|
/// </summary>
|
|
public float lineLength;
|
|
|
|
/// <summary>
|
|
/// 收线速度
|
|
/// </summary>
|
|
public float reelSpeed;
|
|
|
|
/// <summary>
|
|
/// 打开手电筒
|
|
/// </summary>
|
|
public bool openLight;
|
|
|
|
/// <summary>
|
|
/// 打开望远镜
|
|
/// </summary>
|
|
public bool openTelescope;
|
|
|
|
|
|
public SelectorRodSetting selectorRodSetting = SelectorRodSetting.Speed;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 玩家钓组数据
|
|
/// </summary>
|
|
[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;
|
|
|
|
/// <summary>
|
|
/// 获得唯一id
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
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
|
|
{
|
|
/// <summary>
|
|
/// 唯一id
|
|
/// </summary>
|
|
public int id;
|
|
|
|
/// <summary>
|
|
/// 配置id
|
|
/// </summary>
|
|
public int configId;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 鱼竿数据
|
|
/// </summary>
|
|
[Serializable]
|
|
public class FRodData : FGearData
|
|
{
|
|
private GameRods _config;
|
|
|
|
public GameRods Config
|
|
{
|
|
get { return _config ??= GameRods.Get(configId); }
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 线轴数据
|
|
/// </summary>
|
|
[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;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 浮漂数据
|
|
/// </summary>
|
|
[Serializable]
|
|
public class FBobberData : FGearData
|
|
{
|
|
private GameFloats _config;
|
|
|
|
public GameFloats Config
|
|
{
|
|
get { return _config ??= GameFloats.Get(configId); }
|
|
}
|
|
|
|
public float lastSetGroundValue;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 鱼钩数据
|
|
/// </summary>
|
|
[Serializable]
|
|
public class FHookData : FGearData
|
|
{
|
|
private GameHooks _config;
|
|
|
|
public GameHooks Config
|
|
{
|
|
get { return _config ??= GameHooks.Get(configId); }
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 鱼饵数据
|
|
/// </summary>
|
|
[Serializable]
|
|
public class FBaitData : FGearData
|
|
{
|
|
private GameBaits _config;
|
|
|
|
public GameBaits Config
|
|
{
|
|
get { return _config ??= GameBaits.Get(configId); }
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 鱼饵数据
|
|
/// </summary>
|
|
[Serializable]
|
|
public class FLureData : FGearData
|
|
{
|
|
private GameLures _config;
|
|
|
|
public GameLures Config
|
|
{
|
|
get { return _config ??= GameLures.Get(configId); }
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 沉子数据
|
|
/// </summary>
|
|
[Serializable]
|
|
public class FWeightData : FGearData
|
|
{
|
|
private GameWeights _config;
|
|
|
|
public GameWeights Config
|
|
{
|
|
get { return _config ??= GameWeights.Get(configId); }
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 线数据
|
|
/// </summary>
|
|
[Serializable]
|
|
public class FLineData : FGearData
|
|
{
|
|
private GameLines _config;
|
|
|
|
public GameLines Config
|
|
{
|
|
get { return _config ??= GameLines.Get(configId); }
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 引线数据
|
|
/// </summary>
|
|
[Serializable]
|
|
public class FLeaderData : FGearData
|
|
{
|
|
private GameLeaders _config;
|
|
|
|
public GameLeaders Config
|
|
{
|
|
get { return _config ??= GameLeaders.Get(configId); }
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 菲德数据
|
|
/// </summary>
|
|
[Serializable]
|
|
public class FFeederData : FGearData
|
|
{
|
|
private GameFeeders _config;
|
|
|
|
public GameFeeders Config
|
|
{
|
|
get { return _config ??= GameFeeders.Get(configId); }
|
|
}
|
|
}
|
|
} |