public static MethodResult AdjustGold(object sender, IEventInput input) { var gold = EngineGlobals.DataManager.GetVariable("{gold}"); IntInput temp = new IntInput(); if (input is IntInput) temp = (IntInput)input; else EquestriEngine.ErrorMessage = "Invalid input passed into Adjust Gold"; var newGoldDisplay = new SystemWidgets.GoldDisplay(gold.AsInt, temp.Input); GameReference.WidgetDrawer.AddWidget(newGoldDisplay); gold.AsInt += temp.Input; return MethodResult.Success; }
public static MethodResult AdjustGold(object sender, IEventInput input) { var gold = DataManager.GetVariable("{gold}"); IntInput temp = new IntInput(); if (input is IntInput) temp = (IntInput)input; else EquestriEngine.ErrorMessage = "Invalid input passed into Adjust Gold"; if (sender is Achievement /*|| sender is Objects.GameObjects.NPC*/) { var newGoldDisplay = new SystemWidgets.GoldDisplay(gold.AsInt, temp.Input); GameReference.WidgetDrawer.AddWidget(newGoldDisplay); } gold.AsInt += temp.Input; TryContinueList(); return MethodResult.Success; }
public static Data.Inputs.MethodParamPair GenerateMethodFromString(string input) { Data.Inputs.MethodParamPair output = null; string[] temp = input.Split(';'); string methodName = temp[0].ToLower(); switch (methodName) { case "addgold": { if (temp.Length != 2) throw new EngineException("Incorrect number of parameters passed", false); try { MethodParamResult method = AdjustGold; IntInput parameter = new IntInput(); parameter.Input = int.Parse(temp[1]); //output = new MethodParamPair(method, parameter); } catch { EquestriEngine.ErrorMessage = "Error Creating MethodParamPair"; } break; } case "addexp": { MethodParamResult method = AdjustGold; IntInput parameter = new IntInput(); parameter.Input = int.Parse(temp[1]); //output = new MethodParamPair(method, parameter); break; } case "toggleswitch": { if (temp.Length != 2) throw new EngineException("Incorrect number of parameters passed", false); MethodParamResult method = ToggleSwitch; StringInput parameter = new StringInput(); parameter.Input = temp[1]; //output = new MethodParamPair(method, parameter); break; } case "activateswitch": { if (temp.Length != 2) throw new EngineException("Incorrect number of parameters passed", false); break; } case "deactivateswitch": { if (temp.Length != 2) throw new EngineException("Incorrect number of parameters passed", false); break; } default: throw new EngineException("Method name Not Found", false); } return output; }