PlazaRoomMge.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using Sfs2X.Entities.Data;
  5. using UnityEngine;
  6. public class PlazaRoomMge : Regist
  7. {
  8. private class RoomData
  9. {
  10. #region Config
  11. private static string IDLabel = "i";
  12. private static string OwnerLabel = "o";
  13. private static string DurationLabel = "d";
  14. private static string MaxPlayerLabel = "m";
  15. private static string NameLabel = "n";
  16. private static string StartTimeLabel = "s";
  17. public int ID;
  18. public long Owner;
  19. public int Duration;
  20. public int MaxPlayer;
  21. public string Name;
  22. public DateTime StartTime;
  23. public bool IsSystemRoom;
  24. #endregion
  25. public RoomData(ISFSObject arg)
  26. {
  27. ID = arg.GetInt(IDLabel);
  28. Owner = arg.GetLong(OwnerLabel);
  29. Duration = arg.GetInt(DurationLabel);
  30. MaxPlayer = arg.GetInt(MaxPlayerLabel);
  31. Name = arg.GetUtfString(NameLabel);
  32. Debug.Log(arg.GetClass(StartTimeLabel).ToString());
  33. Debug.Log(arg.GetData(StartTimeLabel).ToString());
  34. //StartTime = DateTime.Parse();
  35. if (ID == 0)
  36. IsSystemRoom = true;
  37. Debug.Log(ID);
  38. Debug.Log(Owner);
  39. Debug.Log(Duration);
  40. Debug.Log(MaxPlayer);
  41. Debug.Log(Name);
  42. Debug.Log(StartTime);
  43. Debug.Log(IsSystemRoom);
  44. }
  45. }
  46. #region Config
  47. public static bool FilterEnabled;
  48. #endregion
  49. public override void RegistValueA()
  50. {
  51. DatabaseManager.OnReceiveRoomData += OnReceiveRoomData;
  52. DatabaseManager.GetRoomList(0);
  53. }
  54. public static void OnReceiveRoomData(ISFSArray sfsArray)
  55. {
  56. for (int i = 0; i < sfsArray.Count; i++)
  57. {
  58. new RoomData(sfsArray.GetSFSObject(i));
  59. }
  60. }
  61. public static void OpenPanel()
  62. {
  63. ManaReso.Get("Z_BK").TweenForCG();
  64. }
  65. public static void ClosePanel()
  66. {
  67. ManaReso.Get("Z_BK").TweenBacCG();
  68. }
  69. public static void EnableFilter()
  70. {
  71. FilterEnabled = true;
  72. ManaReso.SetActive("Z_InfoImg51", true);
  73. }
  74. public static void DisableFilter()
  75. {
  76. FilterEnabled = false;
  77. ManaReso.SetActive("Z_InfoImg51", false);
  78. }
  79. }