using UnityEngine; namespace TKS { /// /// 그래픽 품질 높음 / 낮음(PD 2026-11-26 「설정 메뉴에서 고사양 · 저사양 단말에 맞게 조절」 → ① 「768 + 높음/낮음」) — 유닛 그림(Resources/Units · /// 밉맵 한도 그룹 )만 실행 중에 해상도를 바꾼다(다른 그림 · UI 는 그대로). /// 높음 = 임포트 그대로(Android 긴 변 768 · UnitArtImporter) · 낮음 = 밉맵 한 단계 아래(긴 변 384 · 그 그림의 GPU 메모리 약 1/4). /// 저장 = PlayerPrefs(기기마다 · 세이브와 무관) · 고르지 않았으면 기기 메모리로 정함(표 settings_screen gfx_auto MB 이상 = 높음). /// public static class GraphicsQuality { /// 유닛 그림 밉맵 한도 그룹 이름(UnitArtImporter 가 유닛 프레임에 붙임 · QualitySettings 그룹). public const string UnitGroup = "Units"; public const string Key = "tks_set_gfx"; public const int Auto = -1; public const int Low = 0; public const int High = 1; /// 저장된 고름(-1 = 아직 안 고름 = 기기 메모리로). public static int Saved { get { return PlayerPrefs.GetInt(Key, Auto); } } /// 지금 높음인가(고른 값 · 안 골랐으면 기기 메모리). public static bool IsHigh { get { int v = Saved; if (v == High) return true; if (v == Low) return false; return SystemInfo.systemMemorySize >= AutoHighMb; } } /// 안 골랐을 때 높음이 되는 기기 메모리(MB · 표 settings_screen gfx_auto · 표가 없으면 3500 = 4 GB 기기가 보고하는 값 근처). public static float AutoHighMb { get { var t = OutGame.ScreenTable.Load(OutGame.SettingsPopup.TablePath); return t != null ? OutGame.ScreenTable.At(t.L("gfx_auto"), 0, 3500f) : 3500f; } } public static void Set(bool high) { PlayerPrefs.SetInt(Key, high ? High : Low); PlayerPrefs.Save(); Apply(); } /// 지금 값을 그룹에 건다(그룹이 프로젝트에 없으면 아무것도 안 함). public static void Apply() { if (!TextureMipmapLimitGroups.HasGroup(UnitGroup)) return; QualitySettings.SetTextureMipmapLimitSettings(UnitGroup, new TextureMipmapLimitSettings { limitBiasMode = TextureMipmapLimitBiasMode.OffsetGlobalLimit, limitBias = IsHigh ? 0 : 1 }); } [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] static void Boot() { Apply(); } } }