private bool DoLoadGame()
    {
        bool loaded = false;
        int  fReq   = 3;

        if (PlayerPrefs.HasKey("SaveData"))
        {
            SaveData data = JsonUtility.FromJson <SaveData>(PlayerPrefs.GetString("SaveData"));
            state    = data.state;
            stats    = data.stats;
            presents = data.presents;
            friends  = data.friends;
            fReq     = data.friendRequests;
            if (!string.IsNullOrEmpty(data.playerName))
            {
                string[] nameBits = data.playerName.Split(new [] { ' ' }, 2);
                NameManager.SetMyName(nameBits[0], nameBits[1]);
            }
            if (!string.IsNullOrEmpty(data.ldName))
            {
                LudumDareAPI.SetUser(data.ldName, () => {});
            }
            loaded = true;
        }
        pendingRequests.Clear();
        for (int i = 0; i < fReq; ++i)
        {
            pendingRequests.Add(GenerateFriend());
        }
        PrepareFriends();
        SetUpgrades();
        ApplyUpgrades();
        return(loaded);
    }
Beispiel #2
0
    public void SubmitButton()
    {
        if (!isProcessing)
        {
            errorLine.text            = "";
            isProcessing              = true;
            submitButton.interactable = false;
            buttonText.text           = "working...";

            if (firstName.text.Trim() == "" || lastName.text.Trim() == "")
            {
                errorLine.text            = "*First and Last Name are Required";
                isProcessing              = false;
                submitButton.interactable = true;
                buttonText.text           = "Submit";
                return;
            }
            NameManager.SetMyName(firstName.text, lastName.text);

            if (ldName.text != "")
            {
                LudumDareAPI.SetUser(ldName.text, () => {
                    isProcessing = false;
                    if (LudumDareAPI.GetUserID() > 2)
                    {
                        InterfaceManager.ShowFriendBay();
                    }
                    else
                    {
                        submitButton.interactable = true;
                        buttonText.text           = "Submit";
                        errorLine.text            = "*Ludum Dare Username Could Not Be Found";
                    }
                });
            }
            else
            {
                InterfaceManager.ShowFriendBay();
            }
        }
    }