ict.shenzhi/Assets/setactive_.cs

75 lines
2.1 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class setactive_ : MonoBehaviour
{
public GameObject showC;
public GameObject showJava;
public GameObject showPython;
public GameObject ScrollbarC;
public GameObject ScrollbarJava;
public GameObject ScrollbarPython;
public GameObject buttonC;
public GameObject buttonJava;
public GameObject buttonPython;
public Sprite SlecetC;
public Sprite SlecetJava;
public Sprite SlecetPython;
public Sprite UnSlecetC;
public Sprite UnSlecetJava;
public Sprite UnSlecetPython;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void buttonCFunction()
{
showC.SetActive(true);
showJava.SetActive(false);
showPython.SetActive(false);
ScrollbarC.SetActive(true);
ScrollbarJava.SetActive(false);
ScrollbarPython.SetActive(false);
buttonC.GetComponent<Image>().sprite = SlecetC;
buttonJava.GetComponent<Image>().sprite = UnSlecetJava;
buttonPython.GetComponent<Image>().sprite = UnSlecetPython;
}
public void buttonJavaFunction()
{
showC.SetActive(false);
showJava.SetActive(true);
showPython.SetActive(false);
ScrollbarC.SetActive(false);
ScrollbarJava.SetActive(true);
ScrollbarPython.SetActive(false);
buttonC.GetComponent<Image>().sprite = UnSlecetC;
buttonJava.GetComponent<Image>().sprite = SlecetJava;
buttonPython.GetComponent<Image>().sprite = UnSlecetPython;
}
public void buttonPythonFunction()
{
showC.SetActive(false);
showJava.SetActive(false);
showPython.SetActive(true);
ScrollbarC.SetActive(false);
ScrollbarJava.SetActive(false);
ScrollbarPython.SetActive(true);
buttonC.GetComponent<Image>().sprite = UnSlecetC;
buttonJava.GetComponent<Image>().sprite = UnSlecetJava;
buttonPython.GetComponent<Image>().sprite = SlecetPython;
}
}