예제 #1
0
 public BlockContainer(BlockContainer bc) //copy
 {
     Items = new IdeCollection <IdeBaseItem>(this, typeof(IBaseBlock));
     Items.CollectionChanged += (a, b) =>
     {
         OnContainerChanged?.Invoke(this, b);
     };
     foreach (var block in bc.Items)
     {
         if (block is SwitchBlockModel switchBlock)
         {
             Items.Add(new SwitchBlockModel(switchBlock, Items));
         }
         else if (block is ConditionalBlockModel conditionalBlock)
         {
             Items.Add(new ConditionalBlockModel(conditionalBlock, Items));
         }
         else if (block is TextLinkModel textLink)
         {
             Items.Add(new TextLinkModel(textLink, Items));
         }
         else if (block is OverlayLinkContainer overlayContainer)
         {
             Items.Add(new OverlayLinkContainer(overlayContainer, Items));
         }
         else if (block is ArtOverlayBlockModel artOverlay)
         {
             Items.Add(new ArtOverlayBlockModel(artOverlay, Items));
         }
     }
 }
예제 #2
0
 public SwitchBlockModel(SwitchBlockModel switchItem, IdeCollection <IdeBaseItem> source) : base(source) //copy
 {
     _wrapper = new LinkDefinition.LinkWrapper()
     {
         Conditional = new ConditionalDefinition()
         {
         }
     };
     Property = switchItem.Property;
     Items    = new IdeCollection <IdeBaseItem>(this);
     Items.CollectionChanged += (a, b) =>
     {
         BuildSwitchDefinitions(b);
     };
     foreach (IBaseConditionalCase caseItem in switchItem.Items)
     {
         if (caseItem is SwitchCaseModel switchCase)
         {
             Items.Add(new SwitchCaseModel(switchCase, Items));
         }
         if (caseItem is DefaultCaseModel defaultCase)
         {
             Items.Add(new DefaultCaseModel(defaultCase, Items));
         }
     }
     Messenger.Default.Register <CustomPropertyChangedMessage>(this, action => CustomPropertyChanged(action));
     AddCaseCommand    = new RelayCommand(AddCase);
     AddDefaultCommand = new RelayCommand(AddDefault);
 }
예제 #3
0
        public SwitchBlockModel(LinkDefinition.LinkWrapper lw, IdeCollection <IdeBaseItem> source) : base(source) //load
        {
            _wrapper  = lw;
            _property = (PropertyItemModel)CustomProperties.FirstOrDefault(x => ((PropertyItemModel)x)._property.Name == _wrapper.Conditional.switchProperty);
            Items     = new IdeCollection <IdeBaseItem>(this);
            if (lw.Conditional.switchNodeList != null)
            {
                foreach (var switchcase in lw.Conditional.switchNodeList)
                {
                    Items.Add(new SwitchCaseModel(switchcase, Items));
                }
            }
            Items.CollectionChanged += (a, b) =>
            {
                BuildSwitchDefinitions(b);
            };
            if (lw.Conditional.elseNode != null)
            {
                Items.Add(new DefaultCaseModel(lw.Conditional.elseNode, Items));
            }

            Messenger.Default.Register <CustomPropertyChangedMessage>(this, action => CustomPropertyChanged(action));
            AddCaseCommand    = new RelayCommand(AddCase);
            AddDefaultCommand = new RelayCommand(AddDefault);
        }
예제 #4
0
 public ConditionalBlockModel(LinkDefinition.LinkWrapper lw, IdeCollection <IdeBaseItem> source) : base(source) //load
 {
     _wrapper = lw;
     Items    = new IdeCollection <IdeBaseItem>(this, typeof(IBaseConditionalCase));
     if (lw.Conditional.ifNode != null)
     {
         Items.Add(new IfCaseModel(lw.Conditional.ifNode, Items));
     }
     if (lw.Conditional.elseifNodeList != null)
     {
         foreach (var elseif in lw.Conditional.elseifNodeList)
         {
             Items.Add(new ElseIfCaseModel(elseif, Items));
         }
     }
     if (lw.Conditional.elseNode != null)
     {
         Items.Add(new ElseCaseModel(lw.Conditional.elseNode, Items));
     }
     Items.CollectionChanged += (a, b) =>
     {
         BuildConditionalDefinitions(b);
     };
     AddElseIfCommand = new RelayCommand(AddElseIf);
     AddElseCommand   = new RelayCommand(AddElse);
 }
