进入地图相关内容

This commit is contained in:
2025-08-31 23:47:37 +08:00
parent b637e1723d
commit 1c0b272a6f
42 changed files with 242 additions and 64 deletions

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 7924ca863f4b4ce8a7018a42852431a6
timeCreated: 1756564816

View File

@@ -0,0 +1,12 @@
using NBC.Entitas;
namespace NBF.Fishing2
{
/// <summary>
/// 背包
/// </summary>
public class Bag : Entity
{
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 2176086bd28445acb23a458c20d016ab
timeCreated: 1756564836

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 2f5c6349983b45b0bc48d4f30ef677ee
timeCreated: 1756367958

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: e38c5ef195074b4bb7b7faea5020eb96
timeCreated: 1756565130

View File

@@ -0,0 +1,32 @@
using NBC;
using NBC.Entitas;
using NBC.Entitas.Interface;
namespace NBF.Fishing2
{
public class Role : Entity
{
public long RoomId { get; set; }
public RoleInfo Info { get; set; }
}
public static class RoleSystem
{
public class RoleDestroySystem : DestroySystem<Role>
{
protected override void Destroy(Role self)
{
self.RoomId = 0;
self.Info = null;
}
}
public static async FTask GetRoleInfo(this Role self)
{
var response = (Game2C_GetRoleInfoResponse)await Net.Call(new C2Game_GetRoleInfoRequest());
self.RoomId = response.RoomId;
self.Info = response.RoleInfo;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: e7bd45aa4474423cad46c65eeecc1a03
timeCreated: 1756565134

View File

@@ -19,7 +19,12 @@ namespace NBF.Fishing2
RoomId = roomId
});
Log.Info($"进入地图请求返回={response.ErrorCode}");
//如果有房间
if (roomId > 0)
{
//请求获取房间数据
}
// 等待场景切换完成
await root.GetComponent<ObjectWait>().Wait<Wait_SceneChangeFinish>();
Log.Info($"等待场景切换结束");
@@ -39,9 +44,11 @@ namespace NBF.Fishing2
{
LoadingPanel.Show();
var sceneName = "Map99";
//家族场景==
//加载场景==
await SceneHelper.LoadScene(sceneName);
var map = App.Main.AddComponent<Map>();
FishingPanel.Show();
// 通知等待场景切换的协程

View File

@@ -1,7 +1,10 @@
namespace NBF.Fishing2
{
public class UnitHelper
public static class UnitHelper
{
public static void InitUnit(this Unit self)
{
}
}
}

View File

@@ -130,16 +130,6 @@ namespace NBF
LoadData();
CommonTopPanel.Show();
LoginPanel.Show();
// FishingPanel.Show();
// PreviewPanel.Show();
// Fishing.Inst.Go(1);
// HomePanel.Show();
// ChatTestPanel.Show();
// SettingPanel.Show();
// //测试登录
// OnLoginButtonClick().Coroutine();
}
private void LoadData()

View File

@@ -3,6 +3,7 @@ using Assets.Scripts.Hotfix;
using NBC;
using NBC.Network;
using NBF.Fishing2;
using Newtonsoft.Json;
namespace NBF
{
@@ -12,9 +13,15 @@ namespace NBF
public static async FTask Login(string account)
{
var oldRole = App.Main.GetComponent<Role>();
if (oldRole != null)
{
App.Main.RemoveComponent<Role>();
}
_session = Net.CreateSession("127.0.0.1:20001");
_session.Scene.AddComponent<UnitUnityComponent>();
// _session.Scene.AddComponent<UnitUnityComponent>();
var acc = account;
@@ -51,8 +58,19 @@ namespace NBF
return;
}
var role = App.Main.AddComponent<Role>(loginResponse.RoleId);
Log.Debug($"登录到Gate服务器成功ErrorCode:{loginResponse.ErrorCode}");
await _session.Scene.EventComponent.PublishAsync(new ChangePosition());
await role.GetRoleInfo();
Log.Debug(
$"获取角色信息成功roleId={role.Id} Room={role.RoomId} RoleInfo={JsonConvert.SerializeObject(role.Info)}");
var mapId = role.Info.MapId;
if (mapId == 0)
{
Log.Warning("账号没有进入过地图,进入新手引导地图");
mapId = 99;
}
await MapHelper.EnterMap(mapId, role.RoomId);
}
}
}

View File

@@ -14,6 +14,8 @@ namespace NBF.Fishing2
scene.AddComponent<ObjectWait>();
scene.AddComponent<MapManageComponent>();
}
await FTask.CompletedTask;
}
}
}

