private static MementoNode NodeFromElement(GameMemento previous, XElement element) { var type = element.Attribute("type").Value; IUpdateAction action; switch (type) { case MoveBallToken: { var(src, dst) = MoveActionParamsFromElement(element.Element(MoveParamsElement)); action = MoveBallAction.New(src, dst); break; } case MovePieceToken: { var(src, dst) = MoveActionParamsFromElement(element.Element(MoveParamsElement)); action = MovePieceAction.New(src, dst); break; } case PassToken: action = new PassAction(); break; default: throw new ArgumentOutOfRangeException(); } return(previous.Update(action)); }
public void TestPassAction() { ActionFactory factory = new ActionFactory(); factory.IsDraft = false; PassAction action = factory.CreateGameAction("PASS") as PassAction; Assert.IsNotNull(action); Assert.IsInstanceOfType(action, typeof(PassAction)); }
private static void ExecuteTurn(IHero hero) { var Action = hero.DetermineAction(); var Outcome = ActionValidator.ValidateAction(hero, Action); if (!Outcome.Success) { Action = new PassAction(); //Show message? } ActionExecutor.Execute(hero, Action); }
private void Draw() { // begin the offscreen render pass var offscreenPassAction = PassAction.Clear(Rgba32F.Black); _offscreenRenderPass.Begin(ref offscreenPassAction); // describe the bindings for rendering a non-textured cube into the render target var offscreenResourceBindings = default(ResourceBindings); offscreenResourceBindings.VertexBuffer() = _vertexBuffer; offscreenResourceBindings.IndexBuffer = _indexBuffer; // apply the render pipeline and bindings for the offscreen render pass _offscreenRenderPass.ApplyPipeline(_offscreenPipeline); _offscreenRenderPass.ApplyBindings(ref offscreenResourceBindings); // apply the mvp matrix to the offscreen vertex shader _offscreenRenderPass.ApplyShaderUniforms(ShaderStageType.VertexStage, ref _modelViewProjectionMatrix); // draw the non-textured cube into the target of the offscreen render pass _offscreenRenderPass.DrawElements(36); // end the offscreen render pass _offscreenRenderPass.End(); // begin a frame buffer render pass Rgba32F clearColor = 0x0040FFFF; var frameBufferPass = BeginDefaultPass(clearColor); // describe the bindings for using the offscreen render target as the sampled texture var frameBufferResourceBindings = default(ResourceBindings); frameBufferResourceBindings.VertexBuffer() = _vertexBuffer; frameBufferResourceBindings.IndexBuffer = _indexBuffer; frameBufferResourceBindings.FragmentStageImage() = _renderTarget; // apply the render pipeline and bindings for the frame buffer render pass frameBufferPass.ApplyPipeline(_frameBufferPipeline); frameBufferPass.ApplyBindings(ref frameBufferResourceBindings); // apply the mvp matrix to the frame buffer vertex shader frameBufferPass.ApplyShaderUniforms(ShaderStageType.VertexStage, ref _modelViewProjectionMatrix); // draw the textured cube into the target of the frame buffer render pass frameBufferPass.DrawElements(36); // end the frame buffer render pass frameBufferPass.End(); }
private static void GetPassActions(PassActions list, XmlNode parentNode) { foreach (XmlNode actionNode in parentNode.ChildNodes) { var action = new PassAction { Name = Util.GetNodeAttributeValue(actionNode, "name"), Type = StringToPassItemType(actionNode.Name), Exclude = Util.GetNodeAttributeValue(actionNode, "exclude") }; if (action.Type == PassActionType.Scan) { GetPassActions(action.Actions, actionNode); } list.Add(action); } }
/// <summary> /// Processes the current action against the currently selected item /// </summary> private void ProcessAction(PlayOnItem currentItem, PassAction action) { var matchPattern = action.Name; var excludePattern = action.Exclude; var foundItem = false; _logManager.Log("Matching \"{0}\"...", matchPattern); using (_logManager.NextLogDepth()) { foreach (var childItem in ((PlayOnFolder) currentItem).Items) { _logManager.LogVerbose("Checking \"{0}\"...", childItem.Name); if (!Util.MatchesPattern(childItem.Name, matchPattern)) continue; if (Util.MatchesPattern(childItem.Name, excludePattern)) { _logManager.LogVerbose("Excluded match."); continue; } foundItem = true; switch (action.Type) { case PassActionType.Scan: if (!(childItem is PlayOnFolder)) continue; using (_logManager.NextLogVerboseDepth()) { _logManager.LogVerbose("Entering \"{0}\"", childItem.Name); ProcessActions(childItem, action.Actions); _logManager.LogVerbose("Leaving \"{0}\"", childItem.Name); } break; case PassActionType.Queue: if (!(childItem is PlayOnVideo)) continue; _logManager.Log("Queuing \"{0}\"...", childItem.Name); using (_logManager.NextLogDepth()) QueueMedia((PlayOnVideo) childItem); break; } } if (!foundItem) _logManager.Log("No matches \"{0}\".", matchPattern); } }
private static void GetPassActions(PassActions list, XmlNode parentNode) { foreach (XmlNode actionNode in parentNode.ChildNodes) { var action = new PassAction { Name = Util.GetNodeAttributeValue(actionNode, "name"), Type = StringToPassItemType(actionNode.Name), Exclude = Util.GetNodeAttributeValue(actionNode, "exclude") }; if (action.Type == PassActionType.Scan) GetPassActions(action.Actions, actionNode); list.Add(action); } }
/// <summary> /// Begins and returns the frame buffer <see cref="Pass" /> with the specified width, height, and /// <see cref="PassAction" />. /// </summary> /// <param name="passAction">The frame buffer pass action.</param> /// <returns>The frame buffer <see cref="Pass" />.</returns> public Pass BeginDefaultPass([In] ref PassAction passAction) { return(App.BeginDefaultPass(ref passAction)); }
/// <summary> /// Begins and returns the frame buffer <see cref="Pass"/> with the specified width, height, and /// <see cref="PassAction" />. /// </summary> /// <param name="passAction">The frame buffer pass action.</param> /// <returns>The frame buffer <see cref="Pass" />.</returns> public static Pass BeginDefaultPass([In] ref PassAction passAction) { return(GraphicsDevice.BeginDefaultPass(_drawableWidth, _drawableHeight, ref passAction)); }
/// <summary> /// Begins and returns the frame buffer <see cref="Pass" /> with the specified width, height, and /// <see cref="PassAction.Clear" /> as the action. /// </summary> /// <param name="clearColor">The color to clear the color attachments.</param> /// <returns>The frame buffer <see cref="Pass" />.</returns> public static Pass BeginDefaultPass(Rgba32F clearColor) { var passAction = PassAction.Clear(clearColor); return(BeginDefaultPass(ref passAction)); }