public void UpdatePlayerCardList()
    {
        cs = new int[30];
        for (int i = 1; i <= 20; i++)
        {
            cs [i] = i;
        }

        if (CardShop)
        {
            x = cs;
        }
        else
        {
            int[] a = PlayerPrefsX.GetIntArray("PlayerCardsIDs");
            x = a;
        }

        int[] enableds = PlayerPrefsX.GetIntArray("SelectedCardsIDs");

//		foreach (GameObject card in CardPrefabs) {
//			if( ArrayUtility.Contains(x,card.GetComponent<CardScript>().CardID) ){
//			GameObject g = Instantiate (card, this.transform.position, Quaternion.identity);
//			g.transform.localScale = new Vector3 (1, 1, 1);
//			g.transform.SetParent (this.transform,false);
//				childrens.Add (g.transform);
//			}
//		}
        int minimun = 0;

        foreach (int cardID in x)
        {
            switch (cardID)
            {
            case 1:
                g = Instantiate(CardPrefab, this.transform.position, Quaternion.identity);
                g.GetComponent <CardScript> ().CardID       = 1;
                g.GetComponent <CardScript> ().efeito       = "Magia";
                g.GetComponent <CardScript> ().personagem   = "Todos";
                g.GetComponent <CardScript> ().cardname     = "Estalo Magico";
                g.GetComponent <CardScript> ().descrition   = "Aplica um de dano em uma unidade ininimga";
                g.GetComponent <CardScript> ().cost         = "2";
                g.GetComponent <CardScript> ().damage       = "1";
                g.GetComponent <CardScript> ().efect.sprite = Efects [0];
                g.GetComponent <CardScript> ().image        = Images [cardID];
                g.GetComponent <CardScript> ().peson        = Persons [0];
                g.transform.SetParent(this.transform, false);
                g.GetComponent <CardScript> ().cardInfo = CardInfo;
                if (CardShop)
                {
                    g.GetComponent <CardScript> ().activebutton.gameObject.SetActive(false);
                }
                childrens.Add(g.transform);
                break;

            case 2:
                g = Instantiate(CardPrefab, this.transform.position, Quaternion.identity);
                g.GetComponent <CardScript> ().CardID       = 2;
                g.GetComponent <CardScript> ().efeito       = "Magia";
                g.GetComponent <CardScript> ().personagem   = "Todos";
                g.GetComponent <CardScript> ().cardname     = "Explosão Magica";
                g.GetComponent <CardScript> ().descrition   = "Aplica dois de dano em todas unidades ininimgas";
                g.GetComponent <CardScript> ().cost         = "10";
                g.GetComponent <CardScript> ().damage       = "2";
                g.GetComponent <CardScript> ().efect.sprite = Efects[0];
                g.GetComponent <CardScript> ().image        = Images[cardID];
                g.GetComponent <CardScript> ().peson        = Persons[0];
                g.transform.SetParent(this.transform, false);
                g.GetComponent <CardScript> ().cardInfo = CardInfo;
                if (CardShop)
                {
                    g.GetComponent <CardScript> ().activebutton.gameObject.SetActive(false);
                }
                childrens.Add(g.transform);
                break;

            case 3:
                g = Instantiate(CardPrefab, this.transform.position, Quaternion.identity);
                g.GetComponent <CardScript> ().CardID       = 3;
                g.GetComponent <CardScript> ().efeito       = "Magia";
                g.GetComponent <CardScript> ().personagem   = "Todos";
                g.GetComponent <CardScript> ().cardname     = "Nevasca";
                g.GetComponent <CardScript> ().descrition   = "Aplica dois de dano em todas unidades ininimgas";
                g.GetComponent <CardScript> ().cost         = "10";
                g.GetComponent <CardScript> ().damage       = "2";
                g.GetComponent <CardScript> ().efect.sprite = Efects[0];
                g.GetComponent <CardScript> ().image        = Images[cardID];
                g.GetComponent <CardScript> ().peson        = Persons[0];
                g.transform.SetParent(this.transform, false);
                g.GetComponent <CardScript> ().cardInfo = CardInfo;
                if (CardShop)
                {
                    g.GetComponent <CardScript> ().activebutton.gameObject.SetActive(false);
                }
                childrens.Add(g.transform);
                break;

            case 4:
                g = Instantiate(CardPrefab, this.transform.position, Quaternion.identity);
                g.GetComponent <CardScript> ().CardID       = 4;
                g.GetComponent <CardScript> ().efeito       = "Magia";
                g.GetComponent <CardScript> ().personagem   = "Todos";
                g.GetComponent <CardScript> ().cardname     = "Terremoto";
                g.GetComponent <CardScript> ().descrition   = "Deixa Tropas Inimigas Lentas";
                g.GetComponent <CardScript> ().cost         = "10";
                g.GetComponent <CardScript> ().damage       = "2";
                g.GetComponent <CardScript> ().efect.sprite = Efects[0];
                g.GetComponent <CardScript> ().image        = Images[cardID];
                g.GetComponent <CardScript> ().peson        = Persons[0];
                g.transform.SetParent(this.transform, false);
                g.GetComponent <CardScript> ().cardInfo = CardInfo;
                if (CardShop)
                {
                    g.GetComponent <CardScript> ().activebutton.gameObject.SetActive(false);
                }
                childrens.Add(g.transform);
                break;

            case 5:
                g = Instantiate(CardPrefab, this.transform.position, Quaternion.identity);
                g.GetComponent <CardScript> ().CardID       = 5;
                g.GetComponent <CardScript> ().efeito       = "Magia";
                g.GetComponent <CardScript> ().personagem   = "Todos";
                g.GetComponent <CardScript> ().cardname     = "Hora da Soneca";
                g.GetComponent <CardScript> ().descrition   = "Para Tropas Inimigas";
                g.GetComponent <CardScript> ().cost         = "10";
                g.GetComponent <CardScript> ().damage       = "2";
                g.GetComponent <CardScript> ().efect.sprite = Efects[0];
                g.GetComponent <CardScript> ().image        = Images[cardID];
                g.GetComponent <CardScript> ().peson        = Persons[0];
                g.transform.SetParent(this.transform, false);
                g.GetComponent <CardScript> ().cardInfo = CardInfo;
                if (CardShop)
                {
                    g.GetComponent <CardScript> ().activebutton.gameObject.SetActive(false);
                }
                childrens.Add(g.transform);
                break;

            case 6:
                g = Instantiate(CardPrefab, this.transform.position, Quaternion.identity);
                g.GetComponent <CardScript> ().CardID       = 6;
                g.GetComponent <CardScript> ().efeito       = "Magia";
                g.GetComponent <CardScript> ().personagem   = "Todos";
                g.GetComponent <CardScript> ().cardname     = "Remédio";
                g.GetComponent <CardScript> ().descrition   = "Cura seu heroi";
                g.GetComponent <CardScript> ().cost         = "10";
                g.GetComponent <CardScript> ().damage       = "0";
                g.GetComponent <CardScript> ().efect.sprite = Efects[0];
                g.GetComponent <CardScript> ().image        = Images[cardID];
                g.GetComponent <CardScript> ().peson        = Persons[0];
                g.transform.SetParent(this.transform, false);
                g.GetComponent <CardScript> ().cardInfo = CardInfo;
                if (CardShop)
                {
                    g.GetComponent <CardScript> ().activebutton.gameObject.SetActive(false);
                }
                childrens.Add(g.transform);
                break;

            case 7:
                g = Instantiate(CardPrefab, this.transform.position, Quaternion.identity);
                g.GetComponent <CardScript> ().CardID       = 7;
                g.GetComponent <CardScript> ().efeito       = "Magia";
                g.GetComponent <CardScript> ().personagem   = "Todos";
                g.GetComponent <CardScript> ().cardname     = "Canja de Galinha";
                g.GetComponent <CardScript> ().descrition   = "Cura toda sua tropa";
                g.GetComponent <CardScript> ().cost         = "10";
                g.GetComponent <CardScript> ().damage       = "0";
                g.GetComponent <CardScript> ().efect.sprite = Efects[0];
                g.GetComponent <CardScript> ().image        = Images[cardID];
                g.GetComponent <CardScript> ().peson        = Persons[0];
                g.transform.SetParent(this.transform, false);
                g.GetComponent <CardScript> ().cardInfo = CardInfo;
                if (CardShop)
                {
                    g.GetComponent <CardScript> ().activebutton.gameObject.SetActive(false);
                }
                childrens.Add(g.transform);
                break;

            case 8:
                g = Instantiate(CardPrefab, this.transform.position, Quaternion.identity);
                g.GetComponent <CardScript> ().CardID       = 8;
                g.GetComponent <CardScript> ().efeito       = "Magia";
                g.GetComponent <CardScript> ().personagem   = "Todos";
                g.GetComponent <CardScript> ().cardname     = "Escudo";
                g.GetComponent <CardScript> ().descrition   = "Parotege suas Tropas";
                g.GetComponent <CardScript> ().cost         = "10";
                g.GetComponent <CardScript> ().damage       = "0";
                g.GetComponent <CardScript> ().efect.sprite = Efects[0];
                g.GetComponent <CardScript> ().image        = Images[cardID];
                g.GetComponent <CardScript> ().peson        = Persons[0];
                g.transform.SetParent(this.transform, false);
                g.GetComponent <CardScript> ().cardInfo = CardInfo;
                if (CardShop)
                {
                    g.GetComponent <CardScript> ().activebutton.gameObject.SetActive(false);
                }
                childrens.Add(g.transform);
                break;

            case 9:
                g = Instantiate(CardPrefab, this.transform.position, Quaternion.identity);
                g.GetComponent <CardScript> ().CardID       = 9;
                g.GetComponent <CardScript> ().efeito       = "Magia";
                g.GetComponent <CardScript> ().personagem   = "Todos";
                g.GetComponent <CardScript> ().cardname     = "Grito de Guerra";
                g.GetComponent <CardScript> ().descrition   = "Fortalece suas tropas";
                g.GetComponent <CardScript> ().cost         = "10";
                g.GetComponent <CardScript> ().damage       = "0";
                g.GetComponent <CardScript> ().efect.sprite = Efects[0];
                g.GetComponent <CardScript> ().image        = Images[cardID];
                g.GetComponent <CardScript> ().peson        = Persons[0];
                g.transform.SetParent(this.transform, false);
                g.GetComponent <CardScript> ().cardInfo = CardInfo;
                if (CardShop)
                {
                    g.GetComponent <CardScript> ().activebutton.gameObject.SetActive(false);
                }
                childrens.Add(g.transform);
                break;

            case 10:
                g = Instantiate(CardPrefab, this.transform.position, Quaternion.identity);
                g.GetComponent <CardScript> ().CardID       = 10;
                g.GetComponent <CardScript> ().efeito       = "Magia";
                g.GetComponent <CardScript> ().personagem   = "Todos";
                g.GetComponent <CardScript> ().cardname     = "Sem Munição";
                g.GetComponent <CardScript> ().descrition   = "Paralisa torres inimigas";
                g.GetComponent <CardScript> ().cost         = "10";
                g.GetComponent <CardScript> ().damage       = "0";
                g.GetComponent <CardScript> ().efect.sprite = Efects[0];
                g.GetComponent <CardScript> ().image        = Images[cardID];
                g.GetComponent <CardScript> ().peson        = Persons[0];
                g.transform.SetParent(this.transform, false);
                g.GetComponent <CardScript> ().cardInfo = CardInfo;
                if (CardShop)
                {
                    g.GetComponent <CardScript> ().activebutton.gameObject.SetActive(false);
                }
                childrens.Add(g.transform);
                break;

            //TROPAS

            case 11:
                g = Instantiate(CardPrefab, this.transform.position, Quaternion.identity);
                g.GetComponent <CardScript> ().CardID       = 11;
                g.GetComponent <CardScript> ().efeito       = "Unidade";
                g.GetComponent <CardScript> ().personagem   = "Monica";
                g.GetComponent <CardScript> ().cardname     = "Bidu";
                g.GetComponent <CardScript> ().descrition   = "Chama a unidade Bidu para ajudar";
                g.GetComponent <CardScript> ().cost         = "1";
                g.GetComponent <CardScript> ().damage       = "1";
                g.GetComponent <CardScript> ().efect.sprite = Efects[1];
                g.GetComponent <CardScript> ().image        = Images[cardID];
                g.GetComponent <CardScript> ().peson        = Persons[1];
                g.transform.SetParent(this.transform, false);
                g.GetComponent <CardScript> ().cardInfo = CardInfo;
                if (CardShop)
                {
                    g.GetComponent <CardScript> ().activebutton.gameObject.SetActive(false);
                }
                childrens.Add(g.transform);
                break;

            case 12:
                g = Instantiate(CardPrefab, this.transform.position, Quaternion.identity);
                g.GetComponent <CardScript> ().CardID       = 12;
                g.GetComponent <CardScript> ().efeito       = "Unidade";
                g.GetComponent <CardScript> ().personagem   = "Todos";
                g.GetComponent <CardScript> ().cardname     = "Astronauta";
                g.GetComponent <CardScript> ().descrition   = "Chama a unidade Astronauta para ajudar";
                g.GetComponent <CardScript> ().cost         = "3";
                g.GetComponent <CardScript> ().damage       = "1";
                g.GetComponent <CardScript> ().efect.sprite = Efects[1];
                g.GetComponent <CardScript> ().image        = Images[cardID];
                g.GetComponent <CardScript> ().peson        = Persons[0];
                g.transform.SetParent(this.transform, false);
                g.GetComponent <CardScript> ().cardInfo = CardInfo;
                if (CardShop)
                {
                    g.GetComponent <CardScript> ().activebutton.gameObject.SetActive(false);
                }
                childrens.Add(g.transform);
                break;

            case 13:
                g = Instantiate(CardPrefab, this.transform.position, Quaternion.identity);
                g.GetComponent <CardScript> ().CardID       = 13;
                g.GetComponent <CardScript> ().efeito       = "Unidade";
                g.GetComponent <CardScript> ().personagem   = "Todos";
                g.GetComponent <CardScript> ().cardname     = "Anjinho";
                g.GetComponent <CardScript> ().descrition   = "Chama a unidade Anjinho para ajudar";
                g.GetComponent <CardScript> ().cost         = "1";
                g.GetComponent <CardScript> ().damage       = "1";
                g.GetComponent <CardScript> ().efect.sprite = Efects[1];
                g.GetComponent <CardScript> ().image        = Images[cardID];
                g.GetComponent <CardScript> ().peson        = Persons[0];
                g.transform.SetParent(this.transform, false);
                g.GetComponent <CardScript> ().cardInfo = CardInfo;
                if (CardShop)
                {
                    g.GetComponent <CardScript> ().activebutton.gameObject.SetActive(false);
                }
                childrens.Add(g.transform);
                break;

            case 14:
                g = Instantiate(CardPrefab, this.transform.position, Quaternion.identity);
                g.GetComponent <CardScript> ().CardID       = 14;
                g.GetComponent <CardScript> ().efeito       = "Unidade";
                g.GetComponent <CardScript> ().personagem   = "Todos";
                g.GetComponent <CardScript> ().cardname     = "Jotalhão";
                g.GetComponent <CardScript> ().descrition   = "Chama a unidade jotalhão para ajudar";
                g.GetComponent <CardScript> ().cost         = "50";
                g.GetComponent <CardScript> ().damage       = "1";
                g.GetComponent <CardScript> ().efect.sprite = Efects[1];
                g.GetComponent <CardScript> ().image        = Images[cardID];
                g.GetComponent <CardScript> ().peson        = Persons[0];
                g.transform.SetParent(this.transform, false);
                g.GetComponent <CardScript> ().cardInfo = CardInfo;
                if (CardShop)
                {
                    g.GetComponent <CardScript> ().activebutton.gameObject.SetActive(false);
                }
                childrens.Add(g.transform);
                break;

            case 15:
                g = Instantiate(CardPrefab, this.transform.position, Quaternion.identity);
                g.GetComponent <CardScript> ().CardID       = 15;
                g.GetComponent <CardScript> ().efeito       = "Unidade";
                g.GetComponent <CardScript> ().personagem   = "Todos";
                g.GetComponent <CardScript> ().cardname     = "Piteco";
                g.GetComponent <CardScript> ().descrition   = "Chama a unidade Piteco para ajudar";
                g.GetComponent <CardScript> ().cost         = "15";
                g.GetComponent <CardScript> ().damage       = "1";
                g.GetComponent <CardScript> ().efect.sprite = Efects[1];
                g.GetComponent <CardScript> ().image        = Images[cardID];
                g.GetComponent <CardScript> ().peson        = Persons[0];
                g.transform.SetParent(this.transform, false);
                g.GetComponent <CardScript> ().cardInfo = CardInfo;
                if (CardShop)
                {
                    g.GetComponent <CardScript> ().activebutton.gameObject.SetActive(false);
                }
                childrens.Add(g.transform);
                break;

            case 16:
                g = Instantiate(CardPrefab, this.transform.position, Quaternion.identity);
                g.GetComponent <CardScript> ().CardID       = 16;
                g.GetComponent <CardScript> ().efeito       = "Unidade";
                g.GetComponent <CardScript> ().personagem   = "Todos";
                g.GetComponent <CardScript> ().cardname     = "Penadinho";
                g.GetComponent <CardScript> ().descrition   = "Chama a unidade Penadinho para ajudar";
                g.GetComponent <CardScript> ().cost         = "50";
                g.GetComponent <CardScript> ().damage       = "1";
                g.GetComponent <CardScript> ().efect.sprite = Efects[1];
                g.GetComponent <CardScript> ().image        = Images[cardID];
                g.GetComponent <CardScript> ().peson        = Persons[0];
                g.transform.SetParent(this.transform, false);
                g.GetComponent <CardScript> ().cardInfo = CardInfo;
                if (CardShop)
                {
                    g.GetComponent <CardScript> ().activebutton.gameObject.SetActive(false);
                }
                childrens.Add(g.transform);
                break;

            case 17:
                g = Instantiate(CardPrefab, this.transform.position, Quaternion.identity);
                g.GetComponent <CardScript> ().CardID       = 17;
                g.GetComponent <CardScript> ().efeito       = "Unidade";
                g.GetComponent <CardScript> ().personagem   = "Cebolinha";
                g.GetComponent <CardScript> ().cardname     = "Louco";
                g.GetComponent <CardScript> ().descrition   = "Chama a unidade Louco para ajudar";
                g.GetComponent <CardScript> ().cost         = "100";
                g.GetComponent <CardScript> ().damage       = "5";
                g.GetComponent <CardScript> ().efect.sprite = Efects[1];
                g.GetComponent <CardScript> ().image        = Images[cardID];
                g.GetComponent <CardScript> ().peson        = Persons[3];
                g.transform.SetParent(this.transform, false);
                g.GetComponent <CardScript> ().cardInfo = CardInfo;
                if (CardShop)
                {
                    g.GetComponent <CardScript> ().activebutton.gameObject.SetActive(false);
                }
                childrens.Add(g.transform);
                break;

            case 18:
                g = Instantiate(CardPrefab, this.transform.position, Quaternion.identity);
                g.GetComponent <CardScript> ().CardID       = 18;
                g.GetComponent <CardScript> ().efeito       = "Unidade";
                g.GetComponent <CardScript> ().personagem   = "Monica";
                g.GetComponent <CardScript> ().cardname     = "Sansão";
                g.GetComponent <CardScript> ().descrition   = "Chama a unidade Sansão para ajudar";
                g.GetComponent <CardScript> ().cost         = "40";
                g.GetComponent <CardScript> ().damage       = "3";
                g.GetComponent <CardScript> ().efect.sprite = Efects[1];
                g.GetComponent <CardScript> ().image        = Images[cardID];
                g.GetComponent <CardScript> ().peson        = Persons[1];
                g.transform.SetParent(this.transform, false);
                g.GetComponent <CardScript> ().cardInfo = CardInfo;
                if (CardShop)
                {
                    g.GetComponent <CardScript> ().activebutton.gameObject.SetActive(false);
                }
                childrens.Add(g.transform);
                break;

            case 19:
                g = Instantiate(CardPrefab, this.transform.position, Quaternion.identity);
                g.GetComponent <CardScript> ().CardID       = 19;
                g.GetComponent <CardScript> ().efeito       = "Unidade";
                g.GetComponent <CardScript> ().personagem   = "Magali";
                g.GetComponent <CardScript> ().cardname     = "Mingau";
                g.GetComponent <CardScript> ().descrition   = "Chama a unidade Mingau para ajudar";
                g.GetComponent <CardScript> ().cost         = "110";
                g.GetComponent <CardScript> ().damage       = "2";
                g.GetComponent <CardScript> ().efect.sprite = Efects[1];
                g.GetComponent <CardScript> ().image        = Images[cardID];
                g.GetComponent <CardScript> ().peson        = Persons[2];
                g.transform.SetParent(this.transform, false);
                g.GetComponent <CardScript> ().cardInfo = CardInfo;
                if (CardShop)
                {
                    g.GetComponent <CardScript> ().activebutton.gameObject.SetActive(false);
                }
                childrens.Add(g.transform);
                break;

            case 20:
                g = Instantiate(CardPrefab, this.transform.position, Quaternion.identity);
                g.GetComponent <CardScript> ().CardID       = 20;
                g.GetComponent <CardScript> ().efeito       = "Unidade";
                g.GetComponent <CardScript> ().personagem   = "Todos";
                g.GetComponent <CardScript> ().cardname     = "Alfredo";
                g.GetComponent <CardScript> ().descrition   = "Chama a unidade Alfredo para ajudar";
                g.GetComponent <CardScript> ().cost         = "150";
                g.GetComponent <CardScript> ().damage       = "2";
                g.GetComponent <CardScript> ().efect.sprite = Efects[1];
                g.GetComponent <CardScript> ().image        = Images[cardID];
                g.GetComponent <CardScript> ().peson        = Persons[0];
                g.transform.SetParent(this.transform, false);
                g.GetComponent <CardScript> ().cardInfo = CardInfo;
                if (CardShop)
                {
                    g.GetComponent <CardScript> ().activebutton.gameObject.SetActive(false);
                }
                childrens.Add(g.transform);
                break;

            //TORRES

            case 21:
                g = Instantiate(CardPrefab, this.transform.position, Quaternion.identity);
                g.GetComponent <CardScript> ().CardID       = 21;
                g.GetComponent <CardScript> ().efeito       = "Construcao";
                g.GetComponent <CardScript> ().personagem   = "Todos";
                g.GetComponent <CardScript> ().cardname     = "Torre de Papel";
                g.GetComponent <CardScript> ().descrition   = "Constroi a torre para ajudar no campo";
                g.GetComponent <CardScript> ().cost         = "1";
                g.GetComponent <CardScript> ().damage       = "1";
                g.GetComponent <CardScript> ().efect.sprite = Efects[2];
                g.GetComponent <CardScript> ().image        = Images[cardID];
                g.GetComponent <CardScript> ().peson        = Persons[0];
                g.transform.SetParent(this.transform, false);
                g.GetComponent <CardScript> ().cardInfo = CardInfo;
                if (CardShop)
                {
                    g.GetComponent <CardScript> ().activebutton.gameObject.SetActive(false);
                }
                childrens.Add(g.transform);
                break;

            case 22:
                g = Instantiate(CardPrefab, this.transform.position, Quaternion.identity);
                g.GetComponent <CardScript> ().CardID       = 22;
                g.GetComponent <CardScript> ().efeito       = "Construcao";
                g.GetComponent <CardScript> ().personagem   = "Todos";
                g.GetComponent <CardScript> ().cardname     = "Torre de Agua";
                g.GetComponent <CardScript> ().descrition   = "Constroi a torre para ajudar no campo";
                g.GetComponent <CardScript> ().cost         = "3";
                g.GetComponent <CardScript> ().damage       = "1";
                g.GetComponent <CardScript> ().efect.sprite = Efects[2];
                g.GetComponent <CardScript> ().image        = Images[cardID];
                g.GetComponent <CardScript> ().peson        = Persons[0];
                g.transform.SetParent(this.transform, false);
                g.GetComponent <CardScript> ().cardInfo = CardInfo;
                if (CardShop)
                {
                    g.GetComponent <CardScript> ().activebutton.gameObject.SetActive(false);
                }
                childrens.Add(g.transform);
                break;

            case 23:
                g = Instantiate(CardPrefab, this.transform.position, Quaternion.identity);
                g.GetComponent <CardScript> ().CardID       = 23;
                g.GetComponent <CardScript> ().efeito       = "Construcao";
                g.GetComponent <CardScript> ().personagem   = "Todos";
                g.GetComponent <CardScript> ().cardname     = "Torre de Desentupidor";
                g.GetComponent <CardScript> ().descrition   = "Constroi a torre para ajudar no campo";
                g.GetComponent <CardScript> ().cost         = "1";
                g.GetComponent <CardScript> ().damage       = "1";
                g.GetComponent <CardScript> ().efect.sprite = Efects[2];
                g.GetComponent <CardScript> ().image        = Images[cardID];
                g.GetComponent <CardScript> ().peson        = Persons[0];
                g.transform.SetParent(this.transform, false);
                g.GetComponent <CardScript> ().cardInfo = CardInfo;
                if (CardShop)
                {
                    g.GetComponent <CardScript> ().activebutton.gameObject.SetActive(false);
                }
                childrens.Add(g.transform);
                break;

            case 24:
                g = Instantiate(CardPrefab, this.transform.position, Quaternion.identity);
                g.GetComponent <CardScript> ().CardID       = 24;
                g.GetComponent <CardScript> ().efeito       = "Construcao";
                g.GetComponent <CardScript> ().personagem   = "Todos";
                g.GetComponent <CardScript> ().cardname     = "Torre de Neve";
                g.GetComponent <CardScript> ().descrition   = "Constroi a torre para ajudar no campo";
                g.GetComponent <CardScript> ().cost         = "50";
                g.GetComponent <CardScript> ().damage       = "1";
                g.GetComponent <CardScript> ().efect.sprite = Efects[2];
                g.GetComponent <CardScript> ().image        = Images[cardID];
                g.GetComponent <CardScript> ().peson        = Persons[0];
                g.transform.SetParent(this.transform, false);
                g.GetComponent <CardScript> ().cardInfo = CardInfo;
                if (CardShop)
                {
                    g.GetComponent <CardScript> ().activebutton.gameObject.SetActive(false);
                }
                childrens.Add(g.transform);
                break;

            case 25:
                g = Instantiate(CardPrefab, this.transform.position, Quaternion.identity);
                g.GetComponent <CardScript> ().CardID       = 25;
                g.GetComponent <CardScript> ().efeito       = "Construcao";
                g.GetComponent <CardScript> ().personagem   = "Todos";
                g.GetComponent <CardScript> ().cardname     = "Torre da Cura";
                g.GetComponent <CardScript> ().descrition   = "Constroi a torre para ajudar no campo";
                g.GetComponent <CardScript> ().cost         = "15";
                g.GetComponent <CardScript> ().damage       = "1";
                g.GetComponent <CardScript> ().efect.sprite = Efects[2];
                g.GetComponent <CardScript> ().image        = Images[cardID];
                g.GetComponent <CardScript> ().peson        = Persons[0];
                g.transform.SetParent(this.transform, false);
                g.GetComponent <CardScript> ().cardInfo = CardInfo;
                if (CardShop)
                {
                    g.GetComponent <CardScript> ().activebutton.gameObject.SetActive(false);
                }
                childrens.Add(g.transform);
                break;

            case 26:
                g = Instantiate(CardPrefab, this.transform.position, Quaternion.identity);
                g.GetComponent <CardScript> ().CardID       = 26;
                g.GetComponent <CardScript> ().efeito       = "Construcao";
                g.GetComponent <CardScript> ().personagem   = "Todos";
                g.GetComponent <CardScript> ().cardname     = "Torre do Tesouro";
                g.GetComponent <CardScript> ().descrition   = "Constroi a torre para ajudar no campo";
                g.GetComponent <CardScript> ().cost         = "50";
                g.GetComponent <CardScript> ().damage       = "1";
                g.GetComponent <CardScript> ().efect.sprite = Efects[2];
                g.GetComponent <CardScript> ().image        = Images[cardID];
                g.GetComponent <CardScript> ().peson        = Persons[0];
                g.transform.SetParent(this.transform, false);
                g.GetComponent <CardScript> ().cardInfo = CardInfo;
                if (CardShop)
                {
                    g.GetComponent <CardScript> ().activebutton.gameObject.SetActive(false);
                }
                childrens.Add(g.transform);
                break;

            case 27:
                g = Instantiate(CardPrefab, this.transform.position, Quaternion.identity);
                g.GetComponent <CardScript> ().CardID       = 27;
                g.GetComponent <CardScript> ().efeito       = "Construcao";
                g.GetComponent <CardScript> ().personagem   = "Todos";
                g.GetComponent <CardScript> ().cardname     = "Torre do Sono";
                g.GetComponent <CardScript> ().descrition   = "Constroi a torre para ajudar no campo";
                g.GetComponent <CardScript> ().cost         = "100";
                g.GetComponent <CardScript> ().damage       = "5";
                g.GetComponent <CardScript> ().efect.sprite = Efects[2];
                g.GetComponent <CardScript> ().image        = Images[cardID];
                g.GetComponent <CardScript> ().peson        = Persons[0];
                g.transform.SetParent(this.transform, false);
                g.GetComponent <CardScript> ().cardInfo = CardInfo;
                if (CardShop)
                {
                    g.GetComponent <CardScript> ().activebutton.gameObject.SetActive(false);
                }
                childrens.Add(g.transform);
                break;

            case 28:
                g = Instantiate(CardPrefab, this.transform.position, Quaternion.identity);
                g.GetComponent <CardScript> ().CardID       = 28;
                g.GetComponent <CardScript> ().efeito       = "Construcao";
                g.GetComponent <CardScript> ().personagem   = "Todos";
                g.GetComponent <CardScript> ().cardname     = "Torre AntiTorre";
                g.GetComponent <CardScript> ().descrition   = "Constroi a torre para ajudar no campo";
                g.GetComponent <CardScript> ().cost         = "40";
                g.GetComponent <CardScript> ().damage       = "3";
                g.GetComponent <CardScript> ().efect.sprite = Efects[2];
                g.GetComponent <CardScript> ().image        = Images[cardID];
                g.GetComponent <CardScript> ().peson        = Persons[0];
                g.transform.SetParent(this.transform, false);
                g.GetComponent <CardScript> ().cardInfo = CardInfo;
                if (CardShop)
                {
                    g.GetComponent <CardScript> ().activebutton.gameObject.SetActive(false);
                }
                childrens.Add(g.transform);
                break;

            case 29:
                g = Instantiate(CardPrefab, this.transform.position, Quaternion.identity);
                g.GetComponent <CardScript> ().CardID       = 29;
                g.GetComponent <CardScript> ().efeito       = "Construcao";
                g.GetComponent <CardScript> ().personagem   = "Todos";
                g.GetComponent <CardScript> ().cardname     = "Torre Protetora";
                g.GetComponent <CardScript> ().descrition   = "Constroi a torre para ajudar no campo";
                g.GetComponent <CardScript> ().cost         = "110";
                g.GetComponent <CardScript> ().damage       = "5";
                g.GetComponent <CardScript> ().efect.sprite = Efects[2];
                g.GetComponent <CardScript> ().image        = Images[cardID];
                g.GetComponent <CardScript> ().peson        = Persons[0];
                g.transform.SetParent(this.transform, false);
                g.GetComponent <CardScript> ().cardInfo = CardInfo;
                if (CardShop)
                {
                    g.GetComponent <CardScript> ().activebutton.gameObject.SetActive(false);
                }
                childrens.Add(g.transform);
                break;
            }
            if (CardShop == false)
            {
                foreach (int enab in enableds)
                {
                    if (enab == cardID)
                    {
                        g.GetComponent <CardScript> ().activebutton.sprite = g.GetComponent <CardScript> ().activeTrue;
                        g.GetComponent <CardScript> ().isactivebutton      = true;
                    }
                }
            }

//			if (minimun <= 15 && CardShop == false) {
//				g.GetComponent<CardScript> ().ActiveCard ();
//				minimun++;
//			}
        }
    }
