| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | public class MinggeSmallTipWin : UIBase |
| | | { |
| | | [SerializeField] Text m_text; |
| | | protected override void InitComponent() |
| | | { |
| | | [SerializeField] RectTransform content; |
| | | [SerializeField] RectTransform arrow; |
| | | [SerializeField] MinggeItemCell itemCell; |
| | | [SerializeField] Text itemName; |
| | | [SerializeField] OutlineEx itemNameOutline; |
| | | [SerializeField] List<TextEx> fightAttrNames; |
| | | [SerializeField] List<TextEx> fightAttrValues; |
| | | [SerializeField] TextEx[] skillDesces; |
| | | |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | |
| | | Display(); |
| | | |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | protected override void NextFrameAfterOpen() |
| | | { |
| | | var worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition); |
| | | |
| | | |
| | | Vector2 screenAdjustedPos = CameraManager.uiCamera.WorldToScreenPoint(worldPos); |
| | | |
| | | var beforePos = screenAdjustedPos; |
| | | var beforeAdjustedPos = CameraManager.uiCamera.ScreenToWorldPoint(beforePos); |
| | | |
| | | var rectWidth = content.rect.width * Screen.width / canvasScaler.referenceResolution.x; |
| | | screenAdjustedPos.x = Mathf.Clamp(screenAdjustedPos.x, rectWidth * 0.5f, Screen.width - rectWidth * 0.5f); |
| | | screenAdjustedPos.y -= 40; |
| | | var adjustedPos = CameraManager.uiCamera.ScreenToWorldPoint(screenAdjustedPos); |
| | | adjustedPos.z = 0; |
| | | content.position = adjustedPos; |
| | | |
| | | arrow.position = new Vector3(beforeAdjustedPos.x, arrow.position.y, 0); |
| | | } |
| | | |
| | | |
| | | void Display() |
| | | public void Display() |
| | | { |
| | | var guid = ItemTipUtility.mainTipData.guid; |
| | | if (string.IsNullOrEmpty(guid)) |
| | | { |
| | | DelayCloseWindow().Forget(); |
| | | return; |
| | | } |
| | | var equip = PackManager.Instance.GetItemByGuid(guid); |
| | | |
| | | itemCell.Display(equip.guid); |
| | | string qualityName = Language.Get("L1039", MGGuayuQualityConfig.Get(equip.config.ItemColor).ColorName); |
| | | itemName.text = UIHelper.AppendColor(equip.config.ItemColor, qualityName + equip.config.ItemName, true, 2); |
| | | itemNameOutline.OutlineColor = UIHelper.GetUIOutlineColor(equip.config.ItemColor); |
| | | |
| | | |
| | | |
| | | var fightAttrs = EquipModel.Instance.GetEquipFightAttrs(equip); |
| | | var fightValues = EquipModel.Instance.GetEquipFightValues(equip); |
| | | |
| | | |
| | | for (var i = 0; i < fightAttrNames.Count; i++) |
| | | { |
| | | if (i >= fightAttrs.Count) |
| | | { |
| | | //显示锁住 |
| | | fightAttrNames[i].text = "?"; |
| | | fightAttrNames[i].colorType = TextColType.NavyGray; |
| | | fightAttrValues[i].text = Language.Get("Mingge27", MinggeManager.Instance.unlockAttrLVList[i - 1] - 1); |
| | | fightAttrValues[i].colorType = TextColType.NavyGray; |
| | | } |
| | | else |
| | | { |
| | | fightAttrNames[i].text = PlayerPropertyConfig.Get(fightAttrs[i]).Name; |
| | | fightAttrNames[i].colorType = TextColType.lightYellow; |
| | | fightAttrValues[i].text = PlayerPropertyConfig.GetValueDescription(fightAttrs[i], fightValues[i]); |
| | | fightAttrValues[i].colorType = TextColType.lightYellow; |
| | | } |
| | | } |
| | | |
| | | //技能描述 所有技能全显示 |
| | | var skillID = EquipModel.Instance.GetEquipSkillID(equip); |
| | | if (skillID == 0) |
| | | { |
| | | for (int i = 0; i < skillDesces.Length; i++) |
| | | { |
| | | skillDesces[i].SetActive(false); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | var dict = MinggeManager.Instance.GetMinggeSkillTypeIDDict(); |
| | | //如果是旧装备 显示当前数量;新装备不同技能数量+1,同技能不变 |
| | | var hasCnt = dict[skillID].Count; |
| | | for (int i = 0; i < skillDesces.Length; i++) |
| | | { |
| | | skillDesces[i].SetActive(true); |
| | | skillDesces[i].colorType = i == hasCnt - 1 ? TextColType.lightYellow : TextColType.NavyGray; |
| | | var showCnt = Math.Min(hasCnt, i + 1); |
| | | skillDesces[i].text = SkillConfig.Get(skillID).Description + " " + Language.Get("HeroFates11", showCnt, i + 1); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |