private InstructionLine CreateText(int step, Item item, RectTransform page) { InstructionLine instructionLine = Instantiate <InstructionLine>(instructionPrefab, page); instructionLine.image.sprite = ItemImageMapper.Instance.Map(item); instructionLine.text.text = "<b>" + (step + 1) + ". </b>" + itemToInstructionTextMap[item]; instructionLine.gameObject.SetActive(true); return(instructionLine); }
public void DoDebugNormalFunction(InstructionLine func, bool munchkin) { if (func.Function.Instruction != null) func.Function.Instruction.DoInstruction(exm, func, state); else doNormalFunction(func); if (munchkin) vEvaluator.IamaMunchkin(); }
public static bool SetArgumentTo(InstructionLine line) { if (line == null) { return(false); } if (line.Argument != null) { return(true); } if (line.IsError) { return(false); } if (!Program.DebugMode && line.Function.IsDebug()) { //非DebugモードでのDebug系命令。何もしないので引数解析も不要 line.Argument = null; return(true); } Argument arg = null; string errmes = null; try { arg = line.Function.ArgBuilder.CreateArgument(line, GlobalStatic.EMediator); } catch (EmueraException e) { errmes = e.Message; goto error; } if (arg == null) { if (!line.IsError) { errmes = "命令の引数解析中に特定できないエラーが発生"; goto error; } return(false); } line.Argument = arg; if (arg == null) { line.IsError = true; } return(true); error: //SystemSounds.Hand.Play(); uEmuera.Media.SystemSounds.Hand.Play(); line.IsError = true; line.ErrMes = errmes; ParserMediator.Warn(errmes, line, 2, true, false); return(false); }
protected void assignwarn(string mes, InstructionLine line, int level, bool isBackComp) { bool isError = level >= 2; if (isError) { line.IsError = true; line.ErrMes = mes; } ParserMediator.Warn(mes, line, level, isError, isBackComp); }
public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { ExpressionArrayArgument intExpArg = (ExpressionArrayArgument)func.Argument; Int64 integer = -1; foreach (IOperandTerm int64Term in intExpArg.TermList) { integer = int64Term.GetIntValue(exm); if(isDel) exm.VEvaluator.DelCharacter(integer); else exm.VEvaluator.AddCharacter(integer, isSp); } }
protected bool checkArgumentType(InstructionLine line, ExpressionMediator exm, IOperandTerm[] arguments) { if (arguments == null) { warn("引数がありません", line, 2, false); return false; } if ( arguments.Length < minArg || ((arguments.Length < argumentTypeArray.Length) && (minArg < 0)) ) { warn("引数が足りません", line, 2, false); return false; } int length = arguments.Length; if ((arguments.Length > argumentTypeArray.Length)&&(!argAny)) { warn("引数が多すぎます", line, 1, false); length = argumentTypeArray.Length; } for (int i = 0; i < length; i++) { Type allowType; if ((!argAny) && (argumentTypeArray[i] == null)) continue; else if (argAny && i >= argumentTypeArray.Length) allowType = argumentTypeArray[argumentTypeArray.Length - 1]; else allowType = argumentTypeArray[i]; if (arguments[i] == null) { if (allowType == null) continue; warn("第" + (i + 1).ToString() + "引数を認識できません", line, 2, false); return false; } if ((allowType != typeof(void)) && (allowType != arguments[i].GetOperandType())) { warn("第" + (i + 1).ToString() + "引数の型が正しくありません", line, 2, false); return false; } } length = arguments.Length; for (int i = 0; i < length; i++) { if (arguments[i] == null) continue; arguments[i] = arguments[i].Restructure(exm); } return true; }
public static bool SetArgumentTo(InstructionLine line) { if (line == null) return false; if (line.Argument != null) return true; if (line.IsError) return false; if (!Program.DebugMode && line.Function.IsDebug()) {//非DebugモードでのDebug系命令。何もしないので引数解析も不要 line.Argument = null; return true; } Argument arg = null; string errmes = null; try { arg = line.Function.ArgBuilder.CreateArgument(line, GlobalStatic.EMediator); } catch (CodeEE e) { errmes = e.Message; goto error; } if (arg == null) { if (!line.IsError) { errmes = "命令の引数解析中に特定できないエラーが発生"; goto error; } return false; } line.Argument = arg; if (arg == null) line.IsError = true; return true; error: System.Media.SystemSounds.Hand.Play(); line.IsError = true; line.ErrMes = errmes; ParserMediator.Warn(errmes, line, 2, true, false); return false; }
private InstructionLine GetInstructionLine(string instructionLineString) { InstructionLine instructionLine; try { var kvp = InstructionLineTypes.First(x => instructionLineString.StartsWith(x.Key)); var parameters = instructionLineString.Substring(kvp.Key.Length); instructionLine = new InstructionLine(instructionLineString, kvp.Key, parameters, kvp.Value); } catch (Exception e) { throw new Exception($"Instruction not recognized: {instructionLineString}", e); } return(instructionLine); }
public void Fill(House house) { Clear(); image.sprite = house.image; List <Item> items = house.GetItemList(); bool useSecondPage = items.Count > 8; int i = 0; foreach (Item item in items) { int half = items.Count / 2; RectTransform page = useSecondPage && i > half ? InstructionsPage2 : InstructionsPage1; InstructionLine line = CreateText(i, item, page); i++; } }
private void OpenButton_Click(object sender, RoutedEventArgs e) { Microsoft.Win32.OpenFileDialog newDialog = new Microsoft.Win32.OpenFileDialog(); newDialog.ShowDialog(); FileLocation = newDialog.FileName; int i = 1; foreach (var Line in File.ReadAllLines(FileLocation)) { InstructionLine.AppendText(i.ToString()); InstructionLine.AppendText(Environment.NewLine); // InstructionLine.AppendText(Environment.NewLine); AssemblyTextBox.AppendText(Line); AssemblyTextBox.AppendText(Environment.NewLine); // AssemblyTextBox.AppendText(Environment.NewLine); i++; } }
public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { }
public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { SpVarSetArgument spvarsetarg = (SpVarSetArgument)func.Argument; VariableTerm var = spvarsetarg.VariableDest; FixedVariableTerm p = var.GetFixedVariableTerm(exm); int start = 0; int end = 0; //endを先に取って判定の処理変更 if (spvarsetarg.End != null) end = (int)spvarsetarg.End.GetIntValue(exm); else if (var.Identifier.IsArray1D) end = (int)var.GetLength(); if (spvarsetarg.Start != null) { start = (int)spvarsetarg.Start.GetIntValue(exm); if (start > end) { int temp = start; start = end; end = start; } } if (var.IsString) { string src = spvarsetarg.Term.GetStrValue(exm); exm.VEvaluator.SetValueAll(p, src, start, end); } else { long src = spvarsetarg.Term.GetIntValue(exm); exm.VEvaluator.SetValueAll(p, src, start, end); } }
public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { //if (iFuncCode == FunctionCode.ELSE || iFuncCode == FunctionCode.ELSEIF // || iFuncCode == FunctionCode.CASE || iFuncCode == FunctionCode.CASEELSE) //チェック済み //if (func.JumpTo == null) // throw new ExeEE(func.Function.Name + "のジャンプ先が設定されていない"); state.JumpTo(func.JumpTo); }
public override void SetJumpTo(ref bool useCallForm, InstructionLine func, int currentDepth, ref string FunctionoNotFoundName) { if (!func.Argument.IsConst) { useCallForm = true; return; } SpCallFArgment callfArg = (SpCallFArgment)func.Argument; if (Config.ICFunction) callfArg.ConstStr = callfArg.ConstStr.ToUpper(); string labelName = callfArg.ConstStr; FunctionLabelLine targetLabel = GlobalStatic.LabelDictionary.GetNonEventLabel(labelName); if (targetLabel == null) { if (!Program.AnalysisMode) ParserMediator.Warn("指定された関数名\"@" + labelName + "\"は存在しません", func, 2, true, false); else ParserMediator.Warn(labelName, func, 2, true, false); return; } if (targetLabel.Depth < 0) targetLabel.Depth = currentDepth + 1; if (!targetLabel.IsMethod) { ParserMediator.Warn("#FUNCTIONが指定されていない関数\"@" + labelName + "\"をCALLF系命令で呼び出そうとしました", func, 2, true, false); return; } CalledFunction call = CalledFunction.CreateCalledFunctionMethod(targetLabel, targetLabel.LabelName); string errMes; callfArg.FuncTerm = UserDefinedMethodTerm.Create(callfArg.RowArgs, call, out errMes); if (callfArg.FuncTerm == null) ParserMediator.Warn(errMes, targetLabel, 2, true, false); else callfArg.FuncTerm.Restructure(GlobalStatic.EMediator); }
public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { Int64 target; if (func.Argument.IsConst) target = func.Argument.ConstInt; else target = ((ExpressionArgument)func.Argument).Term.GetIntValue(exm); int target32 = FunctionIdentifier.toUInt32inArg(target, "DELDATA", 1); exm.VEvaluator.DelData(target32); }
public override void SetJumpTo(ref bool useCallForm, InstructionLine func, int currentDepth, ref string FunctionoNotFoundName) { GotoLabelLine jumpto = null; func.JumpTo = null; if (func.Argument.IsConst) { string labelName = func.Argument.ConstStr; if (Config.ICVariable)//eramakerではGOTO文は大文字小文字を区別しない labelName = labelName.ToUpper(); jumpto = GlobalStatic.LabelDictionary.GetLabelDollar(labelName, func.ParentLabelLine); if ((jumpto == null) && (!func.Function.IsTry())) ParserMediator.Warn("指定されたラベル名\"$" + labelName + "\"は現在の関数内に存在しません", func, 2, true, false); else if (jumpto.IsError) ParserMediator.Warn("指定されたラベル名\"$" + labelName + "\"は無効な$ラベル行です", func, 2, true, false); else if (jumpto != null) { func.JumpTo = jumpto; } } }
public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { if (isForce) exm.Console.ReadAnyKeyForce(); else exm.Console.ReadAnyKey(); }
public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { ExpressionArgument intExpArg = (ExpressionArgument)func.Argument; Int32 delNum = (Int32)intExpArg.Term.GetIntValue(exm); exm.Console.deleteLine(delNum); exm.Console.RefreshStrings(false); }
public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { exm.VEvaluator.InitRanddata(); }
public override void SetJumpTo(ref bool useCallForm, InstructionLine func, int currentDepth, ref string FunctionoNotFoundName) { if (!func.Argument.IsConst) { useCallForm = true; return; } SpCallArgment callArg = (SpCallArgment)func.Argument; string labelName = callArg.ConstStr; if (Config.ICFunction) labelName = labelName.ToUpper(); CalledFunction call = CalledFunction.CallFunction(GlobalStatic.Process, labelName, func); if ((call == null) && (!func.Function.IsTry())) { FunctionoNotFoundName = labelName; return; } if (call != null) { func.JumpTo = call.TopLabel; if (call.TopLabel.Depth < 0) call.TopLabel.Depth = currentDepth + 1; if (call.TopLabel.IsError) { func.IsError = true; func.ErrMes = call.TopLabel.ErrMes; return; } string errMes; callArg.UDFArgument = call.ConvertArg(callArg.RowArgs, out errMes); if (callArg.UDFArgument == null) { ParserMediator.Warn(errMes, func, 2, true, false); return; } } callArg.CallFunc = call; }
public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { //if (sequential)//上から流れてきたなら何もしないでENDCATCHに飛ぶ state.JumpTo(func.JumpToEndCatch); }
public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { SpCallArgment spCallArg = (SpCallArgment)func.Argument; CalledFunction call = null; string labelName = null; UserDefinedFunctionArgument arg = null; if (spCallArg.IsConst) { call = spCallArg.CallFunc; labelName = spCallArg.ConstStr; arg = spCallArg.UDFArgument; } else { labelName = spCallArg.FuncnameTerm.GetStrValue(exm); if (Config.ICFunction) labelName = labelName.ToUpper(); call = CalledFunction.CallFunction(GlobalStatic.Process, labelName, func); } if (call == null) { if (!isTry) throw new CodeEE("関数\"@" + labelName + "\"が見つかりません"); if (func.JumpToEndCatch != null) state.JumpTo(func.JumpToEndCatch); return; } call.IsJump = isJump; if (arg == null) { string errMes; arg = call.ConvertArg(spCallArg.RowArgs, out errMes); if (arg == null) throw new CodeEE(errMes); } state.IntoFunction(call, arg, exm); }
public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { ExpressionArgument expArg = (ExpressionArgument)func.Argument; if (expArg.Term.GetIntValue(exm) != 0)//式が真 return;//そのまま中の処理へ state.JumpTo(func.JumpTo); }
public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { InstructionLine jumpTo = (InstructionLine)func.JumpTo; if (((ExpressionArgument)jumpTo.Argument).Term.GetIntValue(exm) != 0) state.JumpTo(func.JumpTo); }
public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { exm.Console.SetStringStyle(FontStyle.Regular); }
public virtual Argument CreateArgument(InstructionLine line, ExpressionMediator exm) { throw new ExeEE("実装されていない"); }
public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { string label = null; LogicalLine jumpto = null; if (func.Argument.IsConst) { label = func.Argument.ConstStr; jumpto = func.JumpTo; } else { label = ((SpCallArgment)func.Argument).FuncnameTerm.GetStrValue(exm); if (Config.ICVariable) label = label.ToUpper(); jumpto = state.CurrentCalled.CallLabel(GlobalStatic.Process, label); } if (jumpto == null) { if (!func.Function.IsTry()) throw new CodeEE("指定されたラベル名\"$" + label + "\"は現在の関数内に存在しません"); if (func.JumpToEndCatch != null) state.JumpTo(func.JumpToEndCatch); return; } else if (jumpto.IsError) throw new CodeEE("指定されたラベル名\"$" + label + "\"は無効な$ラベル行です"); state.JumpTo(jumpto); }
public virtual void SetJumpTo(ref bool useCallForm, InstructionLine func, int currentDepth, ref string FunctionoNotFoundName) { }
public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { LogicalLine ifJumpto = func.JumpTo;//ENDIF //チェック済み //if (func.IfCaseList == null) // throw new ExeEE("IFのIF-ELSEIFリストが適正に作成されていない"); //if (func.JumpTo == null) // throw new ExeEE("IFに対応するENDIFが設定されていない"); InstructionLine line = null; for (int i = 0; i < func.IfCaseList.Count; i++) { line = func.IfCaseList[i]; if (line.IsError) continue; if (line.FunctionCode == FunctionCode.ELSE) { ifJumpto = line; break; } //ExpressionArgument expArg = (ExpressionArgument)(line.Argument); //チェック済み //if (expArg == null) // throw new ExeEE("IFチェック中。引数が解析されていない。", func.IfCaseList[i].Position); //1730 ELSEIFが出したエラーがIFのエラーとして検出されていた state.CurrentLine = line; Int64 value = ((ExpressionArgument)(line.Argument)).Term.GetIntValue(exm); if (value != 0)//式が真 { ifJumpto = line; break; } } if (ifJumpto != func)//自分自身がジャンプ先ならそのまま state.JumpTo(ifJumpto); //state.RunningLine = null; }
public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { exm.Console.ReadAnyKeyAndGo(); }
public static InstructionLine CreateInstructionLine(string instruction) { InstructionLine line = new InstructionLine(instruction); return(line); }
public virtual void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { throw new ExeEE("未実装 or 呼び出しミス"); }
public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { string str = null; if (func.Argument.IsConst) str = func.Argument.ConstStr; else str = ((ExpressionArgument)func.Argument).Term.GetStrValue(exm); exm.Console.DebugPrint(str); if (func.Function.IsNewLine()) exm.Console.DebugNewLine(); }
public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { InstructionLine jumpTo = (InstructionLine)func.JumpTo; if ((jumpTo.FunctionCode == FunctionCode.REPEAT) || (jumpTo.FunctionCode == FunctionCode.FOR)) { //ループ変数が不明(REPEAT、FORを経由せずにループしようとした場合は無視してループを抜ける(eramakerがこういう仕様だったりする)) if (jumpTo.LoopCounter == null) { state.JumpTo(jumpTo.JumpTo); return; } unchecked { jumpTo.LoopCounter.PlusValue(jumpTo.LoopStep, exm); } Int64 counter = jumpTo.LoopCounter.GetIntValue(exm); //まだ回数が残っているなら、 if (((jumpTo.LoopStep > 0) && (jumpTo.LoopEnd > counter)) || ((jumpTo.LoopStep < 0) && (jumpTo.LoopEnd < counter))) state.JumpTo(func.JumpTo); else state.JumpTo(jumpTo.JumpTo); return; } if (jumpTo.FunctionCode == FunctionCode.WHILE) { if (((ExpressionArgument)jumpTo.Argument).Term.GetIntValue(exm) != 0) state.JumpTo(func.JumpTo); else state.JumpTo(jumpTo.JumpTo); return; } if (jumpTo.FunctionCode == FunctionCode.DO) { //こいつだけはCONTINUEよりも後ろに判定行があるため、判定行にエラーがあった場合に問題がある InstructionLine tFunc = (InstructionLine)((InstructionLine)func.JumpTo).JumpTo;//LOOP if (tFunc.IsError) throw new CodeEE(tFunc.ErrMes, tFunc.Position); ExpressionArgument expArg = (ExpressionArgument)tFunc.Argument; if (expArg.Term.GetIntValue(exm) != 0)//式が真 state.JumpTo(jumpTo);//DO else state.JumpTo(tFunc);//LOOP return; } throw new ExeEE("異常なCONTINUE"); }
public static InstructionLine GenerateInstructionline(DialogueInstruction instruction) { InstructionLine line = new InstructionLine(instruction); return(line); }
public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { SpSwapCharaArgument arg = (SpSwapCharaArgument)func.Argument; long x = arg.X.GetIntValue(exm); long y = arg.Y.GetIntValue(exm); exm.VEvaluator.CopyChara(x, y); }
public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { SpCVarSetArgument spvarsetarg = (SpCVarSetArgument)func.Argument; FixedVariableTerm p = spvarsetarg.VariableDest.GetFixedVariableTerm(exm); SingleTerm index = spvarsetarg.Index.GetValue(exm); int charaNum = (int)exm.VEvaluator.CHARANUM; int start = 0; if (spvarsetarg.Start != null) { start = (int)spvarsetarg.Start.GetIntValue(exm); if (start < 0 || start >= charaNum) throw new CodeEE("命令CVARSETの第4引数(" + start.ToString() + ")がキャラクタの範囲外です"); } int end = 0; if (spvarsetarg.End != null) { end = (int)spvarsetarg.End.GetIntValue(exm); if (end < 0 || end > charaNum) throw new CodeEE("命令CVARSETの第5引数(" + end.ToString() + ")がキャラクタの範囲外です"); } else end = charaNum; if (start > end) { int temp = start; start = end; end = start; } if (!p.Identifier.IsCharacterData) throw new CodeEE("命令CVARSETにキャラクタ変数でない変数" + p.Identifier.Name + "が渡されました"); if (index.GetOperandType() == typeof(string) && p.Identifier.IsArray1D) { if (!GlobalStatic.ConstantData.isDefined(p.Identifier.Code, index.Str)) throw new CodeEE("文字列" + index.Str + "は配列変数" + p.Identifier.Name + "の要素ではありません"); } if (p.Identifier.IsString) { string src = spvarsetarg.Term.GetStrValue(exm); exm.VEvaluator.SetValueAllEachChara(p, index, src, start, end); } else { long src = spvarsetarg.Term.GetIntValue(exm); exm.VEvaluator.SetValueAllEachChara(p, index, src, start, end); } }