Esempio n. 1
0
 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;
 }
Esempio n. 2
0
 public TextBlockDefinitionItemModel(TextBlockDefinitionItemModel t, IdeCollection <IdeBaseItem> source) : base(source)
 {
     _def = new BlockDefinition
     {
     };
     Name = t.Name;
 }
Esempio n. 3
0
 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));
 }
Esempio n. 4
0
        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));
        }
Esempio n. 5
0
 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);
 }
Esempio n. 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);
        }
Esempio n. 7
0
File: Link.cs Progetto: 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);
        }
Esempio n. 8
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);
        }
Esempio n. 9
0
 public PhaseItemModel(GamePhase p, IdeCollection <IdeBaseItem> source) : base(source)
 {
     _phase = p;
     Asset  = new AssetController(AssetType.Image);
     Asset.Register(p.Icon);
     Asset.PropertyChanged += AssetUpdated;
 }
Esempio n. 10
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);
        }
Esempio n. 11
0
File: Option.cs Progetto: 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);
 }
Esempio n. 12
0
        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));
        }
Esempio n. 13
0
 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);
 }
Esempio n. 14
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");
            });
        }
Esempio n. 15
0
 public MarkerItemModel(GameMarker m, IdeCollection <IdeBaseItem> source) : base(source)
 {
     _marker = m;
     Asset   = new AssetController(AssetType.Image);
     Asset.Register(m.Source);
     Asset.PropertyChanged += AssetUpdated;
 }
Esempio n. 16
0
 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;
 }
Esempio n. 17
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));
         }
     }
 }
Esempio n. 18
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);
 }
Esempio n. 19
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);
        }
Esempio n. 20
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);
 }
Esempio n. 21
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);
        }
Esempio n. 22
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);
            };
        }
Esempio n. 23
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);
            };
        }
Esempio n. 24
0
 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;
 }
Esempio n. 25
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));
            }
        }
Esempio n. 26
0
File: Set.cs Progetto: 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;
        }
Esempio n. 27
0
 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";
 }
Esempio n. 28
0
 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;
 }
Esempio n. 29
0
 public GameEventItemModel(GameEventItemModel gameEvent, IdeCollection <IdeBaseItem> source) : base(source) // copy item
 {
     _gameEvent = new GameEvent()
     {
         Name           = gameEvent.Name,
         PythonFunction = gameEvent.PythonFunction.Name
     };
 }
Esempio n. 30
0
 public GameEventItemModel(IdeCollection <IdeBaseItem> source) : base(source) // new item
 {
     _gameEvent = new GameEvent()
     {
         Name           = "Event",
         PythonFunction = ""
     };
 }