public void SendMailMessage()
    {
        string prefString  = (isBugReport) ? "_alt_inpJoy" : "_defaults_ax";
        int    currentTime = DarkRef.GetSystemTime();

        int    lastTime = 0;
        string val      = DarkRef.DecryptString(PlayerPrefs.GetString(prefString, ""), 2, true);

        if (val == "dse-1")
        {
            PlayerPrefs.SetString(prefString, DarkRef.EncryptString((currentTime * ((isBugReport) ? 19 : 8)).ToString(), 2));
            StartCoroutine(ClearInputs());
            return;
        }

        if (int.TryParse(val, out lastTime))
        {
            if (!DarkRef.CheckAccess() && Mathf.Abs(currentTime - (lastTime / ((isBugReport) ? 19 : 8))) <= 30)
            {
                StartCoroutine(FadePanelMessage());
                return;
            }
        }
        else if (PlayerPrefs.HasKey(prefString) && PlayerPrefs.GetString(prefString) != "")
        {
            return;
        }

        StartCoroutine(SendMessageRoutine());
        PlayerPrefs.SetString(prefString, DarkRef.EncryptString((currentTime * ((isBugReport) ? 19 : 8)).ToString(), 2));
    }
Esempio n. 2
0
    private void OnGUI()
    {
        encryptInput     = EditorGUILayout.TextField("Encrypt: ", encryptInput);
        encryptIteration = EditorGUILayout.IntSlider("Encrypt Iterations:", encryptIteration, 1, 5);
        if (encryptInput != "")
        {
            EditorGUILayout.TextField("  RESULT:", DarkRef.EncryptString(encryptInput, encryptIteration));
        }

        GUILayout.Space(10f);

        decryptInput     = EditorGUILayout.TextField("Decrypt: ", decryptInput);
        decryptIteration = EditorGUILayout.IntSlider("Decrypt Iterations:", decryptIteration, 1, 5);
        if (decryptInput != "")
        {
            EditorGUILayout.TextField("  RESULT:", DarkRef.DecryptString(decryptInput, decryptIteration));
        }

        if (GUI.changed)
        {
            EditorPrefs.SetString("EncInput", encryptInput);
            EditorPrefs.SetString("DecInput", decryptInput);
            EditorPrefs.SetInt("EncIter", encryptIteration);
            EditorPrefs.SetInt("DecIter", decryptIteration);
        }
    }
Esempio n. 3
0
    private IEnumerator StartLoginRoutine()
    {
        logging = true;

        signInLoading.SetActive(true);
        signinResult.enabled = false;

        WWWForm loginForm = new WWWForm();

        loginForm.AddField("user", usernameInput.value);
        loginForm.AddField("pwd", CalculateSHA1(passwordInput.value, Encoding.Default));
        WWW loginWWW = new WWW(loginURL, loginForm);

        yield return(loginWWW);

        databaseID = -1;
        if (string.IsNullOrEmpty(loginWWW.error) && loginWWW.text != "-1")
        {
            databaseID     = int.Parse(loginWWW.text);
            isGuestAccount = false;

            if (rememberMeCheck.value)
            {
                PlayerPrefs.SetString("Username", usernameInput.value);
                PlayerPrefs.SetString("Pwd", DarkRef.EncryptString(passwordInput.value));
            }

            PlayerPrefs.SetInt("RememberMe", (rememberMeCheck.value) ? 1 : 0);

            signinResult.enabled = true;
            signinResult.text    = "[89B01B]Login successful[-]";

            if (!ignoreSound)
            {
                NGUITools.PlaySound(loginSuccess);
            }

            signInLoading.SetActive(false);

            yield return(StartCoroutine(UpdateProfileInfo(databaseID)));

            if (!ignoreWait)
            {
                float wait = 0f;
                while (wait < 0.8f)
                {
                    wait += Time.deltaTime;
                    yield return(null);
                }
            }

            if (tabManager.selectedTab != 0)
            {
                tabManager.SelectTab(0);
            }

            yield return(new WaitForSeconds(0.2f));

            signinResult.enabled = false;
        }
        else
        {
            signinResult.enabled = true;

            if (!ignoreSound)
            {
                NGUITools.PlaySound(loginFailure, 0.3f);
            }

            signInLoading.SetActive(false);

            if (MultiplayerMenu.mServerIsOnline)
            {
                signinResult.text = "[FF2000]Invalid username or password[-]";
            }
            else
            {
                signinResult.text = "[FF2000]Authentication failed[-]";
            }
        }

        logging     = false;
        ignoreWait  = false;
        ignoreSound = false;
    }