public void SetShopBuyPopup(ShopProductInfo getProductInfo)
    {
        if (getProductInfo.type != SHOP_TYPE.PACKAGE)
        {
            if (shopBuyPopup.activeSelf == true)
            {
                return;
            }

            if (shopBuyPopup.GetComponent <ShopBuyPopup>().SetShopBuyPopup(getProductInfo) == false)
            {
                return;
            }

            shopBuyPopup.SetActive(true);
        }
        else
        {
            if (shopBuyPackagePopup.activeSelf == true)
            {
                return;
            }

            if (shopBuyPackagePopup.GetComponent <ShopBuyPackagePopup>().SetShopPackageBuyPopup(getProductInfo) == false)
            {
                return;
            }

            shopBuyPackagePopup.SetActive(true);
        }
    }
示例#2
0
    public void SetShopObjectInfo(ShopProductInfo getInfo)
    {
        DBShopData shopData = CSVData.Inst.GetShopData(getInfo.index);

        if (shopData == null)
        {
            DebugLog.Log(false, "Invalid Shop Object ID : " + getInfo.index);
            return;
        }

        index    = getInfo.index;
        shopType = getInfo.type;
        id       = getInfo.id;

        textCount.text = "X " + shopData.productCount;
        if (shopType == SHOP_TYPE.ETC)
        {
            // 기타등등은 소수점없다
            textCost.text = shopData.priceCount.ToString();
        }
        else
        {
            textCost.text = (shopData.priceCount * 0.0001).ToString("N4");
        }

        if (shopType == SHOP_TYPE.PACKAGE)
        {
            // 패키지면 패키지에서 찾아야한다...
            DBPackageData packageData = CSVData.Inst.GetPackageData(shopData.productID);
            if (packageData == null)
            {
                DebugLog.Log(true, "Error");
                return;
            }
            imageObject.sprite = packageData.resourceIcon;
            textName.text      = packageData.name;
        }
        else
        {
            imageObject.sprite = CSVData.Inst.GetItemIcon(shopData.productID);
            textName.text      = CSVData.Inst.GetItemData(shopData.productID).name;
        }
        imageCost.sprite = CSVData.Inst.GetItemIcon(shopData.priceID);

        shopProductInfo = getInfo;
    }
    public bool SetShopBuyPopup(ShopProductInfo getInfo)
    {
        DBShopData shopData = CSVData.Inst.GetShopData(getInfo.index);

        if (shopData == null)
        {
            DebugLog.Log(false, "Invalid Shop Object ID : " + getInfo.index);
            return(false);
        }

        index    = getInfo.index;
        shopType = getInfo.type;
        id       = getInfo.id;

        textCount.text = "X " + shopData.productCount;
        priceCount     = shopData.priceCount;

        if (shopType == SHOP_TYPE.ETC)
        {
            textCost.text = priceCount.ToString();
        }
        else
        {
            textCost.text = (priceCount * 0.0001).ToString("N4");
        }

        DBItemData itemData = CSVData.Inst.GetItemData(shopData.productID);

        if (itemData == null)
        {
            itemData = CSVData.Inst.GetItemData(500002);
        }

        textName.text    = itemData.name;
        textExplain.text = itemData.description;

        imageObject.sprite = itemData.ItemIcon;
        imageCost.sprite   = CSVData.Inst.GetItemIcon(shopData.priceID);

        buyCount          = 1;
        textBuyCount.text = buyCount.ToString();

        return(true);
    }
