예제 #1
0
    public static string[] SplitArray(JSONNode jsonData)
    {
        string str = jsonData == null || !jsonData.Exists() ? null : jsonData.AsDecodedURL();

        if (string.IsNullOrEmpty(str))
        {
            return(null);
        }

        Regex badChars = new Regex(@"[^\w_\-,]*", RegexOptions.IgnoreCase);

        str = badChars.Replace(str, "");

        string[] strSplit = str.Split(",");

        return(strSplit);
    }
예제 #2
0
    private IEnumerator __TrySignup()
    {
        SetBusy(true);

        API.Users.Signup(signupFullname.text, signupUsername.text, signupEmail.text, signupPassword.text)
        .Then(res => {
            trace("Signup Success!!!!!!");
            this.Wait(1.0f, () => {
                SetBusy(false);
                Hide();
            });
        })
        .Catch(err => {
            NodeError nodeErr = (NodeError)err;
            JSONNode data     = nodeErr.json["data"];

            if (data.Exists() && data["duplicates"].Exists())
            {
                JSONArray fields = data["duplicates"]["fields"].AsArray;

                ShowError("Found duplicate user on field(s):\n" + fields.Join(", "));
            }
            else
            {
                ShowError(nodeErr.json["error"]);
                traceError(nodeErr.response.text);
                traceError(nodeErr.Message);
            }

            ShowPanel(signupPanel);
            SetBusy(false);
        });

        while (_isBusy)
        {
            yield return(new WaitForSeconds(1.0f));
        }

        yield break;
    }