Пример #1
0
    public void showQuickPotions()
    {
        if (quickPotionButton == null || quickPotionButton.Length <= 0 || Game.game.currentDialog != null || inventoryVisible)
        {
            return;
        }

        GuiUtils.aspectRatio = GuiUtils.AspectRatio.AspectRatioFree;

        for (int i = 0; i < quickPotionButton.Length; i++)
        {
            HudButton btn = quickPotionButton[i];

            if (Inventory.inventory.getItemAmmount(quickInventoryItems[i]) > 0)
            {
                btn.rect = interpolateRect(initPositionButtons, getFinalQuickPotionRect(nItems), quickPotionInterpolator);

                showHudButton(btn, true, delegate(Object o)
                {
                    if (quickPotionState == QUICKPOTION_STATE.INPLACE)
                    {
                        selectedItem = quickInventoryItems[i];
                        Inventory.inventory.consume(selectedItem, 1);
                        if (quickInventoryTotalPotions() == 0)
                        {
                            quickPotionState = QUICKPOTION_STATE.CLOSING;
                        }
                    }
                });

                if (quickPotionState == QUICKPOTION_STATE.INPLACE)
                {
                    Rect ammountRect = new Rect(btn.rect);
                    ammountRect.x      += quickPotionOffsets.x;
                    ammountRect.y      += quickPotionOffsets.y;
                    ammountRect.width  += quickPotionOffsets.width;
                    ammountRect.height += quickPotionOffsets.height;

                    GuiUtils.showImage(potionFontStyle.normal.background, ammountRect);

                    GUIStyle style = new GUIStyle();
                    style.normal.textColor = Color.white;
                    style.font             = GuiUtils.styleInResolution(style, buttonSmall, buttonMidle, buttonBig, buttonBigXXL);
                    style.alignment        = TextAnchor.MiddleCenter;

                    GuiUtils.showLabel(ammountRect, Inventory.inventory.getItemAmmount(quickInventoryItems[i]).ToString(), style);
                }

                nItems++;
            }
        }
        nItems = 0;
    }
Пример #2
0
    public void toogleQuickPotions(Object o)
    {
        if (!quickPotionsCanBeToogled)
        {
            return;
        }

        switch (quickPotionState)
        {
        case QUICKPOTION_STATE.CLOSED:
        case QUICKPOTION_STATE.CLOSING:
        {
            quickPotionState = QUICKPOTION_STATE.OPENING;
            iTween.Stop(this.gameObject);
            iTween.ValueTo(this.gameObject, iTween.Hash(
                               "from", quickPotionInterpolator,
                               "to", 1.0f,
                               "speed", quickPotionSpeed,
                               "onupdate", "updateQuickPotionInterpolator",
                               "oncomplete", "onInPlaceQuickPotionInterpolator",
                               "easetype", iTween.EaseType.linear
                               ));
        }
        break;

        case QUICKPOTION_STATE.OPENING:
        case QUICKPOTION_STATE.INPLACE:
        {
            quickPotionState = QUICKPOTION_STATE.CLOSING;
            iTween.Stop(this.gameObject);
            iTween.ValueTo(this.gameObject, iTween.Hash(
                               "from", quickPotionInterpolator,
                               "to", 0.0f,
                               "speed", quickPotionSpeed,
                               "onupdate", "updateQuickPotionInterpolator",
                               "oncomplete", "onClosedQuickPotionInterpolator",
                               "easetype", iTween.EaseType.linear
                               ));
        }
        break;
        }
    }
Пример #3
0
 public void onClosedQuickPotionInterpolator()
 {
     quickPotionState = QUICKPOTION_STATE.CLOSED;
 }
Пример #4
0
 public void onInPlaceQuickPotionInterpolator()
 {
     quickPotionState = QUICKPOTION_STATE.INPLACE;
 }