예제 #5
0
파일: Option.cs 프로젝트: wlk0/OCTGN
 public OptionModel(OptionModel p, IdeCollection <IdeBaseItem> source) : base(source) // copy item
 {
     Option = new Option
     {
         Items       = new List <object>(),
         Probability = p.Probability
     };
     Items = new IdeCollection <IdeBaseItem>(this);
     Items.CollectionChanged += (a, b) =>
     {
         BuildOptionDef(b);
     };
     foreach (var packItem in p.Items)
     {
         if (packItem is PickModel pick)
         {
             Items.Add(new PickModel(pick, Items));
         }
         if (packItem is OptionsModel options)
         {
             Items.Add(new OptionsModel(options, Items));
         }
     }
     AddOptionsCommand = new RelayCommand(AddOptions);
     AddPickCommand    = new RelayCommand(AddPick);
 }
예제 #6
0
        public ConditionalBlockModel(ConditionalBlockModel conditional, IdeCollection <IdeBaseItem> source) : base(source) //copy
        {
            _wrapper = new LinkDefinition.LinkWrapper()
            {
                Conditional = new ConditionalDefinition()
            };

            Items = new IdeCollection <IdeBaseItem>(this, typeof(IBaseConditionalCase));
            Items.CollectionChanged += (a, b) =>
            {
                BuildConditionalDefinitions(b);
            };
            foreach (IBaseConditionalCase caseItem in conditional.Items)
            {
                if (caseItem is IfCaseModel ifCase)
                {
                    Items.Add(new IfCaseModel(ifCase, Items));
                }
                if (caseItem is ElseIfCaseModel elseIfCase)
                {
                    Items.Add(new ElseIfCaseModel(elseIfCase, Items));
                }
                if (caseItem is ElseCaseModel elseCase)
                {
                    Items.Add(new ElseCaseModel(elseCase, Items));
                }
            }
            AddElseIfCommand = new RelayCommand(AddElseIf);
            AddElseCommand   = new RelayCommand(AddElse);
        }
예제 #7
0
 public BlockContainer(List <LinkDefinition.LinkWrapper> items) //load
 {
     Items = new IdeCollection <IdeBaseItem>(this, typeof(IBaseBlock));
     foreach (LinkDefinition.LinkWrapper item in items)
     {
         if (item.Conditional != null)
         {
             if (item.Conditional.switchProperty != null)
             {
                 Items.Add(new SwitchBlockModel(item, Items));
             }
             else if (item.Conditional.ifNode != null)
             {
                 Items.Add(new ConditionalBlockModel(item, Items));
             }
         }
         else if (item.Link != null)
         {
             if (item.Link.IsTextLink)
             {
                 Items.Add(new TextLinkModel(item, Items));
             }
             else
             {
                 OverlayLinkContainer container;
                 if (!(Items.LastOrDefault() is OverlayLinkContainer))
                 {
                     container = new OverlayLinkContainer(Items);
                     Items.Add(container); //adds a new link container at the end
                 }
                 else
                 {
                     container = Items.Last() as OverlayLinkContainer;
                     container.Items.CollectionChanged -= (a, b) =>
                     {
                         OnContainerChanged?.Invoke(this, b);
                     };
                 }
                 container.Items.Add(new OverlayLinkModel(item, container.Items));
                 container.Items.CollectionChanged += (a, b) =>
                 {
                     OnContainerChanged?.Invoke(this, b);
                 };
             }
         }
         else if (item.CardArtCrop != null)
         {
             Items.Add(new ArtOverlayBlockModel(item, Items));
         }
     }
     Items.CollectionChanged += (a, b) =>
     {
         OnContainerChanged?.Invoke(this, b);
     };
 }
예제 #8
0
파일: Link.cs 프로젝트: wlk0/OCTGN
        public TextLinkModel(TextLinkModel link, IdeCollection <IdeBaseItem> source) : base(source)  //copy
        {
            var _linkDefinition = new LinkDefinition()
            {
                Block            = link._wrapper.Link.Block,
                IsTextLink       = true,
                Separator        = link._wrapper.Link.Separator,
                NestedProperties = new List <Property>()
            };

            _wrapper = new LinkDefinition.LinkWrapper()
            {
                Link = _linkDefinition
            };

            Items = new IdeCollection <IdeBaseItem>(this);
            Items.CollectionChanged += (a, b) =>
            {
                BuildPropertyDefinition(b);
            };
            foreach (TextLinkPropertyModel property in link.Items)
            {
                Items.Add(new TextLinkPropertyModel(property, Items));
            }
            AddPropertyCommand = new RelayCommand(AddProperty);
        }
예제 #9
0
        public CardModel(CardModel c, IdeCollection <IdeBaseItem> src) : base(src) //for copying the item
        {
            var guid = Guid.NewGuid();

            _card = new Card(c._card)
            {
                Id = Guid.NewGuid()
            };
            Items = new IdeCollection <IdeBaseItem>(this, typeof(AlternateModel));
            Items.CollectionChanged += (a, b) =>
            {
                BuildCardDef(b);
            };
            foreach (AlternateModel alt in c.Items)
            {
                AlternateModel newAlt = new AlternateModel(alt, Items);
                if (alt.IsDefault)
                {
                    Items.DefaultItem  = newAlt;
                    Items.SelectedItem = newAlt;
                }
                Items.Add(newAlt);
            }

            AddAltCommand = new RelayCommand(AddAlt);
        }
예제 #10
0
파일: Set.cs 프로젝트: wlk0/OCTGN
        public SetModel(Set s, IdeCollection <IdeBaseItem> src) : base(src) // For loading existing set data
        {
            _set      = s;
            CardItems = new IdeCollection <IdeBaseItem>(this);
            foreach (var card in _set.Cards)
            {
                CardItems.Add(new CardModel(card, CardItems));
            }
            CardItems.CollectionChanged += (a, b) =>
            {
                BuildCardDef(b);
            };
            CardItems.SelectedItemChanged += (a, b) =>
            {
                SelectDefaultAlt(b);
            };

            PackageItems = new IdeCollection <IdeBaseItem>(this);
            foreach (var package in _set.Packs)
            {
                PackageItems.Add(new PackageModel(package, PackageItems));
            }
            PackageItems.CollectionChanged += (a, b) =>
            {
                BuildPackageDef(b);
            };

            AddCardCommand    = new RelayCommand(AddCard);
            AddPackageCommand = new RelayCommand(AddPackage);
            ImportCSVCommand  = new RelayCommand(ImportCSV);

            CanDragDrop = false;
        }
예제 #11
0
        public BaseGroupItemModel(BaseGroupItemModel g, IdeCollection <IdeBaseItem> source) : base(source) //copy item
        {
            _group = new Group
            {
                Visibility = g.GroupVisibility,
            };
            Name = g.Name;

            NewActionCommand    = new RelayCommand <IdeCollection <IdeBaseItem> >(NewAction);
            NewSubmenuCommand   = new RelayCommand <IdeCollection <IdeBaseItem> >(NewSubmenu);
            NewSeparatorCommand = new RelayCommand <IdeCollection <IdeBaseItem> >(NewSeparator);
            ActionsDropHandler  = new ActionsDropHandler();

            GroupActions = new IdeCollection <IdeBaseItem>(this, typeof(IBaseAction));
            GroupActions.CollectionChanged += (a, b) =>
            {
                _group.GroupActions = GroupActions.Select(x => ((IBaseAction)x)._action);
            };
            foreach (var item in g.GroupActions)
            {
                GroupActions.Add(IBaseAction.CopyActionItems(item, GroupActions));
            }

            CardActions = new IdeCollection <IdeBaseItem>(this, typeof(IBaseAction));
            CardActions.CollectionChanged += (a, b) =>
            {
                _group.CardActions = CardActions.Select(x => ((IBaseAction)x)._action);
            };
            foreach (var item in g.CardActions)
            {
                CardActions.Add(IBaseAction.CopyActionItems(item, CardActions));
            }
        }