示例#2
0
 public void LockAbility()
 {
     PlayerPrefsX.SetBool(abilityName, false);
 }
示例#3
0
 // Use this for initialization
 void Start()
 {
     //Debug.Log(transform.rotation.y);
     if (sceneTesting)
     {
         introRunning = false;
     }
     else
     {
         if (PlayerPrefs.HasKey("IntroPlayed"))
         {
             introRunning = PlayerPrefsX.GetBool("IntroPlayed");
         }
         else
         {
             introRunning = true;
             StartCoroutine("intro");
         }
     }
     originalParent = gameObject.transform.parent.gameObject;
     Debug.Log(originalParent.name);
     paused = false;
     isHeld = false;
     if (!hintSystemDisable)
     {
         HintBox    = GameObject.Find("HintBox");
         hintText   = GameObject.Find("HintText").GetComponent <Text>();
         hintActive = false;
         HintBox.SetActive(false);
     }
     if (PlayerPrefs.HasKey("HintDC"))
     {
         firstDCJ      = PlayerPrefsX.GetBool("HintDCJ");
         firstPatrol   = PlayerPrefsX.GetBool("HintDC");
         firstNinCat   = PlayerPrefsX.GetBool("HintNC");
         firstDoomba   = PlayerPrefsX.GetBool("HintDoom");
         firstRover    = PlayerPrefsX.GetBool("HintRov");
         firstKid      = PlayerPrefsX.GetBool("HintKid");
         firstBirb     = PlayerPrefsX.GetBool("HintBirb");
         firstUFO      = PlayerPrefsX.GetBool("HintUFO");
         firstLaser    = PlayerPrefsX.GetBool("HintLas");
         firstAsteroid = PlayerPrefsX.GetBool("HintAst");
         firstWormhole = PlayerPrefsX.GetBool("HintWorm");
     }
     else
     {
         firstPatrol   = true;
         firstDCJ      = true;
         firstNinCat   = true;
         firstDoomba   = true;
         firstRover    = true;
         firstKid      = true;
         firstBirb     = true;
         firstUFO      = true;
         firstLaser    = true;
         firstAsteroid = true;
         firstWormhole = true;
     }
     release  = true;
     barkQ    = 0;
     cooldown = false;
     falling  = false;
     silencer = GameObject.Find("MuteManager").GetComponent <mutePls>();
     //GameObject.DontDestroyOnLoad(GameObject.Find("Corgo"));
     mainCam            = GameObject.Find("Main Camera");
     attackBox          = GameObject.Find("AttackBox");
     rb                 = gameObject.GetComponent <Rigidbody2D>();
     sr                 = gameObject.GetComponent <SpriteRenderer>();
     pa                 = gameObject.GetComponent <Animator>();
     QuinnAS            = gameObject.GetComponent <AudioSource>();
     lookingAnim        = new string[2];
     lookingAnim[0]     = "LookSR";
     lookingAnim[1]     = "LookR";
     sniffingAnim       = new string[2];
     sniffingAnim[0]    = "SniffStand";
     sniffingAnim[1]    = "SniffWalk";
     speed              = 2.0f;
     runSpeed           = 4.0f;
     crouchSpeed        = 1.0f;
     jumpHeight         = 3.0f;
     canMove            = true;
     crouching          = false;
     barking            = false;
     running            = false;
     jumping            = false;
     landing            = false;
     idling             = false;
     idlingtimerstarted = false;
     dead               = false;
     hidden             = false;
     right              = true;
     outroRunning       = false;
     outroFinished      = false;
     gameOver           = false;
     if (PlayerPrefs.HasKey("PlayerPos"))
     {
         spawnpoint = PlayerPrefsX.GetVector3("PlayerPos");
         gameObject.transform.position = PlayerPrefsX.GetVector3("PlayerPos");
     }
 }
