Merge pull request 'feature/chat' (#239) from feature/chat into develop
Reviewed-on: https://git.pthub.vn/Unity/perfect-world-unity/pulls/239
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:80240cfe7d09ee2bd71e83f71df212818695e4bb1f431eafb04dce66f2ced2a0
|
||||
size 323449
|
||||
oid sha256:47ff1377fe87865c1bdada70b8f6fee638a20879f70b84b40d62fb978aee203e
|
||||
size 325051
|
||||
|
||||
@@ -106,11 +106,12 @@ namespace BrewMonster.Scripts.ChatUI
|
||||
if (_userAtBottom)
|
||||
ScrollToBottom();
|
||||
}
|
||||
|
||||
|
||||
void AddMessageView(string msg)
|
||||
{
|
||||
var view = _pool.Get();
|
||||
view.transform.SetParent(content, false);
|
||||
view.transform.SetAsLastSibling();
|
||||
view.Bind(msg);
|
||||
|
||||
_visibleViews.Add(view);
|
||||
@@ -138,12 +139,14 @@ namespace BrewMonster.Scripts.ChatUI
|
||||
{
|
||||
var view = _pool.Get();
|
||||
view.transform.SetParent(content, false);
|
||||
view.transform.SetAsLastSibling();
|
||||
view.Bind(_messages[i]);
|
||||
|
||||
_visibleViews.Add(view);
|
||||
}
|
||||
|
||||
Canvas.ForceUpdateCanvases();
|
||||
ScrollToBottom();
|
||||
}
|
||||
|
||||
public void ScrollToBottom()
|
||||
@@ -171,4 +174,4 @@ namespace BrewMonster.Scripts.ChatUI
|
||||
RefreshVisible();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -28,7 +28,7 @@ namespace CSNetwork
|
||||
enumEINum = enumEICustom + MAXNUM_CUSTOM_ITEM
|
||||
}
|
||||
|
||||
public static void AUI_ConvertChatString(string pszChat, char[] pszConv, bool bName)
|
||||
public static void AUI_ConvertChatString(ref string pszChat, ref char[] pszConv, bool bName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(pszChat) || pszConv == null)
|
||||
return;
|
||||
@@ -320,6 +320,52 @@ namespace CSNetwork
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Chuyển đổi định dạng printf (C-style: %s, %d) sang string.Format (C#-style: {0}, {1})
|
||||
/// </summary>
|
||||
public static string ConvertPrintfToCSharpFormat(string format)
|
||||
{
|
||||
if (string.IsNullOrEmpty(format)) return "";
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int argIndex = 0;
|
||||
for (int i = 0; i < format.Length; i++)
|
||||
{
|
||||
if (format[i] == '%' && i + 1 < format.Length)
|
||||
{
|
||||
char next = format[i + 1];
|
||||
if (next == '%') // Trường hợp %% -> %
|
||||
{
|
||||
sb.Append('%');
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append('{').Append(argIndex++).Append('}');
|
||||
|
||||
i++;
|
||||
// Nhảy qua các ký tự định dạng (ví dụ: %02d, %ls, %f)
|
||||
while (i < format.Length && (char.IsDigit(format[i]) || format[i] == '.' || format[i] == 'l' || format[i] == 'u' || format[i] == 'd' || format[i] == 's' || format[i] == 'f' || format[i] == 'x'))
|
||||
{
|
||||
// Nếu gặp ký tự kết thúc định dạng (s, d, f, ...) thì dừng lại sau ký tự đó
|
||||
char c = format[i];
|
||||
if (c == 's' || c == 'd' || c == 'f' || c == 'u' || c == 'x' || c == 'g')
|
||||
{
|
||||
// i++; // Đã ở đúng vị trí để vòng lặp cha thực hiện i++ tiếp theo
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append(format[i]);
|
||||
}
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -628,7 +674,7 @@ public class EditBoxItemBase
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private bool TryParseInt(string text, int start, out int value)
|
||||
{
|
||||
int end = start;
|
||||
@@ -638,7 +684,7 @@ public class EditBoxItemBase
|
||||
|
||||
return int.TryParse(text.Substring(start, end - start), out value);
|
||||
}
|
||||
|
||||
|
||||
private bool TryParseUInt(string text, int start, out uint value)
|
||||
{
|
||||
int end = start;
|
||||
@@ -803,4 +849,4 @@ public class EditboxScriptItem
|
||||
{
|
||||
return Data?.Length ?? 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,7 +259,7 @@ namespace CSNetwork
|
||||
|
||||
Debug.Log($"[GameSession] Creating role - UserID: {_currentUserId}, Localsid: {_localsid}, Profession: {roleInfo.occupation}, Gender: {roleInfo.gender}");
|
||||
Debug.Log($"[GameSession] RoleInfo details - Name size: {roleInfo.name?.Size ?? 0}, Equipment count: {roleInfo.equipment?.Count ?? 0}, Custom data size: {roleInfo.custom_data?.Size ?? 0}, Race: {roleInfo.race}");
|
||||
|
||||
|
||||
// Log first few bytes of custom_data for debugging
|
||||
if (roleInfo.custom_data != null && roleInfo.custom_data.Size > 0)
|
||||
{
|
||||
@@ -268,7 +268,7 @@ namespace CSNetwork
|
||||
string hexPreview = BitConverter.ToString(customDataPreview).Replace("-", " ");
|
||||
Debug.Log($"[GameSession] Custom_data preview (first 16 bytes): {hexPreview}");
|
||||
}
|
||||
|
||||
|
||||
Debug.Log($"[GameSession] Sending createrole protocol (Type: {createRoleProtocol.Type})");
|
||||
SendProtocol(createRoleProtocol);
|
||||
}
|
||||
@@ -331,7 +331,7 @@ namespace CSNetwork
|
||||
// Initialize custom data exactly as C++ does: memset to 0, then set specific values
|
||||
// This matches C++ LoadDefaultCustomizeData behavior
|
||||
roleInfo.custom_data = CreateDefaultCustomizeData(profession, gender);
|
||||
|
||||
|
||||
// Initialize other empty custom data fields
|
||||
roleInfo.custom_status = new Octets();
|
||||
roleInfo.charactermode = new Octets();
|
||||
@@ -370,31 +370,31 @@ namespace CSNetwork
|
||||
const int CUSTOMIZE_DATA_SIZE = 176; // Match server expectation (176 bytes from response)
|
||||
const uint CUSTOMIZE_DATA_VERSION = 0x10007001; // CUSTOMIZE_DATA_VERSION from C++
|
||||
byte[] customDataBytes = new byte[CUSTOMIZE_DATA_SIZE];
|
||||
|
||||
|
||||
// Step 1: memset to 0 (already done by new byte[])
|
||||
|
||||
|
||||
// Step 2: Set dwVersion at offset 0-3 (little-endian)
|
||||
byte[] versionBytes = BitConverter.GetBytes(CUSTOMIZE_DATA_VERSION);
|
||||
Array.Copy(versionBytes, 0, customDataBytes, 0, 4);
|
||||
|
||||
|
||||
// Step 3: FACE_CUSTOMIZEDATA at offset 4-87 is already zero (84 bytes)
|
||||
// (In C++ this would be loaded from INI, but for now we use zeros)
|
||||
|
||||
|
||||
// Step 4: bodyID at offset 88-89 is already zero (2 bytes)
|
||||
// Note: There might be 2 bytes padding here if struct is 4-byte aligned
|
||||
|
||||
// Step 5: Set colorBody to 0xffffffff
|
||||
|
||||
// Step 5: Set colorBody to 0xffffffff
|
||||
// Try offset 90 first (no padding), if that doesn't work try 92 (with padding)
|
||||
byte[] colorBodyBytes = BitConverter.GetBytes(0xffffffffu);
|
||||
Array.Copy(colorBodyBytes, 0, customDataBytes, 90, 4); // Try 90 first
|
||||
|
||||
|
||||
// Step 6: Set all 6 scale fields to 128
|
||||
// Try offset 94 first (no padding), if that doesn't work try 96 (with padding)
|
||||
for (int i = 94; i < 100; i++)
|
||||
{
|
||||
customDataBytes[i] = 128;
|
||||
}
|
||||
|
||||
|
||||
return new Octets(customDataBytes);
|
||||
}
|
||||
|
||||
@@ -997,7 +997,7 @@ namespace CSNetwork
|
||||
}
|
||||
else if (pCmd.iMessage == 133 || pCmd.iMessage == 134)
|
||||
{
|
||||
// deal failed
|
||||
// deal failed
|
||||
//pGameRun.PostMessage(MSG_HST_BUY_SELL_FAIL, MAN_PLAYER, 0, (DWORD)pDataBuf, pCmdHeader.cmd);
|
||||
}
|
||||
else if (pCmd.iMessage == 158)
|
||||
@@ -1343,7 +1343,7 @@ namespace CSNetwork
|
||||
private void HandleCreateRoleResponse(createrole_re protocol)
|
||||
{
|
||||
Debug.Log($"[GameSession] HandleCreateRoleResponse - result: {protocol.result}, roleid: {protocol.roleid}");
|
||||
|
||||
|
||||
if (protocol.result != (int)ErrCode.ERR_SUCCESS)
|
||||
{
|
||||
string errorMsg = $"Create role failed with result code: {protocol.result} (ERR_SUCCESS = {(int)ErrCode.ERR_SUCCESS})";
|
||||
@@ -1364,7 +1364,7 @@ namespace CSNetwork
|
||||
private void HandleErrorInfo(errorinfo protocol)
|
||||
{
|
||||
Debug.LogError($"[GameSession] Server error - Errcode: {protocol.Errcode}");
|
||||
|
||||
|
||||
// If we're waiting for create role response and get an error, fail the callback
|
||||
if (_createRoleCallback != null)
|
||||
{
|
||||
@@ -1656,8 +1656,8 @@ namespace CSNetwork
|
||||
g.Data = C2SCommandFactory.CreatePlayerLogoutCmd(outType);
|
||||
SendProtocol(g, complete);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void c2s_SendCmdStopMove(in Vector3 vDest, float fSpeed, int iMoveMode,
|
||||
byte byDir, ushort wStamp, int iTime)
|
||||
{
|
||||
@@ -1687,7 +1687,7 @@ namespace CSNetwork
|
||||
{
|
||||
if (string.IsNullOrEmpty(szMsg))
|
||||
return;
|
||||
|
||||
|
||||
publicchat p = new publicchat();
|
||||
p.Channel = cChannel;
|
||||
p.Roleid = m_iCharID;
|
||||
@@ -1727,14 +1727,14 @@ namespace CSNetwork
|
||||
BitConverter.GetBytes(index).CopyTo(bytes, 3);
|
||||
p.Data.Replace(bytes);
|
||||
}
|
||||
|
||||
|
||||
byte[] unicodeBytes = Encoding.Unicode.GetBytes(szMsg);
|
||||
p.Msg.Replace(unicodeBytes);
|
||||
SendProtocol(p);
|
||||
|
||||
if (cChannel is (byte)ChatChannel.GP_CHAT_LOCAL
|
||||
|
||||
if (cChannel is (byte)ChatChannel.GP_CHAT_LOCAL
|
||||
or (byte)ChatChannel.GP_CHAT_FARCRY
|
||||
or (byte)ChatChannel.GP_CHAT_SUPERFARCRY
|
||||
or (byte)ChatChannel.GP_CHAT_SUPERFARCRY
|
||||
or (byte)ChatChannel.GP_CHAT_BATTLE
|
||||
or (byte)ChatChannel.GP_CHAT_COUNTRY) {
|
||||
CECHostPlayer pHost = EC_Game.GetGameRun().GetHostPlayer();
|
||||
@@ -1761,7 +1761,7 @@ namespace CSNetwork
|
||||
EventBus.Publish(new ChatMessageEvent(szMsg, p.Channel));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void LoadConfigData()
|
||||
{
|
||||
getuiconfig p = new getuiconfig();
|
||||
@@ -1776,7 +1776,7 @@ namespace CSNetwork
|
||||
public void SaveConfigData(byte[] pBuf, int len)
|
||||
{
|
||||
BMLogger.Log($"[MH] Session.SaveConfigData | len={len}");
|
||||
|
||||
|
||||
if (pBuf == null || len <= 0) return;
|
||||
var p = new setuiconfig();
|
||||
p.Roleid = m_iCharID;
|
||||
@@ -1784,7 +1784,7 @@ namespace CSNetwork
|
||||
byte[] slice = new byte[len];
|
||||
Buffer.BlockCopy(pBuf, 0, slice, 0, len);
|
||||
p.Ui_config = new Octets(slice);
|
||||
|
||||
|
||||
// return;
|
||||
SendProtocol(p);
|
||||
}
|
||||
@@ -1802,7 +1802,7 @@ namespace CSNetwork
|
||||
OnTaskChatMessage(p.Msg.RawBuffer, p.Msg.Size);
|
||||
return true;
|
||||
}*/
|
||||
|
||||
|
||||
// TODO: Porting logic OnPrtcWorldChat hoàn chỉnh từ C++ if needed
|
||||
Debug.Log("[Cuong] OnPrtcWorldChat");
|
||||
return true;
|
||||
@@ -1818,7 +1818,7 @@ namespace CSNetwork
|
||||
// Tương đương OnBattleChatMessage trong C++
|
||||
// Hiện tại đơn giản hóa việc hiển thị, thực tế cần parse nội dung Battle cụ thể
|
||||
Debug.Log($"[Battle Chat] RoleID: {p.Srcroleid}");
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool OnFortressChatMessage(chatmessage p, List<int> pPendingFactions)
|
||||
@@ -1844,7 +1844,7 @@ namespace CSNetwork
|
||||
private bool OnPrtcChatMessage(Protocol pProtocol, bool bCalledagain)
|
||||
{
|
||||
CECGameUIMan pGameUI = EC_Game.GetGameRun().GetUIManager().GetInGameUIMan();
|
||||
|
||||
|
||||
chatmessage p = (chatmessage)pProtocol;
|
||||
//var channel = (ChatChannel)p.Channel;
|
||||
Debug.Log("[Cuong] reciver chat channel: " + p.Channel);
|
||||
@@ -1856,7 +1856,7 @@ namespace CSNetwork
|
||||
}
|
||||
|
||||
EC_IvtrItem pItem = CHAT_S2C.CreateChatItem(p.Data);
|
||||
|
||||
|
||||
string szMsg = null;
|
||||
string strTemp = Encoding.Unicode.GetString(p.Msg.ToArray(), 0, p.Msg.Length);
|
||||
string strMsgOrigion = strTemp;
|
||||
@@ -1892,14 +1892,14 @@ namespace CSNetwork
|
||||
}
|
||||
break;
|
||||
case 18: case 19: case 20: case 21: case 22: // Auction Message
|
||||
// pGameUI.AddSysAuctionMessage(...)
|
||||
// pGameUI.AddSysAuctionMessage(...)
|
||||
Debug.Log("[Auction] " + strTemp);
|
||||
EventBus.Publish(new ChatMessageEvent(strTemp, p.Channel));
|
||||
break;
|
||||
case 24: // Task Message
|
||||
// OnTaskChatMessage(p.Data.RawBuffer, p.Data.Size);
|
||||
break;
|
||||
case 29: case 30: case 31: case 32: case 33: case 34:
|
||||
case 29: case 30: case 31: case 32: case 33: case 34:
|
||||
case 35: case 36: case 37: case 38: case 39: case 40:
|
||||
case 41: case 42: case 43: case 45: // Fortress Message
|
||||
OnFortressChatMessage(p, null);
|
||||
@@ -1949,18 +1949,18 @@ namespace CSNetwork
|
||||
{
|
||||
Debug.Log("[Cuong] Other 1");
|
||||
char[] szText = new char[80];
|
||||
AUICommon.AUI_ConvertChatString(szName, szText, false);
|
||||
AUICommon.AUI_ConvertChatString(ref szName,ref szText, false);
|
||||
|
||||
string fmt = AUICommon.ConvertPrintfToCSharpFormat(pStrTab.GetWideString((int)FixedMsg.FIXMSG_CHAT));
|
||||
string str = string.Format(
|
||||
pStrTab.GetWideString((int)FixedMsg.FIXMSG_CHAT),
|
||||
fmt,
|
||||
szName,
|
||||
strTemp
|
||||
);
|
||||
// Convert to EventBus
|
||||
|
||||
/*EC_Game.GetGameRun().AddChatMessage(strTemp, p.Channel, p.Srcroleid,
|
||||
/*EC_Game.GetGameRun().AddChatMessage(strTemp, p.Channel, p.Srcroleid,
|
||||
null, 0, p.Emotion, null, strMsgOrigion);*/
|
||||
EventBus.Publish(new ChatMessageEvent(strTemp, p.Channel));
|
||||
EventBus.Publish(new ChatMessageEvent(str, p.Channel));
|
||||
// Set player's last said words
|
||||
CECPlayer pPlayer = EC_Game.GetGameRun().GetWorld().GetPlayerMan().GetPlayer(p.Srcroleid);
|
||||
if (pPlayer != null)
|
||||
@@ -1978,14 +1978,14 @@ namespace CSNetwork
|
||||
if (pNPC != null)
|
||||
{
|
||||
string str;
|
||||
string template = pStrTab.GetWideString((int)FixedMsg.FIXMSG_CHAT2);
|
||||
string template = AUICommon.ConvertPrintfToCSharpFormat(pStrTab.GetWideString((int)FixedMsg.FIXMSG_CHAT2));
|
||||
|
||||
string message = string.Format(
|
||||
template,
|
||||
pNPC.GetName(),
|
||||
strTemp
|
||||
);
|
||||
|
||||
|
||||
EC_Game.GetGameRun().AddChatMessage(
|
||||
message,
|
||||
p.Channel,
|
||||
@@ -2030,7 +2030,7 @@ namespace CSNetwork
|
||||
EC_Game.GetConfigs().ApplyUserSetting();
|
||||
}
|
||||
|
||||
// Now, Get config data request is sent after all host initial data ready.
|
||||
// Now, Get config data request is sent after all host initial data ready.
|
||||
// so when we receive this reply, we can do some last work before game
|
||||
// really starts. Maybe it's not the best place to do these work, but
|
||||
// now we do it here.
|
||||
@@ -2041,7 +2041,7 @@ namespace CSNetwork
|
||||
pGameUI.EnableUI(true);
|
||||
|
||||
// Get referral name for adding friend or other display
|
||||
//TODO: a Hung lam phan select role info di
|
||||
//TODO: a Hung lam phan select role info di
|
||||
/* RoleInfo info = EC_Game.GetGameRun().GetSelectedRoleInfo();
|
||||
if (info.referrer_role > 0)
|
||||
GetPlayerBriefInfo(1, info.referrer_role, 2);*/
|
||||
@@ -2062,7 +2062,7 @@ namespace CSNetwork
|
||||
CECMCDownload::GetInstance().SendGetDownloadOK();*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void OnPrtcSetConfigRe(Protocol pProtocol)
|
||||
{
|
||||
SetUIConfig_Re p = (SetUIConfig_Re)pProtocol;
|
||||
@@ -2072,12 +2072,12 @@ namespace CSNetwork
|
||||
if (CECGameRun.Instance != null)
|
||||
{
|
||||
TestLogoutLogic.Instance.WasClientSendLogoutMessage = true;
|
||||
|
||||
|
||||
CECGameRun.Instance.GetPendingLogOut().TriggerAll();
|
||||
CECGameRun.Instance.GetPendingLogOut().Clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void OnPrtcPlayerBaseInfoRe(Protocol pProtocol)
|
||||
{
|
||||
playerbaseinfo_re p = (playerbaseinfo_re)pProtocol;
|
||||
@@ -2195,7 +2195,7 @@ namespace CSNetwork
|
||||
BYTE* pBuf = (BYTE*)a_malloctemp(iSize);
|
||||
if (!pBuf)
|
||||
return;
|
||||
|
||||
|
||||
((cmd_header*)pBuf)->cmd = C2S::GET_OTHER_EQUIP;
|
||||
|
||||
cmd_get_other_equip* pCmd = (cmd_get_other_equip*)(pBuf + sizeof (cmd_header));
|
||||
@@ -2212,7 +2212,7 @@ namespace CSNetwork
|
||||
var idlist = new int[iNumSend];
|
||||
for (int i=0; i < iNumSend; i++)
|
||||
idlist[i] = aIDs[iCount+i];
|
||||
|
||||
|
||||
gamedatasend gamedatasend = new gamedatasend();
|
||||
gamedatasend.Data = C2SCommandFactory.CreateGetOtherEquipCmd(iNumID, idlist);
|
||||
SendProtocol(gamedatasend);
|
||||
@@ -2328,7 +2328,7 @@ namespace CSNetwork
|
||||
gamedatasend.Data = C2SCommandFactory.CreateNakeCmd(C2SCommand.CommandID.STAND_UP);
|
||||
SendProtocol(gamedatasend);
|
||||
}
|
||||
|
||||
|
||||
public void c2s_SendCmdAutoTeamSetGoal(int type, int goal_id, int op)
|
||||
{
|
||||
gamedatasend gamedatasend = new gamedatasend();
|
||||
@@ -2416,9 +2416,9 @@ namespace CSNetwork
|
||||
|
||||
public void c2s_CmdGoto(float x, float y, float z)
|
||||
{
|
||||
c2s_SendCmdGoto(x, y, z);
|
||||
c2s_SendCmdGoto(x, y, z);
|
||||
}
|
||||
|
||||
|
||||
// Send C2S::GOTO command data
|
||||
void c2s_SendCmdGoto(float x, float y, float z)
|
||||
{
|
||||
@@ -2545,7 +2545,7 @@ namespace CSNetwork
|
||||
gamedatasend.Data = C2SCommandFactory.CreateNPCSevRestorePetCmd(iPetIdx);
|
||||
SendProtocol(gamedatasend);
|
||||
}
|
||||
|
||||
|
||||
// Cross-server get in (C++: c2s_CmdNPCSevCrossServerGetIn) — TODO: implement C2S packet when needed
|
||||
public void c2s_CmdNPCSevCrossServerGetIn()
|
||||
{
|
||||
@@ -2557,6 +2557,6 @@ namespace CSNetwork
|
||||
{
|
||||
// TODO: C2SCommandFactory.CreateNPCSevCrossServerGetOutCmd() and SendProtocol
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ using UnityEngine.UI;
|
||||
namespace BrewMonster.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// Login Flow:
|
||||
/// Login Flow:
|
||||
/// 1. Enter username and password
|
||||
/// 2. Click login button
|
||||
/// 3. Login success, get the list of characters
|
||||
@@ -92,13 +92,14 @@ namespace BrewMonster.UI
|
||||
#if UNITY_EDITOR
|
||||
if (Input.GetKeyUp(KeyCode.LeftAlt))
|
||||
{
|
||||
_usernameInputField.text = "test004";
|
||||
_usernameInputField.text = "test016";
|
||||
_passwordInputField.text = "123456";
|
||||
OnLoginButtonClicked();
|
||||
}
|
||||
|
||||
if (Input.GetKeyUp(KeyCode.Tab))
|
||||
{
|
||||
_usernameInputField.text = "test002";
|
||||
_usernameInputField.text = "test017";
|
||||
_passwordInputField.text = "123456";
|
||||
OnLoginButtonClicked();
|
||||
}
|
||||
@@ -135,7 +136,7 @@ namespace BrewMonster.UI
|
||||
BMLogger.LogError("[LoginScreenUI] Username/password empty.");
|
||||
await BeginGameLoginAsync(_usernameInputField.text, _passwordInputField.text);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private async Task BeginGameLoginAsync(string username, string password)
|
||||
@@ -179,7 +180,7 @@ namespace BrewMonster.UI
|
||||
// If we're returning to select role, skip straight to select role without showing login UI again, since we never fully left the game session.
|
||||
OnLoginComplete(true);
|
||||
return;
|
||||
|
||||
|
||||
// Auto-login to reach Select Role like the original client, without showing Tech3C auth UI again.
|
||||
if (!string.IsNullOrEmpty(_usernameInputField.text) && !string.IsNullOrEmpty(_passwordInputField.text))
|
||||
{
|
||||
@@ -192,7 +193,7 @@ namespace BrewMonster.UI
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Callback when the login is complete.
|
||||
/// Callback when the login is complete.
|
||||
/// Then get the list of characters
|
||||
/// </summary>
|
||||
private void OnLoginComplete(bool result)
|
||||
@@ -214,7 +215,7 @@ namespace BrewMonster.UI
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Callback when the list of characters is retrieved.
|
||||
/// Callback when the list of characters is retrieved.
|
||||
/// Then move to the select character screen
|
||||
/// </summary>
|
||||
private void OnGetRoleListComplete(List<RoleInfo> roleInfos)
|
||||
@@ -344,7 +345,7 @@ namespace BrewMonster.UI
|
||||
UnityGameSession.EnterWorldAsync(roleInfo, OnEnterWorldComplete);
|
||||
#else
|
||||
string nameScene = UnityGameSession.Instance.GetWorldInstanceName();
|
||||
UnityGameSession.Instance.LoadScene(nameScene, LoadSceneMode.Single,
|
||||
UnityGameSession.Instance.LoadScene(nameScene, LoadSceneMode.Single,
|
||||
(progress) =>
|
||||
{
|
||||
LoadingSceneController.Instance.SetProgress(progress);
|
||||
@@ -356,7 +357,7 @@ namespace BrewMonster.UI
|
||||
isDoneWorldRender = true;
|
||||
actLoadChar?.Invoke();
|
||||
UnityGameSession.EnterWorldAsync(roleInfo, OnEnterWorldComplete);
|
||||
|
||||
|
||||
});
|
||||
#endif
|
||||
}, null);
|
||||
@@ -433,4 +434,4 @@ namespace BrewMonster.UI
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,10 +206,10 @@ RectTransform:
|
||||
- {fileID: 6133989890986254344}
|
||||
m_Father: {fileID: 1983722419643715407}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 500, y: 426.75708}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!222 &6409592904291504631
|
||||
CanvasRenderer:
|
||||
@@ -458,11 +458,11 @@ RectTransform:
|
||||
- {fileID: 4454076196230765805}
|
||||
m_Father: {fileID: 6199635200021499044}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: -288.98}
|
||||
m_SizeDelta: {x: 508.681, y: 53}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
m_AnchorMin: {x: 0.5, y: 0}
|
||||
m_AnchorMax: {x: 0.5, y: 0}
|
||||
m_AnchoredPosition: {x: -396, y: 79}
|
||||
m_SizeDelta: {x: 75, y: 75}
|
||||
m_Pivot: {x: 0.5, y: 0}
|
||||
--- !u!1 &4190358850504021446
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -481,7 +481,7 @@ GameObject:
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!224 &1983722419643715407
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -497,10 +497,10 @@ RectTransform:
|
||||
- {fileID: 7473152984931807423}
|
||||
m_Father: {fileID: 6199635200021499044}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: -783}
|
||||
m_SizeDelta: {x: 508.681, y: 441.022}
|
||||
m_AnchorMin: {x: 0.5, y: 0}
|
||||
m_AnchorMax: {x: 0.5, y: 0}
|
||||
m_AnchoredPosition: {x: -346.5, y: 50}
|
||||
m_SizeDelta: {x: 550, y: 450}
|
||||
m_Pivot: {x: 0, y: 0}
|
||||
--- !u!222 &5213722908587404148
|
||||
CanvasRenderer:
|
||||
@@ -764,7 +764,7 @@ RectTransform:
|
||||
m_Father: {fileID: 3976287853544917220}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 20, y: 20}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
@@ -859,7 +859,7 @@ MonoBehaviour:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5535948066766320732}
|
||||
m_Enabled: 1
|
||||
m_Enabled: 0
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
|
||||
m_Name:
|
||||
@@ -1028,7 +1028,7 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: "\u200B"
|
||||
m_text: "<u>5</u>\u200B"
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
@@ -1133,11 +1133,11 @@ RectTransform:
|
||||
- {fileID: 7133716985767026273}
|
||||
m_Father: {fileID: 4963429530816417249}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 116, y: -0.000026464}
|
||||
m_SizeDelta: {x: 160, y: 50}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 75, y: 75}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &5054963699385999060
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1466,9 +1466,9 @@ RectTransform:
|
||||
m_Father: {fileID: 1473672866371037475}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: -17, y: 0}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!222 &4906838759260176767
|
||||
CanvasRenderer:
|
||||
|
||||
Reference in New Issue
Block a user