Example #1
0
    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!");
        }
    }
Example #2
0
    public bool Payed()
    {
        payed = B64X.Decrypt(payed, key2);

        bool val = bool.Parse(payed);

        key2  = B64X.GetNewKey();
        payed = B64X.Encrypt(payed, key2);
        return(val);
    }
Example #3
0
    public int getMoney()
    {
        carrots = B64X.Decrypt(carrots, key);

        int money = int.Parse(carrots);

        key     = B64X.GetNewKey();
        carrots = B64X.Encrypt(carrots, key);
        return(money);
    }
Example #4
0
    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);
    }
Example #5
0
    public bool Donate()
    {
        if (_isInitialized)
        {
            string randomString = B64X.GetNewKey() + B64X.GetNewKey();

            //real Purchase
            OpenIAB.purchaseProduct(SKU, randomString);
            //ToDo: save payload on server

            return(true);
        }
        else
        {
            return(false);
        }
    }
Example #6
0
    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);
    }
Example #7
0
    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
    }
Example #8
0
    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);
    }
Example #9
0
    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
    }
Example #10
0
    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();
    }
Example #11
0
    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
    }
Example #12
0
    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();
    }