This commit is contained in:
ALIENJACK\alien 2024-12-13 17:28:47 +08:00
commit 839a711637
5 changed files with 33 additions and 2 deletions

View File

@ -43,6 +43,8 @@ namespace AxibugEmuOnline.Client.ClientCore
#endif
public static void Init(Initer initer, bool isTest = false, string testSrvIP = "")
{
PlayerPrefs.DeleteAll();
settings = new AppSettings();
log = new LogManager();

View File

@ -3,6 +3,18 @@
public enum EEvent
{
// 添加你自己需要的事件类型
/// <summary>
/// 登录成功
/// </summary>
OnLoginSucceed,
/// <summary>
/// 登录失败
/// </summary>
OnLoginFailed,
OnChatMsg,
//自己的信息更新(比如改名更新)

View File

@ -1,5 +1,6 @@
using AxibugEmuOnline.Client.ClientCore;
using AxibugEmuOnline.Client.Common;
using AxibugEmuOnline.Client.Event;
using AxibugEmuOnline.Client.Network;
using AxibugProtobuf;
using System;
@ -50,15 +51,21 @@ namespace AxibugEmuOnline.Client.Manager
{
App.log.Info("登录成功");
App.user.InitMainUserData(App.user.userdata.Account, msg.UID);
OverlayManager.PopTip("登录成功");
App.log.Info("获取Room列表");
App.roomMgr.SendGetRoomList();
App.log.Info("获取在线玩家列表");
App.user.Send_GetUserList();
Eventer.Instance.PostEvent(EEvent.OnLoginSucceed);
}
else
{
App.log.Info("登录失败");
App.log.Info("登录失败");
OverlayManager.PopTip("登录失败");
Eventer.Instance.PostEvent(EEvent.OnLoginFailed);
}
#if UNITY_EDITOR
//TestCreate();

View File

@ -295,7 +295,10 @@ namespace AxibugEmuOnline.Client.Manager
Protobuf_Room_Join_RESP msg = ProtoBufHelper.DeSerizlize<Protobuf_Room_Join_RESP>(reqData);
mineRoomMiniInfo = msg.RoomMiniInfo;
InitRePlay();
Eventer.Instance.PostEvent(EEvent.OnMineJoinRoom);
{
OverlayManager.PopTip($"已进入[{msg.RoomMiniInfo.GetHostNickName()}]的房间");
Eventer.Instance.PostEvent(EEvent.OnMineJoinRoom);
}
}
/// <summary>
@ -322,6 +325,7 @@ namespace AxibugEmuOnline.Client.Manager
ReleaseRePlay();
mineRoomMiniInfo = null;
Eventer.Instance.PostEvent(EEvent.OnMineLeavnRoom);
OverlayManager.PopTip($"已经离开房间");
}
void RecvRoomMyRoomStateChange(byte[] reqData)
@ -341,7 +345,10 @@ namespace AxibugEmuOnline.Client.Manager
{
Eventer.Instance.PostEvent(EEvent.OnOtherPlayerLeavnRoom, i, OldPlayer);
if (NewPlayer > 0)//而且害换了一个玩家
{
Eventer.Instance.PostEvent(EEvent.OnOtherPlayerJoinRoom, i, NewPlayer);
OverlayManager.PopTip($"其他人进入了房间");
}
}
else //之前没人
Eventer.Instance.PostEvent(EEvent.OnOtherPlayerJoinRoom, i, NewPlayer);

View File

@ -163,7 +163,10 @@ namespace AxibugEmuOnline.Client.Manager
Protobuf_UserJoin_RESP msg = ProtoBufHelper.DeSerizlize<Protobuf_UserJoin_RESP>(reqData);
UpdateOrAddUser(msg.UserInfo, out bool isNewUser);
if (isNewUser)
{
Eventer.Instance.PostEvent(EEvent.OnUserLogin, msg.UserInfo.UID, msg.UserInfo.NickName);
OverlayManager.PopTip($"玩家[{msg.UserInfo.NickName}]上线了");
}
}
public void RecvGetUserLeave(byte[] reqData)