Exemplo n.º 1
0
    void OnAnyKeyPress()
    {
        isLoadingEnd = false;

        if (onAnyKeyPressClip)
        {
            AudioManager.Instance.Play(onAnyKeyPressClip);
        }

        LeanTweenEx.ChangeAlpha(pressAnyKeyText, 0.0f, 0.2f).setIgnoreTimeScale(true);

        StartCoroutine(OnKeyPressRoutine());

        IEnumerator OnKeyPressRoutine()
        {
            loader.allowSceneActivation = true;
            yield return(null);

            DisableCanvasGroup();
            yield return(null);

            TransitionManager.Instance.StartTransitonEffectOut();

            sceneId           = -1;
            loader            = null;
            loadingBarRoutine = null;
            enabled           = false;
        }
    }
Exemplo n.º 2
0
    void OnClickOnItem(CraftSO craft)
    {
        selectedCraft = craft;

        inventoryToAddItem.InitInvetory(selectedCraft.results.Length);
        inventoryToRemoveItem.InitInvetory(selectedCraft.ingradients.Length);

        for (int i = 0; i < selectedCraft.results.Length; ++i)
        {
            inventoryToAddItem.SetFilter(i, selectedCraft.results[i].itemSO);
        }

        for (int i = 0; i < selectedCraft.ingradients.Length; ++i)
        {
            inventoryToRemoveItem.SetFilter(i, selectedCraft.ingradients[i].itemSO);
        }

        cgSelectCraft.interactable = cgSelectCraft.blocksRaycasts = false;
        LeanTween.cancel(cgSelectCraft.gameObject, false);
        LeanTweenEx.ChangeAlpha(cgSelectCraft, 0.0f, 0.2f).setEase(LeanTweenType.easeInOutQuad);

        cgCraftingPlace.interactable = cgCraftingPlace.blocksRaycasts = true;
        LeanTween.cancel(cgCraftingPlace.gameObject, false);
        LeanTweenEx.ChangeAlpha(cgCraftingPlace, 1.0f, 0.2f).setEase(LeanTweenType.easeInOutQuad);

        craftingPlace.ResetCraftTime();
        TryCraft();

        previousCraft = null;
    }
Exemplo n.º 3
0
    internal virtual void Hide(bool isForce)
    {
        LeanTween.cancel(cg.gameObject);
        cg.interactable = cg.blocksRaycasts = false;

        if ((!isForce || playOnForce) && closeClip)
        {
            AudioManager.Instance.Play(closeClip);
        }

        if (isForce)
        {
            cg.alpha = 0.0f;
            gameObject.SetActive(false);
            enabled = false;
        }
        else
        {
            SaveLastButton();

            LeanTweenEx.ChangeAlpha(cg, 0.0f, animTime)
            .setOnComplete(() => {
                gameObject.SetActive(false);
                enabled = false;
            });
        }
    }
Exemplo n.º 4
0
    public void ToggleVisible()
    {
        if (!cg)
        {
            return;
        }

        LeanTween.cancel(gameObject, false);

        if (isShowed)
        {
            isShowed          = false;
            cg.blocksRaycasts = cg.interactable = false;
            LeanTweenEx.ChangeAlpha(cg, 0.0f, 0.1f).setEase(LeanTweenType.easeInOutQuad);

            if (cgAlt)
            {
                cgAlt.blocksRaycasts = cgAlt.interactable = true;
                LeanTweenEx.ChangeAlpha(cgAlt, 1.0f, 0.1f).setEase(LeanTweenType.easeInOutQuad);
            }
        }
        else
        {
            isShowed          = true;
            cg.blocksRaycasts = cg.interactable = true;
            LeanTweenEx.ChangeAlpha(cg, 1.0f, 0.1f).setEase(LeanTweenType.easeInOutQuad);

            if (cgAlt)
            {
                cgAlt.blocksRaycasts = cgAlt.interactable = false;
                LeanTweenEx.ChangeAlpha(cgAlt, 0.0f, 0.1f).setEase(LeanTweenType.easeInOutQuad);
            }
        }
    }