示例#4
0
    public bool SetShopPackageBuyPopup(ShopProductInfo getInfo)
    {
        DBShopData shopData = CSVData.Inst.GetShopData(getInfo.index);

        if (shopData == null)
        {
            DebugLog.Log(false, "Invalid Shop Object ID : " + getInfo.index);
            return(false);
        }
        index = getInfo.index;
        DBPackageData packageData = CSVData.Inst.GetPackageData(shopData.id);

        if (packageData == null)
        {
            DebugLog.Log(false, "Invalid Package ID : " + shopData.id);
            return(false);
        }

        for (int i = 0; i < 3; i++)
        {
            packageList[i].SetActive(false);
        }
        packageList[getInfo.index - 16].SetActive(true);

        textName.text = packageData.name;
        if (packageData.utg > 0)
        {
            textGetUTG.text = (packageData.utg * 0.0001).ToString("N4");
            utgObject.SetActive(true);
        }
        else
        {
            utgObject.SetActive(false);
        }
        imageObjectIcon.sprite = packageData.resourceIcon;
        imagePriceIcon.sprite  = CSVData.Inst.GetItemIcon(packageData.priceID);
        textPrice.text         = (packageData.priceCount * 0.0001).ToString("N4");

        return(true);
    }
示例#5
0
 /// <summary>
 /// 상점 현금 결제 처리
 /// </summary>
 /// <param name="errorCode"></param>
 /// <param name="shopId"></param>
 /// <param name="shopProductInfo"></param>
 /// <param name="arrayItemBaseInfo"></param>
 /// <returns></returns>
 public bool ShowPurchaseResult(GameBaseShopErrorCode errorCode, int shopId, ShopProductInfo shopProductInfo, ShopProductInfo changeProductInfo, ItemBaseInfo payItemInfo, ItemBaseInfo[] arrayRewardItemInfo, QuestData[] arrayQuestData)
 {
     return(ShowBuyResult(errorCode, shopId, shopProductInfo, changeProductInfo, payItemInfo, arrayRewardItemInfo, arrayQuestData));
 }
示例#6
0
        /// <summary>
        /// 상점 인게임 재화 구매 처리
        /// </summary>
        /// <param name="errorCode"></param>
        /// <param name="shopId"></param>
        /// <param name="shopProductInfo"></param>
        /// <param name="payItemInfo"></param>
        /// <param name="arrayRewardItemInfo"></param>
        /// <returns></returns>
        public bool ShowBuyResult(GameBaseShopErrorCode errorCode, int shopId, ShopProductInfo shopProductInfo, ShopProductInfo changeProductInfo, ItemBaseInfo payItemInfo, ItemBaseInfo[] arrayRewardItemInfo, QuestData[] arrayQuestData)
        {
            UI_Main.Get().obj_IndicatorPopup.SetActive(false);

            if (errorCode == GameBaseShopErrorCode.Success)
            {
                //구매한 상품에 대한 정보
                //shopProductInfo
                switch (shopId)
                {
                case 1:
                case 2:
                case 3:
                case 5:
                case 6:
                    RefreshShop();
                    break;
                }

                if (payItemInfo != null)
                {
                    //소모한 재화에 대한 연출 처리
                    //payItemInfo
                    ITEM_TYPE type;
                    switch (payItemInfo.ItemId)
                    {
                    case 1:
                        type = ITEM_TYPE.GOLD;
                        UserInfoManager.Get().GetUserInfo().gold += payItemInfo.Value;
                        break;

                    case 2:
                        type = ITEM_TYPE.DIAMOND;
                        UserInfoManager.Get().GetUserInfo().diamond += payItemInfo.Value;
                        break;

                    case 11:
                        type = ITEM_TYPE.KEY;
                        UserInfoManager.Get().GetUserInfo().key += payItemInfo.Value;
                        break;

                    default:
                        type = ITEM_TYPE.NONE;
                        break;
                    }
                    UI_GetProduction.Get().RefreshProduct(type);
                }

                //구매한 상품에 대한 결과 값
                //arrayRewardItemInfo
                ItemBaseInfo[] arr = new ItemBaseInfo[arrayRewardItemInfo.Length];
                for (int i = 0; i < arrayRewardItemInfo.Length; i++)
                {
                    Debug.Log($"GET == ID:{arrayRewardItemInfo[i].ItemId}, Value:{arrayRewardItemInfo[i].Value}");
                    arr[i]        = new ItemBaseInfo();
                    arr[i].ItemId = arrayRewardItemInfo[i].ItemId;
                    arr[i].Value  = arrayRewardItemInfo[i].Value;
                }
                UI_Main.Get().AddReward(arr, ShopItem.pos);

                return(true);
            }
            else
            {
                Debug.Log($"에러 발생 : {errorCode}");
                UI_ErrorMessage.Get().ShowMessage($"Error : {errorCode}");
                return(false);
            }
        }
