void DetermineCardFlip(CardVisibility visibility) { switch (visibility) { // only show backside case CardVisibility.None: _backsideUI.gameObject.SetActive(true); break; // show the owning player case CardVisibility.Player: _backsideUI.gameObject.SetActive(false); break; // show everyone case CardVisibility.Everyone: _backsideUI.gameObject.SetActive(false); break; default: Debug.Log("Card visibility undefined..."); break; } }
public static void RaiseMoveCards(GameView gameView, List<CardView> cardViews, string targetSectorCode, CardPositionOffset offset, CardVisibility? visibility) { foreach(var cardsByOwner in cardViews.GroupBy(c => c.CardViewItem.OwnerPlayerKey)) { List<CardPosition> positions; PlayerStructure ownerPlayer = gameView.GameStructure.GetPlayer(cardsByOwner.Key); ISectorView targetSectorView = (ISectorView)gameView.Controls.Find(ownerPlayer.Sectors.Single(e => e.Item.Code == targetSectorCode).SectorKey, true).First(); if(GameViewHelper.TryGetSectorValidCardPositions(targetSectorView, offset, cardsByOwner.Count(), out positions)) gameView.Controller.MoveCards(cardsByOwner.Select(e => e.Name).ToList(), targetSectorCode, positions, visibility); } }
public static void RaiseMoveCards(GameView gameView, List<CardView> cardViews, string targetSectorCode, CardVisibility? visibility) { RaiseMoveCards(gameView, cardViews, targetSectorCode, CardPositionOffset.Top, visibility); }
void SaveState() { oldPosition = this.Position.Value; oldVisibility = this.Visibility.Value; oldReversed = this.Reversed.Value; oldLocked = this.Locked.Value; oldRotated = this.Rotated.Value; oldCustomCharacteristics = this.CustomCharacteristics.Value; oldTokens = this.Tokens.ToList(); }
public virtual void Discard(CardPlayer player) { Visibility = CardVisibility.None; }
public virtual void Draw(CardPlayer player) { Visibility = CardVisibility.Player; }
public virtual void Play(ITargetable target) { Visibility = CardVisibility.Everyone; }
public void SetVisibility(CardVisibility visibility, int hiddenCode) { cardViewItem.Visibility = visibility; cardViewItem.HiddenCode = hiddenCode; ApplyCardBehavior(); }
public static void LogMovement(GameModel game, string executorPlayerKey, CardModel card, SectorModel fromSector, SectorModel toSector, int fromIndex, int toIndex, CardVisibility? toCardVisibility, bool verbose) { if(fromSector.Key == toSector.Key && fromSector.Data.Behavior != SectorBehavior.Simple) return; IEnumerable<SectorModel> sectors = game.Players.Cast<PlayerModel>().SelectMany(e => e.Sectors).Cast<SectorModel>(); SectorCardsVisibility fromSectorVisibility = sectors.First(e => e.Data.Code == fromSector.Data.Code).Data.CardsVisibility; SectorCardsVisibility toSectorVisibility = sectors.First(e => e.Data.Code == toSector.Data.Code).Data.CardsVisibility; PlayerModel fromPlayer = (PlayerModel)fromSector.Parent; PlayerModel toPlayer = (PlayerModel)toSector.Parent; PlayerModel executorPlayer = game.GetPlayerByKey(executorPlayerKey); MessageContent logContent = new MessageContent(); StringBuilder logText = new StringBuilder(200); if(verbose) { logText.Append("[").Append(executorPlayer.Info.NickName).Append("] "); logText.Append(game.GetCommandByKey(MoveCardsCommand.COMMANDCODE_SINGLE).Data.Name).Append(" "); } bool fromVisible = fromSectorVisibility == SectorCardsVisibility.Visibile || (fromSectorVisibility == SectorCardsVisibility.Private && fromPlayer.Key == game.ActivePlayer.Key); if(fromVisible) { fromVisible = (card.Visibility.Value == CardVisibility.Visible || (card.Visibility.Value == CardVisibility.Private && fromPlayer.Key == game.ActivePlayer.Key)); } bool toVisible = toSectorVisibility == SectorCardsVisibility.Visibile || (toSectorVisibility == SectorCardsVisibility.Private && toPlayer.Key == game.ActivePlayer.Key); if(toVisible) { if(toCardVisibility.HasValue) toVisible = (toCardVisibility.Value == CardVisibility.Visible || (toCardVisibility.Value == CardVisibility.Private && toPlayer.Key == game.ActivePlayer.Key)); else toVisible = (card.Visibility.Value == CardVisibility.Visible || (card.Visibility.Value == CardVisibility.Private && toPlayer.Key == game.ActivePlayer.Key)); } logContent.Add(logText.ToString()); logText.Length = 0; logContent.Add(EncodeCardSmartName(card, fromVisible || toVisible)); if(verbose) { logText.Append(" ("); if(fromPlayer.Key != executorPlayerKey) logText.Append(fromPlayer.Info.NickName).Append("-"); logText.Append(fromSector.Data.Name); if(fromSector.Data.Behavior == SectorBehavior.Simple) logText.Append("[").Append(fromIndex + 1).Append("]"); logText.Append(">"); if(toPlayer.Key != executorPlayerKey) logText.Append(toPlayer.Info.NickName).Append("-"); logText.Append(toSector.Data.Name); if(toSector.Data.Behavior == SectorBehavior.Simple) logText.Append("[").Append(toIndex + 1).Append("]"); logText.Append(")"); } else { if(fromSector.Data.Behavior == SectorBehavior.Simple) logText.Append("[").Append(fromIndex + 1).Append("]"); if(toSector.Data.Behavior == SectorBehavior.Simple) logText.Append("[").Append(toIndex + 1).Append("]"); } logContent.Add(logText.ToString()); game.Console.WriteLog(logContent); }
public void SetCardVisibility(string key, CardVisibility visibility, int hiddenCode) { if(InvokeRequired) Invoke(new Action<string, CardVisibility, int>(SetCardVisibility), key, visibility, hiddenCode); else { try { foreach(CardView card in Controls.Find(key, true)) card.SetVisibility(visibility, hiddenCode); } catch(Exception ex) { HandleException(ex); } } }