PlazaRoomManager.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. using System;
  2. using UnityEngine;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using LitJson;
  6. using Sfs2X.Core;
  7. using Sfs2X.Entities;
  8. using Sfs2X.Entities.Data;
  9. using Sfs2X.Requests;
  10. using Sfs2X.Entities.Variables;
  11. using UnityEngine.UI;
  12. public class PlazaRoomManager
  13. {
  14. public class PlazaRoomPlayer
  15. {
  16. #region Config
  17. public string NickName;
  18. public Player Player;
  19. public Transform NickNameTransform;
  20. public Transform MessageBox;
  21. public List<TweenRoot> TweenRoots;
  22. #endregion
  23. public PlazaRoomPlayer(Player player, string nickname)
  24. {
  25. Player = player;
  26. TweenRoots = new List<TweenRoot>();
  27. NickNameTransform = ManaReso.Get("NickName", Folder.UI, false, ManaReso.Get("W_HudParent"), false, ObjType.NickName);
  28. HudTarget hudTarget = NickNameTransform.GetComponent<HudTarget>();
  29. if (hudTarget == null)
  30. {
  31. hudTarget = NickNameTransform.AddComponent<HudTarget>();
  32. }
  33. hudTarget.PosTra = Player.ChildDic["NickName"];
  34. hudTarget.SetPosition();
  35. NickName = string.IsNullOrEmpty(nickname) ? Language.GetStr("UI", "未命名") : nickname;
  36. NickNameTransform.GetComponent<Text>().text = NickName;
  37. MessageBox = ManaReso.Get("MessageBox", Folder.UI, false, ManaReso.Get("W_HudParent"), false, ObjType.MessageBox);
  38. MessageBox.GetComponentInChildren<BestfitText>().VerticalMinSize = 12;
  39. MessageBox.GetComponentInChildren<BestfitText>().VerticalMaxSize = 20;
  40. hudTarget = MessageBox.GetComponent<HudTarget>();
  41. if (hudTarget == null)
  42. {
  43. hudTarget = MessageBox.AddComponent<HudTarget>();
  44. }
  45. hudTarget.PosTra = Player.ChildDic["MessageBox"];
  46. MessageBox.CreateTweenCG(0, 1, 0.25f, true, true, Curve.EaseOutQuad).InOrigin = true;
  47. }
  48. public void Save()
  49. {
  50. foreach (var tweenRoot in TweenRoots)
  51. {
  52. tweenRoot.Pause();
  53. }
  54. ManaReso.Save(Player);
  55. ManaReso.Save(NickNameTransform);
  56. ManaReso.Save(MessageBox);
  57. Player.PlayAnim(Player.IdleAnimationName);
  58. }
  59. public bool IsMoving;
  60. public float Speed = 1f;
  61. public Vector3 Destination;
  62. public TweenVec MoveTween;
  63. public void MoveTo(Vector3 destination)
  64. {
  65. if (destination.Equal(Player.transform.position))
  66. {
  67. return;
  68. }
  69. if (destination.x > Player.transform.position.x)
  70. {
  71. Player.Flip(PlayerDirection.Right);
  72. }
  73. else
  74. {
  75. Player.Flip(PlayerDirection.Left);
  76. }
  77. float duration = Mathf.Clamp(Vector3.Magnitude(destination - Player.transform.position) / 1.5f, 0.25f, 10f) / Speed;
  78. MoveTween = Player.transform.CreateTweenVec3D(destination, duration, false, true, true, Curve.EaseOutQuad);
  79. MoveTween.StartForward();
  80. MoveTween.AddEventOnetime(EventType.ForwardFinish, StopMove);
  81. TweenRoots.Add(MoveTween);
  82. IsMoving = true;
  83. Destination = destination;
  84. Player.PlayAnim(Player.WalkAnimationName);
  85. }
  86. public void StopMove()
  87. {
  88. IsMoving = false;
  89. Player.PlayAnim(Player.IdleAnimationName);
  90. }
  91. public float MessgeTime = 3f;
  92. public Coroutine MessgeCoroutine;
  93. public void ShowMessage(string message)
  94. {
  95. if (MessgeCoroutine != null)
  96. {
  97. Auxiliary.Instance.StopCoroutine(MessgeCoroutine);
  98. }
  99. MessageBox.GetChild(0).GetComponent<Text>().text = message;
  100. MessageBox.TweenForCG();
  101. MessgeCoroutine = Auxiliary.Instance.DelayCall(() => { MessageBox.TweenBacCG(); }, MessgeTime);
  102. }
  103. }
  104. #region Variable
  105. public GardenSmartFox GardenSmartFox;
  106. public User SelfUser;
  107. public PlazaRoomPlayer SelfInstance;
  108. public Room CurrentPlazaRoom;
  109. public bool InPlazaRoom
  110. {
  111. get { return CurrentPlazaRoom != null; }
  112. }
  113. public bool EnteringPlazaRoom;
  114. public bool IsBlackMaskFinish;
  115. public RequestStatus JoinRoomStatus = RequestStatus.Pending;
  116. public Dictionary<User, PlazaRoomPlayer> UserInstanceDictionary = new Dictionary<User, PlazaRoomPlayer>();
  117. #endregion
  118. public void OnEnterPlazaRoomButton()
  119. {
  120. IsBlackMaskFinish = false;
  121. EnteringPlazaRoom = true;
  122. ManaReso.Get("B_SignIn0").TweenBacCG();
  123. ManaReso.Get("T_NickName").TweenBacCG();
  124. ManaCenter.SceneSwitchLock = true;
  125. TweenRoot tweenRoot = ManaReso.Get("V_BlackMask").TweenBacCG();
  126. tweenRoot.AddEventOnetime
  127. (
  128. EventType.BackwardFinish, () =>
  129. {
  130. IsBlackMaskFinish = true;
  131. TryEnterPlazaRoom();
  132. }
  133. );
  134. GardenSmartFox.ExecuteAfterCheckConection
  135. (
  136. () =>
  137. {
  138. GardenSmartFox.PlazaRoomManager.JoinRoomStatus = RequestStatus.Pending;
  139. GardenSmartFox.ExtensionManager.PlazaRoomExtension.JoinPlazaRoom();
  140. },
  141. (succeed, baseEvent) =>
  142. {
  143. if (!succeed)
  144. {
  145. GardenSmartFox.PlazaRoomManager.JoinRoomStatus = RequestStatus.Failed;
  146. TryEnterPlazaRoom();
  147. }
  148. },
  149. (succeed, baseEvent) =>
  150. {
  151. if (!succeed)
  152. {
  153. GardenSmartFox.PlazaRoomManager.JoinRoomStatus = RequestStatus.Failed;
  154. TryEnterPlazaRoom();
  155. }
  156. }
  157. );
  158. }
  159. public void TryEnterPlazaRoom()
  160. {
  161. if (!GardenSmartFox.PlazaRoomManager.IsBlackMaskFinish)
  162. {
  163. return;
  164. }
  165. if (!GardenSmartFox.PlazaRoomManager.EnteringPlazaRoom)
  166. {
  167. return;
  168. }
  169. if (GardenSmartFox.PlazaRoomManager.JoinRoomStatus == RequestStatus.Pending)
  170. {
  171. return;
  172. }
  173. if (GardenSmartFox.PlazaRoomManager.JoinRoomStatus == RequestStatus.Failed)
  174. {
  175. QuitPlazaRoom();
  176. Bubble.Show(null, Language.GetStr("UI", "加入房间失败"), null, null, () => { ManaReso.Get("V_BlackMask").TweenForCG();},null,false);
  177. EnteringPlazaRoom = false;
  178. }
  179. else if (GardenSmartFox.PlazaRoomManager.JoinRoomStatus == RequestStatus.Succeed)
  180. {
  181. EnterPlazaRoom();
  182. EnteringPlazaRoom = false;
  183. }
  184. }
  185. private Vector3 PlayerDefaultPosition;
  186. public void EnterPlazaRoom()
  187. {
  188. PlazaRoom.Initialize();
  189. foreach (var kv in UserInstanceDictionary)
  190. {
  191. if (kv.Value.Player.transform.parent == null)
  192. kv.Value.Player.transform.parent = ManaReso.Get("PlazaRoom");
  193. }
  194. GardenSmartFox.PlazaRoomManager.PlazaRoomSky = ManaReso.Get("PlazaRoomSky");
  195. SkyOriginPosition = GardenSmartFox.PlazaRoomManager.PlazaRoomSky.position;
  196. GardenSmartFox.PlazaRoomManager.PlazaRoomCamera = ManaReso.Get<Camera>("MainCamera");
  197. GardenSmartFox.PlazaRoomManager.CameraOriginPosition = GardenSmartFox.PlazaRoomManager.PlazaRoomCamera.transform.position;
  198. //Debug.Log(GardenSmartFox.User.Id);
  199. SelfUser = GardenSmartFox.User;
  200. PlayerDefaultPosition = ManaReso.Get("PlazaRoomDefaultPosition").position;
  201. SelfInstance = InstantiatePlayer(SelfUser, ManaNickName.NickName, PlayerDefaultPosition, PlayerDirection.Left, ManaData.GetDressDataIDs(ManaPlayer.Player));
  202. SelfInstance.Player.transform.position += new Vector3(0, 0, -0.001f);
  203. UserInstanceDictionary.Add(SelfUser, SelfInstance);
  204. SendInstantiateRequset(-1);
  205. GardenSmartFox.PlazaRoomManager.CameraLeftBorder = ManaReso.Get("PlazaRoomCameraLeftBorder").position.x;
  206. GardenSmartFox.PlazaRoomManager.CameraRightBorder = ManaReso.Get("PlazaRoomCameraRightBorder").position.x;
  207. GardenSmartFox.PlazaRoomManager.PlazaRoomCamera.transform.SetX(GardenSmartFox.PlazaRoomManager.CameraLeftBorder);
  208. ManaReso.Get("V_BlackMask").TweenForCG();
  209. ManaReso.SetActive("C_Main2", false);
  210. ManaReso.SetActive("Garden", false);
  211. ManaReso.SetActive("PlazaRoom", true);
  212. ManaReso.SetActive("W_HudParent", true);
  213. ManaReso.SetActive("X_PlazaRoom", true);
  214. }
  215. public void ExitPlazaRoom()
  216. {
  217. QuitPlazaRoom();
  218. TweenRoot tweenRoot = ManaReso.Get("V_BlackMask").TweenBacCG();
  219. tweenRoot.AddEventOnetime
  220. (
  221. EventType.BackwardFinish,
  222. () =>
  223. {
  224. PlazaRoomSky.position = SkyOriginPosition;
  225. PlazaRoomCamera.transform.position = CameraOriginPosition;
  226. ManaReso.SetActive("C_Main2", true);
  227. ManaReso.SetActive("Garden", true);
  228. ManaReso.SetActive("PlazaRoom", false);
  229. ManaReso.SetActive("W_HudParent", false);
  230. ManaReso.SetActive("X_PlazaRoom", false);
  231. ManaReso.Get("V_BlackMask").TweenForCG();
  232. ManaReso.Get("B_SignIn0").TweenForCG();
  233. ManaReso.Get("T_NickName").TweenForCG();
  234. foreach (var kv in UserInstanceDictionary)
  235. {
  236. kv.Value.Save();
  237. }
  238. UserInstanceDictionary = new Dictionary<User, PlazaRoomPlayer>();
  239. }
  240. );
  241. }
  242. public void QuitPlazaRoom()
  243. {
  244. ManaCenter.SceneSwitchLock = false;
  245. GardenSmartFox.SmartFox.Send(new LeaveRoomRequest(CurrentPlazaRoom));
  246. GardenSmartFox.PlazaRoomManager.CurrentPlazaRoom = null;
  247. }
  248. public PlazaRoomManager(GardenSmartFox gardenSmartFox)
  249. {
  250. GardenSmartFox = gardenSmartFox;
  251. GardenSmartFox.ExtensionManager.PlazaRoomExtension.onExitPlazaRoom += OnExitPlazaRoom;
  252. GardenSmartFox.ExtensionManager.PlazaRoomExtension.onJoinPlazaRoom += OnJoinPlazaRoom;
  253. GardenSmartFox.ExtensionManager.PlazaRoomExtension.onUserExitCurrentPlazaRoom += OnUserExitPlazaRoom;
  254. GardenSmartFox.ExtensionManager.PlazaRoomExtension.onUserEnterCurrentPlazaRoom += OnUserEnterPlazaRoom;
  255. GardenSmartFox.ExtensionManager.PlazaRoomExtension.onSynchronize += Synchronize;
  256. GardenSmartFox.ExtensionManager.PlazaRoomExtension.onReceiveExpression += ReceiveExpression;
  257. GardenSmartFox.ExtensionManager.PlazaRoomExtension.onReceivePublicMessage += ReceivePublicMessage;
  258. GardenSmartFox.ExtensionManager.PlazaRoomExtension.onInstantiate += OnInstantiate;
  259. gardenSmartFox.Connector.onConnectionLost += OnConectionLost;
  260. }
  261. public void Update()
  262. {
  263. if (!InPlazaRoom)
  264. return;
  265. if (EnteringPlazaRoom)
  266. return;
  267. KeepAliveThread();
  268. CameraControllThread();
  269. }
  270. public float KeepAliveTime = 30;
  271. public float KeepAliveTimer;
  272. public void KeepAliveThread()
  273. {
  274. KeepAliveTimer += Time.deltaTime;
  275. if (KeepAliveTimer > KeepAliveTime)
  276. {
  277. KeepAliveTimer = 0;
  278. GardenSmartFox.AddRequest(GardenSmartFox.ConstructCommandParameter(CommandID.KeepAlive.GetHashCode(), new SFSObject(), 0), RequestType.Immediate);
  279. }
  280. }
  281. public float CameraLeftBorder;
  282. public float CameraRightBorder;
  283. public Vector3 CameraOriginPosition;
  284. public Camera PlazaRoomCamera;
  285. public void CameraControllThread()
  286. {
  287. if (PlazaRoomCamera == null)
  288. {
  289. return;
  290. }
  291. float x;
  292. if (SelfInstance.Player.transform.position.x <= CameraLeftBorder)
  293. {
  294. x = Mathf.Lerp(PlazaRoomCamera.transform.position.x, CameraLeftBorder, Time.deltaTime);
  295. if (SkyTween != null)
  296. SkyTween.Pause();
  297. }
  298. else if (SelfInstance.Player.transform.position.x >= CameraRightBorder)
  299. {
  300. x = Mathf.Lerp(PlazaRoomCamera.transform.position.x, CameraRightBorder, Time.deltaTime);
  301. if (SkyTween != null)
  302. SkyTween.Pause();
  303. }
  304. else
  305. {
  306. x = Mathf.Lerp(PlazaRoomCamera.transform.position.x, SelfInstance.Player.transform.position.x, Time.deltaTime);
  307. }
  308. PlazaRoomCamera.transform.SetX(x);
  309. }
  310. public void MoveTo(Vector3 destination)
  311. {
  312. GardenSmartFoxManager.GardenSmartFox.PlazaRoomManager.SelfInstance.MoveTo(destination);
  313. GardenSmartFoxManager.GardenSmartFox.PlazaRoomManager.SendSynchronizeDestination(destination);
  314. MoveSky(SelfInstance.MoveTween.Duration, SelfInstance.MoveTween.Delta);
  315. }
  316. private float SkyMoveRatio = 0.1f;
  317. private Vector3 SkyOriginPosition;
  318. private TweenRoot SkyTween;
  319. public Transform PlazaRoomSky;
  320. private void MoveSky(float duration, Vector3 offset)
  321. {
  322. offset *= -SkyMoveRatio;
  323. offset.y = 0;
  324. offset.z = 0;
  325. SkyTween = PlazaRoomSky.transform.CreateTweenVecOffset2D(offset, duration, false, true, true, Curve.Linear);
  326. SkyTween.StartForward();
  327. }
  328. public void OnConectionLost(BaseEvent baseEvent)
  329. {
  330. if (InPlazaRoom)
  331. {
  332. OnExitPlazaRoom();
  333. }
  334. }
  335. public void OnExitPlazaRoom()
  336. {
  337. ExitPlazaRoom();
  338. }
  339. public void OnJoinPlazaRoom(Room room)
  340. {
  341. GardenSmartFox.PlazaRoomManager.CurrentPlazaRoom = room;
  342. JoinRoomStatus = RequestStatus.Succeed;
  343. TryEnterPlazaRoom();
  344. }
  345. public void OnUserExitPlazaRoom(User user)
  346. {
  347. UserInstanceDictionary[user].Save();
  348. UserInstanceDictionary.Remove(user);
  349. }
  350. public void OnUserEnterPlazaRoom(User user)
  351. {
  352. SendInstantiateRequset(user);
  353. }
  354. public void Synchronize(User sender, SFSObject parameter)
  355. {
  356. if (!UserInstanceDictionary.ContainsKey(sender))
  357. return;
  358. if (sender.IsItMe)
  359. return;
  360. if (parameter.ContainsKey(DataID.Destination.GetHashString()))
  361. {
  362. Vector3 destination = parameter.GetUtfString(DataID.Destination.GetHashString()).StringToVector();
  363. SynchronizeDestination(destination, sender);
  364. }
  365. if (parameter.ContainsKey(DataID.Close.GetHashString()))
  366. {
  367. List<int> closeIDs = parameter.GetIntArray(DataID.Destination.GetHashString()).ToList();
  368. SynchronizeClose(closeIDs, sender);
  369. }
  370. //Debug.LogWarning(sender.IsItMe + " : " + jsonData.ToJson());
  371. }
  372. public void SynchronizeClose(List<int> closeIDs, User sender)
  373. {
  374. Player player = UserInstanceDictionary[sender].Player;
  375. foreach (var closeID in closeIDs)
  376. {
  377. CloseUnit closeUnit = ManaPlayer.CloseUnitDic[closeID];
  378. player.ChangeClose(closeUnit.BodyPart, closeUnit.ArmatureName);
  379. }
  380. }
  381. public void SynchronizeDestination(Vector3 destination, User sender)
  382. {
  383. UserInstanceDictionary[sender].MoveTo(destination);
  384. }
  385. private float ExpressionDuration = 1;
  386. public void ReceiveExpression(int expressionID, User sender)
  387. {
  388. PlazaRoomPlayer plazaRoomPlayer = UserInstanceDictionary[sender];
  389. string expressionName = Enum.GetName(typeof(ExpressionID), expressionID);
  390. plazaRoomPlayer.Player.ChangeExpression(expressionName, ExpressionDuration);
  391. string message = $"{plazaRoomPlayer.NickName}:\u3000<({expressionName}按钮)>";
  392. ManaInfoBox.Show(InfoCategory.PlazaRoom, message, Mathf.Infinity, ManaReso.LoadSprite("Expression", Folder.Scene));
  393. ManaReso.SetText("X_CurrentInfoLab", message);
  394. }
  395. public void ReceivePublicMessage(string message, User sender)
  396. {
  397. //Debug.Log(sender.Id);
  398. PlazaRoomPlayer plazaRoomPlayer = UserInstanceDictionary[sender];
  399. plazaRoomPlayer.ShowMessage(message);
  400. message = $"{plazaRoomPlayer.NickName}:\u3000{message}";
  401. ManaInfoBox.Show(InfoCategory.PlazaRoom, message, Mathf.Infinity, ManaReso.LoadSprite("Expression", Folder.Scene));
  402. ManaReso.SetText("X_CurrentInfoLab", message);
  403. }
  404. public void OnInstantiate(User user, SFSObject parameter)
  405. {
  406. if (user.IsItMe)
  407. return;
  408. UserInstanceDictionary.Add(user, InstantiatePlayer(user, parameter));
  409. }
  410. public void SendExpression(ExpressionID expressionID)
  411. {
  412. GardenSmartFoxManager.GardenSmartFox.ExtensionManager.PlazaRoomExtension.SendExpression(expressionID);
  413. }
  414. //private string LastPublicMessage;
  415. public bool SendPublicMessage(string message)
  416. {
  417. if (string.IsNullOrEmpty(message))
  418. {
  419. Bubble.Show(null, Language.GetStr("UI", "内容不能为空"));
  420. return false;
  421. }
  422. //else if (LastPublicMessage == message)
  423. //{
  424. // Bubble.Show(null, Language.GetStr("UI", "请勿重复发送"));
  425. // return false;
  426. //}
  427. else
  428. {
  429. //LastPublicMessage = message;
  430. message = StringFilter.GetFilteredString(message);
  431. GardenSmartFoxManager.GardenSmartFox.ExtensionManager.PlazaRoomExtension.SendPublicMessage(message);
  432. //ManaInfoBox.Show(InfoCategory.PlazaRoom, $"{SelfUser.Name} : {message}", 10, ManaReso.LoadSprite("Expression", Folder.Scene));
  433. return true;
  434. }
  435. }
  436. public void SendInstantiateRequset(User receiver)
  437. {
  438. SendInstantiateRequset(receiver.Id);
  439. }
  440. public void SendInstantiateRequset(int receiverID)
  441. {
  442. SFSObject parameter = new SFSObject();
  443. parameter.PutInt(DataID.SenderID.GetHashString(), GardenSmartFox.User.Id);
  444. parameter.PutIntArray(DataID.Close.GetHashString(), ManaData.GetDressDataIDs(SelfInstance.Player).ToArray());
  445. parameter.PutUtfString(DataID.Position.GetHashString(), SelfInstance.Player.transform.position.VectorToString());
  446. parameter.PutInt(DataID.PlayerDirection.GetHashString(), SelfInstance.Player.PlayerDirection.GetHashCode());
  447. parameter.PutUtfString(DataID.NickName.GetHashString(), ManaNickName.NickName);
  448. GardenSmartFox.AddRequest(GardenSmartFox.ConstructCommandParameter(CommandID.Instantiate.GetHashCode(), parameter, receiverID), RequestType.Immediate);
  449. if (SelfInstance.IsMoving)
  450. {
  451. SendSynchronizeDestination(SelfInstance.Destination);
  452. }
  453. }
  454. public void SendSynchronizeDestination(Vector3 destination)
  455. {
  456. GardenSmartFoxManager.GardenSmartFox.ExtensionManager.PlazaRoomExtension.SendSynchronizeDestination(destination);
  457. }
  458. public PlazaRoomPlayer InstantiatePlayer(User user, string nickName, Vector3 position, PlayerDirection direction, List<int> dressDataIDs)
  459. {
  460. Transform parent = ManaReso.Get("PlazaRoom", false);
  461. Transform tra = ManaReso.Get("Player", Folder.Scene, false, parent, false, ObjType.Player);
  462. Player player = tra.GetComponent<Player>();
  463. if (player == null)
  464. {
  465. player = tra.AddScript<Player>();
  466. player.Build();
  467. }
  468. foreach (var id in dressDataIDs)
  469. {
  470. CloseUnit closeUnit = ManaPlayer.CloseUnitDic[id];
  471. closeUnit.ChangeDress(player);
  472. }
  473. player.SetAllCollider(false);
  474. player.transform.position = position;
  475. player.Flip(direction);
  476. tra.localScale = new Vector3(0.525f, 0.525f, 0.525f);
  477. return new PlazaRoomPlayer(player, nickName);
  478. }
  479. public PlazaRoomPlayer InstantiatePlayer(User user, SFSObject parameter)
  480. {
  481. List<int> dressDatas = ManaData.GetDressDataIDs(parameter);
  482. Vector3 position = parameter.GetUtfString(DataID.Position.GetHashString()).StringToVector();
  483. PlayerDirection direction = (PlayerDirection) parameter.GetInt(DataID.PlayerDirection.GetHashString());
  484. string nickName = parameter.GetUtfString(DataID.NickName.GetHashString());
  485. PlazaRoomPlayer plazaRoomPlayer = InstantiatePlayer(user, nickName, position, direction, dressDatas);
  486. return plazaRoomPlayer;
  487. }
  488. }