Пример #1
0
    /// <summary> 아이템클릭시  </summary>
    void OnclicItemPopup(NetData.ShopItemInfo info, int price, Color nameColor)
    {
        //아이템세부정보
        //구매팝업에서는 무조건 1개로시작함

        string dec      = "";
        string itemName = "";

        if (_LowDataMgr.instance.GetLowDataEquipItemInfo(info.GoodsId) != null)//장비아이템
        {
            Item.EquipmentInfo equipLowData = _LowDataMgr.instance.GetLowDataEquipItemInfo(info.GoodsId);
            Item.ItemValueInfo valueLowData = _LowDataMgr.instance.GetLowDataItemValueInfo(equipLowData.BasicOptionIndex);

            //dec += _LowDataMgr.instance.GetStringItem(equipLowData.NameId);
            itemName = _LowDataMgr.instance.GetStringItem(equipLowData.NameId);
            //dec += "\n\n";
            dec += _LowDataMgr.instance.GetStringItem(equipLowData.DescriptionId);
            dec += "\n\n";
            dec += string.Format("{0} : {1}", uiMgr.GetAbilityLocName((AbilityType)valueLowData.OptionId)
                                 , uiMgr.GetAbilityStrValue((AbilityType)valueLowData.OptionId, valueLowData.BasicValue));;
            dec += "\n\n";
            dec += string.Format(_LowDataMgr.instance.GetStringCommon(179)
                                 , 0, 3);
        }
        else
        {
            Item.ItemInfo useLowData = _LowDataMgr.instance.GetUseItem(info.GoodsId);
            itemName = _LowDataMgr.instance.GetStringItem(useLowData.NameId);
            //dec += _LowDataMgr.instance.GetStringItem(useLowData.NameId);
            //dec += "\n\n";
            dec += _LowDataMgr.instance.GetStringItem(useLowData.DescriptionId);
        }

        GoodsName.text  = itemName;
        GoodsName.color = nameColor;
        GoodsInfo.text  = dec;

        //        시간 / 한정판매아이템일경우 초기화시간자리에 정보를 표시해줘야함
        if (CurShopType == 102 || CurShopType == 202)
        {
            //TimeItemInfo.gameObject.SetActive(true);
            ulong start = _LowDataMgr.instance.GetLowDataShopById(info.DbIndex).shopopentime;
            ulong end   = _LowDataMgr.instance.GetLowDataShopById(info.DbIndex).shopclosetime;

            //577 {0}년{0}월{1}일 // 260 {0}분
            string Start = string.Format(_LowDataMgr.instance.GetStringCommon(577),
                                         start.ToString().Substring(0, 4), start.ToString().Substring(4, 2), start.ToString().Substring(6, 2));
            Start += string.Format(_LowDataMgr.instance.GetStringCommon(260), start.ToString().Substring(8, 2));
            //Start += ":";
            //Start += start.ToString().Substring(2, 2);
            //Start += ":";
            //Start += start.ToString().Substring(4, 2);

            string End = string.Format(_LowDataMgr.instance.GetStringCommon(577),
                                       end.ToString().Substring(0, 4), end.ToString().Substring(4, 2), end.ToString().Substring(6, 2));
            End += string.Format(_LowDataMgr.instance.GetStringCommon(260), end.ToString().Substring(8, 2));


            //string End = end.ToString().Substring(0, 2);
            //End += ":";
            //End += end.ToString().Substring(2, 2);

            //End += ":";
            //End += end.ToString().Substring(4, 2);

            TimeItemInfo.text = string.Format("{0} ~ {1}", Start, End);
        }

        UseSellAmount      = 1;
        UseSellTotalAmount = (int)info.Account;

        TotalNum.text   = UseSellAmount.ToString();
        TotalPrice.text = (UseSellAmount * price).ToString();

        TotalPrice.color = ulong.Parse(TotalPrice.text) <= money ? Color.white : Color.red;  //돈이 모자르면 빨간색

        EventDelegate.Set(BtnPlus.onClick, delegate() { OnclickUseCount(1, price); });
        EventDelegate.Set(BtnMinus.onClick, delegate() { OnclickUseCount(-1, price); });

        EventDelegate.Set(BtnMax.onClick, delegate() { OnclickUseCount((int)info.Account, price); });


        EventDelegate.Set(BuyBtn.onClick, delegate()
        {
            if (UseSellAmount != 0)
            {
                string msg = string.Format(_LowDataMgr.instance.GetStringCommon(472), itemName);
                uiMgr.AddPopup(_LowDataMgr.instance.GetStringCommon(141), msg, _LowDataMgr.instance.GetStringCommon(467), _LowDataMgr.instance.GetStringCommon(76), null,
                               () =>
                {
                    SceneManager.instance.ShowNetProcess("PurchaseShopItme");
                    NetworkClient.instance.SendPMsgShopByItemC(info.Idx, CurShopType, info.GoodsId, (uint)UseSellAmount, info.DbIndex);
                });
            }
        });


        //  TotalPrice.text = ((ulong)UseSellTotalAmount * price) * ToString();//총 판매 금액
    }
