LeagueDataManager.cs 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. using System.Collections.Generic;
  2. using ET;
  3. namespace GFGGame
  4. {
  5. public class LeagueDataManager : SingletonBase<LeagueDataManager>
  6. {
  7. public int Type = 2;// 1:已经加入军团 2:未加入军团
  8. public LeagueData LeagueData;//联盟信息
  9. public int HallLevel { get { return (int)GetNumeriValue(LeagueNumericType.HallLevel); } }
  10. public int HotelLevel { get { return (int)GetNumeriValue(LeagueNumericType.HotelLevel); } }
  11. public int StoreLevel { get { return (int)GetNumeriValue(LeagueNumericType.StoreLevel); } }
  12. public Dictionary<int, long> LeagueNumber = new Dictionary<int, long>();//联盟数值
  13. public Dictionary<long, LeagueListData> ListDatas = new Dictionary<long, LeagueListData>();//联盟列表
  14. public Dictionary<long, OtherRoleInfoData> ListApplyDatas = new Dictionary<long, OtherRoleInfoData>();//联盟申请列表
  15. public List<LeagueLogData> ListLogDatas = new List<LeagueLogData>();//日志数据
  16. public Dictionary<long, int> ListAnswerDatas = new Dictionary<long, int>();//答题数据
  17. public void Clear()
  18. {
  19. Type = 2;
  20. ListDatas.Clear();
  21. LeagueData = null;
  22. ListApplyDatas.Clear();
  23. ListLogDatas.Clear();
  24. }
  25. public void SetNumeric(int type, long value)
  26. {
  27. LeagueNumber[type] = value;
  28. }
  29. public long GetNumeriValue(int type)
  30. {
  31. if (LeagueNumber.TryGetValue(type, out long value))
  32. {
  33. return value;
  34. }
  35. return 0;
  36. }
  37. public string GetMemberTitle(int pos)
  38. {
  39. string title = "";
  40. switch (pos)
  41. {
  42. case LeaguePos.Owner:
  43. title = "社长";
  44. break;
  45. case LeaguePos.SubOwner:
  46. title = "副社长";
  47. break;
  48. case LeaguePos.Flower:
  49. title = "御史";
  50. break;
  51. case LeaguePos.Member:
  52. title = "成员";
  53. break;
  54. }
  55. return title;
  56. }
  57. public int GetMyPos()
  58. {
  59. if (LeagueDataManager.Instance.LeagueData.LeagueMemberDatas.TryGetValue(RoleDataManager.roleId, out LeagueMemberData memberData))
  60. {
  61. return memberData.Pos;
  62. }
  63. return LeaguePos.Member;
  64. }
  65. // //判断一个玩家是否是会长副会长
  66. // public bool CheckPlayerIsLeader()
  67. // {
  68. // }
  69. /// <summary>
  70. /// 根据祈福类型获取祈福次数
  71. /// </summary>
  72. /// <returns></returns>
  73. public int GetPrayTimesByType(int prayType)
  74. {
  75. int curCount = 0;
  76. switch (prayType)
  77. {
  78. case LeaguePrayType.First:
  79. curCount = RoleDataManager.LeagueType1PrayTimes;
  80. break;
  81. case LeaguePrayType.Second:
  82. curCount = RoleDataManager.LeagueType2PrayTimes;
  83. break;
  84. case LeaguePrayType.Third:
  85. curCount = RoleDataManager.LeagueType3PrayTimes;
  86. break;
  87. }
  88. return curCount;
  89. }
  90. }
  91. }