private void Select(GameObject _selectedPawn) { m_Cursor.transform.position = GetCursorPosition(_selectedPawn); GameMaster.GetInstance().TurnHistory_RemoveHighlightedEnemies(); GameMaster.GetInstance().TurnHistory_HighlightEnemy(_selectedPawn); ActionRunner runner = GameMaster.GetInstance().GetSelectedAction(); if (runner != null && runner.ActionDescription != null) { ISpecificActionDescription desc = runner.ActionDescription; if (desc.m_ShowHistoryPreview) { //preview the damages PawnStatistics targetStats = new PawnStatistics(_selectedPawn.GetComponent <PawnStatistics>()); PawnStatistics sourceStats = new PawnStatistics(GameTurnManager.GetInstance().GetCurrentPawnStatistics()); ResolveResult result = new ResolveResult(); desc.m_Power.Resolve(sourceStats, targetStats, result); //preview turn history List <GameObject> preview = GameTurnManager.GetInstance().Preview(_selectedPawn, targetStats, 10); GameMaster.GetInstance().m_UITurnHistory.ShowPreview(preview.ToArray()); } } }
public void AddAct(ActionRunner ar) { lock (_listActRunner) { _listActRunner.Add(ar); } }
private void ExecuteAfterPopulateSection() { try { ActionRunner runner = new ActionRunner(); Core.Action action = null; if (Section is DetailsSection) { if (DetailsSection.AfterPopulateSection != null) { action = ObjectCopier.Clone <Core.Action>(DetailsSection.AfterPopulateSection); } } if (Section is EditSection) { action = ObjectCopier.Clone <Core.Action>(EditSection.AfterPopulateSection); } if (action != null) { runner.Page = (BasePage)this.Page; runner.Action = action; runner.Execute(); } } catch (Exception ex) { throw ex; } }
public void Start() { impressionMemory = (ImpressionMemory)GetComponent("ImpressionMemory"); actionRunner = (ActionRunner)GetComponent("ActionRunner"); neck = (Neck)GetComponentInChildren(typeof(Neck)); enabled=false; }
void ctrl_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e) { try { if (Me.SelectedIndexChanged != null) { ActionRunner runner = new ActionRunner(); Core.Action action = ObjectCopier.Clone <Core.Action>(Me.SelectedIndexChanged); runner.Page = (BasePage)this.Page; runner.Action = action; runner.Execute(); } } catch (Exception ex) { string ErrorMessageFormat = "ERROR - {0} - Control {1} ({2} - {3})"; string ErrorMessages = String.Format(ErrorMessageFormat, ex.Message, this.ControlID, Me.Type, this.ID); this.ctrl.Items.Insert(0, new RadComboBoxItem(ErrorMessages, String.Empty)); this.ctrl.BackColor = Color.Red; } }
public AbstractAction(GameObject actor) { this.actor = actor; state = actor.GetComponent(typeof(CharacterState)) as CharacterState; animator = actor.GetComponent(typeof(CharacterAnimator)) as CharacterAnimator; mover = actor.GetComponent(typeof(CharacterMover)) as CharacterMover; actionRunner = actor.GetComponent(typeof(ActionRunner)) as ActionRunner; animationName = null; wrapMode = WrapMode.Once; emotionBodyParts = Emotion.BodyParts.NONE; canStartDialogueWithPC = true; canStartDialogueWithAgents = true; canEndAnyTime = true; //canCancelDuringMovement = true; quickReaction = null; moveToAction = null; started = false; endedASAP = false; endNextRound = false; finished = false; }
private IDisposable WithExistingPullRequest(SynchronizePullRequestResult checkResult) { AfterDbUpdateActions.Add(() => { var pr = new InProgressPullRequest { Url = InProgressPrUrl, ContainedSubscriptions = new List <SubscriptionPullRequestUpdate> { new SubscriptionPullRequestUpdate { BuildId = -1, SubscriptionId = Subscription.Id } }, RequiredUpdates = new List <DependencyUpdateSummary> { new DependencyUpdateSummary { DependencyName = "Ham", FromVersion = "1.0.0-beta.1", ToVersion = "1.0.1-beta.1" }, new DependencyUpdateSummary { DependencyName = "Ham", FromVersion = "1.0.0-beta.1", ToVersion = "1.0.1-beta.1" }, } }; StateManager.SetStateAsync(PullRequestActorImplementation.PullRequest, pr); ExpectedActorState.Add(PullRequestActorImplementation.PullRequest, pr); }); ActionRunner.Setup(r => r.ExecuteAction(It.IsAny <Expression <Func <Task <ActionResult <SynchronizePullRequestResult> > > > >())) .ReturnsAsync(checkResult); if (checkResult == SynchronizePullRequestResult.InProgressCanUpdate) { DarcRemotes.GetOrAddValue(TargetRepo, CreateMock <IRemote>) .Setup(r => r.GetPullRequestAsync(InProgressPrUrl)) .ReturnsAsync( new PullRequest { HeadBranch = InProgressPrHeadBranch, BaseBranch = TargetBranch }); } return(Disposable.Create( () => { ActionRunner.Verify(r => r.ExecuteAction(It.IsAny <Expression <Func <Task <ActionResult <SynchronizePullRequestResult> > > > >())); if (checkResult == SynchronizePullRequestResult.InProgressCanUpdate) { DarcRemotes[TargetRepo].Verify(r => r.GetPullRequestAsync(InProgressPrUrl)); } })); }
public override void Run() { //get the humidity data SenseHat.Sensors.HumiditySensor.Update(); humidity = (SenseHat.Sensors.Humidity.Value); //get the temperature data temperature = (SenseHat.Sensors.Temperature.Value); if ((humidity > 60) & (temperature < 28)) { drawrain(); } else if ((humidity < 40) & (temperature > 35)) { drawsun(); } /*else * { * drawcloud(); * }*/ Sleep(TimeSpan.FromSeconds(2)); ActionRunner.Run(senseHat => HomeSelector.GetAction(senseHat, SetScreenText)); }
private void LoadPluginAndRunAction() { PluginPackage p = new PluginPackage(); Console.WriteLine("Plugin Package folder?"); string s = Console.ReadLine(); p.Folder = s; p.ScanPackage(); ObservableList <StandAloneAction> list = p.GetStandAloneActions(); int i = 0; foreach (StandAloneAction a in list) { Console.WriteLine(i + ": " + a.ID); i++; } string actnum = Console.ReadLine(); ActionHandler AH = p.GetStandAloneActionHandler(list[int.Parse(actnum)].ID); // FIXME need lazy load of params foreach (ActionParam v in AH.GingerAction.InputParams.Values) { Console.WriteLine(v.Name + "?"); string val = Console.ReadLine(); v.Value = val; } ActionRunner.RunAction(AH.Instance, AH.GingerAction, AH); }
// 0) path => Blog.Admin // 1) path => Blog // 2) path => "" private static String addLayoutPrivate(String path, String actionContent, MvcContext ctx, Boolean isLastLayout) { // String content = layoutCacher.getByPath( path ) // if( strUtil.HasText( content ) ) return HtmlCombiner.combinePage( content, actionContent ); ControllerBase controller = ControllerFactory.FindLayoutController(path, ctx); if (controller == null) { return(actionContent); } ctx.controller.utils.addHidedLayouts(controller); // 将controller中提到需要隐藏的控制器隐藏 if (ctx.controller.utils.isHided(controller.GetType())) { return(actionContent); } // 检查缓存 String cacheKey = null; if (MvcConfig.Instance.IsActionCache) { IActionCache actionCache = ControllerMeta.GetActionCache(controller.GetType(), "Layout"); cacheKey = getCacheKey(actionCache, ctx); if (strUtil.HasText(cacheKey)) { Object cacheContent = checkCache(cacheKey); if (cacheContent != null) { logger.Info("load from nsLayoutCache=" + cacheKey); return(HtmlCombiner.combinePage(cacheContent.ToString(), actionContent)); } } } controller.utils.switchViewToLayout(); ActionRunner.runLayoutAction(ctx, controller, controller.Layout); if (ctx.utils.isEnd()) { return(controller.utils.getActionResult()); } String actionResult = controller.utils.getActionResult(); // 加入缓存 if (MvcConfig.Instance.IsActionCache) { if (cacheKey != null) { addContentToCache(cacheKey, actionResult); } } return(HtmlCombiner.combinePage(actionResult, actionContent)); }
private static void AddPackage(string package, bool activate) { string action = activate ? ActionRunner.ADD_ACTIVATE_PACKAGE_ACTION : ActionRunner.ADD_PACKAGE_ACTION; ActionRunner.AddActionToStartup($"{action} {package}"); }
public SubcriptionIncomingBusAction(IFactoryBroker brokers, ActionBusConfiguration configuration, ActionRunner <ActionBusContext> action) : base("Service consume incoming adapter broker queue") { _action = action; Subscription = brokers.CreateSubscription(configuration.ActionBusBrokerConfiguration.ActionBusQueue, context => Callback(context)); _acknowledgeQueue = brokers.CreatePublisher(configuration.ActionBusBrokerConfiguration.AcknowledgeExchange); _deadQueue = brokers.CreatePublisher(configuration.ActionBusBrokerConfiguration.DeadQueueAction); }
public override void Start () { if ((bool)GameStateManager.Instance.GetVariable(variableName)) action = actionIfTrue; else action = actionIfFalse; action.Start(); }
/// <summary> /// Initializes the Plugin System. /// </summary> /// <param name="internalConfigPath">The Path that is used by internal config files by the Plugin System</param> /// <param name="pluginDirectory">The Path used as "Install Directory" for Plugins/Packages</param> public static void Initialize( string internalConfigPath, string pluginDirectory, Func <string, string, bool> updateDialog, Action <string, int, int> setStatus, string staticDataConfig = null, bool checkUpdates = true) { if (IsInitialized) { throw new Exception("Can not Initialize the Plugin System Twice"); } SendLog("Initializing Plugin System"); //TODO: Process Things like updates before the plugin system loads the libraries. PluginPaths.InternalSystemConfigPath = Path.GetFullPath(internalConfigPath); PluginPaths.PluginDirectory = Path.GetFullPath(pluginDirectory); PluginPaths.EnsureInternalDirectoriesExist(); PluginPaths.CreateInternalFilesIfMissing(); ErrorHandler.Initialize(); LoadOrder.Initialize(); if (staticDataConfig != null && File.Exists(staticDataConfig)) { StaticData.SetState(File.ReadAllText(staticDataConfig)); } IsInitialized = true; SendLog("Updating.."); PluginHost = new PluginSystemHost(); HelperClass.ReloadDefaultPlugins(); OnInitialized?.Invoke(); if (File.Exists(PluginPaths.InternalStartupInstructionPath)) { SendLog("Running Start Actions.."); ActionRunner.RunActions(); } if (checkUpdates) { ListHelper.LoadList(PluginPaths.PluginListFile).Select(x => new BasePluginPointer(x)).ToList() .ForEach(x => UpdateManager.CheckAndUpdate(x, updateDialog, setStatus)); } SendLog("Registering System Host.."); LoadPlugins(PluginHost); SendLog("Registered System Host.."); SendLogDivider(); //Everything Finished SendLog("Initialization Complete."); SendLogDivider(); }
public override void Start() { current = actions.Current; current.register (currentDone); current.Start (); bool hasNext = actions.MoveNext (); if(hasNext){ next = actions.Current; } }
private static Result Execute(int problemId) { var problemSolver = ProblemStore.Instance.Get<IProblemSolver<string>>(problemId); IActionRunner runner = new ActionRunner(); var answer = runner.Invoke<string>(problemSolver.Solve); return new Result(problemSolver.Title, answer, runner.TimeElapsed); }
public SDKClusterDataSource(IKinectSensor nuiRuntime, IClusterFactory clusterFactory, IDepthPointFilter <DepthImageFrame> filter) : base(nuiRuntime) { this.CurrentValue = new ClusterCollection(); this.clusterFactory = clusterFactory; this.filter = filter; this.queue = new ConcurrentQueue <DepthImageFrame>(); this.runner = new ActionRunner(() => Process()); }
public GameState(string name, IDictionary<Trigger,string> transitionTable, ActionRunner mainAction, ActionRunner actionToInterrupt = null) { // TODO: add ongoing action support this.Name = name; this.transitionTable = transitionTable; this.mainAction = mainAction; this.actionToInterrupt = actionToInterrupt; }
private void OnMagicEnemySelected(GameObject _enemy) { //Set the enemy in the action ActionRunner act = GameMaster.GetInstance().GetSelectedAction(); act.m_Target = _enemy; GameMaster.GetInstance().ActionReady(); }
private String runOtherLayout(ControllerBase controller, MvcContext ctx, ProcessContext context, String actionContent) { ControllerBase layoutController = ControllerFactory.FindController(controller.LayoutControllerType, ctx); layoutController.utils.switchViewToLayout(); ActionRunner.runLayoutAction(ctx, layoutController, layoutController.Layout); return(layoutController.utils.getActionResult()); }
private void OnAttackEnemySelected(GameObject _enemy) { ActionRunner attackAction = GameTurnManager.GetInstance().GetCurrentPawn().GetComponent <PawnActions>().m_DefaultAttack; attackAction.m_Target = _enemy; attackAction.ActionDescription = GameTurnManager.GetInstance().GetCurrentPawn().GetComponent <PawnBehavior>().m_AttackDescription; GameMaster.GetInstance().SetSelectedAction(attackAction); GameMaster.GetInstance().ActionReady(); }
//public SDKClusterDataSource(IKinectSensor nuiRuntime, IClusterFactory clusterFactory, IDepthPointFilter<DepthImageFrame> filter) // : base(nuiRuntime) // older version public SDKClusterDataSource(IKinectSensor nuiRuntime, IClusterFactory clusterFactory, IDepthPointFilter <DepthFrame> filter) : base(nuiRuntime) // update: using DepthFrame instead of DeothImageFrame { this.CurrentValue = new ClusterCollection(); this.clusterFactory = clusterFactory; this.filter = filter; //this.queue = new ConcurrentQueue<DepthImageFrame>(); // older version this.queue = new ConcurrentQueue <DepthFrame>(); // update: using DepthFrame instead of DepthImageFrame this.runner = new ActionRunner(() => Process()); }
protected override void TryUpdatingAllPackages() { List <IPackageFromRepository> packages = GetPackagesFromViewModels().ToList(); using (IDisposable operation = StartUpdateOperation(packages.First())) { var factory = new UpdatePackagesActionFactory(logger, packageManagementEvents); IUpdatePackagesAction action = factory.CreateAction(selectedProjects, packages); ActionRunner.Run(action); } }
public GameState(string name, IDictionary <Trigger, string> transitionTable, ActionRunner mainAction, ActionRunner actionToInterrupt = null) { // TODO: add ongoing action support this.Name = name; this.transitionTable = transitionTable; this.mainAction = mainAction; this.actionToInterrupt = actionToInterrupt; }
private void StartOnTarget() { ActionRunner action = GameMaster.GetInstance().GetSelectedAction(); Vector3 initialPosition = action.m_Target.transform.position; Vector3 finalPosition = initialPosition + m_OffsetPosition; Vector3 screenSpacePosition = Camera.main.WorldToScreenPoint(finalPosition); m_Container.transform.position = screenSpacePosition; }
public override void Start() { current = actions.Current; current.register(currentDone); current.Start(); bool hasNext = actions.MoveNext(); if (hasNext) { next = actions.Current; } }
public override void OnEnter() { //prepare the action m_SelectedAction = m_Behavior.GetRunSingleTurnState().GetSelectedAction(); m_SelectedAction.Prepare(); //show the attack name m_Behavior.m_UIEffects.StartAnimationShowAttackName(m_SelectedAction.ActionDescription.m_DisplayName); //apply attack cost m_SelectedAction.ActionDescription.m_Power.ApplyCost(m_SelectedAction.m_Pawn.GetComponent <PawnStatistics>()); }
public static void AddTask(Action act) { if (IsMainThread()) { act.Invoke(); } else { var runner = new ActionRunner(act); _taskExecutor.AddAct(runner); } }
protected override void Provide(Action <IFileValue> pushFileValue, MailAdapterConnectionParameters connectionParameters, MailAdapterProviderParameters providerParameters, CancellationToken cancellationToken, IDependencyResolver resolver, IInvoker invoker) { var files = ActionRunner.TryExecute(connectionParameters.MaxAttempts, () => GetFileList(connectionParameters, providerParameters)); foreach (var item in files) { if (cancellationToken.IsCancellationRequested) { break; } pushFileValue(item); } }
public void StopMarkerFromActionDescription() { ActionRunner runner = GameMaster.GetInstance().GetSelectedAction(); Transform prefab = runner.ActionDescription.m_EventMarker; if (prefab == null) { return; } m_Markers[prefab.name].StopEvent(); }
public override void Start() { if ((bool)GameStateManager.Instance.GetVariable(variableName)) { action = actionIfTrue; } else { action = actionIfFalse; } action.Start(); }
protected void RunSelenium(List <Action> actionsList) { SetLogText(""); LogDir = (_actionArgs != null) ? _actionArgs.LogFilePath : GetCurrentFolder(); Log.Reset(LogDir); if (txtRootURL.Text == "" && _actionArgs == null) { MessageBox.Show("Please provide root url!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } try { EnablePaneAction(false); /////////////////////////////////////////////////////////////////////////////// var actionRunner = new ActionRunner(new ActionRunnerArgs { LogFilePath = LogDir, URL = txtRootURL.Text, RunTimes = Convert.ToInt32(txtRunTimes.Value) }); actionRunner.RunActions(this, GetActionsList()); } catch (Exception ex) { LogTask logMsg = new LogTask { message = ex.Message, status = TaskCompletionStatus.Error, TaskName = "MainForm class - RunSelenium", TimeNetto = TimeSpan.MinValue }; Log.WriteLog(logMsg); } finally { Log.Close(); } EnablePaneAction(true); ShowNotification(false); if (_actionArgs != null) { Close(); } }
public void RemoveTable(ActionRunner runner) { runner.DropConstraint(op => { op.TableName = AddPersonTable.TABLE_NAME; op.ConstraintName = FK_NAME; }); runner.DropColumn(op => { op.TableName = AddPersonTable.TABLE_NAME; op.ColumnName = FK_COL_NAME; }); runner.Run<IDropTableOperation>(op => op.TableName = TABLE_NAME); }
public virtual void ExecuteAction(CodeTorch.Core.Action sourceAction) { if (sourceAction != null) { ActionRunner runner = new ActionRunner(); Core.Action action = ObjectCopier.Clone <Core.Action>(sourceAction); runner.Page = (BasePage)this.Page; runner.Action = action; runner.Execute(); } }
protected override void Process(IFileValue fileValue, DropboxAdapterConnectionParameters connectionParameters, DropboxAdapterProcessorParameters processorParameters, Action <IFileValue> push, CancellationToken cancellationToken, IDependencyResolver resolver, IInvoker invoker) { var path = $"/{Path.Combine(connectionParameters.RootFolder ?? "", processorParameters.SubFolder ?? "", fileValue.Name)}".Replace("\\", "/").Replace("//", "/"); var stream = fileValue.GetContent(); byte[] fileContents; stream.Position = 0; using (MemoryStream ms = new MemoryStream()) { stream.CopyTo(ms); fileContents = ms.ToArray(); } ActionRunner.TryExecute(connectionParameters.MaxAttempts, () => UploadSingleTime(connectionParameters, fileContents, path)); push(fileValue); }
protected override void Process(IFileValue fileValue, SftpAdapterConnectionParameters connectionParameters, SftpAdapterProcessorParameters processorParameters, Action <IFileValue> push, CancellationToken cancellationToken, IDependencyResolver resolver, IInvoker invoker) { var folder = string.IsNullOrWhiteSpace(connectionParameters.RootFolder) ? (processorParameters.SubFolder ?? "") : Path.Combine(connectionParameters.RootFolder, processorParameters.SubFolder ?? ""); var stream = fileValue.GetContent(); byte[] fileContents; stream.Position = 0; using (MemoryStream ms = new MemoryStream()) { stream.CopyTo(ms); fileContents = ms.ToArray(); } ActionRunner.TryExecute(connectionParameters.MaxAttempts, () => UploadSingleTime(connectionParameters, fileContents, Path.Combine(folder, fileValue.Name))); push(fileValue); }
//Called when curreng subAction finishes //Either start next action, or if no more actions left, call done protected void currentDone(){ if(next != null) { next.register (currentDone); next.Start (); current = next; bool hasNext = actions.MoveNext (); if (hasNext) { next = actions.Current; } else next = null; } else{ done(); } }
public override void OnExecute() { GameTurnManager turnMng = GameTurnManager.GetInstance(); PawnActions actions = turnMng.GetCurrentPawn().GetComponent <PawnActions>(); ActionRunner selectedAction = actions.m_DefaultAttack; //Set target int id = Random.Range(0, turnMng.m_PlayerPawns.Count); GameObject obj = turnMng.m_PlayerPawns[id]; selectedAction.m_Target = obj; selectedAction.ActionDescription = turnMng.GetCurrentPawn().GetComponent <PawnBehavior>().m_AttackDescription; //Set the action to run and go to next state m_Behavior.SetSelectedAction(selectedAction); m_Behavior.ActionReady(); m_Runner.SetCurrentState((int)RunSingleTurnState.RunAction, "AI has selected action"); }
public void AddTableNormalWay(ActionRunner runner) { runner.AddTable( op => { op.TableName = TABLE_NAME; op.AddColumn(new Column { Name = "id", DbType = DbType.Int32, Property = ColumnProperty.PrimaryKeyWithIdentity }); op.AddColumn(new Column { Name = "street1", DbType = DbType.String, Size = 50 }); op.AddColumn(new Column { Name = "street2", DbType = DbType.String, Size = 50 }); op.AddColumn(new Column { Name = "city", DbType = DbType.String, Size = 50 }); op.AddColumn(new Column { Name = "state", DbType = DbType.String, Size = 2 }); op.AddColumn(new Column { Name = "postalCode", DbType = DbType.String, Size = 12 }); }); runner.Run<IAddReferenceAndFkOperation>(op => { op.Driver = runner.Driver; op.TableName = AddPersonTable.TABLE_NAME; op.ColumnName = FK_COL_NAME; op.ConstraintName = FK_NAME; op.ReferenceTableName = TABLE_NAME; op.ReferenceColumnName = "id"; }); }
public void DoSomethingElse(ActionRunner runner) { runner.Driver.Run<IGenericOperation>( op => { op.Sql = "Foo"; } ); }
public SocialActions(ActionRunner runner) { this.runner = runner; }
public IfVariableAction(string variableName, ActionRunner actionIfTrue, ActionRunner actionIfFalse){ this.variableName = variableName; this.actionIfTrue = actionIfTrue; this.actionIfFalse = actionIfFalse; }