示例#1
0
    void Update()
    {
        string name = NameManager.GetMyName();

        if (!string.IsNullOrEmpty(name))
        {
            text.text    = name;
            text.enabled = true;
            enabled      = false;
        }
    }
    private void DoSaveGame()
    {
        SaveData data = new SaveData();

        data.state          = state;
        data.stats          = stats;
        data.presents       = presents;
        data.friends        = friends;
        data.friendRequests = pendingRequests.Count;
        data.playerName     = NameManager.GetMyName();
        data.ldName         = LudumDareAPI.GetUsername();
        PlayerPrefs.SetString("SaveData", JsonUtility.ToJson(data));
        SendHighscore();
    }
    public static Coroutine SendHighscore()
    {
        SaveData data = new SaveData();

        data.state          = instance.state;
        data.stats          = instance.stats;
        data.friendRequests = instance.pendingRequests.Count;
        data.playerName     = NameManager.GetMyName();
        data.ldName         = LudumDareAPI.GetUsername();
        WWWForm form = new WWWForm();

        form.AddField("SaveData", JsonUtility.ToJson(data));
        WWW req = new WWW("https://hitchh1k3rsguide.com/api/ld40_highscore.php", form);

        return(instance.StartCoroutine(req));
    }