public CalculationCommand(AsmInterpreter interpreter, string[] lineParts) : base(interpreter, lineParts) { string operatorName = lineParts[0]; string targetName = lineParts[1]; string sourceName = lineParts[2]; CalculationDelegate delegation = GetCalculationDelegation(operatorName); if (delegation == null) throw new InvalidOperationException("Invalid calculation operator."); calc = delegation; ValueStorage vs = null; vs = parent.GetVariableByName(sourceName); if (vs == null) { vs = parent.GetRegisterByName(sourceName); if (vs == null) { vs = parent.GetStackValueFromTop(sourceName); if (vs == null) { float number = 0.0f; if (float.TryParse(sourceName, out number)) { vs = new ValueStorage(); vs.SetValue(number); parent.m_constants.Add(vs); } } } } if (vs == null) throw new InvalidOperationException("Invalid calculation operand."); operand = vs; vs = parent.GetVariableByName(targetName); if (vs == null) { vs = parent.GetRegisterByName(targetName); if (vs == null) { vs = parent.GetStackValueFromTop(targetName); } } if (vs == null) throw new InvalidOperationException("Invalid calculation target."); target = vs; }
public TalentBonusCalculatedFromMethod(TalentDelegate talent, CalculationDelegate calculation) : base(talent) { _calculation = calculation; }
public void StartCalculation(int count) { lock (this) { if (_calcState == CalculationStatus.NotCalculating) { CalculationDelegate calc = new CalculationDelegate(Calculation); calc.BeginInvoke(count, new AsyncCallback(EndCalculate), calc); } } }