示例#4
0
    void OnGUI()
    {
        if (isInitialized)
        {
            GUI.skin  = GuiManager.GetSkin();
            GUI.depth = 3;

            if (isDisplayingPrompt)
            {
                GUI.enabled = false;
            }

            GUI.BeginGroup(new Rect(Screen.width / 2 - 250, Screen.height / 2 - 300, 500, 600));
            // All rectangles are now adjusted to the group. (0,0) is the topleft corner of the group.

            // We'll make a box so you can see where the group is on-screen.
            GUI.Box(new Rect(0, 0, 500, 600), "Project Editor: " + activeProject.projectName);

            GUI.Label(new Rect(35, 25, 360, 30), "Tank:   Warning:Numbers only");

            // Unity textfields work by assigning a value on return, without the assignment they are uneditable
            // Decided to parse them back to floats on the fly.

            //TODO: Limit to only number input Regex.Replace(text, @"[^0-9 ]", "");
            GUI.Label(new Rect(35, 50, 100, 30), "Width(MM) : ");
            activeProject.tankDimensions.x = float.Parse(GUI.TextField(new Rect(150, 50, 100, 25), activeProject.tankDimensions.x.ToString()));
            GUI.Label(new Rect(35, 75, 100, 30), "Height(MM): ");
            activeProject.tankDimensions.y = float.Parse(GUI.TextField(new Rect(150, 75, 100, 25), activeProject.tankDimensions.y.ToString()));
            GUI.Label(new Rect(35, 100, 100, 30), "Depth(MM) : ");
            activeProject.tankDimensions.z = float.Parse(GUI.TextField(new Rect(150, 100, 100, 25), activeProject.tankDimensions.z.ToString()));

            GUI.Label(new Rect(290, 25, 180, 30), "Background Color");
            GUI.Label(new Rect(295, 50, 30, 30), "R");
            activeProject.backgroundR = int.Parse(GUI.TextField(new Rect(330, 50, 35, 25), activeProject.backgroundR.ToString()));

            GUI.Label(new Rect(295, 75, 30, 30), "G");
            activeProject.backgroundG = int.Parse(GUI.TextField(new Rect(330, 75, 35, 25), activeProject.backgroundG.ToString()));

            GUI.Label(new Rect(295, 100, 30, 30), "B");
            activeProject.backgroundB = int.Parse(GUI.TextField(new Rect(330, 100, 35, 25), activeProject.backgroundB.ToString()));


            GUI.Label(new Rect(35, 140, 100, 30), "Fish Models : ");
            fishModelScrollVector = GUI.BeginScrollView(new Rect(15, 160, 220, 120), fishModelScrollVector, new Rect(0, 0, 200, 150));

            activeProject.type = GUILayout.SelectionGrid(activeProject.type, getPossibleFishModels(), 1, "toggle");

            //selectedModelIndex =
            GUI.EndScrollView();


            GUI.Label(new Rect(260, 140, 100, 30), "Fish Paths : ");
            fishPathsScrollVector = GUI.BeginScrollView(new Rect(260, 155, 220, 120), fishPathsScrollVector, new Rect(0, 0, 200, 150));
            pathNames.render();

            GUI.EndScrollView();

            if (GUI.Button(new Rect(260, 290, 80, 32), "New Path"))
            {
                PlayerPrefs.SetInt("FishType", activeProject.type);
                isDisplayingPrompt = true;
                //Application.LoadLevel(1);
                //GameRegistry activeRegistry = gameObject.GetComponent<GameRegistry>();
                //activeRegistry.switchState(States.AnimationEditor);
                //WarningSystem.addWarning("Write Failure", "Failed to write path data", Code.Error);
            }

            if (GUI.Button(new Rect(365, 290, 80, 32), "Edit Path"))
            {
                if (pathNames.hasActive())
                {
                    List <string> activePaths = pathNames.getActive();
                    // Check that only one is selected
                    if (activePaths.Count != 1)
                    {
                        WarningSystem.addWarning("Please select a path.", "Please select only a single path for editing", Code.Warning);
                    }
                    else
                    {
                        // Open the path
                        PlayerPrefs.SetInt("FishType", activeProject.type);
                        PlayerPrefs.SetString("PathDir", activePaths[0]);
                        if (tpsNames.hasActive())
                        {
                            List <string> activeMorphs = tpsNames.getActive();
                            if (activeMorphs.Count > 1)
                            {
                                WarningSystem.addWarning("Please select a single TPS", "Please select just one morph for path editing", Code.Warning);
                            }
                            else
                            {
                                if (textureNames.hasActive())
                                {
                                    List <string> activeTextures = textureNames.getActive();
                                    if (activeTextures.Count > 1)
                                    {
                                        WarningSystem.addWarning("Please select a single texture", "Please select a single texture for path editing", Code.Warning);
                                    }
                                    else
                                    {
                                        PlayerPrefs.SetString("MorphPath", activeMorphs[0]);
                                        PlayerPrefs.SetString("TexturePath", activeTextures[0]);
                                        Application.LoadLevel(1);
                                    }
                                }
                                else
                                {
                                    PlayerPrefs.SetString("MorphPath", activeMorphs[0]);
                                    PlayerPrefs.SetString("TexturePath", "default");
                                    Application.LoadLevel(1);
                                }
                            }
                        }
                        else
                        {
                            PlayerPrefs.SetString("TexturePath", "default");
                            PlayerPrefs.SetString("MorphPath", "default");
                            Application.LoadLevel(1);
                        }
                    }
                }
                else
                {
                    WarningSystem.addWarning("Select a path!", "First select an existing path or create a new one.", Code.Warning);
                }
            }

            // End the group we started above. This is very important to remember!


            GUI.Label(new Rect(35, 340, 100, 30), "Textures : ");
            fishTexturesScrollVec = GUI.BeginScrollView(new Rect(15, 355, 220, 120), fishTexturesScrollVec, new Rect(0, 0, 200, 150));
            textureNames.render();
            // Put something inside the ScrollView
            //toggleThree = GUI.Toggle(new Rect(10, 10, 20, 24), toggleThree, ""); GUI.Label(new Rect(35, 10, 100, 24), "need swordtail tps");

            // End the ScrollView
            GUI.EndScrollView();
            //GUI.enabled = false;
            if (GUI.Button(new Rect(25, 500, 100, 32), "Batch Render"))
            {
                // Store FishType
                bool hasRequirementsToRender = true;

                PlayerPrefs.SetInt("FishType", activeProject.type);
                // Check if Paths
                if (pathNames.hasActive())
                {
                    List <string> activePaths = pathNames.getActive();
                    PlayerPrefsX.SetStringArray("PathsDir", activePaths.ToArray());
                }
                else
                {
                    WarningSystem.addWarning("Select a path!", "First select an existing path or create a new one.", Code.Warning);
                    hasRequirementsToRender = false;
                }
                // Check textures
                if (textureNames.hasActive())
                {
                    List <string> activeTextures = textureNames.getActive();
                    PlayerPrefsX.SetStringArray("TexturesDir", activeTextures.ToArray());
                }
                else
                {
                    WarningSystem.addWarning("Select a texture!", "Please select at least one existing texture.", Code.Warning);
                    hasRequirementsToRender = false;
                }

                // Check TPS
                if (tpsNames.hasActive())
                {
                    List <string> activeTPS = tpsNames.getActive();
                    PlayerPrefsX.SetStringArray("TPSDir", activeTPS.ToArray());
                }
                else
                {
                    PlayerPrefsX.SetStringArray("TPSDir", new string[] { "default" });
                }

                // Launch Renderer
                if (hasRequirementsToRender)
                {
                    Application.LoadLevel(2);
                }
            }

            GUI.enabled = true;

            GUI.Label(new Rect(260, 340, 100, 30), "TPS : ");
            tpsTexturesScrollVec = GUI.BeginScrollView(new Rect(260, 355, 220, 120), tpsTexturesScrollVec, new Rect(0, 0, 200, 150));
            tpsNames.render();
            // Put something inside the ScrollView
            //toggleThree = GUI.Toggle(new Rect(10, 10, 20, 24), toggleThree, ""); GUI.Label(new Rect(35, 10, 100, 24), "need swordtail tps");

            // End the ScrollView
            GUI.EndScrollView();



            //GUI.Label(new Rect(260, 480, 100, 30), "Time Dilation: ");

            GUI.Label(new Rect(260, 485, 120, 30), "Frame Rate: ");
            activeProject.dialFrames = int.Parse(GUI.TextField(new Rect(390, 485, 50, 25), activeProject.dialFrames.ToString()));
            GUI.Label(new Rect(260, 510, 120, 30), "Render Every: ");
            activeProject.snapshotPer = int.Parse(GUI.TextField(new Rect(390, 515, 50, 25), activeProject.snapshotPer.ToString()));

            if (GUI.Button(new Rect(250, 550, 220, 32), "Windows Only: Open Project Folder"))
            {
                try{
                    string itemPath = activeProject.projectFolderPath.Replace(@"/", @"\");                       // explorer doesn't like front slashes
                    System.Diagnostics.Process.Start("explorer.exe", "/select," + itemPath);
                }catch
                {
                    WarningSystem.addWarning("Failed to spawn explorer", "Unable to open explorer, are you using a mac?", Code.Error);
                }
            }

            GUI.enabled = true;

            if (isDisplayingPrompt)
            {
                GUI.BeginGroup(new Rect(120, 100, 500, 500));
                GUI.Box(new Rect(30, 80, 190, 180), "Enter Path Name:");

                GUI.SetNextControlName("ProjectPathField");
                pathName = GUI.TextField(new Rect(50, 120, 150, 32), pathName, 40);
                GUI.FocusControl("ProjectPathField");

                if (GUI.Button(new Rect(50, 190, 150, 32), "Ok"))
                {
                    isDisplayingPrompt = false;

                    PlayerPrefs.SetInt("FishType", activeProject.type);
                    PlayerPrefs.SetString("PathDir", activeProject.projectFolderPath + "\\paths\\" + pathName + ".xml");
                    PlayerPrefs.SetString("PathName", pathName);
                    Application.LoadLevel(1);

                    //Directory.CreateDirectory(activeProject.projectFolderPath + "\\paths\\" + pathName);

                    PathData newPathData = new PathData();
                    newPathData.pathName  = pathName;
                    newPathData.keyframes = new List <KeyframeInfo>(0);
                    saveNewPathData(newPathData);
                    //GameRegistry activeRegistry = gameObject.GetComponent<GameRegistry>();
                    //activeRegistry.switchState(States.AnimationEditor);

                    // Create Project Directory and Add to the display list
                }
                GUI.EndGroup();
            }


            GUI.EndGroup();
        }
    }
示例#5
0
    //! Called by unity engine for rendering and handling GUI events.
    public void OnGUI()
    {
        // STYLE
        GUI.skin = GetComponent <PlayerGUI>().thisGUIskin;

        // ASPECT RATIO
        float ScreenHeight = Screen.height;
        float ScreenWidth  = Screen.width;

        if (ScreenWidth / ScreenHeight < 1.7f)
        {
            ScreenHeight = (ScreenHeight * 0.75f);
        }
        if (ScreenHeight < 700)
        {
            GUI.skin.label.fontSize = 10;
        }

        if (!playerController.stateManager.Busy() && GetComponent <MainMenu>().finishedLoading == true)
        {
            // MACHINE CONTROL GUI
            if (playerController.inventoryOpen == false && playerController.machineGUIopen == true && playerController.objectInSight != null)
            {
                GameObject obj = playerController.objectInSight;

                if (obj.GetComponent <PowerConduit>() != null)
                {
                    bool         netFlag      = false;
                    PowerConduit powerConduit = obj.GetComponent <PowerConduit>();
                    if (powerConduit.connectionFailed == false)
                    {
                        GUI.DrawTexture(guiCoordinates.FourButtonSpeedControlBGRect, textureDictionary.dictionary["Interface Background"]);
                        GUI.Label(guiCoordinates.outputLabelRect, "Range");
                        powerConduit.range = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, powerConduit.range, 6, 120);
                        if (GUI.Button(guiCoordinates.outputControlButton3Rect, "Dual Output: " + powerConduit.dualOutput))
                        {
                            if (powerConduit.dualOutput == true)
                            {
                                powerConduit.dualOutput = false;
                            }
                            else
                            {
                                powerConduit.dualOutput = true;
                            }
                            playerController.PlayButtonSound();
                        }
                        if (GUI.Button(guiCoordinates.outputControlButton4Rect, "Close"))
                        {
                            playerController.machineGUIopen = false;
                            playerController.PlayButtonSound();
                        }
                    }
                    else
                    {
                        GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]);
                        GUI.Label(guiCoordinates.outputLabelRect, "Offline");
                        if (GUI.Button(guiCoordinates.outputControlButton2Rect, "Reboot"))
                        {
                            netFlag = true;
                            powerConduit.connectionAttempts = 0;
                            powerConduit.connectionFailed   = false;
                            playerController.PlayButtonSound();
                        }
                    }
                    if (PlayerPrefsX.GetPersistentBool("multiplayer") == true)
                    {
                        bool rangeDeSync  = powerConduit.range != playerController.networkedConduitRange;
                        bool outputDeSync = powerConduit.dualOutput != playerController.networkedDualPower;
                        if (rangeDeSync || outputDeSync || netFlag)
                        {
                            NetworkSend net      = playerController.networkController.networkSend;
                            Vector3     location = powerConduit.gameObject.transform.position;
                            updateNetworkConduitCoroutine          = StartCoroutine(net.SendPowerData(location, powerConduit.range, powerConduit.dualOutput));
                            playerController.networkedConduitRange = powerConduit.range;
                            playerController.networkedDualPower    = powerConduit.dualOutput;
                        }
                    }
                }

                if (obj.GetComponent <RailCartHub>() != null)
                {
                    bool        netFlag = false;
                    RailCartHub hub     = obj.GetComponent <RailCartHub>();
                    if (hub.connectionFailed == false)
                    {
                        if (hubStopWindowOpen == false)
                        {
                            GUI.DrawTexture(guiCoordinates.FiveButtonSpeedControlBGRect, textureDictionary.dictionary["Interface Background"]);
                            GUI.Label(guiCoordinates.railCartHubCircuitLabelRect, "Circuit");
                            int    circuit       = hub.circuit;
                            string circuitString = GUI.TextField(guiCoordinates.railCartHubCircuitRect, circuit.ToString(), 3);
                            try
                            {
                                hub.circuit = int.Parse(circuitString);
                            }
                            catch
                            {
                                // NOOP
                            }
                            GUI.Label(guiCoordinates.outputLabelRect, "Range");
                            hub.range = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, hub.range, 6, 120);
                            if (GUI.Button(guiCoordinates.outputControlButton3Rect, "Stop Settings"))
                            {
                                hubStopWindowOpen = true;
                                playerController.PlayButtonSound();
                            }
                            if (GUI.Button(guiCoordinates.outputControlButton4Rect, "Close"))
                            {
                                playerController.machineGUIopen = false;
                                hubStopWindowOpen = false;
                                playerController.PlayButtonSound();
                            }
                        }
                        else
                        {
                            GUI.DrawTexture(guiCoordinates.FiveButtonSpeedControlBGRect, textureDictionary.dictionary["Interface Background"]);
                            GUI.Label(guiCoordinates.longOutputLabelRect, "Stop Time");
                            if (GUI.Button(guiCoordinates.outputControlButton0Rect, "Stop: " + hub.stop))
                            {
                                if (hub.stop == true)
                                {
                                    hub.stop = false;
                                }
                                else
                                {
                                    hub.stop = true;
                                }
                                playerController.PlayButtonSound();
                            }
                            hub.stopTime = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, hub.stopTime, 0, 600);
                            if (GUI.Button(guiCoordinates.outputControlButton3Rect, "Range Settings"))
                            {
                                hubStopWindowOpen = false;
                                playerController.PlayButtonSound();
                            }
                            if (GUI.Button(guiCoordinates.outputControlButton4Rect, "Close"))
                            {
                                playerController.machineGUIopen = false;
                                hubStopWindowOpen = false;
                                playerController.PlayButtonSound();
                            }
                        }
                    }
                    else
                    {
                        GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]);
                        GUI.Label(guiCoordinates.outputLabelRect, "Offline");
                        if (GUI.Button(guiCoordinates.outputControlButton2Rect, "Reboot"))
                        {
                            netFlag = true;
                            hub.connectionAttempts = 0;
                            hub.connectionFailed   = false;
                            playerController.PlayButtonSound();
                        }
                    }
                    if (PlayerPrefsX.GetPersistentBool("multiplayer") == true)
                    {
                        bool circuitDeSync = hub.circuit != playerController.networkedHubCircuit;
                        bool rangeDeSync   = hub.range != playerController.networkedHubRange;
                        bool stopDeSync    = hub.stop != playerController.networkedHubStop;
                        bool timeDeSync    = (int)hub.stopTime != (int)playerController.networkedHubStopTime;
                        if (circuitDeSync || rangeDeSync || stopDeSync || timeDeSync || netFlag)
                        {
                            NetworkSend net      = playerController.networkController.networkSend;
                            Vector3     location = hub.gameObject.transform.position;
                            updateNetworkConduitCoroutine         = StartCoroutine(net.SendHubData(location, hub.circuit, hub.range, hub.stop, hub.stopTime));
                            playerController.networkedHubCircuit  = hub.circuit;
                            playerController.networkedHubRange    = hub.range;
                            playerController.networkedHubStop     = hub.stop;
                            playerController.networkedHubStopTime = hub.stopTime;
                        }
                    }
                }

                if (obj.GetComponent <Retriever>() != null)
                {
                    bool      netFlag   = false;
                    Retriever retriever = obj.GetComponent <Retriever>();
                    if (retriever.connectionFailed == false)
                    {
                        GUI.DrawTexture(guiCoordinates.FourButtonSpeedControlBGRect, textureDictionary.dictionary["Interface Background"]);
                        if (retriever.power > 0)
                        {
                            GUI.Label(guiCoordinates.outputLabelRect, "Output");
                            retriever.speed = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, retriever.speed, 0, retriever.power);
                        }
                        else
                        {
                            GUI.Label(guiCoordinates.outputLabelRect, "No Power");
                        }
                        if (GUI.Button(guiCoordinates.outputControlButton3Rect, "Choose Items"))
                        {
                            if (obj.GetComponent <InventoryManager>().initialized == true)
                            {
                                playerController.inventoryOpen  = true;
                                playerController.storageGUIopen = true;
                                playerController.machineGUIopen = false;
                                playerController.PlayButtonSound();
                            }
                        }
                        if (GUI.Button(guiCoordinates.outputControlButton4Rect, "Close"))
                        {
                            playerController.machineGUIopen = false;
                            playerController.PlayButtonSound();
                        }
                    }
                    else
                    {
                        GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]);
                        GUI.Label(guiCoordinates.outputLabelRect, "Offline");
                        if (GUI.Button(guiCoordinates.outputControlButton2Rect, "Reboot"))
                        {
                            netFlag = true;
                            retriever.connectionAttempts = 0;
                            retriever.connectionFailed   = false;
                            playerController.PlayButtonSound();
                        }
                    }
                    if (PlayerPrefsX.GetPersistentBool("multiplayer") == true)
                    {
                        if (retriever.speed != playerController.networkedConduitRange || netFlag == true)
                        {
                            NetworkSend net      = playerController.networkController.networkSend;
                            Vector3     location = retriever.gameObject.transform.position;
                            updateNetworkConduitCoroutine          = StartCoroutine(net.SendConduitData(location, retriever.speed));
                            playerController.networkedConduitRange = retriever.speed;
                        }
                    }
                }

                if (obj.GetComponent <AutoCrafter>() != null)
                {
                    bool        netFlag     = false;
                    AutoCrafter autoCrafter = obj.GetComponent <AutoCrafter>();
                    if (autoCrafter.connectionFailed == false)
                    {
                        GUI.DrawTexture(guiCoordinates.FourButtonSpeedControlBGRect, textureDictionary.dictionary["Interface Background"]);
                        if (autoCrafter.power > 0)
                        {
                            GUI.Label(guiCoordinates.outputLabelRect, "Output");
                            autoCrafter.speed = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, autoCrafter.speed, 0, autoCrafter.power);
                        }
                        else
                        {
                            GUI.Label(guiCoordinates.outputLabelRect, "No Power");
                        }
                        if (GUI.Button(guiCoordinates.outputControlButton3Rect, "Choose Item"))
                        {
                            if (obj.GetComponent <InventoryManager>().initialized == true)
                            {
                                playerController.inventoryOpen  = true;
                                playerController.storageGUIopen = true;
                                playerController.machineGUIopen = false;
                                playerController.PlayButtonSound();
                            }
                        }
                        if (GUI.Button(guiCoordinates.outputControlButton4Rect, "Close"))
                        {
                            playerController.machineGUIopen = false;
                            playerController.PlayButtonSound();
                        }
                    }
                    else
                    {
                        GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]);
                        GUI.Label(guiCoordinates.outputLabelRect, "Offline");
                        if (GUI.Button(guiCoordinates.outputControlButton2Rect, "Reboot"))
                        {
                            netFlag = true;
                            autoCrafter.connectionAttempts = 0;
                            autoCrafter.connectionFailed   = false;
                            playerController.PlayButtonSound();
                        }
                    }
                    if (PlayerPrefsX.GetPersistentBool("multiplayer") == true)
                    {
                        if (autoCrafter.speed != playerController.networkedConduitRange || netFlag == true)
                        {
                            NetworkSend net      = playerController.networkController.networkSend;
                            Vector3     location = autoCrafter.gameObject.transform.position;
                            updateNetworkConduitCoroutine          = StartCoroutine(net.SendConduitData(location, autoCrafter.speed));
                            playerController.networkedConduitRange = autoCrafter.speed;
                        }
                    }
                }

                if (obj.GetComponent <UniversalConduit>() != null)
                {
                    bool netFlag = false;
                    GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]);
                    UniversalConduit conduit = obj.GetComponent <UniversalConduit>();
                    if (conduit.connectionFailed == false)
                    {
                        GUI.Label(guiCoordinates.outputLabelRect, "Range");
                        conduit.range = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, conduit.range, 6, 120);
                    }
                    else
                    {
                        GUI.Label(guiCoordinates.outputLabelRect, "Offline");
                        if (GUI.Button(guiCoordinates.outputControlButton2Rect, "Reboot"))
                        {
                            netFlag = true;
                            conduit.connectionAttempts = 0;
                            conduit.connectionFailed   = false;
                            playerController.PlayButtonSound();
                        }
                    }
                    if (PlayerPrefsX.GetPersistentBool("multiplayer") == true)
                    {
                        if (conduit.range != playerController.networkedConduitRange || netFlag == true)
                        {
                            NetworkSend net      = playerController.networkController.networkSend;
                            Vector3     location = conduit.gameObject.transform.position;
                            updateNetworkConduitCoroutine          = StartCoroutine(net.SendConduitData(location, conduit.range));
                            playerController.networkedConduitRange = conduit.range;
                        }
                    }
                }

                if (obj.GetComponent <DarkMatterConduit>() != null)
                {
                    bool netFlag = false;
                    GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]);
                    DarkMatterConduit conduit = obj.GetComponent <DarkMatterConduit>();
                    if (conduit.connectionFailed == false)
                    {
                        GUI.Label(guiCoordinates.outputLabelRect, "Range");
                        conduit.range = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, conduit.range, 6, 120);
                    }
                    else
                    {
                        GUI.Label(guiCoordinates.outputLabelRect, "Offline");
                        if (GUI.Button(guiCoordinates.outputControlButton2Rect, "Reboot"))
                        {
                            netFlag = true;
                            conduit.connectionAttempts = 0;
                            conduit.connectionFailed   = false;
                            playerController.PlayButtonSound();
                        }
                    }
                    if (PlayerPrefsX.GetPersistentBool("multiplayer") == true)
                    {
                        if (conduit.range != playerController.networkedConduitRange || netFlag == true)
                        {
                            NetworkSend net      = playerController.networkController.networkSend;
                            Vector3     location = conduit.gameObject.transform.position;
                            updateNetworkConduitCoroutine          = StartCoroutine(net.SendConduitData(location, conduit.range));
                            playerController.networkedConduitRange = conduit.range;
                        }
                    }
                }

                if (obj.GetComponent <HeatExchanger>() != null)
                {
                    bool netFlag = false;
                    GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]);
                    HeatExchanger hx = obj.GetComponent <HeatExchanger>();
                    if (hx.inputObject != null)
                    {
                        if (hx.inputObject.GetComponent <UniversalConduit>() != null)
                        {
                            if (hx.connectionFailed == false)
                            {
                                GUI.Label(guiCoordinates.outputLabelRect, "Output");
                                hx.speed = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, hx.speed, 0, playerController.hxAmount);
                            }
                            else
                            {
                                GUI.Label(guiCoordinates.outputLabelRect, "Offline");
                                if (GUI.Button(guiCoordinates.outputControlButton2Rect, "Reboot"))
                                {
                                    netFlag = true;
                                    hx.connectionAttempts = 0;
                                    hx.connectionFailed   = false;
                                    playerController.PlayButtonSound();
                                }
                            }
                            if (PlayerPrefsX.GetPersistentBool("multiplayer") == true)
                            {
                                if (hx.speed != playerController.networkedMachineSpeed || netFlag == true)
                                {
                                    NetworkSend net      = playerController.networkController.networkSend;
                                    Vector3     location = hx.gameObject.transform.position;
                                    updateNetworkMachineCoroutine          = StartCoroutine(net.SendMachineData(location, hx.speed));
                                    playerController.networkedMachineSpeed = hx.speed;
                                }
                            }
                        }
                        else
                        {
                            GUI.Label(guiCoordinates.outputLabelRect, "No Input");
                        }
                    }
                    else
                    {
                        GUI.Label(guiCoordinates.outputLabelRect, "No Input");
                    }
                }

                if (obj.GetComponent <PowerSource>() != null)
                {
                    GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]);
                    PowerSource powerSource = obj.GetComponent <PowerSource>();
                    if (powerSource.connectionFailed == true)
                    {
                        GUI.Label(guiCoordinates.outputLabelRect, "Offline");
                        if (GUI.Button(guiCoordinates.outputControlButton2Rect, "Reboot"))
                        {
                            powerSource.connectionAttempts = 0;
                            powerSource.connectionFailed   = false;
                            playerController.PlayButtonSound();
                        }
                    }
                    else
                    {
                        GUI.Label(guiCoordinates.outputLabelRect, "Online");
                    }
                }

                if (obj.GetComponent <Auger>() != null)
                {
                    GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]);
                    Auger auger = obj.GetComponent <Auger>();
                    if (auger.power > 0)
                    {
                        GUI.Label(guiCoordinates.outputLabelRect, "Output");
                        auger.speed = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, auger.speed, 0, auger.power);
                    }
                    else
                    {
                        GUI.Label(guiCoordinates.outputLabelRect, "No Power");
                    }
                    if (PlayerPrefsX.GetPersistentBool("multiplayer") == true)
                    {
                        if (auger.speed != playerController.networkedMachineSpeed)
                        {
                            NetworkSend net      = playerController.networkController.networkSend;
                            Vector3     location = auger.gameObject.transform.position;
                            updateNetworkMachineCoroutine          = StartCoroutine(net.SendMachineData(location, auger.speed));
                            playerController.networkedMachineSpeed = auger.speed;
                        }
                    }
                }

                if (obj.GetComponent <UniversalExtractor>() != null)
                {
                    bool netFlag = false;
                    GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]);
                    UniversalExtractor extractor = obj.GetComponent <UniversalExtractor>();
                    if (extractor.connectionFailed == false)
                    {
                        if (extractor.power > 0)
                        {
                            GUI.Label(guiCoordinates.outputLabelRect, "Output");
                            extractor.speed = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, extractor.speed, 0, extractor.power);
                        }
                        else
                        {
                            GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]);
                            GUI.Label(guiCoordinates.outputLabelRect, "No Power");
                        }
                    }
                    else
                    {
                        GUI.Label(guiCoordinates.outputLabelRect, "Offline");
                        if (GUI.Button(guiCoordinates.outputControlButton2Rect, "Reboot"))
                        {
                            netFlag = true;
                            extractor.connectionAttempts = 0;
                            extractor.connectionFailed   = false;
                            playerController.PlayButtonSound();
                        }
                    }
                    if (PlayerPrefsX.GetPersistentBool("multiplayer") == true)
                    {
                        if (extractor.speed != playerController.networkedMachineSpeed || netFlag == true)
                        {
                            NetworkSend net      = playerController.networkController.networkSend;
                            Vector3     location = extractor.gameObject.transform.position;
                            updateNetworkMachineCoroutine          = StartCoroutine(net.SendMachineData(location, extractor.speed));
                            playerController.networkedMachineSpeed = extractor.speed;
                        }
                    }
                }
                if (obj.GetComponent <DarkMatterCollector>() != null)
                {
                    bool netFlag = false;
                    GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]);
                    DarkMatterCollector collector = obj.GetComponent <DarkMatterCollector>();
                    if (collector.connectionFailed == false)
                    {
                        if (collector.power > 0)
                        {
                            GUI.Label(guiCoordinates.outputLabelRect, "Output");
                            collector.speed = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, collector.speed, 0, collector.power);
                        }
                        else
                        {
                            GUI.Label(guiCoordinates.outputLabelRect, "No Power");
                        }
                    }
                    else
                    {
                        GUI.Label(guiCoordinates.outputLabelRect, "Offline");
                        if (GUI.Button(guiCoordinates.outputControlButton2Rect, "Reboot"))
                        {
                            netFlag = true;
                            collector.connectionAttempts = 0;
                            collector.connectionFailed   = false;
                            playerController.PlayButtonSound();
                        }
                    }
                    if (PlayerPrefsX.GetPersistentBool("multiplayer") == true)
                    {
                        if (collector.speed != playerController.networkedMachineSpeed || netFlag == true)
                        {
                            NetworkSend net      = playerController.networkController.networkSend;
                            Vector3     location = collector.gameObject.transform.position;
                            updateNetworkMachineCoroutine          = StartCoroutine(net.SendMachineData(location, collector.speed));
                            playerController.networkedMachineSpeed = collector.speed;
                        }
                    }
                }

                if (obj.GetComponent <Smelter>() != null)
                {
                    bool netFlag = false;
                    GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]);
                    Smelter smelter = obj.GetComponent <Smelter>();
                    if (smelter.connectionFailed == false)
                    {
                        if (smelter.power > 0)
                        {
                            GUI.Label(guiCoordinates.outputLabelRect, "Output");
                            smelter.speed = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, smelter.speed, 0, smelter.power);
                        }
                        else
                        {
                            GUI.Label(guiCoordinates.outputLabelRect, "No Power");
                        }
                    }
                    else
                    {
                        GUI.Label(guiCoordinates.outputLabelRect, "Offline");
                        if (GUI.Button(guiCoordinates.outputControlButton2Rect, "Reboot"))
                        {
                            netFlag = true;
                            smelter.connectionAttempts = 0;
                            smelter.connectionFailed   = false;
                            playerController.PlayButtonSound();
                        }
                    }
                    if (PlayerPrefsX.GetPersistentBool("multiplayer") == true)
                    {
                        if (smelter.speed != playerController.networkedMachineSpeed || netFlag == true)
                        {
                            NetworkSend net      = playerController.networkController.networkSend;
                            Vector3     location = smelter.gameObject.transform.position;
                            updateNetworkMachineCoroutine          = StartCoroutine(net.SendMachineData(location, smelter.speed));
                            playerController.networkedMachineSpeed = smelter.speed;
                        }
                    }
                }

                if (obj.GetComponent <AlloySmelter>() != null)
                {
                    bool netFlag = false;
                    GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]);
                    AlloySmelter alloySmelter = obj.GetComponent <AlloySmelter>();
                    if (alloySmelter.connectionFailed == false)
                    {
                        if (alloySmelter.power > 0)
                        {
                            GUI.Label(guiCoordinates.outputLabelRect, "Output");
                            alloySmelter.speed = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, alloySmelter.speed, 0, alloySmelter.power);
                        }
                        else
                        {
                            GUI.Label(guiCoordinates.outputLabelRect, "No Power");
                        }
                    }
                    else
                    {
                        GUI.Label(guiCoordinates.outputLabelRect, "Offline");
                        if (GUI.Button(guiCoordinates.outputControlButton2Rect, "Reboot"))
                        {
                            netFlag = true;
                            alloySmelter.connectionAttempts = 0;
                            alloySmelter.connectionFailed   = false;
                            playerController.PlayButtonSound();
                        }
                    }
                    if (PlayerPrefsX.GetPersistentBool("multiplayer") == true)
                    {
                        if (alloySmelter.speed != playerController.networkedMachineSpeed || netFlag == true)
                        {
                            NetworkSend net      = playerController.networkController.networkSend;
                            Vector3     location = alloySmelter.gameObject.transform.position;
                            updateNetworkMachineCoroutine          = StartCoroutine(net.SendMachineData(location, alloySmelter.speed));
                            playerController.networkedMachineSpeed = alloySmelter.speed;
                        }
                    }
                }

                if (obj.GetComponent <Press>() != null)
                {
                    bool netFlag = false;
                    GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]);
                    Press press = obj.GetComponent <Press>();
                    if (press.connectionFailed == false)
                    {
                        if (press.power > 0)
                        {
                            GUI.Label(guiCoordinates.outputLabelRect, "Output");
                            press.speed = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, press.speed, 0, press.power);
                        }
                        else
                        {
                            GUI.Label(guiCoordinates.outputLabelRect, "No Power");
                        }
                    }
                    else
                    {
                        GUI.Label(guiCoordinates.outputLabelRect, "Offline");
                        if (GUI.Button(guiCoordinates.outputControlButton2Rect, "Reboot"))
                        {
                            netFlag = true;
                            press.connectionAttempts = 0;
                            press.connectionFailed   = false;
                            playerController.PlayButtonSound();
                        }
                    }
                    if (PlayerPrefsX.GetPersistentBool("multiplayer") == true)
                    {
                        if (press.speed != playerController.networkedMachineSpeed || netFlag == true)
                        {
                            NetworkSend net      = playerController.networkController.networkSend;
                            Vector3     location = press.gameObject.transform.position;
                            updateNetworkMachineCoroutine          = StartCoroutine(net.SendMachineData(location, press.speed));
                            playerController.networkedMachineSpeed = press.speed;
                        }
                    }
                }

                if (obj.GetComponent <Extruder>() != null)
                {
                    bool netFlag = false;
                    GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]);
                    Extruder extruder = obj.GetComponent <Extruder>();
                    if (extruder.connectionFailed == false)
                    {
                        if (extruder.power > 0)
                        {
                            GUI.Label(guiCoordinates.outputLabelRect, "Output");
                            extruder.speed = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, extruder.speed, 0, extruder.power);
                        }
                        else
                        {
                            GUI.Label(guiCoordinates.outputLabelRect, "No Power");
                        }
                    }
                    else
                    {
                        GUI.Label(guiCoordinates.outputLabelRect, "Offline");
                        if (GUI.Button(guiCoordinates.outputControlButton2Rect, "Reboot"))
                        {
                            netFlag = true;
                            extruder.connectionAttempts = 0;
                            extruder.connectionFailed   = false;
                            playerController.PlayButtonSound();
                        }
                    }
                    if (PlayerPrefsX.GetPersistentBool("multiplayer") == true)
                    {
                        if (extruder.speed != playerController.networkedMachineSpeed || netFlag == true)
                        {
                            NetworkSend net      = playerController.networkController.networkSend;
                            Vector3     location = extruder.gameObject.transform.position;
                            updateNetworkMachineCoroutine          = StartCoroutine(net.SendMachineData(location, extruder.speed));
                            playerController.networkedMachineSpeed = extruder.speed;
                        }
                    }
                }

                if (obj.GetComponent <ModMachine>() != null)
                {
                    bool netFlag = false;
                    GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]);
                    ModMachine modMachine = obj.GetComponent <ModMachine>();
                    if (modMachine.connectionFailed == false)
                    {
                        if (modMachine.power > 0)
                        {
                            GUI.Label(guiCoordinates.outputLabelRect, "Output");
                            modMachine.speed = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, modMachine.speed, 0, modMachine.power);
                        }
                        else
                        {
                            GUI.Label(guiCoordinates.outputLabelRect, "No Power");
                        }
                    }
                    else
                    {
                        GUI.Label(guiCoordinates.outputLabelRect, "Offline");
                        if (GUI.Button(guiCoordinates.outputControlButton2Rect, "Reboot"))
                        {
                            netFlag = true;
                            modMachine.connectionAttempts = 0;
                            modMachine.connectionFailed   = false;
                            playerController.PlayButtonSound();
                        }
                    }
                    if (PlayerPrefsX.GetPersistentBool("multiplayer") == true)
                    {
                        if (modMachine.speed != playerController.networkedMachineSpeed || netFlag == true)
                        {
                            NetworkSend net      = playerController.networkController.networkSend;
                            Vector3     location = modMachine.gameObject.transform.position;
                            updateNetworkMachineCoroutine          = StartCoroutine(net.SendMachineData(location, modMachine.speed));
                            playerController.networkedMachineSpeed = modMachine.speed;
                        }
                    }
                }

                if (obj.GetComponent <Turret>() != null)
                {
                    GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]);
                    Turret turret = obj.GetComponent <Turret>();
                    if (turret.power > 0)
                    {
                        GUI.Label(guiCoordinates.outputLabelRect, "Output");
                        if (turret.power < 30)
                        {
                            turret.speed = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, turret.speed, 0, turret.power);
                        }
                        else
                        {
                            turret.speed = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, turret.speed, 0, 30);
                        }
                    }
                    else
                    {
                        GUI.Label(guiCoordinates.outputLabelRect, "No Power");
                    }
                    if (PlayerPrefsX.GetPersistentBool("multiplayer") == true)
                    {
                        if (turret.speed != playerController.networkedMachineSpeed)
                        {
                            NetworkSend net      = playerController.networkController.networkSend;
                            Vector3     location = turret.gameObject.transform.position;
                            updateNetworkMachineCoroutine          = StartCoroutine(net.SendMachineData(location, turret.speed));
                            playerController.networkedMachineSpeed = turret.speed;
                        }
                    }
                }

                if (obj.GetComponent <MissileTurret>() != null)
                {
                    GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]);
                    MissileTurret turret = obj.GetComponent <MissileTurret>();
                    if (turret.power > 0)
                    {
                        GUI.Label(guiCoordinates.outputLabelRect, "Output");
                        if (turret.power < 30)
                        {
                            turret.speed = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, turret.speed, 0, turret.power);
                        }
                        else
                        {
                            turret.speed = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, turret.speed, 0, 30);
                        }
                    }
                    else
                    {
                        GUI.Label(guiCoordinates.outputLabelRect, "No Power");
                    }
                    if (PlayerPrefsX.GetPersistentBool("multiplayer") == true)
                    {
                        if (turret.speed != playerController.networkedMachineSpeed)
                        {
                            NetworkSend net      = playerController.networkController.networkSend;
                            Vector3     location = turret.gameObject.transform.position;
                            updateNetworkMachineCoroutine          = StartCoroutine(net.SendMachineData(location, turret.speed));
                            playerController.networkedMachineSpeed = turret.speed;
                        }
                    }
                }

                if (obj.GetComponent <GearCutter>() != null)
                {
                    bool netFlag = false;
                    GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]);
                    GearCutter gearCutter = obj.GetComponent <GearCutter>();
                    if (gearCutter.connectionFailed == false)
                    {
                        if (gearCutter.power > 0)
                        {
                            GUI.Label(guiCoordinates.outputLabelRect, "Output");
                            gearCutter.speed = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, gearCutter.speed, 0, gearCutter.power);
                        }
                        else
                        {
                            GUI.Label(guiCoordinates.outputLabelRect, "No Power");
                        }
                    }
                    else
                    {
                        GUI.Label(guiCoordinates.outputLabelRect, "Offline");
                        if (GUI.Button(guiCoordinates.outputControlButton2Rect, "Reboot"))
                        {
                            netFlag = true;
                            gearCutter.connectionAttempts = 0;
                            gearCutter.connectionFailed   = false;
                            playerController.PlayButtonSound();
                        }
                    }
                    if (PlayerPrefsX.GetPersistentBool("multiplayer") == true)
                    {
                        if (gearCutter.speed != playerController.networkedMachineSpeed || netFlag == true)
                        {
                            NetworkSend net      = playerController.networkController.networkSend;
                            Vector3     location = gearCutter.gameObject.transform.position;
                            updateNetworkMachineCoroutine          = StartCoroutine(net.SendMachineData(location, gearCutter.speed));
                            playerController.networkedMachineSpeed = gearCutter.speed;
                        }
                    }
                }
            }
            else
            {
                hubStopWindowOpen = false;
                gameObject.GetComponent <MSCameraController>().enabled = true;
            }
        }
    }