예제 #12
0
        public CardModel(IdeCollection <IdeBaseItem> src) : base(src) //for adding new items
        {
            var guid = Guid.NewGuid();                                //every card has a new GUID

            _card = new Card(
                guid,                                                                              //card guid
                ((SetModel)Source.Parent).Id,                                                      //set guid
                "Card",                                                                            //card name
                guid.ToString(),                                                                   //imageuri
                "",                                                                                //alternate
                ((SizeItemModel)ViewModelLocator.PreviewTabViewModel.CardSizes.DefaultItem)._size, //size
                new Dictionary <string, CardPropertySet>());                                       //property sets

            Items = new IdeCollection <IdeBaseItem>(this);
            Items.CollectionChanged += (a, b) =>
            {
                BuildCardDef(b);
            };
            var baseCardAlt = new AlternateModel(Items)
            {
                CanRemove   = false,
                CanDragDrop = false
            };

            Items.DefaultItem = baseCardAlt;
            Items.Add(baseCardAlt);

            AddAltCommand = new RelayCommand(AddAlt);
        }
예제 #13
0
파일: Set.cs 프로젝트: wlk0/OCTGN
        public void AddPackage()
        {
            var ret = new PackageModel(PackageItems);

            PackageItems.Add(ret);
            PackageItems.SelectedItem = ret;
        }
예제 #14
0
        public GroupItemModel(Group g, IdeCollection <IdeBaseItem> source) : base(source) //load
        {
            NewActionCommand    = new RelayCommand <IdeCollection <IdeBaseItem> >(NewAction);
            NewSubmenuCommand   = new RelayCommand <IdeCollection <IdeBaseItem> >(NewSubmenu);
            NewSeparatorCommand = new RelayCommand <IdeCollection <IdeBaseItem> >(NewSeparator);
            ActionsDropHandler  = new ActionsDropHandler();

            _group       = g;
            GroupActions = new IdeCollection <IdeBaseItem>(this);
            foreach (var action in g.GroupActions)
            {
                GroupActions.Add(IBaseAction.CreateActionItem(action, GroupActions));
            }
            GroupActions.CollectionChanged += (a, b) =>
            {
                _group.GroupActions = GroupActions.Select(x => ((IBaseAction)x)._action);
            };
            CardActions = new IdeCollection <IdeBaseItem>(this);
            foreach (var action in g.CardActions)
            {
                CardActions.Add(IBaseAction.CreateActionItem(action, CardActions));
            }
            CardActions.CollectionChanged += (a, b) =>
            {
                _group.CardActions = CardActions.Select(x => ((IBaseAction)x)._action);
            };
        }
예제 #15
0
        public SetTabViewModel()
        {
            AddSetCommand = new RelayCommand(AddSet);

            Items = new IdeCollection <IdeBaseItem>(this);

            var setSerializer = new SetSerializer()
            {
                Game = ViewModelLocator.GameLoader.Game
            };

            var setAssets = ViewModelLocator.AssetsTabViewModel.Assets.Where(x => x.Type == AssetType.Xml && x.Name == "set");

            foreach (var asset in setAssets)
            {
                asset.IsReserved = true;
                asset.LockName   = true;
                var set      = (Set)setSerializer.Deserialize(asset.TargetFilePath);
                var setModel = new SetModel(set, Items);
                Items.Add(setModel);
            }

            Items.CollectionChanged += (a, b) =>
            {
                //            ViewModelLocator.GameLoader.Sets = Items.Select(x => ((SetModel)x)._set);
            };
        }
예제 #16
0
        public DeckSectionTabViewModel()
        {
            AddCommand             = new RelayCommand(AddItem);
            AddGlobalCommand       = new RelayCommand(AddGlobalItem);
            DeckSectionDropHandler = new DeckSectionDropHandler();

            Items = new IdeCollection <IdeBaseItem>(this, typeof(DeckSectionItemModel));
            foreach (var deckSection in ViewModelLocator.GameLoader.Game.DeckSections.Values)
            {
                Items.Add(new DeckSectionItemModel(deckSection, Items));
            }
            Items.CollectionChanged += (sender, args) =>
            {
                ViewModelLocator.GameLoader.Game.DeckSections = Items.ToDictionary(x => ((DeckSectionItemModel)x).Name, y => ((DeckSectionItemModel)y)._deckSection);
            };
            GlobalItems = new IdeCollection <IdeBaseItem>(this, typeof(DeckSectionItemModel));
            foreach (var globalDeckSection in ViewModelLocator.GameLoader.Game.SharedDeckSections.Values)
            {
                GlobalItems.Add(new DeckSectionItemModel(globalDeckSection, GlobalItems));
            }
            GlobalItems.CollectionChanged += (sender, args) =>
            {
                ViewModelLocator.GameLoader.Game.SharedDeckSections = GlobalItems.ToDictionary(x => ((DeckSectionItemModel)x).Name, y => ((DeckSectionItemModel)y)._deckSection);
            };


            Messenger.Default.Register <GroupChangedMessage>(this, x =>
            {
                RaisePropertyChanged("HasPiles");
                RaisePropertyChanged("HasGlobalPiles");
            });
        }
