From 5b8a8c82864d4ea7e2f93484bd26f293dd31979d Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期一, 01 九月 2025 23:26:58 +0800
Subject: [PATCH] 50 【主界面】核心主体 - 主线BOS界面
---
Main/System/MainLevel/MainLevelDropCell.cs.meta | 11 +
Main/System/SkillUI/SkillWordCell.cs.meta | 11 +
Main/System/MainLevel/MainBossEnterWin.cs | 185 ++++++++++++++++++
Main/Config/PartialConfigs/MainChapterConfig.cs | 26 ++
Main/System/SkillUI/SkillWordCell.cs | 109 ++++++++++
Main/System/ItemTip/SmallTipWin.cs | 42 +++
Main/System/MainLevel/MainLevelManager.cs | 21 +
/dev/null | 66 ------
Main/System/MainLevel/MainLevelDropCell.cs | 62 ++++++
Main/Config/PartialConfigs/MainChapterConfig.cs.meta | 11 +
Main/Config/Configs/MainChapterConfig.cs | 5
Main/Core/NetworkPackage/DTCFile/ServerPack/HB1_Role/DTCB123_tagSCDropBootyInfo.cs | 12
Main/Main.cs | 1
Main/System/MainLevel/MainBossEnterWin.cs.meta | 0
14 files changed, 481 insertions(+), 81 deletions(-)
diff --git a/Main/Config/Configs/MainChapterConfig.cs b/Main/Config/Configs/MainChapterConfig.cs
index 502ed62..b90a297 100644
--- a/Main/Config/Configs/MainChapterConfig.cs
+++ b/Main/Config/Configs/MainChapterConfig.cs
@@ -1,6 +1,6 @@
锘�//--------------------------------------------------------
// [Author]: YYL
-// [ Date ]: Thursday, August 14, 2025
+// [ Date ]: 2025骞�9鏈�1鏃�
//--------------------------------------------------------
using System.Collections.Generic;
@@ -21,6 +21,7 @@
public string Level;
public string MapBG;
public int[][] DailyBootyUpperList;
+ public string BG;
public override int LoadKey(string _key)
{
@@ -41,6 +42,8 @@
MapBG = tables[3];
DailyBootyUpperList = JsonMapper.ToObject<int[][]>(tables[4].Replace("(", "[").Replace(")", "]"));
+
+ BG = tables[5];
}
catch (Exception exception)
{
diff --git a/Main/Config/PartialConfigs/MainChapterConfig.cs b/Main/Config/PartialConfigs/MainChapterConfig.cs
new file mode 100644
index 0000000..424daf6
--- /dev/null
+++ b/Main/Config/PartialConfigs/MainChapterConfig.cs
@@ -0,0 +1,26 @@
+锘縰sing System.Collections.Generic;
+using System.Collections.Specialized;
+
+public partial class MainChapterConfig : ConfigBase<int, MainChapterConfig>
+{
+ public static OrderedDictionary unLockedChapterDict = new OrderedDictionary();
+
+ protected override void OnConfigParseCompleted()
+ {
+ for (int i = 0; i < DailyBootyUpperList.Length; i++)
+ {
+ int itemID = DailyBootyUpperList[i][0];
+ if (!unLockedChapterDict.Contains(itemID))
+ {
+ unLockedChapterDict.Add(itemID, ChapterID);
+ }
+ }
+ }
+
+
+}
+
+
+
+
+
diff --git a/Main/Config/PartialConfigs/MainChapterConfig.cs.meta b/Main/Config/PartialConfigs/MainChapterConfig.cs.meta
new file mode 100644
index 0000000..cc32ae5
--- /dev/null
+++ b/Main/Config/PartialConfigs/MainChapterConfig.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: e0fb13dc55216ce41ace6dda01db730a
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/HB1_Role/DTCB123_tagSCDropBootyInfo.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/HB1_Role/DTCB123_tagSCDropBootyInfo.cs
index 3d0fa34..b417d8e 100644
--- a/Main/Core/NetworkPackage/DTCFile/ServerPack/HB1_Role/DTCB123_tagSCDropBootyInfo.cs
+++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/HB1_Role/DTCB123_tagSCDropBootyInfo.cs
@@ -1,11 +1,15 @@
-using UnityEngine;
-using System.Collections;
-
+using UnityEngine;
+using System.Collections;
+
// B1 23 姣忔棩鎺夎惤鎴樺埄鍝佷俊鎭� #tagSCDropBootyInfo
public class DTCB123_tagSCDropBootyInfo : DtcBasic {
- public override void Done(GameNetPackBasic vNetPack) {
+
+
+ public override void Done(GameNetPackBasic vNetPack)
+ {
base.Done(vNetPack);
HB123_tagSCDropBootyInfo vNetData = vNetPack as HB123_tagSCDropBootyInfo;
+ MainLevelManager.Instance.UpdateDayDropBooty(vNetData);
}
}
diff --git a/Main/Main.cs b/Main/Main.cs
index 7e634a8..78c3ffe 100644
--- a/Main/Main.cs
+++ b/Main/Main.cs
@@ -78,6 +78,7 @@
managers.Add(InvestModel.Instance);
managers.Add(BlessLVManager.Instance);
managers.Add(AutoFightModel.Instance);
+ managers.Add(MainLevelManager.Instance);
foreach (var manager in managers)
{
diff --git a/Main/System/Boss.meta b/Main/System/Boss.meta
deleted file mode 100644
index fdf93e3..0000000
--- a/Main/System/Boss.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: c969d67096e20dc419cc22ed78640290
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Main/System/Boss/MainBossEnterWin.cs b/Main/System/Boss/MainBossEnterWin.cs
deleted file mode 100644
index 83546ab..0000000
--- a/Main/System/Boss/MainBossEnterWin.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-锘�//--------------------------------------------------------
-// [Author]: 鐜╀釜娓告垙
-// [ Date ]: Tuesday, July 24, 2018
-//--------------------------------------------------------
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.UI;
-
-
-public class MainBossEnterWin : UIBase
-{
- [SerializeField] Text fbNameText;
- [SerializeField] Button CloseBtn;
- [SerializeField] Button rankBtn;
-
- [SerializeField] Button fightBtn;
-
-
- protected override void InitComponent()
- {
- CloseBtn.AddListener(CloseWindow);
- rankBtn.AddListener(() =>
- {
- RankModel.Instance.ResetQueryParam();
- RankModel.Instance.QueryRankByPage(0, watchID: (int)PlayerDatas.Instance.baseData.PlayerID);
- var win = UIManager.Instance.OpenWindow<PlayerRankWin>();
- win.rankType = 0;
-
- });
-
- fightBtn.AddListener(FightBoss);
- }
-
- protected override void OnPreOpen()
- {
-
- }
-
-
- protected override void OnPreClose()
- {
-
- }
-
- void Display()
- {
- var canChallengeBoss = AutoFightModel.Instance.CanChallengeBoss();
- fightBtn.interactable = canChallengeBoss;
- fightBtn.SetColorful(null, canChallengeBoss);
- }
- void FightBoss()
- {
- if (AutoFightModel.Instance.CanChallengeBoss())
- {
- BattleManager.Instance.MainFightRequest(3);
- }
- }
-
-}
-
-
-
-
diff --git a/Main/System/ItemTip/SmallTipWin.cs b/Main/System/ItemTip/SmallTipWin.cs
index cc4bba1..e2bdbcc 100644
--- a/Main/System/ItemTip/SmallTipWin.cs
+++ b/Main/System/ItemTip/SmallTipWin.cs
@@ -3,22 +3,31 @@
using UnityEngine.UI;
/// <summary>
-/// 鏂囨湰鎻愮ず鐣岄潰
+/// 鏂囨湰鎻愮ず鐣岄潰锛氬閮ㄤ紶鍏ユ枃鏈唴瀹瑰拰涓栫晫鍧愭爣绯讳綅缃�
/// </summary>
public class SmallTipWin : UIBase
{
[SerializeField] RectTransform rectTransform;
[SerializeField] RectTransform arrowImage;
+ [SerializeField] RectTransform arrowUpImage;
[SerializeField] Text descText;
public static Vector3 worldPos; //涓栫晫鍧愭爣绯讳綅缃�
public static string showText;
+ public static bool isDownShow = false; // 鏄惁鍚戜笅鏄剧ず
protected override void OnPreOpen()
- {
+ {
descText.text = showText;
rectTransform.position = new Vector3(100, 100, 100); //鍒濆鍖栨椂锛屽睆骞曡寖鍥村
+ arrowImage.SetActive(!isDownShow);
+ arrowUpImage.SetActive(isDownShow);
+ }
+
+ protected override void OnPreClose()
+ {
+ isDownShow = false;
}
@@ -45,14 +54,23 @@
float screenHeight = maxY - minY;
- Vector2 adjustedPos = new Vector2(worldPos.x, worldPos.y + screenHeight * 0.5f);
+ Vector2 adjustedPos = new Vector2(worldPos.x, worldPos.y + (!isDownShow ? screenHeight * 0.5f : -screenHeight * 0.5f));
Vector2 screenAdjustedPos = CameraManager.uiCamera.WorldToScreenPoint(adjustedPos);
screenAdjustedPos.x = Mathf.Clamp(screenAdjustedPos.x, rectTransform.rect.width * 0.5f, Screen.width - rectTransform.rect.width * 0.5f);
screenAdjustedPos.y = Mathf.Clamp(screenAdjustedPos.y, rectTransform.rect.height * 0.5f, Screen.height - rectTransform.rect.height * 0.5f - 15);
+
adjustedPos = CameraManager.uiCamera.ScreenToWorldPoint(screenAdjustedPos);
rectTransform.position = adjustedPos;
- rectTransform.localPosition = new Vector3(rectTransform.localPosition.x, rectTransform.localPosition.y + 15, rectTransform.localPosition.z);
+
+ if (!isDownShow)
+ {
+ rectTransform.localPosition = new Vector3(rectTransform.localPosition.x, rectTransform.localPosition.y + 15, rectTransform.localPosition.z);
+ }
+ else
+ {
+ rectTransform.localPosition = new Vector3(rectTransform.localPosition.x, rectTransform.localPosition.y - 15, rectTransform.localPosition.z);
+ }
rectTransform.GetWorldCorners(corners);
float minX = corners[0].x;
@@ -63,10 +81,20 @@
if (corners[i].x < minX) minX = corners[i].x;
if (corners[i].x > maxX) maxX = corners[i].x;
}
+
//鏄剧ずarrowImage 鐨剎杞翠笂鐨勪綅缃紝鍜寃orldPos鍚屾锛屼絾涓嶈秴杩噈inX 鍜� maxX鑼冨洿
- Vector3 arrowImagePosition = arrowImage.position;
- arrowImagePosition.x = Mathf.Clamp(worldPos.x, minX, maxX);
- arrowImage.position = arrowImagePosition;
+ if (!isDownShow)
+ {
+ Vector3 arrowImagePosition = arrowImage.position;
+ arrowImagePosition.x = Mathf.Clamp(worldPos.x, minX, maxX);
+ arrowImage.position = arrowImagePosition;
+ }
+ else
+ {
+ Vector3 arrowUpImagePosition = arrowUpImage.position;
+ arrowUpImagePosition.x = Mathf.Clamp(worldPos.x, minX, maxX);
+ arrowUpImage.position = arrowUpImagePosition;
+ }
}
}
\ No newline at end of file
diff --git a/Main/System/MainLevel/MainBossEnterWin.cs b/Main/System/MainLevel/MainBossEnterWin.cs
new file mode 100644
index 0000000..9d7350d
--- /dev/null
+++ b/Main/System/MainLevel/MainBossEnterWin.cs
@@ -0,0 +1,185 @@
+锘�//--------------------------------------------------------
+// [Author]: 鐜╀釜娓告垙
+// [ Date ]: Tuesday, July 24, 2018
+//--------------------------------------------------------
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.UI;
+
+
+public class MainBossEnterWin : UIBase
+{
+ [SerializeField] Text fbNameText;
+ [SerializeField] Button CloseBtn;
+ [SerializeField] Text bossNameText;
+ [SerializeField] Image bossBG;
+ [SerializeField] SkillWordCell[] skillWordCells;
+ [SerializeField] UIHeroController bossModel;
+ [SerializeField] Text fightPowerText;
+ [SerializeField] Button rankBtn;
+ [SerializeField] ItemCell[] passAwards;
+ [SerializeField] Button fightBtn;
+ [SerializeField] ScrollerController dropItemScroller;
+
+
+ protected override void InitComponent()
+ {
+ CloseBtn.AddListener(CloseWindow);
+ rankBtn.AddListener(() =>
+ {
+ RankModel.Instance.ResetQueryParam();
+ RankModel.Instance.QueryRankByPage(0, watchID: (int)PlayerDatas.Instance.baseData.PlayerID);
+ var win = UIManager.Instance.OpenWindow<PlayerRankWin>();
+ win.rankType = 0;
+
+ });
+
+ fightBtn.AddListener(FightBoss);
+ }
+
+ protected override void OnPreOpen()
+ {
+ PlayerDatas.Instance.playerDataRefreshEvent += PlayerDataRefresh;
+ dropItemScroller.OnRefreshCell += OnRefreshCell;
+ MainLevelManager.Instance.OnUpdateDayBooty += UpdateDayBooty;
+ Display();
+ CreateScroller();
+ }
+
+
+ protected override void OnPreClose()
+ {
+ PlayerDatas.Instance.playerDataRefreshEvent -= PlayerDataRefresh;
+ dropItemScroller.OnRefreshCell -= OnRefreshCell;
+ MainLevelManager.Instance.OnUpdateDayBooty -= UpdateDayBooty;
+ }
+
+ void Display()
+ {
+ var value = PlayerDatas.Instance.baseData.ExAttr2;
+ var chapterID = value / 10000;
+ var levelNum = value % 10000 / 100;
+
+ var chapterConfig = MainChapterConfig.Get(chapterID);
+
+ //銆愭櫘閫氥�戝叧鍗″悕瀛�1-6
+ fbNameText.text = Language.Get("mainui7", chapterConfig.Level, chapterConfig.ChapterName, chapterID, levelNum);
+
+ var levelConfig = MainLevelConfig.GetMainLevelConfig(chapterID, levelNum);
+ var lineUPID = levelConfig.BossLineupIDList[levelConfig.BossLineupIDList.Length - 1];
+ var lineUPConfig = NPCLineupConfig.Get(lineUPID);
+ var npcConfig = NPCConfig.Get(lineUPConfig.BossID);
+ if (npcConfig == null)
+ {
+ Debug.LogErrorFormat("NPC鏈厤缃� : {0}", lineUPConfig.BossID);
+ return;
+ }
+
+
+ bossNameText.text = npcConfig.NPCName;
+
+ for (int i = 0; i < skillWordCells.Length; i++)
+ {
+ if (i < lineUPConfig.SkillIDExList.Length)
+ {
+ skillWordCells[i].SetActive(true);
+ int skillID = lineUPConfig.SkillIDExList[i];
+ skillWordCells[i].Init(skillID, () =>
+ {
+ SmallTipWin.showText = SkillConfig.Get(skillID)?.Description;
+ SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
+ SmallTipWin.isDownShow = true;
+ UIManager.Instance.OpenWindow<SmallTipWin>();
+ });
+ }
+ else
+ {
+ skillWordCells[i].SetActive(false);
+ }
+ }
+
+ bossModel.Create(npcConfig.SkinID, npcConfig.ModelScale);
+
+ fightPowerText.text = UIHelper.ReplaceLargeArtNum(levelConfig.FightPower);
+
+ var canChallengeBoss = AutoFightModel.Instance.CanChallengeBoss();
+
+ fightBtn.interactable = canChallengeBoss;
+ fightBtn.SetColorful(null, canChallengeBoss);
+
+
+ for (int i = 0; i < passAwards.Length; i++)
+ {
+ if (i < levelConfig.AwardItemList.Length)
+ {
+ passAwards[i].SetActive(true);
+ int id = levelConfig.AwardItemList[i][0];
+ passAwards[i].Init(new ItemCellModel(id, false, levelConfig.AwardItemList[i][1]));
+ passAwards[i].button.AddListener(() =>
+ {
+ ItemTipUtility.Show(id);
+ });
+ }
+ else
+ {
+ passAwards[i].SetActive(false);
+ }
+ }
+ bossBG.SetOrgSprite(chapterConfig.BG, "MainLevel");
+ }
+
+
+ void FightBoss()
+ {
+ if (AutoFightModel.Instance.CanChallengeBoss())
+ {
+ BattleManager.Instance.MainFightRequest(3);
+ }
+ CloseWindow();
+ }
+
+
+ void PlayerDataRefresh(PlayerDataType type)
+ {
+ switch (type)
+ {
+ case PlayerDataType.ExAttr1:
+ case PlayerDataType.ExAttr2:
+ var canChallengeBoss = AutoFightModel.Instance.CanChallengeBoss();
+
+ fightBtn.interactable = canChallengeBoss;
+ fightBtn.SetColorful(null, canChallengeBoss);
+ break;
+ }
+
+ }
+
+ void OnRefreshCell(ScrollerDataType type, CellView cell)
+ {
+ var _cell = cell as MainLevelDropCell;
+ _cell.Display(cell.index);
+ }
+
+ void UpdateDayBooty()
+ {
+ dropItemScroller.m_Scorller.RefreshActiveCellViews();
+ }
+
+
+ void CreateScroller()
+ {
+ dropItemScroller.Refresh();
+ foreach (DictionaryEntry item in MainChapterConfig.unLockedChapterDict)
+ {
+ dropItemScroller.AddCell(ScrollerDataType.Header, (int)item.Key);
+ }
+ dropItemScroller.Restart();
+ }
+}
+
+
+
+
diff --git a/Main/System/Boss/MainBossEnterWin.cs.meta b/Main/System/MainLevel/MainBossEnterWin.cs.meta
similarity index 100%
rename from Main/System/Boss/MainBossEnterWin.cs.meta
rename to Main/System/MainLevel/MainBossEnterWin.cs.meta
diff --git a/Main/System/MainLevel/MainLevelDropCell.cs b/Main/System/MainLevel/MainLevelDropCell.cs
new file mode 100644
index 0000000..253f53e
--- /dev/null
+++ b/Main/System/MainLevel/MainLevelDropCell.cs
@@ -0,0 +1,62 @@
+锘�//--------------------------------------------------------
+// [Author]: 鐜╀釜娓告垙
+// [ Date ]: Tuesday, July 24, 2018
+//--------------------------------------------------------
+
+using System;
+using System.Collections;
+using UnityEngine;
+using UnityEngine.UI;
+
+public class MainLevelDropCell : CellView
+{
+
+ [SerializeField] Text dropValueText;
+ [SerializeField] ItemCell dropItemCell;
+ [SerializeField] Image lockImg;
+
+
+ public void Display(int itemID)
+ {
+ var value = PlayerDatas.Instance.baseData.ExAttr2;
+ var chapterID = value / 10000;
+ var config = MainChapterConfig.Get(chapterID);
+ var needChapterID = (int)MainChapterConfig.unLockedChapterDict[(object)itemID];
+ bool isLock = (int)needChapterID > chapterID;
+
+ dropItemCell.Init(new ItemCellModel(itemID, false, 0));
+ dropItemCell.button.AddListener(()=>
+ {
+ ItemTipUtility.Show(itemID);
+ });
+
+ if (isLock)
+ {
+ lockImg.SetActive(true);
+ dropValueText.text = UIHelper.AppendColor(TextColType.Red, needChapterID + "-" + "1" + Language.Get("FuncLimitOpen1"));
+ }
+ else
+ {
+ lockImg.SetActive(false);
+ int maxValue = 0;
+ for (int i = 0; i < config.DailyBootyUpperList.Length; i++)
+ {
+ if (config.DailyBootyUpperList[i][0] == itemID)
+ {
+ maxValue = config.DailyBootyUpperList[i][1];
+ break;
+ }
+ }
+ int curValue = 0;
+ MainLevelManager.Instance.m_DailyBootyDict.TryGetValue(itemID, out curValue);
+ dropValueText.text = UIHelper.AppendColor(curValue >= maxValue ? TextColType.Red : TextColType.Green,
+ UIHelper.ReplaceLargeNum(curValue) + "/" + UIHelper.ReplaceLargeNum(maxValue));
+
+ }
+ }
+
+}
+
+
+
+
diff --git a/Main/System/MainLevel/MainLevelDropCell.cs.meta b/Main/System/MainLevel/MainLevelDropCell.cs.meta
new file mode 100644
index 0000000..12c190a
--- /dev/null
+++ b/Main/System/MainLevel/MainLevelDropCell.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: c1075011d33762b4aa8320a32ac2adda
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Main/System/MainLevel/MainLevelManager.cs b/Main/System/MainLevel/MainLevelManager.cs
index 5b940f9..a4bc494 100644
--- a/Main/System/MainLevel/MainLevelManager.cs
+++ b/Main/System/MainLevel/MainLevelManager.cs
@@ -1,21 +1,36 @@
using System.Collections.Generic;
using UnityEngine;
using LitJson;
+using System;
public class MainLevelManager : GameSystemManager<MainLevelManager>
{
+ public Dictionary<int, int> m_DailyBootyDict = new Dictionary<int, int>();
+ public event Action OnUpdateDayBooty;
public override void Init()
{
- base.Init();
+ DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitialize;
}
public override void Release()
{
- base.Release();
+ DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent -= OnBeforePlayerDataInitialize;
}
-
+ private void OnBeforePlayerDataInitialize()
+ {
+ m_DailyBootyDict.Clear();
+ }
+
+ public void UpdateDayDropBooty(HB123_tagSCDropBootyInfo netPack)
+ {
+ for (int i = 0; i < netPack.Count; i++)
+ {
+ m_DailyBootyDict[(int)netPack.DropBootyList[i].ItemID] = (int)netPack.DropBootyList[i].TodayDropCnt;
+ }
+ OnUpdateDayBooty?.Invoke();
+ }
}
\ No newline at end of file
diff --git a/Main/System/SkillUI/SkillWordCell.cs b/Main/System/SkillUI/SkillWordCell.cs
new file mode 100644
index 0000000..168f1f9
--- /dev/null
+++ b/Main/System/SkillUI/SkillWordCell.cs
@@ -0,0 +1,109 @@
+锘縰sing UnityEngine;
+using UnityEngine.UI;
+using UnityEngine.Events;
+
+public class SkillWordCell : MonoBehaviour
+{
+
+ Image m_SkillIcon;
+ Image skillIcon
+ {
+ get
+ {
+ if (m_SkillIcon == null)
+ {
+ m_SkillIcon = this.transform.GetComponent<Image>("Container_SkillCell/Img_Icon");
+ }
+ return m_SkillIcon;
+ }
+ }
+
+ Button m_SkillBtn;
+ Button skillBtn
+ {
+ get
+ {
+ if (m_SkillBtn == null)
+ {
+ m_SkillBtn = this.transform.GetComponent<Button>("Container_SkillCell");
+ }
+ return m_SkillBtn;
+ }
+ }
+
+
+ Text m_SkillType;
+ Text skillType
+ {
+ get
+ {
+ if (m_SkillType == null)
+ {
+ m_SkillType = this.transform.GetComponent<Text>("Container_SkillCell/name");
+ }
+ return m_SkillType;
+ }
+ }
+
+ void Awake()
+ {
+ LoadPrefab();
+ }
+
+ public void Init(int skillID, UnityAction onclick = null, bool showType = false)
+ {
+ var config = SkillConfig.Get(skillID);
+ if (config == null)
+ {
+ Debug.LogErrorFormat("鎶�鑳芥湭閰嶇疆 : {0}", skillID);
+ return;
+ }
+ skillIcon.SetOrgSprite(config.IconName, "SkillIcon");
+#if UNITY_EDITOR
+ if (string.IsNullOrEmpty(config.IconName))
+ {
+ //鍐呯綉娴嬭瘯
+ skillIcon.SetOrgSprite("skillicondefault", "SkillIcon");
+ }
+#endif
+
+ skillBtn.AddListener(()=>
+ {
+ onclick?.Invoke();
+ });
+
+ skillType.text = config.SkillName;
+ }
+
+ GameObject cellContainer;
+ protected void LoadPrefab()
+ {
+ if (cellContainer != null)
+ return;
+
+ var tmp = transform.Find("Container_SkillCell");
+ if (tmp != null)
+ {
+ cellContainer = tmp.gameObject;
+ return;
+ }
+ if (cellContainer == null)
+ {
+ cellContainer = UIUtility.CreateWidget("SkillWordCell", "Container_SkillCell");
+
+ if (cellContainer != null)
+ {
+ cellContainer.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
+ cellContainer.transform.SetAsFirstSibling();
+ }
+ }
+
+ //缂╂斁鍒板拰鐖秗ect涓�鏍峰ぇ
+ var scale = 1f;
+ var rect = cellContainer.GetComponent<RectTransform>();
+ var parentRect = transform.GetComponent<RectTransform>();
+ scale = parentRect.sizeDelta.x / rect.sizeDelta.x;
+ cellContainer.transform.localScale = new Vector3(scale, scale, scale);
+ }
+}
+
diff --git a/Main/System/SkillUI/SkillWordCell.cs.meta b/Main/System/SkillUI/SkillWordCell.cs.meta
new file mode 100644
index 0000000..3935e5f
--- /dev/null
+++ b/Main/System/SkillUI/SkillWordCell.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 0b88e4b27913c8c4eb320aa57fb6a7b0
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
--
Gitblit v1.8.0