Firstborn/Assets/Scripts/StatChangeInt.cs
Schaken-Mods 761017edae stats fixed
Stats in Character menu are fixed and the female body is all good now.
2023-04-07 12:27:43 -05:00

86 lines
3.0 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class StatChangeInt : MonoBehaviour
{
[SerializeField] private TextMeshProUGUI RemainingPoints;
[SerializeField] private TextMeshProUGUI EditingBox;
[SerializeField] private bool Adding;
[SerializeField] private GameObject CantChangeBox;
[SerializeField] private GameObject ChangeBoxParent;
[SerializeField] private Button MyButton;
[SerializeField] private List<Button> RightButtons;
[SerializeField] private List<Button> LeftButtons;
[SerializeField] private Button ThisLeftButton;
[SerializeField] private bool AddingDisabled = false;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void ChangeValue() {
int i = int.Parse(EditingBox.text);
int j = int.Parse(RemainingPoints.text);
if (Adding) {
if (EditingBox.text == "0") {
ThisLeftButton.interactable = true;
}
i += 1;
j -= 1;
RemainingPoints.text = j.ToString();
EditingBox.text = i.ToString();
if (RemainingPoints.text == "0") {
for (int k = 0; k < RightButtons.Count; k++) {
Button TheButton = RightButtons[k].GetComponent<Button>();
TheButton.interactable = false;
StatChangeInt ST = RightButtons[k].GetComponent<StatChangeInt>();
ST.AddingDisabled = true;
}
for (int k = 0; k < LeftButtons.Count; k++) {
StatChangeInt ST = LeftButtons[k].GetComponent<StatChangeInt>();
ST.AddingDisabled = true;
}
}
} else {
if (EditingBox.text == "0") {
CantChangeBox.SetActive(true);
ChangeBoxParent.SetActive(true);
MyButton.interactable = false;
} else {
i -= 1;
j += 1;
RemainingPoints.text = j.ToString();
EditingBox.text = i.ToString();
if (EditingBox.text == "0") {
MyButton.interactable = false;
}
}
if (AddingDisabled == true) {
for (int k = 0; k < RightButtons.Count; k++) {
Button TheButton = RightButtons[k].GetComponent<Button>();
TheButton.interactable = true;
StatChangeInt ST = RightButtons[k].GetComponent<StatChangeInt>();
ST.AddingDisabled = false;
}
for (int k = 0; k < LeftButtons.Count; k++) {
StatChangeInt ST = LeftButtons[k].GetComponent<StatChangeInt>();
ST.AddingDisabled = false;
}
}
}
}
}