Exemplo n.º 5
0
    internal virtual void Show(bool isForce)
    {
        enabled = true;
        gameObject.SetActive(true);

        LeanTween.cancel(cg.gameObject);
        cg.interactable = cg.blocksRaycasts = true;

        EnableAllSelectable();
        SelectButton();

        if ((!isForce || playOnForce) && openClip)
        {
            AudioManager.Instance.Play(openClip);
        }

        if ((!isForce || playOnForce) && ambient)
        {
            AudioManager.Instance.PlayMusic(ambient);
        }

        if (isForce)
        {
            cg.alpha = 1.0f;
        }
        else
        {
            LeanTweenEx.ChangeAlpha(cg, 1.0f, animTime);
        }
    }
Exemplo n.º 6
0
    void OnSceneLoadEnd(EventData data)
    {
        if (data == null)
        {
            return;
        }

        bool needUI = (bool)data?["needUI"];

        if (!needUI)
        {
            return;
        }

        if (loadingBarRoutine != null)
        {
            StopCoroutine(loadingBarRoutine);
        }

        if (onLoadingEndClip)
        {
            AudioManager.Instance.Play(onLoadingEndClip);
        }

        LeanTweenEx.ChangeAlpha(pressAnyKeyText, 1.0f, 0.5f).setIgnoreTimeScale(true)
        .setOnComplete(() => {
            pressAnyKeyTextAlphaLerp.enabled = true;
            pressAnyKeyTextSizeLerp.enabled  = true;
        });
        loadingBar.fillAmount = 1.0f;

        isLoadingEnd = true;
    }
Exemplo n.º 7
0
    public void StopSelectAnimation()
    {
        LeanTween.cancel(activeImage.gameObject, false);

        LeanTweenEx.ChangeAlpha(activeImage, 0.0f, 0.2f)
        .setEase(LeanTweenType.easeInOutSine);
    }
Exemplo n.º 8
0
 public void EndClient()
 {
     LeanTweenEx.ChangeAlpha(clientInactiveSprite, 1.0f, 0.2f)
     .setOnComplete(() => {
         SetRandomSprite();
     });
 }
Exemplo n.º 9
0
    public void DrawItem()
    {
        LeanTween.cancel(itemImage.gameObject, false);

        if (draggingSlot != this)
        {
            itemImage.transform.SetParent(transform, true);
            itemImage.transform.SetAsFirstSibling();
            count.transform.SetParent(transform, true);
            count.transform.SetAsLastSibling();

            itemImage.transform.localPosition    = Vector3.zero;
            count.rectTransform.anchoredPosition = Vector3.zero;
        }

        if (filter)
        {
            itemFilterImage.sprite = filter.sprite;
            itemFilterImage.color  = itemFilterImage.color.SetA(0.5f);
        }
        else
        {
            itemFilterImage.sprite = null;
            itemFilterImage.color  = itemFilterImage.color.SetA(0.0f);
        }

        if (item != null && item.itemSO != null)
        {
            if (item.itemSO.maxCount == 1)
            {
                count.text = "";
            }
            else
            {
                count.text = item.count.ToString();
            }

            itemImage.sprite = item.itemSO.sprite;
            LeanTweenEx.ChangeAlpha(itemImage, 1.0f, 0.05f).setEase(LeanTweenType.easeInOutQuad);

            tooltip.SetText(item.itemSO.GetInfoForPopup());
        }
        else
        {
            count.text = "";

            if (filter)
            {
                tooltip.SetText(filter.GetInfoForPopup());
            }
            else
            {
                tooltip.SetText("");
            }

            itemImage.sprite = null;
            itemImage.color  = itemImage.color.SetA(0.0f);
        }
    }
Exemplo n.º 10
0
    public virtual void HideUI()
    {
        isShowed = false;

        --canvasSortOrder;
        cg.interactable = cg.blocksRaycasts = false;

        LeanTween.cancel(cg.gameObject, false);
        LeanTweenEx.ChangeAlpha(cg, 0.0f, 0.2f).setEase(LeanTweenType.easeInOutQuad);
    }
