コード例 #1
0
    public void SubmitConfirm_OnClick()
    {
        // Deactive input field and buttons until server response
        GameObject Background_Canvas = GameObject.Find("Background_Canvas");

        Set_InteractableSubmitScore(false);
        Set_Error(false);

        // Send high score to server
        string Name       = Background_Canvas.transform.GetChild(14).GetComponent <InputField>().text;
        int    High_Score = Data_Manager.Get_HighScore();

        // Check string name is null
        if (string.IsNullOrEmpty(Name.Replace(" ", "")))
        {
            // Name error
            Button_OnClick.Set_InteractableSubmitScore(true);
            Button_OnClick.Set_Error(true, "enter your name");
        }
        else if (Name.IndexOf("'") >= 0 || Name.IndexOf("|") >= 0)
        {
            // Correct name error
            Button_OnClick.Set_InteractableSubmitScore(true);
            Button_OnClick.Set_Error(true, "enter correct name");
        }
        else
        {
            GameObject.Find("Game_Controller").GetComponent <Submit_Score>().Post_Score(Name, High_Score);
        }
    }
コード例 #2
0
    public void Share()
    {
        if (!Processing)
        {
            // Active canvas and set high score
            Share_Canvas.SetActive(true);
            Share_Canvas.transform.GetChild(4).GetComponent <Text>().text = Data_Manager.Get_HighScore().ToString();

            StartCoroutine(Share_ScreenShot());
        }
    }
コード例 #3
0
    void Set_GameOver()
    {
        if (Data_Manager.Get_HighScore() < Score)
        {
            Data_Manager.Set_HighScore(Score);
        }

        Txt_GameOverScore.text     = Score.ToString();
        Txt_GameOverHighsocre.text = Data_Manager.Get_HighScore().ToString();
        GameObject Background_Canvas = GameObject.Find("Background_Canvas");

        // Active game over menu
        Button_OnClick.Set_GameOverMenu(true);
        SceneManager.LoadScene("In_Game");
        // Enable animation
        Background_Canvas.GetComponent <Animator>().enabled = false;

        // Save file
        // File_Manager.Save_Info();
    }
コード例 #4
0
    public static void Save_Info()
    {
        // Write information
        string Str_Data = Data_Manager.Get_PlayerName() + "|" + Data_Manager.Get_PlayerHash() + "|" + Data_Manager.Get_HighScore();

        byte[]   Byte_Data = System.Text.Encoding.UTF8.GetBytes(Str_Data);
        string[] Data      = new string[1];
        Data[0] = System.Convert.ToBase64String(Byte_Data);

        File.WriteAllLines(File_Path, Data);
    }