Пример #2
0
    public void ViewInfo(uint type, NetData.ShopItemInfoData shopInfo)
    {
        ScrollView.gameObject.SetActive(shopInfo == null ? false : true);
        EmptyTxt.SetActive(shopInfo == null? true:false);
        if (/*!ScrollView.gameObject.activeSelf*/ shopInfo == null)
        {
            return;
        }

        int shopCnt = shopInfo.shopInfo.Count;

        CurShopType = shopInfo.Type;
        RefreshCash(CurShopType);

        bool IsTimeReset = true;

        if (CurShopType == 101)
        {
            IsTimeReset = false;
        }
        if (CurShopType == 201)
        {
            IsTimeReset = false;
        }
        if (CurShopType == 202)
        {
            IsTimeReset = false;
        }
        if (CurShopType == 102)
        {
            IsTimeReset = false;
        }

        TimeRoot.gameObject.SetActive(IsTimeReset);
        TimeItemInfo.gameObject.SetActive(!TimeRoot.gameObject.activeSelf);
        ResetBtn.transform.gameObject.SetActive(IsTimeReset);

        if (CurViewType != eMainTab.CHANGE)
        {
            TimeRoot.gameObject.SetActive(false);
            ResetBtn.transform.gameObject.SetActive(false);
        }

        if (IsTimeReset)
        {
            RefreshTime = shopInfo.RefreshTimer.ToString();
            // 리셋비용을 얻기위해
            PriceList = _LowDataMgr.instance.GetLowDataPrice(shopInfo.Type);
        }

        GoodsName.text     = "";
        GoodsInfo.text     = "";
        UseSellAmount      = 0;
        UseSellTotalAmount = 0;
        TotalNum.text      = "0";
        TotalPrice.text    = "0";
        TimeItemInfo.text  = "";


        bool isFirstSelect = false;

        int childCount = 0;

        for (int i = 0; i < Grid.transform.childCount; i++)
        {
            if (i >= shopCnt)
            {
                Grid.transform.GetChild(i).gameObject.SetActive(false);
                continue;
            }

            Transform slotTf = Grid.transform.GetChild(i);
            slotTf.gameObject.SetActive(true);

            NetData.ShopItemInfo info      = shopInfo.shopInfo[i];
            Shop.ShopInfo        shopTable = _LowDataMgr.instance.GetLowDataShopById(info.DbIndex);

            if (shopTable == null)
            {
                Grid.transform.GetChild(i).gameObject.SetActive(false);
                continue;
            }

            //한정판매 일때는 기간지나면 목록에서 없앰
            if (shopTable.shopopentime != 0)
            {
                DateTime startTime = DateTime.ParseExact(shopTable.shopopentime.ToString(), "yyyyMMddHHmmss", null);
                DateTime endTime   = DateTime.ParseExact(shopTable.shopclosetime.ToString(), "yyyyMMddHHmmss", null);

                if (startTime.CompareTo(DateTime.Now) < 0) // 오늘이 시작날짜보다 빠르다면
                {
                    slotTf.gameObject.SetActive(false);
                    continue;
                }

                if (endTime.CompareTo(DateTime.Now) > 0) //오늘이 완료날짜보다 늦다면
                {
                    slotTf.gameObject.SetActive(false);
                    continue;
                }
            }

            // 갯수 1개는 표시x , 2개부터 표시해줌
            UILabel Count = slotTf.FindChild("cnt").GetComponent <UILabel>();
            Count.text = info.Account.ToString();
            Count.gameObject.SetActive(info.Account > 1 ? true : false);

            UISprite moneyIcon = slotTf.FindChild("Img_Money").GetComponent <UISprite>();
            moneyIcon.spriteName = MoneyImg.spriteName;

            UILabel name  = slotTf.FindChild("name").GetComponent <UILabel>();
            UILabel price = slotTf.FindChild("price").GetComponent <UILabel>();

            price.text = shopTable.cost.ToString();
            Item.EquipmentInfo eLowData = _LowDataMgr.instance.GetLowDataEquipItemInfo(info.GoodsId);
            if (eLowData != null)//장비아이템이 드랍아이템 대표로 등록되어 있음
            {
                name.color = GradeNameColor[eLowData.Grade];
                name.text  = _LowDataMgr.instance.GetStringItem(eLowData.NameId);
            }
            else//소모아이템이 드랍아이템 대표로 등록되어 있음
            {
                Item.ItemInfo uLowData = _LowDataMgr.instance.GetUseItem(info.GoodsId);
                if (uLowData == null)
                {
                    continue;
                }

                name.color = GradeNameColor[uLowData.Grade];
                name.text  = _LowDataMgr.instance.GetStringItem(uLowData.NameId);
            }


            int idx = i;

            //슬롯눌럿을경우 선택
            EventDelegate.Set(slotTf.GetComponent <UIEventTrigger>().onClick, delegate()
            {
                if (0 < info.Account)
                {
                    OnclicItemPopup(info, int.Parse(price.text), name.color);
                }

                for (int j = 0; j < SelEff.Length; j++)
                {
                    SelEff[j].SetActive(j == idx);
                }
            });

            //아이콘일경우 팝업
            slotTf.FindChild("root").GetChild(0).GetComponent <InvenItemSlotObject>().SetLowDataItemSlot(info.GoodsId, 0, (key) =>
            {
                UIMgr.OpenDetailPopup(this, info.GoodsId);
            });

            //매진팝업
            Transform soldOut      = slotTf.FindChild("soldout").GetComponent <Transform>();
            Transform soldOutStemp = slotTf.FindChild("Stemp").GetComponent <Transform>();

            soldOut.gameObject.SetActive(false);
            soldOutStemp.gameObject.SetActive(false);

            // 한개 이상이면 구매팝업창으로
            if (info.Account < 1)
            {
                soldOut.gameObject.SetActive(true);
                soldOutStemp.gameObject.SetActive(true);
            }


            //매진이아닌 아이템이 최초선택된채로 시작.
            if (!isFirstSelect && !soldOutStemp.gameObject.activeSelf && !isResetSelect)
            {
                OnclicItemPopup(info, int.Parse(price.text), name.color);

                for (int j = 0; j < SelEff.Length; j++)
                {
                    SelEff[j].SetActive(j == idx);
                }

                isFirstSelect = true;
            }
            childCount++;
        }

        //초기화
        EventDelegate.Set(ResetBtn.onClick, delegate()
        {
            OnclickReset((int)shopInfo.ManualRefreshCount, (int)shopInfo.Type);
        });
        EmptyTxt.SetActive(shopInfo == null /*!Grid.transform.GetChild(0).gameObject.activeSelf*/);
        Grid.Reposition();
        ScrollView.enabled = childCount > 10;
        isResetSelect      = false;
    }