public Task <IEventOutput> Execute(IEventInput input) { EventCompleted eventCompleted = new EventCompleted(); Execute(input, eventCompleted); return(eventCompleted.GetTask()); }
public static MethodResult ToggleSwitch(object sender, IEventInput input) { var sInput = (StringInput)input; Systems.DataManager.ToggleSwitch(sInput.Input); return(MethodResult.Success); }
public void Execute(IEventInput input, IEventCompleted callBackEvent) { if (input.ID == 0) { input.ID = GetInputID(); } EventOutput output = new EventOutput(); output.Token = input.Token; output.ID = input.ID; output.EventError = EventError.Success; EventActionHandler handler = GetActionHandler(input.EventPath); if (handler == null) { output.EventError = EventError.NotFound; output.Data = new object[] { $"Process event error {input.EventPath} not found!" }; if (EnabledLog(LogType.Warring)) { Log(LogType.Warring, $"[{input.ID}]{input.Token} Process event error {input.EventPath} not found!"); } callBackEvent.Completed(output); } else { OnExecute(input, output, handler, callBackEvent); } }
public static MethodResult TurnOffSwitch(object sender, IEventInput input) { var sInput = (StringInput)input; Systems.DataManager.TurnOffSwitch(sInput.Input); return(MethodResult.False); }
public static MethodResult TurnOnSwitch(object sender, IEventInput input) { var sInput = (StringInput)input; EngineGlobals.DataManager.TurnOnSwitch(sInput.Input); return(MethodResult.True); }
protected void OnEventInvoke(IAnyCompletionSource e, IEventInput input, IEventOutput output) { ProxyOutputWork resultWork = new ProxyOutputWork { CompletionSource = e, EventCenter = EventCenter, Input = input, Output = output, EventDispatchProxy = this }; EventCenter.OutputNextQueue.Enqueue(resultWork, EventCenter.NextQueueWaits); }
public static MethodResult Wait(object sender, IEventInput input) { IntInput IInput = (IntInput)input; System.Threading.Thread.Sleep(IInput.Input); return(MethodResult.Success); }
public EventActionHandlerContext(EventCenter server, IEventInput input, EventActionHandler handler, object controller, NextQueue nextQueue) { Input = input; EventCenter = server; Handler = handler; Controller = controller; NextQueue = nextQueue; }
public static MethodResult CreateVariable(object sender, IEventInput input) { var vInput = (CreateVariableInput)input; Variable newVar = new Variable(vInput.Value); DataManager.SetVariable(vInput.Name, newVar); return(MethodResult.Success); }
public static MethodResult ShowMessageBox(object sender, IEventInput input) { var sInput = (StringInput)input; string _lines = sInput.Input; var screen = new SystemScreens.MessageBoxScreen(_lines, Current_ActionList); GameReference.State_Manager.AddScreen(screen); return(MethodResult.Success); }
/// <summary> /// Starts a battle sequence /// </summary> /// <param name="sender">The object that sent the request </param> /// <param name="input">A BattleInput, this will hold information on enemies in battle, /// and spoils, as well as info about the type of battle</param> public static MethodResult InitiateBattle(object sender, IEventInput input) { if (sender is GameData.Map.Character.Enemy.Enemy) { } var bScreen = new Screens.BattleScreen(); StateManager.AddScreenLoad(bScreen); return MethodResult.Success; }
public static MethodResult WaitForInput(object sender, IEventInput input) { ControlInput controlInput = (ControlInput)input; while (!controlInput.Control.Value) { System.Threading.Thread.Sleep(10); } return(MethodResult.Success); }
public EventActionHandlerContext(EventCenter server, IEventInput input, EventActionHandler handler, object controller, NextQueue nextQueue, ActorCollection.ActorItem actorItem) { Input = input; EventCenter = server; Handler = handler; Controller = controller; NextQueue = nextQueue; ActorItem = actorItem; }
/// <summary> /// Starts a battle sequence /// </summary> /// <param name="sender">The object that sent the request </param> /// <param name="input">A BattleInput, this will hold information on enemies in battle, /// and spoils, as well as info about the type of battle</param> public static MethodResult InitiateBattle(object sender, IEventInput input) { if (sender is GameData.Map.Character.Enemy.Enemy) { } var bScreen = new Screens.BattleScreen(); StateManager.AddScreenLoad(bScreen); return(MethodResult.Success); }
public static MethodResult ShowMessageBox(object sender, IEventInput input) { var sInput = (StringInput)input; string _lines = sInput.Input; var screen = new SystemScreens.MessageBoxScreen(_lines); GameReference.State_Manager.AddScreen(screen); while (screen.Result != MethodResult.Yes) { System.Threading.Thread.Sleep(100); } return(MethodResult.Success); }
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 void Execute(IEventInput input, IEventCompleted callBackEvent) { if (input.ID == 0) { input.ID = GetInputID(); } EventOutput output = new EventOutput(); output.Token = input.Token; output.ID = input.ID; output.EventError = EventError.Success; EventActionHandler handler = GetActionHandler(input.EventPath); if (handler == null) { output.EventError = EventError.NotFound; output.Data = new object[] { $"Process event error {input.EventPath} not found!" }; if (EnabledLog(LogType.Warring)) { Log(LogType.Warring, $"{input.Token} Process event error {input.EventPath} not found!"); } callBackEvent.Completed(output); } else { try { OnExecute(input, output, handler, callBackEvent); } catch (Exception e_) { output.EventError = EventError.InnerError; output.Data = new object[] { $"Process event {input.EventPath} error {e_.Message}" }; if (EnabledLog(LogType.Error)) { Log(LogType.Error, $"{input.Token} process event {input.EventPath} error {e_.Message}@{e_.StackTrace}"); } callBackEvent.Completed(output); } } }
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 virtual bool Executing(EventCenter center, EventActionHandler handler, IEventInput input, IEventOutput output) { return(true); }
public override void Executed(EventCenter center, EventActionHandler handler, IEventInput input, IEventOutput output) { base.Executed(center, handler, input, output); Console.WriteLine($"{input.EventPath} executed"); }
public static MethodResult AddCutSceneActor(object sender, IEventInput input) { return MethodResult.Success; }
public static MethodResult Wait(object sender, IEventInput input) { IntInput IInput = (IntInput)input; System.Threading.Thread.Sleep(IInput.Input); return MethodResult.Success; }
public static MethodResult ToggleSwitch(object sender, IEventInput input) { var sInput = (StringInput)input; EngineGlobals.DataManager.ToggleSwitch(sInput.Input); return MethodResult.Success; }
public static MethodResult ShowDialogueChoice(object sender, IEventInput input) { return MethodResult.No; }
public static MethodResult CreateVariable(object sender, IEventInput input) { var vInput = (CreateVariableInput)input; Variable newVar = new Variable(vInput.Value); DataManager.SetVariable(vInput.Name, newVar); return MethodResult.Success; }
/// <summary> /// Starts a battle sequence /// </summary> /// <param name="sender">The object that sent the request </param> /// <param name="input">A BattleInput, this will hold information on enemies in battle, /// and spoils, as well as info about the type of battle</param> public static MethodResult InitiateBattle(object sender, IEventInput input) { //var bScreen = new SystemScreens.BattleScreen("level.level"); return MethodResult.Success; }
/// <summary> /// Starts a battle sequence /// </summary> /// <param name="sender">The object that sent the request </param> /// <param name="input">A BattleInput, this will hold information on enemies in battle, /// and spoils, as well as info about the type of battle</param> public static MethodResult InitiateBattle(object sender, IEventInput input) { //var bScreen = new SystemScreens.BattleScreen("level.level"); return(MethodResult.Success); }
public static void Wait(object sender, IEventInput input) { IntInput IInput = (IntInput)input; System.Threading.Thread.Sleep(IInput.Input); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="input"></param> /// <returns></returns> public static void Condition(object sender, IEventInput input) { if (!(input is ConditionInput)) { ConsoleWindow.WriteLine("Invalid input passed to Condition method"); } var cInput = (ConditionInput)input; var v1 = cInput.InputA as Variable; var v2 = cInput.InputB as Variable; bool path1 = false; bool path2; switch (cInput.Comparison) { case CompareType.Var_Var: case CompareType.Var_Gold: if (cInput.CheckValue == CheckValue.ValueEqual) { if (v1.Value == v2.Value) { path1 = true; } } else if (cInput.CheckValue == CheckValue.ValueGreater) { if (v1.AsInt > v2.AsInt) { path1 = true; } } else if (cInput.CheckValue == CheckValue.ValueGreaterEqual) { if (v1.AsInt >= v2.AsInt) { path1 = true; } } else if (cInput.CheckValue == CheckValue.ValueLess) { if (v1.AsInt < v2.AsInt) { path1 = true; } } else if (cInput.CheckValue == CheckValue.ValueLessEqual) { if (v1.AsInt <= v2.AsInt) { path1 = true; } } break; case CompareType.Var_String: if (cInput.CheckValue == CheckValue.ValueEqual) { if (v1.Value == v2.Value) { path1 = true; } } break; case CompareType.Switch_Val: break; } path2 = !path1 && cInput.HasElse; if (path1) //Conditional complete route { //cInput.Path1.OldList = Current_ActionList; Current_ActionList.ExecuteList(cInput.Path1); } else if (path2) //Else route { Current_ActionList.ExecuteList(cInput.Path2); } }
public override bool Executing(EventCenter center, EventActionHandler handler, IEventInput input, IEventOutput output) { output.EventError = EventError.NotFound; output.Data = new object[] { $"{input.EventPath} not found!" }; return(false); }
public virtual void Executed(EventCenter center, EventActionHandler handler, IEventInput input, IEventOutput output) { }
public static MethodResult ShowDialogueChoice(object sender, IEventInput input) { return(MethodResult.Success); }
/// <summary> /// Checks internal variables and switches for their values and alternates method paths on the result /// </summary> /// <param name="sender"></param> /// <param name="input"></param> /// <returns></returns> public static MethodResult Condition(object sender, IEventInput input) { if (!(input is ConditionInput)) { ConsoleWindow.WriteLine("Invalid input passed to Condition method"); } var cInput = (ConditionInput)input; switch (cInput.Comparison) //Check the comparison type { case CompareType.Var_Var: case CompareType.Var_Gold: { var v1 = cInput.InputA as Variable; //Turn the inputs into variables var v2 = cInput.InputB as Variable; switch (cInput.CheckValue) { case CheckValue.ValueEqual: return v1.Value == v2.Value ? MethodResult.True : MethodResult.False; //Check if Value A is the same case CheckValue.ValueGreater: return v1.AsInt > v2.AsInt ? MethodResult.True : MethodResult.False; //Check if Value A is greater than value B case CheckValue.ValueGreater | CheckValue.ValueEqual: return v1.AsInt >= v2.AsInt ? MethodResult.True : MethodResult.False; //Check if Value A is greater or equal to value B case CheckValue.ValueLess: return v1.AsInt < v2.AsInt ? MethodResult.True : MethodResult.False; //Check if Value A is less than value B case CheckValue.ValueLess | CheckValue.ValueEqual: return v1.AsInt <= v2.AsInt ? MethodResult.True : MethodResult.False; //Check if Value A is less than or equal to value B } } return MethodResult.Fail; //If none of those were compared then it's a fail flag case CompareType.Var_String: { var v1 = cInput.InputA as Variable; //Compare the variables as strings var v2 = cInput.InputB as Variable; if (cInput.CheckValue == CheckValue.ValueEqual) { return v1.AsString == v2.AsString ? MethodResult.True : MethodResult.False; } } break; case CompareType.Switch_Val: { var s1 = cInput.InputA as Switch; if (cInput.CheckValue == CheckValue.ValueON) { return s1.Value ? MethodResult.True : MethodResult.False; } if (cInput.CheckValue == CheckValue.ValueOFF) { return s1.Value ? MethodResult.False : MethodResult.True; } if (cInput.CheckValue == CheckValue.ValueEqual) { var s2 = cInput.InputB as Switch; return s1.Value == s2.Value ? MethodResult.True : MethodResult.False; } } break; } return MethodResult.Fail; }
public static void ChangeMusic(object sender, IEventInput input) { //var aInput = input as AudioInput; }
public static MethodResult ModifyVariables(object sender, IEventInput input) { if (input is IntModInput) { var temp = (IntModInput)input; switch (temp.AdjustmentType) { case AdjustType.Addition: temp.VarInput += temp.IntInput; break; case AdjustType.Subtract: temp.VarInput -= temp.IntInput; break; case AdjustType.Multiply: temp.VarInput *= temp.IntInput; break; case AdjustType.Divide: temp.VarInput /= temp.IntInput; break; case AdjustType.Modulus: temp.VarInput %= temp.IntInput; break; case AdjustType.Set: Variable.Set(temp.VarInput, temp.IntInput); break; case AdjustType.SetToGold: Variable.Set(temp.VarInput, EngineGlobals.DataManager.GetVariable("{gold}").AsInt); break; case AdjustType.SetToPlayerX: break; case AdjustType.SetToPlayerY: break; } } else if (input is VariableModInput) { var temp = (VariableModInput)input; switch (temp.AdjustmentType) { case AdjustType.Addition: temp.InputL.AsInt += temp.InputR.AsInt; break; case AdjustType.Subtract: temp.InputL.AsInt -= temp.InputR.AsInt; break; case AdjustType.Multiply: temp.InputL.AsInt *= temp.InputR.AsInt; break; case AdjustType.Divide: temp.InputL.AsInt /= temp.InputR.AsInt; break; case AdjustType.Modulus: temp.InputL.AsInt %= temp.InputR.AsInt; break; case AdjustType.Set: temp.InputL.Value = temp.InputR.Value; break; } } return MethodResult.Success; }
public static void ListErase(object sender, IEventInput input) { Current_ActionList = null; }
public static MethodResult ShowMessageBox(object sender, IEventInput input) { var sInput = (StringInput)input; string _lines = sInput.Input; var screen = new SystemScreens.MessageBoxScreen(_lines); GameReference.State_Manager.AddScreen(screen); while (screen.Result != MethodResult.Yes) { System.Threading.Thread.Sleep(100); } return MethodResult.Success; }
public static MethodResult TurnOnSwitch(object sender, IEventInput input) { var sInput = (StringInput)input; EngineGlobals.DataManager.TurnOnSwitch(sInput.Input); return MethodResult.True; }
public static void Wait(object sender,IEventInput input) { IntInput IInput = (IntInput)input; System.Threading.Thread.Sleep(IInput.Input); }
public static MethodResult WaitForInput(object sender, IEventInput input) { ControlInput controlInput = (ControlInput)input; while (!controlInput.Control.Value) { System.Threading.Thread.Sleep(10); } return MethodResult.Success; }
public static MethodResult ModifyVariables(object sender, IEventInput input) { if (input is IntModInput) { var temp = (IntModInput)input; switch (temp.AdjustmentType) { case AdjustType.Addition: temp.VarInput += temp.IntInput; break; case AdjustType.Subtract: temp.VarInput -= temp.IntInput; break; case AdjustType.Multiply: temp.VarInput *= temp.IntInput; break; case AdjustType.Divide: temp.VarInput /= temp.IntInput; break; case AdjustType.Modulus: temp.VarInput %= temp.IntInput; break; case AdjustType.Set: Variable.Set(temp.VarInput, temp.IntInput); break; case AdjustType.SetToGold: Variable.Set(temp.VarInput, Systems.DataManager.GetVariable("{gold}").AsInt); break; case AdjustType.SetToPlayerX: break; case AdjustType.SetToPlayerY: break; } } else if (input is VariableModInput) { var temp = (VariableModInput)input; switch (temp.AdjustmentType) { case AdjustType.Addition: temp.InputL.AsInt += temp.InputR.AsInt; break; case AdjustType.Subtract: temp.InputL.AsInt -= temp.InputR.AsInt; break; case AdjustType.Multiply: temp.InputL.AsInt *= temp.InputR.AsInt; break; case AdjustType.Divide: temp.InputL.AsInt /= temp.InputR.AsInt; break; case AdjustType.Modulus: temp.InputL.AsInt %= temp.InputR.AsInt; break; case AdjustType.Set: temp.InputL.Value = temp.InputR.Value; break; } } return(MethodResult.Success); }
public override bool Executing(EventCenter center, EventActionHandler handler, IEventInput input, IEventOutput output) { string token = null; input.Properties?.TryGetValue("token", out token); var user = JWTHelper.Default.GetUserInfo(token); if (user != null) { return(base.Executing(center, handler, input, output)); } else { output.EventError = EventError.InnerError; output.Data = new object[] { "操作错误,无权操作相关资源!" }; return(false); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="input"></param> /// <returns></returns> public static void Condition(object sender, IEventInput input) { if (!(input is ConditionInput)) { ConsoleWindow.WriteLine("Invalid input passed to Condition method"); } var cInput = (ConditionInput)input; var v1 = cInput.InputA as Variable; var v2 = cInput.InputB as Variable; bool path1 = false; bool path2; switch (cInput.Comparison) { case CompareType.Var_Var: case CompareType.Var_Gold: if (cInput.CheckValue == CheckValue.ValueEqual) { if (v1.Value == v2.Value) path1 = true; } else if (cInput.CheckValue == CheckValue.ValueGreater) { if (v1.AsInt > v2.AsInt) path1 = true; } else if (cInput.CheckValue == CheckValue.ValueGreaterEqual) { if (v1.AsInt >= v2.AsInt) path1 = true; } else if (cInput.CheckValue == CheckValue.ValueLess) { if (v1.AsInt < v2.AsInt) path1 = true; } else if (cInput.CheckValue == CheckValue.ValueLessEqual) { if (v1.AsInt <= v2.AsInt) path1 = true; } break; case CompareType.Var_String: if (cInput.CheckValue == CheckValue.ValueEqual) { if (v1.Value == v2.Value) path1 = true; } break; case CompareType.Switch_Val: break; } path2 = !path1 && cInput.HasElse; if (path1) //Conditional complete route { //cInput.Path1.OldList = Current_ActionList; Current_ActionList.ExecuteList(cInput.Path1); } else if (path2) //Else route { Current_ActionList.ExecuteList(cInput.Path2); } }
public static MethodResult ShowMessageBox(object sender, IEventInput input) { var sInput = (StringInput)input; string _lines = sInput.Input; var screen = new SystemScreens.MessageBoxScreen(_lines, Current_ActionList); GameReference.State_Manager.AddScreen(screen); return MethodResult.Success; }
public static MethodResult TurnOffSwitch(object sender, IEventInput input) { var sInput = (StringInput)input; Systems.DataManager.TurnOffSwitch(sInput.Input); return MethodResult.False; }
public static MethodResult AddCutSceneActor(object sender, IEventInput input) { return(MethodResult.Success); }