protected void Finish(HandlerTransfer transfer) { if (End != null) { End(transfer); } }
public void ProcessHandler(HandlerTransfer handler) { switch (handler.Mode) { case HandlerMode.Next: new EndStateTransition(handler).Apply(this); break; case HandlerMode.Push: new PushStateTransition(handler).Apply(this); break; case HandlerMode.Pop: new PopStateTransition(handler).Apply(this); break; } }
public HandlerTransfer Load(XElement node) { HandlerTransfer transfer = new HandlerTransfer(); var modeAttr = node.Attribute("mode"); var mode = HandlerMode.Next; if (modeAttr != null) { Enum.TryParse <HandlerMode>(modeAttr.Value, true, out mode); } transfer.Mode = mode; if (mode == HandlerMode.Push) { transfer.Pause = node.TryAttribute <bool>("pause"); } if (mode != HandlerMode.Pop) { switch (node.RequireAttribute("type").Value.ToLower()) { case "stage": transfer.Type = HandlerType.Stage; break; case "scene": transfer.Type = HandlerType.Scene; break; case "menu": transfer.Type = HandlerType.Menu; break; } transfer.Name = node.RequireAttribute("name").Value; } transfer.Fade = node.TryAttribute <bool>("fade"); return(transfer); }
public void StartHandler(HandlerTransfer handler) { if (handler != null) { switch (handler.Type) { case HandlerType.Scene: StartScene(handler); break; case HandlerType.Stage: StartStage(handler.Name); break; case HandlerType.Menu: StartMenu(handler); break; } } }
private void WriteHandlerTransfer(HandlerTransfer handlerTransfer) { _writer.WriteStartElement("Next"); if (handlerTransfer.Mode != HandlerMode.Next) { _writer.WriteAttributeString("mode", handlerTransfer.Mode.ToString()); } if (handlerTransfer.Mode == HandlerMode.Push) { _writer.WriteAttributeString("pause", handlerTransfer.Pause.ToString()); } if (handlerTransfer.Mode != HandlerMode.Pop) { _writer.WriteAttributeString("type", Enum.GetName(typeof(HandlerType), handlerTransfer.Type)); _writer.WriteAttributeString("name", handlerTransfer.Name); } _writer.WriteAttributeString("fade", handlerTransfer.Fade.ToString()); _writer.WriteEndElement(); }
public void Write(HandlerTransfer info, XmlWriter writer) { writer.WriteStartElement("Next"); if (info.Mode != HandlerMode.Next) { writer.WriteAttributeString("mode", info.Mode.ToString()); } if (info.Mode == HandlerMode.Push) { writer.WriteAttributeString("pause", info.Pause.ToString()); } if (info.Mode != HandlerMode.Pop) { writer.WriteAttributeString("type", Enum.GetName(typeof(HandlerType), info.Type)); writer.WriteAttributeString("name", info.Name); } writer.WriteAttributeString("fade", info.Fade.ToString()); writer.WriteEndElement(); }
public void ProcessHandler(HandlerTransfer handler) { _stateMachine.ProcessHandler(handler); }
public EndStateTransition(HandlerTransfer transfer) { _transfer = transfer; }
public void StartScene(HandlerTransfer handler) { var scene = Scene.Get(handler.Name); StartAndPushToStack(scene); }
public void StartMenu(HandlerTransfer handler) { var menu = Menu.Get(handler.Name); StartAndPushToStack(menu); }
public PushStateTransition(HandlerTransfer transfer) { _transfer = transfer; }