示例#1
0
 protected void Finish(HandlerTransfer transfer)
 {
     if (End != null)
     {
         End(transfer);
     }
 }
示例#2
0
        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;
            }
        }
示例#3
0
        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);
        }
示例#4
0
        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;
                }
            }
        }
示例#5
0
        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();
        }
示例#7
0
 public void ProcessHandler(HandlerTransfer handler)
 {
     _stateMachine.ProcessHandler(handler);
 }
 public EndStateTransition(HandlerTransfer transfer)
 {
     _transfer = transfer;
 }
示例#9
0
        public void StartScene(HandlerTransfer handler)
        {
            var scene = Scene.Get(handler.Name);

            StartAndPushToStack(scene);
        }
示例#10
0
        public void StartMenu(HandlerTransfer handler)
        {
            var menu = Menu.Get(handler.Name);

            StartAndPushToStack(menu);
        }
示例#11
0
 public PushStateTransition(HandlerTransfer transfer)
 {
     _transfer = transfer;
 }