using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class RealTimeRewardChanger : MonoBehaviour { public GameObject Agent; public InputField nonRInputField; public InputField shootRInputField; public InputField shootWithoutReadyRInputField; public InputField hitRInputField; public InputField killRInputField; public InputField winRInputField; public InputField loseRInputField; public Text nonRPlaceholder; public Text shootRPlaceholder; public Text shootWithoutReadyRPlaceholder; public Text hitRPlaceholder; public Text killRPlaceholder; public Text winRPlaceholder; public Text loseRPlaceholder; private void Start() { } public void nonRBTPresses() { InGameMessages messenger = gameObject.GetComponent(); if (nonRInputField.GetComponent().text == "-") { // input chara not illegal nonRPlaceholder.color = Color.red; nonRPlaceholder.text = "Wrong Type!"; nonRInputField.GetComponent().text = ""; messenger.SendMessagetoBox("Wrong Reward Type!", Message.MessageType.error); }else if (nonRInputField.GetComponent().text == "") { // empty chara nonRPlaceholder.color = Color.gray; nonRPlaceholder.text = "nonR"; } else { // good to go~ nonRPlaceholder.color = Color.gray; nonRPlaceholder.text = "nonR"; string reward = nonRInputField.GetComponent().text; Agent.GetComponent().nonReward = float.Parse(reward); nonRInputField.GetComponent().text = ""; messenger.SendMessagetoBox("Reward nonR change Success",Message.MessageType.success); } } public void shootRBTPresses() { InGameMessages messenger = gameObject.GetComponent(); if (shootRInputField.GetComponent().text == "-") { // input chara not illegal shootRPlaceholder.color = Color.red; shootRPlaceholder.text = "Wrong Type!"; shootRInputField.GetComponent().text = ""; messenger.SendMessagetoBox("Wrong Reward Type!", Message.MessageType.error); } else if (shootRInputField.GetComponent().text == "") { // empty chara shootRPlaceholder.color = Color.gray; shootRPlaceholder.text = "shootR"; } else { // good to go~ shootRPlaceholder.color = Color.gray; shootRPlaceholder.text = "shootR"; string reward = shootRInputField.GetComponent().text; Agent.GetComponent().shootReward = float.Parse(reward); shootRInputField.GetComponent().text = ""; messenger.SendMessagetoBox("Reward shootR change Success",Message.MessageType.success); } } public void shootWithoutReadyRBTPresses() { InGameMessages messenger = gameObject.GetComponent(); if (shootWithoutReadyRInputField.GetComponent().text == "-") { // input chara not illegal shootWithoutReadyRPlaceholder.color = Color.red; shootWithoutReadyRPlaceholder.text = "Wrong Type!"; shootWithoutReadyRInputField.GetComponent().text = ""; messenger.SendMessagetoBox("Wrong Reward Type!", Message.MessageType.error); } else if (shootWithoutReadyRInputField.GetComponent().text == "") { // empty chara shootWithoutReadyRPlaceholder.color = Color.gray; shootWithoutReadyRPlaceholder.text = "SWORR"; } else { // good to go~ shootWithoutReadyRPlaceholder.color = Color.gray; shootWithoutReadyRPlaceholder.text = "SWORR"; string reward = shootWithoutReadyRInputField.GetComponent().text; Agent.GetComponent().shootWithoutReadyReward = float.Parse(reward); shootWithoutReadyRInputField.GetComponent().text = ""; messenger.SendMessagetoBox("Reward SWORR change Success",Message.MessageType.success); } } public void hitRBTPresses() { InGameMessages messenger = gameObject.GetComponent(); if (hitRInputField.GetComponent().text == "-") { // input chara not illegal hitRPlaceholder.color = Color.red; hitRPlaceholder.text = "Wrong Type!"; hitRInputField.GetComponent().text = ""; messenger.SendMessagetoBox("Wrong Reward Type!", Message.MessageType.error); } else if (hitRInputField.GetComponent().text == "") { // empty chara hitRPlaceholder.color = Color.gray; hitRPlaceholder.text = "hitR"; } else { // good to go~ hitRPlaceholder.color = Color.gray; hitRPlaceholder.text = "hitR"; string reward = hitRInputField.GetComponent().text; Agent.GetComponent().hitReward = float.Parse(reward); hitRInputField.GetComponent().text = ""; messenger.SendMessagetoBox("Reward hitR change Success",Message.MessageType.success); } } public void killRBTPresses() { InGameMessages messenger = gameObject.GetComponent(); if (killRInputField.GetComponent().text == "-") { // input chara not illegal killRPlaceholder.color = Color.red; killRPlaceholder.text = "Wrong Type!"; killRInputField.GetComponent().text = ""; messenger.SendMessagetoBox("Wrong Reward Type!", Message.MessageType.error); } else if (killRInputField.GetComponent().text == "") { // empty chara killRPlaceholder.color = Color.gray; killRPlaceholder.text = "killR"; } else { // good to go~ killRPlaceholder.color = Color.gray; killRPlaceholder.text = "killR"; string reward = killRInputField.GetComponent().text; Agent.GetComponent().killReward = float.Parse(reward); killRInputField.GetComponent().text = ""; messenger.SendMessagetoBox("Reward killR change Success",Message.MessageType.success); } } public void winRBTPresses() { InGameMessages messenger = gameObject.GetComponent(); if (winRInputField.GetComponent().text == "-") { // input chara not illegal winRPlaceholder.color = Color.red; winRPlaceholder.text = "Wrong Type!"; winRInputField.GetComponent().text = ""; messenger.SendMessagetoBox("Wrong Reward Type!", Message.MessageType.error); } else if (winRInputField.GetComponent().text == "") { // empty chara winRPlaceholder.color = Color.gray; winRPlaceholder.text = "winR"; } else { // good to go~ winRPlaceholder.color = Color.gray; winRPlaceholder.text = "winR"; string reward = winRInputField.GetComponent().text; Agent.GetComponent().winReward = float.Parse(reward); winRInputField.GetComponent().text = ""; messenger.SendMessagetoBox("Reward winR change Success", Message.MessageType.success); } } public void loseRBTPresses() { InGameMessages messenger = gameObject.GetComponent(); if (loseRInputField.GetComponent().text == "-") { // input chara not illegal loseRPlaceholder.color = Color.red; loseRPlaceholder.text = "Wrong Type!"; loseRInputField.GetComponent().text = ""; messenger.SendMessagetoBox("Wrong Reward Type!", Message.MessageType.error); } else if (loseRInputField.GetComponent().text == "") { // empty chara loseRPlaceholder.color = Color.gray; loseRPlaceholder.text = "loseR"; } else { // good to go~ loseRPlaceholder.color = Color.gray; loseRPlaceholder.text = "loseR"; string reward = loseRInputField.GetComponent().text; Agent.GetComponent().loseReward = float.Parse(reward); loseRInputField.GetComponent().text = ""; messenger.SendMessagetoBox("Reward loseR change Success",Message.MessageType.success); } } }