feat: move json file data to code

This commit is contained in:
2024-05-05 15:05:47 +08:00
parent f392463a84
commit a8e88983e2
6 changed files with 31 additions and 38 deletions

View File

@ -0,0 +1,561 @@
final advancedLocalizationJsonData = {
"class_keys": [
{
"id": "location_opt",
"class_name": "地点-其他",
"keys": [
"ATC_.*",
"Crus_HistMarker_.*",
"Enroll_.*",
"Hurston_JumpPoint_.*",
"Jurisdictions_Name_.*",
"LandingPad_.*",
"Lorville_.*",
"MiningClaim_.*",
"MiningClaims_Desc_.*",
"NavBeacon_.*",
"NavPoint_.*",
"Nav_.*",
"Navpoint_.*",
"Orison_Destination_.*",
"Starfarer_Wreckage_QT_.*",
"area_.*",
"cargodeck_.*",
"dockingport_.*",
"garage_.*",
"hangar_.*",
"landing_pad_.*",
"pyro_.*",
"room_.*",
"security_.*",
"select_.*",
"shop_name_.*",
"vehicle_room_.*",
"weapons_heal_.*",
"QT_.*",
"RR_.*",
"Shubin_.*",
"Solar_system_.*",
"Bacchus.*_Desc.*",
"Cano.*_Desc.*",
"Castra.*_Desc.*",
"Delamar.*_Desc.*",
"Ellis.*_Desc.*",
"Goss.*_Desc.*",
"Hadrian.*_Desc.*",
"Levski_Shop_Teach.*_Desc.*",
"Magnus.*_Desc.*",
"Nyx.*_Desc.*",
"Oso.*_Desc.*",
"Pyro.*_Desc.*",
"Stanton.*_Desc.*",
"Taranis.*_Desc.*",
"Tarpits.*_Desc.*",
"Tayac.*_Desc.*",
"Terra.*_Desc.*",
"Virgil.*_Desc.*"
]
},
{
"id": "location",
"class_name": "地点-常用",
"keys": [
"Bacchus(?!.*_Desc).*",
"Cano(?!.*_Desc).*",
"Castra(?!.*_Desc).*",
"Delamar(?!.*_Desc).*",
"Ellis(?!.*_Desc).*",
"Goss(?!.*_Desc).*",
"Hadrian(?!.*_Desc).*",
"Levski_Shop_Teach(?!.*_Desc).*",
"Magnus(?!.*_Desc).*",
"Nyx(?!.*_Desc).*",
"Oso(?!.*_Desc).*",
"Pyro(?!.*_Desc).*",
"Stanton(?!.*_Desc).*",
"Taranis(?!.*_Desc).*",
"Tarpits(?!.*_Desc).*",
"Tayac(?!.*_Desc).*",
"Terra(?!.*_Desc).*",
"Virgil(?!.*_Desc).*"
]
},
{
"class_name": "物品-其他",
"id": "thing_opt",
"keys": [
"BarMenu_.*",
"FLOOR_Flair_Items.*",
"FPS_AI_.*",
"ItemPort_.*",
"itemPort_.*",
"destoryitems_.*",
"destroyItems_.*",
"kopion_.*",
"item_desc.*"
]
},
{
"class_name": "物品-常用",
"id": "thing",
"keys": ["item_Name.*"]
},
{
"class_name": "载具-其他",
"id": "vehicle_name",
"keys": [
"vehicle_Desc.*",
"vehicl_Desc.*",
"vehicel_Desc.*",
"vehicles_.*"
]
},
{
"class_name": "载具-常用",
"id": "vehicle",
"keys": ["vehicle_Name.*"]
},
{
"id": "mission",
"class_name": "任务/日志",
"keys": [
"BasicSalvage_.*",
"BitZeros_.*",
"BHG_.*",
"BlacJac_.*",
"BountyHuntersGuild_.*",
"BrightSky_.*",
"CThing_.*",
"ChainedDeliveryModule_.*",
"Clovis_Safe_.*",
"CommArray_.*",
"Commissary_.*",
"Community_Service.*",
"CovalexIC_.*",
"Constantine_.*",
"Covalex_.*",
"Criminal_.*",
"CrusaderSecurity_.*",
"Crusader_ReputationJournal_.*",
"Crusader_from_.*",
"DC_room_.*",
"DataHeist_.*",
"Datapad_.*",
"Delivery_.*",
"Derelict_.*",
"DestroyDebris_.*",
"DestroyEvidence_.*",
"DestroyObj_Text_.*",
"DistributionCenter_.*",
"DynamicEvent_.*",
"Eckhart_.*",
"FPSPVEVS_.*",
"FTL_.*",
"FW22_NT_Journal_Title_.*",
"ForceDepletion_.*",
"GLoc_Bartender_Conv_.*",
"GMCapture_.*",
"GarethWIP_.*",
"Gathering_.*",
"Gen_NPC_Conv_.*",
"Greeter_.*",
"HeadHunters_.*",
"HexPenetrator_.*",
"Hurston_ReputationJournal_.*",
"Hurston_bounty_.*",
"Hurston_destroystash_.*",
"Hurston_eliminateall_.*",
"Hurston_eliminatespecifc_.*",
"Hurston_killcreatureslocation_.*",
"Hurston_searchbody_.*",
"IAE2951_.*",
"IAE2952_.*",
"IAE952_.*",
"Info_Kiosks_.*",
"Infractions_.*",
"Investigation_.*",
"Invictus2951_.*",
"Invictus_.*",
"JournalEntry_.*",
"JournalText.*",
"Journal_.*",
"Jumptown2_.*",
"JurisdictionJournals_.*",
"Kill_Civ_.*",
"LingFamily_.*",
"Ling_.*",
"LocalDelivery_.*",
"Local_Delivery_.*",
"MG_.*",
"MTPS_.*",
"MTProtectiveServices_.*",
"MilesEckhart_.*",
"Mission.*",
"Missions.*",
"Mtps_killallcreatures_.*",
"NB_.*",
"NPE_.*",
"NTLockdown_.*",
"Name_.*",
"NorthRock_.*",
"Orison_CRUShowroom_.*",
"Orison_DiscoverySpot_.*",
"OutlawSweep_.*",
"Outpost_.*",
"Pacheco_.*",
"PreventData_.*",
"ProtLife_.*",
"RAIN_.*",
"RacingRep_.*",
"Racing_Ship_DisplayName.*",
"RedWind_.*",
"RepScope_.*",
"RepStanding_.*",
"RepairOxygenKiosk_.*",
"Reststop_.*",
"RetakeLocation_.*",
"RetrieveConsignment_.*",
"RetrieveDatapad_.*",
"ReturnObjective_.*",
"ReturnToLocation_.*",
"Roughready_.*",
"Ruto_.*",
"SB_.*",
"SalvageContractor_.*",
"ScanVehicleLocationModule_.*",
"ScrambleRace_.*",
"ScreamingGalsons_.*",
"ServiceBeacon_.*",
"ShipName_.*",
"ShipStrip_.*",
"Special_Event_.*",
"Station_Illegal_.*",
"Staton4_NewBab_.*",
"StealEvidence_.*",
"TarPits_.*",
"Temp_.*",
"Terminal_.*",
"Text_.*",
"TimeSensative_.*",
"TimeSensitive_.*",
"TimeTrial_.*",
"TimedSalvage_.*",
"TransportGuild_.*",
"TravelObjective_.*",
"Tut.*",
"Tutorial.*",
"UDM_.*",
"Vaughn_.*",
"VendingMachien_.*",
"VendingMachin_.*",
"VendingMachine_.*",
"WSTR_.*",
"WantedLevel5_.*",
"XenoThreat_.*",
"acquirepart_.*",
"alt_criminal_collect_reclaimer_desc.*",
"aracersurvivesrace_.*",
"assassin_.*",
"assassination_.*",
"asteroidfield_.*",
"basesweep_.*",
"bitzeros_.*",
"blacJac_.*",
"blackbox_.*",
"blackboxillegal_.*",
"blackboxlegal_.*",
"boarders_.*",
"bounty_.*",
"bountymarker_.*",
"cave_.*",
"ccdemo19_.*",
"cdf_.*",
"cfp_.*",
"civilian_.*",
"claimsweep_.*",
"collect_reclaimer_.*",
"combatassist_.*",
"commarray_hack_.*",
"commarray_repair_.*",
"confirmkill_.*",
"constantine_.*",
"criminal_.*",
"crus_.*",
"crusader_.*",
"delivery_.*",
"deliverydecoy_.*",
"deploypiggyback_.*",
"deployprobe_.*",
"destroyblade_.*",
"destroyitem_.*",
"destroyitems_.*",
"destroyitemsspace_.*",
"destroyprobe_.*",
"destroyprobeillegal_.*",
"destroyprobelegal_.*",
"destroyprove_illegal_.*",
"destroystash_.*",
"dfmcrusader_.*",
"distraction_.*",
"distractionkill_.*",
"dusters_.*",
"ecn_.*",
"eliminatespecificracer_.*",
"escort_.*",
"escortscan_.*",
"fleetweek2950_.*",
"fps_.*",
"goupbounty_.*",
"groupbounty_.*",
"hack_prevent_.*",
"hdactivist_.*",
"headhunters_.*",
"hurston_.*",
"iae2953_.*",
"kareah_.*",
"kareahsweep_.*",
"killallanimal_.*",
"killallanimals_.*",
"killallkopion_.*",
"killallmarok_.*",
"killanimalslocation_.*",
"killatlocation_.*",
"killcollect_.*",
"killcollectanimal_.*",
"killcollectkopion_.*",
"killcollectmarok_.*",
"loc_.*",
"manufacturer_.*",
"meet_miles_.*",
"mgClovus_.*",
"mg_*",
"missionManager_.*",
"mission_.*",
"mtps_.*",
"murderspree_.*",
"mustcomesecond_.*",
"ninetails_.*",
"northrock_.*",
"notification_.*",
"openbounty_.*",
"outlawsweep_.*",
"outpost_.*",
"p_protectandresupply_.*",
"p_showdown_.*",
"pickanddestroy_.*",
"planetcollect_.*",
"prisonerbreak_.*",
"prisonermanifest_.*",
"protlife_.*",
"racelastforxcheckpoints_.*",
"recoverspace_.*",
"recoverstash_.*",
"recoverstolen_.*",
"recovery_.*",
"redwind_.*",
"roughready_.*",
"sandbox_.*",
"seachbody_.*",
"searchbody_.*",
"searchcrew_.*",
"sectorsweep_.*",
"shubin_.*",
"shuttle_.*",
"spacecargo_.*",
"spacecollect_.*",
"spacesteal_.*",
"stanton.*",
"stealfromship_.*",
"stealitem_.*",
"takecheckpointsxandy_.*",
"ugf_.*",
"vaughn_.*",
"winwithoutkillingracer_.*",
"xdamagetoracersinorder_.*",
"xenothreat_.*"
]
},
{
"id": "subtitle",
"class_name": "字幕",
"keys": [
"DXSH_",
"Dlg_SC_.*",
"FW22_NT_Datapad_.*",
"FleetWeek2950_.*",
"GenResponse_.*",
"GenericLanding_.*",
"IT_Shared_.*",
"Imperilled_.*",
"MKTG_CUSTOMS1_CV_Access_.*",
"PH_PU_.*",
"PU_.*",
"Pacheco_.*",
"SC_ac_.*",
"SC_lz_.*",
"SM_SIMANN1_.*",
"contract_.*",
"covalex_.*",
"covalexrand_.*",
"covalexspec_.*"
]
},
{
"id": "ui",
"class_name": "UI/HUD/菜单",
"keys": [
".*_RepUI_.*",
"CharacterCustomizer_.*",
".*_OEM_UI_.*",
"DownloadConnectivity_.*",
"DownloadError_.*",
"DownloadStalled_.*",
"DownloadState_.*",
"Download_BrowseForFolder",
"Exit_Screen_.*",
"FW2022_DatapadScreen_.*",
"FW2022_IFFIscreen_.*",
"FW2022_TransferScreen_.*",
"FW22_NT_Journal_Body_.*",
".*_DisplayName_.*",
"FreightElevator_.*",
"Frontend_.*",
"Fines_.*",
"FireMode_.*",
"GraceWarnings_.*",
"HUD_.*",
"Heads_Male_.*",
"Hints_.*",
"Human_Crew_.*",
"Human_First_Names_.*",
"Human_Nicknames_.*",
"Human_Security_Titles_.*",
"Human_Surnames_.*",
"HurDynDrugUGF_.*",
"HurDynMining_.*",
"HurstonSecurity_.*",
"Inner_.*",
"Kareah_.*",
"KeypadButton_.*",
"KeypadDisplay_.*",
"Map_Header_.*",
"Maps_.*",
"Marker_.*",
"Markers_.*",
"MurderSpree.*",
"NPC_Interact_Generic_.*",
"Out_of_Quantum_fuel.*",
"Oxygen_Screen_.*",
"PAUSE_OPTIONS_.*",
"PBay_.*",
"PIT_.*",
"PrisonKeypadPass_.*",
"Prison_.*",
"Prisoner.*",
"RN_.*",
"ShipSelector_.*",
"SkyLine_.*",
"Takedown.*",
"UEERanks_.*",
"UGF_.*",
"UI_.*",
"UnitedWorkersOfHurston_.*",
"Usable_CommTower_.*",
"Usable_Terminal_.*",
"Vehicle_Container_.*",
"actor_.*",
"ad_.*",
"airlock_.*",
"annun_.*",
"cargoTransfer_HUD_.*",
"cargo_.*",
"cc_.*",
"chat_.*",
"citizencon16_.*",
"cockpit_screen_.*",
"comm_.*",
"comms_.*",
"concate_.*",
"constellation_rear_tube.*",
"crate_panel_.*",
"defend_UGF_.*",
"dfm_.*",
"diff_notification_ui_.*",
"docking_.*",
"ea_popup_.*",
"ea_ui_.*",
"elevator_.*",
"engineering_.*",
"entrance_.*",
"fine_terminal_.*",
"flightHUD_.*",
"frontend_.*",
"generic_.*",
"global_terminal_.*",
"group_.*",
"hack_program_.*",
"hud_.*",
"infopanel_.*",
"innerthought_.*",
"input_.*",
"install_.*",
"interaction_.*",
"interiormap_.*",
"invictus_.*",
"journal_.*",
"kiosk_.*",
"law_.*",
"lens_.*",
"loadout_.*",
"mG_.*",
"masterMode_.*",
"me_.*",
"med_.*",
"medbed_.*",
"mfd_.*",
"mm_LobbyStatus_.*",
"mobiGlas_.*",
"mobiglas_.*",
"navitem_.*",
"net_dialog_.*",
"operatorMode_.*",
"panel_.*",
"pause_.*",
"pit_.*",
"port_Name.*",
"quantum_hud_.*",
"rc_ScanInfo_.*",
"refinery_ui_.*",
"refueling_HUD_.*",
"refueling_ui_.*",
"respawn_hud_.*",
"salvage_.*",
"scan_data_.*",
"scrambleracesubmissions_.*",
"shop_ui_.*",
"sm_ui_.*",
"spaceship_.*",
"starmap_.*",
"stomp_warning_.*",
"swapWheel_.*",
"system_.*",
"target_hud_.*",
"terminal_.*",
"text_.*",
"transit_.*",
"tutorial_.*",
"ui_.*",
"unittest_.*",
"usable_.*",
"vehicle_Type.*",
"vehicle_class_.*",
"vehicle_deck_.*",
"vehicle_focus_.*",
"vehicle_gunnery_hud_.*",
"vehicle_interactor_.*",
"weapon_stats.*",
"warning_.*"
]
}
]
};

