public void SetUp()
    {
        PrototypeManager.Initialize();

        JToken reader = JToken.Parse(testHeadlineJson);

        PrototypeManager.Headline.LoadJsonPrototypes((JProperty)reader.First);

        gen = new HeadlineGenerator();
        gen.UpdatedHeadline += StringPrinted;
        stringPrinted        = false;
    }
Example #2
0
    public void Init()
    {
        FunctionsManager.Initialize();

        FunctionsManager.ScheduledEvent.LoadScript(LuaFunctionString, "ScheduledEvent", Functions.Type.Lua);

        PrototypeManager.Initialize();

        JToken reader = JToken.Parse(JsonPrototypeString);

        PrototypeManager.ScheduledEvent.Add(new ScheduledEvent("ping_log", evt => UnityDebugger.Debugger.LogFormat("Scheduler", "Event {0} fired", evt.Name)));
        PrototypeManager.ScheduledEvent.LoadJsonPrototypes((JProperty)reader.First);

        // The problem with unit testing singletons
        ///scheduler = Scheduler.Scheduler.Current;
        scheduler = new Scheduler.Scheduler();

        callback = evt => UnityDebugger.Debugger.LogFormat("SchedulerTest", "Event {0} fired", evt.Name);
    }
    public void Awake()
    {
        if (Instance == null || Instance == this)
        {
            Instance = this;
        }
        else
        {
            UnityDebugger.Debugger.LogError("Two 'MainMenuController' exist, deleting the new version rather than the old.");
            Destroy(this.gameObject);
        }

        PrototypeManager.Initialize();
        FunctionsManager.Initialize();
        SpriteManager.Initialize();
        AudioManager.Initialize();

        // Load Mods and Settings on awake rather than on Starts
        ModsManager = new ModsManager();
        Settings.LoadSettings();
    }
    public void OnEnable()
    {
        if (Instance == null || Instance == this)
        {
            Instance = this;
        }
        else
        {
            UnityDebugger.Debugger.LogError("WorldController", "There should never be two world controllers.");
        }

        FunctionsManager.Initialize();
        PrototypeManager.Initialize();
        CharacterNameManager.Initialize();
        SpriteManager.Initialize();
        AudioManager.Initialize();

        // FIXME: Do something real here. This is just to show how to register a C# event prototype for the Scheduler.
        PrototypeManager.ScheduledEvent.Add(
            new ScheduledEvent(
                "ping_log",
                (evt) => UnityDebugger.Debugger.LogFormat("Scheduler", "Event {0} fired", evt.Name)));

        ModsManager = new ModsManager();

        // Reload incase any mods have changed settings
        Settings.LoadSettings();

        if (SceneController.LoadWorldFromFileName != null)
        {
            CreateWorldFromSaveFile(SceneController.LoadWorldFromFileName);
            SceneController.LoadWorldFromFileName = null;
        }
        else
        {
            CreateEmptyWorld();
        }

        SoundController = new SoundController(World);
    }