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); } }
public void AddCardUI(int id) { //Debug.Log("AddCardUI() Log: Function entered " + id); Vector2 spawnPos = new Vector2(0, 0); Button listCard = Instantiate(listPrefab, spawnPos, Quaternion.identity) as Button; listCard.transform.SetParent(GetListTransform().transform, false); var txt = listCard.GetComponentInChildren <Text>(); var ident = listCard.GetComponent <CardIdentity>(); ident.id = id; txt.text = ident.GetName(); var list = CardLibrary.Get().cardList; for (int i = 0; i < list.Count; i++) { if (list[i].cardID == ident.id) { Debug.Log(ident.id); LibraryCard.Cult libCult = CardLibrary.Get().cardList[i].cult; string cult = LibraryCard.CultToString(libCult); listCard.GetComponent <Image>().color = CultColorUI(cult); break; } } uiCards.Add(listCard); MoveCardsUI(); deckCounterTxt.text = "Size: " + deck.Count; }
public bool NextFx() { if (fxIdx >= CardLibrary.Get().GetCard(libId).fxList.Count - 1) { return(false); } fxIdx++; return(true); }
public static List <LibraryCard> DeckFromJSON(JSONObject jsDeck) { List <LibraryCard> deck = new List <LibraryCard>(); for (int i = 0; i < jsDeck.Count; i++) { int id = (int)jsDeck[i]; LibraryCard card = CardLibrary.Get().GetCard(id); deck.Add(card); } return(deck); }
public void SpawnCard() { Vector3 spawnPos; float x = 7f; float y = 3.5f; int counter = -1; int nameCounter = -1; int cardCounter = 0; GameObject card; for (int j = 0; j < 27; j++) { for (int i = 0; i < 3; i++) { nameCounter++; counter++; card = (GameObject)Resources.Load("Prefabs/CardDB"); spawnPos = new Vector3(x + (i * 2.2f), y - (j * 3.05f), 0); GameObject cardSpawn = (GameObject)Instantiate(card, spawnPos, Quaternion.identity); cardSpawn.name = "card" + nameCounter.ToString(); //Fix card position somehow... cardSpawn.transform.rotation = Quaternion.EulerAngles(-Mathf.PI / 2, 0, 0); //cardSpawn.transform.localScale = new Vector3(1, 1, 1); cardSpawn.transform.gameObject.AddComponent <CardControllerDB>(); cards.Add(cardSpawn); var rend = cardSpawn.transform.FindChild("GFX").GetComponent <MeshRenderer>(); for (int k = 0; k < cards.Count; k++) { rend.material.mainTexture = CardLibrary.Get().cardList[k].texture_p; } if (counter >= (cardLibrary.cardList.Count - 1)) { counter = -1; } cardCounter++; if (cardCounter == cardsCount) { return; } } } }
public void AddCard(int index) { LibraryCard card; Debug.Log(deck.Count); if (deck.Count == maxDeckCount) { return; } int count = 0; for (int i = 0; i < deck.Count; i++) { if (deck[i].cardID == cardLibrary.cardList[index].cardID) { count++; } } if (count >= maxCardCount) { return; } if (index > CardLibrary.Get().cardList.Count) { Debug.LogError("Finish Cardlist, yo"); return; } card = cardLibrary.cardList[index]; deck.Add(card); AddCardUI(card.cardID); }
public LibraryFX GetLibFx() { return(CardLibrary.Get().GetCard(libId).fxList[fxIdx]); }
public static void LoadFromFile(int texId) { string skin = ""; //string[] fileArray = Directory.GetFiles(filePath); var array = Resources.LoadAll("Images/", typeof(Texture2D)); Debug.Log(OptionsMenu.isDarkFantasy + " " + OptionsMenu.isWonderland); //DELETE FOR BUILD VERSION //OptionsMenu.isDarkFantasy = true; if (OptionsMenu.isDarkFantasy) { skin = "cards_DF/"; Debug.Log(skin); } else if (OptionsMenu.isWonderland) { skin = "cards_WL/"; Debug.Log(skin); } else { Debug.LogError("NO SKIN ASSIGNED; DEFAULTED TO DARK FANTASY"); skin = "cards_DF/"; Debug.Log(skin); } Debug.Log(skin); if (texId == 0) { array = Resources.LoadAll("Images/" + skin + "inPlay", typeof(Texture2D)); } if (texId == 1) { array = Resources.LoadAll("Images/" + skin + "preview", typeof(Texture2D)); } var imgArray = new Texture2D[array.Length]; for (int i = 0; i < array.Length; i++) { imgArray[i] = array[i] as Texture2D; } for (int i = 0; i < imgArray.Length; i++) { //Debug.Log("texname " + imgArray[i].name); for (int j = 0; j < CardLibrary.Get().cardList.Count; j++) { if (CardLibrary.Get().cardList[j].cardID == Int32.Parse(imgArray[i].name)) { if (texId == 0) { CardLibrary.Get().cardList[j].texture = imgArray[i]; } if (texId == 1) { CardLibrary.Get().cardList[j].texture_p = imgArray[i]; } /* * else * { * GameManager.Get().SendNotification(GameManager.Get().localPlayerId, "Unable to load textures, texture load index invalid"); * } * */ } } } }
public void InitLibrary() { this.health = CardLibrary.Get().GetCard(libId).health; this.attack = CardLibrary.Get().GetCard(libId).attack; this.actions = CardLibrary.Get().GetCard(libId).moveRange; }
public LibraryCard GetLibCard() { return(CardLibrary.Get().GetCard(libId)); }
public Texture2D GetTexturePreview() { return(CardLibrary.Get().GetCard(libId).texture_p); }
public Texture2D GetTexture() { return(CardLibrary.Get().GetCard(libId).texture); }
//public Transform cardGfx; public string GetName() { return(CardLibrary.Get().GetCard(libId).cardName); }