SFSPlazaRoomManager.cs 20 KB

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