Beispiel #1
0
    void InitPromo()
    {
        Dictionary <AbilityType, float> nextAbilityDic = null;
        Transform evolveView = ViewObj[(int)ViewType.Evolve].transform;

        Damage.text = string.Format(_LowDataMgr.instance.GetStringCommon(1163), CurData._Attack);

        if (CurData.CurQuality >= 6)
        {
            //최대
            for (int i = 0; i < NextEvolveAttAbilitys.Length; i++)
            {
                NextEvolveAttAbilitys[i].text = "";
            }

            evolveView.FindChild("arrow").gameObject.SetActive(false);
            evolveView.FindChild("name").gameObject.SetActive(false);
            EvoleRoot.gameObject.SetActive(false);
            BtnEvolve.transform.gameObject.SetActive(false);
            EvolveLevel[1].transform.parent.gameObject.SetActive(false);
            EvolveLevel[0].transform.parent.transform.localPosition = new Vector3(0, 268.4f, 0);
            MaxEvolve.SetActive(true);
        }
        else
        {
            Partner.PartnerDataInfo nextInfo = _LowDataMgr.instance.GetPartnerInfo(CurData.GetLowData().QualityUpId);   //다음승급데이터
            nextAbilityDic = NetData.instance.CalcPartnerStats(CurData._NowLevel, nextInfo, nextInfo.Quality);

            EvolveLevel[1].text    = string.Format("{0}{1}[-]", UIHelper.GetItemGradeColor((int)CurData.CurQuality + 1), GetGradeName((int)(CurData.CurQuality + 1)));
            EvolveManLevel[1].text = string.Format(_LowDataMgr.instance.GetStringCommon(1152), GetMaxEvolveLevel((int)CurData.CurQuality + 1));

            //스킬재료아이템
            EvolveMaterialSlot.SetLowDataItemSlot(CurData.GetLowData().QualityUpItem, 0, (lowDataId) =>
            {
                OpenDetailPopup(null, CurData.GetLowData().QualityUpItem);
            });

            int  nowAmount = UserInfo.GetItemCountForItemId(CurData.GetLowData().QualityUpItem, (byte)eItemType.USE);
            bool isSuccess = true;
            if (nowAmount < CurData.GetLowData().QualityUpItemCount || NetData.instance.GetAsset(AssetType.Gold) < CurData.GetLowData().QualityUpNeedGold)
            {
                isSuccess = false;
            }

            EvoleRoot.FindChild("value").GetComponent <UILabel>().text  = string.Format(_LowDataMgr.instance.GetStringCommon(1167), nowAmount, CurData.GetLowData().QualityUpItemCount);
            EvoleRoot.FindChild("value").GetComponent <UILabel>().color = nowAmount < CurData.GetLowData().QualityUpItemCount ? Color.red : Color.white;

            EvoleRoot.FindChild("Lock").gameObject.SetActive(nowAmount < CurData.GetLowData().QualityUpItemCount);

            if (isSuccess)
            {
                BtnEvolve.transform.FindChild("Btn_on").gameObject.SetActive(true);
                BtnEvolve.transform.FindChild("Btn_off").gameObject.SetActive(false);

                BtnEvolve.transform.FindChild("Btn_on/price").GetComponent <UILabel>().text = string.Format("x{0}", CurData.GetLowData().QualityUpNeedGold);
            }
            else
            {
                BtnEvolve.transform.FindChild("Btn_on").gameObject.SetActive(false);
                BtnEvolve.transform.FindChild("Btn_off").gameObject.SetActive(true);

                BtnEvolve.transform.FindChild("Btn_off/price").GetComponent <UILabel>().text = string.Format("x{0}", CurData.GetLowData().QualityUpNeedGold);
            }

            EventDelegate.Set(BtnEvolve.onClick, delegate()
            {
                if (IsUpgrading)
                {
                    SceneManager.instance.SetNoticePanel(NoticeType.Message, 9921);
                    return;
                }

                if (!isSuccess)
                {
                    string msg = "";
                    if (nowAmount < CurData.GetLowData().QualityUpItemCount)
                    {
                        msg = _LowDataMgr.instance.GetStringCommon(1173);   //재료부족
                    }
                    else if (NetData.instance.GetAsset(AssetType.Gold) < CurData.GetLowData().QualityUpNeedGold)
                    {
                        msg = _LowDataMgr.instance.GetStringCommon(1174);   //골드부족
                    }
                    UIMgr.instance.AddPopup(_LowDataMgr.instance.GetStringCommon(141), msg, _LowDataMgr.instance.GetStringCommon(117));
                    return;
                }

                NetworkClient.instance.SendPMsgHeroEvolveC(CurData._partnerIndex);
            });

            evolveView.FindChild("arrow").gameObject.SetActive(true);
            evolveView.FindChild("name").gameObject.SetActive(true);

            EvoleRoot.gameObject.SetActive(true);
            BtnEvolve.transform.gameObject.SetActive(true);
            EvolveLevel[1].transform.parent.gameObject.SetActive(true);
            EvolveLevel[0].transform.parent.transform.localPosition = new Vector3(-145.5f, 268.4f, 0);
            MaxEvolve.SetActive(false);
        }

        EvolveLevel[0].text    = string.Format("{0}{1}[-]", UIHelper.GetItemGradeColor((int)CurData.CurQuality), GetGradeName((int)CurData.CurQuality));
        EvolveManLevel[0].text = string.Format(_LowDataMgr.instance.GetStringCommon(1152), GetMaxEvolveLevel((int)CurData.CurQuality));
        EvolveLevel[1].gameObject.transform.localScale = Vector3.one;

        Dictionary <AbilityType, float> abilityDic = NetData.instance.CalcPartnerStats(CurData._NowLevel, CurData.GetLowData(), CurData.CurQuality);

        //어빌리티 정보 셋팅
        int length = EvolveAttAbilitys.Length;

        for (int i = 0; i < length; i++)
        {
            float       value = 0;
            AbilityType a     = (AbilityType)i + 1;
            abilityDic.TryGetValue(a, out value);

            if (nextAbilityDic != null)
            {
                float       nextValue = 0;
                AbilityType b         = (AbilityType)i + 1;
                nextAbilityDic.TryGetValue(b, out nextValue);

                if (nextValue - value > 0)
                {
                    NextEvolveAttAbilitys[i].text = string.Format("▲{0}", nextValue - value);
                }
                else if (nextValue - value == 0)
                {
                    NextEvolveAttAbilitys[i].text = "━";
                }
            }

            EvolveAttAbilitys[i].text = UIMgr.instance.GetAbilityStrValue(a, value);
        }
    }
    /// <summary>
    /// 코스튬 뷰를 보여준다.
    /// </summary>
    void CostumeListView()
    {
        List <NetData._CostumeData> costimeList = UserInfo.GetCostumeList();
        Transform listTf = ViewObj[(uint)ViewType.List].transform;
        Transform gridTf = listTf.FindChild("ScrollView/Grid");

        for (int i = 0; i < gridTf.childCount; /*costimeList.Count;*/ i++)
        {
            Transform slotTf = gridTf.GetChild(i);

            slotTf.FindChild("costume").gameObject.SetActive(false);
            slotTf.FindChild("noncostum_slot").gameObject.SetActive(false);
            if (i >= costimeList.Count)
            {
                slotTf.FindChild("noncostum_slot").gameObject.SetActive(true);
                continue;
            }
            slotTf.FindChild("costume").gameObject.SetActive(true);

            NetData._CostumeData costumeData = costimeList[i];

            //아이템리스트에서 현재의 조각아이템을 찾아서 갯수를 가져온다 - 자주쓸거같으면 _Inventory안에 만들기
            Item.CostumeInfo tempCos = _LowDataMgr.instance.GetLowDataCostumeInfo(costumeData._costmeDataIndex);
            int shardCount           = UserInfo.GetItemCountForItemId(tempCos.ShardIdx, (byte)eItemType.USE);

            slotTf.name = string.Format("{0}", costumeData._costmeDataIndex);
            UILabel  nameAndStack = slotTf.FindChild("costume/name_and_stack_d1").GetComponent <UILabel>();
            UILabel  ability      = slotTf.FindChild("costume/ability_d1").GetComponent <UILabel>();
            UILabel  info         = slotTf.FindChild("costume/info_d1").GetComponent <UILabel>();
            UISprite icon         = slotTf.FindChild("costume/icon").GetComponent <UISprite>();
            UISprite bg           = slotTf.FindChild("costume/bg").GetComponent <UISprite>();
            NetData.ItemAbilityData abilityData = costumeData.AbilityData;

            nameAndStack.text = string.Format("{0} ({1}/{2})", costumeData.GetLocName(), shardCount, costumeData._needShard);

            float calculatedAbilityValue = _LowDataMgr.instance.GetCostumeAbilityValue(costumeData._Grade, costumeData._MinorGrade, abilityData.Value);
            ability.text = string.Format("{0} {1}", UIMgr.instance.GetAbilityLocName(abilityData.Ability)                   //이름
                                         , UIMgr.instance.GetAbilityStrValue(abilityData.Ability, calculatedAbilityValue)); //지금 능력치

            info.text       = costumeData.GetDescription();
            icon.spriteName = costumeData.GetIconName();

            UIButton       uiBtnGet   = slotTf.FindChild("costume/BtnGet").GetComponent <UIButton>();
            UIEventTrigger uiTriMount = slotTf.FindChild("costume/BtnMount").GetComponent <UIEventTrigger>();
            GameObject     mountEff   = slotTf.FindChild("costume/mount_effect").gameObject;
            GameObject     mountCover = slotTf.FindChild("costume/cover").gameObject;
            bool           isGetBtn   = false;
            mountEff.SetActive(costumeData._isEquip);
            mountCover.SetActive(costumeData._isEquip);
            ///보유중
            if (costumeData._isOwn)
            {
                string text = null;
                if (costumeData._isEquip)
                {
                    text          = _LowDataMgr.instance.GetStringCommon(37);
                    bg.spriteName = "Bod_List04";
                }
                else
                {
                    text          = _LowDataMgr.instance.GetStringCommon(38);
                    bg.spriteName = "Bod_List05";

                    if (i != 0)
                    {
                        Destroy(uiTriMount.gameObject.GetComponent <TutorialSupport>());
                    }
                }

                EventDelegate.Set(uiTriMount.onClick, delegate()
                {
                    if (costumeData._isEquip && (IsPreViewCostume))
                    {
                        OnClickPreView(costumeData);
                    }
                    else
                    {
                        OnClickMountCostume(costumeData);
                    }
                });

                uiTriMount.transform.GetComponent <UILabel>().text = text;
            }
            else//획득하지 못한 아이템
            {
                uiTriMount.transform.GetComponent <UILabel>().text = _LowDataMgr.instance.GetStringCommon(38);

                if (costumeData._needShard <= shardCount)//획득 가능.
                {
                    uiBtnGet.collider.enabled = true;
                    slotTf.FindChild("costume/BtnGet/label_d2").GetComponent <UILabel>().color = Color.white;
                    EventDelegate.Set(uiBtnGet.onClick, delegate() { OnClickGetCostume(costumeData._costmeDataIndex); }); //, slotTf
                }
                else//불가능
                {
                    uiBtnGet.collider.enabled = false;
                    slotTf.FindChild("costume/BtnGet/label_d2").GetComponent <UILabel>().color = Color.gray;
                }

                EventDelegate.Set(uiTriMount.onClick, delegate() { OnClickPreView(costumeData); });

                isGetBtn = true;
            }

            uiBtnGet.gameObject.SetActive(isGetBtn);
        }

        gridTf.GetComponent <UIGrid>().Reposition();

        ListScrollView.enabled = true;
        ListScrollView.transform.SetLocalY(0);
        ListScrollView.transform.GetComponent <UIPanel>().clipOffset = Vector3.zero;
        // ListScrollView.ResetPosition();

        if (costimeList.Count < 4)
        {
            ListScrollView.enabled = false;
        }
    }
    /// <summary> 아이템 디테일 팝업 실행 함수. </summary>
    void SetDetailPopup(NetData._ItemData itemData)
    {
        CurItemData = itemData;
        Debug.Log(string.Format("Click Item UseId={0}, equipId={1}", itemData._useitemDataIndex, itemData._equipitemDataIndex));
        bool isDifferentClass = false;

        NetData._UserInfo charInven = NetData.instance.GetUserInfo();

        if (CurItemData.IsEquipItem())
        {
            LinkPopup[0].SetActive(false);
            LinkPopup[1].SetActive(false);

            int limitLv = CurItemData.GetEquipLowData().LimitLevel;
            //EquipLv.text = string.Format(_LowDataMgr.instance.GetStringCommon(952), limitLv);
            if (limitLv <= charInven._Level && !isDifferentClass)//내 직업이고 레벨이 높다면
            {
                EquipState[0].SetActive(true);
                EquipState[1].SetActive(false);
            }
            else
            {
                EquipState[0].SetActive(false);
                EquipState[1].SetActive(true);
            }

            uint strKey = 0;
            if (BasePanel is EquipmentPanel)
            {
                Item.EquipmentInfo equipLow = CurItemData.GetEquipLowData();
                if (CurItemData._enchant < equipLow.MaxEnchant)
                {
                    strKey = 31;
                }
                else if (0 < equipLow.NextPartsId)
                {
                    strKey = 32;
                }
                else//최대
                {
                    strKey = 1182;
                }
            }
            else
            {
                strKey = 106;//닫기
            }
            if (0 < strKey)
            {
                SetOnOff(MainBtn.transform, true, _LowDataMgr.instance.GetStringCommon(strKey));
            }

            //텍스트 셋팅
            int    grade = itemData.GetEquipLowData().Grade;
            string color = UIHelper.GetItemGradeColor(grade);
            ItemName.text = string.Format("{0}{1}[-] [FFE400]+{2}[-]", color, itemData.GetLocName(), itemData._enchant);
        }
        else
        {
            //EquipLv.text = "";
            EquipState[0].SetActive(false);
            EquipState[1].SetActive(false);
            LinkPopup[0].SetActive(true);
            LinkPopup[1].SetActive(false);

            SetOnOff(MainBtn.transform, true, _LowDataMgr.instance.GetStringCommon(106));
            int count = charInven.GetItemCountForItemId(CurItemData._useitemDataIndex, (byte)eItemType.USE);
            LinkItemSlot[0].SetLowDataItemSlot(CurItemData._useitemDataIndex, (uint)count);
            LinkItemSlot[0].transform.parent.FindChild("Lock").gameObject.SetActive(count <= 0);

            Transform gridTf = LinkScroll.transform.FindChild("Grid");
            List <Item.ContentsListInfo> conList = _LowDataMgr.instance.GetLowDataContentsItemList(CurItemData._useitemDataIndex);
            for (int i = 0; i < conList.Count; i++)
            {
                Item.ContentsListInfo info = conList[i];
                string contentsName        = _LowDataMgr.instance.GetStringCommon(info.ContentsName);
                if (info.ContentsParam != null && 0 < info.ContentsParam.Count)
                {
                    if (contentsName.Contains("{0}") && contentsName.Contains("{1}"))
                    {
                        contentsName = string.Format(contentsName, info.ContentsParam[0], info.ContentsParam[1]);
                    }
                    else if (contentsName.Contains("{0}"))
                    {
                        contentsName = string.Format(contentsName, info.ContentsParam[0]);
                    }
                }

                Transform tf = null;
                if (i < gridTf.childCount)
                {
                    tf = gridTf.GetChild(i);
                }
                else
                {
                    tf            = Instantiate(gridTf.GetChild(0)) as Transform;
                    tf.parent     = gridTf;
                    tf.localScale = Vector3.one;
                }

                tf.gameObject.SetActive(true);

                tf.FindChild("txt").GetComponent <UILabel>().text = contentsName;
                bool isEnter = true;
                if (CheckContentsLink(info, false))//조건 만족
                {
                    tf.FindChild("error_txt").GetComponent <UILabel>().text = "";
                }
                else
                {
                    isEnter = false;

                    string contentsError = _LowDataMgr.instance.GetStringCommon(info.ConditionName);
                    if (info.ConditionParam != null && 0 < info.ConditionParam.Count)
                    {
                        if (contentsError.Contains("{0}") && contentsError.Contains("{1}"))
                        {
                            contentsError = string.Format(contentsError, info.ConditionParam[0], info.ConditionParam[1]);
                        }
                        else if (contentsError.Contains("{0}"))
                        {
                            contentsError = string.Format(contentsError, info.ConditionParam[0]);
                        }
                    }

                    tf.FindChild("error_txt").GetComponent <UILabel>().text = contentsError;
                }

                EventDelegate.Set(tf.FindChild("Btn").GetComponent <UIEventTrigger>().onClick, () => { OnClickContentsLink(info); });
                if (info.ContentsLinkType == 1)//재료조합
                {
                    tf.FindChild("Btn/On/label").GetComponent <UILabel>().text  = _LowDataMgr.instance.GetStringCommon(39);
                    tf.FindChild("Btn/Off/label").GetComponent <UILabel>().text = _LowDataMgr.instance.GetStringCommon(39);
                }
                else if (info.ContentsLinkType == 2)//바로가기(던전)
                {
                    tf.FindChild("Btn/On/label").GetComponent <UILabel>().text  = _LowDataMgr.instance.GetStringCommon(249);
                    tf.FindChild("Btn/Off/label").GetComponent <UILabel>().text = _LowDataMgr.instance.GetStringCommon(249);
                }

                tf.FindChild("Btn/On").gameObject.SetActive(isEnter);
                tf.FindChild("Btn/Off").gameObject.SetActive(!isEnter);
            }

            gridTf.GetComponent <UIGrid>().repositionNow = true;
            for (int j = conList.Count; j < gridTf.childCount; j++)
            {
                gridTf.GetChild(j).gameObject.SetActive(false);
            }

            if (conList.Count < 4)
            {
                LinkScroll.enabled = false;
            }
            else
            {
                LinkScroll.enabled = true;
            }

            Item.ItemInfo data  = itemData.GetUseLowData();
            string        color = UIHelper.GetItemGradeColor(data == null ? 0 : (int)data.Grade);
            ItemName.text = string.Format("{0}{1}[-] [FFE400][-]", color, itemData.GetLocName());
        }

        //아이템 셋팅
        ItemSlot.SetInvenItemSlot(itemData, null, 0);

        //아이템의 옵션들 셋팅
        byte optionCount = 0;

        Desc.transform.localPosition = SetAbility(itemData, ref optionCount); //어빌리티
        SetDesc(itemData, ref optionCount);                                   //아이템 설명 표현

        OptionScrollView.ResetPosition();
        if (optionCount <= 1)//스크롤 되면 안됨.
        {
            AbilityTf.parent.collider.enabled = false;
        }
        else
        {
            AbilityTf.parent.collider.enabled = true;
        }
    }