View File

@@ -12,6 +12,8 @@ namespace NBF
UIObjectFactory.SetPackageItemExtension(FishingStateInfo.URL, typeof(FishingStateInfo));
UIObjectFactory.SetPackageItemExtension(InteractiveTag.URL, typeof(InteractiveTag));
UIObjectFactory.SetPackageItemExtension(FishingPower.URL, typeof(FishingPower));
UIObjectFactory.SetPackageItemExtension(FishingTeam.URL, typeof(FishingTeam));
UIObjectFactory.SetPackageItemExtension(TeamItem.URL, typeof(TeamItem));
}
}
}

View File

@@ -32,6 +32,8 @@ namespace NBF
public InteractiveTag Interactive;
[AutoFind(Name = "OperationTips")]
public GList OperationTips;
[AutoFind(Name = "Team")]
public FishingTeam Team;
public override string[] GetDependPackages(){ return new string[] {"Common"}; }
public static void Show(object param = null){ App.UI.OpenUI<FishingPanel>(param); }

View File

@@ -0,0 +1,33 @@
/**本脚本为自动生成每次生成会覆盖请勿手动修改生成插件文档及项目地址https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
using FairyGUI;
using FairyGUI.Utils;
using NBC;
namespace NBF
{
public partial class FishingTeam
{
public const string URL = "ui://682kb9n0o9ci1u";
public CommonInput TeamInput;
public GButton BtnCreate;
public GButton BtnJoin;
public GButton BtnExit;
public GList List;
public override void ConstructFromXML(XML xml)
{
base.ConstructFromXML(xml);
TeamInput = (CommonInput)GetChild("TeamInput");
BtnCreate = (GButton)GetChild("BtnCreate");
BtnJoin = (GButton)GetChild("BtnJoin");
BtnExit = (GButton)GetChild("BtnExit");
List = (GList)GetChild("List");
OnInited();
UILanguage.TrySetComponentLanguage(this);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 7cc6ec326ea4bf54faf7e071cb31c12a

View File

@@ -0,0 +1,15 @@
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
using UnityEngine;
using FairyGUI;
using NBC;
namespace NBF
{
public partial class FishingTeam : GComponent
{
private void OnInited()
{
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 50df4e31a0175034284645c94c611056

View File

@@ -27,7 +27,7 @@ namespace NBF
private async FTask OnLoginClick()
{
await LoginHelper.Login(InputAccount.text);
await MapHelper.EnterMap(99);
// await MapHelper.EnterMap(99);
Del();
}
}

27
Assets/Scripts/UI/TeamItem.Designer.cs generated Normal file
View File

@@ -0,0 +1,27 @@
/**本脚本为自动生成每次生成会覆盖请勿手动修改生成插件文档及项目地址https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
using FairyGUI;
using FairyGUI.Utils;
using NBC;
namespace NBF
{
public partial class TeamItem
{
public const string URL = "ui://682kb9n0oso11t";
public GTextField title;
public GTextField TextScore;
public override void ConstructFromXML(XML xml)
{
base.ConstructFromXML(xml);
title = (GTextField)GetChild("title");
TextScore = (GTextField)GetChild("TextScore");
OnInited();
UILanguage.TrySetComponentLanguage(this);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 5181414dcb090564cb84e5d71ff24841

View File

@@ -0,0 +1,15 @@
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
using UnityEngine;
using FairyGUI;
using NBC;
namespace NBF
{
public partial class TeamItem : GComponent
{
private void OnInited()
{
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: f0259ab9ca7292a4c976d275b5ce71bc