/// <summary> 사용 아이템의 설명문 Equip아이템은 아님. 마지막 셋팅 함수임. Position은 주지 않는다 </summary> void SetDesc(NetData._ItemData itemData, ref byte optionCount) { uint descId = 0; if (itemData.IsEquipItem()) { Item.EquipmentInfo equipLowData = itemData.GetEquipLowData(); descId = equipLowData.DescriptionId; } else { Item.ItemInfo useLowData = itemData.GetUseLowData(); descId = useLowData == null ? 0 : useLowData.DescriptionId; } if (descId <= 0) { Desc.gameObject.SetActive(false); return; } ++optionCount; Desc.gameObject.SetActive(true); Desc.text = _LowDataMgr.instance.GetStringItem(descId); }
/// <summary> 인벤토리의 아이템 정의 </summary> /// <param name="itemData">셋팅하고자 하는 아이템데이터</param> /// <param name="startDepth">시작 뎁스 값</param> public void SetInvenItemSlot(NetData._ItemData itemData, Action <ulong, byte> callBack, int startDepth = 8) { EnchantLv.gameObject.SetActive(itemData.IsEquipItem()); if (itemData.IsEquipItem()) { SetEquipItem(itemData.GetEquipLowData(), itemData.Count); EnchantLv.text = itemData._enchant <= 0 ? "" : string.Format("+{0}", itemData._enchant); } else { SetUseItem(itemData.GetUseLowData(), itemData.Count); } Key = itemData._itemIndex; Key2 = itemData._itemType; CallBackTwo = callBack; SetDepth(startDepth); }
int SortJewel(NetData._ItemData a, NetData._ItemData b) { if (!a.IsUseItem() || !b.IsUseItem()) { return(0); } Item.ItemInfo aLowData = a.GetUseLowData(); Item.ItemInfo bLowData = b.GetUseLowData(); AssetType aType = (AssetType)aLowData.Type; AssetType bType = (AssetType)bLowData.Type; //보석은 별도 if (aType == AssetType.Jewel && bType == AssetType.Jewel) { if (aLowData.Grade < bLowData.Grade) { return(1); } else if (bLowData.Grade < aLowData.Grade) { return(-1); } } else if (aType != AssetType.Jewel && bType == AssetType.Jewel) { return(1); } else if (aType == AssetType.Jewel && bType != AssetType.Jewel) { return(-1); } if (a._itemIndex < b._itemIndex) { return(-1); } else { return(1); } }
/// <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; } }