public GameModeItemModel(GameMode g, IdeCollection <IdeBaseItem> source) : base(source) // load item { _gameMode = g; Asset = new AssetController(AssetType.Image); Asset.Register(g.Image); Asset.PropertyChanged += AssetUpdated; }
public TextBlockDefinitionItemModel(TextBlockDefinitionItemModel t, IdeCollection <IdeBaseItem> source) : base(source) { _def = new BlockDefinition { }; Name = t.Name; }
public PackagePropertyModel(PackagePropertyModel p, IdeCollection <IdeBaseItem> src) : base(src) // copy item { PropertyDef = new PickProperty(); ActiveProperty = p.ActiveProperty; PropertyDef.Value = p.PropertyDef.Value; Messenger.Default.Register <CustomPropertyChangedMessage>(this, action => CustomPropertyChanged(action)); }
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)); }
public PackageModel(IdeCollection <IdeBaseItem> src) : base(src) //new item { _pack = new Pack { Name = "Package", Id = Guid.NewGuid(), Items = new List <object>(), Set = ((SetModel)Source.Parent)._set }; Items = new IdeCollection <IdeBaseItem>(this); Items.CollectionChanged += (a, b) => { BuildPackDef(b); }; Includes = new IdeCollection <IdeBaseItem>(this); Includes.CollectionChanged += (a, b) => { BuildIncludesDef(b); }; PackageDropHandler = new PackageDropHandler(); GeneratePackCommand = new RelayCommand(GeneratePack); AddOptionsCommand = new RelayCommand(AddOptions); AddPickCommand = new RelayCommand(AddPick); AddIncludeCommand = new RelayCommand(AddInclude); }
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); }
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); }
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); }
public PhaseItemModel(GamePhase p, IdeCollection <IdeBaseItem> source) : base(source) { _phase = p; Asset = new AssetController(AssetType.Image); Asset.Register(p.Icon); Asset.PropertyChanged += AssetUpdated; }
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); }
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); }
public MatchModel(Property property, IdeCollection <IdeBaseItem> source) : base(source) //load match { _match = property; _property = (PropertyItemModel)CustomProperties.FirstOrDefault(x => ((PropertyItemModel)x)._property.Name == _match.Name); Messenger.Default.Register <CustomPropertyChangedMessage>(this, action => CustomPropertyChanged(action)); }
public SymbolItemModel(IdeCollection <IdeBaseItem> source) : base(source) // new item { _symbol = new Symbol(); Name = "New Symbol"; Id = "symbol"; Asset = AssetManager.Instance.Assets.FirstOrDefault(x => x.Type == AssetType.Image); }
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"); }); }
public MarkerItemModel(GameMarker m, IdeCollection <IdeBaseItem> source) : base(source) { _marker = m; Asset = new AssetController(AssetType.Image); Asset.Register(m.Source); Asset.PropertyChanged += AssetUpdated; }
public SymbolItemModel(Symbol s, IdeCollection <IdeBaseItem> source) : base(source) // load item { _symbol = s; Asset = new AssetController(AssetType.Image); Asset.Register(s.Source); Asset.PropertyChanged += AssetUpdated; }
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)); } } }
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); }
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); }
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); }
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); }
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); }; }
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); }; }
public OverlayBlockDefinitionItemModel(BlockDefinition b, IdeCollection <IdeBaseItem> source) : base(source) // load overlay { _def = b; Asset = new AssetController(AssetType.Image); Asset.Register(b.src); Asset.PropertyChanged += AssetUpdated; }
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)); } }
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; }
public DocumentItemModel(IdeCollection <IdeBaseItem> source) : base(source) // new item { _document = new Document(); DocumentAsset = AssetManager.Instance.Assets.FirstOrDefault(x => x.Type == AssetType.Document); IconAsset = AssetManager.Instance.Assets.FirstOrDefault(x => x.Type == AssetType.Image); Name = "New Document"; }
public BoardItemModel(GameBoard g, IdeCollection <IdeBaseItem> source) : base(source) // load item { CanBeDefault = true; _board = g; Asset = new AssetController(AssetType.Image); Asset.Register(g.Source); Asset.PropertyChanged += AssetUpdated; }
public GameEventItemModel(GameEventItemModel gameEvent, IdeCollection <IdeBaseItem> source) : base(source) // copy item { _gameEvent = new GameEvent() { Name = gameEvent.Name, PythonFunction = gameEvent.PythonFunction.Name }; }
public GameEventItemModel(IdeCollection <IdeBaseItem> source) : base(source) // new item { _gameEvent = new GameEvent() { Name = "Event", PythonFunction = "" }; }