using System.Collections;
using System.Collections.Generic;
using System;
using UnityEngine;
using UnityEngine.UI;

public class RewardsChange : MonoBehaviour
{
    public GameObject DataTransfer;

    public GameObject nonRInputOBJ;
    public GameObject shootRInputOBJ;
    public GameObject shootWithoutReadyRInputOBJ;
    public GameObject hitRInputOBJ;
    public GameObject killRInputOBJ;
    public GameObject winRInputOBJ;
    public GameObject loseRInputOBJ;


    public Text nonRInputText;
    public Text shootRInputText;
    public Text shootWithoutReadyRInputText;
    public Text hitRInputText;
    public Text killRInputText;
    public Text winRInputText;
    public Text loseRInputText;

   

    private void Start()
    {
    }
    // Update is called once per frame

    public void nonRValueChanged()
    {
        if (nonRInputOBJ.GetComponent<InputField>().text == "" || nonRInputOBJ.GetComponent<InputField>().text == "-")
        {
            nonRInputText.color = Color.gray;
            DataTransfer.GetComponent<StartSeneData>().nonReward = DataTransfer.GetComponent<StartSeneData>().nonRewardDefault;
        }
        else
        {
            nonRInputText.color = Color.yellow;
            DataTransfer.GetComponent<StartSeneData>().nonReward = float.Parse(nonRInputOBJ.GetComponent<InputField>().text);
        }
    }
    public void shootRValueChanged()
    {
        if (shootRInputOBJ.GetComponent<InputField>().text == "" || shootRInputOBJ.GetComponent<InputField>().text == "-")
        {
            shootRInputText.color = Color.gray;
            DataTransfer.GetComponent<StartSeneData>().shootReward = DataTransfer.GetComponent<StartSeneData>().shootRewardDefault;
        }
        else {
            shootRInputText.color = Color.yellow;
            DataTransfer.GetComponent<StartSeneData>().shootReward = float.Parse(shootRInputOBJ.GetComponent<InputField>().text);
        }
    }
    public void shootWOReadyRValueChanged()
    {
        if(shootWithoutReadyRInputOBJ.GetComponent<InputField>().text == "" || shootWithoutReadyRInputOBJ.GetComponent<InputField>().text == "-")
        {
            shootWithoutReadyRInputText.color = Color.gray;
            DataTransfer.GetComponent<StartSeneData>().shootWithoutReadyReward = DataTransfer.GetComponent<StartSeneData>().shootWithoutReadyRewardDefault;
        }
        else{
            shootWithoutReadyRInputText.color = Color.yellow;
            DataTransfer.GetComponent<StartSeneData>().shootWithoutReadyReward = float.Parse(shootWithoutReadyRInputOBJ.GetComponent<InputField>().text);
        }
    }
    public void hitRValueChanged()
    {
        if(hitRInputOBJ.GetComponent<InputField>().text == "" || hitRInputOBJ.GetComponent<InputField>().text == "-")
        {
            hitRInputText.color = Color.gray;
            DataTransfer.GetComponent<StartSeneData>().hitReward = DataTransfer.GetComponent<StartSeneData>().hitRewardDefault;
        }
        else{
            hitRInputText.color = Color.yellow;
            DataTransfer.GetComponent<StartSeneData>().hitReward = float.Parse(hitRInputOBJ.GetComponent<InputField>().text);
        }
    }
    public void winRValueChanged()
    {
        if(winRInputOBJ.GetComponent<InputField>().text == "" || winRInputOBJ.GetComponent<InputField>().text == "-")
        {
            winRInputText.color = Color.gray;
            DataTransfer.GetComponent<StartSeneData>().winReward = DataTransfer.GetComponent<StartSeneData>().winRewardDefault;
        }
        else{
            winRInputText.color = Color.yellow;
            DataTransfer.GetComponent<StartSeneData>().winReward = float.Parse(winRInputOBJ.GetComponent<InputField>().text);
        }
    }
    public void loseRValueChanged()
    {
        if(loseRInputOBJ.GetComponent<InputField>().text == "" || loseRInputOBJ.GetComponent<InputField>().text == "-")
        {
            loseRInputText.color = Color.gray;
            DataTransfer.GetComponent<StartSeneData>().loseReward = DataTransfer.GetComponent<StartSeneData>().loseRewardDefault;
        }
        else{
            loseRInputText.color = Color.yellow;
            DataTransfer.GetComponent<StartSeneData>().loseReward = float.Parse(loseRInputOBJ.GetComponent<InputField>().text);
        }
    }
    public void killRValueChanged()
    {
        if(killRInputOBJ.GetComponent<InputField>().text == "" || killRInputOBJ.GetComponent<InputField>().text == "-")
        {
            killRInputText.color = Color.gray;
            DataTransfer.GetComponent<StartSeneData>().killReward = DataTransfer.GetComponent<StartSeneData>().killRewardDefault;
        }
        else{
            killRInputText.color = Color.yellow;
            DataTransfer.GetComponent<StartSeneData>().killReward = float.Parse(killRInputOBJ.GetComponent<InputField>().text);
        }
    }
}