示例#6
0
 void Start()
 {
     isAreaClear = PlayerPrefsX.GetBoolArray("RoomData");
     PlayerClear = GameObject.Find("Clear");
     PlayerClear.SetActive(false);
 }
示例#7
0
    private void Start()
    {
        Player.coins = 0;
        levelEnd     = GameObject.Find("Portal");
        levelEnd.SetActive(false);
        //coins = PlayerPrefs.GetInt("coins", 0);
        Physics2D.IgnoreLayerCollision(9, 10);
        Physics2D.IgnoreLayerCollision(9, 2);
        Physics2D.IgnoreLayerCollision(10, 2);
        Physics2D.IgnoreLayerCollision(2, 2);
        //currentScene = SceneManager.GetActiveScene().buildIndex;
        GM = FindObjectOfType <GameManager>();

        gunObject = transform.Find("Guns").gameObject;
        guns      = GunData.guns;
        nameToGun = GunData.nameToGun;
        int[] gunSlots = PlayerPrefsX.GetIntArray("gunsEquipped", 0, 2);
        gunsEquipped.Add(gunSlots[0]);
        gunsEquipped.Add(gunSlots[1]);
        //Debug.Log(gunSlots[0]);
        //Debug.Log(gunSlots[1]);
        for (int i = 0; i < guns.Count; i++)
        {
            if (gunsEquipped.Contains(i))
            {
                Gun clone = new Gun();
                if (guns[i] is Shotgun)
                {
                    clone = new Shotgun();
                }
                else if (guns[i] is Beam)
                {
                    clone = new Beam();
                }
                else if (guns[i] is Hitscan)
                {
                    clone = new Hitscan();
                }
                else if (guns[i] is Projectile)
                {
                    clone = new Projectile();
                }
                clone.setVals(guns[i]);
                playerGuns.Add(clone);
                Debug.Log(nameToGun[clone.gunName]);
                playerGunsObjects.Add(nameToGun[clone.gunName], gunObject.transform.Find(clone.gunName).gameObject);
            }
        }
        gun = playerGuns[currentGun];
        playerGunsObjects[nameToGun[playerGuns[currentGun].gunName]].SetActive(true);
        gunAccuracy    = gun.accuracy;
        crouchAccuracy = gunAccuracy / 2;

        if (healthBar.barHeight == 0)
        {
            healthBar.barHeight = 0.5f;
        }
        if (healthBar.barLength == 0)
        {
            healthBar.barLength = 2f;
        }

        healthBar.bar.startWidth     = healthBar.barHeight / 2;
        healthBar.bar.material.color = Color.red;
        healthBar.bar.positionCount  = 2;

        healthBar.health.startWidth     = healthBar.barHeight / 2;
        healthBar.health.material.color = Color.green;
        healthBar.health.positionCount  = 2;
    }
 public void resetHasPlayed()
 {
     hasPlayedBefore = false;
     PlayerPrefsX.SetBool("HasPlayedBefore", hasPlayedBefore);
     Debug.Log("hasplayedbefore = " + hasPlayedBefore);
 }
 private void OnDestroy()
 {
     hasPlayedBefore = true;
     PlayerPrefsX.SetBool("HasPlayedBefore", hasPlayedBefore);
 }
