using vnxbqy.UI;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
class BreachSuccessWin : ILWindow
|
{
|
|
Transform attGridContainer;
|
Transform prefabs;
|
RawImage equShow;
|
Button bgBtn;
|
Text powerText;
|
UIEffect uiEffect;
|
|
List<AttGridBehaviour> attGridBehaviours = new List<AttGridBehaviour>();
|
|
protected override void BindController()
|
{
|
base.BindController();
|
this.attGridContainer = this.transform.Find("Container_AttrGrid");
|
this.prefabs = this.transform.Find("Prefabs");
|
this.equShow = this.transform.FindComponentEx<RawImage>("Cotainer_Bg/EquShow");
|
this.bgBtn = this.transform.FindComponentEx<Button>("Img_BG");
|
this.powerText = this.transform.FindComponentEx<Text>("Conatainer_Power/Text_Power");
|
this.uiEffect = this.transform.FindComponentEx<UIEffect>("UIEffect");
|
}
|
|
protected override void AddListeners()
|
{
|
base.AddListeners();
|
this.bgBtn.SetListener(() =>
|
{
|
WindowCenter.Instance.CloseIL<BreachSuccessWin>();
|
});
|
}
|
|
protected override void OnPreOpen()
|
{
|
base.OnPreOpen();
|
this.uiEffect.Play();
|
this.RefreshUI();
|
}
|
|
void RefreshUI()
|
{
|
var beforeItemID = SpiritEquipModel.Instance.beforeBeachItemID;
|
var afterItemID = SpiritEquipModel.Instance.afterBeachItemID;
|
|
var beforeConfig = SpiritWeaponConfig.Get(beforeItemID);
|
var afterConfig = SpiritWeaponConfig.Get(afterItemID);
|
var attrCount = afterConfig.AttrIDList.Length;
|
|
//展示模型
|
if (SpiritEquipModel.Instance.curEquType == RoleEquipType.Wing)
|
UI3DModelExhibition.Instance.ShowWing(afterConfig.NPCID, this.equShow);
|
else if (SpiritEquipModel.Instance.curEquType == RoleEquipType.Guard)
|
UI3DModelExhibition.Instance.ShowNPC(afterConfig.NPCID, new Vector3(0, -45, 0), this.equShow, false, false);
|
else
|
UI3DModelExhibition.Instance.ShowEquipment(ItemConfig.Get(afterItemID).ChangeOrd, afterConfig.Rotation, afterConfig.scale, this.equShow);
|
//展示战力
|
var power = EquipFightPower.Instance.GetSpiritWeaponPower(afterItemID);
|
this.powerText.text = power.ToString();
|
|
var beforeAttrValueTable = new Dictionary<int, int>();
|
for (int i = 0; i < beforeConfig.AttrIDList.Length; i++)
|
{
|
beforeAttrValueTable[beforeConfig.AttrIDList[i]] = beforeConfig.AttrValueList[i];
|
}
|
|
var beforeAttrs = SpiritEquipModel.Instance.GetBaseProperty(beforeItemID).baseProperties;
|
var afterBaseAttrs = SpiritEquipModel.Instance.GetBaseProperty(afterItemID).baseProperties;
|
var baseAttrCount = afterBaseAttrs.Count;
|
|
var totalAttrCount = attrCount + baseAttrCount;
|
var lerpCount = totalAttrCount - this.attGridBehaviours.Count;
|
|
var attGridPrefab = this.prefabs.Find("AttGrid");
|
for (int i = 1; i <= lerpCount; i++)
|
{
|
var attGrid = GameObject.Instantiate(attGridPrefab, this.attGridContainer);
|
attGrid.SetActiveIL(true);
|
attGrid.localScale = Vector3.one;
|
var attGridBehaviour = new AttGridBehaviour();
|
attGridBehaviour.BindController(attGrid);
|
attGridBehaviours.Add(attGridBehaviour);
|
}
|
|
for (int i = 0; i < attGridBehaviours.Count; i++)
|
{
|
var index = i + 1;
|
var behaviour = attGridBehaviours[i];
|
if (index > totalAttrCount)
|
behaviour.transform.SetActive(false);
|
else
|
{
|
behaviour.transform.SetActive(true);
|
PlayerPropertyConfig attrConfig;
|
var nowAttrValue = 0;
|
var afterAttrValue = 0;
|
if (index > baseAttrCount)
|
{
|
var id = index - baseAttrCount;
|
afterAttrValue = afterConfig.AttrValueList[id - 1];
|
attrConfig = PlayerPropertyConfig.Get(afterConfig.AttrIDList[id - 1]);
|
beforeAttrValueTable.TryGetValue(afterConfig.AttrIDList[id - 1], out nowAttrValue);
|
}
|
else
|
{
|
afterAttrValue = afterBaseAttrs[index - 1].y;
|
attrConfig = PlayerPropertyConfig.Get(afterBaseAttrs[index - 1].x);
|
if (index - 1 < beforeAttrs.Count)
|
nowAttrValue = beforeAttrs[index - 1].y;
|
else
|
attrConfig = PlayerPropertyConfig.Get(afterBaseAttrs[index - 1].x);
|
}
|
|
var bIsPerAttr = attrConfig.ISPercentage == 1;
|
var attrName = "";
|
var attrBeforeStr = "";
|
var attrAfterStr = "";
|
//if (bIsPerAttr)
|
// valueUnit = "%";
|
|
attrName = attrConfig.Name + ':';
|
attrBeforeStr = PlayerPropertyConfig.GetValueDescription(attrConfig.ID, nowAttrValue, false);
|
attrAfterStr = PlayerPropertyConfig.GetValueDescription(attrConfig.ID, afterAttrValue, false);
|
behaviour.Init(attrName, attrBeforeStr, attrAfterStr);
|
}
|
}
|
}
|
}
|