From c5adf3e22a5cdfb185a4befc22ef0cd079a7eb33 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期二, 02 九月 2025 22:30:10 +0800
Subject: [PATCH] 117 【武将】武将系统 - 天赋显示,修复描边文字遇到mask问题
---
Main/Utility/EnumHelper.cs | 4
Main/System/HeroUI/HeroUIManager.Gift.cs | 31 ++
Main/System/HeroUI/GiftBaseCell.cs | 18 +
Main/System/SkillUI/SkillWordCell.cs | 13 +
Main/Component/UI/Core/OutlineEx.cs | 418 +++++++++++++++-------------------
Main/System/HeroUI/HeroUIManager.Gift.cs.meta | 2
Main/System/Hero/HeroInfo.Talent.cs | 35 ++
/dev/null | 26 --
Main/Utility/UIHelper.cs | 4
Main/System/SkillUI/SkillBaseCell.cs | 13 +
Main/Config/PartialConfigs/HeroAwakeConfig.cs | 18 +
Main/System/HeroUI/HeroShowBaseCell.cs | 13 +
Main/System/HeroUI/HeroHeadBaseCell.cs | 13 +
Main/System/HeroUI/HeroTrainWin.cs | 73 +++++
Main/System/HeroUI/HeroUIManager.cs | 1
15 files changed, 393 insertions(+), 289 deletions(-)
diff --git a/Main/Component/UI/Core/OutlineEx.cs b/Main/Component/UI/Core/OutlineEx.cs
index a5c6940..62ef5c2 100644
--- a/Main/Component/UI/Core/OutlineEx.cs
+++ b/Main/Component/UI/Core/OutlineEx.cs
@@ -40,66 +40,86 @@
public int OutlineWidth = 10;
private static List<UIVertex> m_VetexList = new List<UIVertex>();
- // 鏉愯川姹狅細Key涓�"棰滆壊_瀹藉害"鏍煎紡鐨勫瓧绗︿覆锛孷alue涓哄搴旂殑鏉愯川; 鍑忓皯鍚堟壒闂锛屽張鑳戒繚鎸佷笉鍚岀殑鎻忚竟锛涘叡鐢ㄦ潗璐ㄤ細鍚屾椂鏀瑰彉鍙傛暟
- private static Dictionary<string, Material> m_MaterialPool = new Dictionary<string, Material>();
- static Shader m_tmpShader;
- private static Shader m_Shader
+ protected override void Awake()
{
- get
+ base.Awake();
+
+ if (base.graphic)
{
- if (m_tmpShader == null)
+ if (base.graphic.material == null || base.graphic.material.shader.name != "TSF Shaders/UI/OutlineEx")
{
- m_tmpShader = Shader.Find("TSF Shaders/UI/OutlineEx");
+// #if UNITY_EDITOR
+
+ var texMaterial = ResManager.Instance.LoadAsset<Material>("Materials", "OutlineMat");
+ if (texMaterial != null)
+ {
+ base.graphic.material = texMaterial;
+ }
+ else
+ {
+ Debug.LogError("娌℃湁鎵惧埌鏉愯川OutlineMat.mat");
+ }
+// #else
+// var shader = Shader.Find("TSF Shaders/UI/OutlineEx");
+// base.graphic.material = new Material(shader);
+// #endif
}
- return m_tmpShader;
+
+ if (base.graphic.canvas)
+ {
+ var v1 = base.graphic.canvas.additionalShaderChannels;
+ var v2 = AdditionalCanvasShaderChannels.TexCoord1;
+ if ((v1 & v2) != v2)
+ {
+ base.graphic.canvas.additionalShaderChannels |= v2;
+ }
+ v2 = AdditionalCanvasShaderChannels.TexCoord2;
+ if ((v1 & v2) != v2)
+ {
+ base.graphic.canvas.additionalShaderChannels |= v2;
+ }
+ v2 = AdditionalCanvasShaderChannels.TexCoord3;
+ if ((v1 & v2) != v2)
+ {
+ base.graphic.canvas.additionalShaderChannels |= v2;
+ }
+ v2 = AdditionalCanvasShaderChannels.Tangent;
+ if ((v1 & v2) != v2)
+ {
+ base.graphic.canvas.additionalShaderChannels |= v2;
+ }
+ v2 = AdditionalCanvasShaderChannels.Normal;
+ if ((v1 & v2) != v2)
+ {
+ base.graphic.canvas.additionalShaderChannels |= v2;
+ }
+ }
+ this._Refresh();
}
}
-
- protected override void Start()
- {
- base.Start();
-
- // 浣跨敤鏉愯川姹犺幏鍙栨垨鍒涘缓鏉愯川
- string key = GetMaterialKey(OutlineColor, OutlineWidth);
- if (!m_MaterialPool.TryGetValue(key, out Material material))
- {
- material = new Material(m_Shader);
- material.SetColor("_OutlineColor", this.OutlineColor);
- material.SetInt("_OutlineWidth", this.OutlineWidth);
- m_MaterialPool[key] = material;
- }
- base.graphic.material = material;
-
- var v1 = base.graphic.canvas.additionalShaderChannels;
- var v2 = AdditionalCanvasShaderChannels.TexCoord1;
- if ((v1 & v2) != v2)
- {
- base.graphic.canvas.additionalShaderChannels |= v2;
- }
- v2 = AdditionalCanvasShaderChannels.TexCoord2;
- if ((v1 & v2) != v2)
- {
- base.graphic.canvas.additionalShaderChannels |= v2;
- }
-
- this._Refresh();
- }
-
+
#if UNITY_EDITOR
- //鍦ㄧ紪杈戝櫒涓嬫墦寮�涔熷埛鏂颁笅
- // protected override void OnEnable()
- // {
- // base.OnEnable();
- // this._Refresh();
- // }
-
protected override void OnValidate()
{
base.OnValidate();
if (base.graphic.material != null)
{
+ if (base.graphic.material.shader.name != "TSF Shaders/UI/OutlineEx")
+ {
+ var texMaterial = ResManager.Instance.LoadAsset<Material>("Materials", "OutlineMat");
+ if (texMaterial != null)
+ {
+ base.graphic.material = texMaterial;
+ }
+ else
+ {
+ Debug.LogError("娌℃湁鎵惧埌鏉愯川OutlineMat.mat");
+ }
+ //var shader = Shader.Find("TSF Shaders/UI/OutlineEx");
+ //base.graphic.material = new Material(shader);
+ }
this._Refresh();
}
}
@@ -108,218 +128,144 @@
private void _Refresh()
{
- // 妫�鏌ュ綋鍓嶆潗璐ㄦ槸鍚︿笌鎵�闇�灞炴�у尮閰嶏紝濡傛灉涓嶅尮閰嶅垯浠庢睜涓幏鍙栨垨鍒涘缓鏂版潗璐�
- string key = GetMaterialKey(OutlineColor, OutlineWidth);
- Material material;
- if (!m_MaterialPool.TryGetValue(key, out material))
+ /*if (base.graphic.material.GetInt("_OutlineWidth") != this.OutlineWidth || base.graphic.material.GetColor("_OutlineColor") != this.OutlineColor)
{
- // 濡傛灉姹犱腑娌℃湁瀵瑰簲鐨勬潗璐紝鍒涘缓鏂版潗璐�
- var shader = Shader.Find("TSF Shaders/UI/OutlineEx");
- material = new Material(shader);
- m_MaterialPool[key] = material;
- }
-
- if (material == null)
- {
- // 闃茶寖鏉愯川琚垹鐨勬儏鍐碉紝鍒涘缓鏂版潗璐�
- material = new Material(m_Shader);
- m_MaterialPool[key] = material;
- }
-
- material.SetColor("_OutlineColor", this.OutlineColor);
- material.SetInt("_OutlineWidth", this.OutlineWidth);
-
- // 鏇存柊鍥惧舰鏉愯川
- base.graphic.material = material;
+ base.graphic.material.SetColor("_OutlineColor", this.OutlineColor);
+ base.graphic.material.SetInt("_OutlineWidth", this.OutlineWidth);
+ }*/
base.graphic.SetVerticesDirty();
}
- public override void ModifyMesh(VertexHelper vh)
- {
- vh.GetUIVertexStream(m_VetexList);
-
- this._ProcessVertices();
-
- vh.Clear();
- vh.AddUIVertexTriangleStream(m_VetexList);
- }
-
-
- private void _ProcessVertices()
- {
- for (int i = 0, count = m_VetexList.Count - 3; i <= count; i += 3)
+public override void ModifyMesh(VertexHelper vh)
{
- var v1 = m_VetexList[i];
- var v2 = m_VetexList[i + 1];
- var v3 = m_VetexList[i + 2];
- // 璁$畻鍘熼《鐐瑰潗鏍囦腑蹇冪偣
- //
- var minX = _Min(v1.position.x, v2.position.x, v3.position.x);
- var minY = _Min(v1.position.y, v2.position.y, v3.position.y);
- var maxX = _Max(v1.position.x, v2.position.x, v3.position.x);
- var maxY = _Max(v1.position.y, v2.position.y, v3.position.y);
- var posCenter = new Vector2(minX + maxX, minY + maxY) * 0.5f;
- // 璁$畻鍘熷椤剁偣鍧愭爣鍜孶V鐨勬柟鍚�
- //
- Vector2 triX, triY, uvX, uvY;
- Vector2 pos1 = v1.position;
- Vector2 pos2 = v2.position;
- Vector2 pos3 = v3.position;
- if (Mathf.Abs(Vector2.Dot((pos2 - pos1).normalized, Vector2.right))
- > Mathf.Abs(Vector2.Dot((pos3 - pos2).normalized, Vector2.right)))
- {
- triX = pos2 - pos1;
- triY = pos3 - pos2;
- uvX = v2.uv0 - v1.uv0;
- uvY = v3.uv0 - v2.uv0;
- }
- else
- {
- triX = pos3 - pos2;
- triY = pos2 - pos1;
- uvX = v3.uv0 - v2.uv0;
- uvY = v2.uv0 - v1.uv0;
- }
- // 璁$畻鍘熷UV妗�
- //
- var uvMin = _Min(v1.uv0, v2.uv0, v3.uv0);
- var uvMax = _Max(v1.uv0, v2.uv0, v3.uv0);
- var uvOrigin = new Vector4(uvMin.x, uvMin.y, uvMax.x, uvMax.y);
+ vh.GetUIVertexStream(m_VetexList);
- // 涓烘瘡涓《鐐硅缃柊鐨凱osition鍜孶V锛屽苟浼犲叆鍘熷UV妗�
- v1 = _SetNewPosAndUV(v1, this.OutlineWidth, posCenter, triX, triY, uvX, uvY, uvOrigin);
- v2 = _SetNewPosAndUV(v2, this.OutlineWidth, posCenter, triX, triY, uvX, uvY, uvOrigin);
- v3 = _SetNewPosAndUV(v3, this.OutlineWidth, posCenter, triX, triY, uvX, uvY, uvOrigin);
+ this._ProcessVertices();
- // 鑾峰彇 RectMask2D 鐨勮竟鐣�
- // 纭繚鎻忚竟椤剁偣鎵╁睍涓嶄細瓒呭嚭 RectMask2D 鐨勮竟鐣�
-
- var mask = GetComponentInParent<RectMask2D>();
- if (mask != null)
- {
- // 灏嗗眬閮ㄥ潗鏍囪浆鎹负灞忓箷鍧愭爣
-
- Transform uiTransform = this.transform;
- Vector3 worldPos1 = uiTransform.TransformPoint(v1.position);
- Vector3 worldPos2 = uiTransform.TransformPoint(v2.position);
- Vector3 worldPos3 = uiTransform.TransformPoint(v3.position);
-
- Vector2 screenPos1 = CameraManager.uiCamera.WorldToScreenPoint(worldPos1);
- Vector2 screenPos2 = CameraManager.uiCamera.WorldToScreenPoint(worldPos2);
- Vector2 screenPos3 = CameraManager.uiCamera.WorldToScreenPoint(worldPos3);
-
-
-
- // 纭繚鎻忚竟椤剁偣鎵╁睍涓嶄細瓒呭嚭 RectMask2D 鐨勮竟鐣�
- var clipRect = mask.canvasRect;
- //clipRect鏄腑蹇冪偣涓哄潗鏍�0锛�0锛岃浆鎴愬睆骞曠殑
- var maskMinX = Screen.width / 2 + clipRect.xMin;
- var maskMaxX = Screen.width / 2 + clipRect.xMax;
- var maskMinY = Screen.height / 2 + clipRect.yMin;
- var maskMaxY = Screen.height / 2 + clipRect.yMax;
-
- // //screenPos1 瓒呭嚭clipRect鑼冨洿涓嶆樉绀�
- bool isout = false;
- if (screenPos3.x < maskMinX || screenPos3.x > maskMaxX || screenPos3.y < maskMinY || screenPos3.y > maskMaxY)
- {
- isout = true;
- }
- else if (screenPos2.x < maskMinX || screenPos2.x > maskMaxX || screenPos2.y < maskMinY || screenPos2.y > maskMaxY)
- {
- isout = true;
- }
- else if (screenPos1.x < maskMinX || screenPos1.x > maskMaxX || screenPos1.y < maskMinY || screenPos1.y > maskMaxY)
- {
- isout = true;
- }
- if (isout)
- {
- v1.position = new Vector3(10000, 10000, 10000);
- v2.position = new Vector3(10000, 10000, 10000);
- v3.position = new Vector3(10000, 10000, 10000);
- }
-
- // screenPos1.x = Mathf.Clamp(screenPos1.x, maskMinX, maskMaxX);
- // screenPos1.y = Mathf.Clamp(screenPos1.y, maskMinY, maskMaxY);
- // screenPos2.x = Mathf.Clamp(screenPos2.x, maskMinX, maskMaxX);
- // screenPos2.y = Mathf.Clamp(screenPos2.y, maskMinY, maskMaxY);
- // screenPos3.x = Mathf.Clamp(screenPos3.x, maskMinX, maskMaxX);
- // screenPos3.y = Mathf.Clamp(screenPos3.y, maskMinY, maskMaxY);
-
- // // 灏嗗睆骞曞潗鏍囪浆鎹负灞�閮ㄥ潗鏍�
- // RectTransformUtility.ScreenPointToLocalPointInRectangle(uiTransform.GetComponent<RectTransform>(), screenPos1, CameraManager.uiCamera, out Vector2 localPos1);
- // RectTransformUtility.ScreenPointToLocalPointInRectangle(uiTransform.GetComponent<RectTransform>(), screenPos2, CameraManager.uiCamera, out Vector2 localPos2);
- // RectTransformUtility.ScreenPointToLocalPointInRectangle(uiTransform.GetComponent<RectTransform>(), screenPos3, CameraManager.uiCamera, out Vector2 localPos3);
- // v1.position = localPos1;
- // v2.position = localPos2;
- // v3.position = localPos3;
- }
-
-
- // 搴旂敤璁剧疆鍚庣殑UIVertex
- m_VetexList[i] = v1;
- m_VetexList[i + 1] = v2;
- m_VetexList[i + 2] = v3;
+ vh.Clear();
+ vh.AddUIVertexTriangleStream(m_VetexList);
}
- }
- private static UIVertex _SetNewPosAndUV(UIVertex pVertex, int pOutLineWidth,
- Vector2 pPosCenter,
- Vector2 pTriangleX, Vector2 pTriangleY,
- Vector2 pUVX, Vector2 pUVY,
- Vector4 pUVOrigin)
- {
- // Position
- var pos = pVertex.position;
- var posXOffset = pos.x > pPosCenter.x ? pOutLineWidth : -pOutLineWidth;
- var posYOffset = pos.y > pPosCenter.y ? pOutLineWidth : -pOutLineWidth;
- pos.x += posXOffset;
- pos.y += posYOffset;
- pVertex.position = pos;
- // UV
- var uv = pVertex.uv0;
+ private void _ProcessVertices()
+ {
+ for (int i = 0, count = m_VetexList.Count - 3; i <= count; i += 3)
+ {
+ var v1 = m_VetexList[i];
+ var v2 = m_VetexList[i + 1];
+ var v3 = m_VetexList[i + 2];
+ // 璁$畻鍘熼《鐐瑰潗鏍囦腑蹇冪偣
+ //
+ var minX = _Min(v1.position.x, v2.position.x, v3.position.x);
+ var minY = _Min(v1.position.y, v2.position.y, v3.position.y);
+ var maxX = _Max(v1.position.x, v2.position.x, v3.position.x);
+ var maxY = _Max(v1.position.y, v2.position.y, v3.position.y);
+ var posCenter = new Vector2(minX + maxX, minY + maxY) * 0.5f;
+ // 璁$畻鍘熷椤剁偣鍧愭爣鍜孶V鐨勬柟鍚�
+ //
+ Vector2 triX, triY, uvX, uvY;
+ Vector2 pos1 = v1.position;
+ Vector2 pos2 = v2.position;
+ Vector2 pos3 = v3.position;
+ if (Mathf.Abs(Vector2.Dot((pos2 - pos1).normalized, Vector2.right))
+ > Mathf.Abs(Vector2.Dot((pos3 - pos2).normalized, Vector2.right)))
+ {
+ triX = pos2 - pos1;
+ triY = pos3 - pos2;
+ uvX = v2.uv0 - v1.uv0;
+ uvY = v3.uv0 - v2.uv0;
+ }
+ else
+ {
+ triX = pos3 - pos2;
+ triY = pos2 - pos1;
+ uvX = v3.uv0 - v2.uv0;
+ uvY = v2.uv0 - v1.uv0;
+ }
+ // 璁$畻鍘熷UV妗�
+ var uvMin = _Min(v1.uv0, v2.uv0, v3.uv0);
+ var uvMax = _Max(v1.uv0, v2.uv0, v3.uv0);
+ //OutlineColor 鍜� OutlineWidth 涔熶紶鍏ワ紝閬垮厤鍑虹幇涓嶅悓鐨勬潗璐ㄧ悆
+ var col_rg = new Vector2(OutlineColor.r, OutlineColor.g); //鎻忚竟棰滆壊 鐢╱v3 鍜� tangent鐨� zw浼犻��
+ var col_ba = new Vector4(0,0,OutlineColor.b, OutlineColor.a);
+ var normal = new Vector3(0, 0, OutlineWidth); //鎻忚竟鐨勫搴� 鐢╪ormal鐨剒浼犻��
+
+ // 涓烘瘡涓《鐐硅缃柊鐨凱osition鍜孶V锛屽苟浼犲叆鍘熷UV妗�
+ v1 = _SetNewPosAndUV(v1, this.OutlineWidth, posCenter, triX, triY, uvX, uvY, uvMin, uvMax);
+ v1.uv3 = col_rg;
+ v1.tangent = col_ba;
+ v1.normal = normal;
+ v2 = _SetNewPosAndUV(v2, this.OutlineWidth, posCenter, triX, triY, uvX, uvY, uvMin, uvMax);
+ v2.uv3 = col_rg;
+ v2.tangent = col_ba;
+ v2.normal = normal;
+ v3 = _SetNewPosAndUV(v3, this.OutlineWidth, posCenter, triX, triY, uvX, uvY, uvMin, uvMax);
+ v3.uv3 = col_rg;
+ v3.tangent = col_ba;
+ v3.normal = normal;
+
+
+ // 搴旂敤璁剧疆鍚庣殑UIVertex
+ //
+ m_VetexList[i] = v1;
+ m_VetexList[i + 1] = v2;
+ m_VetexList[i + 2] = v3;
+ }
+ }
+
+
+ private static UIVertex _SetNewPosAndUV(UIVertex pVertex, int pOutLineWidth,
+ Vector2 pPosCenter,
+ Vector2 pTriangleX, Vector2 pTriangleY,
+ Vector2 pUVX, Vector2 pUVY,
+ Vector2 pUVOriginMin, Vector2 pUVOriginMax)
+ {
+ // Position
+ var pos = pVertex.position;
+ var posXOffset = pos.x > pPosCenter.x ? pOutLineWidth : -pOutLineWidth;
+ var posYOffset = pos.y > pPosCenter.y ? pOutLineWidth : -pOutLineWidth;
+ pos.x += posXOffset;
+ pos.y += posYOffset;
+ pVertex.position = pos;
+ // UV
+ var uv = pVertex.uv0;
+
+
uv += new Vector4((pUVX / pTriangleX.magnitude * posXOffset * (Vector2.Dot(pTriangleX, Vector2.right) > 0 ? 1 : -1)).x, (pUVX / pTriangleX.magnitude * posXOffset * (Vector2.Dot(pTriangleX, Vector2.right) > 0 ? 1 : -1)).y, 0, 0);
uv += new Vector4((pUVY / pTriangleY.magnitude * posYOffset * (Vector2.Dot(pTriangleY, Vector2.up) > 0 ? 1 : -1)).x, (pUVY / pTriangleY.magnitude * posYOffset * (Vector2.Dot(pTriangleY, Vector2.up) > 0 ? 1 : -1)).y, 0, 0);
- pVertex.uv0 = uv;
- // 鍘熷UV妗�
- pVertex.uv1 = new Vector2(pUVOrigin.x, pUVOrigin.y);
- pVertex.uv2 = new Vector2(pUVOrigin.z, pUVOrigin.w);
+
+ pVertex.uv0 = uv;
- return pVertex;
- }
+ pVertex.uv1 = pUVOriginMin; //uv1 uv2 鍙敤 tangent normal 鍦ㄧ缉鏀炬儏鍐� 浼氭湁闂
+ pVertex.uv2 = pUVOriginMax;
+
+ return pVertex;
+ }
- private static float _Min(float pA, float pB, float pC)
- {
- return Mathf.Min(Mathf.Min(pA, pB), pC);
- }
+ private static float _Min(float pA, float pB, float pC)
+ {
+ return Mathf.Min(Mathf.Min(pA, pB), pC);
+ }
- private static float _Max(float pA, float pB, float pC)
- {
- return Mathf.Max(Mathf.Max(pA, pB), pC);
- }
+ private static float _Max(float pA, float pB, float pC)
+ {
+ return Mathf.Max(Mathf.Max(pA, pB), pC);
+ }
- private static Vector2 _Min(Vector2 pA, Vector2 pB, Vector2 pC)
- {
- return new Vector2(_Min(pA.x, pB.x, pC.x), _Min(pA.y, pB.y, pC.y));
- }
+ private static Vector2 _Min(Vector2 pA, Vector2 pB, Vector2 pC)
+ {
+ return new Vector2(_Min(pA.x, pB.x, pC.x), _Min(pA.y, pB.y, pC.y));
+ }
- private static Vector2 _Max(Vector2 pA, Vector2 pB, Vector2 pC)
- {
- return new Vector2(_Max(pA.x, pB.x, pC.x), _Max(pA.y, pB.y, pC.y));
- }
+ private static Vector2 _Max(Vector2 pA, Vector2 pB, Vector2 pC)
+ {
+ return new Vector2(_Max(pA.x, pB.x, pC.x), _Max(pA.y, pB.y, pC.y));
+ }
- // 鐢熸垚鏉愯川姹犵殑閿�
- private string GetMaterialKey(Color color, int width)
- {
- // 浣跨敤棰滆壊鐨凴GBA鍊煎拰瀹藉害鐢熸垚鍞竴閿�
- return string.Format("{0}_{1}_{2}_{3}_{4}",
- color.r, color.g, color.b, color.a, width);
- }
}
\ No newline at end of file
diff --git a/Main/Config/PartialConfigs/HeroAwakeConfig.cs b/Main/Config/PartialConfigs/HeroAwakeConfig.cs
index 6673ad4..4d2d182 100644
--- a/Main/Config/PartialConfigs/HeroAwakeConfig.cs
+++ b/Main/Config/PartialConfigs/HeroAwakeConfig.cs
@@ -48,4 +48,22 @@
{
return GetHeroAwakeConfig(heroID, awakeLv) == null;
}
+
+ public static int GetAwakeLVByUnLockGiftIndex(int heroID, int index)
+ {
+ Dictionary<int, HeroAwakeConfig> tempDic = null;
+ if (!configDics.TryGetValue(heroID, out tempDic))
+ {
+ return 0;
+ }
+
+ foreach (var item in tempDic)
+ {
+ if (item.Value.UnlockTalentSlot == index + 1)
+ {
+ return item.Key;
+ }
+ }
+ return 0;
+ }
}
diff --git a/Main/System/Hero/HeroInfo.Talent.cs b/Main/System/Hero/HeroInfo.Talent.cs
index 4e5108d..b692c86 100644
--- a/Main/System/Hero/HeroInfo.Talent.cs
+++ b/Main/System/Hero/HeroInfo.Talent.cs
@@ -16,21 +16,36 @@
}
}
- public List<HeroTalentInfo> talentList = new List<HeroTalentInfo>();
+ // 75 # 鑻遍泟澶╄祴娲楃偧閿佸畾绱㈠紩鍒楄〃锛屽搴�71澶╄祴ID绱㈠紩
+ // 77 # 鑻遍泟澶╄祴娲楃偧闅忔満ID鍒楄〃
+ // 79 # 鑻遍泟瑙夐啋鏃堕殢鏈哄ぉ璧嬮�夐」ID鍒楄〃
+ // 71 # 鑻遍泟澶╄祴ID鍒楄〃
+ public List<int> talentIDList
+ {
+ get
+ {
+ if (itemHero == null)
+ return null;
+ return itemHero.GetUseData(71);
+ }
+ }
+
+ // 73 # 鑻遍泟澶╄祴ID绛夌骇鍒楄〃锛屽搴�71澶╄祴ID鐨勭瓑绾�
+ public List<int> talentLvList
+ {
+ get
+ {
+ if (itemHero == null)
+ return null;
+ return itemHero.GetUseData(73);
+ }
+ }
Dictionary<int, int> talentAttrDic = new Dictionary<int, int>(); //灞炴�D : 澶╄祴灞炴�у��
- // 71 # 鑻遍泟澶╄祴ID鍒楄〃
- // 73 # 鑻遍泟澶╄祴ID绛夌骇鍒楄〃锛屽搴�71澶╄祴ID鐨勭瓑绾�
- // 75 # 鑻遍泟澶╄祴娲楃偧閿佸畾绱㈠紩鍒楄〃锛屽搴�71澶╄祴ID绱㈠紩
- // 77 # 鑻遍泟澶╄祴娲楃偧闅忔満ID鍒楄〃
- // 79 # 鑻遍泟瑙夐啋鏃堕殢鏈哄ぉ璧嬮�夐」ID鍒楄〃
+
protected void RefreshTalentAttr()
{
- // 71 # 鑻遍泟澶╄祴ID鍒楄〃
- List<int> talentIDList = itemHero.GetUseData(71);
- // // 73 # 鑻遍泟澶╄祴ID绛夌骇鍒楄〃锛屽搴�71澶╄祴ID鐨勭瓑绾�
- List<int> talentLvList = itemHero.GetUseData(73);
talentAttrDic.Clear();
for (int i = 0; i < talentIDList.Count; i++)
diff --git a/Main/System/Hero/HeroTalentInfo.cs b/Main/System/Hero/HeroTalentInfo.cs
deleted file mode 100644
index e16d0bf..0000000
--- a/Main/System/Hero/HeroTalentInfo.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-public class HeroTalentInfo
-{
- public HeroTalentConfig config;
-
- public HeroInfo heroInfo;
-
- public int talentId;
-
- public int talentLv;
-
- public int lockIndex;
-
- public HeroTalentInfo(HeroInfo _heroInfo, int _talentId, int _talentLv, int _lockIndex)
- {
- heroInfo = _heroInfo;
- talentId = _talentId;
- talentLv = _talentLv;
- lockIndex = _lockIndex;
-
- config = HeroTalentConfig.Get(talentId);
- }
-
-
-}
\ No newline at end of file
diff --git a/Main/System/HeroUI/GiftBaseCell.cs b/Main/System/HeroUI/GiftBaseCell.cs
index 5ab0faf..56b9f68 100644
--- a/Main/System/HeroUI/GiftBaseCell.cs
+++ b/Main/System/HeroUI/GiftBaseCell.cs
@@ -105,14 +105,14 @@
}
//showState 0锛氫笉鏄剧ず 1锛氭柊澧� 2锛氭彁鍗�
- //giftID 0 :浠h〃鏈縺娲荤伆鑹� -1锛氫唬琛ㄤ笉鑳芥縺娲� 妫曡壊锛屽叾浠栨牴鎹厤琛�
+ //giftID 0 :浠h〃鐏拌壊闇�鍗囨槦婵�娲� -1锛氫唬琛ㄦ鑹查渶瑙夐啋婵�娲伙紝鍏朵粬鏍规嵁閰嶈〃锛屾病鏈夊ぉ璧嬬殑澶栧眰鎺у埗鏄鹃殣
public void Init(int giftID, int lv, UnityAction onclick = null, int showState = 0)
{
+ giftBtn.AddListener(onclick);
if (HeroTalentConfig.HasKey(giftID))
{
var config = HeroTalentConfig.Get(giftID);
qualityBG.SetSprite("GiftQualityBG" + config.Quality);
- giftBtn.AddListener(onclick);
giftName.text = config.Name;
giftName.color = GetColor(config.Quality);
textOutline.OutlineColor = GetOutlineColor(config.Quality);
@@ -125,7 +125,6 @@
else
{
qualityBG.SetSprite("GiftQualityBG" + giftID);
- giftBtn.RemoveAllListeners();
giftName.text = string.Empty;
lvRect.SetActive(false);
stateImg.SetActive(false);
@@ -209,7 +208,18 @@
var scale = 1f;
var rect = cellContainer.GetComponent<RectTransform>();
var parentRect = transform.GetComponent<RectTransform>();
- scale = parentRect.sizeDelta.x / rect.sizeDelta.x;
+ float width = parentRect.sizeDelta.x;
+ if (width <= 0f)
+ {
+ //澶栭儴鎺у埗浜嗗昂瀵歌幏鍙栦负0
+ GridLayoutGroup grid = GetComponentInParent<GridLayoutGroup>();
+ if (grid != null)
+ {
+ width = grid.cellSize.x;
+ }
+
+ }
+ scale = width / rect.sizeDelta.x;
cellContainer.transform.localScale = new Vector3(scale, scale, scale);
}
}
diff --git a/Main/System/HeroUI/HeroHeadBaseCell.cs b/Main/System/HeroUI/HeroHeadBaseCell.cs
index 235971a..5547b2f 100644
--- a/Main/System/HeroUI/HeroHeadBaseCell.cs
+++ b/Main/System/HeroUI/HeroHeadBaseCell.cs
@@ -220,7 +220,18 @@
var scale = 1f;
var rect = cellContainer.GetComponent<RectTransform>();
var parentRect = transform.GetComponent<RectTransform>();
- scale = parentRect.sizeDelta.x / rect.sizeDelta.x;
+ float width = parentRect.sizeDelta.x;
+ if (width <= 0f)
+ {
+ //澶栭儴鎺у埗浜嗗昂瀵歌幏鍙栦负0
+ GridLayoutGroup grid = GetComponentInParent<GridLayoutGroup>();
+ if (grid != null)
+ {
+ width = grid.cellSize.x;
+ }
+
+ }
+ scale = width / rect.sizeDelta.x;
cellContainer.transform.localScale = new Vector3(scale, scale, scale);
}
}
diff --git a/Main/System/HeroUI/HeroShowBaseCell.cs b/Main/System/HeroUI/HeroShowBaseCell.cs
index e0a07f4..4206963 100644
--- a/Main/System/HeroUI/HeroShowBaseCell.cs
+++ b/Main/System/HeroUI/HeroShowBaseCell.cs
@@ -187,7 +187,18 @@
var scale = 1f;
var rect = cellContainer.GetComponent<RectTransform>();
var parentRect = transform.GetComponent<RectTransform>();
- scale = parentRect.sizeDelta.x / rect.sizeDelta.x;
+ float width = parentRect.sizeDelta.x;
+ if (width <= 0f)
+ {
+ //澶栭儴鎺у埗浜嗗昂瀵歌幏鍙栦负0
+ GridLayoutGroup grid = GetComponentInParent<GridLayoutGroup>();
+ if (grid != null)
+ {
+ width = grid.cellSize.x;
+ }
+
+ }
+ scale = width / rect.sizeDelta.x;
cellContainer.transform.localScale = new Vector3(scale, scale, scale);
heroNameOutline = nameText.GetComponent<OutlineEx>();
heroLVOutline = lvText.GetComponent<OutlineEx>();
diff --git a/Main/System/HeroUI/HeroTrainWin.cs b/Main/System/HeroUI/HeroTrainWin.cs
index 6b688b3..386285d 100644
--- a/Main/System/HeroUI/HeroTrainWin.cs
+++ b/Main/System/HeroUI/HeroTrainWin.cs
@@ -64,6 +64,13 @@
[SerializeField] Text[] fetterNameText; //缇佺粖
+ //澶╄祴
+ [SerializeField] GiftBaseCell[] giftBaseCells;
+ [SerializeField] Button totalGiftBtn;
+ [SerializeField] Button starUPBtn;
+ [SerializeField] Button washBtn;
+
+
string guid;
HeroInfo hero;
@@ -132,7 +139,7 @@
hero = HeroManager.Instance.GetHero(guid);
unfoldState = false;
addPerObject.SetActive(false);
- Refresh();
+ Display();
}
protected override void OnPreClose()
@@ -154,7 +161,8 @@
}
}
}
- public override void Refresh()
+
+ public void Display()
{
roleLhModel.Create(hero.SkinID, HeroUIManager.lihuiScale, motionName: "", isLh: true);
roleXsModel.Create(hero.SkinID);
@@ -184,6 +192,7 @@
RefreshAttr();
RefreshAllPotential();
RefreshFetter();
+ RefreshGift();
}
void RefreshItemLockEvent(PackType type, string guid, bool lockState)
@@ -196,7 +205,7 @@
void RefreshHeroEvent(HeroInfo hero)
{
- Refresh();
+ Display();
}
void RefreshConn()
@@ -230,7 +239,7 @@
}
guid = HeroUIManager.Instance.heroSortList[resultIndex];
hero = HeroManager.Instance.GetHero(guid);
- Refresh();
+ Display();
}
void ResetBtnClick()
@@ -517,7 +526,7 @@
else
{
//缃伆
- allAttrStr += UIHelper.AppendColor(TextColType.Gray, Language.Get("herocard63", i + 1, string.Join(Language.Get("L1112"), attrStrArr))) + "\n";
+ allAttrStr += UIHelper.AppendColor(TextColType.NavyGray, Language.Get("herocard63", i + 1, string.Join(Language.Get("L1112"), attrStrArr))) + "\n";
}
}
@@ -527,7 +536,7 @@
//缇佺粖
void RefreshFetter()
- {
+ {
for (int i = 0; i < fetterText.Length; i++)
{
if (i < hero.heroConfig.FetterIDList.Length)
@@ -563,7 +572,57 @@
fetterText[i].SetActive(false);
}
}
+ }
+ void RefreshGift()
+ {
+ //浼犺浠ヤ笅鍙湁4涓�
+ int showCount = hero.Quality < 4 ? HeroUIManager.normalGiftMaxCnt : HeroUIManager.giftMaxCnt;
+ for (int i = 0; i < giftBaseCells.Length; i++)
+ {
+ if (i >= showCount)
+ {
+ giftBaseCells[i].SetActive(false);
+ continue;
+ }
- }
+ giftBaseCells[i].SetActive(true);
+ if (i < hero.talentIDList.Count)
+ {
+ int giftID = hero.talentIDList[i];
+ int giftLV = hero.talentLvList[i];
+ giftBaseCells[i].Init(giftID, giftLV, () =>
+ {
+ var giftConfig = HeroTalentConfig.Get(giftID);
+ SmallTipWin.showText = Language.Get("SmallTipFomat", giftConfig.Name + " " + Language.Get("L1113", giftLV),
+ Language.Get("HeroGift5", PlayerPropertyConfig.Get(giftConfig.AttrID).Name, PlayerPropertyConfig.GetValueDescription(giftConfig.AttrID, giftConfig.AttrValue)));
+ SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
+ UIManager.Instance.OpenWindow<SmallTipWin>();
+ });
+ }
+ else
+ {
+ if (i < HeroUIManager.normalGiftMaxCnt)
+ {
+ giftBaseCells[i].Init(0, 0, () =>
+ {
+ SmallTipWin.showText = Language.Get("HeroGift1");
+ SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
+ UIManager.Instance.OpenWindow<SmallTipWin>();
+ });
+ }
+ else
+ {
+ int index = i;
+ giftBaseCells[i].Init(-1, 0, () =>
+ {
+ SmallTipWin.showText = Language.Get("HeroGift2", HeroAwakeConfig.GetAwakeLVByUnLockGiftIndex(hero.heroId, index));
+ SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
+ UIManager.Instance.OpenWindow<SmallTipWin>();
+ });
+ }
+ }
+
+ }
+ }
}
\ No newline at end of file
diff --git a/Main/System/HeroUI/HeroUIManager.Gift.cs b/Main/System/HeroUI/HeroUIManager.Gift.cs
new file mode 100644
index 0000000..8252aef
--- /dev/null
+++ b/Main/System/HeroUI/HeroUIManager.Gift.cs
@@ -0,0 +1,31 @@
+锘縰sing System;
+using System.Collections;
+using System.Collections.Generic;
+using LitJson;
+
+using UnityEngine;
+
+//澶╄祴
+public partial class HeroUIManager : GameSystemManager<HeroUIManager>
+{
+ public const int normalGiftMaxCnt = 4; //浼犺4浠ヤ笅
+ public const int giftMaxCnt = 8;
+ public int maxGiftLevel; //澶╄祴鏈�楂樼瓑绾э紝鍏朵粬鍔熻兘鍙兘浼氬鍔犺繖涓笂闄�
+ public int starLevelCanAwake; //x鏄熷彲浠ヨ閱�
+
+ public int washItemID;
+ public int[] washByLockUseCounts;
+
+ void ParseGiftConfig()
+ {
+ var config = FuncConfigConfig.Get("HeroStarTalent");
+ maxGiftLevel = int.Parse(config.Numerical2);
+ starLevelCanAwake = int.Parse(config.Numerical4);
+
+ config = FuncConfigConfig.Get("HeroWash");
+ washItemID = int.Parse(config.Numerical1);
+ washByLockUseCounts = JsonMapper.ToObject<int[]>(config.Numerical2);
+ }
+
+}
+
diff --git a/Main/System/Hero/HeroTalentInfo.cs.meta b/Main/System/HeroUI/HeroUIManager.Gift.cs.meta
similarity index 83%
rename from Main/System/Hero/HeroTalentInfo.cs.meta
rename to Main/System/HeroUI/HeroUIManager.Gift.cs.meta
index b34a6c2..3755c84 100644
--- a/Main/System/Hero/HeroTalentInfo.cs.meta
+++ b/Main/System/HeroUI/HeroUIManager.Gift.cs.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: 262ca07cf60e33946bf5fc0a9a1007ab
+guid: fb636b74ad337ca439fb8205757fa6c1
MonoImporter:
externalObjects: {}
serializedVersion: 2
diff --git a/Main/System/HeroUI/HeroUIManager.cs b/Main/System/HeroUI/HeroUIManager.cs
index 874b6f1..e09454c 100644
--- a/Main/System/HeroUI/HeroUIManager.cs
+++ b/Main/System/HeroUI/HeroUIManager.cs
@@ -39,6 +39,7 @@
var config = FuncConfigConfig.Get("HeroRebirth");
payBackMoneyType = int.Parse(config.Numerical1);
rebornAwakeHeroMaxCount = int.Parse(config.Numerical2);
+ ParseGiftConfig();
}
public void OnBeforePlayerDataInitialize()
diff --git a/Main/System/SkillUI/SkillBaseCell.cs b/Main/System/SkillUI/SkillBaseCell.cs
index 77101a2..7101b77 100644
--- a/Main/System/SkillUI/SkillBaseCell.cs
+++ b/Main/System/SkillUI/SkillBaseCell.cs
@@ -109,7 +109,18 @@
var scale = 1f;
var rect = cellContainer.GetComponent<RectTransform>();
var parentRect = transform.GetComponent<RectTransform>();
- scale = parentRect.sizeDelta.x / rect.sizeDelta.x;
+ float width = parentRect.sizeDelta.x;
+ if (width <= 0f)
+ {
+ //澶栭儴鎺у埗浜嗗昂瀵歌幏鍙栦负0
+ GridLayoutGroup grid = GetComponentInParent<GridLayoutGroup>();
+ if (grid != null)
+ {
+ width = grid.cellSize.x;
+ }
+
+ }
+ scale = width / rect.sizeDelta.x;
cellContainer.transform.localScale = new Vector3(scale, scale, scale);
}
}
diff --git a/Main/System/SkillUI/SkillWordCell.cs b/Main/System/SkillUI/SkillWordCell.cs
index 168f1f9..6d436cd 100644
--- a/Main/System/SkillUI/SkillWordCell.cs
+++ b/Main/System/SkillUI/SkillWordCell.cs
@@ -102,7 +102,18 @@
var scale = 1f;
var rect = cellContainer.GetComponent<RectTransform>();
var parentRect = transform.GetComponent<RectTransform>();
- scale = parentRect.sizeDelta.x / rect.sizeDelta.x;
+ float width = parentRect.sizeDelta.x;
+ if (width <= 0f)
+ {
+ //澶栭儴鎺у埗浜嗗昂瀵歌幏鍙栦负0
+ GridLayoutGroup grid = GetComponentInParent<GridLayoutGroup>();
+ if (grid != null)
+ {
+ width = grid.cellSize.x;
+ }
+
+ }
+ scale = width / rect.sizeDelta.x;
cellContainer.transform.localScale = new Vector3(scale, scale, scale);
}
}
diff --git a/Main/Utility/EnumHelper.cs b/Main/Utility/EnumHelper.cs
index 6395744..f2c6882 100644
--- a/Main/Utility/EnumHelper.cs
+++ b/Main/Utility/EnumHelper.cs
@@ -1077,10 +1077,12 @@
lightYellow = 4, //娴呴粍鑹�
Red = 5,
Pink = 6,
+
/// <summary>
/// 娣辫鑹� 401c06 (64, 28, 6, 255)
/// </summary>
NavyBrown,
+ NavyGray = 8, //娣辩伆鑹� 797979 (121, 121, 121, 255)
Green = 9,//缁胯壊
Black = 10,
/// <summary>
@@ -1096,7 +1098,7 @@
/// <summary>
/// (204, 204, 204, 255)
/// </summary>
- Gray = 16,
+ Gray = 16, // 绮楃硻 鐏拌壊
//鐗╁搧鍝佽川棰滆壊
itemjingliang = 17, //绮捐壇
itemxiyou = 18, //绋�鏈�
diff --git a/Main/Utility/UIHelper.cs b/Main/Utility/UIHelper.cs
index 2f6bf80..4513e1f 100644
--- a/Main/Utility/UIHelper.cs
+++ b/Main/Utility/UIHelper.cs
@@ -543,6 +543,8 @@
return s_LightWhite;
case TextColType.Gray:
return s_Gray;
+ case TextColType.NavyGray:
+ return new Color32(121, 121, 121, 255);
case TextColType.itemjingliang:
// 729de4 绮捐壇
return new Color32(114, 157, 228, 255);
@@ -716,6 +718,8 @@
return StringUtility.Contact("<color=#8ddc11>", msg, "</color>");
case TextColType.Gray:
return StringUtility.Contact("<color=#bbbbbb>", msg, "</color>");
+ case TextColType.NavyGray:
+ return StringUtility.Contact("<color=#797979>", msg, "</color>");
case TextColType.lightYellow:
return StringUtility.Contact("<color=#fcedb9>", msg, "</color>");
case TextColType.NavyYellow:
--
Gitblit v1.8.0