协议提交
This commit is contained in:
@@ -12,5 +12,5 @@ message ChatMessageInfo
|
|||||||
int32 Type = 1; //消息类型
|
int32 Type = 1; //消息类型
|
||||||
int32 Source = 2; //消息来源
|
int32 Source = 2; //消息来源
|
||||||
ChatUserInfo Trigger = 3; //触发者
|
ChatUserInfo Trigger = 3; //触发者
|
||||||
repeated byte Content = 4; //内容
|
string Content = 4; //内容
|
||||||
}
|
}
|
||||||
@@ -3,24 +3,26 @@ using MongoDB.Bson.Serialization.Attributes;
|
|||||||
|
|
||||||
namespace NB.Chat;
|
namespace NB.Chat;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 聊天频道实体
|
/// 聊天频道实体
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ChatChannel : Entity
|
public class ChatChannel : Entity
|
||||||
{
|
{
|
||||||
[BsonElement("type")] public uint ChannelType;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 频道Id
|
/// 频道类型 0.地图 1.公开 2.私密
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[BsonElement("cid")] public long ChannelId;
|
[BsonElement("type")] public uint ChannelType;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 频道名称
|
/// 频道名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[BsonElement("name")] public string Name = "";
|
[BsonElement("name")] public string Name = "";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 频道密码
|
||||||
|
/// </summary>
|
||||||
|
[BsonElement("pass")] public string Password = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建者
|
/// 创建者
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -32,9 +34,12 @@ public class ChatChannel : Entity
|
|||||||
[BsonElement("ct")] public long CreateTime;
|
[BsonElement("ct")] public long CreateTime;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 频道地区
|
/// 频道地区 0,全球 非0地区 如果是地图频道则表示地图位置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[BsonElement("region")] public int Region;
|
[BsonElement("region")] public int Region;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当前频道在线人数
|
||||||
|
/// </summary>
|
||||||
[BsonElement("ids")] public readonly HashSet<long> Units = new HashSet<long>();
|
[BsonElement("ids")] public readonly HashSet<long> Units = new HashSet<long>();
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using Fantasy;
|
||||||
using Fantasy.Entitas;
|
using Fantasy.Entitas;
|
||||||
|
|
||||||
namespace NB.Chat;
|
namespace NB.Chat;
|
||||||
@@ -5,16 +6,8 @@ namespace NB.Chat;
|
|||||||
public sealed class ChatUnit : Entity
|
public sealed class ChatUnit : Entity
|
||||||
{
|
{
|
||||||
public long GateRouteId;
|
public long GateRouteId;
|
||||||
|
|
||||||
public long RoleId;
|
public RoleSimpleInfo Role;
|
||||||
|
|
||||||
public string NickName = string.Empty;
|
|
||||||
|
|
||||||
public string Head = string.Empty;
|
|
||||||
|
|
||||||
public string Country = string.Empty;
|
|
||||||
|
|
||||||
public int Level;
|
|
||||||
|
|
||||||
public override void Dispose()
|
public override void Dispose()
|
||||||
{
|
{
|
||||||
@@ -23,12 +16,8 @@ public sealed class ChatUnit : Entity
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RoleId = 0;
|
|
||||||
GateRouteId = 0;
|
GateRouteId = 0;
|
||||||
NickName = string.Empty;
|
Role = null;
|
||||||
Head = string.Empty;
|
|
||||||
Country = string.Empty;
|
|
||||||
Level = 0;
|
|
||||||
base.Dispose();
|
base.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Game\Activity\" />
|
<Folder Include="Club\" />
|
||||||
<Folder Include="Map\" />
|
<Folder Include="Map\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
7
Entity/Game/Achievement/Achievement.cs
Normal file
7
Entity/Game/Achievement/Achievement.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
using Fantasy.Entitas;
|
||||||
|
|
||||||
|
namespace NB.Game;
|
||||||
|
|
||||||
|
public class Achievement : Entity
|
||||||
|
{
|
||||||
|
}
|
||||||
10
Entity/Game/Achievement/AchievementContainer.cs
Normal file
10
Entity/Game/Achievement/AchievementContainer.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using Fantasy.Entitas;
|
||||||
|
|
||||||
|
namespace NB.Game;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 成就容器
|
||||||
|
/// </summary>
|
||||||
|
public class AchievementContainer : Entity
|
||||||
|
{
|
||||||
|
}
|
||||||
8
Entity/Game/Activity/Activity.cs
Normal file
8
Entity/Game/Activity/Activity.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
using Fantasy.Entitas;
|
||||||
|
|
||||||
|
namespace NB.Game;
|
||||||
|
|
||||||
|
public class Activity : Entity
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -36,6 +36,15 @@ public sealed class Player : Entity
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public FishContainer FishContainer;
|
public FishContainer FishContainer;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 技能
|
||||||
|
/// </summary>
|
||||||
|
public SkillContainer SkillContainer;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 成就
|
||||||
|
/// </summary>
|
||||||
|
public AchievementContainer AchievementContainer;
|
||||||
|
|
||||||
[BsonIgnore] public long SessionRunTimeId;
|
[BsonIgnore] public long SessionRunTimeId;
|
||||||
|
|
||||||
|
|||||||
7
Entity/Game/Skill/SkillContainer.cs
Normal file
7
Entity/Game/Skill/SkillContainer.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
using Fantasy.Entitas;
|
||||||
|
|
||||||
|
namespace NB.Game;
|
||||||
|
|
||||||
|
public class SkillContainer : Entity
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -49,7 +49,7 @@ namespace Fantasy
|
|||||||
Type = default;
|
Type = default;
|
||||||
Source = default;
|
Source = default;
|
||||||
Trigger = default;
|
Trigger = default;
|
||||||
Content.Clear();
|
Content = default;
|
||||||
#if FANTASY_NET || FANTASY_UNITY
|
#if FANTASY_NET || FANTASY_UNITY
|
||||||
GetScene().MessagePoolComponent.Return<ChatMessageInfo>(this);
|
GetScene().MessagePoolComponent.Return<ChatMessageInfo>(this);
|
||||||
#endif
|
#endif
|
||||||
@@ -61,6 +61,6 @@ namespace Fantasy
|
|||||||
[ProtoMember(3)]
|
[ProtoMember(3)]
|
||||||
public ChatUserInfo Trigger { get; set; }
|
public ChatUserInfo Trigger { get; set; }
|
||||||
[ProtoMember(4)]
|
[ProtoMember(4)]
|
||||||
public List<byte> Content = new List<byte>();
|
public string Content { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Fantasy;
|
using System.Text;
|
||||||
|
using Fantasy;
|
||||||
using Fantasy.Async;
|
using Fantasy.Async;
|
||||||
using Fantasy.Network.Interface;
|
using Fantasy.Network.Interface;
|
||||||
|
|
||||||
@@ -10,7 +11,10 @@ public sealed class
|
|||||||
protected override async FTask Run(ChatUnit chatUnit, C2Chat_SendMessageRequest request,
|
protected override async FTask Run(ChatUnit chatUnit, C2Chat_SendMessageRequest request,
|
||||||
Caht2C_SendMessageResponse response, Action reply)
|
Caht2C_SendMessageResponse response, Action reply)
|
||||||
{
|
{
|
||||||
// ChatSceneHelper.Broadcast(chatUnit.Scene, request.Message);
|
ChatSceneHelper.Broadcast(chatUnit.Scene, new ChatMessageInfo()
|
||||||
|
{
|
||||||
|
Content = request.Message,
|
||||||
|
});
|
||||||
await FTask.CompletedTask;
|
await FTask.CompletedTask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -20,7 +20,7 @@ public static class ChatChannelCenterComponentSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
channel = Entity.Create<ChatChannel>(self.Scene, channelId, true, true);
|
channel = Entity.Create<ChatChannel>(self.Scene, channelId, true, true);
|
||||||
channel.Creator = unit.RoleId;
|
channel.Creator = unit.Role.RoleId;
|
||||||
channel.CreateTime = TimeHelper.Now;
|
channel.CreateTime = TimeHelper.Now;
|
||||||
self.Channels.Add(channelId, channel);
|
self.Channels.Add(channelId, channel);
|
||||||
return channel;
|
return channel;
|
||||||
|
|||||||
@@ -28,11 +28,7 @@ public static class ChatUnitManageComponentSystem
|
|||||||
if (account != null)
|
if (account != null)
|
||||||
{
|
{
|
||||||
account.GateRouteId = gateRouteId;
|
account.GateRouteId = gateRouteId;
|
||||||
account.RoleId = accountId;
|
account.Role = roleSimpleInfo;
|
||||||
account.Head = roleSimpleInfo.Head;
|
|
||||||
account.Level = roleSimpleInfo.Level;
|
|
||||||
account.NickName = roleSimpleInfo.NickName;
|
|
||||||
account.Country = roleSimpleInfo.Country;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await FTask.CompletedTask;
|
await FTask.CompletedTask;
|
||||||
|
|||||||
@@ -13,8 +13,9 @@ public class Chat2G_ChatMessageHandler : Route<Scene, Chat2G_ChatMessage>
|
|||||||
{
|
{
|
||||||
var chatMessage = new Chat2C_Message()
|
var chatMessage = new Chat2C_Message()
|
||||||
{
|
{
|
||||||
Message = new ChatMessageInfo(),
|
Message = message.Message,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
var gateUnitManage = scene.GetComponent<GateUnitManageComponent>();
|
var gateUnitManage = scene.GetComponent<GateUnitManageComponent>();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user