Пример #1
0
    private IEnumerator Hide(bool face = true)
    {
        yield return(new WaitForSeconds(5));

        fader.FadeOut(balloon.gameObject.GetComponent <CanvasGroup>());
        if (face)
        {
            happyFace.SetActive(false);
        }
    }
Пример #2
0
    IEnumerator StartLevel()
    {
        blackOverlay.FadeIn(0.5f);
        HideMenuUI();
        yield return(new WaitForSeconds(0.5f));

        blackOverlay.FadeOut(0.5f);
        GameManager.instance.StartGame(selectedLevel);
        livesText.text = "LIVES: " + GameManager.instance.lives;
    }
    public void Start()
    {
        staticStartId = startId;
        GameObject.FindGameObjectsWithTag("InputHandler")[0].GetComponent <InputHandler>().addObserver(this);

        GameObject levelLoader = Instantiate(LevelLoader);

        _levelLoader = levelLoader.GetComponent <LevelLoader>();
        Invoke("waitABit", 2f);

        loadVideos();
        fader.FadeOut(0.5f);
    }
Пример #4
0
    private void StartClick()
    {
        UIFader fader = movePanel.GetComponent <UIFader>();

        fader.FadeOut();
        fader.OnOffRayCast(false);
    }
Пример #5
0
 private void ShowError(string message)
 {
     error.text    = message;
     error.enabled = true;
     UIFader.CancelCurrent();
     UIFader.FadeIn(error, 0.1f);
     UIFader.FadeOut(error, 3.0f, 1.0f);
 }
Пример #6
0
 public void Deselect()
 {
     if (FlashlightGO.activeSelf && !isReloading)
     {
         StartCoroutine(UIFader.FadeOut(2));
         StartCoroutine(DeselectCorountine());
     }
 }
Пример #7
0
    void Start()
    {
        UIFader.SetColor(FadeImage.color);

        if (startFadeOut)
        {
            StartCoroutine(UIFader.FadeOut(FadeSpeed));
        }
    }
Пример #8
0
    private void ShowSelectedBlock(Block block)
    {
        string name = block.Name();

        selectedText.text = name;

        UIFader.CancelCurrent();

        UIFader.FadeIn(selectedPanel, 0.1f);
        UIFader.FadeIn(selectedText, 0.1f);

        UIFader.FadeOut(selectedPanel, 2.0f, 0.5f);
        UIFader.FadeOut(selectedText, 2.0f, 0.5f);
    }
Пример #9
0
    private void FadeBackground(bool _triger)
    {
        UIFader background = root.GetComponent <UIFader>();

        background.OnOffRayCast(_triger);
        if (_triger)
        {
            background.FadeIn();
        }
        else
        {
            background.FadeOut();
        }
    }
Пример #10
0
    private void FadePreference(bool _triger)
    {
        UIFader fader = preferenceWindow.GetComponent <UIFader>();

        fader.OnOffRayCast(_triger);
        if (_triger)
        {
            fader.FadeIn();
        }
        else
        {
            fader.FadeOut();
        }
    }
