local SettingHelper = {} local DeviceLODSetting = require "Modules/Setting/DeviceLODSetting" local SettingImpl_Default = require "Modules/Setting/SettingImpl_Default" local SettingImpl_HD = require "Modules/Setting/SettingImpl_HD" local SettingImpl = {} local LodLevelCustom, LodLevelHigh, LodLevelMid, LodLevelLow = -1, 2, 1, 0 local SettingImpl_Current = SettingImpl_Default function SettingHelper.Init() --TODO 区分PC包,使用高画质和提高显示容量,后续如果需要扩展部分高端机型,也可以放在这里 if GameAppInfo.IsPCOrMacPackage() then SettingImpl_Current = SettingImpl_HD logging.crit(LTAG.CRIT, "use quality setting HD") else SettingImpl_Current = SettingImpl_Default logging.crit(LTAG.CRIT, "use quality setting Default") end end function SettingHelper.GetSettingValue(settingKeyEnum, settingLevel, deviceLevel) local settingValue = SettingImpl_Current.GetSettingValue(settingKeyEnum, settingLevel, deviceLevel) if not settingValue then settingValue = SettingImpl_Default.GetSettingValue(settingKeyEnum, settingLevel, deviceLevel) end return settingValue end --SettingAPI.SetTextureQuality 的参数 0:FullRes 1:HalfRes function SettingHelper.ExecuteTextureSetting(isCustom, settingLevel, deviceLevel, systemMemory, isPCPackage) --PC平台直接使用最高的贴图质量 if isPCPackage then SettingAPI.SetTextureQuality(0) return end --默认设置为0,内存过低则设置为1,降低贴图质量,降低内存 local textureSettingValue = 0 if UNITY_IOS and systemMemory < 4500 then textureSettingValue = 1 end if UNITY_ANDROID and systemMemory < 5500 then textureSettingValue = 1 end SettingAPI.SetTextureQuality(textureSettingValue) end function SettingHelper.ExecuteFrameSetting(settingLevel) SettingAPI.fpsLevel = settingLevel end function SettingHelper.SwitchLOD(settingLevel) SettingAPI.lodLevel = settingLevel if DeviceLODSetting.QualitySetting[settingLevel] then for k, v in pairs(DeviceLODSetting.QualitySetting[settingLevel]) do SettingHelper.ExecuteSetting(k, settingLevel) end end end function SettingHelper.ExecuteSetting(settingEnum, settingLevel, deviceLevel, forceValue) if not SettingImpl_Current.ExecuteSetting(settingEnum, settingLevel, deviceLevel, forceValue) then SettingImpl_Default.ExecuteSetting(settingEnum, settingLevel, deviceLevel, forceValue) end end --特效等级 function SettingHelper.SetPsPresetConfig(self0, other0, self1, other1, self2, other2) SettingImpl_Current.ApplyPsPreset(self0, other0, self1, other1, self2, other2) end --特效容量 function SettingHelper.SetPsCapacityConfig(capNear, capMedium, capFar) SettingImpl_Current.ApplyPsCapacity(capNear, capMedium, capFar) end --同屏人数 function SettingHelper.SetVisualCullingCapacityConfig(cullingCount) SettingImpl_Current.ApplyVisualCullingCapacity(cullingCount) end --同屏显示距离 function SettingHelper.SetVisualCullingDistanceConfig(visibleDistanceNear, visibleDistanceFar, visibleDistanceMax) SettingImpl_Current.ApplyVisualCullingDistance(visibleDistanceNear, visibleDistanceFar, visibleDistanceMax) end return SettingHelper