示例#7
0
        public virtual void UpdateContent(ShopInfo shopInfo, ShopProductInfo shopProductInfo)
        {
            this.shopInfo = shopInfo;
            int maxBuyCount = 0;
            int tapInfo     = 0;

            textPItemId.text  = shopProductInfo.shopProductId.ToString();
            textPItemId.text += $"  ({shopProductInfo.buyCount}/{maxBuyCount})";
            int getCount = 0;
            TDataShopProductList data = null;
            TDataItemList        item = null;

            switch (shopInfo.shopId)
            {
            case 1:         // 이벤트 상품
            {
                if (TableManager.Get().ShopProductList.GetData(shopProductInfo.shopProductId, out data))
                {
                    buyType     = (BuyType)data.buyType;
                    tapInfo     = data.tapInfo;
                    imageName   = data.shopImage;
                    maxBuyCount = data.buyLimitCnt;
                    switch (buyType)
                    {
                    case BuyType.gold:
                        imagePriceIcon.sprite  = FileHelper.GetIcon("icon_gold");
                        textPItemBuyCount.text = data.buyPrice.ToString();
                        break;

                    case BuyType.dia:
                        imagePriceIcon.sprite  = FileHelper.GetIcon("icon_dia");
                        textPItemBuyCount.text = data.buyPrice.ToString();
                        break;

                    case BuyType.cash:
                        imagePriceIcon.enabled = false;
                        break;

                    case BuyType.free:
                        imagePriceIcon.enabled = false;
                        textPItemBuyCount.text = LocalizationManager.GetLangDesc("Shop_Buyfree");
                        var pos = textPItemBuyCount.rectTransform.anchoredPosition;
                        pos.x = 0;
                        textPItemBuyCount.rectTransform.anchoredPosition = pos;
                        break;

                    case BuyType.ad:
                        imagePriceIcon.enabled = false;
                        break;
                    }
#if UNITY_ANDROID
                    productId = data.googleProductId;
#elif UNITY_IOS
                    productId = data.appleProductId;
#endif
                }
            }
            break;

            case 2:         // 패키지 상품
            {
                if (TableManager.Get().ShopProductList.GetData(shopProductInfo.shopProductId, out data))
                {
                    buyType     = (BuyType)data.buyType;
                    tapInfo     = data.tapInfo;
                    imageName   = data.shopImage;
                    maxBuyCount = data.buyLimitCnt;
                    switch (buyType)
                    {
                    case BuyType.gold:
                        imagePriceIcon.sprite  = FileHelper.GetIcon("icon_gold");
                        textPItemBuyCount.text = data.buyPrice.ToString();
                        break;

                    case BuyType.dia:
                        imagePriceIcon.sprite  = FileHelper.GetIcon("icon_dia");
                        textPItemBuyCount.text = data.buyPrice.ToString();
                        break;

                    case BuyType.cash:
                        imagePriceIcon.enabled = false;
                        break;

                    case BuyType.free:
                        imagePriceIcon.enabled = false;
                        textPItemBuyCount.text = LocalizationManager.GetLangDesc("Shop_Buyfree");
                        var pos = textPItemBuyCount.rectTransform.anchoredPosition;
                        pos.x = 0;
                        textPItemBuyCount.rectTransform.anchoredPosition = pos;
                        break;

                    case BuyType.ad:
                        imagePriceIcon.enabled = false;
                        break;
                    }
#if UNITY_ANDROID
                    productId = data.googleProductId;
#elif UNITY_IOS
                    productId = data.appleProductId;
#endif
                }
            }
            break;

            case 3:         // 일일 상품
            {
                if (TableManager.Get().ShopProductList.GetData(shopProductInfo.shopProductId, out data))
                {
                    buyType = (BuyType)data.buyType;
                    tapInfo = data.tapInfo;
                    switch (buyType)
                    {
                    case BuyType.gold:
                        imagePriceIcon.enabled = true;
                        imagePriceIcon.sprite  = FileHelper.GetIcon("icon_gold");
                        textPItemBuyCount.text = data.buyPrice.ToString();
                        break;

                    case BuyType.dia:
                        imagePriceIcon.enabled = true;
                        imagePriceIcon.sprite  = FileHelper.GetIcon("icon_dia");
                        textPItemBuyCount.text = data.buyPrice.ToString();
                        break;

                    case BuyType.cash:
                        imagePriceIcon.enabled = false;
                        break;

                    case BuyType.free:
                        imagePriceIcon.enabled = false;
                        textPItemBuyCount.text = LocalizationManager.GetLangDesc("Shop_Buyfree");
                        var pos = textPItemBuyCount.rectTransform.anchoredPosition;
                        pos.x = 0;
                        textPItemBuyCount.rectTransform.anchoredPosition = pos;
                        break;

                    case BuyType.ad:
                        imagePriceIcon.enabled = false;
                        break;
                    }

                    textPItemId.text = $"x{data.itemValue01}";

                    if (TableManager.Get().ItemList.GetData(itm => itm.id == data.itemId01, out item))
                    {
                        imageIcon.sprite = FileHelper.GetIcon(item.itemIcon);
                    }
                }

                buttonShopItem.interactable = shopProductInfo.buyCount == 0;
            }
            break;

            case 4:         // 박스
            {
                if (TableManager.Get().ShopProductList.GetData(shopProductInfo.shopProductId, out data))
                {
                    buyType = (BuyType)data.buyType;
                    tapInfo = data.tapInfo;
                    switch (buyType)
                    {
                    case BuyType.gold:
                        imagePriceIcon.sprite  = FileHelper.GetIcon("icon_gold");
                        textPItemBuyCount.text = data.buyPrice.ToString();
                        break;

                    case BuyType.dia:
                        imagePriceIcon.sprite  = FileHelper.GetIcon("icon_dia");
                        textPItemBuyCount.text = data.buyPrice.ToString();
                        break;

                    case BuyType.cash:
                        imagePriceIcon.enabled = false;
                        textPItemBuyCount.text = LocalizationManager.GetLangDesc("Shop_Buyfree");
                        var pos = textPItemBuyCount.rectTransform.anchoredPosition;
                        pos.x = 0;
                        textPItemBuyCount.rectTransform.anchoredPosition = pos;
                        break;

                    case BuyType.free:
                        imagePriceIcon.enabled = false;
                        textPItemBuyCount.text = LocalizationManager.GetLangDesc("Shop_Buyfree");
                        pos   = textPItemBuyCount.rectTransform.anchoredPosition;
                        pos.x = 0;
                        textPItemBuyCount.rectTransform.anchoredPosition = pos;
                        break;

                    case BuyType.ad:
                        imagePriceIcon.enabled = false;
                        break;
                    }

                    textPItemId.text = $"x{data.itemValue01}";

                    if (TableManager.Get().ItemList.GetData(itm => itm.id == data.itemId01, out item))
                    {
                        imageIcon.sprite = FileHelper.GetIcon(item.itemIcon);
                        imageIcon.SetNativeSize();
                    }
                    textPItemBuyCount.text = $"{data.buyPrice}";
                }
            }
            break;

            case 5:         // 프리미엄
            {
                if (TableManager.Get().ShopProductList.GetData(shopProductInfo.shopProductId, out data))
                {
                    buyType   = (BuyType)data.buyType;
                    tapInfo   = data.tapInfo;
                    imageName = data.shopImage;
                    switch (buyType)
                    {
                    case BuyType.gold:
                        imagePriceIcon.sprite  = FileHelper.GetIcon("icon_gold");
                        textPItemBuyCount.text = data.buyPrice.ToString();
                        break;

                    case BuyType.dia:
                        imagePriceIcon.sprite  = FileHelper.GetIcon("icon_dia");
                        textPItemBuyCount.text = data.buyPrice.ToString();
                        break;

                    case BuyType.cash:
                        imagePriceIcon.enabled = false;
                        break;

                    case BuyType.free:
                        imagePriceIcon.enabled = false;
                        textPItemBuyCount.text = LocalizationManager.GetLangDesc("Shop_Buyfree");
                        var pos = textPItemBuyCount.rectTransform.anchoredPosition;
                        pos.x = 0;
                        textPItemBuyCount.rectTransform.anchoredPosition = pos;
                        break;

                    case BuyType.ad:
                        imagePriceIcon.enabled = false;
                        break;
                    }
#if UNITY_ANDROID
                    productId = data.googleProductId;
#elif UNITY_IOS
                    productId = data.appleProductId;
#endif
                }
            }
            break;

            case 6:         // 이모티콘
            {
                if (TableManager.Get().ShopProductList.GetData(shopProductInfo.shopProductId, out data))
                {
                    buyType = (BuyType)data.buyType;
                    tapInfo = data.tapInfo;
                    textPItemBuyCount.text = $"{data.buyType}:{data.buyPrice}";
                }
            }
            break;

            case 7:         // 다이아
            {
                if (TableManager.Get().ShopProductList.GetData(shopProductInfo.shopProductId, out data))
                {
                    buyType   = (BuyType)data.buyType;
                    tapInfo   = data.tapInfo;
                    imageName = data.shopImage;
#if UNITY_ANDROID
                    productId = data.googleProductId;
#elif UNITY_IOS
                    productId = data.appleProductId;
#endif
                    switch (buyType)
                    {
                    case BuyType.gold:
                        imagePriceIcon.sprite  = FileHelper.GetIcon("icon_gold");
                        textPItemBuyCount.text = data.buyPrice.ToString();
                        break;

                    case BuyType.dia:
                        imagePriceIcon.sprite  = FileHelper.GetIcon("icon_dia");
                        textPItemBuyCount.text = data.buyPrice.ToString();
                        break;

                    case BuyType.cash:
                        imagePriceIcon.enabled = false;
                        textPItemBuyCount.text = LocalizationManager.GetLangDesc("Shop_Buyfree");
                        var pos = textPItemBuyCount.rectTransform.anchoredPosition;
                        pos.x = 0;
                        textPItemBuyCount.rectTransform.anchoredPosition = pos;
                        break;

                    case BuyType.free:
                        imagePriceIcon.enabled = false;
                        textPItemBuyCount.text = LocalizationManager.GetLangDesc("Shop_Buyfree");
                        pos   = textPItemBuyCount.rectTransform.anchoredPosition;
                        pos.x = 0;
                        textPItemBuyCount.rectTransform.anchoredPosition = pos;
                        break;

                    case BuyType.ad:
                        imagePriceIcon.enabled = false;
                        break;
                    }

                    textPItemId.text = $"x{data.itemValue01}";

                    if (TableManager.Get().ItemList.GetData(itm => itm.id == data.itemId01, out item))
                    {
                        imageIcon.sprite = FileHelper.GetIcon(data.shopImage);
                    }
                }
            }
            break;

            case 8:         // 골드
            {
                if (TableManager.Get().ShopProductList.GetData(shopProductInfo.shopProductId, out data))
                {
                    buyType   = (BuyType)data.buyType;
                    tapInfo   = data.tapInfo;
                    imageName = data.shopImage;
                    switch (buyType)
                    {
                    case BuyType.gold:
                        imagePriceIcon.sprite  = FileHelper.GetIcon("icon_gold");
                        textPItemBuyCount.text = data.buyPrice.ToString();
                        break;

                    case BuyType.dia:
                        imagePriceIcon.sprite  = FileHelper.GetIcon("icon_dia");
                        textPItemBuyCount.text = data.buyPrice.ToString();
                        break;

                    case BuyType.cash:
                        imagePriceIcon.enabled = false;
                        textPItemBuyCount.text = LocalizationManager.GetLangDesc("Shop_Buyfree");
                        var pos = textPItemBuyCount.rectTransform.anchoredPosition;
                        pos.x = 0;
                        textPItemBuyCount.rectTransform.anchoredPosition = pos;
                        break;

                    case BuyType.free:
                        imagePriceIcon.enabled = false;
                        textPItemBuyCount.text = LocalizationManager.GetLangDesc("Shop_Buyfree");
                        pos   = textPItemBuyCount.rectTransform.anchoredPosition;
                        pos.x = 0;
                        textPItemBuyCount.rectTransform.anchoredPosition = pos;
                        break;

                    case BuyType.ad:
                        imagePriceIcon.enabled = false;
                        break;
                    }

                    textPItemId.text = $"x{data.itemValue01}";

                    if (TableManager.Get().ItemList.GetData(itm => itm.id == data.itemId01, out item))
                    {
                        imageIcon.sprite = FileHelper.GetIcon(data.shopImage);
                    }
                    textPItemBuyCount.text = $"{data.buyPrice}";
                }
            }
            break;
            }

            // Tap
            if (data != null)
            {
                switch ((ETapInfoKey)data.tapInfo)
                {
                case ETapInfoKey.tap_hot:
                    textBadge.text = "HOT";
                    textBadge.transform.parent.gameObject.SetActive(true);
                    textValue.transform.parent.gameObject.SetActive(false);
                    textFirstBuy.transform.parent.gameObject.SetActive(false);
                    break;

                case ETapInfoKey.tap_best:
                    textBadge.text = "BEST";
                    textBadge.transform.parent.gameObject.SetActive(true);
                    textValue.transform.parent.gameObject.SetActive(false);
                    textFirstBuy.transform.parent.gameObject.SetActive(false);
                    break;

                case ETapInfoKey.tap_new:
                    textBadge.text = "NEW";
                    textBadge.transform.parent.gameObject.SetActive(true);
                    textValue.transform.parent.gameObject.SetActive(false);
                    textFirstBuy.transform.parent.gameObject.SetActive(false);
                    break;

                case ETapInfoKey.tap_oneplusone:
                    textBadge.text = "1+1";
                    textBadge.transform.parent.gameObject.SetActive(true);
                    textValue.transform.parent.gameObject.SetActive(false);
                    textFirstBuy.transform.parent.gameObject.SetActive(true);
                    break;

                case ETapInfoKey.tap_value:
                    textValue.text = $"{data.tapValue}";
                    textBadge.transform.parent.gameObject.SetActive(false);
                    textValue.transform.parent.gameObject.SetActive(true);
                    textFirstBuy.transform.parent.gameObject.SetActive(false);
                    break;
                }
            }

            buttonShopItem.onClick = new Button.ButtonClickedEvent();

            //shopProductInfo.shopProductId 값으로 테이블에 존재하는 상품 데이터 조회
            //string productId = "mhl_package_crystal_150";

            if (buyType == BuyType.cash)
            {
                textPItemBuyCount.text = InAppManager.Instance.GetIDToProduct(productId)?.metadata.localizedPriceString;
            }
            //else textPItemBuyCount.text = string.Empty;

            shopProductId = shopProductInfo.shopProductId;

            //아이템의 buyType에 따라서 구매 버튼 눌렀을때 다르게 처리하기
            buttonShopItem.onClick.AddListener(() =>
            {
                if (buyType == BuyType.dia || buyType == BuyType.gold)
                {
                    UI_Main.Get().shopBuyPopup.Initialize(imageIcon.sprite, textPItemId.text, buyType,
                                                          textPItemBuyCount.text, item, tapInfo, Buy);
                }
                else
                {
                    Buy();
                }
            });

            SetColor();
        }
示例#8
0
    public override void UpdateContent(ShopInfo shopInfo, ShopProductInfo shopProductInfo)
    {
        base.UpdateContent(shopInfo, shopProductInfo);

        SetSubitem(shopProductInfo.shopProductId);
    }