void Awake() { if (Application.platform == RuntimePlatform.IPhonePlayer) { Debug.Log("on iphone"); // System.Environment.SetEnvironmentVariable("MONO_REFLECTION_SERIALIZER", "yes"); Debug.Log("didn't error"); } EventControl.NewLevelReset(); QControl.Initialize(); playsLeftText = GameObject.Find("plays left #").GetComponent <TextMesh> (); movesLeftText = GameObject.Find("moves left #").GetComponent <TextMesh> (); dollarsText = GameObject.Find("Dollar count").GetComponent <TextMesh> (); deckText = GameObject.Find("Deck count").GetComponent <TextMesh> (); playButton = GameObject.Find("play end button").GetComponent <ButtonAnimate> (); moveButton = GameObject.Find("move end button").GetComponent <ButtonAnimate> (); endTurnButton = GameObject.Find("end turn button").GetComponent <ButtonAnimate> (); handObj = GameObject.Find("Hand"); playBoardObj = GameObject.Find("Play board"); playerObj = GameObject.FindGameObjectWithTag("Player"); player = GameObject.FindGameObjectWithTag("Player").GetComponent <Player> (); gooeyskin = (GUISkin)Resources.Load("GUISkins/S.GameControlInst.guiskin"); SaveDataControl.Load(); StateSavingControl.Initialize(this, player); if (SaveDataControl.UnlockedCards.Count == 0 | SaveDataControl.UnlockedGods.Count == 0) { SaveDataControl.NewSaveFile(); } MainMenu.UnlockCheck(); }
public static bool TryToUnlockCard(LibraryCard card) { if (!UnlockedCards.Contains(card) && UnlockedGods.Contains(card.God)) { UnlockedCards.Add(card); NewCardsAvailable = true; SaveDataControl.Save(); return(true); } return(false); }
//ends tutorial void endTutorial() { Tutorial.TutorialLevel = 0; S.MenuControlInst.TurnOnMenu(MenuControl.MenuType.MainMenu); SaveDataControl.FinishedTutorial = true; SaveDataControl.Save(); S.ClickControlInst.CardHasntBeenClickedOn(); gameObject.GetComponent <GridControl>().CancelInvoke(); }
void OnGUI() { GUI.depth = 1; GUI.Box(new Rect(0, 0, Screen.width, Screen.height), "", S.GUIStyleLibraryInst.MainStyles.BlackBackground); GUI.depth = 0; for (int i = 0; i < SaveDataControl.UnlockedGods.Count; i++) { int thisGodNumber = ShopControl.AllGods.IndexOf(SaveDataControl.UnlockedGods[i]); GodChoiceSelection[thisGodNumber] = GUI.Toggle(new Rect(Screen.width * .1f, Screen.height * .1f * i, Screen.width * .6f, Screen.height * .1f), GodChoiceSelection[thisGodNumber], SaveDataControl.UnlockedGods[i].ToString(), S.GUIStyleLibraryInst.GodChoiceStyles.GodChoiceToggle); GUI.Box(new Rect(Screen.width * .15f, Screen.height * .1f * i + Screen.height * .06f, Screen.width * .6f, Screen.height * .030f), ShopControl.GodDescriptions[thisGodNumber], S.GUIStyleLibraryInst.GodChoiceStyles.GodChoiceToggleText); if (GodChoiceSelection[ShopControl.AllGods.IndexOf(SaveDataControl.UnlockedGods[i])]) { GUI.Box(new Rect(Screen.width * .75f, Screen.height * .1f * i, Screen.width * .2f, Screen.height * .1f), S.ShopControlGUIInst.GodIcons[thisGodNumber]); } } if (!MainMenu.InGame) { if (GUI.Button(new Rect(Screen.width * .1f, Screen.height * .8f, Screen.width * .3f, Screen.height * .15f), "Back", S.GUIStyleLibraryInst.GodChoiceStyles.BackButton)) { S.MenuControlInst.TurnOnMenu(MenuControl.MenuType.MainMenu); SaveDataControl.Save(); } } if (GUI.Button(new Rect(Screen.width * .6f, Screen.height * .8f, Screen.width * .3f, Screen.height * .15f), "Start", S.GUIStyleLibraryInst.GodChoiceStyles.Title)) { if (GoalLibrary.NumberOfGoalsPossible(GodChoiceSelection) > 3) { S.MenuControlInst.TurnOffMenus(); startGameOrGoToNextLevel(); } else { MainMenu.errorText = "You must select more gods than\nthat to have enough goals to play."; } } if (MainMenu.errorText != "") { GUI.Box(new Rect(Screen.width * .2f, Screen.height * .7f, Screen.width * .6f, Screen.height * .075f), MainMenu.errorText); } }
void Awake() { //If we don't currently have a game control if (instance == null) { //...set this one to be it... DontDestroyOnLoad(gameObject); instance = this; } //...otherwise... else if (instance != this) { //...destroy this one because it is a duplicate. Destroy(gameObject); } }
public void Buy() { Debug.Log("buy"); S.ShopControlInst.BoughtCardFromGod(GODNUMBER); S.ShopControlInst.RemoveBoughtCard(title.text); background.gameObject.SetActive(false); showThisCardButton.gameObject.SetActive(false); buyingThisCardBackground.gameObject.transform.parent.gameObject.SetActive(false); costBarDescription.gameObject.transform.parent.gameObject.SetActive(false); boughtThisCardDialog.gameObject.SetActive(true); if (S.GameControlInst.Dollars >= thisCard.Cost) { string tempString = thisCard.CardName.ToString(); S.GameControlInst.Deck.Add(tempString); S.GameControlInst.AddDollars(-thisCard.Cost); if (SaveDataControl.TryToUnlockCard(thisCard)) { boughtThisCardText.text = ("Added " + thisCard.God.ToString() + "'s card " + tempString + " to your deck as well as your collection!"); boughtThisCardDialog.sprite = S.ShopGridCanvasInst.BOUGHTSPRITEADDEDTOCOLLECTION; } else { boughtThisCardText.text = ("This card has been added to your deck!"); boughtThisCardDialog.sprite = S.ShopGridCanvasInst.BOUGHTSPRITENORMAL; } Invoke("HideThisCard", 2.0f); StateSavingControl.Save(); } else { boughtThisCardText.text = ("You don't have enough money! This card costs $" + thisCard.Cost.ToString() + "."); boughtThisCardDialog.sprite = S.ShopGridCanvasInst.BOUGHTSPRITENORMAL; } StateSavingControl.Save(); }
public void TurnOnShopGUI() { highScoreNotification = new bool[S.ShopControlInst.Goals.Length]; for (int i = 0; i < S.ShopControlInst.Goals.Length; i++) { if (SaveDataControl.CheckForHighScores(S.ShopControlInst.Goals[i])) { highScoreNotification[i] = true; } } IgnoreClicking = true; S.ShopAndGoalParentCanvasInst.SetUpShopRows(); StateSavingControl.TurnShopModeOn(); StateSavingControl.Save(); S.ShopAndGoalParentCanvasInst.TurnOnShopGUI(); }
public static bool CheckForHighScores(Goal goal) { if (!SaveDataControl.GoalHighScores.ContainsKey(goal.MiniDescription)) { if ((goal.HighScore != 0) | (goal.HighScore == 0 && !goal.HigherScoreIsGood)) { SaveDataControl.GoalHighScores[goal.MiniDescription] = goal.HighScore; } SaveDataControl.Save(); return(true); } if (goal.HigherScoreIsGood) { if (SaveDataControl.GoalHighScores[goal.MiniDescription] < goal.HighScore) { Debug.Log("new high score is " + goal.HighScore); SaveDataControl.GoalHighScores[goal.MiniDescription] = goal.HighScore; SaveDataControl.Save(); return(true); } } else { if (SaveDataControl.GoalHighScores[goal.MiniDescription] > goal.HighScore) { Debug.Log("new high score is " + goal.HighScore); SaveDataControl.GoalHighScores[goal.MiniDescription] = goal.HighScore; SaveDataControl.Save(); return(true); } } return(false); }
void OnGUI() { GUI.depth = 1; GUI.Box(new Rect(0, 0, Screen.width, Screen.height), "", S.GUIStyleLibraryInst.MainStyles.BlackBackground); GUI.depth = 0; GUI.BeginGroup(new Rect(Screen.width * .1f, Screen.height * .05f, Screen.width * .9f, Screen.height * .9f)); if (allCards.Length == 0) { FindCards(); } for (int i = 0; i < ShopControl.AllGods.Count - 2; i++) { if (SaveDataControl.UnlockedGods.Contains(ShopControl.AllGods[i])) { GUI.Box(new Rect(seventh * i, 0f, seventh, Screen.height * .1f), new GUIContent(S.ShopControlGUIInst.GodIcons[i]), GUIStyle.none); } else { GUI.Box(new Rect(seventh * i, 0f, seventh, Screen.height * .1f), new GUIContent(S.ShopControlGUIInst.GodIcons[7]), GUIStyle.none); } } scrollPos = GUI.BeginScrollView(new Rect(0, Screen.height * .1f, Screen.width * .9f, Screen.height * .47f), scrollPos, new Rect(0, Screen.height * .1f, Screen.width * .795f, Screen.height * .1f * longestLength)); for (int i = 0; i < ShopControl.AllGods.Count; i++) { for (int j = 0; j < allCards[i].Count; j++) { LibraryCard thisCard = allCards[i][j]; Texture2D Rarity = S.ShopControlGUIInst.PaperTexture; if (thisCard.ThisRarity == Card.Rarity.Bronze) { Rarity = S.ShopControlGUIInst.BronzeTexture; } else if (thisCard.ThisRarity == Card.Rarity.Silver) { Rarity = S.ShopControlGUIInst.SilverTexture; } else if (thisCard.ThisRarity == Card.Rarity.Gold) { Rarity = S.ShopControlGUIInst.GoldTexture; } GUIContent name = new GUIContent(thisCard.CardName, Rarity); //if this isn't unlocked, don't display it.... if (!UnlockedCardNames.Contains(thisCard.CardName) | (thisCard.ThisRarity != Card.Rarity.Paper && !SaveDataControl.UnlockedGods.Contains(thisCard.God))) { if (GUI.Button(new Rect(seventh * i, Screen.height * .1f * (j + 1), seventh, Screen.height * .1f), "???", S.GUIStyleLibraryInst.CustomizeStyles.CardToggleOff)) { } } //if this is in your starting deck, show a CardToggleRemove button, which removes it else if (StartingDeckCardNames.Contains(thisCard.CardName)) { GUIStyle UnlockedStyle = new GUIStyle(S.GUIStyleLibraryInst.CustomizeStyles.CardToggleRemove); if (thisCard.ThisRarity == Card.Rarity.Paper) { UnlockedStyle.normal = S.GUIStyleLibraryInst.CustomizeStyles.CardNeutral.normal; } if (GUI.Button(new Rect(seventh * i, Screen.height * .1f * (j + 1), seventh, Screen.height * .1f), name, UnlockedStyle)) { selectedCard = thisCard; selectedGod = i; if (thisCard.ThisRarity == Card.Rarity.Paper) { return; } for (int k = 0; k < SaveDataControl.StartingDeckCards.Count; k++) { if (SaveDataControl.StartingDeckCards[k].CardName == thisCard.CardName) { SaveDataControl.StartingDeckCards.RemoveAt(k); } } FindCards(); } } //if this isn't in your starting deck, show a CardToggleAdd button, //which adds it to your starting deck if you haven't added your Bronze or silver card else { if (GUI.Button(new Rect(seventh * i, Screen.height * .1f * (j + 1), seventh, Screen.height * .1f), name, S.GUIStyleLibraryInst.CustomizeStyles.CardToggleAdd)) { selectedCard = thisCard; selectedGod = i; if (thisCard.ThisRarity == Card.Rarity.Paper) { return; } else { Card.Rarity thisRarity = thisCard.ThisRarity; for (int k = 0; k < SaveDataControl.StartingDeckCards.Count; k++) { if (SaveDataControl.StartingDeckCards[k].ThisRarity == thisRarity) { SaveDataControl.StartingDeckCards.RemoveAt(k); break; } } SaveDataControl.StartingDeckCards.Add(thisCard); } FindCards(); } } } } GUI.EndScrollView(); GUI.BeginGroup(new Rect(Screen.width * .4f, Screen.height * .585f, Screen.width * .4f, Screen.height * .3f), ""); if (BronzeSpotTaken != "") { if (GUI.Button(new Rect(0, 0, Screen.width * .4f, Screen.height * .1f), new GUIContent("Your added Bronze card is " + BronzeSpotTaken + " ", S.ShopControlGUIInst.BronzeTexture), S.GUIStyleLibraryInst.CustomizeStyles.RarityToggleOn)) { selectedCard = CardLibrary.Lib[BronzeSpotTaken]; } } else { GUI.Box(new Rect(0, 0, Screen.width * .4f, Screen.height * .1f), new GUIContent("You haven't chosen a Bronze card to add to your deck."), S.GUIStyleLibraryInst.CustomizeStyles.RarityToggleOff); } if (silverSpotTaken != "") { if (GUI.Button(new Rect(0, Screen.height * .1f, Screen.width * .4f, Screen.height * .1f), new GUIContent("Your added Silver card is " + silverSpotTaken + " ", S.ShopControlGUIInst.SilverTexture), S.GUIStyleLibraryInst.CustomizeStyles.RarityToggleOn)) { selectedCard = CardLibrary.Lib[silverSpotTaken]; } } else { GUI.Box(new Rect(0, Screen.height * .1f, Screen.width * .4f, Screen.height * .1f), new GUIContent("You haven't chosen a silver card to add to your deck."), S.GUIStyleLibraryInst.CustomizeStyles.RarityToggleOff); } if (goldSpotTaken != "") { if (GUI.Button(new Rect(0, Screen.height * .2f, Screen.width * .4f, Screen.height * .1f), new GUIContent("Your added Gold card is " + goldSpotTaken + " ", S.ShopControlGUIInst.GoldTexture), S.GUIStyleLibraryInst.CustomizeStyles.RarityToggleOn)) { selectedCard = CardLibrary.Lib[goldSpotTaken]; } } else { GUI.Box(new Rect(0, Screen.height * .2f, Screen.width * .4f, Screen.height * .1f), new GUIContent("You haven't chosen a gold card to add to your deck."), S.GUIStyleLibraryInst.CustomizeStyles.RarityToggleOff); } GUI.EndGroup(); if (selectedCard.CardName != null) { GUI.BeginGroup(new Rect(Screen.width * 0f, Screen.height * .585f, Screen.width * .35f, Screen.height * .3f), ""); if (S.ShopControlGUIInst.CardTextures[selectedGod] != null) { GUI.DrawTexture(new Rect(Screen.width * .0f, Screen.height * .0f, Screen.width * .35f, Screen.height * .3f), S.ShopControlGUIInst.CardTextures[selectedGod]); } GUIStyle cardNameStyle = new GUIStyle(S.GUIStyleLibraryInst.CustomizeStyles.CardNameStyle); cardNameStyle.fontSize = S.GUIStyleLibraryInst.CustomizeStyles.CustomizeCardNameFontSize; cardNameStyle.alignment = TextAnchor.UpperLeft; GUIStyle cardTextStyle = new GUIStyle(S.GUIStyleLibraryInst.CustomizeStyles.CardTextStyle); cardTextStyle.fontSize = S.GUIStyleLibraryInst.CustomizeStyles.CustomizeCardTextFontSize; cardTextStyle.alignment = TextAnchor.UpperLeft; if (selectedCard.God == ShopControl.Gods.Akan | selectedCard.God == ShopControl.Gods.Buluc | selectedCard.God == ShopControl.Gods.Ikka | selectedCard.God == ShopControl.Gods.Kinich | selectedCard.God == ShopControl.Gods.Chac) { cardNameStyle.normal.textColor = Color.black; cardTextStyle.normal.textColor = Color.black; } else { cardNameStyle.normal.textColor = Color.white; cardTextStyle.normal.textColor = Color.white; } GUI.Box(new Rect(Screen.width * .025f, Screen.height * .025f, Screen.width * .25f, Screen.height * .1f), selectedCard.DisplayName, cardNameStyle); Texture2D icon = Resources.Load("sprites/card icons/" + selectedCard.IconPath) as Texture2D; GUI.Box(new Rect(Screen.width * .21f, Screen.height * .025f, Screen.width * .11f, Screen.height * .11f), icon, GUIStyle.none); GUI.Box(new Rect(Screen.width * .025f, Screen.height * .1f, Screen.width * .3f, Screen.height * .15f), selectedCard.DisplayText, cardTextStyle); GUI.DrawTexture(new Rect(Screen.width * .275f, Screen.height * .25f, Screen.width * .05f, Screen.width * .05f), S.ShopControlGUIInst.GodIcons[selectedGod]); Card.Rarity rarity = selectedCard.ThisRarity; Texture2D rarityTexture = S.ShopControlGUIInst.PaperTexture; if (rarity == Card.Rarity.Bronze) { rarityTexture = S.ShopControlGUIInst.BronzeTexture; } else if (rarity == Card.Rarity.Silver) { rarityTexture = S.ShopControlGUIInst.SilverTexture; } else if (rarity == Card.Rarity.Gold) { rarityTexture = S.ShopControlGUIInst.GoldTexture; } GUI.DrawTexture(new Rect(Screen.width * .025f, Screen.height * .25f, Screen.width * .05f, Screen.width * .05f), rarityTexture); GUI.EndGroup(); } else { GUI.Box(new Rect(Screen.width * .0f, Screen.height * .585f, Screen.width * .3f, Screen.height * .3f), "Your starting deck consists of two of every card of paper rarity.\n\n" + "You can pick one unlocked card of each rarity to add to your starting deck.", S.GUIStyleLibraryInst.CustomizeStyles.InstructionInfoBox); } GUI.EndGroup(); GUIStyle gobackstyle = new GUIStyle(S.GUIStyleLibraryInst.CustomizeStyles.CardToggleRemove); gobackstyle.fontSize = 14; if (GUI.Button(new Rect(Screen.width * .3f, Screen.height * .95f, Screen.width * .4f, Screen.height * .05f), "Go back", gobackstyle)) { SaveDataControl.Save(); selectedCard = new LibraryCard(); S.MenuControlInst.TurnOnMenu(MenuControl.MenuType.MainMenu); } }