Beispiel #1
0
        public override string PostCompile(HaJSCompiler compiler, HaJSElement parent)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("if (mode == 0)");
            sb.AppendLine("{");
            sb.AppendLine(IndentedStringBuilder.Indent + compiler.GetFeature("dlg_Ok").Compile(compiler, Stringify(noText)));
            sb.AppendLine(IndentedStringBuilder.Indent + compiler.GetFeature("special_End").Compile(compiler));
            sb.AppendLine(IndentedStringBuilder.Indent + "return;");
            sb.AppendLine("}");
            return(sb.ToString());
        }
        public static string Translate(HaJSCompiler compiler, string x)
        {
            int i = x.IndexOf("$");

            while (i != -1)
            {
                int callOpen = x.IndexOf("(", i);
                if (callOpen != -1)
                {
                    int callClose = x.IndexOf(")", callOpen);
                    if (callClose != -1)
                    {
                        string   feature = x.Substring(i + 1, callOpen - (i + 1));
                        string[] args    = x.Substring(callOpen + 1, callClose - (callOpen + 1)).Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                        if (compiler.HasFeature(feature))
                        {
                            HaJSFeature f           = compiler.GetFeature(feature);
                            string      replacement = f.Compile(compiler, args.ElementAtOrDefault(0), args.ElementAtOrDefault(1), args.ElementAtOrDefault(2));
                            x  = x.Remove(i, callClose + 1 - i); // Remove old string
                            x  = x.Insert(i, replacement);       // Insert our replacement
                            i += replacement.Length;
                        }
                    }
                }

                if (i + 1 >= x.Length)
                {
                    break;
                }
                i = x.IndexOf("$", i + 1);
            }
            return(x);
        }
Beispiel #3
0
        public override string Compile(HaJSCompiler compiler)
        {
            string fullText = text + "#b";

            for (int i = 0; i < Children.Count; i++)
            {
                OptionElement oe = (OptionElement)Children[i];
                fullText += "\\r\\n#L" + i.ToString() + "#" + oe.Text + "#l";
            }
            fullText += "#k";
            return(compiler.GetFeature("dlg_Options").Compile(compiler, Stringify(fullText)));
        }
Beispiel #4
0
 public override string Compile(HaJSCompiler compiler)
 {
     return(compiler.GetFeature("dlg_YesNo").Compile(compiler, Stringify(text)));
 }
Beispiel #5
0
 public override string Compile(HaJSCompiler compiler)
 {
     return(style == -1 ? compiler.GetFeature("dlg_Ok").Compile(compiler, Stringify(text))
                        : compiler.GetFeature("dlg_OkExtended").Compile(compiler, Stringify(text), style.ToString()));
 }