示例#10
0
    //! Saves the world.
    public IEnumerator SaveDataCoroutine()
    {
        stateManager.dataSaved = false;
        stateManager.saving    = true;
        currentObject          = 0;
        int        saveInterval  = 0;
        int        objectID      = 0;
        string     worldID       = "";
        string     objectName    = "";
        List <int> machineIdList = new List <int>();
        List <int> blockIdList   = new List <int>();

        GameObject[]  machines     = GameObject.FindGameObjectsWithTag("Machine");
        Transform[]   blocks       = stateManager.builtObjects.GetComponentsInChildren <Transform>(true);
        MeshPainter[] meshPainters = Object.FindObjectsOfType <MeshPainter>();

        if (totalObjects == 0)
        {
            totalObjects = machines.Length + blocks.Length + meshPainters.Length;
        }

        foreach (GameObject go in machines)
        {
            if (go != null)
            {
                if (go.transform.parent != stateManager.builtObjects.transform)
                {
                    Vector3    objectPosition = go.transform.position;
                    Quaternion objectRotation = go.transform.rotation;
                    if (go.GetComponent <Auger>() != null)
                    {
                        objectName = stateManager.worldName + "Auger";
                        worldID    = go.GetComponent <Auger>().ID;
                        if (worldID != "unassigned" && worldID != "")
                        {
                            objectID = int.Parse(worldID.Substring(objectName.Length));
                            machineIdList.Add(objectID);
                            int   speed  = go.GetComponent <Auger>().speed;
                            float amount = go.GetComponent <Auger>().amount;
                            FileBasedPrefs.SetInt(worldID + "speed", speed);
                            FileBasedPrefs.SetFloat(worldID + "amount", amount);
                            FileBasedPrefs.SetBool(worldID + "falling", go.GetComponent <PhysicsHandler>().falling);
                            FileBasedPrefs.SetBool(worldID + "fallingStack", go.GetComponent <PhysicsHandler>().fallingStack);
                        }
                    }
                    if (go.GetComponent <ElectricLight>() != null)
                    {
                        objectName = stateManager.worldName + "ElectricLight";
                        worldID    = go.GetComponent <ElectricLight>().ID;
                        if (worldID != "unassigned" && worldID != "")
                        {
                            objectID = int.Parse(worldID.Substring(objectName.Length));
                            machineIdList.Add(objectID);
                            FileBasedPrefs.SetBool(worldID + "falling", go.GetComponent <PhysicsHandler>().falling);
                            FileBasedPrefs.SetBool(worldID + "fallingStack", go.GetComponent <PhysicsHandler>().fallingStack);
                        }
                    }
                    if (go.GetComponent <DarkMatterCollector>() != null)
                    {
                        objectName = stateManager.worldName + "DarkMatterCollector";
                        worldID    = go.GetComponent <DarkMatterCollector>().ID;
                        if (worldID != "unassigned" && worldID != "")
                        {
                            objectID = int.Parse(worldID.Substring(objectName.Length));
                            machineIdList.Add(objectID);
                            int   speed            = go.GetComponent <DarkMatterCollector>().speed;
                            float darkMatterAmount = go.GetComponent <DarkMatterCollector>().darkMatterAmount;
                            FileBasedPrefs.SetInt(worldID + "speed", speed);
                            FileBasedPrefs.SetFloat(worldID + "darkMatterAmount", darkMatterAmount);
                            FileBasedPrefs.SetBool(worldID + "falling", go.GetComponent <PhysicsHandler>().falling);
                            FileBasedPrefs.SetBool(worldID + "fallingStack", go.GetComponent <PhysicsHandler>().fallingStack);
                        }
                    }
                    if (go.GetComponent <DarkMatterConduit>() != null)
                    {
                        objectName = stateManager.worldName + "DarkMatterConduit";
                        worldID    = go.GetComponent <DarkMatterConduit>().ID;
                        if (worldID != "unassigned" && worldID != "")
                        {
                            objectID = int.Parse(worldID.Substring(objectName.Length));
                            machineIdList.Add(objectID);
                            string inputID          = go.GetComponent <DarkMatterConduit>().inputID;
                            string outputID         = go.GetComponent <DarkMatterConduit>().outputID;
                            int    speed            = go.GetComponent <DarkMatterConduit>().speed;
                            float  darkMatterAmount = go.GetComponent <DarkMatterConduit>().darkMatterAmount;
                            int    range            = go.GetComponent <DarkMatterConduit>().range;
                            FileBasedPrefs.SetString(worldID + "inputID", inputID);
                            FileBasedPrefs.SetString(worldID + "outputID", outputID);
                            FileBasedPrefs.SetInt(worldID + "speed", speed);
                            FileBasedPrefs.SetInt(worldID + "range", range);
                            FileBasedPrefs.SetFloat(worldID + "darkMatterAmount", darkMatterAmount);
                            FileBasedPrefs.SetBool(worldID + "falling", go.GetComponent <PhysicsHandler>().falling);
                            FileBasedPrefs.SetBool(worldID + "fallingStack", go.GetComponent <PhysicsHandler>().fallingStack);
                        }
                    }
                    if (go.GetComponent <RailCart>() != null)
                    {
                        objectName = stateManager.worldName + "RailCart";
                        worldID    = go.GetComponent <RailCart>().ID;
                        if (worldID != "unassigned" && worldID != "")
                        {
                            objectID = int.Parse(worldID.Substring(objectName.Length));
                            machineIdList.Add(objectID);
                            string  targetID      = go.GetComponent <RailCart>().targetID;
                            Vector3 startPosition = go.GetComponent <RailCart>().startPosition;
                            if (go.GetComponent <InventoryManager>() != null)
                            {
                                go.GetComponent <InventoryManager>().SaveData();
                            }
                            FileBasedPrefs.SetString(worldID + "targetID", targetID);
                            PlayerPrefsX.SetVector3(worldID + "startPosition", startPosition);
                        }
                    }
                    if (go.GetComponent <RailCartHub>() != null)
                    {
                        objectName = stateManager.worldName + "RailCartHub";
                        worldID    = go.GetComponent <RailCartHub>().ID;
                        if (worldID != "unassigned" && worldID != "")
                        {
                            objectID = int.Parse(worldID.Substring(objectName.Length));
                            machineIdList.Add(objectID);
                            string inputID    = go.GetComponent <RailCartHub>().inputID;
                            string outputID   = go.GetComponent <RailCartHub>().outputID;
                            int    range      = go.GetComponent <RailCartHub>().range;
                            bool   centralHub = go.GetComponent <RailCartHub>().centralHub;
                            bool   stop       = go.GetComponent <RailCartHub>().stop;
                            int    circuit    = go.GetComponent <RailCartHub>().circuit;
                            float  stopTime   = go.GetComponent <RailCartHub>().stopTime;
                            FileBasedPrefs.SetString(worldID + "inputID", inputID);
                            FileBasedPrefs.SetString(worldID + "outputID", outputID);
                            FileBasedPrefs.SetInt(worldID + "range", range);
                            FileBasedPrefs.SetInt(worldID + "circuit", circuit);
                            FileBasedPrefs.SetBool(worldID + "centralHub", centralHub);
                            FileBasedPrefs.SetBool(worldID + "stop", stop);
                            FileBasedPrefs.SetFloat(worldID + "stopTime", stopTime);
                            FileBasedPrefs.SetBool(worldID + "falling", go.GetComponent <PhysicsHandler>().falling);
                            FileBasedPrefs.SetBool(worldID + "fallingStack", go.GetComponent <PhysicsHandler>().fallingStack);
                        }
                    }
                    if (go.GetComponent <UniversalConduit>() != null)
                    {
                        objectName = stateManager.worldName + "UniversalConduit";
                        worldID    = go.GetComponent <UniversalConduit>().ID;
                        if (worldID != "unassigned" && worldID != "")
                        {
                            objectID = int.Parse(worldID.Substring(objectName.Length));
                            machineIdList.Add(objectID);
                            string inputID  = go.GetComponent <UniversalConduit>().inputID;
                            string outputID = go.GetComponent <UniversalConduit>().outputID;
                            string type     = go.GetComponent <UniversalConduit>().type;
                            int    speed    = go.GetComponent <UniversalConduit>().speed;
                            int    range    = go.GetComponent <UniversalConduit>().range;
                            float  amount   = go.GetComponent <UniversalConduit>().amount;
                            FileBasedPrefs.SetString(worldID + "inputID", inputID);
                            FileBasedPrefs.SetString(worldID + "outputID", outputID);
                            FileBasedPrefs.SetString(worldID + "type", type);
                            FileBasedPrefs.SetInt(worldID + "speed", speed);
                            FileBasedPrefs.SetInt(worldID + "range", range);
                            FileBasedPrefs.SetFloat(worldID + "amount", amount);
                            FileBasedPrefs.SetBool(worldID + "falling", go.GetComponent <PhysicsHandler>().falling);
                            FileBasedPrefs.SetBool(worldID + "fallingStack", go.GetComponent <PhysicsHandler>().fallingStack);
                        }
                    }
                    if (go.GetComponent <HeatExchanger>() != null)
                    {
                        objectName = stateManager.worldName + "HeatExchanger";
                        worldID    = go.GetComponent <HeatExchanger>().ID;
                        if (worldID != "unassigned" && worldID != "")
                        {
                            objectID = int.Parse(worldID.Substring(objectName.Length));
                            machineIdList.Add(objectID);
                            string inputID   = go.GetComponent <HeatExchanger>().inputID;
                            string outputID  = go.GetComponent <HeatExchanger>().outputID;
                            string inputType = go.GetComponent <HeatExchanger>().inputType;
                            int    speed     = go.GetComponent <HeatExchanger>().speed;
                            float  amount    = go.GetComponent <HeatExchanger>().amount;
                            FileBasedPrefs.SetString(worldID + "inputID", inputID);
                            FileBasedPrefs.SetString(worldID + "outputID", outputID);
                            FileBasedPrefs.SetString(worldID + "inputType", inputType);
                            FileBasedPrefs.SetInt(worldID + "speed", speed);
                            FileBasedPrefs.SetFloat(worldID + "amount", amount);
                            FileBasedPrefs.SetBool(worldID + "falling", go.GetComponent <PhysicsHandler>().falling);
                            FileBasedPrefs.SetBool(worldID + "fallingStack", go.GetComponent <PhysicsHandler>().fallingStack);
                        }
                    }
                    if (go.GetComponent <Retriever>() != null)
                    {
                        objectName = stateManager.worldName + "Retriever";
                        worldID    = go.GetComponent <Retriever>().ID;
                        if (worldID != "unassigned" && worldID != "")
                        {
                            objectID = int.Parse(worldID.Substring(objectName.Length));
                            machineIdList.Add(objectID);
                            string inputID  = go.GetComponent <Retriever>().inputID;
                            string outputID = go.GetComponent <Retriever>().outputID;
                            int    speed    = go.GetComponent <Retriever>().speed;
                            float  amount   = go.GetComponent <Retriever>().amount;
                            FileBasedPrefs.SetString(worldID + "inputID", inputID);
                            FileBasedPrefs.SetString(worldID + "outputID", outputID);
                            FileBasedPrefs.SetInt(worldID + "speed", speed);
                            FileBasedPrefs.SetFloat(worldID + "amount", amount);
                            FileBasedPrefs.SetBool(worldID + "falling", go.GetComponent <PhysicsHandler>().falling);
                            FileBasedPrefs.SetBool(worldID + "fallingStack", go.GetComponent <PhysicsHandler>().fallingStack);
                            if (go.GetComponent <InventoryManager>() != null)
                            {
                                go.GetComponent <InventoryManager>().SaveData();
                            }
                        }
                    }
                    if (go.GetComponent <AutoCrafter>() != null)
                    {
                        objectName = stateManager.worldName + "AutoCrafter";
                        worldID    = go.GetComponent <AutoCrafter>().ID;
                        if (worldID != "unassigned" && worldID != "")
                        {
                            objectID = int.Parse(worldID.Substring(objectName.Length));
                            machineIdList.Add(objectID);
                            string inputID = go.GetComponent <AutoCrafter>().inputID;
                            int    speed   = go.GetComponent <AutoCrafter>().speed;
                            FileBasedPrefs.SetString(worldID + "inputID", inputID);
                            FileBasedPrefs.SetInt(worldID + "speed", speed);
                            FileBasedPrefs.SetBool(worldID + "falling", go.GetComponent <PhysicsHandler>().falling);
                            FileBasedPrefs.SetBool(worldID + "fallingStack", go.GetComponent <PhysicsHandler>().fallingStack);
                            if (go.GetComponent <InventoryManager>() != null)
                            {
                                go.GetComponent <InventoryManager>().SaveData();
                            }
                        }
                    }
                    if (go.GetComponent <Smelter>() != null)
                    {
                        objectName = stateManager.worldName + "Smelter";
                        worldID    = go.GetComponent <Smelter>().ID;
                        if (worldID != "unassigned" && worldID != "")
                        {
                            objectID = int.Parse(worldID.Substring(objectName.Length));
                            machineIdList.Add(objectID);
                            string inputID    = go.GetComponent <Smelter>().inputID;
                            string outputID   = go.GetComponent <Smelter>().outputID;
                            string inputType  = go.GetComponent <Smelter>().inputType;
                            string outputType = go.GetComponent <Smelter>().outputType;
                            int    speed      = go.GetComponent <Smelter>().speed;
                            float  amount     = go.GetComponent <Smelter>().amount;
                            FileBasedPrefs.SetString(worldID + "inputID", inputID);
                            FileBasedPrefs.SetString(worldID + "outputID", outputID);
                            FileBasedPrefs.SetString(worldID + "inputType", inputType);
                            FileBasedPrefs.SetString(worldID + "outputType", outputType);
                            FileBasedPrefs.SetInt(worldID + "speed", speed);
                            FileBasedPrefs.SetFloat(worldID + "amount", amount);
                            FileBasedPrefs.SetBool(worldID + "falling", go.GetComponent <PhysicsHandler>().falling);
                            FileBasedPrefs.SetBool(worldID + "fallingStack", go.GetComponent <PhysicsHandler>().fallingStack);
                        }
                    }
                    if (go.GetComponent <Turret>() != null)
                    {
                        objectName = stateManager.worldName + "Turret";
                        worldID    = go.GetComponent <Turret>().ID;
                        if (worldID != "unassigned" && worldID != "")
                        {
                            objectID = int.Parse(worldID.Substring(objectName.Length));
                            machineIdList.Add(objectID);
                            int speed = go.GetComponent <Turret>().speed;
                            FileBasedPrefs.SetInt(worldID + "speed", speed);
                            FileBasedPrefs.SetBool(worldID + "falling", go.GetComponent <PhysicsHandler>().falling);
                            FileBasedPrefs.SetBool(worldID + "fallingStack", go.GetComponent <PhysicsHandler>().fallingStack);
                        }
                    }
                    if (go.GetComponent <MissileTurret>() != null)
                    {
                        objectName = stateManager.worldName + "MissileTurret";
                        worldID    = go.GetComponent <MissileTurret>().ID;
                        if (worldID != "unassigned" && worldID != "")
                        {
                            objectID = int.Parse(worldID.Substring(objectName.Length));
                            machineIdList.Add(objectID);
                            int    speed      = go.GetComponent <MissileTurret>().speed;
                            string ammoType   = go.GetComponent <MissileTurret>().ammoType;
                            int    ammoAmount = go.GetComponent <MissileTurret>().ammoAmount;
                            FileBasedPrefs.SetString(worldID + "ammoType", ammoType);
                            FileBasedPrefs.SetInt(worldID + "ammoAmount", ammoAmount);
                            FileBasedPrefs.SetInt(worldID + "speed", speed);
                            FileBasedPrefs.SetBool(worldID + "falling", go.GetComponent <PhysicsHandler>().falling);
                            FileBasedPrefs.SetBool(worldID + "fallingStack", go.GetComponent <PhysicsHandler>().fallingStack);
                        }
                    }
                    if (go.GetComponent <PowerSource>() != null)
                    {
                        if (go.GetComponent <PowerSource>().type == "Solar Panel")
                        {
                            objectName = stateManager.worldName + "SolarPanel";
                        }
                        else if (go.GetComponent <PowerSource>().type == "Generator")
                        {
                            objectName = stateManager.worldName + "Generator";
                        }
                        else if (go.GetComponent <PowerSource>().type == "Reactor Turbine")
                        {
                            objectName = stateManager.worldName + "ReactorTurbine";
                        }
                        worldID = go.GetComponent <PowerSource>().ID;
                        if (worldID != "unassigned" && worldID != "")
                        {
                            objectID = int.Parse(worldID.Substring(objectName.Length));
                            machineIdList.Add(objectID);
                            string outputID   = go.GetComponent <PowerSource>().outputID;
                            string fuelType   = go.GetComponent <PowerSource>().fuelType;
                            int    fuelAmount = go.GetComponent <PowerSource>().fuelAmount;
                            FileBasedPrefs.SetString(worldID + "outputID", outputID);
                            FileBasedPrefs.SetString(worldID + "fuelType", fuelType);
                            FileBasedPrefs.SetInt(worldID + "fuelAmount", fuelAmount);
                            FileBasedPrefs.SetBool(worldID + "falling", go.GetComponent <PhysicsHandler>().falling);
                            FileBasedPrefs.SetBool(worldID + "fallingStack", go.GetComponent <PhysicsHandler>().fallingStack);
                        }
                    }
                    if (go.GetComponent <NuclearReactor>() != null)
                    {
                        objectName = stateManager.worldName + "NuclearReactor";
                        worldID    = go.GetComponent <NuclearReactor>().ID;
                        if (worldID != "unassigned" && worldID != "")
                        {
                            objectID = int.Parse(worldID.Substring(objectName.Length));
                            machineIdList.Add(objectID);
                            FileBasedPrefs.SetBool(worldID + "falling", go.GetComponent <PhysicsHandler>().falling);
                            FileBasedPrefs.SetBool(worldID + "fallingStack", go.GetComponent <PhysicsHandler>().fallingStack);
                        }
                    }
                    if (go.GetComponent <PowerConduit>() != null)
                    {
                        objectName = stateManager.worldName + "PowerConduit";
                        worldID    = go.GetComponent <PowerConduit>().ID;
                        if (worldID != "unassigned" && worldID != "")
                        {
                            objectID = int.Parse(worldID.Substring(objectName.Length));
                            machineIdList.Add(objectID);
                            string inputID     = go.GetComponent <PowerConduit>().inputID;
                            string outputID1   = go.GetComponent <PowerConduit>().outputID1;
                            string outputID2   = go.GetComponent <PowerConduit>().outputID2;
                            bool   dualOutput  = go.GetComponent <PowerConduit>().dualOutput;
                            int    range       = go.GetComponent <PowerConduit>().range;
                            int    powerAmount = go.GetComponent <PowerConduit>().powerAmount;
                            FileBasedPrefs.SetString(worldID + "inputID", inputID);
                            FileBasedPrefs.SetString(worldID + "outputID1", outputID1);
                            FileBasedPrefs.SetString(worldID + "outputID2", outputID2);
                            FileBasedPrefs.SetBool(worldID + "dualOutput", dualOutput);
                            FileBasedPrefs.SetInt(worldID + "range", range);
                            FileBasedPrefs.SetBool(worldID + "falling", go.GetComponent <PhysicsHandler>().falling);
                            FileBasedPrefs.SetBool(worldID + "fallingStack", go.GetComponent <PhysicsHandler>().fallingStack);
                        }
                    }
                    if (go.GetComponent <AlloySmelter>() != null)
                    {
                        objectName = stateManager.worldName + "AlloySmelter";
                        worldID    = go.GetComponent <AlloySmelter>().ID;
                        if (worldID != "unassigned" && worldID != "")
                        {
                            objectID = int.Parse(worldID.Substring(objectName.Length));
                            machineIdList.Add(objectID);
                            string inputID1     = go.GetComponent <AlloySmelter>().inputID1;
                            string inputID2     = go.GetComponent <AlloySmelter>().inputID2;
                            string inputType1   = go.GetComponent <AlloySmelter>().inputType1;
                            string inputType2   = go.GetComponent <AlloySmelter>().inputType2;
                            string outputType   = go.GetComponent <AlloySmelter>().outputType;
                            string outputID     = go.GetComponent <AlloySmelter>().outputID;
                            int    speed        = go.GetComponent <AlloySmelter>().speed;
                            float  amount       = go.GetComponent <AlloySmelter>().amount;
                            float  amount2      = go.GetComponent <AlloySmelter>().amount2;
                            float  outputAmount = go.GetComponent <AlloySmelter>().outputAmount;
                            FileBasedPrefs.SetString(worldID + "inputID1", inputID1);
                            FileBasedPrefs.SetString(worldID + "inputID2", inputID2);
                            FileBasedPrefs.SetString(worldID + "inputType1", inputType1);
                            FileBasedPrefs.SetString(worldID + "inputType2", inputType2);
                            FileBasedPrefs.SetString(worldID + "outputType", outputType);
                            FileBasedPrefs.SetString(worldID + "outputID", outputID);
                            FileBasedPrefs.SetInt(worldID + "speed", speed);
                            FileBasedPrefs.SetFloat(worldID + "amount", amount);
                            FileBasedPrefs.SetFloat(worldID + "amount2", amount2);
                            FileBasedPrefs.SetFloat(worldID + "amount", outputAmount);
                            FileBasedPrefs.SetBool(worldID + "falling", go.GetComponent <PhysicsHandler>().falling);
                            FileBasedPrefs.SetBool(worldID + "fallingStack", go.GetComponent <PhysicsHandler>().fallingStack);
                        }
                    }
                    if (go.GetComponent <Press>() != null)
                    {
                        objectName = stateManager.worldName + "Press";
                        worldID    = go.GetComponent <Press>().ID;
                        if (worldID != "unassigned" && worldID != "")
                        {
                            objectID = int.Parse(worldID.Substring(objectName.Length));
                            machineIdList.Add(objectID);
                            string inputID    = go.GetComponent <Press>().inputID;
                            string inputType  = go.GetComponent <Press>().inputType;
                            string outputType = go.GetComponent <Press>().outputType;
                            string outputID   = go.GetComponent <Press>().outputID;
                            int    speed      = go.GetComponent <Press>().speed;
                            float  amount     = go.GetComponent <Press>().amount;
                            FileBasedPrefs.SetString(worldID + "inputID", inputID);
                            FileBasedPrefs.SetString(worldID + "inputType", inputType);
                            FileBasedPrefs.SetString(worldID + "outputType", outputType);
                            FileBasedPrefs.SetString(worldID + "outputID", outputID);
                            FileBasedPrefs.SetInt(worldID + "speed", speed);
                            FileBasedPrefs.SetFloat(worldID + "amount", amount);
                            FileBasedPrefs.SetBool(worldID + "falling", go.GetComponent <PhysicsHandler>().falling);
                            FileBasedPrefs.SetBool(worldID + "fallingStack", go.GetComponent <PhysicsHandler>().fallingStack);
                        }
                    }
                    if (go.GetComponent <Extruder>() != null)
                    {
                        objectName = stateManager.worldName + "Extruder";
                        worldID    = go.GetComponent <Extruder>().ID;
                        if (worldID != "unassigned" && worldID != "")
                        {
                            objectID = int.Parse(worldID.Substring(objectName.Length));
                            machineIdList.Add(objectID);
                            string inputID    = go.GetComponent <Extruder>().inputID;
                            string inputType  = go.GetComponent <Extruder>().inputType;
                            string outputType = go.GetComponent <Extruder>().outputType;
                            string outputID   = go.GetComponent <Extruder>().outputID;
                            int    speed      = go.GetComponent <Extruder>().speed;
                            float  amount     = go.GetComponent <Extruder>().amount;
                            FileBasedPrefs.SetString(worldID + "inputID", inputID);
                            FileBasedPrefs.SetString(worldID + "inputType", inputType);
                            FileBasedPrefs.SetString(worldID + "outputType", outputType);
                            FileBasedPrefs.SetString(worldID + "outputID", outputID);
                            FileBasedPrefs.SetInt(worldID + "speed", speed);
                            FileBasedPrefs.SetFloat(worldID + "amount", amount);
                            FileBasedPrefs.SetBool(worldID + "falling", go.GetComponent <PhysicsHandler>().falling);
                            FileBasedPrefs.SetBool(worldID + "fallingStack", go.GetComponent <PhysicsHandler>().fallingStack);
                        }
                    }
                    if (go.GetComponent <GearCutter>() != null)
                    {
                        objectName = stateManager.worldName + "GearCutter";
                        worldID    = go.GetComponent <GearCutter>().ID;
                        if (worldID != "unassigned" && worldID != "")
                        {
                            objectID = int.Parse(worldID.Substring(objectName.Length));
                            machineIdList.Add(objectID);
                            string inputID    = go.GetComponent <GearCutter>().inputID;
                            string inputType  = go.GetComponent <GearCutter>().inputType;
                            string outputType = go.GetComponent <GearCutter>().outputType;
                            string outputID   = go.GetComponent <GearCutter>().outputID;
                            int    speed      = go.GetComponent <GearCutter>().speed;
                            float  amount     = go.GetComponent <GearCutter>().amount;
                            FileBasedPrefs.SetString(worldID + "inputID", inputID);
                            FileBasedPrefs.SetString(worldID + "inputType", inputType);
                            FileBasedPrefs.SetString(worldID + "outputType", outputType);
                            FileBasedPrefs.SetString(worldID + "outputID", outputID);
                            FileBasedPrefs.SetInt(worldID + "speed", speed);
                            FileBasedPrefs.SetFloat(worldID + "amount", amount);
                            FileBasedPrefs.SetBool(worldID + "falling", go.GetComponent <PhysicsHandler>().falling);
                            FileBasedPrefs.SetBool(worldID + "fallingStack", go.GetComponent <PhysicsHandler>().fallingStack);
                        }
                    }
                    if (go.GetComponent <UniversalExtractor>() != null)
                    {
                        objectName = stateManager.worldName + "UniversalExtractor";
                        worldID    = go.GetComponent <UniversalExtractor>().ID;
                        if (worldID != "unassigned" && worldID != "")
                        {
                            objectID = int.Parse(worldID.Substring(objectName.Length));
                            machineIdList.Add(objectID);
                            int    speed  = go.GetComponent <UniversalExtractor>().speed;
                            float  amount = go.GetComponent <UniversalExtractor>().amount;
                            string type   = go.GetComponent <UniversalExtractor>().type;
                            FileBasedPrefs.SetInt(worldID + "speed", speed);
                            FileBasedPrefs.SetFloat(worldID + "amount", amount);
                            FileBasedPrefs.SetString(worldID + "type", type);
                            FileBasedPrefs.SetBool(worldID + "falling", go.GetComponent <PhysicsHandler>().falling);
                            FileBasedPrefs.SetBool(worldID + "fallingStack", go.GetComponent <PhysicsHandler>().fallingStack);
                        }
                    }
                    if (stateManager.IsStorageContainer(go))
                    {
                        objectName = stateManager.worldName + "StorageContainer";
                        worldID    = go.GetComponent <InventoryManager>().ID;
                        if (worldID != "unassigned" && worldID != "")
                        {
                            objectID = int.Parse(worldID.Substring(objectName.Length));
                            machineIdList.Add(objectID);
                            go.GetComponent <InventoryManager>().SaveData();
                            FileBasedPrefs.SetBool(worldID + "falling", go.GetComponent <PhysicsHandler>().falling);
                            FileBasedPrefs.SetBool(worldID + "fallingStack", go.GetComponent <PhysicsHandler>().fallingStack);
                        }
                    }
                    if (go.GetComponent <StorageComputer>() != null)
                    {
                        objectName = stateManager.worldName + "StorageComputer";
                        worldID    = go.GetComponent <StorageComputer>().ID;
                        if (worldID != "unassigned" && worldID != "")
                        {
                            objectID = int.Parse(worldID.Substring(objectName.Length));
                            machineIdList.Add(objectID);
                            FileBasedPrefs.SetBool(worldID + "falling", go.GetComponent <PhysicsHandler>().falling);
                            FileBasedPrefs.SetBool(worldID + "fallingStack", go.GetComponent <PhysicsHandler>().fallingStack);
                        }
                    }
                    if (go.GetComponent <Door>() != null)
                    {
                        if (go.GetComponent <Door>().type == "Door")
                        {
                            objectName = stateManager.worldName + "Door";
                        }
                        else if (go.GetComponent <Door>().type == "Quantum Hatchway")
                        {
                            Debug.Log("Saving hatch");
                            objectName = stateManager.worldName + "QuantumHatchway";
                        }
                        worldID = go.GetComponent <Door>().ID;
                        if (worldID != "unassigned" && worldID != "")
                        {
                            objectID = int.Parse(worldID.Substring(objectName.Length));
                            machineIdList.Add(objectID);
                            int    audioClip = go.GetComponent <Door>().audioClip;
                            int    texture   = go.GetComponent <Door>().textureIndex;
                            string material  = go.GetComponent <Door>().material;
                            bool   edited    = go.GetComponent <Door>().edited;
                            FileBasedPrefs.SetInt(worldID + "audioClip", audioClip);
                            FileBasedPrefs.SetInt(worldID + "texture", texture);
                            FileBasedPrefs.SetString(worldID + "material", material);
                            FileBasedPrefs.SetBool(worldID + "edited", edited);
                            FileBasedPrefs.SetBool(worldID + "falling", go.GetComponent <PhysicsHandler>().falling);
                            FileBasedPrefs.SetBool(worldID + "fallingStack", go.GetComponent <PhysicsHandler>().fallingStack);
                        }
                    }
                    if (go.GetComponent <ModMachine>() != null)
                    {
                        objectName = stateManager.worldName + "ModMachine";
                        worldID    = go.GetComponent <ModMachine>().ID;
                        if (worldID != "unassigned" && worldID != "")
                        {
                            objectID = int.Parse(worldID.Substring(objectName.Length));
                            machineIdList.Add(objectID);
                            int    speed       = go.GetComponent <ModMachine>().speed;
                            float  amount      = go.GetComponent <ModMachine>().amount;
                            string machineName = go.GetComponent <ModMachine>().machineName;
                            string inputID     = go.GetComponent <ModMachine>().inputID;
                            string outputID    = go.GetComponent <ModMachine>().outputID;
                            string inputType   = go.GetComponent <ModMachine>().inputType;
                            string outputType  = go.GetComponent <ModMachine>().outputType;
                            FileBasedPrefs.SetString(worldID + "machineName", machineName);
                            FileBasedPrefs.SetString(worldID + "inputID", inputID);
                            FileBasedPrefs.SetString(worldID + "outputID", outputID);
                            FileBasedPrefs.SetString(worldID + "inputType", inputType);
                            FileBasedPrefs.SetString(worldID + "outputType", outputType);
                            FileBasedPrefs.SetInt(worldID + "speed", speed);
                            FileBasedPrefs.SetFloat(worldID + "amount", amount);
                            FileBasedPrefs.SetBool(worldID + "falling", go.GetComponent <PhysicsHandler>().falling);
                            FileBasedPrefs.SetBool(worldID + "fallingStack", go.GetComponent <PhysicsHandler>().fallingStack);
                        }
                    }
                    if (go.GetComponent <ProtectionBlock>() != null)
                    {
                        worldID = go.GetComponent <ProtectionBlock>().ID;
                        List <string> userNames = go.GetComponent <ProtectionBlock>().GetUserNames();
                        if (worldID != "unassigned" && worldID != "" && userNames != null)
                        {
                            PlayerPrefsX.SetStringArray(worldID + "userNames", userNames.ToArray());
                            FileBasedPrefs.SetBool(worldID + "falling", go.GetComponent <PhysicsHandler>().falling);
                            FileBasedPrefs.SetBool(worldID + "fallingStack", go.GetComponent <PhysicsHandler>().fallingStack);
                            objectName = stateManager.worldName + "ProtectionBlock";
                            objectID   = int.Parse(worldID.Substring(objectName.Length));
                            machineIdList.Add(objectID);
                        }
                    }

                    FileBasedPrefs.SetString(stateManager.worldName + "machine" + objectID + "Name", objectName);
                    PlayerPrefsX.SetVector3(stateManager.worldName + "machine" + objectID + "Position", objectPosition);
                    PlayerPrefsX.SetQuaternion(stateManager.worldName + "machine" + objectID + "Rotation", objectRotation);

                    currentObject++;
                    saveInterval++;
                    if (saveInterval >= totalObjects * 0.05f)
                    {
                        yield return(null);

                        saveInterval = 0;
                    }
                }
            }
        }

        foreach (Transform T in blocks)
        {
            if (T != null)
            {
                Vector3    objectPosition = T.position;
                Quaternion objectRotation = T.rotation;
                if (T.gameObject.GetComponent <IronBlock>() != null)
                {
                    if (T.gameObject.name.Equals("IronRamp(Clone)"))
                    {
                        objectName = stateManager.worldName + "IronRamp";
                    }
                    else
                    {
                        objectName = stateManager.worldName + "IronBlock";
                    }
                    worldID = T.gameObject.GetComponent <IronBlock>().ID;
                    if (worldID != "unassigned" && worldID != "")
                    {
                        objectID = int.Parse(worldID.Substring(objectName.Length));
                        blockIdList.Add(objectID);
                        FileBasedPrefs.SetString(stateManager.worldName + "block" + objectID + "Name", objectName);
                        PlayerPrefsX.SetVector3(stateManager.worldName + "block" + objectID + "Position", objectPosition);
                        PlayerPrefsX.SetQuaternion(stateManager.worldName + "block" + objectID + "Rotation", objectRotation);
                        FileBasedPrefs.SetBool(worldID + "falling", T.gameObject.GetComponent <PhysicsHandler>().falling);
                        FileBasedPrefs.SetBool(worldID + "fallingStack", T.gameObject.GetComponent <PhysicsHandler>().fallingStack);
                    }
                }
                if (T.gameObject.GetComponent <Steel>() != null)
                {
                    if (T.gameObject.name.Equals("SteelRamp(Clone)"))
                    {
                        objectName = stateManager.worldName + "SteelRamp";
                    }
                    else
                    {
                        objectName = stateManager.worldName + "Steel";
                    }
                    worldID = T.gameObject.GetComponent <Steel>().ID;
                    if (worldID != "unassigned" && worldID != "")
                    {
                        objectID = int.Parse(worldID.Substring(objectName.Length));
                        blockIdList.Add(objectID);
                        FileBasedPrefs.SetString(stateManager.worldName + "block" + objectID + "Name", objectName);
                        PlayerPrefsX.SetVector3(stateManager.worldName + "block" + objectID + "Position", objectPosition);
                        PlayerPrefsX.SetQuaternion(stateManager.worldName + "block" + objectID + "Rotation", objectRotation);
                        FileBasedPrefs.SetBool(worldID + "falling", T.gameObject.GetComponent <PhysicsHandler>().falling);
                        FileBasedPrefs.SetBool(worldID + "fallingStack", T.gameObject.GetComponent <PhysicsHandler>().fallingStack);
                    }
                }
                if (T.gameObject.GetComponent <Brick>() != null)
                {
                    objectName = stateManager.worldName + "Brick";
                    worldID    = T.gameObject.GetComponent <Brick>().ID;
                    if (worldID != "unassigned" && worldID != "")
                    {
                        objectID = int.Parse(worldID.Substring(objectName.Length));
                        blockIdList.Add(objectID);
                        FileBasedPrefs.SetString(stateManager.worldName + "block" + objectID + "Name", objectName);
                        PlayerPrefsX.SetVector3(stateManager.worldName + "block" + objectID + "Position", objectPosition);
                        PlayerPrefsX.SetQuaternion(stateManager.worldName + "block" + objectID + "Rotation", objectRotation);
                        FileBasedPrefs.SetBool(worldID + "falling", T.gameObject.GetComponent <PhysicsHandler>().falling);
                        FileBasedPrefs.SetBool(worldID + "fallingStack", T.gameObject.GetComponent <PhysicsHandler>().fallingStack);
                    }
                }
                if (T.gameObject.GetComponent <Glass>() != null)
                {
                    objectName = stateManager.worldName + "Glass";
                    worldID    = T.gameObject.GetComponent <Glass>().ID;
                    if (worldID != "unassigned" && worldID != "")
                    {
                        objectID = int.Parse(worldID.Substring(objectName.Length));
                        blockIdList.Add(objectID);
                        FileBasedPrefs.SetString(stateManager.worldName + "block" + objectID + "Name", objectName);
                        PlayerPrefsX.SetVector3(stateManager.worldName + "block" + objectID + "Position", objectPosition);
                        PlayerPrefsX.SetQuaternion(stateManager.worldName + "block" + objectID + "Rotation", objectRotation);
                        FileBasedPrefs.SetBool(worldID + "falling", T.gameObject.GetComponent <PhysicsHandler>().falling);
                        FileBasedPrefs.SetBool(worldID + "fallingStack", T.gameObject.GetComponent <PhysicsHandler>().fallingStack);
                    }
                }
                if (T.gameObject.GetComponent <ModBlock>() != null)
                {
                    objectName = stateManager.worldName + "ModBlock";
                    worldID    = T.gameObject.GetComponent <ModBlock>().ID;
                    if (worldID != "unassigned" && worldID != "")
                    {
                        objectID = int.Parse(worldID.Substring(objectName.Length));
                        blockIdList.Add(objectID);
                        string blockName = T.gameObject.GetComponent <ModBlock>().blockName;
                        FileBasedPrefs.SetString(worldID + "blockName", blockName);
                        FileBasedPrefs.SetString(stateManager.worldName + "block" + objectID + "Name", objectName);
                        PlayerPrefsX.SetVector3(stateManager.worldName + "block" + objectID + "Position", objectPosition);
                        PlayerPrefsX.SetQuaternion(stateManager.worldName + "block" + objectID + "Rotation", objectRotation);
                        FileBasedPrefs.SetBool(worldID + "falling", T.gameObject.GetComponent <PhysicsHandler>().falling);
                        FileBasedPrefs.SetBool(worldID + "fallingStack", T.gameObject.GetComponent <PhysicsHandler>().fallingStack);
                    }
                }

                currentObject++;
                saveInterval++;
                if (saveInterval >= totalObjects * 0.05f)
                {
                    yield return(null);

                    saveInterval = 0;
                }
            }
        }

        foreach (MeshPainter painter in meshPainters)
        {
            painter.SaveData();
            currentObject++;
            saveInterval++;
            if (saveInterval >= totalObjects * 0.05f)
            {
                yield return(null);

                saveInterval = 0;
            }
        }

        if (machineIdList.Count > 0)
        {
            PlayerPrefsX.SetIntArray(stateManager.worldName + "machineIdList", machineIdList.ToArray());
        }

        if (blockIdList.Count > 0)
        {
            PlayerPrefsX.SetIntArray(stateManager.worldName + "blockIdList", blockIdList.ToArray());
        }

        FileBasedPrefs.ManuallySave();
        stateManager.dataSaved = true;
        stateManager.saving    = false;
        currentObject          = 0;
        totalObjects           = 0;
    }
 public static string[] getProtectedCardsID()
 {
     return(PlayerPrefsX.GetStringArray(KEY_CARD_PROTECT + Obj_MyselfPlayer.GetMe().accountID));
 }