예제 #17
0
파일: Alternate.cs 프로젝트: wlk0/OCTGN
        public AlternateModel(AlternateModel a, IdeCollection <IdeBaseItem> source) : base(source) //for copying the item
        {
            _altDef = new CardPropertySet()
            {
                Size       = a._altDef.Size,
                Properties = a._altDef.Properties.ToDictionary(x => x.Key, x => x.Value),
                Name       = a.Name
            };
            Type  = a.Type;
            Items = new IdeCollection <CardPropertyModel>(this);
            Items.CollectionChanged += (c, b) =>
            {
                BuildAltDef(b);
            };
            foreach (var prop in _altDef.Properties)
            {
                Items.Add(new CardPropertyModel
                {
                    Property   = ViewModelLocator.PropertyTabViewModel.Items.First(y => (y as PropertyItemModel)._property.Equals(prop.Key)) as PropertyItemModel,
                    _value     = prop.Value,
                    _isDefined = prop.Value != null,
                    Parent     = this
                });
            }

            DeleteImageCommand = new RelayCommand(DeleteImage);
            Messenger.Default.Register <CustomPropertyChangedMessage>(this, action => CustomPropertyChanged(action));
            Messenger.Default.Register <CardSizeChangedMesssage>(this, action => CardSizeChanged(action));
        }
예제 #18
0
        public CardModel(CardModel c, IdeCollection <IdeBaseItem> src) : base(src) //for copying the item
        {
            var guid = Guid.NewGuid();

            _card = new Card(c._card)
            {
                Id       = Guid.NewGuid(),
                ImageUri = guid.ToString()
            };
            Items = new IdeCollection <IdeBaseItem>(this);
            Items.CollectionChanged += (a, b) =>
            {
                BuildCardDef(b);
            };
            foreach (AlternateModel alt in c.Items)
            {
                AlternateModel newAlt = new AlternateModel(alt, Items);
                if (alt.IsDefault)
                {
                    newAlt.CanDragDrop = false;
                    newAlt.CanRemove   = false;
                    Items.DefaultItem  = newAlt;
                }
                Items.Add(newAlt);
            }

            AddAltCommand = new RelayCommand(AddAlt);
        }
예제 #19
0
        public SetModel(SetModel s, IdeCollection <IdeBaseItem> src) : base(src) //for copying the item
        {
            _set = new Set()
            {
                Name        = s._set.Name,
                Id          = Guid.NewGuid(),
                GameId      = s._set.GameId,
                Hidden      = s._set.Hidden,
                ShortName   = s._set.ShortName,
                Description = s._set.Description,
                ReleaseDate = s._set.ReleaseDate
            };

            var setAsset = ViewModelLocator.AssetsTabViewModel.NewAsset(new string[] { "Sets", _set.Id.ToString() }, "set", ".xml");

            _set.Filename     = setAsset.FullPath;
            _set.ImagePackUri = Path.Combine(Config.Instance.ImageDirectoryFull, _set.GameId.ToString(), "Sets", _set.Id.ToString());

            setAsset.IsReserved = true;
            setAsset.LockName   = true;
            Asset = new AssetController(AssetType.Xml);
            Asset.SelectedAsset    = setAsset;
            Asset.PropertyChanged += AssetUpdated;

            CardItems = new IdeCollection <IdeBaseItem>(this, typeof(CardModel));
            CardItems.CollectionChanged += (a, b) =>
            {
                BuildCardDef(b);
            };
            CardItems.SelectedItemChanged += (a, b) =>
            {
                SelectDefaultAlt(b);
            };
            foreach (CardModel card in s.CardItems)
            {
                CardItems.Add(new CardModel(card, CardItems));
            }

            PackageItems = new IdeCollection <IdeBaseItem>(this, typeof(PackageModel));
            PackageItems.CollectionChanged += (a, b) =>
            {
                BuildPackageDef(b);
            };
            foreach (PackageModel package in s.PackageItems)
            {
                PackageItems.Add(new PackageModel(package, PackageItems));
            }
            ;

            AddCardCommand    = new RelayCommand(AddCard);
            AddPackageCommand = new RelayCommand(AddPackage);
            ImportCSVCommand  = new RelayCommand(ImportCSV);

            CanDragDrop = false;
        }