Exemplo n.º 11
0
    public virtual void ShowUI()
    {
        isShowed = true;

        canvas.sortingOrder = canvasSortOrder++;
        cg.interactable     = cg.blocksRaycasts = true;

        LeanTween.cancel(cg.gameObject, false);
        LeanTweenEx.ChangeAlpha(cg, 1.0f, 0.2f).setEase(LeanTweenType.easeInOutQuad);
    }
    public void Show()
    {
        enabled = isShowed = true;

        canvas.sortingOrder = 1000;

        LeanTween.cancel(gameObject, false);
        LeanTweenEx.ChangeAlpha(cg, 1.0f, 0.1f)
        .setEase(LeanTweenType.easeInOutQuad)
        .setDelay(0.2f);
    }
    public void Hide()
    {
        isShowed = false;

        LeanTween.cancel(gameObject, false);
        LeanTweenEx.ChangeAlpha(cg, 0.0f, 0.1f)
        .setEase(LeanTweenType.easeInOutQuad)
        .setOnComplete(() => {
            enabled = false;
        });
    }
Exemplo n.º 14
0
    public void Hide()
    {
        isShowed = false;

        --InventoryItemTooltip.canvasSortOrder;

        LeanTween.cancel(gameObject, false);
        LeanTweenEx.ChangeAlpha(cg, 0.0f, 0.1f)
        .setEase(LeanTweenType.easeInOutQuad)
        .setOnComplete(() => {
            enabled = false;
        });
    }
Exemplo n.º 15
0
    public void OnClickComboBar()
    {
        useComboButton.image.raycastTarget = useComboButton.interactable = false;
        LeanTweenEx.ChangeAlpha(auraYellow, 0.0f, 0.2f);

        if (isGroupSelectionShowed)
        {
            OnSelectAnyGroup();
            UseGroupBoth();
            AfterUseGroup();

            progressBarCombo.UpdateValueNoCallback(statCombo = 0);
        }
    }
Exemplo n.º 16
0
    public void RemoveSelectedFrame(bool isLeftHand)
    {
        LeanTween.cancel(gameObject, false);

        if (isLeftHand)
        {
            isSelectLeft = false;
        }
        else
        {
            isSelectRight = false;
        }

        if (isLeftHand)
        {
            if (isSelectRight)
            {
                LeanTween.cancel(selectedFrameRightImage.gameObject, false);
                LeanTween.cancel(selectedFrameBothImage.gameObject, false);

                LeanTweenEx.ChangeAlpha(selectedFrameBothImage, 0.0f, 0.1f).setEase(LeanTweenType.easeInOutQuad);
                LeanTweenEx.ChangeAlpha(selectedFrameRightImage, 1.0f, 0.1f).setEase(LeanTweenType.easeInOutQuad);
            }
            else
            {
                LeanTween.cancel(selectedFrameLeftImage.gameObject, false);

                LeanTweenEx.ChangeAlpha(selectedFrameLeftImage, 0.0f, 0.1f).setEase(LeanTweenType.easeInOutQuad);
            }
        }
        else
        {
            if (isSelectLeft)
            {
                LeanTween.cancel(selectedFrameLeftImage.gameObject, false);
                LeanTween.cancel(selectedFrameBothImage.gameObject, false);

                LeanTweenEx.ChangeAlpha(selectedFrameBothImage, 0.0f, 0.1f).setEase(LeanTweenType.easeInOutQuad);
                LeanTweenEx.ChangeAlpha(selectedFrameLeftImage, 1.0f, 0.1f).setEase(LeanTweenType.easeInOutQuad);
            }
            else
            {
                LeanTween.cancel(selectedFrameRightImage.gameObject, false);

                LeanTweenEx.ChangeAlpha(selectedFrameRightImage, 0.0f, 0.1f).setEase(LeanTweenType.easeInOutQuad);
            }
        }
    }
Exemplo n.º 17
0
    void OnHelpModeChange(int mode)
    {
        LeanTween.cancel(gameObject, false);

        if (textField)
        {
            LeanTweenEx.ChangeAlpha(textField, mode == levelWhenShow ? 1.0f : 0.0f, 0.2f);
        }
        else if (cg)
        {
            LeanTweenEx.ChangeAlpha(cg, mode == levelWhenShow ? 1.0f : 0.0f, 0.2f);
        }
        else
        {
            gameObject.SetActive(mode == levelWhenShow);
        }
    }
