调整目录结构
This commit is contained in:
Binary file not shown.
@@ -1,3 +1,3 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: c8426c4b03da403284afe458076b9c10
|
guid: caf75b28905c41ab8e414e696c3423f9
|
||||||
timeCreated: 1742387508
|
timeCreated: 1756363998
|
||||||
8
Assets/Scripts/Common/Def/ErrorCode.cs
Normal file
8
Assets/Scripts/Common/Def/ErrorCode.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
namespace NBF
|
||||||
|
{
|
||||||
|
public class ErrorCode
|
||||||
|
{
|
||||||
|
public const int Success = 0;
|
||||||
|
public const int Error = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
3
Assets/Scripts/Common/Def/ErrorCode.cs.meta
Normal file
3
Assets/Scripts/Common/Def/ErrorCode.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 059e898abe0b45988f002ca7e6ff9540
|
||||||
|
timeCreated: 1756365454
|
||||||
78
Assets/Scripts/Common/Events.cs
Normal file
78
Assets/Scripts/Common/Events.cs
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
using NBF.Fishing2;
|
||||||
|
|
||||||
|
namespace NBF
|
||||||
|
{
|
||||||
|
public struct Wait_SceneChangeFinish : IWaitType
|
||||||
|
{
|
||||||
|
public int Error { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 开始切换场景
|
||||||
|
/// </summary>
|
||||||
|
public struct SceneChangeStart
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Loading进度变化
|
||||||
|
/// </summary>
|
||||||
|
public struct LoadingProgress
|
||||||
|
{
|
||||||
|
public float Progress { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 场景切换结束
|
||||||
|
/// </summary>
|
||||||
|
public struct SceneChangeFinish
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 是否首次切换场景
|
||||||
|
/// </summary>
|
||||||
|
public bool IsFirst { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 场景创建成功事件
|
||||||
|
/// </summary>
|
||||||
|
public struct AfterCreateCurrentScene
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 游戏启动成功事件
|
||||||
|
/// </summary>
|
||||||
|
public struct AppStartInitFinish
|
||||||
|
{
|
||||||
|
public bool IsRobot;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 登录完成
|
||||||
|
/// </summary>
|
||||||
|
public struct LoginFinish
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 进入地图成功
|
||||||
|
/// </summary>
|
||||||
|
public struct EnterMapFinish
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 角色创建完成
|
||||||
|
/// </summary>
|
||||||
|
public struct AfterUnitCreate
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 是否是主玩家
|
||||||
|
/// </summary>
|
||||||
|
public bool IsMainPlayer;
|
||||||
|
|
||||||
|
public Unit Unit;
|
||||||
|
// public UnitInfo UnitInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
3
Assets/Scripts/Common/Events.cs.meta
Normal file
3
Assets/Scripts/Common/Events.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9c1540ac905c4c4eb9486d66019e7485
|
||||||
|
timeCreated: 1756365591
|
||||||
@@ -43,7 +43,7 @@ public class SceneSettings : MonoBehaviour
|
|||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
// EnviroManager.instance.Time.Settings.simulate = true;
|
// EnviroManager.instance.Time.Settings.simulate = true;
|
||||||
EnviroManager.instance.Time.SetTimeOfDay(0.5f * 24f);
|
// EnviroManager.instance.Time.SetTimeOfDay(0.5f * 24f);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
@@ -80,12 +80,12 @@ public class SceneSettings : MonoBehaviour
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 场景时间
|
#region 场景时间
|
||||||
|
|
||||||
private void UpdateTimeOfDay()
|
private void UpdateTimeOfDay()
|
||||||
{
|
{
|
||||||
// var p = GameTimer.GetGameDayProgress();
|
// var p = GameTimer.GetGameDayProgress();
|
||||||
// Debug.Log(p);
|
// Debug.Log(p);
|
||||||
EnviroManager.instance.Time.SetTimeOfDay(GameTimer.GetGameDayProgress() * 24f);
|
// EnviroManager.instance.Time.SetTimeOfDay(GameTimer.GetGameDayProgress() * 24f);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: bd88d7e7b7f24428a3a67395265ba9b6
|
guid: 370fe07e6dd1446298721033a240b4fd
|
||||||
timeCreated: 1755792122
|
timeCreated: 1756363974
|
||||||
3
Assets/Scripts/Fishing2/Data.meta
Normal file
3
Assets/Scripts/Fishing2/Data.meta
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 67d5b3b1b06a4f60875ee66ec05d6205
|
||||||
|
timeCreated: 1756364079
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using NBC;
|
using NBC;
|
||||||
|
|
||||||
namespace NBF.Fishing2
|
namespace NBF.Fishing2
|
||||||
@@ -22,5 +22,7 @@ namespace NBF.Fishing2
|
|||||||
{
|
{
|
||||||
return self.Config().Type;
|
return self.Config().Type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using NBC.Entitas;
|
using NBC;
|
||||||
|
using NBC.Entitas;
|
||||||
using Unity.Mathematics;
|
using Unity.Mathematics;
|
||||||
|
|
||||||
namespace NBF.Fishing2
|
namespace NBF.Fishing2
|
||||||
@@ -48,5 +49,17 @@ namespace NBF.Fishing2
|
|||||||
{
|
{
|
||||||
Scene.EventComponent.Publish(new ChangeState() { Unit = this, State = state, Args = 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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 664b8188498e48b7875266cd768c4b23
|
|
||||||
timeCreated: 1756305288
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 3aca1b3b8c2e4ef38cb2c4e0759f5620
|
|
||||||
timeCreated: 1756305296
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 6ce24e5f59f2424faadee3d97e357365
|
|
||||||
timeCreated: 1756049282
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 958c7de8b9234f129e1ce439a961d540
|
|
||||||
timeCreated: 1756305421
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
namespace NBF.Fishing2
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 登录完成
|
|
||||||
/// </summary>
|
|
||||||
public struct LoginFinish
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: a85bf2f0e79b42caab50178c5b9c89e6
|
|
||||||
timeCreated: 1756132556
|
|
||||||
3
Assets/Scripts/Fishing2/Map.meta
Normal file
3
Assets/Scripts/Fishing2/Map.meta
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b9626380655a42298daf90e7333172ae
|
||||||
|
timeCreated: 1756363915
|
||||||
@@ -15,5 +15,7 @@ namespace NBF.Fishing2
|
|||||||
/// 地图中的单位
|
/// 地图中的单位
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Dictionary<long, Unit> Units = new Dictionary<long, Unit>();
|
public Dictionary<long, Unit> Units = new Dictionary<long, Unit>();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
18
Assets/Scripts/Fishing2/Map/Map2C_ChangeMapHandler.cs
Normal file
18
Assets/Scripts/Fishing2/Map/Map2C_ChangeMapHandler.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
using NBC;
|
||||||
|
using NBC.Network;
|
||||||
|
using NBC.Network.Interface;
|
||||||
|
using NBF.Fishing2;
|
||||||
|
|
||||||
|
namespace NBF
|
||||||
|
{
|
||||||
|
public class Map2C_ChangeMapHandler : Message<Map2C_ChangeMap>
|
||||||
|
{
|
||||||
|
protected override async FTask Run(Session session, Map2C_ChangeMap message)
|
||||||
|
{
|
||||||
|
Log.Info($"收到地图切换消息=={message.MapId}");
|
||||||
|
await MapHelper.LoadMap(message.MapId);
|
||||||
|
|
||||||
|
// await MapHelper.CreateRoomTest(message.MapId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
67
Assets/Scripts/Fishing2/Map/MapHelper.cs
Normal file
67
Assets/Scripts/Fishing2/Map/MapHelper.cs
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
using System;
|
||||||
|
using NBC;
|
||||||
|
|
||||||
|
namespace NBF.Fishing2
|
||||||
|
{
|
||||||
|
public static class MapHelper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 开始进入地图
|
||||||
|
/// </summary>
|
||||||
|
public static async FTask<int> EnterMap(int mapId, long roomId = 0)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var root = App.Main;
|
||||||
|
var response = (Map2C_EnterMapResponse)await Net.Call(new C2Map_EnterMapRequest()
|
||||||
|
{
|
||||||
|
MapId = mapId,
|
||||||
|
RoomId = roomId
|
||||||
|
});
|
||||||
|
Log.Info($"进入地图请求返回={response.ErrorCode}");
|
||||||
|
|
||||||
|
// 等待场景切换完成
|
||||||
|
await root.GetComponent<ObjectWait>().Wait<Wait_SceneChangeFinish>();
|
||||||
|
Log.Info($"等待场景切换结束");
|
||||||
|
await root.EventComponent.PublishAsync(new EnterMapFinish());
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Log.Error(e);
|
||||||
|
return ErrorCode.Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ErrorCode.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static async FTask LoadMap(int mapId)
|
||||||
|
{
|
||||||
|
LoadingPanel.Show();
|
||||||
|
var sceneName = "Map99";
|
||||||
|
//家族场景==
|
||||||
|
await SceneHelper.LoadScene(sceneName);
|
||||||
|
|
||||||
|
FishingPanel.Show();
|
||||||
|
|
||||||
|
// 通知等待场景切换的协程
|
||||||
|
App.Main.GetComponent<ObjectWait>().Notify(new Wait_SceneChangeFinish());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async FTask CreateRoomTest(int mapId)
|
||||||
|
{
|
||||||
|
// var roomResponse = (Map2C_CreateRoomResponse)await Net.Call(new C2Map_CreateRoomRequest()
|
||||||
|
// {
|
||||||
|
// MapId = mapId
|
||||||
|
// });
|
||||||
|
// Log.Info($"创建房间返回 Code={roomResponse.RoomCode} 房间玩家数量={roomResponse.Units.Count}");
|
||||||
|
//
|
||||||
|
// //执行进入房间
|
||||||
|
// var roomResponse2 = (G2C_EnterRoomResponse)await Net.Call(new C2G_EnterRoomRequest()
|
||||||
|
// {
|
||||||
|
// RoomCode = roomResponse.RoomCode
|
||||||
|
// });
|
||||||
|
// Log.Info($"进入房间返回 Code={roomResponse2.RoomCode} 房间玩家数量={roomResponse2.Units.Count}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
namespace NBF.Fishing2
|
namespace NBF.Fishing2
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 地图管理组件
|
||||||
|
/// </summary>
|
||||||
public class MapManageComponent : Entity
|
public class MapManageComponent : Entity
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
3
Assets/Scripts/Fishing2/Map/Scene.meta
Normal file
3
Assets/Scripts/Fishing2/Map/Scene.meta
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2f5c6349983b45b0bc48d4f30ef677ee
|
||||||
|
timeCreated: 1756367958
|
||||||
9
Assets/Scripts/Fishing2/Map/Scene/MapScene.cs
Normal file
9
Assets/Scripts/Fishing2/Map/Scene/MapScene.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
using NBC.Entitas;
|
||||||
|
|
||||||
|
namespace NBF.Fishing2
|
||||||
|
{
|
||||||
|
public class MapScene : Entity
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
3
Assets/Scripts/Fishing2/Map/Scene/MapScene.cs.meta
Normal file
3
Assets/Scripts/Fishing2/Map/Scene/MapScene.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f4087371950b45cb8eaa0933cfbd9bee
|
||||||
|
timeCreated: 1756365024
|
||||||
38
Assets/Scripts/Fishing2/Map/Scene/SceneHelper.cs
Normal file
38
Assets/Scripts/Fishing2/Map/Scene/SceneHelper.cs
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
using System;
|
||||||
|
using NBC;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
|
namespace NBF.Fishing2
|
||||||
|
{
|
||||||
|
public static class SceneHelper
|
||||||
|
{
|
||||||
|
public static async FTask LoadScene(string sceneName)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
App.Main.EventComponent.Publish(new SceneChangeStart());
|
||||||
|
LoadingPanel.Show();
|
||||||
|
var asyncOperation = SceneManager.LoadSceneAsync(sceneName);
|
||||||
|
if (asyncOperation == null) throw new Exception($"Scene not found,name={sceneName}");
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
App.Main.EventComponent.Publish(new LoadingProgress()
|
||||||
|
{
|
||||||
|
Progress = asyncOperation.progress
|
||||||
|
});
|
||||||
|
LoadingPanel.SetProgress(asyncOperation.progress);
|
||||||
|
// 等待0.5秒后执行下面的逻辑。
|
||||||
|
await App.Main.TimerComponent.Net.WaitAsync(500);
|
||||||
|
if (asyncOperation.isDone)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Log.Error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
3
Assets/Scripts/Fishing2/Map/Scene/SceneHelper.cs.meta
Normal file
3
Assets/Scripts/Fishing2/Map/Scene/SceneHelper.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d4a2e9c0ac6d4faabbec4bccdb7a2917
|
||||||
|
timeCreated: 1756367987
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user