调整目录结构
This commit is contained in:
3
Assets/Scripts/Fishing2/Data/Move.meta
Normal file
3
Assets/Scripts/Fishing2/Data/Move.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3313ff0be8cf4611891770497b258bcd
|
||||
timeCreated: 1756115138
|
||||
9
Assets/Scripts/Fishing2/Data/Move/MoveComponent.cs
Normal file
9
Assets/Scripts/Fishing2/Data/Move/MoveComponent.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using NBC.Entitas;
|
||||
|
||||
namespace NBF.Fishing2
|
||||
{
|
||||
public class MoveComponent : Entity
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Fishing2/Data/Move/MoveComponent.cs.meta
Normal file
3
Assets/Scripts/Fishing2/Data/Move/MoveComponent.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 660d750ed1f74128a55bbb574d772af4
|
||||
timeCreated: 1756115969
|
||||
3
Assets/Scripts/Fishing2/Data/System.meta
Normal file
3
Assets/Scripts/Fishing2/Data/System.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e7f0c94a8514f5fa23bcc283e7abdc4
|
||||
timeCreated: 1756049392
|
||||
43
Assets/Scripts/Fishing2/Data/System/MapSystem.cs
Normal file
43
Assets/Scripts/Fishing2/Data/System/MapSystem.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System.Collections.Generic;
|
||||
using NBC;
|
||||
|
||||
namespace NBF.Fishing2
|
||||
{
|
||||
public static class MapSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取一个单位
|
||||
/// </summary>
|
||||
/// <param name="self"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public static Unit GetUnit(this Map self, long id)
|
||||
{
|
||||
return self.Units.GetValueOrDefault(id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 进入地图
|
||||
/// </summary>
|
||||
/// <param name="map"></param>
|
||||
/// <param name="unit"></param>
|
||||
/// <returns></returns>
|
||||
public static async FTask<bool> Enter(this Map map, Unit unit)
|
||||
{
|
||||
await FTask.CompletedTask;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 离开地图
|
||||
/// </summary>
|
||||
/// <param name="self"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public static async FTask<bool> Exit(this Map self, long id)
|
||||
{
|
||||
await FTask.CompletedTask;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Fishing2/Data/System/MapSystem.cs.meta
Normal file
3
Assets/Scripts/Fishing2/Data/System/MapSystem.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e4715bc722c4438ae8603fab6232e81
|
||||
timeCreated: 1756049567
|
||||
28
Assets/Scripts/Fishing2/Data/System/UnitSystem.cs
Normal file
28
Assets/Scripts/Fishing2/Data/System/UnitSystem.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using NBC;
|
||||
|
||||
namespace NBF.Fishing2
|
||||
{
|
||||
public static class UnitSystem
|
||||
{
|
||||
public static void SetUnitInfo(this Unit self, MapUnitInfo unitInfo)
|
||||
{
|
||||
NumericComponent numericComponent = self.AddComponent<NumericComponent>();
|
||||
foreach (var kv in unitInfo.KV)
|
||||
{
|
||||
numericComponent.Set(kv.Key, kv.Value);
|
||||
}
|
||||
}
|
||||
|
||||
public static UnitConfig Config(this Unit self)
|
||||
{
|
||||
return UnitConfig.Get(self.ConfigId);
|
||||
}
|
||||
|
||||
public static UnitType Type(this Unit self)
|
||||
{
|
||||
return self.Config().Type;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Fishing2/Data/System/UnitSystem.cs.meta
Normal file
3
Assets/Scripts/Fishing2/Data/System/UnitSystem.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1e34ab621bcb45b1af37fca0b06878bb
|
||||
timeCreated: 1756049584
|
||||
3
Assets/Scripts/Fishing2/Data/Unit.meta
Normal file
3
Assets/Scripts/Fishing2/Data/Unit.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1fb0ee12d9cf40408478e8f9ad9aafdd
|
||||
timeCreated: 1755915944
|
||||
3
Assets/Scripts/Fishing2/Data/Unit/Gear.meta
Normal file
3
Assets/Scripts/Fishing2/Data/Unit/Gear.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 70bbe8d6e0c04cdaa553cacaee37fe59
|
||||
timeCreated: 1755921259
|
||||
3
Assets/Scripts/Fishing2/Data/Unit/Gear/Child.meta
Normal file
3
Assets/Scripts/Fishing2/Data/Unit/Gear/Child.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 629d828f3fc74ce78482025124c31f85
|
||||
timeCreated: 1756047176
|
||||
@@ -0,0 +1,9 @@
|
||||
using NBC.Entitas;
|
||||
|
||||
namespace NBF.Fishing2
|
||||
{
|
||||
public class GearBaitComponent : Entity
|
||||
{
|
||||
public int ConfigId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ee9d5fa0951c490fafb108bfb3e1d496
|
||||
timeCreated: 1756047193
|
||||
@@ -0,0 +1,9 @@
|
||||
using NBC.Entitas;
|
||||
|
||||
namespace NBF.Fishing2
|
||||
{
|
||||
public class GearBobberComponent : Entity
|
||||
{
|
||||
public int ConfigId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3f772262a6ee45ebaa276d716c191ddd
|
||||
timeCreated: 1756047151
|
||||
@@ -0,0 +1,9 @@
|
||||
using NBC.Entitas;
|
||||
|
||||
namespace NBF.Fishing2
|
||||
{
|
||||
public class GearHookComponent : Entity
|
||||
{
|
||||
public int ConfigId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 601122a982d048789ee9131376c72158
|
||||
timeCreated: 1756047164
|
||||
@@ -0,0 +1,9 @@
|
||||
using NBC.Entitas;
|
||||
|
||||
namespace NBF.Fishing2
|
||||
{
|
||||
public class GearLineComponent : Entity
|
||||
{
|
||||
public int ConfigId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3e1209cd4f4242c2af9fbfbbb7480f6b
|
||||
timeCreated: 1756047232
|
||||
@@ -0,0 +1,9 @@
|
||||
using NBC.Entitas;
|
||||
|
||||
namespace NBF.Fishing2
|
||||
{
|
||||
public class GearLureComponent : Entity
|
||||
{
|
||||
public int ConfigId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5537f49777ef40f0adeb36bb7687356d
|
||||
timeCreated: 1756047207
|
||||
@@ -0,0 +1,9 @@
|
||||
using NBC.Entitas;
|
||||
|
||||
namespace NBF.Fishing2
|
||||
{
|
||||
public class GearReelComponent : Entity
|
||||
{
|
||||
public int ConfigId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 60c6ee2c8c084dd29267b0653a1a239d
|
||||
timeCreated: 1756047139
|
||||
@@ -0,0 +1,9 @@
|
||||
using NBC.Entitas;
|
||||
|
||||
namespace NBF.Fishing2
|
||||
{
|
||||
public class GearRodComponent : Entity
|
||||
{
|
||||
public int ConfigId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8a353dda940c4dd9bddcf7420d1c2108
|
||||
timeCreated: 1756047099
|
||||
@@ -0,0 +1,9 @@
|
||||
using NBC.Entitas;
|
||||
|
||||
namespace NBF.Fishing2
|
||||
{
|
||||
public class GearWeightComponent : Entity
|
||||
{
|
||||
public int ConfigId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 82411b517dd84b9ca7839a4ddb486a66
|
||||
timeCreated: 1756047222
|
||||
26
Assets/Scripts/Fishing2/Data/Unit/Gear/UnitGearComponent.cs
Normal file
26
Assets/Scripts/Fishing2/Data/Unit/Gear/UnitGearComponent.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using NBC;
|
||||
using NBC.Entitas;
|
||||
|
||||
namespace NBF.Fishing2
|
||||
{
|
||||
/// <summary>
|
||||
/// 钓组组件
|
||||
/// </summary>
|
||||
public class UnitGearComponent : Entity
|
||||
{
|
||||
/// <summary>
|
||||
/// 线长度
|
||||
/// </summary>
|
||||
public float LineLength { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 旋转速度
|
||||
/// </summary>
|
||||
public float ReelSpeed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 鱼竿设置
|
||||
/// </summary>
|
||||
public int RedSetting { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c9a70a1145b41e2ad6c57384d7c922c
|
||||
timeCreated: 1755921173
|
||||
3
Assets/Scripts/Fishing2/Data/Unit/Parts.meta
Normal file
3
Assets/Scripts/Fishing2/Data/Unit/Parts.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f63b5a4df9be4d1c839c3c1cc56c1275
|
||||
timeCreated: 1756048419
|
||||
@@ -0,0 +1,15 @@
|
||||
using NBC.Entitas;
|
||||
|
||||
namespace NBF.Fishing2
|
||||
{
|
||||
/// <summary>
|
||||
/// 手电筒组件
|
||||
/// </summary>
|
||||
public class UnitFlashlightComponent : Entity
|
||||
{
|
||||
/// <summary>
|
||||
/// 打开手电筒
|
||||
/// </summary>
|
||||
public bool OpenLight { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5f151cee0d5f43ff90c3aa013214b1ea
|
||||
timeCreated: 1756048476
|
||||
3
Assets/Scripts/Fishing2/Data/Unit/Skin.meta
Normal file
3
Assets/Scripts/Fishing2/Data/Unit/Skin.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0f655e37e9dd4b5885e127f44e01100d
|
||||
timeCreated: 1756048586
|
||||
11
Assets/Scripts/Fishing2/Data/Unit/Skin/UnitSkinComponent.cs
Normal file
11
Assets/Scripts/Fishing2/Data/Unit/Skin/UnitSkinComponent.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using NBC.Entitas;
|
||||
|
||||
namespace NBF.Fishing2
|
||||
{
|
||||
/// <summary>
|
||||
/// Unity皮肤组件
|
||||
/// </summary>
|
||||
public class UnitSkinComponent : Entity
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 40c5cce71c8443aa82ea4108e72c887b
|
||||
timeCreated: 1756048599
|
||||
65
Assets/Scripts/Fishing2/Data/Unit/Unit.cs
Normal file
65
Assets/Scripts/Fishing2/Data/Unit/Unit.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using NBC;
|
||||
using NBC.Entitas;
|
||||
using Unity.Mathematics;
|
||||
|
||||
namespace NBF.Fishing2
|
||||
{
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
public class Unit : Entity
|
||||
{
|
||||
public int ConfigId { get; set; } //配置表id
|
||||
|
||||
private float3 position; //坐标
|
||||
|
||||
public float3 Position
|
||||
{
|
||||
get => position;
|
||||
set
|
||||
{
|
||||
float3 oldPos = position;
|
||||
position = value;
|
||||
Scene.EventComponent.Publish(new ChangePosition() { Unit = this, OldPos = oldPos });
|
||||
}
|
||||
}
|
||||
|
||||
public float3 Forward
|
||||
{
|
||||
get => math.mul(Rotation, math.forward());
|
||||
set => Rotation = quaternion.LookRotation(value, math.up());
|
||||
}
|
||||
|
||||
private quaternion rotation;
|
||||
|
||||
public quaternion Rotation
|
||||
{
|
||||
get => rotation;
|
||||
set
|
||||
{
|
||||
rotation = value;
|
||||
Scene.EventComponent.Publish(new ChangeRotation() { Unit = this });
|
||||
}
|
||||
}
|
||||
|
||||
public uint State { get; set; }
|
||||
public string StateArgs { get; set; }
|
||||
|
||||
public void ChangeState(uint state, string args)
|
||||
{
|
||||
Scene.EventComponent.Publish(new ChangeState() { Unit = this, State = state, Args = args });
|
||||
}
|
||||
|
||||
|
||||
#region 静态
|
||||
|
||||
public static Unit Create(Map map, MapUnitInfo unitInfo, bool isMainPlayer = false)
|
||||
{
|
||||
var unit = Entity.Create<Unit>(map.Scene, true, true);
|
||||
unit.SetUnitInfo(unitInfo);
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Fishing2/Data/Unit/Unit.cs.meta
Normal file
3
Assets/Scripts/Fishing2/Data/Unit/Unit.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ff176fc098254fe2a1b48ea26eaf8857
|
||||
timeCreated: 1755915448
|
||||
9
Assets/Scripts/Fishing2/Data/Unit/UnitBasic.cs
Normal file
9
Assets/Scripts/Fishing2/Data/Unit/UnitBasic.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using NBC.Entitas;
|
||||
|
||||
namespace NBF.Fishing2
|
||||
{
|
||||
public class UnitBasic : Entity
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Fishing2/Data/Unit/UnitBasic.cs.meta
Normal file
3
Assets/Scripts/Fishing2/Data/Unit/UnitBasic.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 19299372f58c4c1db612f36ce60ee238
|
||||
timeCreated: 1756116063
|
||||
22
Assets/Scripts/Fishing2/Data/Unit/UnitEventType.cs
Normal file
22
Assets/Scripts/Fishing2/Data/Unit/UnitEventType.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Unity.Mathematics;
|
||||
|
||||
namespace NBF.Fishing2
|
||||
{
|
||||
public struct ChangePosition
|
||||
{
|
||||
public Unit Unit;
|
||||
public float3 OldPos;
|
||||
}
|
||||
|
||||
public struct ChangeRotation
|
||||
{
|
||||
public Unit Unit;
|
||||
}
|
||||
|
||||
public struct ChangeState
|
||||
{
|
||||
public Unit Unit;
|
||||
public uint State;
|
||||
public string Args;
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Fishing2/Data/Unit/UnitEventType.cs.meta
Normal file
3
Assets/Scripts/Fishing2/Data/Unit/UnitEventType.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cd2dd8a7207544b19be4b51b2a6ef215
|
||||
timeCreated: 1755915609
|
||||
33
Assets/Scripts/Fishing2/Data/Unit/UnitStateArgs.cs
Normal file
33
Assets/Scripts/Fishing2/Data/Unit/UnitStateArgs.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
namespace NBF.Fishing2
|
||||
{
|
||||
public class UnitStateArgsFactory
|
||||
{
|
||||
public static UnitStateArgs Create(Unit unit, string[] args)
|
||||
{
|
||||
UnitStateArgs ret = null;
|
||||
// return new UnitStateArgs()
|
||||
// {
|
||||
//
|
||||
// }
|
||||
if (ret != null)
|
||||
{
|
||||
ret.SetArgs(args);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class UnitStateArgs
|
||||
{
|
||||
protected string[] Args;
|
||||
|
||||
public void SetArgs(string[] args)
|
||||
{
|
||||
Args = args;
|
||||
OnParseArgs();
|
||||
}
|
||||
|
||||
public abstract void OnParseArgs();
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Fishing2/Data/Unit/UnitStateArgs.cs.meta
Normal file
3
Assets/Scripts/Fishing2/Data/Unit/UnitStateArgs.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6afa60e6892f49d0aed14024432ab10d
|
||||
timeCreated: 1755917036
|
||||
Reference in New Issue
Block a user