Exemplo n.º 18
0
    internal virtual void Hide(bool isForce)
    {
        LeanTween.cancel(canvasGroup.gameObject);
        SaveLastButton();

        if (isForce)
        {
            canvasGroup.alpha = 0.0f;
            gameObject.SetActive(false);
        }
        else
        {
            LeanTweenEx.ChangeAlpha(canvasGroup, 0.0f, animTime)
            .setOnComplete(() => {
                gameObject.SetActive(false);
            });
        }
    }
Exemplo n.º 19
0
    internal virtual void Show(bool isForce)
    {
        LeanTween.cancel(canvasGroup.gameObject);
        gameObject.SetActive(true);
        EnableAllSelectable();

        SelectButton();
        lastSelectedButton = firstButton.gameObject;

        if (isForce)
        {
            canvasGroup.alpha = 1.0f;
        }
        else
        {
            LeanTweenEx.ChangeAlpha(canvasGroup, 1.0f, animTime);
        }
    }
Exemplo n.º 20
0
    public void ShowText(string text)
    {
        LeanTween.cancel(cg.gameObject);
        LeanTweenEx.ChangeAlpha(cg, 1.0f, showHideTime);

        AudioSource writeAS = AudioManager.Instance.PlayLoop(writeAudioClip, channel: AudioManager.AudioChannel.Sound);

        textField.text = text;
        textField.maxVisibleCharacters = 0;
        LeanTween.value(cg.gameObject, 0, text.Length, text.Length * timeForOneChar)
        .setOnUpdate((float c) => {
            textField.maxVisibleCharacters = Mathf.CeilToInt(c);
        })
        .setOnComplete(() => {
            AudioManager.Instance.ChangeASVolume(writeAS, 0.0f, 0.1f);
            Destroy(writeAS.gameObject, 0.2f);
        });
    }
Exemplo n.º 21
0
    private void Update()
    {
        if (timePassed < timeToShowAnyKeyText)
        {
            timePassed += Time.deltaTime;
            if (timePassed >= timeToShowAnyKeyText)
            {
                LeanTweenEx.ChangeAlpha(anyKeyText, 1.0f, 0.2f)
                .setOnComplete(() => {
                    anyKeyTextAlphaLerp.enabled = anyKeyTextSizeLerp.enabled = true;
                });
            }
        }

        if (timePassed >= timeToCanSkip && InputEx.IsAnyKeyPressedThisFrame())
        {
            OnAnyKeyPress();
        }
    }
Exemplo n.º 22
0
    public void SelectOtherCraft()
    {
        previousCraft = selectedCraft;
        selectedCraft = null;

        if (isCrafting)
        {
            foreach (var ingradient in previousCraft.ingradients)
            {
                ItemData leftItem = GameManager.Instance.player.inventory.AddItem(ingradient.CloneItem());

                if (leftItem.count != 0)
                {
                    //TODO: Inventory full popup text
                    Vector3 pos = GameManager.Instance.player.transform.position;
                    ItemOnGround.CreateOnGround(leftItem, pos);
                    leftItem.itemSO = null;
                }
            }

            craftingPlace.AbortCraft();
        }

        inventoryToAddItem.GiveAllItemsToPlayerOrDrop(
            myBlock.MyCell.transform.position,
            new Vector2(-myBlock.MyCell.MyGrid.cellSize.x / 2, myBlock.MyCell.MyGrid.cellSize.x / 2) * 0.8f,
            new Vector2(-myBlock.MyCell.MyGrid.cellSize.y / 2, myBlock.MyCell.MyGrid.cellSize.y / 2) * 0.8f
            );
        inventoryToRemoveItem.GiveAllItemsToPlayerOrDrop(
            myBlock.MyCell.transform.position,
            new Vector2(-myBlock.MyCell.MyGrid.cellSize.x / 2, myBlock.MyCell.MyGrid.cellSize.x / 2) * 0.8f,
            new Vector2(-myBlock.MyCell.MyGrid.cellSize.y / 2, myBlock.MyCell.MyGrid.cellSize.y / 2) * 0.8f
            );


        cgCraftingPlace.interactable = cgCraftingPlace.blocksRaycasts = false;
        LeanTween.cancel(cgCraftingPlace.gameObject, false);
        LeanTweenEx.ChangeAlpha(cgCraftingPlace, 0.0f, 0.2f).setEase(LeanTweenType.easeInOutQuad);

        cgSelectCraft.interactable = cgSelectCraft.blocksRaycasts = true;
        LeanTween.cancel(cgSelectCraft.gameObject, false);
        LeanTweenEx.ChangeAlpha(cgSelectCraft, 1.0f, 0.2f).setEase(LeanTweenType.easeInOutQuad);
    }
