public static int GetArgumentTypeLength(LogicArgumentType argument) { int length = 1; switch (argument) { case LogicArgumentType.Number: length = 1; break; case LogicArgumentType.Variable: length = 1; break; case LogicArgumentType.Flag: length = 1; break; case LogicArgumentType.Message: length = 1; break; case LogicArgumentType.ScreenObject: length = 1; break; case LogicArgumentType.InventoryObject: length = 1; break; case LogicArgumentType.String: length = 1; break; case LogicArgumentType.Word: length = 2; break; case LogicArgumentType.Control: length = 1; break; } return(length); }
private void TraceParameters(LogicCommand command, int operatorIndex, bool said) { int parameterCount = command.ParameterCount; this.WindowManager.PushTextPosition(); if (said) { parameterCount = this.LogicInterpreter.CurrentLogic.GetCode(operatorIndex++); } this.WindowManager.DisplayCharacter(UserInterface.TraceParameterStart[0]); for (int param = 0; param < parameterCount; param++) { int val = this.GetTraceParameterValue(operatorIndex, param, said); if (said) { this.WindowManager.PrintFormatted(UserInterface.TraceParameterSigned, val); } else { this.WindowManager.PrintFormatted(UserInterface.TraceParameterUnsigned, val); } if (param < (parameterCount - 1)) { this.WindowManager.DisplayCharacter(UserInterface.TraceParameterSeparator[0]); } } this.WindowManager.DisplayCharacter(UserInterface.TraceParameterEnd[0]); bool anyVariables = false; if (!said) { for (int param = 0; param < parameterCount; param++) { LogicArgumentType type = command.GetParameterType(param); if (type == LogicArgumentType.Variable) { anyVariables = true; } } } if (anyVariables) { this.ScrollTraceWindow(); } this.WindowManager.PopTextPosition(); if (anyVariables) { this.WindowManager.DisplayCharacter(UserInterface.TraceParameterStart[0]); for (int param = 0; param < parameterCount; param++) { int val = this.GetTraceParameterValue(operatorIndex, param, said); LogicArgumentType type = command.GetParameterType(param); if (type == LogicArgumentType.Variable) { this.WindowManager.PrintFormatted(UserInterface.TraceParameterSigned, this.State.Variables[val]); } else { this.WindowManager.PrintFormatted(UserInterface.TraceParameterSigned, val); } if (param < (parameterCount - 1)) { this.WindowManager.DisplayCharacter(UserInterface.TraceParameterSeparator[0]); } } this.WindowManager.DisplayCharacter(UserInterface.TraceParameterEnd[0]); } }