public GenericTranslatable(SPTCommand c) : base()
 {
     InitializeComponent();
     commands.Add(c);
     japs        = new List <TextBox>();
     engs        = new List <TextBox>();
     commandArgs = new List <GenericTArgOpts>();
 }
 public GenericTranslatable(SPTCommand c)
     : base()
 {
     InitializeComponent();
     commands.Add(c);
     japs = new List<TextBox>();
     engs = new List<TextBox>();
     commandArgs = new List<GenericTArgOpts>();
 }
Exemple #3
0
        public override List <SPTCommand> GetEnglishCommands()
        {
            List <SPTCommand> ret = new List <SPTCommand>(commands.Capacity);

            // by default every new line in english text box is new line in game
            List <string> lines = new List <string>(EngText.Replace("\r\n", "\n").Split('\n'));

            for (int i = 0; i < lines.Count; ++i)
            {
                SPTCommand n;
                if (lines[i].Length == 0)
                {
                    continue;
                }

                string full = lines[i].Replace("§S0§", "AAAAAAAA").Replace("§S1§", "XMXMX").Replace("§S2§", "BBBBBBBB");
                int    idx  = NFTR.GetIndexWhereWidthExceeds(TexBmpConv.font, full, 230, true);
                if (idx < full.Length)
                {
                    int    lastSpace = LastIndexBefore(full, ' ', idx);
                    string newL1     = full.Substring(0, lastSpace).Replace("AAAAAAAA", "§S0§").Replace("XMXMX", "§S1§").Replace("BBBBBBBB", "§S2§");
                    string newL2     = "";
                    if (lastSpace + 1 < full.Length)
                    {
                        newL2 = full.Substring(lastSpace + 1).Replace("AAAAAAAA", "§S0§").Replace("XMXMX", "§S1§").Replace("BBBBBBBB", "§S2§");
                    }
                    lines[i] = newL1;
                    if (newL2.Length > 0)
                    {
                        int colidx = newL1.LastIndexOf("<c:");
                        if (colidx > 0 && newL1.LastIndexOf("<c>") < colidx)
                        {
                            newL2 = newL2.Insert(0, newL1.Substring(colidx, 10));
                        }
                        lines.Insert(i + 1, newL2);
                    }
                }
                else if (lines[i].Equals("KEY_WAIT"))
                {
                    n = new SPTCommand(commands[0].Block);
                    n.PushArg("gosub"); n.PushArg("KEY_WAIT");
                    ret.Add(n);
                    continue;
                }

                n = new SPTCommand(commands[0].Block);
                n.PushArg(commands[0].GetArg(0)); n.PushArg(commands[0].GetArg(1));
                n.PushArg(Font10Converter.ReplaceOut(lines[i]));
                ret.Add(n);
            }
            return(ret);
        }
 public override List<SPTCommand> GetEnglishCommands()
 {
     List<SPTCommand> ret = new List<SPTCommand>(commands.Capacity);
     string[] lines = EngText.Replace("\r\n", "\n").Split('\n');
     for (int i = 0; i < lines.Length; ++i)
     {
         if (lines[i].Length == 0)
             continue;
         SPTCommand n = new SPTCommand(commands[0].Block);
         n.PushArg(commands[0].GetArg(0)); n.PushArg(commands[0].GetArg(1));
         n.PushArg(Font10Converter.ReplaceOut(lines[i]));
         ret.Add(n);
     }
     return ret;
 }
Exemple #5
0
        public override List <SPTCommand> GetEnglishCommands()
        {
            List <SPTCommand> ret = new List <SPTCommand>(commands.Capacity);

            string[] lines = EngText.Replace("\r\n", "\n").Split('\n');
            for (int i = 0; i < lines.Length; ++i)
            {
                if (lines[i].Length == 0)
                {
                    continue;
                }
                SPTCommand n = new SPTCommand(commands[0].Block);
                n.PushArg(commands[0].GetArg(0)); n.PushArg(commands[0].GetArg(1));
                n.PushArg(Font10Converter.ReplaceOut(lines[i]));
                ret.Add(n);
            }
            return(ret);
        }
        public override List <SPTCommand> GetEnglishCommands()
        {
            List <SPTCommand> ret = new List <SPTCommand>(1);
            SPTCommand        c   = new SPTCommand(commands[0].Block);

            for (int i = 0; i < commands[0].ArgCount; ++i)
            {
                int idx = commandArgs.IndexOf((GenericTArgOpts)i);
                if (idx >= 0 && engs[idx].Text.Length > 0)
                {
                    c.PushArg(Font10Converter.ReplaceOut(engs[idx].Text));
                }
                else
                {
                    c.PushArg(commands[0].GetArg(i));
                }
            }
            ret.Add(c);
            return(ret);
        }
 public override List<SPTCommand> GetEnglishCommands()
 {
     List<SPTCommand> ret = new List<SPTCommand>(1);
     SPTCommand c = new SPTCommand(commands[0].Block);
     for (int i = 0; i < commands[0].ArgCount; ++i)
     {
         int idx = commandArgs.IndexOf((GenericTArgOpts)i);
         if (idx >= 0 && engs[idx].Text.Length > 0)
             c.PushArg(Font10Converter.ReplaceOut(engs[idx].Text));
         else
             c.PushArg(commands[0].GetArg(i));
     }
     ret.Add(c);
     return ret;
 }