public SectorActionsSupporting(SectorItem sector, GameType gameType, bool isActivePlayer) { this.sector = sector; supportEntries.Add(SectorActions.StraightAllCards, sector.Behavior == SectorBehavior.StaticFree && (gameType == GameType.Solitaire || isActivePlayer)); supportEntries.Add(SectorActions.ChangeAllCardsCharacteristics, sector.Behavior == SectorBehavior.StaticFree && (gameType == GameType.Solitaire || isActivePlayer)); supportEntries.Add(SectorActions.CreatePawn, sector.Behavior == SectorBehavior.StaticFree && (gameType == GameType.Solitaire || isActivePlayer)); supportEntries.Add(SectorActions.Shuffle, sector.Behavior == SectorBehavior.Simple && sector.CardsVisibility == SectorCardsVisibility.Hidden && (gameType == GameType.Solitaire || isActivePlayer)); supportEntries.Add(SectorActions.Mulligan, sector.Code == SystemSectors.HAND.ToString() && (gameType == GameType.Solitaire || isActivePlayer)); supportEntries.Add(SectorActions.MoveCards, (gameType == GameType.Solitaire || isActivePlayer)); supportEntries.Add(SectorActions.MoveCardsToDefaultSector, (sector.Behavior == SectorBehavior.Simple || sector.Behavior == SectorBehavior.CollapsableFlow) && !string.IsNullOrEmpty(sector.DefaultTarget) && (gameType == GameType.Solitaire || isActivePlayer)); supportEntries.Add(SectorActions.MoveTopCards, sector.Behavior == SectorBehavior.Simple && (gameType == GameType.Solitaire || isActivePlayer)); supportEntries.Add(SectorActions.MoveRandomCards, sector.Behavior == SectorBehavior.CollapsableFlow && sector.CardsVisibility != SectorCardsVisibility.Visibile && (gameType == GameType.Solitaire || isActivePlayer)); supportEntries.Add(SectorActions.MoveAllCards, (gameType == GameType.Solitaire || isActivePlayer)); supportEntries.Add(SectorActions.ShowTop, sector.Behavior == SectorBehavior.Simple && sector.CardsVisibility != SectorCardsVisibility.Visibile && (gameType == GameType.Solitaire || isActivePlayer)); supportEntries.Add(SectorActions.ShowRandomCards, sector.Behavior == SectorBehavior.CollapsableFlow && sector.CardsVisibility != SectorCardsVisibility.Visibile && (gameType == GameType.Solitaire || isActivePlayer)); supportEntries.Add(SectorActions.Show, sector.CardsVisibility != SectorCardsVisibility.Visibile && (gameType == GameType.Solitaire || isActivePlayer)); supportEntries.Add(SectorActions.Watch, sector.Behavior == SectorBehavior.Simple && (gameType == GameType.Solitaire || isActivePlayer || sector.CardsVisibility == SectorCardsVisibility.Visibile)); supportEntries.Add(SectorActions.KeepUncovered, sector.CardsVisibility == SectorCardsVisibility.Hidden && (gameType == GameType.Solitaire || isActivePlayer)); }
public SectorItem GetByCode(string code) { SectorItem item = null; XmlNode nodeItem = nodeSectors.SelectSingleNode(string.Concat("item[@code='", code, "']")); if(nodeItem != null) { XmlNode nodeLang = nodeSectorsLang.SelectSingleNode(string.Concat("item[@code='", nodeItem.Attributes["code"].Value, "']")); item = new SectorItem(nodeItem, nodeLang); } return item; }
public LookupView(LookupRules rules, bool readOnly, SectorItem sectorItem, string sectorKey, string playerKey) { InitializeComponent(); this.rules = rules; this.readOnly = readOnly; this.sectorItem = sectorItem; this.sectorKey = sectorKey; this.playerKey = playerKey; cardList.MouseDown += new MouseEventHandler(list_MouseDown); cardList.MouseMove += new MouseEventHandler(list_MouseMove); cardList.MouseUp += new MouseEventHandler(list_MouseUp); cardList.SelectedIndexChanged += new EventHandler(cardList_SelectedIndexChanged); cardList.DragOver += new DragEventHandler(cardList_DragOver); cardList.DragDrop += new DragEventHandler(cardList_DragDrop); sortedCardList.MouseDown += new MouseEventHandler(list_MouseDown); sortedCardList.MouseMove += new MouseEventHandler(list_MouseMove); sortedCardList.MouseUp += new MouseEventHandler(list_MouseUp); sortedCardList.OrderList(0); btnUp.Enabled = !readOnly; btnDown.Enabled = !readOnly; btnBottom.Enabled = !readOnly; btnSort.Enabled = rules.Style == LookupStyle.All; btnSort.Click += new EventHandler(btnSort_Click); btnUp.Click += new EventHandler(btnUp_Click); btnDown.Click += new EventHandler(btnDown_Click); btnBottom.Click += new EventHandler(btnBottom_Click); txtQuickSearch.TextChanged += new EventHandler(txtQuickSearch_TextChanged); string title = string.Empty; switch(rules.Style) { case LookupStyle.KeepVisibleTop: case LookupStyle.Top: title = string.Concat(sectorItem.Name, " (" , rules.Amount, ")"); break; case LookupStyle.All: title = sectorItem.Name; break; } this.Text = title; Localize(); }
public void UpdateData(SectorItem newData) { Data.Name = newData.Name; OnDataChanged(); }
public SectorModel(string key, SectorItem sector) : base(key) { this.Cards = new ModelCollection(this); this.Data = sector; }
public void AddSector(string key, SectorItem sectorItem, SectorActionsSupporting sectorActionsSupporting) { if(sectorItem.Behavior == SectorBehavior.Simple || sectorItem.HasSimpleDuplicate) { SimpleSectorView sectorView = new SimpleSectorView(); sectorView.Name = key; sectorView.SectorItem = sectorItem; sectorView.SetDescription(sectorItem.Name); sectorView.MouseDoubleClick += new MouseEventHandler(sectorView_MouseDoubleClick); sectorView.SetImage(Program.LogicHandler.ServicesProvider.ImagesService.GetSectorBackground(sectorItem.Code)); simpleSectorsContainer.Controls.Add(sectorView); SectorMenuContainer menu = new SectorMenuContainer(); menu.SectorView = sectorView; sectorView.ContextMenuStrip = menu.InnerMenu; } }
public void UpdateSector(string key, SectorItem sectorItem) { }
public void AddSector(string playerKey, string sectorKey, SectorItem sectorItem, SectorActionsSupporting sectorActionsSupporting) { if(InvokeRequired) Invoke(new Action<string, string, SectorItem, SectorActionsSupporting>(AddSector), playerKey, sectorKey, sectorItem, sectorActionsSupporting); else { try { this.sectorActionsSupporting.Add(sectorKey, sectorActionsSupporting); gameStructure.GetPlayer(playerKey).Sectors.Add(new SectorStructure() { SectorKey = sectorKey, Item = sectorItem }); foreach(PlayerView playerView in Controls.Find(playerKey, true).OfType<PlayerView>()) playerView.AddSector(sectorKey, sectorItem, sectorActionsSupporting); foreach(PlayerStatusView playerStatusView in Controls.Find(playerKey, true).OfType<PlayerStatusView>()) playerStatusView.AddSector(sectorKey, sectorItem, sectorActionsSupporting); } catch(Exception ex) { HandleException(ex); } } }
public void UpdateSector(string key, SectorItem sectorItem) { if(InvokeRequired) Invoke(new Action<string, SectorItem>(UpdateSector), key, sectorItem); else { try { foreach(ISectorView sectorView in Controls.Find(key, true)) { sectorView.SetDescription(sectorItem.Name); PlayerStatusView fieldView = GameViewHelper.FindParentPlayerStatusView((Control)sectorView); if(fieldView != null) fieldView.UpdateSector(key, sectorItem); } } catch(Exception ex) { HandleException(ex); } } }