local GameSettingData = class("GameSettingData", BaseData) local QUALITY_LEVEL_LOW = 1 local QUALITY_LEVEL_MID = 5 local QUALITY_LEVEL_HIGH = 10 function GameSettingData:ctor() local qualityLevel = LocalData:getGameQualityLevel() -- 默认是0,按hight处理 if qualityLevel == 0 then qualityLevel = QUALITY_LEVEL_HIGH end if qualityLevel <= QUALITY_LEVEL_LOW then self.data.qualityLevel = QUALITY_LEVEL_LOW if not EDITOR_MODE then CS.UnityEngine.Application.targetFrameRate = 60 end else self.data.qualityLevel = QUALITY_LEVEL_HIGH if not EDITOR_MODE then CS.UnityEngine.Application.targetFrameRate = 60 end end end function GameSettingData:switchQualityLevel() if self:isHighQualityLevel() then self.data.qualityLevel = QUALITY_LEVEL_LOW if not EDITOR_MODE then CS.UnityEngine.Application.targetFrameRate = 60 end else self.data.qualityLevel = QUALITY_LEVEL_HIGH if not EDITOR_MODE then CS.UnityEngine.Application.targetFrameRate = 60 end end LocalData:setGameQualityLevel(self.data.qualityLevel) end function GameSettingData:isHighQualityLevel() return self.data.qualityLevel >= QUALITY_LEVEL_HIGH end function GameSettingData:isLowQualityLevel() return self.data.qualityLevel <= QUALITY_LEVEL_LOW end return GameSettingData