Exemplo n.º 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);
            }
        }
Exemplo n.º 3
0
 public override bool Run(DialogueFile file)
 {
     DialogueCompiler.Instance.Error(statement, "No such statement ({0})", statement.LineType);
     return false;
 }
Exemplo n.º 4
0
 public override bool Run(DialogueFile file)
 {
     return true;
 }
Exemplo n.º 5
0
 public abstract bool Run(DialogueFile file);
Exemplo n.º 6
0
 public override bool Run(DialogueFile file)
 {
     file.AddLines(File.Lines);
     return false;
 }
Exemplo n.º 7
0
 public AtInclude(DialogueLine param)
 {
     File = DialogueFile.Open(param.Content);
 }
 public void ImportFile(DialogueFile file)
 {
     file.Parse();
     files.Add(file);
 }
Exemplo n.º 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];
        }