示例#12
0
 public static void UpdateHighscore(int[] highscore, string[] highscoreNames)
 {
     PlayerPrefsX.SetIntArray(highScorePrefsName, highscore);
     PlayerPrefsX.SetStringArray(HighscoreNamePrefs, highscoreNames);
 }
示例#13
0
 public static string[] GetHighScoreNames()
 {
     string[] highScorenames = PlayerPrefsX.GetStringArray(HighscoreNamePrefs, "", numHighscores);
     return(highScorenames);
 }
示例#14
0
 public static int[] GetHighScores()
 {
     int[] highScores = PlayerPrefsX.GetIntArray(highScorePrefsName, 0, numHighscores);
     return(highScores);
 }
示例#15
0
    // Update is called once per frame
    public void unlock()
    {
        if (number == 1)
        {
            Debug.Log("1");

            if (redShip == false)
            {
                PlayerPrefsX.SetBool("TheRedShipT", true);
                StartCoroutine("lockGO");
            }
            if (redShip == true)
            {
                Text.SetActive(true);
                Texts.SetActive(true);
                Panel.SetActive(true);
                Panl.SetActive(true);
            }
        }
        else if (number == 2)
        {
            Debug.Log("2");

            if (blueShip == false)
            {
                PlayerPrefsX.SetBool("TheBlueShipT", true);
                StartCoroutine("lockGO");
            }
            if (blueShip == true)
            {
                Text.SetActive(true);
                Texts.SetActive(true);
                Panel.SetActive(true);
                Panl.SetActive(true);
            }
        }
        else if (number == 3)
        {
            Debug.Log("3");

            if (pinkShip == false)
            {
                PlayerPrefsX.SetBool("ThePinkShipT", true);
                StartCoroutine("lockGO");
            }
            if (pinkShip == true)
            {
                Text.SetActive(true);
                Texts.SetActive(true);
                Panel.SetActive(true);
                Panl.SetActive(true);
            }
        }
        else if (number == 4)
        {
            Debug.Log("4");

            if (yellowShip == false)
            {
                PlayerPrefsX.SetBool("TheYellowShipT", true);
                StartCoroutine("lockGO");
            }
            if (yellowShip == true)
            {
                Text.SetActive(true);
                Texts.SetActive(true);
                Panel.SetActive(true);
                Panl.SetActive(true);
            }
        }
        else if (number == 5)
        {
            Debug.Log("5");

            if (greenShip == false)
            {
                PlayerPrefsX.SetBool("TheGreenShipT", true);
                StartCoroutine("lockGO");
            }
            if (greenShip == true)
            {
                Text.SetActive(true);
                Texts.SetActive(true);
                Panel.SetActive(true);
                Panl.SetActive(true);
            }
        }
        else if (number == 6)
        {
            Debug.Log("6");

            if (greenFire == false)
            {
                PlayerPrefsX.SetBool("TheGreenFireT", true);
                StartCoroutine("lockGO");
            }
            if (greenFire == true)
            {
                Text.SetActive(true);
                Texts.SetActive(true);
                Panel.SetActive(true);
                Panl.SetActive(true);
            }
        }
        else if (number == 7)
        {
            Debug.Log("7");

            if (blueFire == false)
            {
                PlayerPrefsX.SetBool("TheBlueFireT", true);
                StartCoroutine("lockGO");
            }
            if (blueFire == true)
            {
                Text.SetActive(true);
                Texts.SetActive(true);
                Panel.SetActive(true);
                Panl.SetActive(true);
            }
        }
        else if (number == 8)
        {
            Debug.Log("8");

            if (redFire == false)
            {
                PlayerPrefsX.SetBool("TheRedFireT", true);
                StartCoroutine("lockGO");
            }
            if (redFire == true)
            {
                Text.SetActive(true);
                Texts.SetActive(true);
                Panel.SetActive(true);
                Panl.SetActive(true);
            }
        }
        else if (number == 9)
        {
            Debug.Log("9");

            if (yellowFire == false)
            {
                PlayerPrefsX.SetBool("TheYellowFireT", true);
                StartCoroutine("lockGO");
            }
            if (yellowFire == true)
            {
                Text.SetActive(true);
                Texts.SetActive(true);
                Panel.SetActive(true);
                Panl.SetActive(true);
            }
        }
        else if (number == 10)
        {
            Debug.Log("10");

            if (pinkFire == false)
            {
                PlayerPrefsX.SetBool("ThePinkFireT", true);
                StartCoroutine("lockGO");
            }
            if (pinkFire == true)
            {
                Text.SetActive(true);
                Texts.SetActive(true);
                Panel.SetActive(true);
                Panl.SetActive(true);
            }
        }
        else if (number == 11)
        {
            Text.SetActive(true);
            Texts.SetActive(true);
            Panel.SetActive(true);
            Panl.SetActive(true);
        }
    }
