private void queryInventorySucceededEvent(Inventory inventory) { if (inventory != null) { _inventory = inventory; Purchase mPurchase = inventory.GetPurchase(SKU); string rsaXml = B64X.Decrypt((Resources.Load("RSA") as TextAsset).text, "myRSA!!!xml"); bool check = GooglePlayPurchaseGuard.Verify(mPurchase.OriginalJson, mPurchase.Signature, rsaXml); if (!check) { print("incorrect"); } bool payed = (mPurchase != null && VerifyDeveloperPayload(mPurchase.DeveloperPayload) && check && mPurchase.PurchaseState == 0); string key = B64X.GetNewKey(); menuManager.payed = B64X.Encrypt(payed.ToString(), key); menuManager.key2 = key; } else { print("Debil!"); } }
void rewriteXML() { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.InnerXml = B64X.Decrypt(PlayerPrefs.GetString("GSAGSAGSA"), "ZeFuTo!"); if (score > maxScore) { xmlDoc.SelectSingleNode("Information/MaxScore").InnerText = score.ToString(); maxScore = score; } xmlDoc.SelectSingleNode("Information/Gliders").InnerText = gliders.ToString(); xmlDoc.SelectSingleNode("Information/Attempts").InnerText = (++Attempts).ToString(); xmlDoc.SelectSingleNode("Information/Scooters").InnerText = Scooters.ToString(); xmlDoc.SelectSingleNode("Information/Ducks").InnerText = Ducks.ToString(); xmlDoc.SelectSingleNode("Information/Level").InnerText = Level.ToString(); //Carrots carrots = B64X.Decrypt(carrots, key); gameCarrots = B64X.Decrypt(gameCarrots, key2); int money = int.Parse(carrots); carrots = ""; int newMoney = int.Parse(gameCarrots); gameCarrots = ""; money += newMoney; xmlDoc.SelectSingleNode("Information/Money").InnerText = money.ToString(); money = -127; PlayerPrefs.SetString("GSAGSAGSA", B64X.Encrypt(xmlDoc.InnerXml, "ZeFuTo!")); }
public bool Payed() { payed = B64X.Decrypt(payed, key2); bool val = bool.Parse(payed); key2 = B64X.GetNewKey(); payed = B64X.Encrypt(payed, key2); return(val); }
public int getMoney() { carrots = B64X.Decrypt(carrots, key); int money = int.Parse(carrots); key = B64X.GetNewKey(); carrots = B64X.Encrypt(carrots, key); return(money); }
private void createXML() { TextAsset xmlAsset = Resources.Load("274") as TextAsset; PlayerPrefs.SetString("GSAGSAGSA", B64X.Encrypt(xmlAsset.text, "ZeFuTo!")); Debug.Log(PlayerPrefs.GetString("GSAGSAGSA")); key = B64X.GetNewKey(); carrots = B64X.Encrypt("0", key); }
public void AddCarrot() { gameCarrots = B64X.Decrypt(gameCarrots, key2); int money = int.Parse(gameCarrots); money += multiple; gameCarrots = money.ToString(); money = -127; CarrotsLabels[0].text = gameCarrots.ToString(); CarrotsLabels[1].text = gameCarrots.ToString(); CarrotsLabels[2].text = gameCarrots.ToString(); key2 = B64X.GetNewKey(); gameCarrots = B64X.Encrypt(gameCarrots, key2); }
public void changeMoney(int val, bool changeInTapjoy) { carrots = B64X.Decrypt(carrots, key); int money = int.Parse(carrots); money += val; carrots = money.ToString(); money = -127; CarrotsLabel.text = carrots.ToString(); CarrotsLabel1.text = carrots.ToString(); key = B64X.GetNewKey(); carrots = B64X.Encrypt(carrots, key); #if UNITY_ANDROID if (changeInTapjoy) { mainTapjoy.ChangeMoney(val); } #endif }
private void createXML() { TextAsset xmlAsset = Resources.Load("274") as TextAsset; PlayerPrefs.SetString("GSAGSAGSA", B64X.Encrypt(xmlAsset.text, "ZeFuTo!")); Debug.Log(PlayerPrefs.GetString("GSAGSAGSA")); for (int i = 0; i < 4; i++) { BonusesDuration[i] = 10; } jumpBTimeLabel.text = "Время бонуса: [990000]" + BonusesDuration[0].ToString() + "[000000] сек."; galoshaTimeLabel.text = "Время бонуса: [990000]" + BonusesDuration[1].ToString() + "[000000] сек."; nonStopTimeLabel.text = "Время бонуса: [990000]" + BonusesDuration[2].ToString() + "[000000] сек."; gliderTimeLabel.text = "Время бонуса: [990000]" + BonusesDuration[3].ToString() + "[000000] сек."; gliders = 0; glidersLabel.text = "Джетпаки: " + gliders.ToString() + " шт."; key = B64X.GetNewKey(); carrots = B64X.Encrypt("0", key); }
void Start() { //PlayerPrefs.DeleteKey("GSAGSAGSA"); musicEnabled = true; clothData = new string[characters.Length][]; openedCloth = new bool[characters.Length][]; BonusesDuration = new float[4]; for (int i = 0; i < characters.Length; i++) { clothData[i] = new string[MaxClothCount]; openedCloth[i] = new bool[MaxClothCount]; for (int j = 0; j < MaxClothCount; j++) { clothData[i][j] = "none"; openedCloth[i][j] = false; } } PriceLabel.alpha = 0; PriceLabel1.alpha = 0; openedPers = new bool[PersCount]; openedPers[0] = true; for (int i = 1; i < PersCount; i++) { openedPers[i] = false; } openedPers[2] = true; StatePoint = 1; if (PlayerPrefs.HasKey("GSAGSAGSA")) { try { readXML(); } catch { Debug.LogError("Error!"); PlayerPrefs.DeleteKey("GSAGSAGSA"); createXML(); } } else { createXML(); } readXMLCloth(); FillGrid(); WearPers(); gridSelecion.CenterOn(gridElements[gridElements.Length - 1].transform); if (openedPers[StatePoint - 1]) { PriceLabel.alpha = 0; PriceLabel1.alpha = 0; PlayLabel.text = "Играть"; } else { PlayLabel.text = "Купить"; PriceLabel.alpha = 1; PriceLabel.text = prices[StatePoint - 1].ToString(); PriceLabel1.alpha = 1; } if (StatePoint == 4 || StatePoint == 6 || StatePoint == 7) { ClothShopButton.SetActive(false); } else { ClothShopButton.SetActive(true); } #if UNITY_ANDROID key2 = B64X.GetNewKey(); payed = B64X.Encrypt("false", key2); #endif }
void rewriteXML() { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.InnerXml = B64X.Decrypt(PlayerPrefs.GetString("GSAGSAGSA"), "ZeFuTo!"); xmlDoc.SelectSingleNode("Information/Pers").InnerText = persName; xmlDoc.SelectSingleNode("Information/MusicEnabled").InnerText = musicEnabled.ToString(); xmlDoc.SelectSingleNode("Information/Night").InnerText = night.ToString(); xmlDoc.SelectSingleNode("Information/StartRoute").InnerText = inTheForest.ToString(); xmlDoc.SelectSingleNode("Information/Gliders").InnerText = gliders.ToString(); string line = ""; for (int i = 0; i < openedPers.Length; i++) { if (openedPers[i]) { line += '1'; } else { line += '0'; } } xmlDoc.SelectSingleNode("Information/OpenedPers").InnerText = line; XmlNode node; for (int i = 0; i < PersCount; i++) { node = xmlDoc.SelectSingleNode("Information/Cloth/" + parsePersName(i + 1)); line = ""; for (int j = 0; j < openedCloth[i].Length; j++) { if (openedCloth[i][j]) { line += '1'; } else { line += '0'; } } node.Attributes.Item(0).Value = line; for (int j = 0; j < 4; j++) { node.Attributes.Item(j + 1).Value = clothData[i][j]; } } node = xmlDoc.SelectSingleNode("Information/BonusesDuration"); for (int i = 0; i < 4; i++) { node.Attributes.Item(i).Value = BonusesDuration[i].ToString(); } //Carrots xmlDoc.SelectSingleNode("Information/Money").InnerText = getMoney().ToString(); //xmlDoc.Save("C:\\274.xml"); PlayerPrefs.SetString("GSAGSAGSA", B64X.Encrypt(xmlDoc.InnerXml, "ZeFuTo!")); }
private void readXML() { XmlTextReader reader = new XmlTextReader(B64X.Decrypt(PlayerPrefs.GetString("GSAGSAGSA"), "ZeFuTo!"), XmlNodeType.Document, null); string NodeName = ""; while (reader.Read()) { /*if (reader.NodeType == XmlNodeType.Text && NodeName == "SoundEnabled") * { * soundEnabled = bool.Parse(reader.Value); * UImusicEnanled.isChecked = soundEnabled; * OnSoundChange(soundEnabled); * } */ if (reader.NodeType == XmlNodeType.Text && NodeName == "MusicEnabled") { musicEnabled = bool.Parse(reader.Value); UImusicEnanled.isChecked = musicEnabled; } else if (reader.NodeType == XmlNodeType.Text && NodeName == "Night") { night = bool.Parse(reader.Value); UInight.isChecked = night; } else if (reader.NodeType == XmlNodeType.Text && NodeName == "StartRoute") { inTheForest = bool.Parse(reader.Value); UIForest.isChecked = inTheForest; } else if (reader.NodeType == XmlNodeType.Text && NodeName == "Gliders") { gliders = int.Parse(reader.Value); glidersLabel.text = "Джетпаки: [990000]" + gliders.ToString() + "[000000] шт"; } else if (reader.NodeType == XmlNodeType.Text && NodeName == "MaxScore") { maxScore = int.Parse(reader.Value); MaxScoreLabel.text = maxScore.ToString(); //break; //можно прервать цикл (нужно прочитать только одно значение) } else if (reader.NodeType == XmlNodeType.Text && NodeName == "Pers") { persName = reader.Value; SwitchStatePoint(); } else if (reader.NodeType == XmlNodeType.Text && NodeName == "OpenedPers") { string line = reader.Value; for (int pos = 0; pos < line.Length; pos++) { if (line[pos] == '1') { openedPers[pos] = true; } else { openedPers[pos] = false; } } } else if (reader.NodeType == XmlNodeType.Text && NodeName == "Money") { key = B64X.GetNewKey(); //if(reader.Value == "0") //carrots = B64X.Encrypt("70000", key); //else carrots = B64X.Encrypt(reader.Value, key); changeMoney(0, false); } else if (reader.NodeType == XmlNodeType.Text && NodeName == "Attempts") { int Attempts = int.Parse(reader.Value); AttemptsLabel.text = "Попыток: " + Attempts.ToString(); } else if (reader.NodeType == XmlNodeType.Element && reader.Name == "BonusesDuration") { for (int i = 0; i < reader.AttributeCount; i++) { BonusesDuration[i] = float.Parse(reader.GetAttribute(i)); } jumpBTimeLabel.text = "Время бонуса: [990000]" + BonusesDuration[0].ToString() + "[000000] сек."; galoshaTimeLabel.text = "Время бонуса: [990000]" + BonusesDuration[1].ToString() + "[000000] сек."; nonStopTimeLabel.text = "Время бонуса: [990000]" + BonusesDuration[2].ToString() + "[000000] сек."; gliderTimeLabel.text = "Время бонуса: [990000]" + BonusesDuration[3].ToString() + "[000000] сек."; } else if (reader.NodeType == XmlNodeType.Element) { NodeName = reader.Name; } } reader.Close(); }
private static void SetValue(string key, string value) { PlayerPrefs.SetString(key, B64X.Encrypt(value, Md5.Encode(key + Password))); PlayerPrefs.Save(); }
void Awake() { clothData = new string[4]; for (int i = 0; i < clothData.Length; i++) { clothData[i] = "none"; } score = 0; maxScore = 0; playing = true; //soundEnabled = true; musicEnabled = true; recordBroken = false; TimeScale = 1; multiple = 1; Time.timeScale = TimeScale; if (PlayerPrefs.HasKey("GSAGSAGSA")) { readXML(); } else { createXML(); } SpawnPers(); readXMLCloth(); readXMLBonusesDuration(); WearPers(); pm = player.GetComponent <PlayerMove>(); if (night) { Color nightColor = new Color(0.12f, 0.12f, 0.12f); //skyMaterial.color = nightColor; //directionalLight.color = nightColor; directionalLight.intensity = 0.1f; skyMaterial.mainTexture = nightSkyTexture; RenderSettings.fogColor = nightColor; Camera.main.backgroundColor = nightColor; } if (inTheForest) { pm.StartFromForest(); areaSpawner.StartFromForest(); carSpawner.StartFromForest(); } else { areaSpawner.StartFromRoute(); carSpawner.StartFromRoute(); pm.StartFromRoute(); } key2 = B64X.GetNewKey(); gameCarrots = B64X.Encrypt("0", key2); //AudioListener.pause = !soundEnabled; if (!musicEnabled) { pm.myCamera.audio.enabled = false; } for (int i = 0; i < clothData.Length; i++) { if (clothData[i] == "sparta" || clothData[i] == "arbuz" || clothData[i] == "Lopata" || clothData[i] == "Shlem") { pm.lives++; } } if (persName == "Bear") { pm.lives += 3; } #if UNITY_ANDROID if (Tapjoy.IsConnected) { tapjoy.enabled = true; } Tapjoy.OnConnectSuccess += HandleConnectSuccess; #endif }
private void readXML() { XmlTextReader reader = new XmlTextReader(B64X.Decrypt(PlayerPrefs.GetString("GSAGSAGSA"), "ZeFuTo!"), XmlNodeType.Document, null); string NodeName = ""; while (reader.Read()) { if (reader.NodeType == XmlNodeType.Text && NodeName == "MaxScore") { maxScore = int.Parse(reader.Value); for (int i = 0; i < MaxScoreLabels.Length; i++) { MaxScoreLabels[i].text = maxScore.ToString(); } //break; //можно прервать цикл (нужно прочитать только одно значение) } else if (reader.NodeType == XmlNodeType.Text && NodeName == "Pers") { persName = reader.Value; } else if (reader.NodeType == XmlNodeType.Text && NodeName == "Night") { night = bool.Parse(reader.Value); } else if (reader.NodeType == XmlNodeType.Text && NodeName == "StartRoute") { inTheForest = !bool.Parse(reader.Value); } //else if (reader.NodeType == XmlNodeType.Text && NodeName == "SoundEnabled") //{ //soundEnabled = bool.Parse(reader.Value); //} else if (reader.NodeType == XmlNodeType.Text && NodeName == "MusicEnabled") { musicEnabled = bool.Parse(reader.Value); } else if (reader.NodeType == XmlNodeType.Text && NodeName == "Money") { key = B64X.GetNewKey(); carrots = B64X.Encrypt(reader.Value, key); } else if (reader.NodeType == XmlNodeType.Text && NodeName == "Attempts") { Attempts = int.Parse(reader.Value); } else if (reader.NodeType == XmlNodeType.Text && NodeName == "Gliders") { gliders = int.Parse(reader.Value); if (persName == "gera" || persName == "ball" || persName == "kuritsa" || persName == "Bear" || persName == "Koza") { if (gliders != 0) { EnableFlyButton(); } } string pickupName = "Монеты:"; if (persName == "rabbit") { pickupName = "Морковь:"; } else if (persName == "kuritsa") { pickupName = "Яйца:"; } else if (persName == "dog") { pickupName = "Косточки:"; } else if (persName == "Bear") { pickupName = "Малина:"; } CarrotsTextLabels[0].text = pickupName; CarrotsTextLabels[1].text = pickupName; } else if (reader.NodeType == XmlNodeType.Text && NodeName == "Scooters") { Scooters = int.Parse(reader.Value); } else if (reader.NodeType == XmlNodeType.Text && NodeName == "Level") { Level = int.Parse(reader.Value); } else if (reader.NodeType == XmlNodeType.Text && NodeName == "Ducks") { Ducks = int.Parse(reader.Value); } else if (reader.NodeType == XmlNodeType.Element) { NodeName = reader.Name; } } reader.Close(); }
public static string EncryptB64X(string value, string key) { return(B64X.Encrypt(value, key)); }