Ejemplo n.º 1
0
        public TemplateModel(TemplateModel p, IdeCollection <IdeBaseItem> source) : base(source) //copy
        {
            CanBeDefault = true;
            CanEdit      = false;
            _def         = new TemplateDefinition()
            {
                OverlayBlocks = p._def.OverlayBlocks,
                TextBlocks    = p._def.TextBlocks,
                Matches       = p._def.Matches,
            };

            Asset = new AssetController(AssetType.Image);
            Asset.Register(p._def.src);
            _def.src = Asset.SelectedAsset.FullPath;
            Asset.PropertyChanged += AssetUpdated;

            Matches = new IdeCollection <IdeBaseItem>(this);
            Matches.CollectionChanged += (a, b) =>
            {
                BuildMatchDef(b);
            };
            foreach (MatchModel match in p.Matches)
            {
                Matches.Add(new MatchModel(match, Matches));
            }

            OverlayContainer = new BlockContainer(p.OverlayContainer);
            OverlayContainer.OnContainerChanged += (a, b) =>
            {
                _def.OverlayBlocks = OverlayContainer.BuildTemplateBlockDef(b);
            };
            _def.OverlayBlocks = OverlayContainer.BuildTemplateBlockDef(null);
            TextBlockContainer = new BlockContainer(p.TextBlockContainer);
            TextBlockContainer.OnContainerChanged += (a, b) =>
            {
                _def.TextBlocks = TextBlockContainer.BuildTemplateBlockDef(b);
            };
            _def.TextBlocks = TextBlockContainer.BuildTemplateBlockDef(null);

            AddMatchCommand = new RelayCommand(AddMatch);
            AddOverlayConditionalCommand = new RelayCommand(AddOverlayConditional);
            AddOverlaySwitchCommand      = new RelayCommand(AddOverlaySwitch);
            AddTextConditionalCommand    = new RelayCommand(AddTextConditional);
            AddTextSwitchCommand         = new RelayCommand(AddTextSwitch);
            OverlayDropHandler           = new TemplateMainDropHandler()
            {
                IsOverlayHandler = true
            };
            TextDropHandler = new TemplateMainDropHandler()
            {
                IsOverlayHandler = false
            };
            DragHandler = new TemplateMainDragHandler();
        }
Ejemplo n.º 2
0
        public TemplateModel(IdeCollection <IdeBaseItem> source) : base(source) //new
        {
            CanBeDefault = true;
            CanEdit      = false;
            _def         = new TemplateDefinition
            {
                Matches       = new List <Property>(),
                OverlayBlocks = new List <LinkDefinition.LinkWrapper>(),
                TextBlocks    = new List <LinkDefinition.LinkWrapper>(),
            };

            Asset    = new AssetController(AssetType.Image);
            _def.src = Asset.SelectedAsset.FullPath;
            Asset.PropertyChanged += AssetUpdated;


            Matches = new IdeCollection <IdeBaseItem>(this);
            Matches.CollectionChanged += (a, b) =>
            {
                BuildMatchDef(b);
            };
            OverlayContainer = new BlockContainer();
            OverlayContainer.OnContainerChanged += (a, b) =>
            {
                _def.OverlayBlocks = OverlayContainer.BuildTemplateBlockDef(b);
            };
            TextBlockContainer = new BlockContainer();
            TextBlockContainer.OnContainerChanged += (a, b) =>
            {
                _def.TextBlocks = TextBlockContainer.BuildTemplateBlockDef(b);
            };
            AddMatchCommand = new RelayCommand(AddMatch);
            AddOverlayConditionalCommand = new RelayCommand(AddOverlayConditional);
            AddOverlaySwitchCommand      = new RelayCommand(AddOverlaySwitch);
            AddTextConditionalCommand    = new RelayCommand(AddTextConditional);
            AddTextSwitchCommand         = new RelayCommand(AddTextSwitch);
            OverlayDropHandler           = new TemplateMainDropHandler()
            {
                IsOverlayHandler = true
            };
            TextDropHandler = new TemplateMainDropHandler()
            {
                IsOverlayHandler = false
            };
            DragHandler = new TemplateMainDragHandler();
        }
