Exemple #1
0
    public void RemoverSelecaoBotaoFaseDentroStatus()
    {
        if (refUltimoBotaoSel == null &&
            _ultimoBotaoSelID == -1)   //ou seja, realmente nao tem nenhum botao selecionado
        {
            return;
        }
        else
        {
            if (refUltimoBotaoSel != null)
            {
                Btn_Fase     btn     = refUltimoBotaoSel.GetComponent <Btn_Fase>();
                GameObject   obj     = GameObject.Find("Images");
                ImagesScript iscript = obj.GetComponent <ImagesScript>();

                this.spriteUltimoBtnSelecionado.mainTexture = (Texture2D)iscript.imagem[btn.ID];                 // Botao sem seleçao;//spriteUltimoBtnSelecionado.color = corBotaoNSelecionado;//spriteUltimoBtnSelecionado.tintColor = corBotaoNSelecionado;
                ultimoBotaoSelID           = -1;
                refUltimoBotaoSel          = null;
                spriteUltimoBtnSelecionado = null;
                btn.selecionado            = false;
            }
            else//utiliza do ID
            {
                if (Application.loadedLevelName == "Tela_Fases")
                {
                    GameObject[] listGO = GameObject.FindGameObjectsWithTag("Btn");
                    for (int i = 0; i < listGO.Length; i++)
                    {
                        Btn_Fase btn = listGO[i].gameObject.GetComponent <Btn_Fase>(); // Tira a cor do botao atual e adiciona cor ao Tint do outro;

                        if (btn.ID == _ultimoBotaoSelID)                               // Se for o botao correto;
                        {
                            //if (btn.selecionado)
                            {
                                GameObject   obj     = GameObject.Find("Images");
                                ImagesScript iscript = obj.GetComponent <ImagesScript>();

                                this.spriteUltimoBtnSelecionado.mainTexture = (Texture2D)iscript.imagem[btn.ID];                                 // Botao sem seleçao;//spriteUltimoBtnSelecionado.color = corBotaoNSelecionado;//spriteUltimoBtnSelecionado.tintColor = corBotaoNSelecionado;
                                ultimoBotaoSelID           = -1;
                                refUltimoBotaoSel          = null;
                                spriteUltimoBtnSelecionado = null;

                                break;
                            }
                        }
                    }
                }
            }
        }
    }
Exemple #2
0
 // Use this for initialization
 void Start()
 {//Set List to new list
     ulBattleReadyParty = new List <Unit>();
     //Get proper component
     iImageList = GetComponent <ImagesScript>();
     //Enable cGameCanvas
     cGameCanvas.enabled = true;
     //Disable cGeneratePartyCanvas
     cGeneratePartyCanvas.enabled = false;
     //Disable cBattleCanvas
     cBattleCanvas.enabled = false;
     //Disable the bPlayButton
     bPlayButton.enabled = false;
     //Disable the cSavedFilePrompt
     cSavedFilePrompt.enabled = false;
 }
Exemple #3
0
    //Selecao via status
    public void SelecionarBotaoFaseDentroStatus()
    {
        RemoverSelecaoBotaoFaseDentroStatus();

        GameObject[] listGO = GameObject.FindGameObjectsWithTag("Btn");
        for (int i = 0; i < listGO.Length; i++)
        {
            Btn_Fase btn = listGO[i].gameObject.GetComponent <Btn_Fase>();       // Tira a cor do botao atual e adiciona cor ao Tint do outro;
            spriteUltimoBtnSelecionado = listGO[i].gameObject.renderer.material; //.GetComponent<OTSprite>();

            if (btn.ID == this.faseID)                                           // Se for o botao correto;
            {
                GameObject   obj     = GameObject.Find("Images");
                ImagesScript iscript = obj.GetComponent <ImagesScript>();

                this.spriteUltimoBtnSelecionado.mainTexture = (Texture2D)iscript.imagem[btn.ID + 6];                 // E somado 6 pois e a quantidade de posiçoes que devem ser puladas do array de imagens;//this.spriteUltimoBtnSelecionado.mainTexture = (Texture2D)iscript.imagem[7];// Selecionado;
                ultimoBotaoSelID  = btn.ID;
                refUltimoBotaoSel = listGO[i].gameObject;
                btn.selecionado   = true;


                break;
            }
        }


        //SetTempoJogobasedOnFase();

        //atualiza os melhores tempos
        if (refMelhoresTemposS == null)
        {
            refMelhoresTemposS = GameObject.Find("MelhoresTempos").GetComponent <MelhoresTempos>();
        }

        refMelhoresTemposS.TrocouFaseSelecionada();
    }
