| | |
| | | public class RealmRecommandEquipWin : Window
|
| | | {
|
| | | [SerializeField] Text m_InfoText;
|
| | | [SerializeField] TextEx[] m_EquipTexts;
|
| | | [SerializeField] Button m_Goto;
|
| | | [SerializeField] Button m_GetWays;
|
| | | [SerializeField] RichText[] m_EquipTexts;
|
| | | [SerializeField] Button[] m_EquipGetWay;
|
| | | [SerializeField] Button m_Close;
|
| | | [SerializeField] Text m_WayText;
|
| | |
|
| | | RealmModel model { get { return ModelCenter.Instance.GetModel<RealmModel>(); } }
|
| | | PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
|
| | |
| | |
|
| | | protected override void AddListeners()
|
| | | {
|
| | | m_Goto.AddListener(Goto);
|
| | | m_GetWays.AddListener(OnGetWay);
|
| | | m_Close.AddListener(CloseClick);
|
| | | for (int i = 0; i < m_EquipGetWay.Length; i++)
|
| | | {
|
| | | m_EquipGetWay[i].AddListener(OnGetWay);
|
| | | }
|
| | | }
|
| | |
|
| | | protected override void OnPreOpen()
|
| | | {
|
| | | var config = RealmLVUPTaskConfig.Get(functionOrder);
|
| | | if (config == null)
|
| | | return;
|
| | |
|
| | | int error;
|
| | | model.SatisfyEquipCondition(config, out error);
|
| | | model.realmUpgrateNoEnoughReason = error;
|
| | |
|
| | | Display();
|
| | | }
|
| | |
|
| | |
| | | };
|
| | | var equipSet = equipModel.GetEquipSet(equipCondition.level);
|
| | | var realmConfig = RealmConfig.Get(equipSet.realm);
|
| | | if (!equipCondition.isSuit)
|
| | | {
|
| | | var colorName = UIHelper.GetColorNameByItemColor(equipCondition.itemColor);
|
| | | m_InfoText.text = Language.Get("RealmNeedEquipCondition_1", realmConfig.NameEx, colorName, equipCondition.starLevel, 8);
|
| | | }
|
| | | else
|
| | | {
|
| | | m_InfoText.text = Language.Get("RealmNeedEquipCondition_2", realmConfig.NameEx, equipCondition.starLevel, 8);
|
| | | }
|
| | |
|
| | | notSatisfyPlaces = new List<int>();
|
| | | model.SatisfyEquipCondition(model.equipNeedConfig, out notSatisfyPlaces);
|
| | |
|
| | | // 1. 没有装备引导获得途径 2. 背包中有更好的装备引导穿戴 3.引导升星
|
| | | m_WayText.text = Language.Get(model.realmUpgrateNoEnoughReason == 2 ? "gotoEquipStar" : "RealmRecommandEquipWin__2");
|
| | | if (!equipCondition.isSuit)
|
| | | {
|
| | | var colorName = UIHelper.GetColorNameByItemColor(equipCondition.itemColor);
|
| | | m_InfoText.text = Language.Get("RealmNeedEquipCondition_1", realmConfig.NameEx, colorName, equipCondition.starLevel, 8)
|
| | | + " (" + Language.Get("BlessedLand036", 8 - notSatisfyPlaces.Count, 8) + ")";
|
| | | }
|
| | | else
|
| | | {
|
| | | m_InfoText.text = Language.Get("RealmNeedEquipCondition_2", realmConfig.NameEx, equipCondition.starLevel, 8)
|
| | | + " (" + Language.Get("BlessedLand036", 8 - notSatisfyPlaces.Count, 8) + ")";
|
| | | }
|
| | |
|
| | |
|
| | | |
| | | int[] recommandEquips;
|
| | | model.TryGetRecommandEquips(equipCondition.level, PlayerDatas.Instance.baseData.Job, model.equipNeedConfig.NeedValueList[3], out recommandEquips);
|
| | | for (int i = 0; i < m_EquipTexts.Length; i++)
|
| | | {
|
| | | int place = i + 1;
|
| | | var itemConfig = ItemConfig.Get(recommandEquips[i]);
|
| | | string equipName = StringUtility.Contact(itemConfig.ItemName, " ", Language.Get("EquipStarLevel", equipCondition.starLevel));
|
| | | m_EquipTexts[i].text = UIHelper.AppendColor(notSatisfyPlaces.Contains(place) ? TextColType.Gray : TextColType.Green, equipName, true);
|
| | | }
|
| | | int equipState = 0; // 0 完成 1. 没有装备引导获得途径 2. 背包中有更好的装备引导穿戴 3.引导升星
|
| | | int curStarLevel = 0;
|
| | | int targetStarLevel = equipCondition.starLevel;
|
| | |
|
| | |
|
| | | if (model.realmUpgrateNoEnoughReason != 2)
|
| | | {
|
| | | var existBetterEquip = false;
|
| | | for (int i = 0; i < notSatisfyPlaces.Count; i++)
|
| | | var equipGuid = equipModel.GetEquip(new Int2(equipCondition.level, place));
|
| | | var itemModel = packModel.GetItemByGuid(equipGuid);
|
| | | if (itemModel != null)
|
| | | {
|
| | | var place = notSatisfyPlaces[i];
|
| | | if (equipCondition.isSuit)
|
| | | {
|
| | | if (itemModel.config.SuiteiD == 0)
|
| | | {
|
| | | equipState = 1;
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | if (itemModel.config.ItemColor < equipCondition.itemColor)
|
| | | {
|
| | | equipState = 1;
|
| | | }
|
| | | }
|
| | |
|
| | | curStarLevel = equipStarModel.GetEquipStarLevel(new Int2(equipCondition.level, place));
|
| | |
|
| | | if (curStarLevel < targetStarLevel)
|
| | | {
|
| | | equipState = 3;
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | equipState = 1;
|
| | | }
|
| | |
|
| | | //查找背包中是否有更好的装备
|
| | | if (equipState == 1)
|
| | | {
|
| | | var items = packModel.GetItems(PackType.Item, new SinglePack.FilterParams()
|
| | | {
|
| | | levels = new List<int>() { equipCondition.level },
|
| | |
| | | {
|
| | | foreach (var item in items)
|
| | | {
|
| | | if (equipCondition.isSuit && item.config.SuiteiD > 0)
|
| | | if ((equipCondition.isSuit && item.config.SuiteiD > 0) ||
|
| | | (!equipCondition.isSuit && item.config.ItemColor >= equipCondition.itemColor))
|
| | | {
|
| | | existBetterEquip = true;
|
| | | break;
|
| | | }
|
| | | if (!equipCondition.isSuit && item.config.ItemColor >= equipCondition.itemColor)
|
| | | {
|
| | | existBetterEquip = true;
|
| | | equipState = 2;
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | if (existBetterEquip)
|
| | | {
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | m_Goto.SetActive(existBetterEquip);
|
| | | m_GetWays.SetActive(!existBetterEquip);
|
| | | var itemConfig = ItemConfig.Get(recommandEquips[i]);
|
| | | string suffix = string.Empty;
|
| | | if (equipState == 0)
|
| | | {
|
| | | suffix = StringUtility.Contact("(", Language.Get("TaskWin_Btn_Finish"), ")");
|
| | | m_EquipGetWay[i].RemoveAllListeners();
|
| | | }
|
| | | else if (equipState == 1)
|
| | | {
|
| | | suffix = StringUtility.Contact("<color=#ff0000><a>", Language.Get("HolidayXianXiaMJLotterynWin__1"), "</a></color>");
|
| | | m_EquipGetWay[i].AddListener(OnGetWay);
|
| | | }
|
| | | else if (equipState == 2)
|
| | | {
|
| | | suffix = StringUtility.Contact("<color=#ff0000><a>", Language.Get("RealmRecommandEquipWin__2"), "</a></color>");
|
| | | m_EquipGetWay[i].AddListener(() => {
|
| | | Goto(2);
|
| | | });
|
| | | }
|
| | | else if (equipState == 3)
|
| | | {
|
| | | suffix = StringUtility.Contact("<color=#ff0000><a>", Language.Get("gotoEquipStar"), "</a></color>");
|
| | | m_EquipGetWay[i].AddListener(() => {
|
| | | Goto(1);
|
| | | });
|
| | | }
|
| | | string equipName = StringUtility.Contact(itemConfig.ItemName, " ", |
| | | Language.Get("EquipStarLevel", Language.Get("BlessedLand036", curStarLevel, targetStarLevel)), " ", suffix);
|
| | | m_EquipTexts[i].text = UIHelper.AppendColor(notSatisfyPlaces.Contains(place) ? TextColType.Gray : TextColType.Green, equipName, true);
|
| | | }
|
| | | else
|
| | | {
|
| | | m_Goto.SetActive(true); //装备升星
|
| | | m_GetWays.SetActive(false);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | private void OnGetWay()
|
| | |
| | | WindowCenter.Instance.Open<RealmRecommandEquipGetWayWin>();
|
| | | }
|
| | |
|
| | | private void Goto()
|
| | | private void Goto(int state)
|
| | | {
|
| | | if (model.realmUpgrateNoEnoughReason != 2)
|
| | | if (state == 2)
|
| | | {
|
| | | equipModel.SelectSet(equipCondition.level);
|
| | | WindowCenter.Instance.Open<KnapSackWin>(false, 0);
|