public GameResultCard(CardColor color, CardPosition position) { this.color = color; this.position = position; this.Init(); }
public Card(CardValue value, CardColor color) { Value = value; Color = color; Type = ToType(value); DrawColor = ToColor(color); }
void MakeCard(CardColor color, CardStack stack) { GameObject cardObject = Instantiate(cardPrefab, stack.transform.position, Quaternion.identity, transform) as GameObject; cardObject.GetComponent <Card>().color = color; stack.ReceiveCard(cardObject); }
private static void OnObjAiBaseProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { try { if (!sender.IsMe) { return; } if (args.SData.Name == "PickACard") { Status = SelectStatus.Selecting; } if (args.SData.Name == "goldcardlock") { LastCard = CardColor.Gold; Status = SelectStatus.Selected; } else if (args.SData.Name == "bluecardlock") { LastCard = CardColor.Blue; Status = SelectStatus.Selected; } else if (args.SData.Name == "redcardlock") { LastCard = CardColor.Red; Status = SelectStatus.Selected; } } catch (Exception ex) { Global.Logger.AddItem(new LogItem(ex)); } }
private int GetWHits(Obj_AI_Base target, List <Obj_AI_Base> targets = null, CardColor color = CardColor.Gold) { try { if (targets != null && color == CardColor.Red) { targets = targets.Where(t => t.IsValidTarget((W.Range + W.Width) * 1.5f)).ToList(); var pred = W.GetPrediction(target); if (pred.Hitchance >= HitChance.Medium) { var circle = new Geometry.Polygon.Circle(pred.UnitPosition, target.BoundingRadius + WRedRadius); return(1 + (from t in targets.Where(x => x.NetworkId != target.NetworkId) let pred2 = W.GetPrediction(t) where pred2.Hitchance >= HitChance.Medium select new Geometry.Polygon.Circle(pred2.UnitPosition, t.BoundingRadius * 0.9f)).Count( circle2 => circle2.Points.Any(p => circle.IsInside(p)))); } } if (W.IsInRange(target)) { return(1); } } catch (Exception ex) { Global.Logger.AddItem(new LogItem(ex)); } return(0); }
static Cards() { LastCard = CardColor.None; ShouldSelect = new List <CardColor>(); Obj_AI_Base.OnProcessSpellCast += OnObjAiBaseProcessSpellCast; Game.OnUpdate += OnGameUpdate; }
public override void EndTurn() { UnoCard topCard = this.Piles["DiscardPile"][0]; this._playClr = topCard.Color; this._playNum = topCard.Value; }
public void ClickColor() { var buttonSelf = UnityEngine.EventSystems.EventSystem.current.currentSelectedGameObject; if (buttonSelf.name == "ButtonRed") { suppressColor = CardColor.Red; } if (buttonSelf.name == "ButtonGreen") { suppressColor = CardColor.Green; } if (buttonSelf.name == "ButtonGray") { suppressColor = CardColor.Gray; } if (buttonSelf.name == "ButtonPurple") { suppressColor = CardColor.Purple; } foreach (var button in colors) { button.SetActive(false); } SetCondition(true); }
private void BuildConnection(int objectId, CardColor color, Player player) { var connection = MapConnections.Single(c => c.Connection.Id == objectId); List <Card> cards; if (connection.Connection.IsTunnel) { int nesessaryAdditionalCards = 0; for (int i = 0; i < 3; i++) { var card = Deck.Dequeue(); if (card.Color == color) { nesessaryAdditionalCards++; } } cards = player.BuildTunnel(color, connection.Connection.Length + nesessaryAdditionalCards); if (cards != null) { Players.Single(p => p.Color == player.Color).Cards.RemoveAll(pc => cards.Select(c => c.Id).ToList().Contains(pc.Id)); } return; } cards = player.BuildTunnel(color, connection.Connection.Length); Players.Single(p => p.Color == player.Color).Cards.RemoveAll(pc => cards.Select(c => c.Id).ToList().Contains(pc.Id)); }
public Card(string value, CardColor type, string owner) { this.color = type; this.value = value; isOnScreen = false; this.owner = owner; }
//bool selected = false; public Card(ContentManager cm, float scale, Point pos, CardColor cardColor, int cardID) { //Load content backOfCard = cm.Load<Texture2D>("backofcard"); frameSheet = cm.Load<Texture2D>("frameSheet"); numberSheet = cm.Load<Texture2D>("numbers"); this.scale = scale; hexWidth = (int)(backOfCard.Width); hexHeight = (int)(backOfCard.Height); radius = hexWidth / 2 * scale; //Assign Numbers this.cardColor = cardColor; Tuple<byte, byte, byte> cardNumbers = CardNumbers(cardID); TopNumber = cardNumbers.Item1; LeftNumber = cardNumbers.Item2; RightNumber = cardNumbers.Item3; //Position Card Elements drawRectangle = new Rectangle(0, 0, (int)(hexWidth * scale), (int)(hexHeight * scale)); drawRectangle.Location = pos; frameRectangle = new Rectangle((int)cardColor * hexWidth, 0, hexWidth, hexHeight); //This just defines the size of the draw rectangle for the numbers topNumSource = new Rectangle(TopNumber * 18, 0, 18, 22); leftNumSource = new Rectangle(LeftNumber * 18, 0, 18, 22); rightNumSource = new Rectangle(RightNumber * 18, 0, 18, 22); }
public GameResultCard(CardColor color) { this.color = color; this.position = CardPosition.Center; this.Init(); }
public void ChangeColor() { CardColor FakeColorToChange = CardColor.Blue; if (EventSystem.current.IsPointerOverGameObject() && EventSystem.current.currentSelectedGameObject != null && EventSystem.current.currentSelectedGameObject.GetComponent <Button>() != null) { Button clickedButton = EventSystem.current.currentSelectedGameObject.GetComponent <Button>(); if (clickedButton.name == "RED") { FakeColorToChange = CardColor.Red; } else if (clickedButton.name == "GREEN") { FakeColorToChange = CardColor.Green; } else if (clickedButton.name == "BLUE") { FakeColorToChange = CardColor.Blue; } else if (clickedButton.name == "YELLOW") { FakeColorToChange = CardColor.Yellow; } print(FakeColorToChange.ToString()); } }
//*************************************************************************** // Private Methods // protected override void CreateDeck() { // Each color gets 2 cards 1-9, but only one '0' card of each color. CardColor[] colors = new CardColor[] { CardColor.Red, CardColor.Yellow, CardColor.Green, CardColor.Blue }; foreach (var clr in colors) { for (int t = 0; t < 2; t++) { for (int i = 0; i <= 12; i++) { if (t == 0 || i > 0) { base.AddCard(new UnoCard(i, clr)); } } } } // Create the "Wild" and "Draw 4" cards (4 each). for (int t = 0; t < 2; t++) { for (int i = 0; i < 4; i++) { base.AddCard(new UnoCard(t, CardColor.Wild)); } } }
/// <summary> /// This switches the color of the card, so long as it is currently a wild card /// </summary> /// <param name="newColor">The new color to set it to</param> public void SwitchCardColor(CardColor newColor) { if (color == CardColor.any) { color = newColor; } }
public Card(CardColor color, Shape shape, Fill fill, int count) { #region validation if (color == CardColor.Other) { throw new InvalidCardException("color", color); } if (shape == Shape.Other) { throw new InvalidCardException("shape", shape); } if (fill == Fill.Other) { throw new InvalidCardException("fill", fill); } if (count > 3 || count < 1) { throw new InvalidCardException("count", count); } #endregion validation this.Color = color; this.Shape = shape; this.Fill = fill; this.Count = count; }
public void SetSelectedColor(CardColor color) { selectedColor = color; colorSelected = true; palette.SetActive(false); }
// 対戦記録のロード public void LoadBattleData() { if (File.Exists(_filePath)) { StreamReader streamReader = new StreamReader(_filePath); string data = streamReader.ReadToEnd(); streamReader.Close(); _cardPlayOrder.Clear(); string[] dataArray = JsonUtility.FromJson <string>(data).Split(','); for (int num = 0; num < dataArray.Length; num++) { CardColor color = (CardColor)Enum.Parse(typeof(CardColor), dataArray[num]); int number = int.Parse(dataArray[num + 1]); Team team = (Team)Enum.Parse(typeof(Team), dataArray[num + 2]); CardData cardData = new CardData(color, number, team); _cardPlayOrder.Add(cardData); Debug.Log(color.ToString()); Debug.Log(number); Debug.Log(team); } } }
public TableDeckCard(CardColor cc, CardType ct, bool a, CardColor FC) { //DeckCard = c; cardColor = cc; cardType = ct; Active = a; FakeColor = FC; }
protected Card GetBestCardOfChosenColor(CardColor chosenColor, IEnumerable <Card> cards) { return(cards .Where(x => x.Colors.Length == 1) .Where(x => x.Colors[0] == chosenColor) .OrderByDescending(GetRating) .FirstOrDefault()); }
public Card(CardColor color, CardSuit suit, CardRank rank, string name, int value = 0) { Color = color; Suit = suit; Rank = rank; Name = name; Value = value; }
public Card(Card card) { type = card.type; color = card.color; value = card.value; isOnScreen = false; owner = card.owner; }
/// <summary> /// Will be call by the UI and allow to choose a new /// </summary> /// <param name="i"> must be between 0 and 4</param> public void ChooseColor(int i) { i = i < 0 ? 0 : i > 3 ? 3 : i; CardColor changeColor = (CardColor)i; PlaceACard(changeColor); }
public Deck(CardColor color) { Color = color; _cards = new Queue <ICard>(); _discardPile = new List <ICard>(); CardEventManager.OnCardDiscarded += OnCardDiscarded; }
public AutomaticallyTriggeredDeflectParams(Player playerPlayed, Player playerTargeted, int numberOfCardsToDraw, ICard cardPlayed, CardColor targetedCardColor) { PlayerPlayed = playerPlayed; PlayerTargeted = playerTargeted; NumberOfCardsToDraw = numberOfCardsToDraw; CardPlayed = cardPlayed; TargetedCardColor = targetedCardColor; }
private void AddRule(Direction direction, CardColor color) { var temp = color == CardColor.Black ? new Card(1, Suit.Spades) : new Card(1, Suit.Hearts); Func <Direction, Card, bool> f = (dir, card) => dir == direction && card.Color == temp.Color; rules.Add(f); }
public string PrintCard() { string c = CardColor.ToString(); string s = CardSuit.ToString(); string v = CardValue.ToString(); return(c + " " + v + " of " + s); }
void Start() { isPause = false; scollIndex = 0; suppressColor = new CardColor(); //View.GetInstance().right = (View.GetInstance().maxShowCount <View.GetInstance(). playerCards.transform.childCount ? // View.GetInstance().maxShowCount : View.GetInstance().playerCards.transform.childCount) - 1; }
public LastCardPlayed(CardColor color, CardValue value, string imageUrl, string playerPlayed, bool wasWildCard) { Color = color; Value = value; ImageUrl = imageUrl; PlayerPlayed = playerPlayed; WasWildCard = wasWildCard; }
public void TellCardColor(Card playerCard, CardColor color) { if (color == CardColor.Unknown) { throw new InvalidTurnException("Color was not provided"); } storeCardInfo(playerCard, color, CardRank.Unknown); }
private void Start() { CardColor color = CardColor.Blue; for (int i = 0; i < 4; i++) { for (int j = 0; j < 2; j++) { cards.Add(new Card(color, CardType.One)); cards.Add(new Card(color, CardType.Two)); cards.Add(new Card(color, CardType.Three)); cards.Add(new Card(color, CardType.Four)); cards.Add(new Card(color, CardType.Five)); cards.Add(new Card(color, CardType.Six)); cards.Add(new Card(color, CardType.Seven)); cards.Add(new Card(color, CardType.Eight)); cards.Add(new Card(color, CardType.Nine)); cards.Add(new Card(color, CardType.Skipp)); cards.Add(new Card(color, CardType.Switch_direction)); cards.Add(new Card(color, CardType.Draw_2)); cards.Add(new Card(color, CardType.Change_cards)); } switch (i) { case 0: color = CardColor.Green; break; case 1: color = CardColor.Red; break; case 2: color = CardColor.Yellow; break; } } for (int i = 0; i < 2; i++) { cards.Add(new Card(CardColor.Black, CardType.Change_color)); cards.Add(new Card(CardColor.Black, CardType.Draw_4)); cards.Add(new Card(CardColor.Black, CardType.Switch_cards_all)); } int count = cards.Count; int last = count - 1; for (var i = 0; i < last; ++i) { int r = UnityEngine.Random.Range(i, count); Card tmp = cards[i]; cards[i] = cards[r]; cards[r] = tmp; } StartCoroutine(gameManager.DealCards()); }
public Link(City from, City to, LinkType type, int length, int color) { this.from = from; this.to = to; this.type = type; this.length = length; this.color = (CardColor)(color); this.player = null; }
private bool IsCardForTeam(Team team, CardColor cardColor) { if (team == Team.Blue && cardColor == CardColor.Blue || team == Team.Red && cardColor == CardColor.Red) { return(true); } return(false); }
public Card(Face faceValue, CardColor color, Suit suit, ImageSource brush, Uri uriResource) { FaceValue = faceValue; Color = color; Suit = suit; CardImage = brush; IsFaceDown = false; CardUri = uriResource; }
/////////////////////////////////////////////////////////////////////////////////////// // Constructors /////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Construct a new card /// </summary> /// <param name="theColor"></param> /// <param name="theFace"></param> public Card(CardColor theColor, CardFace theFace) { // Check the card is value, otherwise throw a runtime error if (!IsValidCard(theColor, theFace)) throw new Exception(CardColorToString(theColor) + " " + CardFaceToString(theFace) + " is not a valid Uno card"); // Save parameters in private attributes color = theColor; face = theFace; }
protected Card(Game game, int id, CardType type, CardSuit suit, CardRank rank) { this.game = game; this.id = id; this.type = type; this.suit = suit; this.rank = rank; color = GetColor(type); empty = new EmptyCard(this); }
public CardViewModel(Card card) { Card = card; Colors = new CardColor[] {}; Update(); _timer = new Timer(delegate { Update(); }, null, TimeSpan.FromMilliseconds(20), TimeSpan.FromMilliseconds(20)); }
protected static int GetColorRank(CardColor cardColor, ColorScore[] scores) { var i = 1; foreach (var colorScore in scores.OrderByDescending(x => x.Score)) { if (cardColor == colorScore.Color) return i; } return scores.Length; }
public List<Card> GenerateCards() { List<Card> cards = new List<Card>(); CardColor[] validColors = new CardColor[] { CardColor.Green, CardColor.Purple, CardColor.Red }; Fill[] validFills = new Fill[] { Fill.Dashed, Fill.Open, Fill.Solid }; Shape[] validShapes = new Shape[] { Shape.Diamond, Shape.Oval, Shape.Squiggle }; int[] validCounts = new int[] { 1, 2, 3 }; foreach (CardColor color in validColors) { foreach (Fill fill in validFills) { foreach (Shape shape in validShapes) { foreach(int i in validCounts) { cards.Add(new Card(color, shape, fill, i)); } } } } return cards; }
}// AddCard protected CardView AddCardView(int player, CardColor col, int value){ CardView cv = null; // Try to find a free one. for (int i = 0; cv == null && i < _cardViewsPerPlayer [player].Count; i++) { if (!_cardViewsPerPlayer [player] [i].gameObject.activeSelf) cv = _cardViewsPerPlayer [player] [i]; }// for if (cv != null) { cv.SetCardColor (col); cv.SetCardNumber (value); cv.gameObject.SetActive (true); } else { cv = SpawnCard ( col, value ); int count = _cardViewsPerPlayer [player].Count; int row = Mathf.FloorToInt (((float)count) / ((float)CardsMaxPerRow)); cv.transform.position = //ParentPlayerHands[p].transform.position + new Vector3 ((count % CardsMaxPerRow) * CardPlayerHandOffset.x, CardPlayerHandOffset.y, row * CardPlayerHandOffset.z); cv.transform.rotation = Quaternion.Euler (CardPlayerHandRotation);// + ParentPlayerHands[p].transform.rotation.eulerAngles); cv.transform.SetParent (ParentPlayerHands [player].transform, false); cv.gameObject.name = "CardPlayer_" + player + "_" + count; _cardViewsPerPlayer [player].Add (cv); }// fi return cv; }// AddCardView
private DrawFourCard(CardColor cc) : base(cc, CardFace.DF) { }
protected Card GetBestCardOfSingleColorOrColorless(IEnumerable<Card> cards, CardColor? primaryColor = null) { return cards .Where(x => x.Colors.Length == 1 || (primaryColor.HasValue && IsUsableNonbasicLand(x, primaryColor.Value))) .OrderByDescending(GetRating) .FirstOrDefault(); }
protected Card GetBestCardOfChosenColor(CardColor chosenColor, IEnumerable<Card> cards) { return cards .Where(x => x.Colors.Length == 1) .Where(x => x.Colors[0] == chosenColor) .OrderByDescending(GetRating) .FirstOrDefault(); }
private static void OnObjAiBaseProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { try { if (!sender.IsMe) { return; } if (args.SData.Name == "PickACard") { Status = SelectStatus.Selecting; } if (args.SData.Name == "goldcardlock") { LastCard = CardColor.Gold; Status = SelectStatus.Selected; } else if (args.SData.Name == "bluecardlock") { LastCard = CardColor.Blue; Status = SelectStatus.Selected; } else if (args.SData.Name == "redcardlock") { LastCard = CardColor.Red; Status = SelectStatus.Selected; } } catch (Exception ex) { Global.Logger.AddItem(new LogItem(ex)); } }
public static bool Has(CardColor color) { return color == CardColor.Gold && ObjectManager.Player.HasBuff("goldcardpreattack") || color == CardColor.Red && ObjectManager.Player.HasBuff("redcardpreattack") || color == CardColor.Blue && ObjectManager.Player.HasBuff("bluecardpreattack"); }
private DrawTwoCard(CardColor cc) : base(cc, CardFace.DT) { }
protected override object this[string index] { get { #region switch (index) { case "Id": return _id; case "Name": return _name; case "Color": return _color; case "Value": return _value; case "HeadIcon": return _headIcon; default: throw new ArgumentException(string.Format("PokerInfo index[{0}] isn't exist.", index)); } #endregion } set { #region switch (index) { case "Id": _id = value.ToInt(); break; case "Name": _name = value.ToNotNullString(); break; case "Color": _color = value.ToEnum<CardColor>(); break; case "Value": _value = value.ToShort(); break; case "HeadIcon": _headIcon = value.ToNotNullString(); break; default: throw new ArgumentException(string.Format("PokerInfo index[{0}] isn't exist.", index)); } #endregion } }
public CardTemplate Protections(CardColor color) { _init.Add(p => p.ProtectionsFromColors.Add(color)); return this; }
public Card(CardRank rank,CardColor color) { this.rank=rank; this.color=color; }
//无参构造 public Card() { rank = (CardRank)0; color = (CardColor)0; }
}// AbortMatch #endregion match management #region view management protected CardView SpawnCard(CardColor color, int value){ GameObject card = GameObject.Instantiate (PrefabCard); CardView view = card.GetComponent<CardView> (); view.SetCardColor (color); view.SetCardNumber (value); return view; }// SpawnCard
private bool IsUsableNonbasicLand(Card card, CardColor color1, CardColor? color2 = null) { if (!card.Is().Land) return false; var landColors = card.ProducableManaColors; if (landColors.Count == 0) return true; if (landColors.Count == 1) { if (landColors[0] == (int) CardColor.Colorless) return true; if (landColors[0] == (int) color1) return true; if (color2.HasValue && landColors[0] == (int) color2.Value) return true; return false; } if (!color2.HasValue) return false; return landColors.Contains((int) color1) && landColors.Contains((int) color2.Value); }
}// property public Card(CardColor color, int value, int position) { _color = color; _value = value; _position = position; }// Card
public bool HasColor(CardColor color) { return Effect().HasColor(color); }
static Cards() { LastCard = CardColor.None; ShouldSelect = new List<CardColor>(); Obj_AI_Base.OnProcessSpellCast += OnObjAiBaseProcessSpellCast; Game.OnUpdate += OnGameUpdate; }
private NumberCard(CardColor cc, CardFace cf) : base(cc, cf) { }
public static void Select(CardColor card) { try { Select(new List<CardColor> { card }); } catch (Exception ex) { Global.Logger.AddItem(new LogItem(ex)); } }
private Card GetCurrentMaxCardInColor( CardColor color ) { Card maxCard = null; CardComparer comparer = new CardComparer( _playingManager.CurrentAnnouncement.Type ); foreach ( Card card in _playingManager.RemainingCards ) { if ( card.CardColor == color ) { if ( maxCard == null ) { maxCard = card; } if ( comparer.Compare( maxCard, card ) < 0 ) { maxCard = card; } } } foreach ( Card card in _playingManager.CurrentHand ) { if ( card.CardColor == color ) { if ( maxCard == null ) { maxCard = card; } if ( comparer.Compare( maxCard, card ) < 0 ) { maxCard = card; } } } return maxCard; }
private int GetWHits(Obj_AI_Base target, List<Obj_AI_Base> targets = null, CardColor color = CardColor.Gold) { try { if (targets != null && color == CardColor.Red) { targets = targets.Where(t => t.IsValidTarget((W.Range + W.Width) * 1.5f)).ToList(); var pred = W.GetPrediction(target); if (pred.Hitchance >= HitChance.Medium) { var circle = new Geometry.Polygon.Circle(pred.UnitPosition, target.BoundingRadius + WRedRadius); return 1 + (from t in targets.Where(x => x.NetworkId != target.NetworkId) let pred2 = W.GetPrediction(t) where pred2.Hitchance >= HitChance.Medium select new Geometry.Polygon.Circle(pred2.UnitPosition, t.BoundingRadius * 0.9f)).Count( circle2 => circle2.Points.Any(p => circle.IsInside(p))); } } if (W.IsInRange(target)) { return 1; } } catch (Exception ex) { Global.Logger.AddItem(new LogItem(ex)); } return 0; }
protected Card GetBestCardOfChosenColorsOrColorless(CardColor color1, IEnumerable<Card> cards, CardColor? color2 = null) { return cards .Where(card => { if (IsUsableNonbasicLand(card, color1, color2)) { return true; } if (card.HasColor(CardColor.Colorless)) return true; return card.Colors.All(c => { if (color2 == null) { return c == color1; } return c == color1 || c == color2; }); }) .OrderByDescending(GetRating) .FirstOrDefault(); }