Add button content setting and fix other issues with custom color settings
This commit is contained in:
@@ -634,6 +634,21 @@ public class BazookaManager : MonoBehaviour
|
||||
return JArray.Parse(saveFile["settings"]["colors"]["text"].ToString());
|
||||
}
|
||||
|
||||
public void SetColorSettingButtonContent(JArray value)
|
||||
{
|
||||
if (saveFile["settings"] == null) saveFile["settings"] = new JObject();
|
||||
if (saveFile["settings"]["colors"] == null) saveFile["settings"]["colors"] = new JObject();
|
||||
saveFile["settings"]["colors"]["buttonColor"] = value;
|
||||
}
|
||||
|
||||
public JArray GetColorSettingButtonContent()
|
||||
{
|
||||
if (saveFile["settings"] == null) return new JArray(0, 0, 0);
|
||||
if (saveFile["settings"]["colors"] == null) return new JArray(0, 0, 0);
|
||||
if (saveFile["settings"]["colors"]["buttonColor"] == null) return new JArray(0, 0, 0);
|
||||
return JArray.Parse(saveFile["settings"]["colors"]["buttonColor"].ToString());
|
||||
}
|
||||
|
||||
public void SetColorSettingIcon(JArray value)
|
||||
{
|
||||
if (saveFile["settings"] == null) saveFile["settings"] = new JObject();
|
||||
|
||||
@@ -126,6 +126,28 @@ public class CustomColorObject : MonoBehaviour
|
||||
currentColor.b = colorType.b;
|
||||
obj2.color = currentColor;
|
||||
break;
|
||||
case ColorObjectType.ButtonContentColorImage:
|
||||
color = BazookaManager.Instance.GetColorSettingButtonContent();
|
||||
colorType = new((int)color[0] / 255f, (int)color[1] / 255f, (int)color[2] / 255f);
|
||||
colorType = ApplyModifiers(colorType);
|
||||
obj2 = gameObject.GetComponent<Image>();
|
||||
currentColor = obj2.color;
|
||||
currentColor.r = colorType.r;
|
||||
currentColor.g = colorType.g;
|
||||
currentColor.b = colorType.b;
|
||||
obj2.color = currentColor;
|
||||
break;
|
||||
case ColorObjectType.ButtonContentColorText:
|
||||
color = BazookaManager.Instance.GetColorSettingButtonContent();
|
||||
colorType = new((int)color[0] / 255f, (int)color[1] / 255f, (int)color[2] / 255f);
|
||||
colorType = ApplyModifiers(colorType);
|
||||
obj3 = gameObject.GetComponent<TMP_Text>();
|
||||
currentColor = obj3.color;
|
||||
currentColor.r = colorType.r;
|
||||
currentColor.g = colorType.g;
|
||||
currentColor.b = colorType.b;
|
||||
obj3.color = currentColor;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,8 @@ public class SettingsMenu : MonoBehaviour
|
||||
if (colorType == 0) BazookaManager.Instance.SetColorSettingBackground(color);
|
||||
else if (colorType == 1) BazookaManager.Instance.SetColorSettingMenuBackground(color);
|
||||
else if (colorType == 2) BazookaManager.Instance.SetColorSettingButton(color);
|
||||
else if (colorType == 3) BazookaManager.Instance.SetColorSettingText(color);
|
||||
else if (colorType == 3) BazookaManager.Instance.SetColorSettingButtonContent(color);
|
||||
else if (colorType == 4) BazookaManager.Instance.SetColorSettingText(color);
|
||||
|
||||
foreach (CustomColorObject customColorObject in FindObjectsByType<CustomColorObject>(FindObjectsSortMode.None)) customColorObject.SetColor();
|
||||
};
|
||||
@@ -110,13 +111,19 @@ public class SettingsMenu : MonoBehaviour
|
||||
colorToSet = BazookaManager.Instance.GetColorSettingButton();
|
||||
colorMenu.defaultColor = new(1f, 1f, 1f);
|
||||
break;
|
||||
case 2: //BColor
|
||||
text.text = "Text color";
|
||||
case 2: //BCColor
|
||||
text.text = "Button content color";
|
||||
colorType = 3;
|
||||
colorToSet = BazookaManager.Instance.GetColorSettingButtonContent();
|
||||
colorMenu.defaultColor = new(0f, 0f, 0f);
|
||||
break;
|
||||
case 3: //TColor
|
||||
text.text = "Text color";
|
||||
colorType = 4;
|
||||
colorToSet = BazookaManager.Instance.GetColorSettingText();
|
||||
colorMenu.defaultColor = new(1f, 1f, 1f);
|
||||
break;
|
||||
case 3: //TColor
|
||||
case 4: //IGColor
|
||||
text.text = "In game background color";
|
||||
colorType = 0;
|
||||
colorToSet = BazookaManager.Instance.GetColorSettingBackground();
|
||||
|
||||
@@ -7,5 +7,7 @@ public enum ColorObjectType
|
||||
TextColor,
|
||||
TextColorImage,
|
||||
MenuBackgroundColorImage,
|
||||
MenuBackgroundColorText
|
||||
MenuBackgroundColorText,
|
||||
ButtonContentColorImage,
|
||||
ButtonContentColorText
|
||||
}
|
||||
Reference in New Issue
Block a user