예제 #20
0
 public PackageModel(PackageModel p, IdeCollection <IdeBaseItem> src) : base(src) //copying item
 {
     _pack = new Pack
     {
         Name     = p.Name,
         Id       = Guid.NewGuid(),
         Set      = p._pack.Set,
         Items    = new List <object>(),
         Includes = new List <Include>()
     };
     Items = new IdeCollection <IdeBaseItem>(this);
     Items.CollectionChanged += (a, b) =>
     {
         BuildPackDef(b);
     };
     foreach (var packItem in p.Items)
     {
         if (packItem is PickModel pick)
         {
             Items.Add(new PickModel(pick, Items));
         }
         else if (packItem is OptionsModel options)
         {
             Items.Add(new OptionsModel(options, Items));
         }
     }
     Includes = new IdeCollection <IdeBaseItem>(this);
     Includes.CollectionChanged += (a, b) =>
     {
         BuildIncludesDef(b);
     };
     foreach (IncludeModel include in p.Includes)
     {
         Includes.Add(new IncludeModel(include, Includes));
     }
     PackageDropHandler  = new PackageDropHandler();
     IncludeDropHandler  = new PackageDropHandler();
     GeneratePackCommand = new RelayCommand(GeneratePack);
     AddOptionsCommand   = new RelayCommand(AddOptions);
     AddPickCommand      = new RelayCommand(AddPick);
     AddIncludeCommand   = new RelayCommand(AddInclude);
 }
예제 #21
0
 public ActionSubmenuItemModel(IdeCollection <IdeBaseItem> source) : base(source) //new item
 {
     _action = new GroupActionSubmenu();
     Items   = new IdeCollection <IdeBaseItem>(this);
     Items.CollectionChanged += (a, b) =>
     {
         ((GroupActionSubmenu)_action).Children = Items.Select(x => ((ActionSubmenuItemModel)x)._action);
     };
     Name = "New Submenu";
     Items.Add(new ActionItemModel(Items));
 }
예제 #22
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();
        }
예제 #23
0
        public OptionsModel(IdeCollection <IdeBaseItem> source) : base(source) // new item
        {
            _options = new OptionsList();

            Items = new IdeCollection <IdeBaseItem>(this, typeof(OptionModel));
            Items.CollectionChanged += (a, b) =>
            {
                BuildOptionsDef(b);
            };
            Items.Add(new OptionModel(Items));
            AddOptionCommand = new RelayCommand(AddOption);
        }
예제 #24
0
 public ActionSubmenuItemModel(GroupActionSubmenu a, IdeCollection <IdeBaseItem> source) : base(source)  //load item
 {
     _action = a;
     Items   = new IdeCollection <IdeBaseItem>(this);
     foreach (var action in a.Children)
     {
         Items.Add(CreateActionItem(action, Items));
     }
     Items.CollectionChanged += (b, c) =>
     {
         ((GroupActionSubmenu)_action).Children = Items.Select(x => ((ActionSubmenuItemModel)x)._action);
     };
 }
예제 #25
0
파일: Option.cs 프로젝트: wlk0/OCTGN
 public OptionModel(Option o, IdeCollection <IdeBaseItem> source) : base(source) // load item
 {
     Option = o;
     Items  = new IdeCollection <IdeBaseItem>(this);
     Items.CollectionChanged += (a, b) =>
     {
         BuildOptionDef(b);
     };
     foreach (var item in o.Items)
     {
         if (item is OptionsList options)
         {
             Items.Add(new OptionsModel(options, Items));
         }
         else if (item is Pick pick)
         {
             Items.Add(new PickModel(pick, Items));
         }
     }
     AddOptionsCommand = new RelayCommand(AddOptions);
     AddPickCommand    = new RelayCommand(AddPick);
 }
