Beispiel #1
0
        public IEnumerable <float> LoadRelayFromDirectory(string pInputDirectory, bool pOnlyLoadTingsAndRooms)
        {
#if PROFILE
            Stopwatch sw = new Stopwatch();
            sw.Start();
#endif

            _relay = CreateEmptyRelay();
            DialogueRunner dialogueRunner = new DialogueRunner(_relay, Language.DEFAULT);
            _dialogueScriptLoader = new DialogueScriptLoader(dialogueRunner);
            _sourceCodeDispenser  = new SourceCodeDispenser(_relay);
            _timetableRunner      = new TimetableRunner(_relay);

            string[] files = GetFilesRecursively(pInputDirectory);

            for (int i = 0; i < files.Length; i++)
            {
                FoundFile(files[i], pOnlyLoadTingsAndRooms);
                yield return((float)i / (float)files.Length);
            }

#if PROFILE
            sw.Stop();
            logger.Log("Loading relay from directory " + pInputDirectory + " took " + sw.Elapsed.TotalSeconds + " s.");
#endif
        }
Beispiel #2
0
        public RelayTwo CreateRelay(string pInputDirectory, bool pOnlyLoadTingsAndRooms)
        {
            _relay = CreateEmptyRelay();
            DialogueRunner dialogueRunner = new DialogueRunner(_relay, Language.DEFAULT);

            _dialogueScriptLoader = new DialogueScriptLoader(dialogueRunner);
            _sourceCodeDispenser  = new SourceCodeDispenser(_relay);
            _timetableRunner      = new TimetableRunner(_relay);

            foreach (string s in GetFilesRecursively(pInputDirectory))
            {
                FoundFile(s, pOnlyLoadTingsAndRooms);
            }

            return(_relay);
        }
Beispiel #3
0
 private void Init(RelayTwo pRelay)
 {
     paused              = false;
     isReadyToPlay       = false;
     relay               = pRelay;
     dialogueRunner      = new DialogueRunner(relay, Language.DEFAULT);
     roomRunner          = new RoomRunner(relay);
     programRunner       = new ProgramRunner(relay);
     sourceCodeDispenser = new SourceCodeDispenser(relay);
     timetableRunner     = new TimetableRunner(relay);
     settings            = new WorldSettings(relay);
     tingRunner          = new MimanTingRunner(relay, dialogueRunner, programRunner, sourceCodeDispenser, roomRunner, timetableRunner, settings);
     grimmApiDefinitions = new MimanGrimmApiDefinitions(this);
     grimmApiDefinitions.RegisterFunctions();
     grimmApiDefinitions.RegisterExpressions();
     translator = new Translator(Translator.Language.SWEDISH);
 }
Beispiel #4
0
		private void Init(RelayTwo pRelay)
        {
			paused = false;
			isReadyToPlay = false;
			relay = pRelay;
			dialogueRunner = new DialogueRunner(relay, Language.DEFAULT);
			roomRunner = new RoomRunner(relay);
			programRunner = new ProgramRunner(relay);
			sourceCodeDispenser = new SourceCodeDispenser(relay);
			timetableRunner = new TimetableRunner(relay);
			settings = new WorldSettings(relay);
            tingRunner = new MimanTingRunner(relay, dialogueRunner, programRunner, sourceCodeDispenser, roomRunner, timetableRunner, settings);
			grimmApiDefinitions = new MimanGrimmApiDefinitions(this);
			grimmApiDefinitions.RegisterFunctions();
			grimmApiDefinitions.RegisterExpressions();
			translator = new Translator (Translator.Language.SWEDISH);
		}
Beispiel #5
0
        public MimanTingRunner(
            RelayTwo pRelay,
            DialogueRunner pDialogueRunner,
            ProgramRunner pProgramRunner,
            SourceCodeDispenser pSourceCodeDispenser,
            RoomRunner pRoomRunner,
            TimetableRunner pTimetableRunner,
            WorldSettings pWorldSettings
            )
            : base(pRelay, pRoomRunner)
        {
            _dialogueRunner = pDialogueRunner;
            _dialogueRunner.AddOnSomeoneSaidSomethingListener(this.OnSomeoneSaidSomething);
            _programRunner       = pProgramRunner;
            _sourceCodeDispenser = pSourceCodeDispenser;
            _timetableRunner     = pTimetableRunner;
            _worldSettings       = pWorldSettings;

            foreach (Ting ting in _tings.Values)
            {
                if (ting is MimanTing)
                {
                    (ting as MimanTing).SetMimanRunners(_programRunner, _sourceCodeDispenser, _dialogueRunner, _worldSettings);
                }
                if (ting is Character)
                {
                    (ting as Character).SetTimetableRunner(_timetableRunner);
                }
            }

            foreach (Ting ting in _tings.Values)
            {
                if (ting is MimanTing)
                {
                    var mimanTing = ting as MimanTing;
                    mimanTing.Init();
                    if (mimanTing.autoUnregisterFromUpdate && mimanTing.dialogueLine != "")
                    {
                        Unregister(mimanTing);
                    }
                }
            }
        }
Beispiel #6
0
 public void SetTimetableRunner(TimetableRunner pTimetableRunner)
 {
     _timetableRunner = pTimetableRunner;
 }