/// <summary> /// Adds the card. /// </summary> /// <param name="card">Card.</param> public void AddCard(PlayCard card) { lock (thisLock) { _cards.Add(new Card(card.CardValue, card.CardColor)); } }
public override void OnDrop(GameObject Card) { PlayCard card = Card.GetComponent <PlayCard>(); if (card.isUsed) { card.GetComponent <CardBody>().ResetDrop(); baseZone.CloseZone(); return; } if (baseBuilding.CheckPreview(card.Value)) { baseBuilding.Fill(card.Value); EffectResolver.TriggerCardEffects(card); card.Use(); if (baseBuilding.CheckReady()) { baseZone.ForceOpen(); return; } } else { CardBody.dragged.ResetDrop(); } baseZone.CloseZone(); }
public Enemy(Form1 form1, int i,Disposal Dis) { fieldLeft = 900; num = i; fieldTop = 10 + 120 * num; trashTop = 740; trashLeft = 10 + 120 * num; name = "CPU"+i; this.Dis = Dis; ShowDeck = new PlayCard(); ShowDeck.Name = "deck"; ShowDeck.Size = new System.Drawing.Size(70, 110); ShowDeck.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; ShowDeck.Image = global::dominion.Properties.Resources.back; ShowDeck.Location = new System.Drawing.Point(820, 10 + 120 * num); ShowTrash.Location = new System.Drawing.Point(740, 10 + 120 * num); ShowTrash.Name = "trash"; ShowTrash.Image = global::dominion.Properties.Resources.back; ShowTrash.Size = new System.Drawing.Size(70, 110); ShowTrash.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; ShowTrash.TabIndex = 8; ShowTrash.TabStop = false; ShowTrash.Visible = false; p.Visible = false; p.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; p.Size = new System.Drawing.Size(70, 110); this.form1 = form1; this.form1.Controls.Add(ShowDeck); this.form1.Controls.Add(ShowTrash); this.form1.Controls.Add(p); }
public void ShowStats(PlayCardController pcc, PlayCard playCard) { var libCard = CardLibrary.Get().GetCard(playCard.libId); if (libCard.health > 0) { var transHealth = pcc.transform.FindChild("Health"); var healthText = transHealth.GetComponent <TextMesh> (); healthText.text = "" + playCard.health; transHealth.gameObject.SetActive(!pcc.turned); } if (libCard.attack > 0) { var transAttack = pcc.transform.FindChild("Attack"); var attackText = transAttack.GetComponent <TextMesh> (); attackText.text = "" + playCard.attack; transAttack.gameObject.SetActive(!pcc.turned); } if (libCard.moveRange > 1) { var transActions = pcc.transform.FindChild("Action"); var actionsText = transActions.GetComponent <TextMesh> (); actionsText.text = "" + playCard.actions; transActions.gameObject.SetActive(!pcc.turned); } if (libCard.atkRange > 1) { var transRange = pcc.transform.FindChild("Action"); var rangeText = transRange.GetComponent <TextMesh> (); rangeText.text = "" + libCard.atkRange; transRange.gameObject.SetActive(!pcc.turned); } }
// 自动出牌 void AutoPop() { List <Card> cards = CardRules.DelayDiscardCard(UserInfoModel.userInfo.userId.ToString()); bool isCanPop = cards.Count > 0; if (isCanPop) { List <Card> select = new List <Card>(); List <CardUI> selectUis = new List <CardUI>(); for (int i = 0; i < GetSpriteUIs().Length; i++) { if (GetSpriteUIs()[i].Select) { select.Add(GetSpriteUIs()[i].Card); selectUis.Add(GetSpriteUIs()[i]); } } //先检测已选择的牌可以出不 if (PlayCard.IsCanPop(select)) { LandlordsNet.C2G_PopReq(1, select, null, null); } else { CardRules.SortCards(cards, true); LandlordsNet.C2G_PopReq(1, cards, null, null); } } else { Interaction.Instance.NoPlayCard(0); } LandlordsModel.Instance.TimeOutAudioPopCount++; }
/// <summary> /// Gives the card. /// </summary> /// <param name="card">Card.</param> public void GiveCard(Card card) { if (_deck == null) { throw new Exceptions.PlayerError("Player must have a deck associated."); } if (!_unitTest) { Console.WriteLine("Giving card to player " + ConnectionManager.Get(_connection).Pseudo + ": " + card.Type.ToString() + " | " + card.Color.ToString()); PlayCard cardPck = new PlayCard { CardValue = card.Type, CardColor = card.Color }; using (MemoryStream stream = new MemoryStream()) { Serializer.Serialize(stream, cardPck); _connection.SendObject("PlayerGetGameCard", stream.ToArray()); } } _cardsHand.Add(card); if (_cardsHand.Count > 8) { throw new ArgumentException("Added too many cards"); } }
/// <summary> /// 出牌回调 /// </summary> void ChuPaiCallBack() { PlayCard playCard = GameObject.Find("Player").GetComponent <PlayCard>(); int[] pai = new int[20]; int count = 0; if (playCard.CheckSelectCardsEx(pai, out count)) { // btnChuPai.SetActive(false); // btnBuChu.SetActive(false); } //CardSprite[] sprites = playCard.GetComponentsInChildren<CardSprite>(); //for (int i = 0; i < sprites.Length; i++) //{ // if (sprites[i].Select) // { // pai[count++] = sprites[i].Poker.GetId; // } //} //num = selectedCardsList.Count; MsgManager m_Msg = GetMsgMgr(); m_Msg.SendChuPai(pai, count); }
public void StartEvent() { //Multiplayer object[] data = new object[] { 1 }; PhotonNetwork.RaiseEvent(DRAW_CARDS, data, new RaiseEventOptions { Receivers = ReceiverGroup.Others }, SendOptions.SendReliable); GameManager.Instance.DrawCard(UIManager.Instance.GetActiveDeckList(true), GameManager.Instance.GetActiveHand(true)); GameManager.Instance.EnableOrDisablePlayerControl(true); foreach (Transform t in GameManager.Instance.GetActiveHand(true)) { PlayCard pc = t.GetComponent <PlayCard>(); if (pc) { Destroy(pc); } t.gameObject.AddComponent <DrawDiscardListener>(); } GameManager.Instance.instructionsObj.GetComponent <TMP_Text>().text = "Select One Card to Discard"; }
/// <summary> /// Initialize the visual card from an abstract PlayCard argument /// </summary> /// <param name="card"></param> void GeneratePlayingCard(PlayCard card) { cardManager.SetCurrentActiveCard(card); int[] randomArray = GameEventManager.Instance.GenerateRandomSwipeDirections(); guiManager.InitializeCard(card, randomArray); PlayerPrefs.SetInt("CurrentCardID", card.CardID); }
public PlayCard[] SortCardsByValue(PlayCard[] flop, PlayCard turn, PlayCard river, PlayCard[] hand) { PlayCard[] cards = new PlayCard[7] { flop[0], flop[1], flop[2], turn, river, hand[0], hand[1] }; for (int i = 0; i < 6; ++i) { for (int j = 1; j + i < 7; ++j) { if (cards[i].Value < cards[i + j].Value) { PlayCard temp = cards[i]; cards[i] = cards[i + j]; cards[i + j] = temp; } } } return(cards); }
private async Task <PlayCard> GenerateCard(string username, int gameId) { var game = await _dbContext.Games .Include(x => x.PlayCards) .Include(x => x.CardSetGames) .FirstOrDefaultAsync(x => x.Id == gameId); var selectedCardSetsIds = game.CardSetGames. Select(x => x.CardSetId) .ToList(); var usedCards = game.PlayCards .Select(x => x.CardId).ToList(); var unusedCards = await _dbContext.Cards .Where(x => selectedCardSetsIds.Contains(x.CardSetId) && !usedCards.Contains(x.Id)) .ToListAsync(); Logger.LogInformation($"Генерация карточки. unusedCard.Count: {unusedCards.Count} {Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}"); int index = rnd.Next(unusedCards.Count() - 1); var randomCard = unusedCards[index]; var newPlayCard = new PlayCard() { GameId = gameId, CardId = randomCard.Id, Username = username, }; return(newPlayCard); }
public void OnFour(ref PlayCard[] cards, int start) { if (start == 0) { cards = new PlayCard[5] { cards[0], cards[1], cards[2], cards[3], cards[4] }; } else { cards = new PlayCard[5] { cards[start], cards[start + 1], cards[start + 2], cards[start + 3], cards[0] }; } }
//TimeZoneInfo zone = TimeZoneInfo.FindSystemTimeZoneById("Central European Standard Time"); /// <summary> /// Event for when you transition between two cards. Can be interrupted by events etc /// </summary> public void CardTransition(int lastCardIndex, int direction) { PlayCard currentActiveCard = CardManager.Instance.GetCurrentActiveCard(); CheckForEarnedBadge(direction); // Check if the player has earned any badges // Check for active tips card TODO: Rough, could optimize List <FeedbackCard> tipsCardList = CardManager.FeedbackCardList; for (int i = 0; i < tipsCardList.Count; i++) { if (tipsCardList[i].NextCardID == currentActiveCard.CardID) { TriggerHintCard(i); StoredDirection = direction; return; } } // Coach methods //if (!GameManager.Instance.CoachReview()) { // Checks with standard coaches if they have something to say, interrupts transmission and hands control over to the relevant coach if so // return; //} bool followingCard = CheckForNextCard(direction); // Check if the choice made had a specified Next Card // Check if there is a card following the current choice, if not, go to next card if (!followingCard) { DrawNextCard(); } }
public void PlayRune(Rune rune, Action action) { PlayCard pc = rune as PlayCard; Controller player = EntityManager.Singelton.GetEntity(pc.controller_uid) as Controller; if (player == null) { Debug.Log("Could not find controller in EntityManager, bad Guid"); action(); return; } Card card = EntityManager.Singelton.GetEntity(pc.card_uid) as Card; if (card == null) { Debug.Log("Could not find card in EntityManager, bad Guid"); action(); return; } RemoveCardFromHand(card.GetCardAvatar(), player.GetGuid()); action(); action = null; }
public void DoRiver() { int i = Utility.Random(m_Set.Count); m_River = m_Set[i]; m_Drawn.Add(m_Set[i]); m_Set.RemoveAt(i); }
public void PlayCallBack() { PlayCard playCard = GameObject.Find("Player").GetComponent <PlayCard>(); if (playCard.CheckSelectCards()) { } }
public void Put(PlayCard card, byte x, byte y) { cell[x, y].card = card; if (x > 0) cell[x - 1, y].right = card.cardInfo.Left; if (x < maxCoord) cell[x + 1, y].left = card.cardInfo.Right; if (y > 0) cell[x, y - 1].down = card.cardInfo.Up; if (y < maxCoord) cell[x, y + 1].up = card.cardInfo.Down; }
public void DoTurn() { int i = Utility.Random(m_Set.Count); m_Turn = m_Set[i]; m_Drawn.Add(m_Set[i]); m_Set.RemoveAt(i); }
private void Processor2PlayCard() { if (mPlayCard == null) { mPlayCard = new PlayCard(); } Player playPlayer = mPlayCard.player.GetComponent <Player>();; PlayerAI playPlayerAI = mPlayCard.player.GetComponent <PlayerAI>(); //出牌 if (mPlayCard.cardDataListToPlayer == null || mPlayCard.player == mPlayCard.cardDataListToPlayer) { if (playPlayer != null) { Debug.LogError("出牌:" + playPlayer.gameObject); playPlayer.PlayCardInit(); playPlayer.mPlay.SetActive(true); } else if (playPlayerAI != null) { Debug.LogError("出牌:" + playPlayerAI.gameObject); playPlayerAI.mPass.SetActive(false); for (int i = 0; i < playPlayerAI.mCardList.Count; i++) { playPlayerAI.mCardList[i].gameObject.SetActive(false); } playPlayerAI.SetTime(true); mTimerTask.Add(TimeManage.Instance.AddTimerTask(playPlayerAI.Play, Random.Range(1.4f, 3.4f))); } } else//打牌 { if (playPlayer != null) { Debug.LogError("打牌:" + playPlayer.gameObject); playPlayer.PlayCardInit(); if (CardArithmetic.AutoPlay(mCombatView.mPlayer.mCardData, mPlayCard) == null) { playPlayer.mPass.SetActive(true); } else { playPlayer.mAct.SetActive(true); } } else if (playPlayerAI != null) { Debug.LogError("打牌:" + playPlayerAI.gameObject); playPlayerAI.mPass.SetActive(false); for (int i = 0; i < playPlayerAI.mCardList.Count; i++) { playPlayerAI.mCardList[i].gameObject.SetActive(false); } playPlayerAI.SetTime(true); mTimerTask.Add(TimeManage.Instance.AddTimerTask(playPlayerAI.HitPlay, Random.Range(1.4f, 3.4f))); } } }
/// <summary> /// Initialize a new card from given values /// </summary> /// <param name="card"></param> /// <param name="randomArray"></param> public void InitializeCard(PlayCard card, int[] randomArray) { playCardObject.GetComponent <InSceneCard>(). SetCardValues(card.ImageName, card.Text, new string[] { card.Choice1.Text, card.Choice2.Text, card.Choice3.Text }, card.Title, randomArray); }
/// <summary> /// 出牌和打牌提示 /// </summary> /// <param name="data"></param> /// <returns></returns> static public List <CardData> AutoPlay(List <CardData> selfData, PlayCard data = null) { //出牌 if (data == null) { return(SeparateCard(selfData)); } //打牌 return(HitCard(selfData, data.cardDataList)); }
/// <summary> /// 出牌回调 /// </summary> void PlayCallBack() { PlayCard playCard = GameObject.Find("Player").GetComponent <PlayCard>(); if (playCard.CheckSelectCards()) { play.SetActive(false); disard.SetActive(false); } }
public void GoChoose(PlayCard _callback) { if (!contral) { choosing = false; return; } callback = _callback; choosing = true; }
public void Btn_Play_Click() { PlayCard playCard = GameObject.Find("Player").GetComponent <PlayCard>(); if (playCard.CheckSelectCards()) { btn_Play.gameObject.SetActive(false); btn_DisPlay.gameObject.SetActive(false); } }
public static PlayCard GeneratePlayCard(string cardData) { PlayCard newCard = new PlayCard(); //newCard.Choices = new List<PlayCardChoice>(new PlayCardChoice[3]); string[] cardInformation = cardData.Split(','); newCard.SetCardValues(cardInformation); return(newCard); }
public void SetZone() { base.OnHover(); PlayCard card = CardBody.dragged.gameObject.GetComponent <PlayCard>(); if (baseCard.CheckMatch(card.Value)) { baseCard.SetPreview(card.Value); } dropPoint.gameObject.SetActive(true); }
public void OnFullHouse(ref PlayCard[] cards, int startthree, int starttwo) { cards = new PlayCard[5] { cards[startthree], cards[startthree + 1], cards[startthree + 2], cards[starttwo], cards[starttwo + 1] }; }
public Card(string name, int starValue, string description, PlayCard cardEffect) { this.name = name; this.starValue = starValue; this.description = description; if (cardEffect != null) { this.cardEffect = cardEffect; } card_image = Resources.Load <Sprite>("sprite_cards/" + name); }
public static void SetCardValues(this PlayCard playCard, string[] cardValues) { playCard.CardID = int.Parse(cardValues[0]); // Card ID playCard.Title = cardValues[1]; // Card Character playCard.ImageName = cardValues[2]; // Image ID playCard.Text = cardValues[3]; // Card Text string[] leftSwipeValues = GenerateSubArray(cardValues, 6, 22); // Choice 1 (Left Swipe) string[] rightswipeValues = GenerateSubArray(cardValues, 22 + 6, 22); // Choice 2 (Right Swipe) string[] downSwipeValues = GenerateSubArray(cardValues, (22 * 2) + 6, 22); // Choice 3 (Down Swipe) playCard.GenerateCardChoices(leftSwipeValues, rightswipeValues, downSwipeValues); }
//adds listener to all cards in hand public void OnEvent(EVENT_TYPE Event_Type) { foreach (Transform t in GameManager.Instance.GetActiveHand(true)) { PlayCard pc = t.gameObject.GetComponent <PlayCard>(); if (pc) { Destroy(pc); } t.gameObject.AddComponent <DiscardCardListener>(); } }
public EffectCard(string name, int starValue, string description, int turns, PlayCard playEffect, UseCard useEffect) : base(name, starValue, description, playEffect) { turns = 0; this.useEffect = x => { useEffect(x); turns--; if (turns <= 0) { // destroy effect } }; }
public void OnEvent(EVENT_TYPE SACRIFICE_SELECTED) { if (!StartGameController.Instance.tutorial) { PlayCard pc = GameManager.Instance.MinionToPromote.GetComponent <PlayCard>(); pc.PromoteMinionWithPlayback(); } else { TutorialPlayCard tpc = GameManager.Instance.MinionToPromote.GetComponent <TutorialPlayCard>(); tpc.PromoteMinionWithPlayback(); } }
internal void AddTrash(Player p) { PlayCard hoge = new PlayCard(); hoge.Size = new System.Drawing.Size(70, 110); hoge.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; f.Controls.Add(hoge); hoge.Visible = true; hoge.Image = Image; hoge.Location = Location; hoge.ChangePointPara(p.trashTop, p.trashLeft); Count--; Supplycount.Text = Count.ToString(); if (Count == 0) { Image = null; } Refresh(); hoge.Visible = false; hoge.Refresh(); }
internal virtual void TrashCard(PlayCard p) { }
/*public void StartCardFxCon(int playerIndex, int cardIndex) { var card = playCards[cardIndex]; var libCard = card.GetLibCard(); var libFx = new LibraryFX(); if (libFx.conditionCount <= 0) { return; } if (libFx.conditionMore) { } if (!libFx.conditionMore) { int value = 0; for (int i = 0; i < playCards.Count; i++) { if (playCards[i].pile == libFx.selectorPile) { value++; } } } }*/ public void StartCardFx( int playerIndex, int libCardIndex, int fxIndex = 0, int adjacentPos = -1, PlayCard card = null ) { Debug.Log("StartCardFx entered"); /*if (effectCounter >= 2) { Debug.Log("test"); return; }*/ //var card = playCards[cardIndex]; var libCard = CardLibrary.Get().GetCard(libCardIndex); //var libFx = new LibraryFX(); //if (libCard == null) { return; } Debug.Log("StartCardFX()" + libCard.fxList.Count + " " + fxIndex + " " + libCardIndex); if (libCard.fxList.Count <= 0) { return; } Debug.Log("Start effectCounter " + effectCounter); currentFx = new PlayFX(); //currentFx.cardId = libCardIndex; currentFx.fxIdx = effectCounter; currentFx.libId = libCardIndex; Debug.Log("currentfx = 0?" + currentFx.libId); currentFx.fxIdx = fxIndex; currentFx.playerIdx = playerIndex; if (card != null) { currentFx.globalIdx = card.globalIdx; } var libFx = currentFx.GetLibFx(); currentFx.actionCount = libFx.actionCount; currentFx.selectorCount = libFx.selectorCount; if (libFx.adjacentPos) { currentFx.adjacentPos = adjacentPos; } effectInProgess = true; //Condition if (libFx.conditionType != LibraryFX.ConditionType.none) { Debug.Log(currentFx.GetLibFx().conditionType); //GREED if (libFx.conditionType == LibraryFX.ConditionType.ctrlOwn) { //Debug.Log("value check storage: " + (CountCards(playerIndex, PlayCard.Pile.field) + 1) + " / " + libFx.conditionCount + " * " + currentFx.actionCount); Debug.Log("value storage check: " + (CountCards(playerIndex, PlayCard.Pile.field) + 1) + " / " + libFx.conditionCount); int storage = ((CountCards(playerIndex, PlayCard.Pile.field) + 1) / libFx.conditionCount); Debug.Log("storage: " + storage); if (storage > 1) { storage = 1; Debug.Log("storage: " + storage); } else if (storage < 0) { storage = 0; Debug.Log(storage); } storage = storage * currentFx.actionCount; Debug.Log("storage: " + storage); currentFx.actionCount = storage; currentFx.actionCount = storage; if (storage > 0) { currentFx.selectorCount = storage; } if (storage < 0) { currentFx.selectorCount = -storage; } } //ENVY if (libFx.conditionType == LibraryFX.ConditionType.ctrlOpp) { Debug.Log("value check storage: " + (CountCards((playerIndex + 1) % 2, PlayCard.Pile.field) + 1) + " / " + libFx.conditionCount + " * " + currentFx.actionCount); int storage = ((CountCards((playerIndex + 1) % 2, PlayCard.Pile.field) + 1) / libFx.conditionCount); Debug.Log("storage " + storage); if (storage > 1) { storage = 1; Debug.Log(storage); } else if (storage < 0) { storage = 0; Debug.Log(storage); } storage = storage * currentFx.actionCount; Debug.Log("storage: " + storage); currentFx.actionCount = storage; if (storage > 0) { currentFx.selectorCount = storage; } if (storage < 0) { currentFx.selectorCount = -storage; } } //PRIDE if (libFx.conditionType == LibraryFX.ConditionType.ctrlMoreOwn) { Debug.Log("value check storage: " + ((CountCards(playerIndex, PlayCard.Pile.field) + 1) + " / " + (CountCards(playerIndex + 1 % 2, PlayCard.Pile.field) + 1))); //int storage = (((CountCards(playerIndex, PlayCard.Pile.field) - libFx.conditionCount) + 1) / (CountCards(playerIndex + 1 % 2, PlayCard.Pile.field) + 1)); int storage = (CountCards(playerIndex, PlayCard.Pile.field) + 1) - (CountCards(playerIndex + 1 % 2, PlayCard.Pile.field) + 1); Debug.Log("storage: " + storage + "conCount: " + libFx.conditionCount); if (storage >= libFx.conditionCount) { storage = 1; Debug.Log(storage); } else if (storage < libFx.conditionCount) { storage = 0; Debug.Log(storage); } storage = storage * currentFx.actionCount; Debug.Log("storage: " + storage); currentFx.actionCount = storage; if (storage > 0) { currentFx.selectorCount = storage; } if (storage < 0) { currentFx.selectorCount = -storage; } } /* * //DELETE FOR BUILD, NOT IN USE if (libFx.conditionType == LibraryFX.ConditionType.ctrlMoreOpp) { currentFx.actionCount = currentFx.selectorCount = (CountCards(playerIndex, PlayCard.Pile.field) / libFx.conditionCount); } /**/ //WRATH if (libFx.conditionType == LibraryFX.ConditionType.kills) { //Debug.Log("calc ints: " + (players[playerIndex].kills + " " + libFx.conditionCount + " " + libFx.actionCount)); int storage = currentFx.selectorCount = (players[playerIndex].kills / libFx.conditionCount); //prevents exponential actioncounts if (storage > 1) { storage = 1; } storage = storage * currentFx.actionCount; //Debug.Log("storage: " + storage); currentFx.actionCount = storage; } if (currentFx.selectorCount > 1) { currentFx.selectorCount = 1; } //Debug.Log("sdgdssh " + currentFx.selectorCount); } //Target checks //Selector Debug.Log("ACTIONCOUNT DEBUG: " + currentFx.actionCount + " " + currentFx.GetLibFx().actionType); if (currentFx.actionCount != 0 || (currentFx.GetLibFx().actionType == LibraryFX.ActionType.tap || currentFx.GetLibFx().actionType == LibraryFX.ActionType.ready)) { if (libFx.selectorPile == PlayCard.Pile.none || currentFx.selectorCount <= 0) { currentFx.selectorDone = true; } if (!CheckSelectorAll(playerIndex)) { currentFx.selectorDone = true; Debug.Log("Skip Selector"); } Debug.Log("currentFx" + currentFx.GetLibFx().description); SendGameManager(); ExeCardFx(); } else if (currentFx.GetLibFx().actionType != LibraryFX.ActionType.tap || currentFx.GetLibFx().actionType != LibraryFX.ActionType.ready) { if (currentFx.actionCount == 0) { effectInProgess = false; currentFx = new PlayFX(); } } }
public int CountCards( int playerIndex, PlayCard.Pile pile ) { int counter = 0; for (int i = 0; i < playCards.Count; i++) { var card = playCards[i]; if (card.owner != playerIndex) continue; if (card.pile != pile) continue; counter++; } return counter; }
public void ShowCardPreview(bool side, PlayCard card) { if (card.owner != GameManager.Get ().localPlayerId && card.pile == PlayCard.Pile.hand) { return; } GameObject child = Camera.main.transform.FindChild ("ZoomCard" + (side ? "L" : "R")).gameObject; MeshRenderer rend = child.transform.GetChild (0).gameObject.GetComponent<MeshRenderer> (); rend.material.mainTexture = card.GetTexturePreview (); child.SetActive (true); }
public void ShowStats(PlayCardController pcc, PlayCard playCard) { var libCard = CardLibrary.Get ().GetCard (playCard.libId); if (libCard.health > 0) { var transHealth = pcc.transform.FindChild ("Health"); var healthText = transHealth.GetComponent<TextMesh> (); healthText.text = "" + playCard.health; transHealth.gameObject.SetActive (!pcc.turned); } if (libCard.attack > 0) { var transAttack = pcc.transform.FindChild ("Attack"); var attackText = transAttack.GetComponent<TextMesh> (); attackText.text = "" + playCard.attack; transAttack.gameObject.SetActive (!pcc.turned); } if (libCard.moveRange > 1) { var transActions = pcc.transform.FindChild ("Action"); var actionsText = transActions.GetComponent<TextMesh> (); actionsText.text = "" + playCard.actions; transActions.gameObject.SetActive (!pcc.turned); } if (libCard.atkRange > 1) { var transRange = pcc.transform.FindChild ("Action"); var rangeText = transRange.GetComponent<TextMesh> (); rangeText.text = "" + libCard.atkRange; transRange.gameObject.SetActive (!pcc.turned); } }
private Transform CreateCardGFX(PlayCard card) { var cardObject = Instantiate ((GameObject)Resources.Load ("Prefabs/PlayCard")); var gfx = cardObject.transform; MeshRenderer rend = gfx.GetChild (0).gameObject.GetComponent<MeshRenderer> (); //Debug.Log("Card Texture: " + card.GetTexture().ToString()); rend.material.mainTexture = card.GetTexture (); //Debug.Log(card.id); var controller = cardObject.transform.gameObject.AddComponent<PlayCardController> (); controller.cardIndex = card.globalIdx; cardGfxs [card.globalIdx] = gfx; return gfx; }
public static List<PlayCard> PileFromJSON( JSONObject jsPile ) { List<PlayCard> pile = new List<PlayCard>(); for (int i = 0; i < jsPile.Count; i++) { PlayCard card = new PlayCard(); card.FromJSON(jsPile[i]); pile.Add(card); } return pile; }
//static int globalIdx = 0; public void BuildPlayPile() { List<PlayCard> playPile = new List<PlayCard>(); for (int i = 0; i < deck.Count; i++) { //globalIdx++; PlayCard playCard = new PlayCard(deck[i].cardID); playCard.InitLibrary(); playPile.Add(playCard); } playPile.Shuffle(); for (int i = 0; i < playPile.Count; i++) { playPile[i].pos = i; playPile[i].globalIdx = GameManager.Get().playCards.Count + i; playPile[i].pile = PlayCard.Pile.deck; playPile[i].owner = playerId; } GameManager.Get().playCards.AddRange(playPile); }
internal virtual void RemoveHandCard(PlayCard p) { ShowHand.Remove(p); Hand.Remove(p.Name); }
internal override void ShowCard(string s,int x,int y) { PlayCard a = new PlayCard(); switch (s) { case "銅貨": a = new Cooper(ShowField, ShowHand, this); break; case "銀貨": a = new Silver(ShowField, ShowHand, this); break; case "金貨": a = new Gold(ShowField, ShowHand, this); break; case "屋敷": a = new Mansion(ShowField, ShowHand, this); break; case "公領": a = new Landtag(ShowField, ShowHand, this); break; case "属州": a = new Province(ShowField, ShowHand, this); break; case "地下貯蔵庫": a = new UndergroundRepository(ShowField, ShowHand, this); break; case "市場": a = new Market(this); break; case "民兵": a = new Militia(ShowField, ShowHand, this); break; case "鉱山": a = new Mine(ShowField, ShowHand, this); break; case "堀": a = new Moat(this); break; case "鍛冶屋": a = new Smithy(this); break; case "村": a = new Village(this); break; case "木こり": a = new Woodcutter(this); break; case "改築": a = new Remodel(this); break; case "工房": a = new Workshop(this); break; } a.Location = new System.Drawing.Point(x,y); a.Size = new System.Drawing.Size(70, 110); a.Name = s; a.SizeMode = PictureBoxSizeMode.StretchImage; a.Image = global::dominion.Properties.Resources.back; form1.Controls.Add(a); a.BringToFront(); ShowHand.Add(a); a.ChangePointPara(880 + 20 * ShowHand.Count, 10 + 120 * num); for (int i = 0; i < ShowHand.Count; i++) { ShowHand[i].Refresh(); } ShowDeck.Refresh(); }