コード例 #1
0
    public void Hide()
    {
        //MFGuiManager.Instance.ShowLayout (m_Layout, false);

        m_ItemScroller.Hide();
        m_Equip_Button.Widget.Show(false, true);
        m_Buy_Button.Widget.Show(false, true);
        m_Cost.Show(false);

        IsShown = false;
    }
コード例 #2
0
    // ------
    public void SetItem(IResearchItem item)
    {
        m_ResearchItem = item;

        //different caption for differen confirmantion (buy, upgrade, add gold, convert gold)
        string caption = TextDatabase.instance[m_ResearchItem.GetName()];

        m_Caption_Label.SetNewText(caption);

        m_BigThumbnail.Widget.CopyMaterialSettings(m_ResearchItem.GetImage());

        /*if(inf.PriceSale)
         * {
         *      m_Sale_Label.SetNewText(inf.DiscountTag);
         * }
         * /**/
        //m_Sale_Label.Widget.Show( false, true);

        if (m_Cost != null)
        {
            m_Cost.Show(true);
            bool isGold;
            int  cost = m_ResearchItem.GetPrice(out isGold);
            m_Cost.SetValue(cost, isGold);
        }
    }
コード例 #3
0
ファイル: GuiShopBuyPopup.cs プロジェクト: huokele/shadow-gun
    protected override void OnViewShow()
    {
        base.OnViewShow();

        if (m_BuyItemId == ShopItemId.EmptyId)
        {
            Debug.LogError("Call SetBuyItem with valid item id first!");
            return;
        }

        ShopItemInfo inf = ShopDataBridge.Instance.GetItemInfo(m_BuyItemId);

        //different caption for differen confirmantion (buy, upgrade, add gold, convert gold)
        int idBuy      = 02030020;
        int idAddFunds = 02030036;

        //format caption, different for adding funds
        string str1    = (m_BuyItemId.ItemType == GuiShop.E_ItemType.Fund) ? TextDatabase.instance[idAddFunds] : TextDatabase.instance[idBuy];
        string caption = str1 + " " + inf.NameText;

        m_Caption_Label.SetNewText(caption);

        m_Thumbnail = GuiBaseUtils.PrepareSprite(m_ScreenLayout, ThumbName(m_BuyItemId.ItemType));
        m_Thumbnail.Widget.Show(true, false);

        //stejne sprity jako ve scrollbaru
        if (inf.ScrollerWidget != null)
        {
            m_Thumbnail.Widget.CopyMaterialSettings(inf.ScrollerWidget);
        }
        else
        {
            m_Thumbnail.Widget.CopyMaterialSettings(inf.SpriteWidget);
        }

        m_SaleRoot.Show(inf.PriceSale, true);
        if (inf.PriceSale)
        {
            m_Sale_Label.SetNewText(inf.DiscountTag);
        }

        if (m_Cost != null)
        {
            m_Cost.Show(true);
            if (m_BuyItemId.ItemType == GuiShop.E_ItemType.Fund)
            {
                bool isGold = inf.AddGold > 0;
                m_Cost.SetValue(isGold ? inf.AddGold : inf.AddMoney, isGold, true);
            }
            else
            {
                m_Cost.SetValue(inf.Cost, inf.GoldCurrency);
            }
        }
    }
コード例 #4
0
	// ------
	public void SetItem(IResearchItem item, int upgradeIndex)
	{
		m_ResearchItem = item;
		m_UpgradeIndex = upgradeIndex;

		m_Caption_Label.SetNewText(TextDatabase.instance[item.GetUpgradeName(upgradeIndex)]);
		m_Value_Label.SetNewText(item.GetUpgradeValueText(upgradeIndex));

		if (m_Cost != null)
		{
			m_Cost.Show(true);

			WeaponSettings.Upgrade upgrade = m_ResearchItem.GetUpgrade(upgradeIndex);

			int cost;
			bool hasEnoughFunds;

			if (upgrade.MoneyCost > 0)
			{
				cost = upgrade.MoneyCost;
				hasEnoughFunds = ResearchSupport.Instance.HasPlayerEnoughFunds(cost, false);
				m_Cost.SetValue(cost, false);
			}
			else
			{
				cost = upgrade.GoldCost;
				hasEnoughFunds = ResearchSupport.Instance.HasPlayerEnoughFunds(cost, true);
				m_Cost.SetValue(cost, true);
			}

			if (!hasEnoughFunds)
			{
				m_AcceptButton.SetDisabled(upgrade.GoldCost > 0 ? false : true);
				m_Cost.SetMissingFunds(true);
			}
			else
			{
				m_AcceptButton.SetDisabled(false);
				m_Cost.SetMissingFunds(false);
			}
		}

		m_UpgradeIcon.SetUpgradeType(item.GetUpgrade(upgradeIndex).ID);
		m_UpgradeIcon.SetStatus(UpgradeIcon.Status.Active);
		m_UpgradeIcon.Show();
	}