View File

@ -1,9 +1,7 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:starcitizen_doctor/common/utils/log.dart';
@ -13,6 +11,7 @@ import 'package:starcitizen_doctor/data/sc_localization_data.dart';
import 'package:starcitizen_doctor/provider/unp4kc.dart';
import '../home_ui_model.dart';
import 'advanced_localization_ui.json.dart';
import 'localization_ui_model.dart';
part 'advanced_localization_ui_model.g.dart';
@ -151,8 +150,7 @@ class AdvancedLocalizationUIModel extends _$AdvancedLocalizationUIModel {
}
Future<AppAdvancedLocalizationData> _readClassJson() async {
final s = await rootBundle.loadString("assets/advanced_localization.json");
return AppAdvancedLocalizationData.fromJson(json.decode(s));
return AppAdvancedLocalizationData.fromJson(advancedLocalizationJsonData);
}
Future<(String, String)> _readIni(LocalizationUIState localizationUIState,

View File

@ -7,7 +7,7 @@ part of 'advanced_localization_ui_model.dart';
// **************************************************************************
String _$advancedLocalizationUIModelHash() =>
r'55c9d02d4c78112b2772f789c2758c3ea88808cb';
r'2db0a21dd98f5fb002469fcefe1bc1c0d514e135';
/// See also [AdvancedLocalizationUIModel].
@ProviderFor(AdvancedLocalizationUIModel)

View File

@ -0,0 +1,322 @@
final performanceUIConfJsonData = [
{
"key": "r_ssdo",
"name": "屏幕光线后处理",
"info": "调整光线后处理等级",
"type": "int",
"max": 2,
"min": 0,
"value": 1,
"group": "图形(修改后建议清理着色器)"
},
{
"key": "r_AntialiasingMode",
"name": "抗锯齿",
"info": "0 关闭1 SMAA2 时间过滤+SMAA3 时间滤波和投影矩阵抖动的 SMAA",
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": "图形(修改后建议清理着色器)"
},
{
"key": "sys_spec_gameeffects",
"name": "特效等级",
"info": "游戏特效等级",
"type": "int",
"max": 4,
"min": 1,
"value": 2,
"group": "图形(修改后建议清理着色器)"
},
{
"key": "sys_spec_texture",
"name": "纹理等级",
"info": "模型纹理细节",
"type": "int",
"max": 3,
"min": 1,
"value": 2,
"group": "图形(修改后建议清理着色器)"
},
{
"key": "sys_spec_volumetriceffects",
"name": "体积效果",
"info": "体积云、体积光照等",
"type": "int",
"max": 4,
"min": 1,
"value": 2,
"group": "图形(修改后建议清理着色器)"
},
{
"key": "sys_spec_water",
"name": "水体效果",
"info": "各种水的等级",
"type": "int",
"max": 4,
"min": 1,
"value": 2,
"group": "图形(修改后建议清理着色器)"
},
{
"key": "sys_spec_objectdetail",
"name": "对象细节",
"info": "模型对象细节影响LOD等..",
"type": "int",
"max": 4,
"min": 1,
"value": 2,
"group": "图形(修改后建议清理着色器)"
},
{
"key": "sys_spec_particles",
"name": "粒子细节",
"info": "",
"type": "int",
"max": 4,
"min": 1,
"value": 2,
"group": "图形(修改后建议清理着色器)"
},
{
"key": "sys_spec_physics",
"name": "物理细节",
"info": "物理效果范围",
"type": "int",
"max": 4,
"min": 1,
"value": 2,
"group": "图形(修改后建议清理着色器)"
},
{
"key": "sys_spec_shading",
"name": "着色器细节",
"info": "着色器相关",
"type": "int",
"max": 4,
"min": 1,
"value": 2,
"group": "图形(修改后建议清理着色器)"
},
{
"key": "sys_spec_shadows",
"name": "阴影细节",
"info": "阴影效果",
"type": "int",
"max": 4,
"min": 1,
"value": 2,
"group": "图形(修改后建议清理着色器)"
},
{
"key": "sys_spec_postprocessing",
"name": "后处理细节",
"info": "后处理着色器,动态模糊效果 等",
"type": "int",
"max": 4,
"min": 1,
"value": 2,
"group": "图形(修改后建议清理着色器)"
},
{
"key": "q_Renderer",
"name": "渲染器质量",
"info": "cryengine 渲染器质量",
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": "图形(修改后建议清理着色器)"
},
{
"key": "q_ShaderDecal",
"name": "贴花质量",
"info": "LOGO、标志等",
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": "图形(修改后建议清理着色器)"
},
{
"key": "q_ShaderPostProcess",
"name": "着色器质量",
"info": "",
"type": "int",
"max": 3,
"min": 0,
"value": 3,
"group": "图形(修改后建议清理着色器)"
},
{
"key": "q_ShaderFX",
"name": "FX 质量",
"info": "",
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": "图形(修改后建议清理着色器)"
},
{
"key": "q_ShaderGeneral",
"name": "常规质量",
"info": "整体模型质量",
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": "图形(修改后建议清理着色器)"
},
{
"key": "q_ShaderGlass",
"name": "玻璃质量",
"info": "窗、镜子等",
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": "图形(修改后建议清理着色器)"
},
{
"key": "q_ShaderHDR",
"name": "HDR质量",
"info": "HDR色差亮度层级 处理 等",
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": "图形(修改后建议清理着色器)"
},
{
"key": "q_ShaderParticle",
"name": "粒子质量",
"info": "粒子效果质量",
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": "图形(修改后建议清理着色器)"
},
{
"key": "q_ShaderTerrain",
"name": "地面质量",
"info": "",
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": "图形(修改后建议清理着色器)"
},
{
"key": "q_ShaderShadow",
"name": "阴影质量",
"info": "",
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": "图形(修改后建议清理着色器)"
},
{
"key": "q_ShaderSky",
"name": "天空质量",
"info": "",
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": "图形(修改后建议清理着色器)"
},
{
"key": "e_ParticlesObjectCollisions",
"name": "粒子碰撞",
"info": "1 仅静态粒子 2 包括动态粒子",
"type": "int",
"max": 2,
"min": 1,
"value": 1,
"group": "图形(修改后建议清理着色器)"
},
{
"key": "r_displayinfo",
"name": "屏幕信息(展示帧率)",
"info": "在屏幕右上角展示帧率,服务器信息等",
"type": "int",
"max": 4,
"min": 0,
"value": 1,
"group": "设置"
},
{
"key": "sys_maxFps",
"name": "最大帧率",
"info": "调整游戏最高帧率0为不限制",
"type": "int",
"max": 300,
"min": 0,
"value": 0,
"group": "设置"
},
{
"key": "r_DisplaySessionInfo",
"name": "显示会话信息",
"info": "开启后在屏幕上显示一个二维码,用于反馈时让 CIG 快速定位相关信息",
"type": "bool",
"max": 1,
"min": 0,
"value": 0,
"group": "设置"
},
{
"key": "r_VSync",
"name": "垂直同步",
"info": "开启以防止撕裂,关闭以提高帧率",
"type": "bool",
"max": 1,
"min": 0,
"value": 0,
"group": "设置"
},
{
"key": "r_MotionBlur",
"name": "动态模糊",
"info": "开启以提高运动感,关闭提升观感",
"type": "bool",
"max": 1,
"min": 0,
"value": 0,
"group": "设置"
},
{
"key": "cl_fov",
"name": "FOV",
"info": "设置视角FOV",
"type": "int",
"max": 160,
"min": 25,
"value": 90,
"group": "设置"
},
{
"key": "ui_disableScreenFade",
"name": "UI 淡入淡出动画",
"info": "",
"type": "bool",
"max": 1,
"min": 0,
"value": 1,
"group": "设置"
},
{
"key": "customize",
"name": "自定义参数",
"info": "",
"type": "customize",
"max": 1,
"min": 0,
"value": 1,
"group": "自定义"
}
];

View File

@ -1,9 +1,7 @@
// ignore_for_file: avoid_build_context_in_providers, avoid_public_notifier_properties
import 'dart:convert';
import 'dart:io';
import 'package:fluent_ui/fluent_ui.dart';
import 'package:flutter/services.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:hive/hive.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
@ -14,6 +12,8 @@ import 'package:starcitizen_doctor/data/game_performance_data.dart';
import 'package:starcitizen_doctor/generated/l10n.dart';
import 'package:starcitizen_doctor/ui/home/home_ui_model.dart';
import 'performance_ui.json.dart';
part 'performance_ui_model.freezed.dart';
part 'performance_ui_model.g.dart';
@ -50,22 +50,16 @@ class HomePerformanceUIModel extends _$HomePerformanceUIModel {
Future<void> _init() async {
customizeCtrl.clear();
_inAppKeys.clear();
final String jsonString =
await rootBundle.loadString('assets/performance.json');
final list = json.decode(jsonString);
if (list is List) {
final performanceMap = <String, List<GamePerformanceData>>{};
for (var element in list) {
final item = GamePerformanceData.fromJson(element);
if (item.key != "customize") {
_inAppKeys.add(item.key ?? "");
}
performanceMap[item.group!] ??= [];
performanceMap[item.group]?.add(item);
final performanceMap = <String, List<GamePerformanceData>>{};
for (var element in performanceUIConfJsonData) {
final item = GamePerformanceData.fromJson(element);
if (item.key != "customize") {
_inAppKeys.add(item.key ?? "");
}
state = state.copyWith(performanceMap: performanceMap);
performanceMap[item.group!] ??= [];
performanceMap[item.group]?.add(item);
}
state = state.copyWith(performanceMap: performanceMap);
if (await confFile.exists()) {
await _readConf();
@ -155,11 +149,13 @@ class HomePerformanceUIModel extends _$HomePerformanceUIModel {
}
clean(BuildContext context) async {
state = state.copyWith(workingString: S.current.performance_info_delete_config_file);
state = state.copyWith(
workingString: S.current.performance_info_delete_config_file);
if (await confFile.exists()) {
await confFile.delete(recursive: true);
}
state = state.copyWith(workingString: S.current.performance_action_clear_shaders);
state = state.copyWith(
workingString: S.current.performance_action_clear_shaders);
if (!context.mounted) return;
await cleanShaderCache(context);
state = state.copyWith(workingString: S.current.performance_info_done);
@ -188,7 +184,8 @@ class HomePerformanceUIModel extends _$HomePerformanceUIModel {
applyProfile(bool cleanShader) async {
if (state.performanceMap == null) return;
AnalyticsApi.touch("performance_apply");
state = state.copyWith(workingString: S.current.performance_info_generate_config_file);
state = state.copyWith(
workingString: S.current.performance_info_generate_config_file);
String conf = "";
for (var v in state.performanceMap!.entries) {
for (var c in v.value) {
@ -207,14 +204,16 @@ class HomePerformanceUIModel extends _$HomePerformanceUIModel {
}
}
}
state = state.copyWith(workingString: S.current.performance_info_write_out_config_file);
state = state.copyWith(
workingString: S.current.performance_info_write_out_config_file);
if (await confFile.exists()) {
await confFile.delete();
}
await confFile.create();
await confFile.writeAsString(conf);
if (cleanShader) {
state = state.copyWith(workingString: S.current.performance_action_clear_shaders);
state = state.copyWith(
workingString: S.current.performance_action_clear_shaders);
await cleanShaderCache(null);
}
state = state.copyWith(workingString: S.current.performance_info_done);
@ -226,4 +225,4 @@ class HomePerformanceUIModel extends _$HomePerformanceUIModel {
updateState() {
state = state.copyWith();
}
}
}

View File

@ -7,7 +7,7 @@ part of 'performance_ui_model.dart';
// **************************************************************************
String _$homePerformanceUIModelHash() =>
r'6ac9c9adc428120cb5ce71949221064c9e5d9385';
r'83fbdbbae287892dd0c67f5fd86d42a73d0ab91f';
/// See also [HomePerformanceUIModel].
@ProviderFor(HomePerformanceUIModel)