Beispiel #1
0
    static void Enable()
    {
        _instance = new RuntimeConsole();
        Application.logMessageReceived += _instance.OnLogMessageReceived;

        Debug.Log("Console Enabled");
    }
Beispiel #2
0
    void Initialize()
    {
        Instance = this;
        DontDestroyOnLoad(gameObject);

        RuntimeConsole.textFont  = consoleFont;
        RuntimeConsole.IsEnabled = enableConsole;
        RuntimeConsole.SetCommands(commandPrefix, commands);
        RuntimeConsole.Initialize();
    }
Beispiel #3
0
    static void Disable()
    {
        Using = false;
        Mini  = false;

        if (_instance != null)
        {
            Application.logMessageReceived -= _instance.OnLogMessageReceived;
            _instance = null;
        }
    }
 public override bool Process(string[] args)
 {
     if (RuntimeConsole.Instance != null)
     {
         string response = "List of all Commands :\n";
         for (int i = 0; i < RuntimeConsole.CommandCount; i++)
         {
             response += RuntimeConsole.Prefix + RuntimeConsole.Command(i).KeyWord + "\n";
         }
         RuntimeConsole.Instance.Respond(response + "You can also add '#1 ' or '#2 ' at the start to make the line colored as an erorr or a warning, respectively.");
         return(true);
     }
     return(false);
 }
Beispiel #5
0
    protected override void Awake()
    {
        try
        {
            base.Awake();

            // Application settings go here
            Application.runInBackground = true;
            Application.targetFrameRate = 60;

            // Set up required components, and just the bare minimum of MVC actors.  We don't have config data yet, so
            // anything that requires real data off the network should be registered in StartupCommand or later
            mGuiManager = new RuntimeGuiManager(mLogger);
            mLogger.AddReporter(new DebugLogReporter());
            mGameFacade = GameFacade.Instance;             // Nulls out the reference on application exit for editor integration

            // Register Required Mediators
            GameFacade.Instance.RegisterMediator(new LoggerMediator(mLogger));
            GameFacade.Instance.RegisterMediator(new InputManagerMediator());
            GameFacade.Instance.RegisterMediator(new SchedulerMediator(this.Scheduler));
            GameFacade.Instance.RegisterMediator((IMediator)mGuiManager);

            RuntimeConsole runtimeConsole = new RuntimeConsole(mGuiManager);
            runtimeConsole.AddCommand("showTasks", ((Scheduler)this.Scheduler).ShowTasks);
            ((Scheduler)this.Scheduler).Logger = mLogger;
            GameFacade.Instance.RegisterMediator(runtimeConsole);
            mLogger.AddReporter(runtimeConsole);

            mLogger.Log("SceneInit.Awake", LogLevel.Info);

            ConnectionProxy connectionProxy = new ConnectionProxy();
            GameFacade.Instance.RegisterProxy(connectionProxy);

            // Get configuration data before doing anything else.  This sends STARTUP_COMMAND when done getting the config data
            ConfigManagerClient configManager = new ConfigManagerClient();
            GameFacade.Instance.RegisterProxy(configManager);
            configManager.InitAndStartup();
        }
        catch (System.Exception ex)
        {
            // Catch all here is to avoid browser crashes on exit if something becomes unstable.
            mLogger.Log(ex.ToString(), LogLevel.Error);
        }
        finally
        {
            mLogger.Flush();
        }
    }