示例#16
0
 private void Update()
 {
     currentLevelNS             = GlobalValues.currentLevel;
     currentMaxLevelNS          = GlobalValues.currentMaxLevel;
     currentScreenNS            = GlobalValues.currentScreen;
     totalLevelCountNS          = GlobalValues.totalLevelCount;
     gameModeNS                 = GlobalValues.gameMode;
     recordedTimesNS            = GlobalValues.recordedTimes;
     topRecordedTimesNS         = GlobalValues.topRecordedTimes;
     timedLevelsBeatNS          = GlobalValues.timedLevelsBeat;
     GlobalValues.timesToBeatPS = timesToBeatP;
     if (GlobalValues.currentMaxLevel > PlayerPrefs.GetInt("Levels Completed"))
     {
         PlayerPrefs.SetInt("Levels Completed", GlobalValues.currentMaxLevel);
     }
     if (GlobalValues.mainLevelsCompleted > PlayerPrefs.GetInt("Main Levels Completed"))
     {
         PlayerPrefs.SetInt("Main Levels Completed", GlobalValues.mainLevelsCompleted);
     }
     if (GlobalValues.mainLevelsCompleted == 1 && GlobalValues.hasDisplayedWin1 == 0)
     {
         PlayerPrefs.SetInt("Has Displayed Win Message", 1);
     }
     if (GlobalValues.currentScreen == 4)
     {
         if (GlobalValues.gameMode == 2 && GlobalValues.recordNewTopTime)
         {
             if (!GlobalValues.forceRecord)
             {
                 if (GlobalValues.recordedTimes[GlobalValues.currentLevel - 1] < GlobalValues.topRecordedTimes[GlobalValues.currentLevel - 1])
                 {
                     GlobalValues.topRecordedTimes[GlobalValues.currentLevel - 2] = GlobalValues.recordedTimes[GlobalValues.currentLevel - 2];
                     topRecordedTimesNS[GlobalValues.currentLevel - 2]            = GlobalValues.recordedTimes[GlobalValues.currentLevel - 2];
                     PlayerPrefsX.SetFloatArray("Top Recorded Times", GlobalValues.topRecordedTimes);
                 }
                 if (GlobalValues.recordedTimes[GlobalValues.currentLevel - 1] < timesToBeatP[GlobalValues.currentLevel - 1])
                 {
                     GlobalValues.timedLevelsBeat[GlobalValues.currentLevel - 2] = true;
                     PlayerPrefsX.SetBoolArray("Completed Timed Levels", GlobalValues.timedLevelsBeat);
                 }
             }
             GlobalValues.recordNewTopTime = false;
         }
         if (GlobalValues.recordTimedLevelBeat)
         {
             GlobalValues.recordTimedLevelBeat = false;
         }
     }
     if (GlobalValues.forceRecord)
     {
         if (GlobalValues.recordedTimes[GlobalValues.currentLevel - 1] < GlobalValues.topRecordedTimes[GlobalValues.currentLevel - 1])
         {
             GlobalValues.topRecordedTimes[GlobalValues.currentLevel - 1] = GlobalValues.recordedTimes[GlobalValues.currentLevel - 1];
             topRecordedTimesNS[GlobalValues.currentLevel - 1]            = GlobalValues.recordedTimes[GlobalValues.currentLevel - 1];
             PlayerPrefsX.SetFloatArray("Top Recorded Times", GlobalValues.topRecordedTimes);
         }
         if (GlobalValues.recordedTimes[GlobalValues.currentLevel - 1] < timesToBeatP[GlobalValues.currentLevel - 1])
         {
             GlobalValues.timedLevelsBeat[GlobalValues.currentLevel - 1] = true;
             PlayerPrefsX.SetBoolArray("Completed Timed Levels", GlobalValues.timedLevelsBeat);
         }
         GlobalValues.forceRecord = false;
     }
     if (GlobalValues.clearTimes)
     {
         ClearTimes();
         GlobalValues.clearTimes = false;
     }
 }
