MultipleMaids.Config.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. using System;
  2. using ExIni;
  3. using UnityEngine;
  4. namespace CM3D2.MultipleMaids.Plugin
  5. {
  6. public partial class MultipleMaids
  7. {
  8. public void Preference()
  9. {
  10. if (isPref)
  11. {
  12. return;
  13. }
  14. isPref = true;
  15. if (Preferences["config"]["hair_setting"].Value == "true")
  16. {
  17. isKamiyure = true;
  18. IniKey iniKey1 = Preferences["config"]["hair_radius"];
  19. IniKey iniKey2 = Preferences["config"]["hair_elasticity"];
  20. kamiyure2 = float.Parse(Preferences["config"]["hair_damping"].Value);
  21. kamiyure3 = float.Parse(iniKey2.Value);
  22. kamiyure4 = float.Parse(iniKey1.Value);
  23. }
  24. else
  25. {
  26. isKamiyure = false;
  27. kamiyure2 = 0.6f;
  28. kamiyure3 = 1f;
  29. kamiyure4 = 0.02f;
  30. }
  31. if (Preferences["config"]["skirt_setting"].Value == "true")
  32. {
  33. isSkirtyure = true;
  34. IniKey iniKey1 = Preferences["config"]["skirt_radius"];
  35. IniKey iniKey2 = Preferences["config"]["skirt_elasticity"];
  36. skirtyure2 = float.Parse(Preferences["config"]["skirt_damping"].Value);
  37. skirtyure3 = float.Parse(iniKey2.Value);
  38. skirtyure4 = float.Parse(iniKey1.Value);
  39. }
  40. else
  41. {
  42. isSkirtyure = false;
  43. skirtyure2 = 0.1f;
  44. skirtyure3 = 0.05f;
  45. skirtyure4 = 0.1f;
  46. }
  47. IniKey iniKey3 = Preferences["config"]["vr_scroll"];
  48. if (iniKey3.Value == "false")
  49. {
  50. isVRScroll = false;
  51. }
  52. else if (iniKey3.Value != "true")
  53. {
  54. Preferences["config"]["vr_scroll"].Value = "true";
  55. SaveConfig();
  56. }
  57. if (Preferences["config"]["shift_f7"].Value == "true")
  58. {
  59. isF7S = true;
  60. }
  61. if (Preferences["config"]["shift_f8"].Value == "false")
  62. {
  63. isVR2 = false;
  64. }
  65. IniKey iniKey4 = Preferences["config"]["ik_all"];
  66. if (iniKey4.Value == "true")
  67. {
  68. isIKAll = true;
  69. for (int index = 0; index < maxMaidCnt; ++index)
  70. {
  71. isIK[index] = true;
  72. }
  73. }
  74. else if (iniKey4.Value != "false")
  75. {
  76. Preferences["config"]["ik_all"].Value = "true";
  77. SaveConfig();
  78. isIKAll = true;
  79. for (int index = 0; index < maxMaidCnt; ++index)
  80. {
  81. isIK[index] = true;
  82. }
  83. }
  84. IniKey modsOnlyKey = Preferences["config"]["mods_only"];
  85. if (modsOnlyKey.Value == "true")
  86. {
  87. modItemsOnly = true;
  88. modItemsToggle = true;
  89. }
  90. else if (modsOnlyKey.Value != "false")
  91. {
  92. Preferences["config"]["mods_only"].Value = "false";
  93. SaveConfig();
  94. modItemsOnly = false;
  95. }
  96. if (!int.TryParse(Preferences["config"]["scene_max"].Value, out maxPage))
  97. {
  98. maxPage = 100;
  99. Preferences["config"]["scene_max"].Value = "100";
  100. SaveConfig();
  101. }
  102. if (!int.TryParse(Preferences["config"]["kankyo_max"].Value, out kankyoMax))
  103. {
  104. kankyoMax = 20;
  105. Preferences["config"]["kankyo_max"].Value = "20";
  106. SaveConfig();
  107. }
  108. for (int index = 0; index < kankyoMax; ++index)
  109. {
  110. IniKey iniKey1 = Preferences["kankyo"]["kankyo" + (index + 1)];
  111. if (iniKey1.Value == null || iniKey1.Value == "")
  112. {
  113. Preferences["kankyo"]["kankyo" + (index + 1)].Value = "環境" + (index + 1);
  114. SaveConfig();
  115. }
  116. }
  117. maxPage /= 10;
  118. string configSortMode = Preferences["scenemanager"]["scene_sort_mode"].Value?.ToLowerInvariant();
  119. int sortIndex = Array.FindIndex(ConfigSortMode, sort => sort == configSortMode);
  120. if (sortIndex > -1)
  121. {
  122. selectedSceneSortMode = sceneSortModeOld = sortIndex;
  123. }
  124. else
  125. {
  126. Preferences["scenemanager"]["scene_sort_mode"].Value = ConfigSortMode[0];
  127. SaveConfig();
  128. }
  129. if (Preferences["scenemanager"]["scene_sort_ascending"].Value == "false")
  130. {
  131. sceneSortAscending = sceneSortAscendingOld = false;
  132. }
  133. else if (Preferences["scenemanager"]["scene_sort_ascending"].Value != "true")
  134. {
  135. Preferences["scenemanager"]["scene_sort_ascending"].Value = "true";
  136. SaveConfig();
  137. }
  138. }
  139. }
  140. }