void UpdateFloodDetection()
    {
        int thisSecond = (int)(Time.unscaledTime);

        if (thisSecond != floodSecond)
        {
            floodSecond = thisSecond;
            floodCount  = 0;
        }
        ++floodCount;
        if (floodCount > FLOOD_THRESHOLD && Time.unscaledTime - lastFloodNotifyTime > 5f)
        {
            floodCount          = 0;
            lastFloodNotifyTime = Time.unscaledTime;
            hudMessageSystem.AddMessage("<color=red>TOO MANY MESSAGES!</color> Printing >" + FLOOD_THRESHOLD + "/second. <color=green>tilde (~)</color> to view.");
        }
    }
Esempio n. 2
0
    IEnumerator SavingCoroutine()
    {
        while (true)
        {
            yield return(new WaitForSecondsRealtime(periodSeconds));

            // Don't autosave during recovery mode. You might be overwriting an
            // autosave that the user wants to recover!
            if (this.isActiveAndEnabled && !GameBuilderApplication.IsRecoveryMode && !paused)
            {
                try
                {
                    DoAutosave(bundleId =>
                    {
                        // HACK HACK. Only because CMS is tied to player panels, when it really should be global.
                        if (notes == null)
                        {
                            notes = FindObjectOfType <HudNotifications>();
                        }

                        if (notes != null)
                        {
                            notes.AddMessage($"Auto-saved!");
                        }
                    });
                }
                catch (System.Exception e)
                {
                    popups.ShowTwoButtons(
                        $"Woops! Failed to autosave due to error:\n{e.Message}\nWe will disable autosaves until you restart Game Builder. Apologies for the error!",
                        "OK", () => { },
                        "Copy error details", () => { Util.CopyToUserClipboard(e.ToString()); },
                        800f);
                    SetPaused(true);
                }
            }
        }
    }
Esempio n. 3
0
 public void AddDebugMessage(string s)
 {
     consoleMessages.AddMessage(s);
 }