예제 #26
0
        public PropertyTabViewModel()
        {
            Items = new IdeCollection <IdeBaseItem>(this);
            foreach (var property in ViewModelLocator.GameLoader.Game.CustomProperties)
            {
                Items.Add(new PropertyItemModel(property, Items));
            }
            Items.CollectionChanged += (sender, args) =>
            {
                ViewModelLocator.GameLoader.Game.CustomProperties = Items.Select(x => ((PropertyItemModel)x)._property).ToList();
                Messenger.Default.Send(new CustomPropertyChangedMessage(args));
            };
            AddCommand = new RelayCommand(AddItem);

            //TODO: Make sure these property names aren't already set

            NameProperty = new PropertyItemModel(new PropertyDef()
            {
                Name = "Name"
            }, Items);
            IdProperty = new PropertyItemModel(new PropertyDef()
            {
                Name = "Id"
            }, Items);
            AlternateProperty = new PropertyItemModel(new PropertyDef()
            {
                Name = "Alternate"
            }, Items);
            SizeProperty = new PropertyItemModel(new PropertyDef()
            {
                Name = "CardSize"
            }, Items);
            //Proxy Properties
            ProxyNameProperty = new PropertyItemModel(new PropertyDef()
            {
                Name = "CardName"
            }, Items);
            SizeNameProperty = new PropertyItemModel(new PropertyDef()
            {
                Name = "CardSizeName"
            }, Items);
            SizeHeightProperty = new PropertyItemModel(new PropertyDef()
            {
                Name = "CardSizeHeight"
            }, Items);
            SizeWidthProperty = new PropertyItemModel(new PropertyDef()
            {
                Name = "CardSizeWidth"
            }, Items);
        }
예제 #27
0
 public PropertyTabViewModel()
 {
     Items = new IdeCollection <IdeBaseItem>(this, typeof(PropertyItemModel));
     foreach (var property in ViewModelLocator.GameLoader.Game.CardProperties.Values)
     {
         Items.Add(new PropertyItemModel(property, Items));
     }
     Items.CollectionChanged += (sender, args) =>
     {
         ViewModelLocator.GameLoader.Game.CardProperties = Items.ToDictionary(x => ((PropertyItemModel)x).Name, y => ((PropertyItemModel)y)._property);
         Messenger.Default.Send(new CustomPropertyChangedMessage(args));
     };
     AddCommand = new RelayCommand(AddItem);
 }
예제 #28
0
        public SymbolTabViewModel()
        {
            AddCommand = new RelayCommand(AddItem);

            Items = new IdeCollection <IdeBaseItem>(this);
            foreach (var symbol in ViewModelLocator.GameLoader.Game.Symbols)
            {
                Items.Add(new SymbolItemModel(symbol, Items));
            }
            Items.CollectionChanged += (a, b) =>
            {
                ViewModelLocator.GameLoader.Game.Symbols = Items.Select(x => (x as SymbolItemModel)._symbol).ToList();
            };
        }
예제 #29
0
파일: Pick.cs 프로젝트: llebel/OCTGN
 public PickModel(IdeCollection <IdeBaseItem> source) : base(source) // new item
 {
     _pick = new Pick()
     {
         Properties = new List <PickProperty>()
     };
     Items = new IdeCollection <IdeBaseItem>(this, typeof(PackagePropertyModel));
     Items.CollectionChanged += (a, b) =>
     {
         BuildPickDef(b);
     };
     Items.Add(new PackagePropertyModel(Items));
     AddPropertyCommand = new RelayCommand(AddProperty);
 }
예제 #30
0
 public OptionsModel(OptionsModel p, IdeCollection <IdeBaseItem> source) : base(source) // copy item
 {
     _options = new OptionsList();
     Items    = new IdeCollection <IdeBaseItem>(this, typeof(OptionModel));
     Items.CollectionChanged += (a, b) =>
     {
         BuildOptionsDef(b);
     };
     foreach (OptionModel item in p.Items)
     {
         Items.Add(new OptionModel(item, Items));
     }
     AddOptionCommand = new RelayCommand(AddOption);
 }