示例#1
0
    // Use this for initialization
    void Start()
    {
        Login_btn  = GameObject.Find("Button_Login");
        Reg_btn    = GameObject.Find("Button_Reg");
        Logout_btn = GameObject.Find("Button_Logout");
        ID         = GameObject.Find("Input_ID");
        Pwd        = GameObject.Find("Input_PW");
        PlayerPrefs.GetInt("LogStat", 0);

        Login_btn.GetComponent <Button>().onClick.AddListener(Button_Login);
        Reg_btn.GetComponent <Button>().onClick.AddListener(Button_Reg);
        Logout_btn.GetComponent <Button>().onClick.AddListener(Button_Logout);

        if (PlayerPrefs.GetInt("LogStat") == 0)
        {
            Login_btn.SetActive(true);
            Reg_btn.SetActive(true);
            Logout_btn.SetActive(false);
            ID.SetActive(true);
            Pwd.SetActive(true);
        }
        else
        {
            Login_btn.SetActive(false);
            Reg_btn.SetActive(false);
            Logout_btn.SetActive(true);
            ID.SetActive(false);
            Pwd.SetActive(false);
        }
    }