Exemplo n.º 1
0
    public void LoadData()
    {
        XmlDocument xmlDoc   = new XmlDocument();
        TextAsset   xmlAsset = Resources.Load("PersData") as TextAsset;

        xmlDoc.LoadXml(B64X.Decrypt(xmlAsset.text, "_ip#X1zaMoQ#mSig!%9j"));

        LoadTree(xmlDoc.DocumentElement);
    }
Exemplo n.º 2
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);
    }
Exemplo n.º 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);
    }
Exemplo n.º 4
0
    public bool Payed()
    {
        payed = B64X.Decrypt(payed, key2);

        bool val = bool.Parse(payed);

        key2  = B64X.GetNewKey();
        payed = B64X.Encrypt(payed, key2);
        return(val);
    }
Exemplo n.º 5
0
 void Awake()
 {
     SetHeroesToButton();
     SetSpeelToButton();
     ownTransform  = transform;
     gold          = B64X.Encode(startedGold.ToString());
     backgroundSR  = background.GetComponent <SpriteRenderer>();
     currentCamera = ownTransform.GetComponent <Camera>();
     maxCameraSize = currentCamera.orthographicSize;
     minCameraSize = maxCameraSize - 1f;
 }
Exemplo n.º 6
0
    /// <summary>
    /// Потерять жизнь
    /// </summary>
    /// <param name="amount">Количество</param>
    public void LoseLife(int amount = 1)
    {
        string currentLiveDecodedStr = B64X.Decode(currentLivesCount);
        int    currentLiveDecoded    = int.Parse(currentLiveDecodedStr);

        currentLiveDecoded -= amount;

        currentLivesCount = B64X.Encode(currentLiveDecoded.ToString());

        OnLivesCountChange.Invoke();

        if (currentLiveDecoded == 0)
        {
            EndGame();
        }
    }
Exemplo n.º 7
0
    /// <summary>
    /// Добавить золото
    /// </summary>
    /// <param name="amount">Количество</param>
    public void AddGold(int amount)
    {
        // Расшифровываем
        string decodingGold = B64X.Decode(currentGold);
        int    existsGold   = int.Parse(decodingGold);

        // Прибавляем
        existsGold += amount;

        // Кодируем обратно
        string encodingGold = B64X.Encode(existsGold.ToString());

        currentGold = encodingGold;

        OnGoldChange.Invoke();
    }
Exemplo n.º 8
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);
        }
    }
Exemplo n.º 9
0
    private void readXMLBonusesDuration()
    {
        XmlTextReader reader = new XmlTextReader(B64X.Decrypt(PlayerPrefs.GetString("GSAGSAGSA"), "ZeFuTo!"), XmlNodeType.Document, null);

        while (reader.Read())
        {
            if (reader.Name == "BonusesDuration")
            {
                PlayerBonuses pb = player.GetComponent <PlayerBonuses>();
                for (int i = 0; i < reader.AttributeCount; i++)
                {
                    pb.bonuses[i].duration = float.Parse(reader.GetAttribute(i));
                }
            }
        }
        reader.Close();
    }
Exemplo n.º 10
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);
    }
Exemplo n.º 11
0
    void Update()
    {
        if (currentGold != TitleScript.gold)
        {
            short  price        = towerLevel.price;
            string decodingGold = B64X.Decode(TitleScript.gold);
            short  existsGold   = short.Parse(decodingGold);
            if (price > existsGold && button.interactable)
            {
                button.interactable = false;
            }
            else if (price <= existsGold && !button.interactable)
            {
                button.interactable = true;
            }

            currentGold = TitleScript.gold;
        }
    }
Exemplo n.º 12
0
    private void readXMLCloth()
    {
        XmlTextReader reader = new XmlTextReader(B64X.Decrypt(PlayerPrefs.GetString("GSAGSAGSA"), "ZeFuTo!"), XmlNodeType.Document, null);

        while (reader.Read())
        {
            if (reader.NodeType == XmlNodeType.Element && reader.Name == persName)
            {
                for (int i = 0; reader.MoveToNextAttribute(); i++)
                {
                    if (reader.Name != "opened")
                    {
                        clothData[i - 1] = reader.Value;
                    }
                }
                break;
            }
        }
        reader.Close();
    }
