public SceneCommandInfo Load(XElement node, string basePath)
        {
            var info = new SceneTextCommandInfo();
            info.Content = node.TryAttribute<string>("content");
            info.Name = node.TryAttribute<string>("name");
            info.Speed = node.TryAttribute<int>("speed");
            info.X = node.GetAttribute<int>("x");
            info.Y = node.GetAttribute<int>("y");

            var bindingNode = node.Element("Binding");
            if (bindingNode != null) info.Binding = _bindingReader.Load(bindingNode);

            info.Font = node.TryAttribute<string>("font");

            return info;
        }
Example #2
0
 private void TextCommand(SceneTextCommandInfo command)
 {
     var obj = new HandlerText(command, Entities);
     obj.Start();
     var name = command.Name ?? Guid.NewGuid().ToString();
     if (!objects.ContainsKey(name)) objects.Add(name, obj);
 }
        public HandlerText(SceneTextCommandInfo info, IEntityPool entityPool)
        {
            this.Content = info.Content ?? String.Empty;
            this.speed = info.Speed ?? 0;
            this.position = new MegaMan.Common.Geometry.Point(info.X, info.Y);
            this.entityPool = entityPool;
            this.font = info.Font ?? "Default";

            if (info.Binding != null)
            {
                this.binding = Binding.Create(info.Binding, this);
            }
        }
 public static SceneTextCommandInfo FromXml(XElement node)
 {
     var info = new SceneTextCommandInfo();
     var contentAttr = node.Attribute("content");
     if (contentAttr != null)
     {
         info.Content = contentAttr.Value;
     }
     var nameAttr = node.Attribute("name");
     if (nameAttr != null) info.Name = nameAttr.Value;
     int speed;
     if (node.TryInteger("speed", out speed)) info.Speed = speed;
     info.X = node.GetInteger("x");
     info.Y = node.GetInteger("y");
     var bindingNode = node.Element("Binding");
     if (bindingNode != null) info.Binding = SceneBindingInfo.FromXml(bindingNode);
     return info;
 }