.
This commit is contained in:
parent
965af02e94
commit
5dd25a3e3f
@ -5,6 +5,7 @@ local DataManager = {
|
||||
function DataManager:init()
|
||||
self.cdCallBack = {}
|
||||
self._cacheManager = {}
|
||||
self:initManager("GameSettingData", "app/userdata/game_setting/game_setting_data")
|
||||
self:initManager("PlayerData", "app/userdata/player/player_data")
|
||||
self:initManager("ChapterData", "app/userdata/chapter/chapter_data")
|
||||
self:initManager("HeroData", "app/userdata/hero/hero_data")
|
||||
|
||||
48
lua/app/userdata/game_setting/game_setting_data.lua
Normal file
48
lua/app/userdata/game_setting/game_setting_data.lua
Normal file
@ -0,0 +1,48 @@
|
||||
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
|
||||
10
lua/app/userdata/game_setting/game_setting_data.lua.meta
Normal file
10
lua/app/userdata/game_setting/game_setting_data.lua.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d3d203112916fef4da96460958d056e2
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
Loading…
x
Reference in New Issue
Block a user