Exemple #4
0
 // Use this for initialization
 void Start()
 {
     //Set List to new list
     ulBattleReadyParty = new List<Unit>();
     //Get proper component
     iImageList = GetComponent<ImagesScript>();
     //Enable cGameCanvas
     cGameCanvas.enabled = true;
     //Disable cGeneratePartyCanvas
     cGeneratePartyCanvas.enabled = false;
     //Disable cBattleCanvas
     cBattleCanvas.enabled = false;
     //Disable the bPlayButton
     bPlayButton.enabled = false;
     //Disable the cSavedFilePrompt
     cSavedFilePrompt.enabled = false;
 }
Exemple #5
0
    // Camera camera1 = null;
#endif

    // Use this for initialization
    void Start()
    {
#if v1
        fase = new Descritores_MD.Fase();
#endif
#if v2
        //if (camera1 == null)
        //    camera1 = GameObject.Find("Main Camera").GetComponent<Camera>();

        if (refScriptStatus == null)
        {
            refScriptStatus = GameObject.Find("Status").GetComponent <Status>();
        }

        if (refSeuSprite == null)
        {
            refSeuSprite = this.gameObject.renderer.material;            //refSeuSprite = this.GetComponent<OTSprite>();
        }
        if (refMelhoresTempos == null)
        {
            refMelhoresTempos = GameObject.Find("MelhoresTempos").GetComponent <MelhoresTempos>();
        }

        char c = this.gameObject.name[this.gameObject.name.Length - 1];       // Pega a última posição;

        string str = "";
        str    += c;
        this.ID = int.Parse(str);         // Logica funciona de 0 a 9;

        // Carregar informações do nível:
        str  = "lvl";
        str += this.ID;

        if (!jaDefiniuBloqueio)
        {
            int tmp = PlayerPrefs.GetInt((str + "b")); // Todos os levels tem sua chave salva como lvl+ID+info. Ex: lvl1b (Pega o bool para saber se está bloqueado ou não);
            if (tmp == 0)
            {
                if (this.ID != 1)
                {//botao 1 é sempre liberado
                    this.bloqueado    = true;
                    jaDefiniuBloqueio = true;
                }
            }
            else if (tmp == 1)//se nao esta bloqueado
            {
                this.bloqueado    = false;
                jaDefiniuBloqueio = true;
            }

            //LiberarTodasFasesDebug();
        }

        /*else
         *  Debug.LogError("Não foi lida uma das informações de arquivo!");
         */

        //this.tempo = PlayerPrefs.GetFloat((str+"t")); // Retorna o tempo;
        //if(this.tempo <= 0.0f){}// Tempo não exite;

        // Imagens:
        //this.sprite = this.gameObject.GetComponent<OTSprite>();

        this.sprite = this.gameObject.renderer.material;

        if (!selecionado)//Se  o botão nao estiver selecionado, dai tu define a imagem padrao baseado se o botao esta liberado ou nao
        {
            GameObject   obj     = GameObject.Find("Images");
            ImagesScript iscript = obj.GetComponent <ImagesScript>();

            if (this.bloqueado)
            {
                this.sprite.mainTexture = (Texture2D)iscript.imagem[0];
            }
            else//trocar dependente de qual sprite
            {
                //this.sprite.image = iscript.imagem[1];
                this.sprite.mainTexture = (Texture2D)iscript.imagem[this.ID];
            }
        }
#endif
    }