Пример #11
0
 public void getBack()
 {
     if (Time.timeScale >= 0.1f)
     {
         if (fader)
         {
             fader.FadeOut(0.2f);
         }
         Destroy(this.gameObject, 0.2f);
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
Пример #12
0
    public void Deselect()
    {
        isSelecting  = false;
        oldIntensity = LanternLight.intensity;

        if (audioS && HideSound)
        {
            audioS.clip   = HideSound;
            audioS.volume = HideVolume;
            audioS.Play();
        }

        if (LanternGO.activeSelf)
        {
            StartCoroutine(UIFader.FadeOut(2));
            StartCoroutine(DeselectCoroutine());
        }
    }
    public void Awake()
    {
        LeanTween.reset();
        LeanTween.init(800);
        startfading.FadeOut();
        Destroy(startfading.gameObject, 0.6f);
        GameObject levelLoader = Instantiate(LevelLoader);

        _levelLoader = levelLoader.GetComponent <LevelLoader>();
        if (levelsContainer && horizontalContainer && levelBubble)
        {
            string          loadedJsonFile = Resources.Load <TextAsset>("levels").text;
            LevelsContainer levelsInJson   = JsonUtility.FromJson <LevelsContainer>(loadedJsonFile);

            //We instanciate the matrix that will contain all the buttons
            uibuttons = new UIButton[(Mathf.Min(levelsInJson.levels.Length, ActualSave.actualSave.NextLevel() + 1) / 4) + 1][];
            for (int i = 0; i < uibuttons.Length; i++)
            {
                uibuttons[i] = new UIButton[4];
            }

            //FIRST LOOP
            GameObject actualContainer = Instantiate(horizontalContainer, levelsContainer.transform);
            firstBubble = Instantiate(levelBubble, actualContainer.transform);
            firstBubble.GetComponent <levelBubbleHandlerScript>().setData(levelsInJson.levels[0], 1);
            int modifier = ((Mathf.Min(ActualSave.actualSave.NextLevel() + 1, levelsInJson.levels.Length) % 4 > 0) ? 1 : 0);

            //Debug.Log("Resultat du calcul : " + Mathf.Min(ActualSave.actualSave.NextLevel() + 1, levelsInJson.levels.Length) % 4);
            levelsContainer.GetComponent <RectTransform>().sizeDelta = new Vector2(700f, ((Mathf.Min(ActualSave.actualSave.NextLevel() + 1, levelsInJson.levels.Length) / 4f + modifier) * 133f + 20f));
            levelsContainer.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, ((Mathf.Min(ActualSave.actualSave.NextLevel() + 1, levelsInJson.levels.Length) / 4f + modifier) * 133f + 20f));

            //We enter the first element in the matrix
            uibuttons[0][0] = firstBubble.GetComponent <levelBubbleHandlerScript>().getButton();



            //THEN ITERATION



            //This will be the row number
            int j = 0;
            for (int i = 1; i < Mathf.Min(levelsInJson.levels.Length, ActualSave.actualSave.NextLevel() + 1); i++)
            {
                if (i % 4 == 0)
                {
                    j++;
                    actualContainer = Instantiate(horizontalContainer, levelsContainer.transform);
                }

                if (i == levelsInJson.levels.Length - 1)
                {
                    //The only thing that changes is that we store it in a global variable
                    lastBubble = Instantiate(levelBubble, actualContainer.transform);
                    lastBubble.GetComponent <levelBubbleHandlerScript>().setData(levelsInJson.levels[i], i + 1);
                    uibuttons[j][i % 4] = lastBubble.GetComponent <levelBubbleHandlerScript>().getButton();
                }
                else
                {
                    GameObject created = Instantiate(levelBubble, actualContainer.transform);
                    created.GetComponent <levelBubbleHandlerScript>().setData(levelsInJson.levels[i], i + 1);
                    uibuttons[j][i % 4] = created.GetComponent <levelBubbleHandlerScript>().getButton();
                }
            }

            //We will now define the navigation of all buttons

            for (j = 0; j < uibuttons.Length; j++)
            {
                for (int i = 0; i < 4; i++)
                {
                    if (uibuttons[j][i])
                    {
                        //Horizontal movement
                        if (i == 0) //Left
                        {
                            if (uibuttons[j][i + 1])
                            {
                                uibuttons[j][i].rightButton = uibuttons[j][i + 1];
                            }
                        }
                        else if (i == 3) //Right
                        {
                            if (uibuttons[j][i - 1])
                            {
                                uibuttons[j][i].leftButton = uibuttons[j][i - 1];
                            }
                            if (ActualSave.actualSave.NextLevel() >= 12)
                            {
                                uibuttons[j][i].rightButton = bar;
                            }
                            else
                            {
                                uibuttons[j][i].rightButton = bar.rightButton;
                            }
                        }
                        else //Center
                        {
                            if (uibuttons[j][i - 1])
                            {
                                uibuttons[j][i].leftButton = uibuttons[j][i - 1];
                            }
                            if (uibuttons[j][i + 1])
                            {
                                uibuttons[j][i].rightButton = uibuttons[j][i + 1];
                            }
                        }

                        //We handle the case of the last button
                        if (j * 4 + i == ActualSave.actualSave.NextLevel() || j * 4 + i == ActualSave.actualSave.NextLevel() - 1)
                        {
                            if (ActualSave.actualSave.NextLevel() >= 12)
                            {
                                uibuttons[j][i].rightButton = bar;
                            }
                            else
                            {
                                uibuttons[j][i].rightButton = bar.rightButton;
                            }
                        }

                        //Vertical movement
                        if (j == 0) //Top
                        {
                            if (j + 1 <= uibuttons.Length - 1)
                            {
                                uibuttons[j][i].downButton = uibuttons[j + 1][i];
                            }
                        }
                        else if (j == uibuttons.Length - 1)//Bottom
                        {
                            if (j - 1 >= 0)
                            {
                                uibuttons[j][i].upButton = uibuttons[j - 1][i];
                            }
                        }
                        else //Center
                        {
                            if (j + 1 <= uibuttons.Length - 1)
                            {
                                uibuttons[j][i].downButton = uibuttons[j + 1][i];
                            }
                            if (j - 1 >= 0)
                            {
                                uibuttons[j][i].upButton = uibuttons[j - 1][i];
                            }
                        }
                    }
                }
            }

            stateMachine.firstSelected = firstBubble.GetComponent <levelBubbleHandlerScript>().getButton();
            stateMachine.firstSelected.changeState(UIButton.SELECTED);
            //events.firstSelectedGameObject = firstBubble.GetComponent<levelBubbleHandlerScript>().getButton();
            size = ActualSave.actualSave.NextLevel() / 4 - 1; /// A REVOIR -----------------------------------------

            initialAnchor = levelsContainer.GetComponent <RectTransform>().anchoredPosition.y;
            if (ActualSave.actualSave.NextLevel() < 12)
            {
                bar.rightButton.leftButton = uibuttons[0][(uibuttons[0][3]) ? 3 : (uibuttons[0][2]) ? 2 : (uibuttons[0][1]) ? 1 : 0];
                bar.isActive = false;
                Destroy(bar.gameObject);
                scrollRect.anchoredPosition = new Vector2(scrollRect.anchoredPosition.x, -scrollRect.sizeDelta.y / 2);
                backButton.leftButton       = (uibuttons[0][3]) ? uibuttons[0][2]: (uibuttons[0][2]) ? uibuttons[0][1] : uibuttons[0][0];
            }
            else
            {
                bar.nbSteps = size + 1;
                bar.size    = (1f / size) * 4f;
                bar.value   = 0;
                bar.Refresh();
            }
        }
    }
Пример #14
0
 public void fadeAgain()
 {
     fader.FadeOut(0.3f);
 }
Пример #15
0
    private IEnumerator FadeOut(float showTimeSecs)
    {
        yield return(new WaitForSeconds(showTimeSecs));

        yield return(uiFader.FadeOut());
    }
Пример #16
0
    IEnumerator Blink()
    {
        yield return(new WaitUntil(() => UIFader.canFadeOut));

        StartCoroutine(UIFader.FadeOut(FadeSpeed));
    }
Пример #17
0
 public void FadeOut()
 {
     UIFader.SetBlinkTime(0);
     StartCoroutine(UIFader.FadeOut(FadeSpeed));
 }
Пример #18
0
 public void HideCanvas()
 {
     StartCoroutine(uiFader.FadeOut());
     canvasGroup.interactable = false;
 }
Пример #19
0
 public void IntialHide()
 {
     uif.FadeOut(0);
 }
Пример #20
0
    IEnumerator DisplayConversation(Conversation convo)
    {
        // Initialize the conversation
        convo.Init();

        // get the current dialogue
        DialogueNode current = convo.current;

        // Safety in case this conversation is empty
        if (!current)
        {
            Debug.LogError("Tried to start empty conversation!");
        }

        ConversationInProgress = true;

        DialogueManager.Instance.SetState(DialogueManager.GameState.Dialogue);

        // Clear text box
        DialogueText.text = "";
        NameText.text     = "";

        // And show it
        Fader.FadeIn();

        // Wait to make sure it's shown
        yield return(new WaitForSeconds(Fader.FadeInTime));

        // while there's still dialogue to be had
        while (current != null)
        {
            // Show the dialogue
            yield return(StartCoroutine(DisplayDialogue(current)));

            // attempt to move to the next node
            if (convo.Next())
            {
                // if we can, set it to current
                current = convo.current;
            }
            else
            {
                // otherwise, the conversation is over
                current = null;

                // hide the text box
                Fader.FadeOut();

                // wait to make sure it's gone
                yield return(new WaitForSeconds(Fader.FadeOutTime));
            }
        }

        ConversationInProgress = false;

        // Dispatch an event saying this conversation is over
        EventDispatcher.Dispatch(ConversationEvent.Prepare(convo, false));

        // Return the game state to gameplay
        DialogueManager.Instance.SetState(DialogueManager.GameState.Gameplay);
    }
Пример #21
0
 public void HideMenuUI()
 {
     mainMenuParent.FadeOut(0);
     levelSelectParent.FadeOut(0);
     logo.FadeOut(0);
 }
 public void FadeOut()
 {
     fader?.FadeOut();
 }