Ejemplo n.º 3
0
        public TemplateModel(TemplateDefinition t, IdeCollection <IdeBaseItem> source) : base(source) //load
        {
            CanBeDefault = true;
            CanEdit      = false;
            _def         = t;

            Asset = new AssetController(AssetType.Image);
            Asset.Register(t.src);
            Asset.PropertyChanged += AssetUpdated;

            Matches = new IdeCollection <IdeBaseItem>(this);
            foreach (var match in t.Matches)
            {
                Matches.Add(new MatchModel(match, Matches));
            }
            Matches.CollectionChanged += (a, b) =>
            {
                BuildMatchDef(b);
            };
            OverlayContainer = new BlockContainer(t.OverlayBlocks);
            OverlayContainer.OnContainerChanged += (a, b) =>
            {
                _def.OverlayBlocks = OverlayContainer.BuildTemplateBlockDef(b);
            };
            TextBlockContainer = new BlockContainer(t.TextBlocks);
            TextBlockContainer.OnContainerChanged += (a, b) =>
            {
                _def.TextBlocks = TextBlockContainer.BuildTemplateBlockDef(b);
            };
            AddMatchCommand = new RelayCommand(AddMatch);
            AddOverlayConditionalCommand = new RelayCommand(AddOverlayConditional);
            AddOverlaySwitchCommand      = new RelayCommand(AddOverlaySwitch);
            AddTextConditionalCommand    = new RelayCommand(AddTextConditional);
            AddTextSwitchCommand         = new RelayCommand(AddTextSwitch);
            OverlayDropHandler           = new TemplateMainDropHandler()
            {
                IsOverlayHandler = true
            };
            TextDropHandler = new TemplateMainDropHandler()
            {
                IsOverlayHandler = false
            };
            DragHandler = new TemplateMainDragHandler();
        }
Ejemplo n.º 4
0
 public TemplateModel(IdeCollection <IdeBaseItem> source) : base(source) //new
 {
     CanBeDefault = true;
     CanEdit      = false;
     _def         = new TemplateDefinition
     {
         Matches       = new List <Property>(),
         OverlayBlocks = new List <LinkDefinition.LinkWrapper>(),
         TextBlocks    = new List <LinkDefinition.LinkWrapper>(),
         rootPath      = ViewModelLocator.GameLoader.ProxyDef.RootPath
     };
     Matches = new IdeCollection <IdeBaseItem>(this);
     Matches.CollectionChanged += (a, b) =>
     {
         BuildMatchDef(b);
     };
     OverlayContainer = new BlockContainer();
     OverlayContainer.OnContainerChanged += (a, b) =>
     {
         _def.OverlayBlocks = OverlayContainer.BuildTemplateBlockDef(b);
     };
     TextBlockContainer = new BlockContainer();
     TextBlockContainer.OnContainerChanged += (a, b) =>
     {
         _def.TextBlocks = TextBlockContainer.BuildTemplateBlockDef(b);
     };
     Asset           = AssetManager.Instance.Assets.FirstOrDefault(x => x.Type == AssetType.Image);
     AddMatchCommand = new RelayCommand(AddMatch);
     AddOverlayConditionalCommand = new RelayCommand(AddOverlayConditional);
     AddOverlaySwitchCommand      = new RelayCommand(AddOverlaySwitch);
     AddTextConditionalCommand    = new RelayCommand(AddTextConditional);
     AddTextSwitchCommand         = new RelayCommand(AddTextSwitch);
     OverlayDropHandler           = new TemplateMainDropHandler()
     {
         IsOverlayHandler = true
     };
     TextDropHandler = new TemplateMainDropHandler()
     {
         IsOverlayHandler = false
     };
     DragHandler = new TemplateMainDragHandler();
 }