Пример #1
0
        public LogEntry GenerateGoodyRoomLogEntry(string doorId, int levelForDoor, List<Item> itemsInRoom)
        {
            var entry = new LogEntry();

            entry.title = GenerateRandomTitle();

            var randomLog = logDatabase[LogType.GoodyDoor].RandomElement();
            var substitutedLog = randomLog.Value.First();
            List<string> logEntryLines = substitutedLog.lines;

            try
            {
                logEntryLines = ApplyStandardSubstitutions(logEntryLines);

                logEntryLines = ApplySubstitutions(logEntryLines, new Dictionary<string, string> {
                { "<doorlevel>", Game.Dungeon.DungeonInfo.LevelNaming[levelForDoor] },
                { "<idtype>", doorId },
                { "<item>", itemsInRoom.RandomElement().SingleItemDescription }
            });

            }
            catch (Exception)
            {
                //Not to worry
            }

            entry.lines = logEntryLines;

            return entry;
        }
Пример #2
0
        public LogEntry GenerateArbitaryLogEntry(string logname)
        {
            var entry = new LogEntry();

            entry.title = GenerateRandomTitle();

            var logByName = logDatabaseByFilename[logname];

            entry.lines = logByName.lines;

            return entry;
        }
Пример #3
0
        public LogEntry GenerateGeneralQuestLogEntry(string logname, int levelForDoor, int levelForClue)
        {
            var entry = new LogEntry();

            entry.title = GenerateRandomTitle();

            var randomLog = logDatabaseByFilename[logname];
            var substitutedLog = randomLog;
            List<string> logEntryLines = substitutedLog.lines;

            try
            {
                logEntryLines = ApplyStandardSubstitutions(logEntryLines);

                logEntryLines = ApplySubstitutions(logEntryLines, new Dictionary<string, string> {
                { "<doorlevel>", Game.Dungeon.DungeonInfo.LevelNaming[levelForDoor] },
                { "<cluelevel>", Game.Dungeon.DungeonInfo.LevelNaming[levelForClue] }
            });

            }
            catch (Exception)
            {
                //Not to worry
            }

            entry.lines = logEntryLines;

            return entry;
        }
Пример #4
0
        public LogEntry GenerateElevatorLogEntry(int sourceLevel, int targetLevel)
        {
            var entry = new LogEntry();

            entry.title = GenerateRandomTitle();

            var randomLog = logDatabase[LogType.Elevator].RandomElement();
            var substitutedLog = randomLog.Value.First();
            List<string> logEntryLines = substitutedLog.lines;

            try {
                logEntryLines = ApplySubstitutions(logEntryLines, new Dictionary<string, string> {
                { "<source>", Game.Dungeon.DungeonInfo.LevelNaming[sourceLevel] },
                { "<target>", Game.Dungeon.DungeonInfo.LevelNaming[targetLevel] }
            });

            } catch(Exception) {
                logEntryLines = ApplySubstitutions(logEntryLines, new Dictionary<string, string> {
                { "<source>", "" },
                { "<target>", "" }
            });
            }

            entry.lines = logEntryLines;

            return entry;
        }
Пример #5
0
        public LogEntry GenerateDoorLogEntry(string doorId, int levelForDoor)
        {
            var entry = new LogEntry();

            entry.title = GenerateRandomTitle();

            var randomLog = logDatabase[LogType.SimpleLockedDoor].RandomElement();
            var substitutedLog = randomLog.Value.First();
            List<string> logEntryLines = substitutedLog.lines;

            try
            {
                logEntryLines = ApplyStandardSubstitutions(logEntryLines);

                logEntryLines = ApplySubstitutions(logEntryLines, new Dictionary<string, string> {
                { "<level>", Game.Dungeon.DungeonInfo.LevelNaming[levelForDoor] },
                { "<idtype>", doorId }
            });

            }
            catch (Exception)
            {
             //Not to worry
            }

            entry.lines = logEntryLines;

            return entry;
        }
Пример #6
0
        public List<LogEntry> GenerateCoupledDoorLogEntry(string doorId, int levelForDoor, int levelForClue)
        {
            //Ensure we have 2 coupled entries
            var randomLog = logDatabase[LogType.SimpleLockedDoor].Where(kv => kv.Value.Count() == 2).RandomElement();

            var firstLog = randomLog.Value.ElementAt(0);
            var secondLog = randomLog.Value.ElementAt(1);

            var firstLogName = allLast.RandomElement();
            var secondLogName = allLast.RandomElement();

            var firstReturnLog = new LogEntry();
            firstReturnLog.title = GenerateRandomTitle(firstLogName);

            var secondReturnLog = new LogEntry();
            secondReturnLog.title = GenerateRandomTitle(secondLogName);

            var firstlogEntryLines = firstLog.lines;

            try
            {
                firstlogEntryLines = ApplySubstitutions(firstlogEntryLines, new Dictionary<string, string> {
                { "<doorlevel>", Game.Dungeon.DungeonInfo.LevelNaming[levelForDoor] },
                { "<cluelevel>", Game.Dungeon.DungeonInfo.LevelNaming[levelForClue] },
                { "<lastname>", secondLogName },
                { "<idtype>", doorId }
            });

            }
            catch (Exception)
            {
                //Not to worry
            }

            firstReturnLog.lines = firstlogEntryLines;

            var secondlogEntryLines = secondLog.lines;

            try
            {
                secondlogEntryLines = ApplySubstitutions(secondlogEntryLines, new Dictionary<string, string> {
                { "<doorlevel>", Game.Dungeon.DungeonInfo.LevelNaming[levelForDoor] },
                { "<cluelevel>", Game.Dungeon.DungeonInfo.LevelNaming[levelForClue] },
                { "<lastname>", firstLogName },
                { "<idtype>", doorId }
            });

            }
            catch (Exception)
            {
                //Not to worry
            }

            firstReturnLog.lines = firstlogEntryLines;
            secondReturnLog.lines = secondlogEntryLines;

            return new List<LogEntry>{ firstReturnLog, secondReturnLog};
        }
Пример #7
0
        public void PlayLog(LogEntry logEntry)
        {
            try
            {
                movieFrames = new List<MovieFrame>();
                var logFrame = new MovieFrame();
                var allLines = new List<string>();
                allLines.Add(logEntry.title);
                allLines.AddRange(logEntry.lines);
                logFrame.scanLines = allLines;
                var dimensions = CalculateWidthHeightFromLines(allLines);
                logFrame.width = dimensions.Item1;
                logFrame.height = dimensions.Item2;

                movieFrames.Add(logFrame);

                PlayMovieFrames(false);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to play movie from frames " + ex.Message);
            }
        }