using System.Collections.Generic;
using TMPro;
using UnityEngine;

public class CrossOptionMenu : BackButton
{
    [SerializeField] GameObject changeColorScreen;
    [SerializeField] GameObject plotScale;
    [SerializeField] GameObject detailExplain;
    [SerializeField] TextMeshPro displayText;

    GraphData crossGraphData;
    List<GraphData> originGraphDatas;
    string str;

    public void Initialize(GraphData crossData, GraphData data1, GraphData data2)
    {
        originGraphDatas = new List<GraphData>();
        originGraphDatas.Add(data1);
        originGraphDatas.Add(data2);

        this.crossGraphData = crossData;
        if (crossData.getgraphObject().activeSelf == true)
        {
            str = "表示中";
        }
        else
        {
            str = "非表示中";
        }
        displayText.text = str;
    }

    public void pressedChangeColorButton()
    {
        if (crossGraphData.getgraphObject().activeSelf == true)
        {
            changeColorScreen.GetComponent<ChangeColorScreen>().Initialize(crossGraphData);
            changeColorScreen.SetActive(true);
            base.anotherButtonAction();
        }
        
    }
    public void pressedPlotScaleButton()
    {
        if (crossGraphData.getgraphObject().activeSelf == true)
        {
            plotScale.GetComponent<PlotScale>().Initialize(crossGraphData);
            plotScale.SetActive(true);
            base.anotherButtonAction();
        }
        
    }

    public void pressedDisplayTriggerButton()
    {
        if (crossGraphData.getgraphObject().activeSelf==true)
        {
            crossGraphData.getgraphObject().SetActive(false);
            str = "非表示中";
        }
        else
        {
            crossGraphData.getgraphObject().SetActive(true);
            str = "表示中";
        }
        displayText.text = str;
    }

    public void pressedDetailButton()
    {
        detailExplain.GetComponent<DetailExplain>().Initialize(crossGraphData, originGraphDatas);
        detailExplain.SetActive(true);
        base.anotherButtonAction();
    }
}
