Exemplo n.º 1
0
    void RequestPlayerEmail(string accountId, LobbyMessageInfo info)
    {
        LogManager.General.Log("Requested mail for: " + accountId);

        // Query email
        LobbyGameDB.GetEmail(accountId, data => {
            if (data != null)
            {
                Lobby.RPC("ReceivePlayerEmail", info.sender, accountId, data);
            }
        });
    }
    // DeleteAccount
    // TODO: This is incomplete and should only be used for not yet activated accounts
    public static IEnumerator DeleteAccount(string accountId)
    {
        string email = null;

        yield return(LobbyGameDB.GetEmail(
                         accountId,
                         data => {
            if (data != null)
            {
                email = data;
            }
        }
                         ));

        if (string.IsNullOrEmpty(email))
        {
            yield break;
        }

        // Get a list of all buckets
        var getBucketsReq = Bucket.GetBuckets();

        yield return(getBucketsReq.WaitUntilDone());

        if (getBucketsReq.isSuccessful)
        {
            foreach (var bucket in getBucketsReq.GetBucketEnumerable())
            {
                if (bucket.name.StartsWith("AccountTo"))
                {
                    yield return(bucket.Remove(accountId).WaitUntilDone());
                }
            }
        }

        var emailBucketNames = new string[] {
            "AccountsAwaitingActivation",
            "uLobby AccountNameToID"
        };

        foreach (var bucketName in emailBucketNames)
        {
            yield return(new Bucket(bucketName).Remove(email).WaitUntilDone());
        }

        yield return(new Bucket("uLobby Accounts").Remove(email).WaitUntilDone());
    }