public ConsoleButtonString(EmueraConsole console, AConsoleDisplayPart[] strs) { this.parent = console; this.strArray = strs; IsButton = false; PointX = -1; Width = -1; ErrPos = null; }
public ConsoleButtonString(EmueraConsole console, ConsoleStyledString[] strs) { this.parent = console; this.strArray = strs; IsButton = false; PointX = -1; Width = -1; ErrPos = null; }
public ConsoleButtonString(EmueraConsole console, ConsoleStyledString[] strs, string inputs,ScriptPosition pos) : this(console, strs) { this.Inputs = inputs; IsButton = true; IsInteger = false; Generation = parent.NewButtonGeneration; console.UpdateGeneration(); ErrPos = pos; }
public ConsoleButtonString(EmueraConsole console, ConsoleStyledString[] strs, Int64 input) : this(console, strs) { this.Input = input; Inputs = input.ToString(); IsButton = true; IsInteger = true; Generation = parent.NewButtonGeneration; console.UpdateGeneration(); ErrPos = null; }
public ConsoleButtonString(EmueraConsole console, AConsoleDisplayPart[] strs, string inputs, ScriptPosition pos) : this(console, strs) { this.Inputs = inputs; IsButton = true; IsInteger = false; if (console != null) { Generation = parent.NewButtonGeneration; console.UpdateGeneration(); } ErrPos = pos; }
public static void Reset() { Process = null; ConstantData = null; GameBaseData = null; EMediator = null; VEvaluator = null; VariableData = null; Console = null; MainWindow = null; LabelDictionary = null; IdentifierDictionary = null; tempDic.Clear(); }
public ConsoleDisplayLine(EmueraConsole parentWindow, ConsoleButtonString[] buttons, bool isLogical, bool temporary) { parent = parentWindow; if (buttons == null) { buttons = new ConsoleButtonString[0]; return; } this.buttons = buttons; foreach (ConsoleButtonString button in buttons) button.ParentLine = this; IsLogicalLine = isLogical; IsTemporary = temporary; }
public ConsoleButtonString(EmueraConsole console, AConsoleDisplayPart[] strs, Int64 input, string inputs) : this(console, strs) { this.Input = input; this.Inputs = inputs; IsButton = true; IsInteger = true; if (console != null) { Generation = parent.NewButtonGeneration; console.UpdateGeneration(); } ErrPos = null; }
/// <summary> /// ここまでのcssをボタン化。発生原因はbrタグ、行末、ボタンタグ /// </summary> /// <param name="cssList"></param> /// <param name="isbutton"></param> /// <param name="state"></param> /// <param name="console"></param> /// <returns></returns> private static ConsoleButtonString cssToButton(List <AConsoleDisplayPart> cssList, HtmlAnalzeState state, EmueraConsole console) { var css = new AConsoleDisplayPart[cssList.Count]; cssList.CopyTo(css); cssList.Clear(); ConsoleButtonString ret = null; if (state.LastButtonTag != null && state.LastButtonTag.IsButton) { if (state.LastButtonTag.ButtonIsInteger) { ret = new ConsoleButtonString(console, css, state.LastButtonTag.ButtonValueInt, state.LastButtonTag.ButtonValueStr); } else { ret = new ConsoleButtonString(console, css, state.LastButtonTag.ButtonValueStr); } } else { ret = new ConsoleButtonString(console, css); ret.Title = null; } if (state.LastButtonTag != null) { ret.Title = state.LastButtonTag.ButtonTitle; if (state.LastButtonTag.PointXisLocked) { ret.LockPointX(state.LastButtonTag.PointX); } } return(ret); }
internal void SetParent(EmueraConsole console, Process process) { emuera = process; mainConsole = console; }
public static LogicalLine ParseLine(string str, EmueraConsole console) { ScriptPosition position = new ScriptPosition(str); StringStream stream = new StringStream(str); return ParseLine(stream, position, console); }
public Process(EmueraConsole view) { console = view; }
public void LoadData(string csvDir, EmueraConsole console, bool disp) { output = console; loadVariableSizeData(csvDir + "VariableSize.CSV", disp); for (int i = 0; i < countNameCsv; i++) { names[i] = new string[MaxDataList[i]]; nameToIntDics[i] = new Dictionary<string, int>(); } ItemPrice = new Int64[MaxDataList[itemIndex]]; loadDataTo(csvDir + "ABL.CSV", ablIndex, null, disp); loadDataTo(csvDir + "EXP.CSV", expIndex, null, disp); loadDataTo(csvDir + "TALENT.CSV", talentIndex, null, disp); loadDataTo(csvDir + "PALAM.CSV", paramIndex, null, disp); loadDataTo(csvDir + "TRAIN.CSV", trainIndex, null, disp); loadDataTo(csvDir + "MARK.CSV", markIndex, null, disp); loadDataTo(csvDir + "ITEM.CSV", itemIndex, ItemPrice, disp); loadDataTo(csvDir + "BASE.CSV", baseIndex, null, disp); loadDataTo(csvDir + "SOURCE.CSV", sourceIndex, null, disp); loadDataTo(csvDir + "EX.CSV", exIndex, null, disp); loadDataTo(csvDir + "STR.CSV", strIndex, null, disp); loadDataTo(csvDir + "EQUIP.CSV", equipIndex, null, disp); loadDataTo(csvDir + "TEQUIP.CSV", tequipIndex, null, disp); loadDataTo(csvDir + "FLAG.CSV", flagIndex, null, disp); loadDataTo(csvDir + "TFLAG.CSV", tflagIndex, null, disp); loadDataTo(csvDir + "CFLAG.CSV", cflagIndex, null, disp); loadDataTo(csvDir + "TCVAR.CSV", tcvarIndex, null, disp); loadDataTo(csvDir + "CSTR.CSV", cstrIndex, null, disp); loadDataTo(csvDir + "STAIN.CSV", stainIndex, null, disp); loadDataTo(csvDir + "CDFLAG1.CSV", cdflag1Index, null, disp); loadDataTo(csvDir + "CDFLAG2.CSV", cdflag2Index, null, disp); loadDataTo(csvDir + "STRNAME.CSV", strnameIndex, null, disp); loadDataTo(csvDir + "TSTR.CSV", tstrnameIndex, null, disp); loadDataTo(csvDir + "SAVESTR.CSV", savestrnameIndex, null, disp); loadDataTo(csvDir + "GLOBAL.CSV", globalIndex, null, disp); loadDataTo(csvDir + "GLOBALS.CSV", globalsIndex, null, disp); //逆引き辞書を作成 for (int i = 0; i < names.Length; i++) { if (i == 10)//Strは逆引き無用 continue; string[] nameArray = names[i]; for (int j = 0; j < nameArray.Length; j++) { if (!string.IsNullOrEmpty(nameArray[j]) && !nameToIntDics[i].ContainsKey(nameArray[j])) nameToIntDics[i].Add(nameArray[j], j); } } //if (!Program.AnalysisMode) loadCharacterData(csvDir, disp); //逆引き辞書を作成2 (RELATION) for (int i = 0; i < CharacterTmplList.Count; i++) { CharacterTemplate tmpl = CharacterTmplList[i]; if (!string.IsNullOrEmpty(tmpl.Name) && !relationDic.ContainsKey(tmpl.Name)) relationDic.Add(tmpl.Name, (int)tmpl.No); if (!string.IsNullOrEmpty(tmpl.Callname) && !relationDic.ContainsKey(tmpl.Callname)) relationDic.Add(tmpl.Callname, (int)tmpl.No); if (!string.IsNullOrEmpty(tmpl.Nickname) && !relationDic.ContainsKey(tmpl.Nickname)) relationDic.Add(tmpl.Nickname, (int)tmpl.No); } }
public static void Initialize(EmueraConsole console) { ParserMediator.console = console; }
public MainWindow() { InitializeComponent(); SavePicBox.picBox = pictureBox1; pictureBox1.DoubleClick += new EventHandler(pictureBox1_DoubleClick); if (Config.SetWindowPos) { this.StartPosition = FormStartPosition.Manual; this.Location = new Point(Config.WindowPosX, Config.WindowPosY); } if (Program.DebugMode) デバッグToolStripMenuItem.Visible = true; ((EraPictureBox)mainPicBox).SetStyle(); this.ResizeEnd += new EventHandler(MainWindow_ResizeEnd); this.Resize += new EventHandler(MainWindow_Resize); lastState = WindowState; int winX = Program.ClientX; Program.ClientX = 0; if (winX == 0) winX = Config.WindowX; winY = Program.ClientY; Program.ClientY = 0; if (winY == 0) winY = Config.WindowY; if (Config.SizableWindow) this.FormBorderStyle = FormBorderStyle.Sizable; else this.FormBorderStyle = FormBorderStyle.Fixed3D; setWindowSize(Config.WindowX, winY); int minimamY = 100; if (minimamY > this.Height) minimamY = this.Height; int maximamY = 2560; if (maximamY < this.Height) maximamY = this.Height; this.MinimumSize = new Size(this.Width, minimamY); this.MaximumSize = new Size(this.Width, maximamY); richTextBox1.ForeColor = Config.ForeColor; richTextBox1.BackColor = Config.BackColor; mainPicBox.BackColor = Config.BackColor; this.BackColor = Config.BackColor; richTextBox1.Font = Config.Font; richTextBox1.LanguageOption = RichTextBoxLanguageOptions.UIFonts; this.MaximizeBox = Config.SizableWindow; if (Config.SizableWindow && Config.WindowMaximixed) this.WindowState = FormWindowState.Maximized; if (Program.state != FormWindowState.Normal) { WindowState = Program.state; Program.state = FormWindowState.Normal; } folderSelectDialog.SelectedPath = Program.ErbDir; folderSelectDialog.ShowNewFolderButton = false; openFileDialog.InitialDirectory = Program.ErbDir; openFileDialog.Filter = "ERBファイル (*.erb)|*.erb"; openFileDialog.FileName = ""; openFileDialog.Multiselect = true; openFileDialog.RestoreDirectory = true; timer.Enabled = true; console = new EmueraConsole(this); macroMenuItems[0] = マクロ01ToolStripMenuItem; macroMenuItems[1] = マクロ02ToolStripMenuItem; macroMenuItems[2] = マクロ03ToolStripMenuItem; macroMenuItems[3] = マクロ04ToolStripMenuItem; macroMenuItems[4] = マクロ05ToolStripMenuItem; macroMenuItems[5] = マクロ06ToolStripMenuItem; macroMenuItems[6] = マクロ07ToolStripMenuItem; macroMenuItems[7] = マクロ08ToolStripMenuItem; macroMenuItems[8] = マクロ09ToolStripMenuItem; macroMenuItems[9] = マクロ10ToolStripMenuItem; macroMenuItems[10] = マクロ11ToolStripMenuItem; macroMenuItems[11] = マクロ12ToolStripMenuItem; foreach (ToolStripMenuItem item in macroMenuItems) item.Click += new EventHandler(マクロToolStripMenuItem_Click); }
public ProcessState(EmueraConsole console) { if (Program.DebugMode)//DebugModeでなければ知らなくて良い this.console = console; }
public ExpressionMediator(Process proc, VariableEvaluator vev, EmueraConsole console) { VEvaluator = vev; Process = proc; Console = console; }
public static LogicalLine ParseLine(StringStream stream, ScriptPosition position, EmueraConsole console) { int lineNo = position.LineNo; string errMes = ""; LexicalAnalyzer.SkipWhiteSpace(stream);//先頭のホワイトスペースを読み飛ばす if (stream.EOS) return null; //コメント行かどうかはここに来る前に判定しておく try { #region 前置インクリメント、デクリメント行 if (stream.Current == '+' || stream.Current == '-') { char op = stream.Current; WordCollection wc = LexicalAnalyzer.Analyse(stream, LexEndWith.EoL, false, false); OperatorWord opWT = wc.Current as OperatorWord; if ((opWT == null)|| ((opWT.Code != OperatorCode.Increment) &&(opWT.Code != OperatorCode.Decrement)) ) { if (op == '+') errMes = "行が\'+\'から始まっていますが、インクリメントではありません"; else errMes = "行が\'-\'から始まっていますが、デクリメントではありません"; goto err; } wc.ShiftNext(); //token = EpressionParser.単語一個分取得(wc) //token非変数 //token文字列形 //token変更不可能 //if (wc != EOS) // return new InstructionLine(position, FunctionIdentifier.SETFunction, opWT.Code, wc, null); } #endregion IdentifierWord idWT = LexicalAnalyzer.ReadFirstIdentifierWord(stream); if (idWT != null) { FunctionIdentifier func = GlobalStatic.IdentifierDictionary.GetFunctionIdentifier(idWT.Code); //命令文 if (func != null)//関数文 { if (stream.EOS) //引数の無い関数 return new InstructionLine(position, func, stream); if ((stream.Current != ' ') && (stream.Current != '\t') && (!Config.SystemAllowFullSpace || (stream.Current != ' '))) { errMes = "命令で行が始まっていますが、命令の直後に半角スペース・タブ以外の文字が来ています"; goto err; } stream.ShiftNext(); return new InstructionLine(position, func, stream); } } LexicalAnalyzer.SkipWhiteSpace(stream); if (stream.EOS) { errMes = "解釈できない行です"; goto err; } //命令行ではない→代入行のはず stream.Seek(0, System.IO.SeekOrigin.Begin); OperatorCode assignOP = OperatorCode.NULL; WordCollection wc1 = LexicalAnalyzer.Analyse(stream, LexEndWith.Operator, false, false); //if (idWT != null) // wc1.Collection.Insert(0, idWT); try { assignOP = LexicalAnalyzer.ReadAssignmentOperator(stream); } catch(CodeEE) { errMes = "解釈できない行です"; goto err; } //eramaker互換警告 //stream.Jump(-1); //if ((stream.Current != ' ') && (stream.Current != '\t')) //{ // errMes = "変数で行が始まっていますが、演算子の直前に半角スペースまたはタブがありません"; // goto err; //} //stream.ShiftNext(); if (assignOP == OperatorCode.Equal) { if (console != null) ParserMediator.Warn("代入演算子に\"==\"が使われています", position, 0); //"=="を代入文に使うのは本当はおかしいが結構使われているので仕様にする assignOP = OperatorCode.Assignment; } return new InstructionLine(position, FunctionIdentifier.SETFunction, assignOP, wc1, stream); err: return new InvalidLine(position, errMes); } catch (CodeEE e) { System.Media.SystemSounds.Hand.Play(); return new InvalidLine(position, e.Message); } }
public static LogicalLine ParseLabelLine(StringStream stream, ScriptPosition position, EmueraConsole console) { bool isFunction = (stream.Current == '@'); int lineNo = position.LineNo; string labelName = ""; string errMes = ""; try { int warnLevel = -1; stream.ShiftNext();//@か$を除去 WordCollection wc = LexicalAnalyzer.Analyse(stream, LexEndWith.EoL, false, true); if (wc.EOL || !(wc.Current is IdentifierWord)) { errMes = "関数名が不正であるか存在しません"; goto err; } labelName = ((IdentifierWord)wc.Current).Code; wc.ShiftNext(); if (Config.ICVariable) labelName = labelName.ToUpper(); GlobalStatic.IdentifierDictionary.CheckUserLabelName(ref errMes, ref warnLevel, isFunction, labelName); if (warnLevel >= 0) { if (warnLevel >= 2) goto err; ParserMediator.Warn(errMes, position, warnLevel); } if (!isFunction)//$ならこの時点で終了 { if (!wc.EOL) ParserMediator.Warn("$で始まるラベルに引数が設定されています", position, 1); return new GotoLabelLine(position, labelName); } //labelName = LexicalAnalyzer.ReadString(stream, StrEndWith.LeftParenthesis_Bracket_Comma_Semicolon); //labelName = labelName.Trim(); //if (Config.ICVariable) // labelName = labelName.ToUpper(); //GlobalStatic.IdentifierDictionary.CheckUserLabelName(ref errMes, ref warnLevel, isFunction, labelName); //if(warnLevel >= 0) //{ // if (warnLevel >= 2) // goto err; // ParserMediator.Warn(errMes, position, warnLevel); //} //if (!isFunction)//$ならこの時点で終了 //{ // LexicalAnalyzer.SkipWhiteSpace(stream); // if (!stream.EOS) // ParserMediator.Warn("$で始まるラベルに引数が設定されています", position, 1); // return new GotoLabelLine(position, labelName); //} ////関数名部分に_renameを使えないように変更 //if (ParserMediator.RenameDic != null && ((stream.ToString().IndexOf("[[") >= 0) && (stream.ToString().IndexOf("]]") >= 0))) //{ // string line = stream.ToString(); // foreach (KeyValuePair<string, string> pair in ParserMediator.RenameDic) // line = line.Replace(pair.Key, pair.Value); // stream = new StringStream(line); //} //WordCollection wc = null; //wc = LexicalAnalyzer.Analyse(stream, LexEndWith.EoL, false, true); if (Program.AnalysisMode) console.PrintC("@" + labelName, false); FunctionLabelLine funclabelLine = new FunctionLabelLine(position, labelName, wc); if (IdentifierDictionary.IsEventLabelName(labelName)) { funclabelLine.IsEvent = true; funclabelLine.IsSystem = true; funclabelLine.Depth = 0; } else if (IdentifierDictionary.IsSystemLabelName(labelName)) { funclabelLine.IsSystem = true; funclabelLine.Depth = 0; } return funclabelLine; } catch (CodeEE e) { errMes = e.Message; } err: System.Media.SystemSounds.Hand.Play(); if (isFunction) { if(labelName.Length == 0) labelName = "<Error>"; return new InvalidLabelLine(position, labelName, errMes); } return new InvalidLine(position, errMes); }
public HeaderFileLoader(EmueraConsole main, IdentifierDictionary idDic, Process proc) { output = main; parentProcess = proc; this.idDic = idDic; }
public ErbLoader(EmueraConsole main, ExpressionMediator exm, Process proc) { output = main; parentProcess = proc; this.exm = exm; }
public void Setup(MainWindow mainWindow, EmueraConsole console) { StringBuilder builder = new StringBuilder(); console.GetDisplayStrings(builder); textBox1.Text = builder.ToString(); }
/// <summary> /// htmlから表示行の作成 /// </summary> /// <param name="str">htmlテキスト</param> /// <param name="sm"></param> /// <param name="console">実際の表示に使わないならnullにする</param> /// <returns></returns> public static ConsoleDisplayLine[] Html2DisplayLine(string str, StringMeasure sm, EmueraConsole console) { List <AConsoleDisplayPart> cssList = new List <AConsoleDisplayPart>(); List <ConsoleButtonString> buttonList = new List <ConsoleButtonString>(); StringStream st = new StringStream(str); int found; bool hasComment = str.IndexOf("<!--") >= 0; bool hasReturn = str.IndexOf('\n') >= 0; HtmlAnalzeState state = new HtmlAnalzeState(); while (!st.EOS) { found = st.Find('<'); if (hasReturn) { int rFound = st.Find('\n'); if (rFound >= 0 && (found > rFound || found < 0)) { found = rFound; } } if (found < 0) { string txt = Unescape(st.Substring()); cssList.Add(new ConsoleStyledString(txt, state.GetSS())); if (state.FlagPClosed) { throw new CodeEE("</p>の後にテキストがあります"); } if (state.FlagNobrClosed) { throw new CodeEE("</nobr>の後にテキストがあります"); } break; } else if (found > 0) { string txt = Unescape(st.Substring(st.CurrentPosition, found)); cssList.Add(new ConsoleStyledString(txt, state.GetSS())); state.LineHead = false; st.CurrentPosition += found; } //コメントタグのみ特別扱い if (hasComment && st.CurrentEqualTo("<!--")) { st.CurrentPosition += 4; found = st.Find("-->"); if (found < 0) { throw new CodeEE("コメンdト終了タグ\"-->\"がみつかりません"); } st.CurrentPosition += found + 3; continue; } if (hasReturn && st.Current == '\n') //テキスト中の\nは<br>として扱う { state.FlagBr = true; st.ShiftNext(); } else //タグ解析 { st.ShiftNext(); AConsoleDisplayPart part = tagAnalyze(state, st); if (st.Current != '>') { throw new CodeEE("タグ終端'>'が見つかりません"); } if (part != null) { cssList.Add(part); } st.ShiftNext(); } if (state.FlagBr) { state.LastButtonTag = state.CurrentButtonTag; if (cssList.Count > 0) { buttonList.Add(cssToButton(cssList, state, console)); } buttonList.Add(null); } if (state.FlagButton && cssList.Count > 0) { buttonList.Add(cssToButton(cssList, state, console)); } state.FlagBr = false; state.FlagButton = false; state.LastButtonTag = state.CurrentButtonTag; } //</nobr></p>は省略許可 if (state.CurrentButtonTag != null || state.FontStyle != FontStyle.Regular || state.FonttagList.Count > 0) { throw new CodeEE("閉じられていないタグがあります"); } if (cssList.Count > 0) { buttonList.Add(cssToButton(cssList, state, console)); } foreach (ConsoleButtonString button in buttonList) { if (button != null && button.PointXisLocked) { if (!state.FlagNobr) { throw new CodeEE("<nobr>が設定されていない行ではpos属性は使用できません"); } if (state.Alignment != DisplayLineAlignment.LEFT) { throw new CodeEE("alignがleftでない行ではpos属性は使用できません"); } break; } } ConsoleDisplayLine[] ret = PrintStringBuffer.ButtonsToDisplayLines(buttonList, sm, state.FlagNobr, false); foreach (ConsoleDisplayLine dl in ret) { dl.SetAlignment(state.Alignment); } return(ret); }
public void CUpdateInUpcheck(EmueraConsole window, Int64 target, bool skipPrint) { Int64[] up, down, param; string[] paramname = constant.GetCsvNameList(VariableCode.PALAMNAME); if ((target < 0) || (target >= varData.CharacterList.Count)) return; CharacterData chara = varData.CharacterList[(int)target]; up = chara.DataIntegerArray[(int)(VariableCode.CUP & VariableCode.__LOWERCASE__)]; down = chara.DataIntegerArray[(int)(VariableCode.CDOWN & VariableCode.__LOWERCASE__)]; param = chara.DataIntegerArray[(int)(VariableCode.PALAM & VariableCode.__LOWERCASE__)]; int length = param.Length; if (param.Length > up.Length) length = up.Length; if (param.Length > down.Length) length = down.Length; for (int i = 0; i < length; i++) { //本家の仕様では負の値は無効。 if ((up[i] <= 0) && (down[i] <= 0)) continue; StringBuilder builder = new StringBuilder(); if (!skipPrint) { builder.Append(paramname[i]); builder.Append(' '); builder.Append(param[i].ToString()); if (up[i] > 0) { builder.Append('+'); builder.Append(up[i].ToString()); } if (down[i] > 0) { builder.Append('-'); builder.Append(down[i].ToString()); } } unchecked { param[i] += up[i] - down[i]; } if (!skipPrint) { builder.Append('='); builder.Append(param[i].ToString()); window.Print(builder.ToString()); window.NewLine(); } } for (int i = 0; i < up.Length; i++) up[i] = 0; for (int i = 0; i < down.Length; i++) down[i] = 0; }
public PrintStringBuffer(EmueraConsole parent) { this.parent = parent; }
public PrintStringBuffer(EmueraConsole parent) { this.parent = parent; makeButtonWrap = Config.ButtonWrap; }