源战役客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 line
1.9 KiB

  1. SettingModel = SettingModel or BaseClass(BaseModel)
  2. --请求所有的设置
  3. SettingModel.RequestTotalSetting = "SettingModel.RequestTotalSetting"
  4. SettingModel.RequestSetSubtype = "SettingModel.RequestSetSubtype"
  5. SettingModel.BROADCAST_SETTING_CHANGE = "SettingModel.BROADCAST_SETTING_CHANGE"
  6. SettingModel.TYPE = {
  7. TEXT = 1,
  8. VOICE = 2,
  9. }
  10. SettingModel.SUBTYPE = {
  11. SYSTEM = 1,
  12. TEXTONLY = 1,
  13. WORLD = 2,
  14. AROUND = 3,
  15. GUILD = 4,
  16. TEAM = 5,
  17. FRIEND = 6,
  18. CROSS = 7,
  19. AUTOPLAY = 8,
  20. }
  21. SettingModel.CHANGE_DAY = {
  22. HOUR_0 = 0,
  23. HOUR_4 = 4,
  24. }
  25. SettingModel.C2T = {
  26. [10] = SettingModel.SUBTYPE.SYSTEM,
  27. [1] = SettingModel.SUBTYPE.WORLD,
  28. [3] = SettingModel.SUBTYPE.AROUND,
  29. [4] = SettingModel.SUBTYPE.GUILD,
  30. [5] = SettingModel.SUBTYPE.TEAM,
  31. [7] = SettingModel.SUBTYPE.FRIEND,
  32. [13] = SettingModel.SUBTYPE.CROSS,
  33. }
  34. function SettingModel:__init()
  35. SettingModel.Instance = self
  36. --分大类 小类
  37. self.total_setting = {}
  38. self.block_change_record = {}
  39. end
  40. function SettingModel:getInstance()
  41. if SettingModel.Instance == nil then
  42. SettingModel.New()
  43. end
  44. return SettingModel.Instance
  45. end
  46. function SettingModel:SetTotalSettingInfo(vo)
  47. local list = self.total_setting[vo.type]
  48. if list == nil then
  49. list = {}
  50. self.total_setting[vo.type] = list
  51. end
  52. for k,v in pairs(vo.setting_list) do
  53. list[v.subtype] = v.is_open
  54. end
  55. end
  56. -- 1 开 0 关
  57. function SettingModel:GetSettingInfo(type,subtype)
  58. local list = self.total_setting[type]
  59. if list == nil then return 0 end
  60. for k,v in pairs(list) do
  61. if k == subtype then
  62. return v
  63. end
  64. end
  65. -- local config = Config.Setting[type.."@"..subtype]
  66. -- local state = 1
  67. -- if config then
  68. -- state = config.is_open
  69. -- end
  70. -- return state
  71. end
  72. -- 1 开 0 关
  73. function SettingModel:SetSettingInfo(type,subtype,is_open)
  74. local list = self.total_setting[type]
  75. if list == nil then
  76. list = {}
  77. self.total_setting[type] = list
  78. end
  79. list[subtype] = is_open
  80. end