private void GrayOutSecrets(Point mousePos) { if ( !PointInsideControl(StackPanelSecrets.PointFromScreen(mousePos), StackPanelSecrets.ActualWidth, StackPanelSecrets.ActualHeight)) { return; } var card = ToolTipCard.DataContext as Card; if (card == null) { return; } // 1: normal, 0: grayed out card.Count = card.Count == 0 ? 1 : 0; //reload secrets panel var cards = StackPanelSecrets.Children.OfType <Controls.Card>().Select(c => c.DataContext).OfType <Card>().ToList(); StackPanelSecrets.Children.Clear(); foreach (var c in cards) { var cardObj = new Controls.Card(); cardObj.SetValue(DataContextProperty, c); StackPanelSecrets.Children.Add(cardObj); } //reset secrets when new secret is played _needToRefreshSecrets = true; }
public void ShowSecrets(string hsClass, bool force = false) { if (Config.Instance.HideSecrets && !force) { return; } if (_lastSecretsClass != hsClass || _needToRefreshSecrets) { List <string> ids; switch (hsClass) { case "Hunter": ids = CardIds.SecretIdsHunter; break; case "Mage": ids = CardIds.SecretIdsMage; break; case "Paladin": ids = CardIds.SecretIdsPaladin; break; default: return; } StackPanelSecrets.Children.Clear(); foreach (var id in ids) { var cardObj = new Controls.Card(); cardObj.SetValue(DataContextProperty, Game.GetCardFromId(id)); StackPanelSecrets.Children.Add(cardObj); } _lastSecretsClass = hsClass; _needToRefreshSecrets = false; } StackPanelSecrets.Visibility = Visibility.Visible; }
public void ShowSecrets(bool force = false, HeroClass? heroClass = null) { if(Config.Instance.HideSecrets && !force) return; StackPanelSecrets.Children.Clear(); var secrets = heroClass == null ? Game.OpponentSecrets.GetSecrets() : Game.OpponentSecrets.GetDefaultSecrets(heroClass.Value); foreach(var id in secrets) { var cardObj = new Controls.Card(); var card = Game.GetCardFromId(id.CardId); card.Count = id.AdjustedCount; cardObj.SetValue(DataContextProperty, card); StackPanelSecrets.Children.Add(cardObj); } StackPanelSecrets.Visibility = Visibility.Visible; }
public void ShowSecrets(string hsClass, bool force = false) { if(Config.Instance.HideSecrets && !force) return; if(_lastSecretsClass != hsClass || _needToRefreshSecrets) { List<string> ids; switch(hsClass) { case "Hunter": ids = CardIds.SecretIdsHunter; break; case "Mage": ids = CardIds.SecretIdsMage; break; case "Paladin": ids = CardIds.SecretIdsPaladin; break; default: return; } StackPanelSecrets.Children.Clear(); foreach(var id in ids) { var cardObj = new Controls.Card(); cardObj.SetValue(DataContextProperty, Game.GetCardFromId(id)); StackPanelSecrets.Children.Add(cardObj); } _lastSecretsClass = hsClass; _needToRefreshSecrets = false; } StackPanelSecrets.Visibility = Visibility.Visible; }
private void GrayOutSecrets(Point mousePos) { if( !PointInsideControl(StackPanelSecrets.PointFromScreen(mousePos), StackPanelSecrets.ActualWidth, StackPanelSecrets.ActualHeight)) return; var card = ToolTipCard.DataContext as Card; if(card == null) return; // 1: normal, 0: grayed out card.Count = card.Count == 0 ? 1 : 0; //reload secrets panel var cards = StackPanelSecrets.Children.OfType<Controls.Card>().Select(c => c.DataContext).OfType<Card>().ToList(); StackPanelSecrets.Children.Clear(); foreach(var c in cards) { var cardObj = new Controls.Card(); cardObj.SetValue(DataContextProperty, c); StackPanelSecrets.Children.Add(cardObj); } //reset secrets when new secret is played _needToRefreshSecrets = true; }