コード例 #5
0
    // ------
    public void SetItems(int[] items)
    {
        m_ResearchGUIDs = items;
        m_Cost          = 0;
        m_RefundedMoney = 0;
        m_Cost         += m_ResearchGUIDs.Length * GameCloudSettings.REFUND_COST_PER_RESEARCH_ITEM;

        foreach (int i  in m_ResearchGUIDs)
        {
            m_RefundedMoney += ResearchSupport.Instance.GetPriceBasedOnGuid(i);
        }
        //Debug.Log("Refunded: " + m_RefundedMoney);

        if (m_CostWidgets != null)
        {
            m_CostWidgets.Show(true);
            m_CostWidgets.SetValue(m_Cost, true);
        }
        bool disabled = (m_Cost <= 0) || !(ResearchSupport.Instance.HasPlayerEnoughFunds(m_Cost, true));

        m_AcceptButton.SetDisabled(disabled);
        m_CostWidgets.SetDisabled(disabled);
    }
コード例 #6
0
    public void Show(ShopItemId itemId)
    {
        m_PictureSprite = GuiBaseUtils.PrepareSprite(m_Layout, ThumbName(itemId.ItemType));

        if (itemId != ShopItemId.EmptyId)
        {
            ShopItemInfo inf = ShopDataBridge.Instance.GetItemInfo(itemId);

            m_NameLabel.Widget.Show(true, false);
            m_NameLabel.SetNewText(inf.NameText);

            m_PictureSprite.Widget.Show(true, false);
            m_PictureSprite.Widget.CopyMaterialSettings(inf.SpriteWidget);

            //string strDesc = TextDatabase.instance[ inf.Description ];
            if (itemId.ItemType == GuiShop.E_ItemType.Hat)
            {
                m_SpecInfoLabel.SetNewText(TextDatabase.instance[0208048]);
                m_SpecInfoLabel.Widget.Show(true, false);
            }
            else
            {
                m_SpecInfoLabel.Widget.Show(false, false);
            }
            m_DescArea.SetNewText(inf.Description);
            m_DescArea.Widget.SetModify(true);
            m_DescArea.Widget.Show(true, false);

            m_OwnedSprite.Widget.Show(inf.Owned, true);

            //show cost only for what costs money
            bool showCost = (inf.Cost > 0) && (!inf.Owned || inf.Consumable);
            m_Cost.SetValue(inf.Cost, inf.GoldCurrency, false);
            m_Cost.Show(showCost);

            m_Sale.Show(inf.PriceSale, true);
            bool showCostBeforeSale = false;
            if (inf.PriceSale)
            {
                m_SaleLabel.SetNewText(inf.DiscountTag);
                showCostBeforeSale = (inf.CostBeforeSale > 0);
                m_CostBeforeSale.SetNewText(inf.CostBeforeSale.ToString());
            }
            m_CostBeforeSale.Widget.Show(showCostBeforeSale, true);

            bool showIAP = ShopDataBridge.Instance.IsIAPFund(itemId) && inf.IAPCost != null;
            if (showIAP)
            {
                m_IAP_Widget.Show(true, true);
                m_IAP_Cost_Label.SetNewText(inf.IAPCost);
            }
            else
            {
                m_IAP_Widget.Show(false, true);
            }

#if IAP_USE_MFLIVE //when using MFLive, amount of gold is chosen at the paywall page, so we display just "Gold" without any sales
            if (inf.AddGold > 0)
            {
                m_NameLabel.SetNewText(TextDatabase.instance[2030004]);
                m_Sale.Show(false, true);
            }
#endif
        }
        else
        {
            //Debug.Log("Empty id");
            m_NameLabel.Widget.Show(false, false);
            m_PictureSprite.Widget.Show(false, false);
            m_Cost.Show(false);
            m_DescArea.Widget.Show(false, false);
            m_OwnedSprite.Widget.Show(false, false);
            m_SaleLabel.Widget.Show(false, true);
        }
    }