private void DrawAvailableTriples() { float margin = 0; var triples = GSP.GameState.CurrentPlayer.GetNotCompletedTriplesForCard(Card); foreach (List <Card> cards in triples) { foreach (Card c in cards) { var card = CardsGenerator.CreateCardGameObject(c.GetResIdForCard(), new Vector2(margin, 0), parent: AvailableCardsObj); GarbageCollector.Add(card); var clickComponent = card.AddComponent <ClickActionScript>(); clickComponent.ClickMethod = (x) => { if (!clickable) { return; } clickable = false; DoneCallback(c.TripleId); Destroy(gameObject); }; margin = margin + GD.CardWidth * 0.6f; } margin = margin + GD.CardWidth + GD.MarginSmall; } }
private static GameObject DrawAnimalCard(Vector2 position, string resId, int howMany) { GameObject card = CardsGenerator.CreateCardGameObject(resId, position); card.AddSmallText(howMany + ""); return(card); }
private static GameObject DrawSilverCard(Vector2 position, int howMany) { GameObject silverCard = CardsGenerator.CreateCardGameObject("silver", position); silverCard.AddSmallText(howMany + ""); return(silverCard); }
private void DrawNewCard() { if (GSP.GameState.CurrentPlayer.Cards.Count > 1) { CardsGenerator.CreateCardGameObject(GSP.GameState.CurrentPlayer.Cards[1].GetResIdForCard(), Vector2.zero, parent: NewCard); } }
void DrawPlayerFinishRow(int place, Player player, Vector2 position) { Object obj = Resources.Load("Prefabs/FinishGamePlayerRow"); GameObject prefab = Instantiate(obj) as GameObject; GameObject canvas = GameObject.Find("Canvas"); prefab.transform.SetParent(canvas.transform); prefab.transform.position = position; prefab.transform .GetChild(0) .GetComponentInChildren <TMPro.TextMeshProUGUI>() .text = GetPlaceString(place); prefab.transform .GetChild(1) .GetComponentInChildren <TMPro.TextMeshProUGUI>() .text = player.NickName; var pointsPosition = prefab.transform .GetChild(2) .GetChild(0) .transform .position; GameObject pointsCard = CardsGenerator.CreateCardGameObject("small_card_empty", pointsPosition, false, true); pointsCard.AddSmallText(player.Score + "", false, true); TMPro.TextMeshProUGUI textObj = prefab.GetComponentInChildren <TMPro.TextMeshProUGUI>(); textObj.text = GetPlaceString(place); }
private static GameObject DrawWorkersCard(Vector2 position, int howMany) { GameObject workerCard = CardsGenerator.CreateCardGameObject("workerGS", position); workerCard.AddSmallText(howMany + ""); return(workerCard); }
private GameObject DrawGoodsCard(Vector2 position, string resId, int howMany) { GameObject card = CardsGenerator.CreateCardGameObject(resId, position, parent: gameObject); card.AddSmallText(howMany + ""); GarbageCollector.Add(card); return(card); }
private GameObject DrawAvailableCard(Vector2 position, Card card) { var resId = card.GetResIdForCard(); GameObject obj = CardsGenerator.CreateCardGameObject(resId, position, parent: AvailableCardsObj); GarbageCollector.Add(obj); return(obj); }
private void DrawPoints(Vector2 position, int points) { GameObject pointsCard = CardsGenerator.CreateCardGameObject("small_card_empty", position, false, true); pointsCard.AddSmallText(points + "", false, true); GarbageCollector.Add(pointsCard); }
private static GameObject DrawPoints(Vector2 position, int points) { GameObject pointsCard = CardsGenerator.CreateCardGameObject("small_card_empty", position, false, true); pointsCard.AddSmallText(points + "", false, true); return(pointsCard); }
private void DrawPlayerCards() { float margin = 0; GSP.GameState.CurrentPlayer.Cards.ForEach((Card obj) => { CardsGenerator.CreateCardGameObject(obj.GetResIdForCard(), new Vector2(margin, 0), parent: YourCards); margin = margin + GD.CardWidth * 0.8f; }); }
private void DrawCard(float margin, int index) { var animal = GSP.GameState.AnimalsDeck.Cards[index]; string resId = ""; switch (animal.Class) { case CardClass.Pig: resId = "pig"; break; case CardClass.Cow: resId = "cow"; break; case CardClass.Sheep: resId = "lamb"; break; case CardClass.Chicken: resId = "hen"; break; } var card = CardsGenerator.CreateCardGameObject(resId, new Vector2(margin, posAvailableCards.y), parent: gameObject); GarbageCollector.Add(card); var clickComponent = card.AddComponent <ClickActionScript>(); clickComponent.ClickMethod = (x) => { print("click"); if (!clickable) { return; } print("click"); GiveThisCardToPlayer(index); HowManyCards = HowManyCards - 1; if (HowManyCards == 0) { UpdateView(HowManyCards); clickable = false; Invoke("Done", 1f); } else { UpdateView(HowManyCards); } }; }
private void DrawCard(float margin, int index) { var goods = GSP.GameState.GoodsDeck.Cards[index]; string resId = ""; switch (goods.Dice) { case CardDice.I_II: resId = "goods1-2"; break; case CardDice.III_IV: resId = "goods3-4"; break; case CardDice.V_VI: resId = "goods5-6"; break; } var card = CardsGenerator.CreateCardGameObject(resId, new Vector2(margin, posAvailableCards.y), parent: gameObject); GarbageCollector.Add(card); var clickComponent = card.AddComponent <ClickActionScript>(); clickComponent.ClickMethod = (x) => { if (!clickable) { return; } GiveThisCardToPlayer(index); HowManyCards = HowManyCards - 1; if (HowManyCards == 0) { UpdateView(HowManyCards); clickable = false; Invoke("Done", 1f); } else { UpdateView(HowManyCards); } }; }
private void DrawCards(List <Card> cards) { float margin = 0; foreach (Card card in cards) { var cardObj = CardsGenerator.CreateCardGameObject(card.GetResIdForCard(), new Vector2(margin, 0), parent: availableCardsObj); cardObj.AddComponent <ClickActionScript>() .ClickMethod = (x) => { if (!clickable) { return; } clickable = false; GiveThisCardToPlayer(card); Invoke("Destroy", 0.5f); }; margin = margin + GD.CardWidth + GD.MarginSmall; } }
private void DrawCurrenRoundCard() { string imageResId = GSP.GameState.CurrentRound.GetResIdForCurrentRoundBonus(); CardsGenerator.CreateCardGameObject(imageResId, Vector2.zero, parent: CurrentRoundCard); }
private static void DrawPoints(Vector2 position, string points) { GameObject pointsCard = CardsGenerator.CreateCardGameObject("small_card_empty", position, false, true); pointsCard.AddSmallText(points, false, true); }
private void DrawBonusCards() { CardsGenerator.CreateCardGameObject(GSP.GameState.CurrentRound.GetResIdForCurrentRoundBonus(), Vector2.zero, parent: roundCard); switch (GSP.GameState.CurrentRound) { case Round.A: DrawCard(posCard11, new Card(CardClass.Barrel), bonus1); DrawCard(posCard12, new Card(CardClass.Barrel), bonus1); DrawCard(posCard13, new Card(CardClass.Barrel), bonus1); if (GSP.GameState.AnimalsDeck.Cards.Count > 0) { DrawCard(posCard21, GSP.GameState.AnimalsDeck.Cards[0], bonus2); } if (GSP.GameState.AnimalsDeck.Cards.Count > 1) { DrawCard(posCard22, GSP.GameState.AnimalsDeck.Cards[1], bonus2); } if (GSP.GameState.GoodsDeck.Cards.Count > 0) { DrawCard(posCard31, GSP.GameState.GoodsDeck.Cards[0], bonus3); } if (GSP.GameState.GoodsDeck.Cards.Count > 1) { DrawCard(posCard32, GSP.GameState.GoodsDeck.Cards[1], bonus3); } DrawCard(posCard41, new Card(CardClass.Worker), bonus4); DrawCard(posCard42, new Card(CardClass.Worker), bonus4); DrawCard(posCard43, new Card(CardClass.Worker), bonus4); DrawCard(posCard51, new Card(CardClass.Silver), bonus5); DrawCard(posCard52, new Card(CardClass.Silver), bonus5); DrawCard(posCard53, new Card(CardClass.Silver), bonus5); break; case Round.B: if (GSP.GameState.AnimalsDeck.Cards.Count > 0) { DrawCard(posCard11, GSP.GameState.AnimalsDeck.Cards[0], bonus2); } if (GSP.GameState.AnimalsDeck.Cards.Count > 1) { DrawCard(posCard12, GSP.GameState.AnimalsDeck.Cards[1], bonus2); } if (GSP.GameState.GoodsDeck.Cards.Count > 0) { DrawCard(posCard21, GSP.GameState.GoodsDeck.Cards[0], bonus3); } if (GSP.GameState.GoodsDeck.Cards.Count > 1) { DrawCard(posCard22, GSP.GameState.GoodsDeck.Cards[1], bonus3); } DrawCard(posCard41, new Card(CardClass.Worker), bonus4); DrawCard(posCard42, new Card(CardClass.Worker), bonus4); DrawCard(posCard43, new Card(CardClass.Worker), bonus4); DrawCard(posCard51, new Card(CardClass.Silver), bonus5); DrawCard(posCard52, new Card(CardClass.Silver), bonus5); DrawCard(posCard53, new Card(CardClass.Silver), bonus5); break; case Round.C: if (GSP.GameState.AnimalsDeck.Cards.Count > 0) { DrawCard(posCard12, GSP.GameState.AnimalsDeck.Cards[0], bonus1); } if (GSP.GameState.GoodsDeck.Cards.Count > 0) { DrawCard(posCard22, GSP.GameState.GoodsDeck.Cards[0], bonus2); } DrawCard(posCard31, new Card(CardClass.Worker), bonus3); DrawCard(posCard32, new Card(CardClass.Worker), bonus3); DrawCard(posCard41, new Card(CardClass.Silver), bonus4); DrawCard(posCard42, new Card(CardClass.Silver), bonus4); DrawCard(posCard51, new Card(CardClass.Worker), bonus5); DrawCard(posCard52, new Card(CardClass.Silver), bonus5); break; case Round.D: DrawCard(posCard11, new Card(CardClass.Worker), bonus3); DrawCard(posCard12, new Card(CardClass.Worker), bonus3); DrawCard(posCard21, new Card(CardClass.Silver), bonus4); DrawCard(posCard22, new Card(CardClass.Silver), bonus4); DrawCard(posCard41, new Card(CardClass.Worker), bonus5); DrawCard(posCard42, new Card(CardClass.Silver), bonus5); break; case Round.E: DrawCard(posCard12, new Card(CardClass.Worker), bonus1); DrawCard(posCard22, new Card(CardClass.Silver), bonus2); break; } }
private void DrawNewCard() { var card = CardsGenerator.CreateCardGameObject(Card.GetResIdForCard(), Vector2.zero, parent: CompletedProjectObj); GarbageCollector.Add(card); }
private void DrawCard(Vector2 position, Card cards, GameObject parent) { CardsGenerator.CreateCardGameObject(cards.GetResIdForCard(), position, parent: parent); }