Exemplo n.º 23
0
    void OnSceneLoadEnd(EventData data)
    {
        if (data == null)
        {
            return;
        }
        if (loadingBarRoutine != null)
        {
            StopCoroutine(loadingBarRoutine);
        }

        LeanTweenEx.ChangeAlpha(pressAnyKeyText, 1.0f, 0.5f).setIgnoreTimeScale(true)
        .setOnComplete(() => {
            pressAnyKeyTextAlphaLerp.enabled = true;
            pressAnyKeyTextSizeLerp.enabled  = true;
        });
        loadingBar.fillAmount = 1.0f;

        isLoadingEnd = true;
    }
Exemplo n.º 24
0
    void OnSpinEnd()
    {
        onSpinEnd?.Invoke();

        foreach (var b in buttonsSelectGroup)
        {
            b.image.raycastTarget = b.interactable = true;
        }

        if (statCombo == pointToCombo && useComboButton.image.raycastTarget == false)
        {
            yellowComboReady?.Invoke();

            useComboButton.image.raycastTarget = useComboButton.interactable = true;

            LeanTweenEx.ChangeAlpha(auraYellow, 1.0f, 0.2f);
        }

        isGroupSelectionShowed = true;
        progressBarLose.UpdateHalfFillValue(statLose + statLoseGrowPerTurn);
        progressBarLoseGrow.UpdateHalfFillValue(statTurnsToIncreaseGrow + 1);
    }
Exemplo n.º 25
0
    public void Show()
    {
        enabled = isShowed = true;

        canvas.sortingOrder = canvasSortOrder++;

        rt.anchorMin        = new Vector2(0.0f, 1.0f);
        rt.anchorMax        = new Vector2(0.0f, 1.0f);
        rt.pivot            = new Vector2(0.0f, 1.0f);
        rt.anchoredPosition = new Vector3(parentRt.rect.width / 2, -parentRt.rect.height);

        if (rt.position.x + rt.rect.xMax >= Screen.width)
        {
            rt.anchoredPosition -= new Vector2(rt.rect.width, 0);
        }

        if (rt.position.y + rt.rect.yMin <= 0)
        {
            rt.anchoredPosition += new Vector2(0, rt.rect.height + parentRt.rect.height);
        }

        LeanTween.cancel(gameObject, false);
        LeanTweenEx.ChangeAlpha(cg, 1.0f, 0.1f).setEase(LeanTweenType.easeInOutQuad);
    }
Exemplo n.º 26
0
 public void StartNewClient()
 {
     LeanTweenEx.ChangeAlpha(clientInactiveSprite, 0.0f, 0.2f);
 }
Exemplo n.º 27
0
Arquivo: Cell.cs Projeto: Team-on/LD48
 public void UnHightlight()
 {
     LeanTween.cancel(hightlightSr.gameObject, false);
     LeanTweenEx.ChangeAlpha(hightlightSr, 0.0f, 0.1f).setEase(LeanTweenType.easeInOutQuad);
 }
Exemplo n.º 28
0
 public void Hide()
 {
     LeanTween.cancel(cg.gameObject, true);
     LeanTweenEx.ChangeAlpha(cg, 0.0f, showHideTime);
 }
Exemplo n.º 29
0
 public void Deactivate()
 {
     LeanTween.cancel(aura.gameObject);
     LeanTweenEx.ChangeAlpha(aura.GetComponent <Image>(), 0.0f, 0.2f);
 }