Пример #1
0
    public void mapcodeButtonOnClick()
    {
        if (getMap.isLoading)
        {
            return;
        }

        if (PlayerPrefs.GetInt("uid", -1) == -1)
        {
            Debug.Log("your user data was not found,plase register first of all");
            return;
        }
        if (mapcodeOpened)
        {
            Debug.Log("hello"); return;
        }
        mapcodeOpened = true;
        startTime     = Time.time;
        panel.SetActive(true);
        imageFadeoutTrigger = true;
        mapcodecross.SetActive(true);
        Inputfield.SetActive(true);
        Holdtext.SetActive(true);
        popOutPanel.SetActive(true);
        textFadeTrigger = true;
        cross.SetActive(false);


        //blurEffect.GetComponent<Image>().color = imageColor;

        imageGameObjectList.Add(panel);
        imageStartColorList.Add(panel.GetComponent <Image>().color);
        imageToColorList.Add(mapcodePanel);

        imageGameObjectList.Add(mapcodecross);
        imageStartColorList.Add(cross.GetComponent <Image>().color);
        imageToColorList.Add(new Color(1.0f, 1.0f, 1.0f, 1.0f));

        imageGameObjectList.Add(Inputfield);
        imageStartColorList.Add(Inputfield.GetComponent <Image>().color);
        imageToColorList.Add(new Color(1.0f, 1.0f, 1.0f, 1.0f));

        imageGameObjectList.Add(popOutPanel);
        imageStartColorList.Add(popOutPanel.GetComponent <Image>().color);
        imageToColorList.Add(new Color(194.0f / 255.0f, 89.0f / 255.0f, 98.0f / 255.0f, 1.0f));

        textObject.Add(Holdtext.GetComponent <Text>());
        textStartColorList.Add(Holdtext.GetComponent <Text>().color);
        textToColorList.Add(new Color(1.0f, 1.0f, 1.0f, 1.0f));

        textObject.Add(GameObject.Find("MapcodeInsideText").GetComponent <Text>());
        textStartColorList.Add(GameObject.Find("MapcodeInsideText").GetComponent <Text>().color);
        textToColorList.Add(new Color(1.0f, 1.0f, 1.0f, 1.0f));

        textObject.Add(inputText.GetComponent <Text>());
        textStartColorList.Add(inputText.GetComponent <Text>().color);
        textToColorList.Add(new Color(1.0f, 1.0f, 1.0f, 1.0f));

        //StartCoroutine(GetComponent<popout>().popoutAnimate(.4f, popOutThing));
        StartCoroutine(wait(.41f));
        mapcodecross.GetComponent <Image>().raycastTarget = true;
    }
Пример #2
0
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            GameObject tap = tapEffect;
            tap = Instantiate(tapEffect, tap.transform.position, tap.transform.rotation);
            //子オブジェクトにする
            tap.transform.SetParent(transform);
            tap.transform.position = Input.mousePosition;
            //tap.transform.SetAsFirstSibling();
        }

        if (imageFadeoutTrigger)          //imageのフェード
        //0から1の進度状況を格納
        {
            float param = (Time.time - startTime) / fadeOutTime;

            //もし移動中であれば
            if (param <= 1.0f)
            {
                for (int i = 0; i < imageGameObjectList.Count; i++)
                {
                    //startの色とtoの色をparam:(1-param)に分けたときの色を代入
                    Color updateColor = Color.Lerp(imageStartColorList[i], imageToColorList[i], param);
                    imageGameObjectList[i].GetComponent <Image>().color = updateColor;
                }
            }
            //通り過ぎたら
            else
            {
                for (int i = 0; i < imageGameObjectList.Count; i++)
                {
                    //ゲームオブジェクトの最終的な色を目的の色に合わせる
                    imageGameObjectList[i].GetComponent <Image>().color = imageToColorList[i];
                }
                imageFadeoutTrigger = false;
                imageToColorList.Clear();
                imageGameObjectList.Clear();
                imageStartColorList.Clear();
                if (panelActiveFalse)
                {
                    panel.SetActive(false);
                    panelActiveFalse = false;

                    settingInsideButton.SetActive(false);
                    popOutPanel.SetActive(false);
                }
            }
        }
        if (textFadeTrigger)          //テキストのフェード
        {
            float param = (Time.time - startTime) / fadeOutTime;
            if (param <= 1.0f)
            {
                for (int i = 0; i < textObject.Count; i++)
                {
                    //startの色とtoの色をparam:(1-param)に分けたときの色を代入
                    Color updateColor = Color.Lerp(textStartColorList[i], textToColorList[i], param);
                    textObject[i].color = updateColor;
                }
            }
            else
            {
                for (int i = 0; i < textObject.Count; i++)
                {
                    textObject[i].color = textToColorList[i];
                }
                textFadeTrigger = false;
                textToColorList.Clear();
                textStartColorList.Clear();
                textObject.Clear();
                if (inputActiveFalse)
                {
                    inputActiveFalse = false;
                    Inputfield.SetActive(false);
                    Holdtext.SetActive(false);
                }
            }
        }
    }