public SceneCommandInfo Load(XElement node, string basePath)
 {
     var info = new SceneAddCommandInfo();
     var nameAttr = node.Attribute("name");
     if (nameAttr != null) info.Name = nameAttr.Value;
     info.Object = node.RequireAttribute("object").Value;
     info.X = node.GetAttribute<int>("x");
     info.Y = node.GetAttribute<int>("y");
     return info;
 }
Ejemplo n.º 2
0
        private void AddCommand(SceneAddCommandInfo command)
        {
            var obj = Info.Objects[command.Object];

            IHandlerObject handler = null;
            if (obj is HandlerSpriteInfo)
            {
                handler = new HandlerSprite(((HandlerSpriteInfo)obj).Sprite, new Point(command.X, command.Y));
            }
            else if (obj is MeterInfo)
            {
                handler = new HandlerMeter(HealthMeter.Create((MeterInfo)obj, false), this);
            }
            handler.Start();
            var name = command.Name ?? Guid.NewGuid().ToString();
            if (!objects.ContainsKey(name)) objects.Add(name, handler);
        }