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));
    }
Exemple #2
0
    void Update()
    {
        multiplayerButton.isEnabled = (DarkRef.CheckAccess() || multiplayerEnabled);
        editServerButton.isEnabled  = (Topan.Network.isConnected && Topan.Network.isServer && !GeneralVariables.lobbyManager.startedCountdown);
        moreInfoButton.isEnabled    = Topan.Network.isConnected;
        hostPortInput.gameObject.SetActive(portForwardCheckbox.value);

        if (Topan.Network.isConnected && tooltipInfo.display)
        {
            tooltipInfo.text = "";
            int i = 0;
            foreach (KeyValuePair <string, GameType.GameTypeSetting> pair in NetworkingGeneral.currentGameType.customSettings)
            {
                tooltipInfo.text += pair.Key + ": " + pair.Value.currentValue;
                if (NetworkingGeneral.currentGameType.customSettings.Count > 1 && i < NetworkingGeneral.currentGameType.customSettings.Count - 1)
                {
                    tooltipInfo.text += "\n";
                }
                i++;
            }

            byte roundCount = (byte)Topan.Network.GetServerInfo("rc");
            tooltipInfo.text += "\n" + "Rounds Per Match: " + ((roundCount == 255) ? "Unlimited" : roundCount.ToString());
            tooltipInfo.text += "\n" + "Ping Limit: " + (int)Topan.Network.GetServerInfo("plim") + " ms";
            byte idleTime = (byte)Topan.Network.GetServerInfo("it");
            tooltipInfo.text += "\n" + "Idle Time Limit: " + ((idleTime == 255) ? "Disabled" : ((int)idleTime * 5).ToString() + " seconds");
            byte botCount = (byte)Topan.Network.GetServerInfo("bC");
            tooltipInfo.text += "\n" + "Bot Count: " + ((botCount == 0) ? "Disabled" : botCount.ToString());
        }

        float timeDiffSec   = (float)DateTime.UtcNow.Subtract(mServerCheckTime).TotalSeconds;
        int   checkTimeDiff = (mServerCheckTime != DateTime.MinValue) ? Mathf.FloorToInt(timeDiffSec / 60f) : -1;

        mCheckingIcon.enabled       = pinging;
        mServerPingButton.isEnabled = (!pinging && timeDiffSec >= ((mServerIsOnline) ? 5f : 0f));

        mServerPing.text = "-- ms";
        if (mPingTime >= 5000)
        {
            mServerPing.text = ">5000 ms";
        }
        else if (mPingTime >= 0 && mPingTime < 5000)
        {
            mServerPing.text = mPingTime.ToString() + " ms";
        }

        string cTimeString = checkTimeDiff.ToString() + " minutes ago";

        if (checkTimeDiff > -1)
        {
            int hour = Mathf.FloorToInt(timeDiffSec / 3600f);
            if (hour > 0)
            {
                if (hour == 1)
                {
                    cTimeString = hour.ToString() + " hour ago";
                }
                else if (hour > 1)
                {
                    cTimeString = hour.ToString() + " hours ago";
                }
            }
            else
            {
                if (checkTimeDiff == 0)
                {
                    cTimeString = "a moment ago";
                }
                else if (checkTimeDiff == 1)
                {
                    cTimeString = checkTimeDiff.ToString() + " minute ago";
                }
            }
        }
        else
        {
            cTimeString = "never";
        }

        if (mServerIsOnline)
        {
            mServerStatus.text = "Master server is [8CC40F]ONLINE[-]" + "\n" + "Last check: " + cTimeString;
        }
        else
        {
            mServerStatus.text = "Master server is [B61515]OFFLINE[-]" + "\n" + "Last check: " + cTimeString;
        }
    }