Exemplo n.º 13
0
    private void readXMLCloth()
    {
        XmlTextReader reader = new XmlTextReader(B64X.Decrypt(PlayerPrefs.GetString("GSAGSAGSA"), "ZeFuTo!"), XmlNodeType.Document, null);

        for (int j = 1; j <= PersCount; j++)
        {
            persName = parsePersName(j);
            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element && reader.Name == persName)
                {
                    for (int i = 0; reader.MoveToNextAttribute(); i++)
                    {
                        if (reader.Name != "opened")
                        {
                            clothData[j - 1][i - 1] = reader.Value;
                        }
                        else
                        {
                            string line = reader.Value;
                            for (int pos = 0; pos < line.Length; pos++)
                            {
                                if (line[pos] == '1')
                                {
                                    openedCloth[j - 1][pos] = true;
                                }
                                else
                                {
                                    openedCloth[j - 1][pos] = false;
                                }
                            }
                        }
                    }
                    break;
                }
            }
        }
        reader.Close();
    }
Exemplo n.º 14
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
    }
Exemplo n.º 15
0
    void CheckGoldChange()
    {
        if (tower == null)
        {
            return;
        }

        TowerLevel towerData    = tower.towerData;
        int        price        = towerData.price;
        string     decodingGold = B64X.Decode(levelManager.currentGold);
        int        existsGold   = int.Parse(decodingGold);

        if (price > existsGold && button.interactable)
        {
            button.interactable = false;
        }
        else if (price <= existsGold && !button.interactable)
        {
            button.interactable = true;
        }

        currentGold = levelManager.currentGold;
    }
Exemplo n.º 16
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);
    }
Exemplo n.º 17
0
    public static string GetString(string key)
    {
        string decodedString = B64X.DecodeToString(PlayerPrefs.GetString(key));

        return(decodedString);
    }
Exemplo n.º 18
0
    public static int GetInt(string key)
    {
        int decodedInt = B64X.DecodeToInt(PlayerPrefs.GetString(key));

        return(decodedInt);
    }
Exemplo n.º 19
0
    public static void SetString(string data, string key)
    {
        string encodedString = B64X.EncodeFrom(data);

        PlayerPrefs.SetString(key, encodedString);
    }
Exemplo n.º 20
0
    public static void SetInt(int data, string key)
    {
        string encodedInt = B64X.EncodeFrom(data);

        PlayerPrefs.SetString(key, encodedInt);
    }
Exemplo n.º 21
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
    }
Exemplo n.º 22
0
 /// <summary>
 /// Отобразить количество золота
 /// </summary>
 void WriteGoldCount()
 {
     goldDisplay.GetComponent <Text>().text = B64X.Decode(gold);
 }
Exemplo n.º 23
0
 private static void SetValue(string key, string value)
 {
     PlayerPrefs.SetString(key, B64X.Encrypt(value, Md5.Encode(key + Password)));
     PlayerPrefs.Save();
 }
Exemplo n.º 24
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
    }
Exemplo n.º 25
0
    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!"));
    }
Exemplo n.º 26
0
 private static string GetValue(string key)
 {
     return(PlayerPrefs.HasKey(key) ? B64X.Decrypt(PlayerPrefs.GetString(key), Md5.Encode(key + Password)) : null);
 }
Exemplo n.º 27
0
    void LifeLabelChange()
    {
        string decodingLife = B64X.Decode(levelManager.currentLivesCount);

        textMeshPro.text = decodingLife;
    }
Exemplo n.º 28
0
 /// <summary>
 /// Инициализация стартовых данных
 /// </summary>
 void InitializeStartStats()
 {
     currentGold       = B64X.Encode(startGold.ToString());
     currentLivesCount = B64X.Encode(startLivesCount.ToString());
 }
Exemplo n.º 29
0
    void GoldLabelChange()
    {
        string decodingGold = B64X.Decode(levelManager.currentGold);

        textMeshPro.text = decodingGold;
    }
Exemplo n.º 30
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();
    }