脚本
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -221,7 +221,7 @@ namespace NBC
|
||||
[ProtoMember(5)]
|
||||
public long GetTime { get; set; }
|
||||
[ProtoMember(6)]
|
||||
public long Abrasion { get; set; }
|
||||
public int Abrasion { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// fish信息
|
||||
|
||||
@@ -21,10 +21,11 @@ namespace NBC
|
||||
Id = default;
|
||||
Title = default;
|
||||
Content = default;
|
||||
SendTime = default;
|
||||
Type = default;
|
||||
CreateTime = default;
|
||||
ExpireTime = default;
|
||||
MailType = default;
|
||||
MailState = default;
|
||||
Items.Clear();
|
||||
IsRead = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<MailInfo>(this);
|
||||
#endif
|
||||
@@ -36,12 +37,14 @@ namespace NBC
|
||||
[ProtoMember(3)]
|
||||
public string Content { get; set; }
|
||||
[ProtoMember(4)]
|
||||
public long SendTime { get; set; }
|
||||
public long CreateTime { get; set; }
|
||||
[ProtoMember(5)]
|
||||
public int Type { get; set; }
|
||||
public long ExpireTime { get; set; }
|
||||
[ProtoMember(6)]
|
||||
public List<AwardInfo> Items = new List<AwardInfo>();
|
||||
public int MailType { get; set; }
|
||||
[ProtoMember(7)]
|
||||
public bool IsRead { get; set; }
|
||||
public int MailState { get; set; }
|
||||
[ProtoMember(8)]
|
||||
public List<AwardInfo> Items = new List<AwardInfo>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace NBC
|
||||
Username = default;
|
||||
Password = default;
|
||||
LoginType = default;
|
||||
Region = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2A_LoginRequest>(this);
|
||||
#endif
|
||||
@@ -34,6 +35,8 @@ namespace NBC
|
||||
public string Password { get; set; }
|
||||
[ProtoMember(3)]
|
||||
public int LoginType { get; set; }
|
||||
[ProtoMember(4)]
|
||||
public int Region { get; set; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class A2C_LoginResponse : AMessage, IResponse, IProto
|
||||
@@ -184,4 +187,165 @@ namespace NBC
|
||||
[ProtoMember(3)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 请求邮件列表
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class C2Game_GetMailsRequest : AMessage, ICustomRouteRequest, IProto
|
||||
{
|
||||
public static C2Game_GetMailsRequest Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2Game_GetMailsRequest>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2Game_GetMailsRequest>(this);
|
||||
#endif
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public Game2C_GetMailsResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return OuterOpcode.C2Game_GetMailsRequest; }
|
||||
[ProtoIgnore]
|
||||
public int RouteType => Fantasy.RouteType.GameRoute;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取邮件列表响应
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class Game2C_GetMailsResponse : AMessage, ICustomRouteResponse, IProto
|
||||
{
|
||||
public static Game2C_GetMailsResponse Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<Game2C_GetMailsResponse>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
Mail.Clear();
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<Game2C_GetMailsResponse>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.Game2C_GetMailsResponse; }
|
||||
[ProtoMember(1)]
|
||||
public List<MailInfo> Mail = new List<MailInfo>();
|
||||
[ProtoMember(2)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 新邮件推送
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class Game2C_HaveMail : AMessage, ICustomRouteMessage, IProto
|
||||
{
|
||||
public static Game2C_HaveMail Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<Game2C_HaveMail>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
Mail = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<Game2C_HaveMail>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.Game2C_HaveMail; }
|
||||
[ProtoIgnore]
|
||||
public int RouteType => Fantasy.RouteType.GameRoute;
|
||||
[ProtoMember(1)]
|
||||
public MailInfo Mail { get; set; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class Game2C_MailState : AMessage, ICustomRouteMessage, IProto
|
||||
{
|
||||
public static Game2C_MailState Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<Game2C_MailState>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
MailState = default;
|
||||
MailId = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<Game2C_MailState>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.Game2C_MailState; }
|
||||
[ProtoIgnore]
|
||||
public int RouteType => Fantasy.RouteType.GameRoute;
|
||||
[ProtoMember(1)]
|
||||
public int MailState { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public long MailId { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 发送聊天
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class C2Chat_SendMessageRequest : AMessage, ICustomRouteRequest, IProto
|
||||
{
|
||||
public static C2Chat_SendMessageRequest Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2Chat_SendMessageRequest>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
Message = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2Chat_SendMessageRequest>(this);
|
||||
#endif
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public Caht2C_SendMessageResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return OuterOpcode.C2Chat_SendMessageRequest; }
|
||||
[ProtoIgnore]
|
||||
public int RouteType => Fantasy.RouteType.ChatRoute;
|
||||
[ProtoMember(1)]
|
||||
public string Message { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 发送聊天响应
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class Caht2C_SendMessageResponse : AMessage, ICustomRouteResponse, IProto
|
||||
{
|
||||
public static Caht2C_SendMessageResponse Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<Caht2C_SendMessageResponse>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<Caht2C_SendMessageResponse>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.Caht2C_SendMessageResponse; }
|
||||
[ProtoMember(1)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 推送消息
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class Chat2C_Message : AMessage, ICustomRouteMessage, IProto
|
||||
{
|
||||
public static Chat2C_Message Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<Chat2C_Message>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
Message = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<Chat2C_Message>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.Chat2C_Message; }
|
||||
[ProtoIgnore]
|
||||
public int RouteType => Fantasy.RouteType.ChatRoute;
|
||||
[ProtoMember(1)]
|
||||
public string Message { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,5 +9,12 @@ namespace Fantasy
|
||||
public const uint G2C_RepeatLogin = 134227729;
|
||||
public const uint C2Game_GetRoleInfoRequest = 2281711377;
|
||||
public const uint Game2C_GetRoleInfoResponse = 2415929105;
|
||||
public const uint C2Game_GetMailsRequest = 2281711378;
|
||||
public const uint Game2C_GetMailsResponse = 2415929106;
|
||||
public const uint Game2C_HaveMail = 2147493649;
|
||||
public const uint Game2C_MailState = 2147493650;
|
||||
public const uint C2Chat_SendMessageRequest = 2281711379;
|
||||
public const uint Caht2C_SendMessageResponse = 2415929107;
|
||||
public const uint Chat2C_Message = 2147493651;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,92 +137,14 @@ namespace NBF
|
||||
// Fishing.Inst.Go(1);
|
||||
// SettingPanel.Show();
|
||||
// HomePanel.Show();
|
||||
ChatTestPanel.Show();
|
||||
|
||||
//测试登录
|
||||
OnLoginButtonClick().Coroutine();
|
||||
// //测试登录
|
||||
// OnLoginButtonClick().Coroutine();
|
||||
}
|
||||
|
||||
|
||||
#region 登录测试
|
||||
|
||||
private Session _session;
|
||||
|
||||
private async FTask OnLoginButtonClick()
|
||||
{
|
||||
// NBC.Platform.Unity.Entry.Initialize(GetType().Assembly);
|
||||
|
||||
// 根据用户名来选择目标的鉴权服务器
|
||||
// 根据鉴权服务器地址来创建一个新的网络会话
|
||||
_session = SessionHelper.CreateSession(App.Main, "127.0.0.1:20001", OnConnectComplete,
|
||||
OnConnectFail,
|
||||
OnConnectDisconnect);
|
||||
|
||||
var acc = "test003";
|
||||
|
||||
// 发送登录的请求给服务器
|
||||
var response = (A2C_LoginResponse)await _session.Call(new C2A_LoginRequest()
|
||||
{
|
||||
Username = acc,
|
||||
Password = acc,
|
||||
LoginType = 1
|
||||
});
|
||||
|
||||
if (response.ErrorCode != 0)
|
||||
{
|
||||
Log.Error($"登录发生错误{response.ErrorCode}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!App.Main.GetComponent<JWTParseComponent>().Parse(response.ToKen, out var payload))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// 根据ToKen返回的Address登录到Gate服务器
|
||||
_session = SessionHelper.CreateSession(App.Main, payload.Address, OnConnectComplete, OnConnectFail,
|
||||
OnConnectDisconnect);
|
||||
// 发送登录请求到Gate服务器
|
||||
var loginResponse = (G2C_LoginResponse)await _session.Call(new C2G_LoginRequest()
|
||||
{
|
||||
ToKen = response.ToKen
|
||||
});
|
||||
if (loginResponse.ErrorCode != 0)
|
||||
{
|
||||
Log.Error($"登录发生错误{loginResponse.ErrorCode}");
|
||||
return;
|
||||
}
|
||||
|
||||
Log.Debug(
|
||||
$"登录到Gate服务器成功!ErrorCode:{loginResponse.ErrorCode}");
|
||||
// Log.Debug(
|
||||
// $"登录到Gate服务器成功!LoginTime:{loginResponse.GameAccountInfo.LoginTime} CreateTime:{loginResponse.GameAccountInfo.CreateTime}");
|
||||
|
||||
// var getResponse = (G2C_GetAccountInfoResponse)await _session.Call(new C2G_GetAccountInfoRequest());
|
||||
// var gameAcc = getResponse.GameAccountInfo;
|
||||
// Log.Info($"gameAcc LoginTime:{gameAcc.LoginTime} CreateTime:{gameAcc.CreateTime}");
|
||||
// getResponse.GameAccountInfo.LoginTime.ToString()
|
||||
}
|
||||
|
||||
private void OnConnectComplete()
|
||||
{
|
||||
Log.Debug("连接成功");
|
||||
// 添加心跳组件给Session。
|
||||
// Start(2000)就是2000毫秒。
|
||||
_session.AddComponent<SessionHeartbeatComponent>().Start(5000);
|
||||
}
|
||||
|
||||
private void OnConnectFail()
|
||||
{
|
||||
Log.Debug("连接失败");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
private void OnConnectDisconnect()
|
||||
{
|
||||
Log.Debug("连接断开");
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace NBF
|
||||
UIObjectFactory.SetPackageItemExtension(HomeRankPage.URL, typeof(HomeRankPage));
|
||||
UIObjectFactory.SetPackageItemExtension(HomeStatisticsPage.URL, typeof(HomeStatisticsPage));
|
||||
UIObjectFactory.SetPackageItemExtension(HomeButtonGroups.URL, typeof(HomeButtonGroups));
|
||||
UIObjectFactory.SetPackageItemExtension(ChatItem.URL, typeof(ChatItem));
|
||||
}
|
||||
}
|
||||
}
|
||||
29
Assets/Scripts/UI/ChatItem.Designer.cs
generated
Normal file
29
Assets/Scripts/UI/ChatItem.Designer.cs
generated
Normal file
@@ -0,0 +1,29 @@
|
||||
/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
|
||||
using FairyGUI;
|
||||
using FairyGUI.Utils;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class ChatItem
|
||||
{
|
||||
public const string URL = "ui://hxr7rc7pn5ne1f";
|
||||
|
||||
public GTextField TextType;
|
||||
public GTextField TextUser;
|
||||
public GTextField TextMessage;
|
||||
|
||||
public override void ConstructFromXML(XML xml)
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
TextType = (GTextField)GetChild("TextType");
|
||||
TextUser = (GTextField)GetChild("TextUser");
|
||||
TextMessage = (GTextField)GetChild("TextMessage");
|
||||
OnInited();
|
||||
UILanguage.TrySetComponentLanguage(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/ChatItem.Designer.cs.meta
Normal file
2
Assets/Scripts/UI/ChatItem.Designer.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8383cf682d2c39f41bc83ea027894ec6
|
||||
15
Assets/Scripts/UI/ChatItem.cs
Normal file
15
Assets/Scripts/UI/ChatItem.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class ChatItem : GComponent
|
||||
{
|
||||
private void OnInited()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/ChatItem.cs.meta
Normal file
2
Assets/Scripts/UI/ChatItem.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e369e839256e8464fbdd0922424f36e3
|
||||
46
Assets/Scripts/UI/ChatTestPanel.Designer.cs
generated
Normal file
46
Assets/Scripts/UI/ChatTestPanel.Designer.cs
generated
Normal file
@@ -0,0 +1,46 @@
|
||||
/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
using FairyGUI;
|
||||
using FairyGUI.Utils;
|
||||
using NBC;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
/// <summary> </summary>
|
||||
public partial class ChatTestPanel
|
||||
{
|
||||
public GObject this[string aKey] => ContentPane.GetChild(aKey);
|
||||
public override string UIPackName => "Main";
|
||||
public override string UIResName => "ChatTestPanel";
|
||||
|
||||
[AutoFind(Name = "back")]
|
||||
public GImage back;
|
||||
[AutoFind(Name = "TextLoginInfo")]
|
||||
public GTextField TextLoginInfo;
|
||||
[AutoFind(Name = "InputAccount")]
|
||||
public GLabel InputAccount;
|
||||
[AutoFind(Name = "BtnLogout")]
|
||||
public GButton BtnLogout;
|
||||
[AutoFind(Name = "BtnLogin")]
|
||||
public GButton BtnLogin;
|
||||
[AutoFind(Name = "InputMessage")]
|
||||
public GLabel InputMessage;
|
||||
[AutoFind(Name = "BtnSendMessage")]
|
||||
public GButton BtnSendMessage;
|
||||
[AutoFind(Name = "BtnSendFriend")]
|
||||
public GButton BtnSendFriend;
|
||||
[AutoFind(Name = "BtnSendWorld")]
|
||||
public GButton BtnSendWorld;
|
||||
[AutoFind(Name = "ChatList")]
|
||||
public GList ChatList;
|
||||
public override string[] GetDependPackages(){ return new string[] {"Common"}; }
|
||||
|
||||
public static void Show(object param = null){ App.UI.OpenUI<ChatTestPanel>(param); }
|
||||
|
||||
public static void Hide(){ App.UI.HideUI<ChatTestPanel>(); }
|
||||
|
||||
public static void Del(){ App.UI.DestroyUI<ChatTestPanel>(); }
|
||||
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/ChatTestPanel.Designer.cs.meta
Normal file
2
Assets/Scripts/UI/ChatTestPanel.Designer.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c9910a4bd1e1d3b4a8c580bcc2cc34e7
|
||||
137
Assets/Scripts/UI/ChatTestPanel.cs
Normal file
137
Assets/Scripts/UI/ChatTestPanel.cs
Normal file
@@ -0,0 +1,137 @@
|
||||
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
|
||||
|
||||
using Assets.Scripts.Entity;
|
||||
using Assets.Scripts.Hotfix;
|
||||
using FairyGUI;
|
||||
using UnityEngine;
|
||||
using NBC;
|
||||
using NBC.Network;
|
||||
using UIPanel = NBC.UIPanel;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class ChatTestPanel : UIPanel
|
||||
{
|
||||
protected override void OnInit()
|
||||
{
|
||||
this.AutoAddClick(OnClick);
|
||||
}
|
||||
|
||||
protected override void OnShow()
|
||||
{
|
||||
SetLoginState(false);
|
||||
}
|
||||
|
||||
private void OnClick(GComponent btn)
|
||||
{
|
||||
if (btn == BtnLogin)
|
||||
{
|
||||
if (string.IsNullOrEmpty(InputAccount.text))
|
||||
{
|
||||
Notices.Info("没有输入账号密码");
|
||||
return;
|
||||
}
|
||||
|
||||
OnLoginButtonClick(InputAccount.text).Coroutine();
|
||||
}
|
||||
}
|
||||
|
||||
private void SetLoginState(bool isLogin = false, string account = "")
|
||||
{
|
||||
if (isLogin)
|
||||
{
|
||||
BtnLogin.visible = false;
|
||||
BtnLogout.visible = true;
|
||||
TextLoginInfo.text = account;
|
||||
}
|
||||
else
|
||||
{
|
||||
BtnLogin.visible = true;
|
||||
BtnLogout.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
#region 登录测试
|
||||
|
||||
private Session _session;
|
||||
|
||||
private async FTask OnLoginButtonClick(string account)
|
||||
{
|
||||
// NBC.Platform.Unity.Entry.Initialize(GetType().Assembly);
|
||||
|
||||
// 根据用户名来选择目标的鉴权服务器
|
||||
// 根据鉴权服务器地址来创建一个新的网络会话
|
||||
_session = SessionHelper.CreateSession(App.Main, "127.0.0.1:20001", OnConnectComplete,
|
||||
OnConnectFail,
|
||||
OnConnectDisconnect);
|
||||
|
||||
var acc = account;
|
||||
|
||||
// 发送登录的请求给服务器
|
||||
var response = (A2C_LoginResponse)await _session.Call(new C2A_LoginRequest()
|
||||
{
|
||||
Username = acc,
|
||||
Password = acc,
|
||||
LoginType = 1
|
||||
});
|
||||
|
||||
if (response.ErrorCode != 0)
|
||||
{
|
||||
Log.Error($"登录发生错误{response.ErrorCode}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!App.Main.GetComponent<JWTParseComponent>().Parse(response.ToKen, out var payload))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// 根据ToKen返回的Address登录到Gate服务器
|
||||
_session = SessionHelper.CreateSession(App.Main, payload.Address, OnConnectComplete, OnConnectFail,
|
||||
OnConnectDisconnect);
|
||||
// 发送登录请求到Gate服务器
|
||||
var loginResponse = (G2C_LoginResponse)await _session.Call(new C2G_LoginRequest()
|
||||
{
|
||||
ToKen = response.ToKen
|
||||
});
|
||||
if (loginResponse.ErrorCode != 0)
|
||||
{
|
||||
Log.Error($"登录发生错误{loginResponse.ErrorCode}");
|
||||
return;
|
||||
}
|
||||
|
||||
SetLoginState(true, InputAccount.text);
|
||||
Log.Debug(
|
||||
$"登录到Gate服务器成功!ErrorCode:{loginResponse.ErrorCode}");
|
||||
// Log.Debug(
|
||||
// $"登录到Gate服务器成功!LoginTime:{loginResponse.GameAccountInfo.LoginTime} CreateTime:{loginResponse.GameAccountInfo.CreateTime}");
|
||||
|
||||
// var getResponse = (G2C_GetAccountInfoResponse)await _session.Call(new C2G_GetAccountInfoRequest());
|
||||
// var gameAcc = getResponse.GameAccountInfo;
|
||||
// Log.Info($"gameAcc LoginTime:{gameAcc.LoginTime} CreateTime:{gameAcc.CreateTime}");
|
||||
// getResponse.GameAccountInfo.LoginTime.ToString()
|
||||
}
|
||||
|
||||
private void OnConnectComplete()
|
||||
{
|
||||
Log.Debug("连接成功");
|
||||
// 添加心跳组件给Session。
|
||||
// Start(2000)就是2000毫秒。
|
||||
_session.AddComponent<SessionHeartbeatComponent>().Start(5000);
|
||||
}
|
||||
|
||||
private void OnConnectFail()
|
||||
{
|
||||
Log.Debug("连接失败");
|
||||
SetLoginState(false);
|
||||
}
|
||||
|
||||
private void OnConnectDisconnect()
|
||||
{
|
||||
Log.Debug("连接断开");
|
||||
SetLoginState(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/ChatTestPanel.cs.meta
Normal file
2
Assets/Scripts/UI/ChatTestPanel.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2f05d713b2557a945b45a81473963207
|
||||
@@ -4,7 +4,7 @@
|
||||
<graph id="n1_sqnk" name="n1" xy="0,0" size="161,57" type="rect" fillColor="#ff666666">
|
||||
<relation target="" sidePair="width-width,height-height"/>
|
||||
</graph>
|
||||
<text id="n0_sqnk" name="title" xy="7,9" size="147,39" fontSize="28" color="#ffffff" autoSize="shrink" text="1" input="true">
|
||||
<text id="n0_sqnk" name="title" xy="7,9" size="147,39" fontSize="28" color="#ffffff" autoSize="shrink" text="" input="true" prompt="请输入...">
|
||||
<relation target="" sidePair="width-width,height-height"/>
|
||||
</text>
|
||||
</displayList>
|
||||
@@ -8,8 +8,8 @@
|
||||
<image id="kryob" name="Square.png" path="/Images/" exported="true" scale="9grid" scale9grid="1,1,1,0"/>
|
||||
<component id="kryoc" name="GreenProgress.xml" path="/Com/Progress/" exported="true"/>
|
||||
<component id="sqnkd" name="GMPanel.xml" path="/Panel/" exported="true"/>
|
||||
<component id="sqnke" name="InputDef.xml" path="/Com/"/>
|
||||
<component id="sqnkf" name="ButtonDef.xml" path="/Com/Buttons/"/>
|
||||
<component id="sqnke" name="InputDef.xml" path="/Com/Inputs/" exported="true"/>
|
||||
<component id="sqnkf" name="ButtonDef.xml" path="/Com/Buttons/" exported="true"/>
|
||||
<component id="sqnkg" name="ComboBox1_item.xml" path="/Com/ComboBox/"/>
|
||||
<component id="sqnkh" name="ComboBox1_popup.xml" path="/Com/ComboBox/"/>
|
||||
<component id="sqnki" name="ComboBox1.xml" path="/Com/ComboBox/" exported="true"/>
|
||||
|
||||
15
FGUIProject/assets/Main/ChatItem.xml
Normal file
15
FGUIProject/assets/Main/ChatItem.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<component size="1220,43">
|
||||
<displayList>
|
||||
<text id="n15_n5ne" name="TextType" xy="0,0" size="122,42" fontSize="30" color="#ffffff" text="【私聊】"/>
|
||||
<text id="n12_n5ne" name="TextUser" xy="130,0" size="109,42" fontSize="30" color="#ffffff" text="100111">
|
||||
<relation target="n15_n5ne" sidePair="middle-middle,left-right"/>
|
||||
</text>
|
||||
<graph id="n14_n5ne" name="n14" xy="245,16" size="2,10" type="rect" lineSize="0">
|
||||
<relation target="n12_n5ne" sidePair="middle-middle,left-right"/>
|
||||
</graph>
|
||||
<text id="n13_n5ne" name="TextMessage" xy="252,1" size="1093,42" fontSize="30" color="#ffffff" autoSize="ellipsis" text="Message">
|
||||
<relation target="n12_n5ne" sidePair="middle-middle,left-right"/>
|
||||
</text>
|
||||
</displayList>
|
||||
</component>
|
||||
47
FGUIProject/assets/Main/ChatTestPanel.xml
Normal file
47
FGUIProject/assets/Main/ChatTestPanel.xml
Normal file
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<component size="1920,1080">
|
||||
<displayList>
|
||||
<image id="n0_n5ne" name="back" src="kryob" fileName="Images/Square.png" pkg="6hgkvlau" xy="0,0" size="1920,1080" color="#182128">
|
||||
<relation target="" sidePair="width-width,height-height"/>
|
||||
</image>
|
||||
<text id="n5_n5ne" name="TextLoginInfo" xy="16,17" size="97,42" fontSize="30" color="#ffffff" text="Login:"/>
|
||||
<component id="n1_n5ne" name="InputAccount" src="sqnke" fileName="Com/Inputs/InputDef.xml" pkg="6hgkvlau" xy="17,75">
|
||||
<Label title="test003"/>
|
||||
</component>
|
||||
<component id="n4_n5ne" name="BtnLogout" src="sqnkf" fileName="Com/Buttons/ButtonDef.xml" pkg="6hgkvlau" xy="200,77" visible="false">
|
||||
<Button title="退出"/>
|
||||
</component>
|
||||
<component id="n2_n5ne" name="BtnLogin" src="sqnkf" fileName="Com/Buttons/ButtonDef.xml" pkg="6hgkvlau" xy="200,77">
|
||||
<Button title="登录"/>
|
||||
</component>
|
||||
<component id="n3_n5ne" name="InputMessage" src="sqnke" fileName="Com/Inputs/InputDef.xml" pkg="6hgkvlau" xy="347,791" size="1226,57"/>
|
||||
<component id="n6_n5ne" name="BtnSendMessage" src="sqnkf" fileName="Com/Buttons/ButtonDef.xml" pkg="6hgkvlau" xy="435,863" size="244,56">
|
||||
<Button title="发送普通聊天"/>
|
||||
</component>
|
||||
<component id="n7_n5ne" name="BtnSendFriend" src="sqnkf" fileName="Com/Buttons/ButtonDef.xml" pkg="6hgkvlau" xy="838,862" size="244,56">
|
||||
<Button title="发送私聊"/>
|
||||
</component>
|
||||
<component id="n9_n5ne" name="BtnSendWorld" src="sqnkf" fileName="Com/Buttons/ButtonDef.xml" pkg="6hgkvlau" xy="1241,863" size="244,56">
|
||||
<Button title="发送广播"/>
|
||||
</component>
|
||||
<graph id="n10_n5ne" name="n10" xy="347,161" size="1226,616" type="rect" fillColor="#4c000000"/>
|
||||
<list id="n11_n5ne" name="ChatList" xy="352,165" size="1220,603" overflow="scroll" lineGap="6" defaultItem="ui://hxr7rc7pn5ne1f" autoClearItems="true">
|
||||
<item/>
|
||||
<item/>
|
||||
<item/>
|
||||
<item/>
|
||||
<item/>
|
||||
<item/>
|
||||
<item/>
|
||||
<item/>
|
||||
<item/>
|
||||
<item/>
|
||||
<item/>
|
||||
<item/>
|
||||
<item/>
|
||||
<item/>
|
||||
<item/>
|
||||
<item/>
|
||||
</list>
|
||||
</displayList>
|
||||
</component>
|
||||
@@ -46,6 +46,8 @@
|
||||
<component id="5dtx1b" name="KeyboardInput.xml" path="/Com/Items/"/>
|
||||
<component id="5dtx1c" name="SettingInputItem.xml" path="/Com/Items/" exported="true"/>
|
||||
<component id="5dtx1d" name="InputWaitingCom.xml" path="/" exported="true"/>
|
||||
<component id="n5ne1e" name="ChatTestPanel.xml" path="/" exported="true"/>
|
||||
<component id="n5ne1f" name="ChatItem.xml" path="/" exported="true"/>
|
||||
</resources>
|
||||
<publish name="" path="../Assets/Resources/Fgui/Main" packageCount="2" genCode="true"/>
|
||||
</packageDescription>
|
||||
1
FGUIProject/settings/whoot/hxr7rc7pn5ne1e.json
Normal file
1
FGUIProject/settings/whoot/hxr7rc7pn5ne1e.json
Normal file
@@ -0,0 +1 @@
|
||||
{"url":"ui://hxr7rc7pn5ne1e","name":"ChatTestPanel","scriptType":"panel","isCustomName":false,"customName":"","annotation":"","member":{}}
|
||||
1
FGUIProject/settings/whoot/hxr7rc7pn5ne1f.json
Normal file
1
FGUIProject/settings/whoot/hxr7rc7pn5ne1f.json
Normal file
@@ -0,0 +1 @@
|
||||
{"url":"ui://hxr7rc7pn5ne1f","name":"ChatItem","scriptType":"component","isCustomName":false,"customName":"","annotation":"","member":{}}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user