| | |
| | | public class CandidateEquipWidget : MonoBehaviour |
| | | { |
| | | [SerializeField] Text m_Title; |
| | | [SerializeField] RectTransform m_CandidateNone; |
| | | [SerializeField] RectTransform m_CandidateContainer; |
| | | [SerializeField] CyclicScroll m_CandidateEquipScroll; |
| | | |
| | |
| | | |
| | | if (!candidates.IsNullOrEmpty()) |
| | | { |
| | | m_CandidateNone.gameObject.SetActive(false); |
| | | m_CandidateContainer.gameObject.SetActive(true); |
| | | m_CandidateEquipScroll.Init(candidates); |
| | | } |
| | | else |
| | | { |
| | | m_CandidateNone.gameObject.SetActive(true); |
| | | m_CandidateContainer.gameObject.SetActive(false); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | var pak = new C032F_tagCRequestEquipShowHide(); |
| | | pak.EquipShowSwitch = (uint)(level * 10 + GetSuitLevel(level, EquipSuitType.EightSuit) >= 0 ? 1 : 0); |
| | | pak.EquipShowSwitch = (uint)level; |
| | | GameNetSystem.Instance.SendInfo(pak); |
| | | } |
| | | |
| | |
| | | |
| | | private string GetDefaultEquipIcon(int place) |
| | | { |
| | | return string.Empty; |
| | | return StringUtility.Contact("EquipDefaultIcon_", place); |
| | | } |
| | | |
| | | private void Select() |
| | |
| | | var maxLevel = GetMaxStarLevel(level); |
| | | if (starLevel > maxLevel) |
| | | { |
| | | //已经是最大星级,无法升星 |
| | | SysNotifyMgr.Instance.ShowTip("StarLevelUp1"); |
| | | return; |
| | | } |
| | | |
| | |
| | | var specialMaterial = packModel.GetItemByGuid(materials[6].value); |
| | | if (config.CostItemDict.x > 0 && (specialMaterial == null || specialMaterial.config.ID != config.CostItemDict.x)) |
| | | { |
| | | //请放入正确的特殊材料 |
| | | SysNotifyMgr.Instance.ShowTip("StarLevelUp2", config.CostItemDict.x); |
| | | return; |
| | | } |
| | | |
| | |
| | | |
| | | if (materialIndexs.Count < (config.CostEquipCnt + config.CostItemDict.x > 0 ? 1 : 0)) |
| | | { |
| | | //材料不足 |
| | | SysNotifyMgr.Instance.ShowTip("StarLevelUp3"); |
| | | return; |
| | | } |
| | | |
| | |
| | | var own = packModel.GetItemCountByID(PackType.Item, itemId); |
| | | if (need > own) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("WashStone1"); |
| | | return; |
| | | } |
| | | |
| | |
| | | public StrengthenProperty strengthenProperty; |
| | | public GemInfo gemInfo; |
| | | public TrainProperty trainProperty; |
| | | public List<ItemOperateType> operates; |
| | | } |
| | | |
| | | public struct BaseInfo |
| | |
| | | suitInfo = GetSuitInfo(guid), |
| | | strengthenProperty = GetStrengthenProperty(guid), |
| | | gemInfo = GetGemInfo(guid), |
| | | trainProperty = GetTrainProperty(guid) |
| | | trainProperty = GetTrainProperty(guid), |
| | | operates = GetOperates(guid), |
| | | }; |
| | | |
| | | if (tipType == EquipTipType.EquipCompare) |
| | |
| | | switch (type) |
| | | { |
| | | case EquipTipType.Equip: |
| | | case EquipTipType.EquipCompare: |
| | | WindowCenter.Instance.Open<EquipTipWin>(); |
| | | break; |
| | | case EquipTipType.Good: |
| | | WindowCenter.Instance.Open<GoodTipWin>(); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | public static void Operate(ItemOperateType type, string guid) |
| | | { |
| | | switch (type) |
| | | { |
| | | case ItemOperateType.putOn: |
| | | ItemOperateUtility.Instance.PutOnItem(guid); |
| | | break; |
| | | case ItemOperateType.putOff: |
| | | ItemOperateUtility.Instance.PutOffEquip(guid); |
| | | break; |
| | | case ItemOperateType.sell: |
| | | break; |
| | | } |
| | | } |
| | |
| | | var baseInfo = new BaseInfo() |
| | | { |
| | | itemId = item.itemId, |
| | | isAuction = item.isAuction , |
| | | isAuction = item.isAuction, |
| | | isEquiped = equipModel.GetEquip(item.config.LV, item.config.EquipPlace) == guid, |
| | | score = item.equipScore, |
| | | auctionSurplusTime = item.auctionSurplusTime, |
| | |
| | | |
| | | var ids = item.GetUseData(17); |
| | | var values = item.GetUseData(19); |
| | | if (!ids.IsNullOrEmpty() && values.IsNullOrEmpty()) |
| | | if (!ids.IsNullOrEmpty() && !values.IsNullOrEmpty()) |
| | | { |
| | | var properties = new List<Int2>(); |
| | | var count = Mathf.Min(ids.Count, values.Count); |
| | |
| | | return trainProperty; |
| | | } |
| | | |
| | | private static List<ItemOperateType> GetOperates(string guid) |
| | | { |
| | | var item = packModel.GetItemByGuid(guid); |
| | | if (item == null) |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | var operates = new List<ItemOperateType>(); |
| | | var equip = equipModel.GetEquip(item.config.LV, item.config.EquipPlace); |
| | | if (equip == guid) |
| | | { |
| | | operates.Add(ItemOperateType.putOff); |
| | | } |
| | | else |
| | | { |
| | | operates.Add(ItemOperateType.putOn); |
| | | } |
| | | |
| | | return operates; |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | private void InitOperateButton() |
| | | { |
| | | if (string.IsNullOrEmpty(EquipTipUtility.mainTipData.guid)) |
| | | var operates = EquipTipUtility.mainTipData.operates; |
| | | var guid = EquipTipUtility.mainTipData.guid; |
| | | if (operates.IsNullOrEmpty()) |
| | | { |
| | | foreach (var button in m_OpreateButtons) |
| | | for (int i = 0; i < m_OpreateButtons.Length; i++) |
| | | { |
| | | var button = m_OpreateButtons[i]; |
| | | button.SetActive(false); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | var actions = new Dictionary<ItemOperateType, UnityAction>(); |
| | | if (EquipTipUtility.mainTipData.baseInfo.isAuction) |
| | | { |
| | | actions[ItemOperateType.putAway] = () => { }; |
| | | } |
| | | else |
| | | { |
| | | |
| | | |
| | | } |
| | | |
| | | var actionKeys = new List<ItemOperateType>(actions.Keys); |
| | | for (int i = 0; i < m_OpreateButtons.Length; i++) |
| | | { |
| | | var button = m_OpreateButtons[i]; |
| | | if (i < actionKeys.Count) |
| | | if (i < operates.Count) |
| | | { |
| | | var action = actions[actionKeys[i]]; |
| | | button.SetActive(true); |
| | | button.Bind(actionKeys[i], action); |
| | | button.Bind(operates[i], guid); |
| | | } |
| | | else |
| | | { |
| | | button.SetActive(false); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | #endregion |
| | |
| | | public Button button; |
| | | public Text title; |
| | | |
| | | ItemOperateType operateType; |
| | | string guid; |
| | | |
| | | public void SetActive(bool active) |
| | | { |
| | | container.gameObject.SetActive(active); |
| | | } |
| | | |
| | | public void Bind(ItemOperateType type, UnityAction action) |
| | | public void Bind(ItemOperateType type, string guid) |
| | | { |
| | | operateType = type; |
| | | this.guid = guid; |
| | | switch (type) |
| | | { |
| | | case ItemOperateType.makeUse: |
| | | this.title.text = "使用"; |
| | | case ItemOperateType.putOn: |
| | | this.title.text = "穿上"; |
| | | break; |
| | | case ItemOperateType.inlay: |
| | | this.title.text = "使用"; |
| | | case ItemOperateType.putOff: |
| | | this.title.text = "脱下"; |
| | | break; |
| | | default: |
| | | this.title.text = ""; |
| | | break; |
| | | } |
| | | |
| | | this.button.SetListener(action); |
| | | button.SetListener(() => |
| | | { |
| | | EquipTipUtility.Operate(operateType, this.guid); |
| | | WindowCenter.Instance.Close<EquipTipWin>(); |
| | | }); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | public void Display(EquipTipUtility.BaseProperty data) |
| | | { |
| | | var count = data.baseProperties.Count; |
| | | var lines = new string[count]; |
| | | for (int i = 0; i < count; i++) |
| | | var attack = Int3.zero; |
| | | var normalProperties = new List<Int3>(); |
| | | foreach (var item in data.baseProperties) |
| | | { |
| | | var baseProperty = data.baseProperties[i]; |
| | | var config = PlayerPropertyConfig.Get(baseProperty.x); |
| | | var name = config.Name; |
| | | var baseValue = PlayerPropertyConfig.GetPropertyDescription(baseProperty.x, baseProperty.y); |
| | | |
| | | if (data.star > 0) |
| | | switch ((AttrEnum)item.x) |
| | | { |
| | | var starProperty = data.starProperties[i]; |
| | | var starValue = PlayerPropertyConfig.GetPropertyDescription(starProperty.x, starProperty.y); |
| | | case AttrEnum.MinAtk: |
| | | case AttrEnum.PetMinAtk: |
| | | attack.x = item.y; |
| | | break; |
| | | case AttrEnum.MaxAtk: |
| | | case AttrEnum.PetMaxAtk: |
| | | attack.y = item.y; |
| | | break; |
| | | default: |
| | | normalProperties.Add(new Int3(item.x, item.y)); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (data.star > 0) |
| | | { |
| | | foreach (var item in data.starProperties) |
| | | { |
| | | switch ((AttrEnum)item.x) |
| | | { |
| | | case AttrEnum.ATK: |
| | | attack.z = item.y; |
| | | break; |
| | | default: |
| | | var index = normalProperties.FindIndex(x => { return x.x == item.x; }); |
| | | if (index != -1) |
| | | { |
| | | var property = normalProperties[index]; |
| | | normalProperties[index] = new Int3(property.x, property.y, item.y); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | var count = attack != Int3.zero ? 1 + normalProperties.Count : normalProperties.Count; |
| | | var lines = new string[count]; |
| | | var lineIndex = 0; |
| | | if (attack != Int3.zero) |
| | | { |
| | | var config = PlayerPropertyConfig.Get((int)AttrEnum.ATK); |
| | | var name = config.Name; |
| | | |
| | | if (attack.z > 0) |
| | | { |
| | | var starValue = PlayerPropertyConfig.GetPropertyDescription((int)AttrEnum.ATK, attack.z); |
| | | var starDescription = UIHelper.AppendColor(TextColType.Green, string.Format("({0}星+{1})", data.star, starValue)); |
| | | lines[i] = string.Format("{0}:{1} {2}", name, baseValue, starDescription); |
| | | lines[lineIndex++] = string.Format("{0}:{1}-{2} {3}", name, attack.x, attack.y, starDescription); |
| | | } |
| | | else |
| | | { |
| | | lines[i] = string.Format("{0}:{1} ", name, baseValue); |
| | | lines[lineIndex++] = string.Format("{0}:{1}-{2}", name, attack.x, attack.y); |
| | | } |
| | | } |
| | | |
| | | foreach (var property in normalProperties) |
| | | { |
| | | var config = PlayerPropertyConfig.Get(property.x); |
| | | var name = config.Name; |
| | | var baseValue = PlayerPropertyConfig.GetPropertyDescription(property.x, property.y); |
| | | |
| | | if (property.z > 0) |
| | | { |
| | | var starValue = PlayerPropertyConfig.GetPropertyDescription(property.x, property.z); |
| | | var starDescription = UIHelper.AppendColor(TextColType.Green, string.Format("({0}星+{1})", data.star, starValue)); |
| | | lines[lineIndex++] = string.Format("{0}:{1} {2}", name, baseValue, starDescription); |
| | | } |
| | | else |
| | | { |
| | | lines[lineIndex++] = string.Format("{0}:{1} ", name, baseValue); |
| | | } |
| | | } |
| | | |
| | |
| | | WindowCenter.Instance.Open<BoxInfoWin>();
|
| | | break;
|
| | | case ItemWinType.equipWin:
|
| | | WindowCenter.Instance.Open<EquipWin>();
|
| | | if (curAttrData.isPreview)
|
| | | {
|
| | | EquipTipUtility.Show(curAttrData.isCompare ? EquipTipType.EquipCompare : EquipTipType.Equip, curAttrData.itemId);
|
| | | }
|
| | | else
|
| | | {
|
| | | EquipTipUtility.Show(curAttrData.isCompare ? EquipTipType.EquipCompare : EquipTipType.Equip, curAttrData.guid);
|
| | | }
|
| | | break;
|
| | | case ItemWinType.wingsWin:
|
| | | WindowCenter.Instance.Open<WingsWin>();
|