示例#17
0
 // Use this for initialization
 void Start()
 {
     PlayerPrefsX.SetBool("sendOnServer", true);
 }
示例#18
0
 public void savePreferences()
 {
     PlayerPrefsX.SetBool("VocAlpha", vocabularyAlphabet.isOn);
     PlayerPrefsX.SetBool("VocFrench", vocabularyFrench.isOn);
     PlayerPrefsX.SetBool("VocEnglish", vocabularyEnglish.isOn);
 }
示例#19
0
    public static void getDifficultyRatios()
    {
        for (int i = 0; i < mapTextureHeight / pixelRange; i++)
        {
            difficultyValues[i] = PlayerPrefsX.GetIntArray(prefName + i);
            for (int j = 0; j < mapTextureWidth / pixelRange; j++)
            {
                if (difficultyValues[i][j] == 0)
                {
                    yellowCount++;
                }
                else if (difficultyValues[i][j] == 1)
                {
                    greenCount++;
                }
                else if (difficultyValues[i][j] == 2)
                {
                    cyanCount++;
                }
                else if (difficultyValues[i][j] == 3)
                {
                    blueCount++;
                }
                else if (difficultyValues[i][j] >= 4)
                {
                    redCount++;
                }
            }
        }
        redRatio     = redCount / ((mapTextureWidth / pixelRange) * (mapTextureHeight / pixelRange)) * 100;
        blueRatio    = blueCount / ((mapTextureWidth / pixelRange) * (mapTextureHeight / pixelRange)) * 100;
        cyanRatio    = cyanCount / ((mapTextureWidth / pixelRange) * (mapTextureHeight / pixelRange)) * 100;
        greenRatio   = greenCount / ((mapTextureWidth / pixelRange) * (mapTextureHeight / pixelRange)) * 100;
        yellowRatio  = yellowCount / ((mapTextureWidth / pixelRange) * (mapTextureHeight / pixelRange)) * 100;
        ratioList[0] = redRatio;
        ratioList[1] = blueRatio;
        ratioList[2] = cyanRatio;
        ratioList[3] = greenRatio;
        ratioList[4] = yellowRatio;
        tempRatio    = redRatio;
        for (int i = 0; i < ratioList.Length; i++)
        {
            if (ratioList[i] >= tempRatio)
            {
                tempRatio = ratioList[i];
            }
        }
        if (tempRatio == redRatio)
        {
            mostAvailableArea = "Red";
        }
        else if (tempRatio == blueRatio)
        {
            mostAvailableArea = "Blue";
        }
        else if (tempRatio == cyanRatio)
        {
            mostAvailableArea = "Cyan";
        }
        else if (tempRatio == greenRatio)
        {
            mostAvailableArea = "Green";
        }
        else if (tempRatio == yellowRatio)
        {
            mostAvailableArea = "Yellow";
        }

        redCount    = 0;
        blueCount   = 0;
        cyanCount   = 0;
        greenCount  = 0;
        yellowCount = 0;
    }
示例#20
0
 public void readPreferences()
 {
     vocabularyAlphabet.isOn = PlayerPrefsX.GetBool("VocAlpha", vocabularyAlphabet.isOn);
     vocabularyFrench.isOn   = PlayerPrefsX.GetBool("VocFrench", vocabularyFrench.isOn);
     vocabularyEnglish.isOn  = PlayerPrefsX.GetBool("VocEnglish", vocabularyEnglish.isOn);
 }
示例#21
0
    // Use this for initialization
    void Start()
    {
        Easy_complete_count = PlayerPrefs.GetInt("SudokuCompleteEasy");
        //Debug.Log(Easy_complete_count);
        Medium_complete_count = PlayerPrefs.GetInt("SudokuCompleteMedium");
        Hard_complete_count   = PlayerPrefs.GetInt("SudokuCompleteHard");
        Total_complete_count  = PlayerPrefs.GetInt("SudokuCompleteTotal", Easy_complete_count + Medium_complete_count + Hard_complete_count);

        Easy_complete_sec = PlayerPrefs.GetFloat("SudokuSecEasy");
        //Debug.Log(Easy_complete_count);
        Medium_complete_sec = PlayerPrefs.GetFloat("SudokuSecMedium");
        Hard_complete_sec   = PlayerPrefs.GetFloat("SudokuSecHard");
        Total_complete_sec  = PlayerPrefs.GetFloat("SudokuSecTotal", Easy_complete_sec + Medium_complete_sec + Hard_complete_sec);

        //game started
        if (PlayerPrefs.GetInt("sudokuContinue", 0) == 1)
        {
            //load previous data
            canChange = new List <List <bool> >();
            solution  = new List <List <int> >();
            for (int i = 0; i < 9; i++)
            {
                canChange.Add(PlayerPrefsX.GetBoolArray("SudokuCanChange" + i.ToString()).ToList());
                solution.Add(PlayerPrefsX.GetIntArray("SudokuSolution" + i.ToString()).ToList());
            }
            //load from local
            loadUserInput();
        }
        else
        {
            //make new one
            canChange = setCanChange(Difficulty.diff);
            solution  = generateSudoku();
            check     = 1;
            second    = 0;
            minute    = 0;
            hour      = 0;
            //save to local
            for (int i = 0; i < 9; i++)
            {
                PlayerPrefsX.SetBoolArray("SudokuCanChange" + i.ToString(), canChange[i].ToArray());
                PlayerPrefsX.SetIntArray("SudokuSolution" + i.ToString(), solution[i].ToArray());
            }
        }
        //draw sudoku based on the information
        int squareIndex = 0;

        for (int i = 0; i < 9; i++)
        {
            for (int j = 0; j < 9; j++)
            {
                all_number_squares[squareIndex].can_change = canChange[i][j];
                if (!canChange[i][j])
                {
                    all_number_squares[squareIndex].gameObject.GetComponent <Image>().color = new Color32(214, 214, 214, 255);
                    all_number_squares[squareIndex].setValue(solution[i][j]);
                }
                squareIndex++;
            }
            Debug.Log("");
        }
        second += Time.deltaTime;
        saveUserInput();
        //PlayerPrefs.SetInt("sudokuContinue", 0);
    }
 public void ZaGraczemKam()
 {
     KameraPodazanie.zmiana_sp_por_kam = true;
     PlayerPrefsX.SetBool("Kam", KameraPodazanie.zmiana_sp_por_kam);
 }
示例#23
0
    public void Start()
    {
        // get levels
        var levels = PlayerPrefsX.GetStringArray("FinishedLevels");

        // loop
        for (var i = 0; i < levels.Length; ++i)
        {
            var level = levels[i];

            // create a row
            var row = Instantiate(TableRowPrefab);

            // set position
            row.transform.Translate(0, -50f * i, 0);

            // parent to me
            row.transform.SetParent(transform, false);

            // get stats
            var name  = level;
            var time  = (int)PlayerPrefs.GetFloat(name + "Time", -1);
            var score = (int)(PlayerPrefs.GetFloat(name + "Score", -1) * 100);

            // create strings
            var timeString = time > 0
                         ? string.Format("{0:D2}:{1:D2}:{2:D2}", time / 3600, (time % 3600) / 60, time % 60)
                         : "";

            var color = "f01f18";
            if (score > 80)
            {
                color = "006c4c";
            }
            else if (score > 50)
            {
                color = "f08b18";
            }

            var scoreString = score > 0 ? string.Format("<color=#{1}>{0} %</color>", score, color) : "<not finished yet>";

            // set texts
            row.transform.GetChild(0).GetComponent <Text>().text = name;
            row.transform.GetChild(1).GetComponent <Text>().text = timeString;
            row.transform.GetChild(2).GetComponent <Text>().text = scoreString;

            // add a button
            var button = row.AddComponent <Button>();

            // find menu manager
            var manager = FindObjectOfType <MenuManager>();

            // set it up
            button.transition = Selectable.Transition.None;
            button.onClick.AddListener(() => manager.Load(name));
        }

        // set height
        var rectTransform = GetComponent <RectTransform>();

        rectTransform.sizeDelta = new Vector2(rectTransform.sizeDelta.x, levels.Length * 50f);
    }
 public void StatycznaKam()
 {
     KameraPodazanie.zmiana_sp_por_kam = false;
     PlayerPrefsX.SetBool("Kam", KameraPodazanie.zmiana_sp_por_kam);
 }
示例#25
0
 public void UnlockAbility()
 {
     PlayerPrefsX.SetBool(abilityName, true);
 }
 public void NieZapisuj()
 {
     Screen.SetResolution(PlayerPrefs.GetInt("rozdzielczoscSzer"), PlayerPrefs.GetInt("rozdzielczoscWys"), PlayerPrefsX.GetBool("FS"), PlayerPrefs.GetInt("RefRat"));
     AudioListener.volume = PlayerPrefs.GetFloat("Glosnosc");
     zapis_opcji.SetActive(false);
     menuInGame.SetActive(true);
     op.SetActive(false);
 }
 public void saveBool(int saveSlot)
 {
     PlayerPrefsX.SetBool("cutscene" + saveNumber + "save" + saveSlot, playedAlready);
 }
    void Update()
    {
        TablicaWynikow     = PlayerPrefsX.GetIntArray("TablicaWynikow");
        TablicaWynikowNick = PlayerPrefsX.GetStringArray("TablicaWynikowNick");

        if (PlayerPrefs.HasKey("ESC"))
        {
            ESCW = (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("ESC"));
        }
        if (PlayerPrefs.HasKey("F1"))
        {
            F1W = (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("F1"));
        }

        if (scena.name != naz)
        {
            if (helpMenu.activeSelf || menuInGameCanvas.enabled || kon.activeSelf)
            {
                Cursor.visible = enabled;
            }
            else
            {
                Cursor.visible = false;
            }

            if (Input.GetKeyDown(ESCW) && helpPocz.activeSelf)
            {
                helpPocz.SetActive(false);
            }
            if (Input.GetKeyDown(ESCW) && !helpMenu.activeSelf && !helpPocz.activeSelf && !kon.activeSelf)
            {
                menuInGame.SetActive(true);
                menuInGameCanvas.enabled = !menuInGameCanvas.enabled;
                if (menuInGameCanvas.enabled)
                {
                    Cursor.visible = enabled;
                }
                else
                {
                    Cursor.visible = false;
                }
            }
            helpMenuUpdate();
        }
        else
        {
            if (PlayerPrefs.GetInt("MozKon") == 1 && PlayerPrefs.GetInt("MozKonWyg") == 1)
            {
                btkon.interactable = true;
            }
            else
            {
                btkon.interactable = false;
            }

            if (PlayerPrefs.GetInt("ostPozTr") == 0)
            {
                btPozTrSr.interactable = false;
                btPozTrTR.interactable = false;
            }
            else if (PlayerPrefs.GetInt("ostPozTr") == 1)
            {
                btPozTrSr.interactable = true;
                btPozTrTR.interactable = false;
            }
            else if (PlayerPrefs.GetInt("ostPozTr") == 2)
            {
                btPozTrSr.interactable = true;
                btPozTrTR.interactable = true;
            }


            timer += Time.deltaTime;

            if (TablicaWynikow[0] == 0 || TablicaWynikowNick[0] == "")
            {
                gotowy_do_czyszcz = false;
            }
            else
            {
                gotowy_do_czyszcz = true;
            }

            if (timer > 0.5f)
            {
                wyczyszczony = false;
            }

            if (gotowy_do_czyszcz == true)
            {
                czysc.interactable = true;
            }
            else
            {
                czysc.interactable = false;
            }

            if (blokada == true)
            {
                rozp.interactable = false;
            }
            else
            {
                rozp.interactable = true;
            }

            if (TablicaWynikow[0] == 0 || TablicaWynikowNick[0] == "")
            {
                btTaWy.interactable = false;
            }
            else
            {
                btTaWy.interactable = true;
            }
        }
    }
示例#29
0
    protected override void Awake()
    {
        base.Awake();

        isSelectLanguageBefore = PlayerPrefsX.GetBool(isSelectLanguageKey, false);
    }
示例#30
0
    //metodo de finalizacao!
    public void FinalizaFase()
    {
        //faz com que o panel da finalizacao fique ativo
        faseFinalizarPanel.SetActive(true);

        theAM.FinalizaFase();

        //coloca o valor da experiencia obtido para o player ver a partir do valor definido aqui
        txtExp.text = expObtida.ToString();

        // coloca o valor do dinheiro que o player tem já somado com que ele pegou na fase!
        txtDinheiro.text = PlayerPrefs.GetInt("Player_Dinheiro").ToString();

        //pega os dados de experiencia para fazer calcula para ver se vai upar!
        int expNecessariaProxLvl = PlayerPrefs.GetInt("Player_Experiencia_Prox_Nivel");

        int expAnterior = PlayerPrefs.GetInt("Player_Experiencia");

        int novaExp = expAnterior + expObtida;


        // armazena o exp obtido para as variaveis de controle global!
        PlayerPrefs.SetInt("Player_Experiencia", novaExp);


        //Pega qual era a quantidade necessaria para upar!
        int expProxLevel = PlayerPrefs.GetInt("Player_Experiencia");

        // se vc alcancou a quantidade necessaria ou ultrapassou, upa!
        if (expProxLevel >= expNecessariaProxLvl)
        {
            //pega os dados de estado do player para receber bonus de level up!
            int proxLvl = PlayerPrefs.GetInt("Player_Nivel");
            int defesa  = PlayerPrefs.GetInt("Player_Defesa");
            int forca   = PlayerPrefs.GetInt("Player_Forca");
            int vida    = PlayerPrefs.GetInt("Player_VidaMaxima");
            int mana    = PlayerPrefs.GetInt("Player_ManaMaxima");

            //soma os valores bonus para o lvl up definidos pelo inspector!
            defesa += defBonus;
            forca  += forcaBonus;
            vida   += vidaBonus;
            mana   += manaBonus;
            expNecessariaProxLvl += (expNecessariaProxLvl * 2);



            //acrescenta um lvl no jogador
            proxLvl += 1;

            //armazena na variavel global o novo lvl e novos status
            PlayerPrefs.SetInt("Player_Nivel", proxLvl);
            PlayerPrefs.SetInt("Player_Defesa", defesa);
            PlayerPrefs.SetInt("Player_Forca", forca);
            PlayerPrefs.SetInt("Player_VidaMaxima", vida);
            PlayerPrefs.SetInt("Player_ManaMaxima", mana);
            PlayerPrefs.SetInt("Player_Experiencia_Prox_Nivel", expNecessariaProxLvl);
        }

        // pega o nivel que o player esta, se ja upou ja vai mostrar o novo nivel!
        txtNivel.text = PlayerPrefs.GetInt("Player_Nivel").ToString();

        //pega as fases do mundo que está jogando!
        int[] mundoNiveis = PlayerPrefsX.GetIntArray(mundo + "Niveis");

        //variavel para saber se acabou as fases do mundo atual!
        bool mundoFinalizado = false;

        // verificacao das fases do mundo!
        for (int i = 0; i < mundoNiveis.Length; i++)
        {
            //a prox fase que estiver com 0 vai ser liberada!
            if (mundoNiveis[i] == 0)
            {
                mundoNiveis[i] = 1;
                PlayerPrefsX.SetIntArray(mundo + "Niveis", mundoNiveis);
                break;
            }
            //se for a ultima interacao do for e nao encontrou 0, quer dizer que nao existem mais fases, logo acabou o mundo!
            if (mundoNiveis[i] == 1 && i == 4)
            {
                mundoFinalizado = true;                 // seta que o mundo acabou!
            }
        }

        if (mundoFinalizado)       //Se verificar que este mundo acabou cria o novo
        {
            int[] novoMundo = { 1, 0, 0, 0, 0 };
            PlayerPrefsX.SetIntArray(proxCena + "Niveis", novoMundo);
        }

        Time.timeScale = 0;

        //mundosLiberados
    }