Пример #1
0
        public DialogueLine(string line, DialogueFile file, int num)
        {
            Regex re = new Regex("([^:]+):(\"([^\"]*)\")?({.*})?");
            var match = re.Match(line);

            LineType = match.Groups[1].Value;
            QuotedContent = match.Groups[2].Value;
            Content = match.Groups[3].Value;
            var opt = match.Groups[4].Value;
            Options = JsonConvert.DeserializeObject<LineOptions>(opt) ?? new LineOptions();

            File = file;
            LineNumber = num;
        }
        public DialogueCompiler(Options opts)
        {
            if (Instance == null) {
                Instance = this;
            }

            BasePath = Path.GetDirectoryName(Path.GetFullPath(opts.InputFile));

            BaseFile = DialogueFile.Open(opts.InputFile);
            ImportFile(BaseFile);

            if (opts.Output == null) {
                Out = Console.Out;
            } else {
                Out = new StreamWriter(opts.Output);
            }
        }
Пример #3
0
 public override bool Run(DialogueFile file)
 {
     DialogueCompiler.Instance.Error(statement, "No such statement ({0})", statement.LineType);
     return false;
 }
Пример #4
0
 public override bool Run(DialogueFile file)
 {
     return true;
 }
Пример #5
0
 public abstract bool Run(DialogueFile file);
Пример #6
0
 public override bool Run(DialogueFile file)
 {
     file.AddLines(File.Lines);
     return false;
 }
Пример #7
0
 public AtInclude(DialogueLine param)
 {
     File = DialogueFile.Open(param.Content);
 }
 public void ImportFile(DialogueFile file)
 {
     file.Parse();
     files.Add(file);
 }
Пример #9
0
        public static DialogueFile Open(string path)
        {
            var f = path = Path.Combine(DialogueCompiler.Instance.BasePath, path);
            if (!File.Exists(f)) {
                f = path + ".txt";
                if (!File.Exists(f)) {
                    f = path + ".dlg";
                    if (!File.Exists(f)) {
                        f = path + ".ch";
                    }
                }
            }

            if (!cache.ContainsKey(f)) {
                cache[f] = new DialogueFile(f);
            }

            return cache[f];
        }