Main/Component/UI/Common/GroupButtonEx.cs
@@ -103,7 +103,7 @@ SelectBtn(); } // 选中当前按钮 // 选中当前按钮,只处理刷新显示 public void SelectBtn(bool forceRefresh = false) { if (m_State == TitleBtnState.Click && !forceRefresh) Main/Component/UI/Common/GroupButtonExManager.cs
@@ -17,8 +17,8 @@ { // 按钮组列表 private List<GroupButtonEx> m_Buttons = new List<GroupButtonEx>(); [SerializeField] Color m_SelectedTextColor = Color.white; // 选中状态文字颜色 [SerializeField] Color m_SelectedTextColor = UIHelper.GetUIColor(TextColType.titleSelectColor); // 选中状态文字颜色 public Color selectedTextColor { get { return m_SelectedTextColor; } set { @@ -26,7 +26,7 @@ } } [SerializeField] Color m_NormalTextColor = new Color(0.7f, 0.7f, 0.7f); // 未选中状态文字颜色 [SerializeField] Color m_NormalTextColor = UIHelper.GetUIColor(TextColType.titleUnSelectColor); // 未选中状态文字颜色 public Color normalTextColor { get { return m_NormalTextColor; } set { @@ -133,7 +133,7 @@ /// </summary> private void UpdateAllButtonsState() { SortBtns(); // SortBtns(); foreach (var btn in m_Buttons) { Main/Component/UI/Common/ItemBaseEffect.cs
File was deleted Main/Component/UI/Common/ItemBaseEffect.cs.meta
File was deleted Main/Component/UI/Common/ItemBehaviour.cs
File was deleted Main/Component/UI/Effect/EffectPlayer.cs
@@ -169,6 +169,7 @@ } PlayerEffect(true); SoundPlayer.Instance.PlayUIAudio(effectConfig.audio); } Main/Component/UI/Effect/UIEffectPlayer.cs
@@ -73,7 +73,7 @@ { PlayerEffect(false); } SoundPlayer.Instance.PlayUIAudio(effectConfig.audio); } Main/Config/ConfigManager.cs
@@ -38,55 +38,28 @@ // 加载配置文件 HashSet<Type> configTypes = new HashSet<Type>() { typeof(ChatBubbleBoxConfig), typeof(ChestsAwardConfig), typeof(CTGConfig), typeof(DailyLivenessRewardConfig), typeof(DailyQuestConfig), typeof(DailyQuestOpenTimeConfig), typeof(DienstgradConfig), typeof(DirtyNameConfig), typeof(DirtyWordConfig), typeof(EffectConfig), typeof(EquipGSParamConfig), typeof(EquipPlaceMapConfig), typeof(FamilyEmblemConfig), typeof(FrameAnimationConfig), typeof(FuncConfigConfig), typeof(FuncOpenLVConfig), typeof(FunctionTeamSetConfig), typeof(GetItemWaysConfig), typeof(GmCmdConfig), typeof(HeroAwakeConfig), typeof(HeroConfig), typeof(FaceConfig), typeof(HeroLineupHaloConfig), typeof(HeroQualityAwakeConfig), typeof(HeroQualityBreakConfig), typeof(HeroQualityConfig), typeof(HeroQualityLVConfig), typeof(HeroSkinConfig), typeof(ItemConfig), typeof(KickOutReasonConfig), typeof(MainChapterConfig), typeof(MainLevelConfig), typeof(NPCConfig), typeof(NPCExConfig), typeof(NPCLineupConfig), typeof(OrderInfoConfig), typeof(PlayerFaceConfig), typeof(PlayerLVConfig), typeof(PlayerPropertyConfig), typeof(priorbundleConfig), typeof(RealmConfig), typeof(RealmLVUPTaskConfig), typeof(RuleConfig), typeof(SkillConfig), typeof(TaskConfig), typeof(StoreConfig), typeof(SuccessConfig), typeof(SysInfoConfig), typeof(TitleStarUpConfig), typeof(TreasureCntAwardConfig), typeof(TreasureItemLibConfig), typeof(TreasureSetConfig), typeof(TreeLVConfig), typeof(XBGetItemConfig), typeof(RichTextMsgReplaceConfig) typeof(XBGetItemConfig) }; #if UNITY_EDITOR @@ -236,96 +209,44 @@ public override void Release() { // 清空 ChatBubbleBoxConfig 字典 ClearConfigDictionary<ChatBubbleBoxConfig>(); // 清空 ChestsAwardConfig 字典 ClearConfigDictionary<ChestsAwardConfig>(); // 清空 CTGConfig 字典 ClearConfigDictionary<CTGConfig>(); // 清空 DailyLivenessRewardConfig 字典 ClearConfigDictionary<DailyLivenessRewardConfig>(); // 清空 DailyQuestConfig 字典 ClearConfigDictionary<DailyQuestConfig>(); // 清空 DailyQuestOpenTimeConfig 字典 ClearConfigDictionary<DailyQuestOpenTimeConfig>(); // 清空 DienstgradConfig 字典 ClearConfigDictionary<DienstgradConfig>(); // 清空 DirtyNameConfig 字典 ClearConfigDictionary<DirtyNameConfig>(); // 清空 DirtyWordConfig 字典 ClearConfigDictionary<DirtyWordConfig>(); // 清空 EffectConfig 字典 ClearConfigDictionary<EffectConfig>(); // 清空 EquipGSParamConfig 字典 ClearConfigDictionary<EquipGSParamConfig>(); // 清空 EquipPlaceMapConfig 字典 ClearConfigDictionary<EquipPlaceMapConfig>(); // 清空 FamilyEmblemConfig 字典 ClearConfigDictionary<FamilyEmblemConfig>(); // 清空 FrameAnimationConfig 字典 ClearConfigDictionary<FrameAnimationConfig>(); // 清空 FuncConfigConfig 字典 ClearConfigDictionary<FuncConfigConfig>(); // 清空 FuncOpenLVConfig 字典 ClearConfigDictionary<FuncOpenLVConfig>(); // 清空 FunctionTeamSetConfig 字典 ClearConfigDictionary<FunctionTeamSetConfig>(); // 清空 GetItemWaysConfig 字典 ClearConfigDictionary<GetItemWaysConfig>(); // 清空 GmCmdConfig 字典 ClearConfigDictionary<GmCmdConfig>(); // 清空 HeroAwakeConfig 字典 ClearConfigDictionary<HeroAwakeConfig>(); // 清空 HeroConfig 字典 ClearConfigDictionary<HeroConfig>(); // 清空 FaceConfig 字典 ClearConfigDictionary<FaceConfig>(); // 清空 HeroLineupHaloConfig 字典 ClearConfigDictionary<HeroLineupHaloConfig>(); // 清空 HeroQualityAwakeConfig 字典 ClearConfigDictionary<HeroQualityAwakeConfig>(); // 清空 HeroQualityBreakConfig 字典 ClearConfigDictionary<HeroQualityBreakConfig>(); // 清空 HeroQualityConfig 字典 ClearConfigDictionary<HeroQualityConfig>(); // 清空 HeroQualityLVConfig 字典 ClearConfigDictionary<HeroQualityLVConfig>(); // 清空 HeroSkinConfig 字典 ClearConfigDictionary<HeroSkinConfig>(); // 清空 ItemConfig 字典 ClearConfigDictionary<ItemConfig>(); // 清空 KickOutReasonConfig 字典 ClearConfigDictionary<KickOutReasonConfig>(); // 清空 MainChapterConfig 字典 ClearConfigDictionary<MainChapterConfig>(); // 清空 MainLevelConfig 字典 ClearConfigDictionary<MainLevelConfig>(); // 清空 NPCConfig 字典 ClearConfigDictionary<NPCConfig>(); // 清空 NPCExConfig 字典 ClearConfigDictionary<NPCExConfig>(); // 清空 NPCLineupConfig 字典 ClearConfigDictionary<NPCLineupConfig>(); // 清空 OrderInfoConfig 字典 ClearConfigDictionary<OrderInfoConfig>(); // 清空 PlayerFaceConfig 字典 ClearConfigDictionary<PlayerFaceConfig>(); // 清空 PlayerLVConfig 字典 ClearConfigDictionary<PlayerLVConfig>(); // 清空 PlayerPropertyConfig 字典 ClearConfigDictionary<PlayerPropertyConfig>(); // 清空 priorbundleConfig 字典 ClearConfigDictionary<priorbundleConfig>(); // 清空 RealmConfig 字典 ClearConfigDictionary<RealmConfig>(); // 清空 RealmLVUPTaskConfig 字典 ClearConfigDictionary<RealmLVUPTaskConfig>(); // 清空 RuleConfig 字典 ClearConfigDictionary<RuleConfig>(); // 清空 SkillConfig 字典 ClearConfigDictionary<SkillConfig>(); // 清空 TaskConfig 字典 ClearConfigDictionary<TaskConfig>(); // 清空 StoreConfig 字典 ClearConfigDictionary<StoreConfig>(); // 清空 SuccessConfig 字典 ClearConfigDictionary<SuccessConfig>(); // 清空 SysInfoConfig 字典 ClearConfigDictionary<SysInfoConfig>(); // 清空 TitleStarUpConfig 字典 ClearConfigDictionary<TitleStarUpConfig>(); // 清空 TreasureCntAwardConfig 字典 ClearConfigDictionary<TreasureCntAwardConfig>(); // 清空 TreasureItemLibConfig 字典 ClearConfigDictionary<TreasureItemLibConfig>(); // 清空 TreasureSetConfig 字典 ClearConfigDictionary<TreasureSetConfig>(); // 清空 TreeLVConfig 字典 Main/Config/Configs/ItemConfig.cs
@@ -1,6 +1,6 @@ //-------------------------------------------------------- // [Author]: YYL // [ Date ]: 2025年7月26日 // [ Date ]: Monday, August 4, 2025 //-------------------------------------------------------- using System.Collections.Generic; @@ -71,7 +71,6 @@ public int ChangeOrd; public string Description; public string QualityName; public int QualityEchoType; public int LimitSTR; public int LimitPHY; public int LimitPNE; @@ -227,31 +226,29 @@ QualityName = tables[59]; int.TryParse(tables[60],out QualityEchoType); int.TryParse(tables[60],out LimitSTR); int.TryParse(tables[61],out LimitSTR); int.TryParse(tables[61],out LimitPHY); int.TryParse(tables[62],out LimitPHY); int.TryParse(tables[62],out LimitPNE); int.TryParse(tables[63],out LimitPNE); Template = tables[63]; Template = tables[64]; int.TryParse(tables[64],out DropItemPattern); int.TryParse(tables[65],out DropItemPattern); int.TryParse(tables[65],out SellTip); int.TryParse(tables[66],out SellTip); int.TryParse(tables[66],out BatchUse); int.TryParse(tables[67],out BatchUse); int.TryParse(tables[67],out Jump); int.TryParse(tables[68],out Jump); if (tables[69].Contains("[")) if (tables[68].Contains("[")) { GetWay = JsonMapper.ToObject<int[]>(tables[69]); GetWay = JsonMapper.ToObject<int[]>(tables[68]); } else { string[] GetWayStringArray = tables[69].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); string[] GetWayStringArray = tables[68].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); GetWay = new int[GetWayStringArray.Length]; for (int i=0;i<GetWayStringArray.Length;i++) { @@ -259,15 +256,15 @@ } } ItemTypeName = tables[70]; ItemTypeName = tables[69]; if (tables[71].Contains("[")) if (tables[70].Contains("[")) { UseCondiType = JsonMapper.ToObject<int[]>(tables[71]); UseCondiType = JsonMapper.ToObject<int[]>(tables[70]); } else { string[] UseCondiTypeStringArray = tables[71].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); string[] UseCondiTypeStringArray = tables[70].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); UseCondiType = new int[UseCondiTypeStringArray.Length]; for (int i=0;i<UseCondiTypeStringArray.Length;i++) { @@ -275,7 +272,7 @@ } } int.TryParse(tables[72],out BaseEffectID); int.TryParse(tables[71],out BaseEffectID); } catch (Exception exception) { Main/System/GeneralConfig/GeneralDefine.cs
@@ -12,7 +12,6 @@ public const int CrossFamilyBattleMapID = 32090; public static int initDepotGridCount { get; private set; } public static int maxDepotGridCount { get; private set; } public static int initBagGridCount { get; private set; } public static int maxBagGridCount { get; private set; } public static int maxXBGridCount { get; private set; } public static int playerMaxLevel { get; private set; } @@ -260,7 +259,6 @@ // BlueEquipJumpLevel = GetInt("BlueEquipJumpLevel"); // initDepotGridCount = GetInt("InitDepotCellCount"); // maxDepotGridCount = GetInt("MaxDepotCellCount"); // initBagGridCount = GetInt("InitBagCellCount"); // maxBagGridCount = GetInt("MaxBagCellCount"); // maxXBGridCount = GetInt("TreasureSet", 3); Main/System/HeroUI/HeroBaseWin.cs
@@ -9,10 +9,6 @@ public class HeroBaseWin : FunctionsBaseWin { [SerializeField] List<Image> funcSelectImgList; [SerializeField] List<Image> funcUnSelectImgList; [SerializeField] List<Text> titleNameList; /// </summary> protected override void InitComponent() { @@ -23,6 +19,7 @@ protected override void OnPreOpen() { base.OnPreOpen(); tabButtons[functionOrder].SelectBtn(true); } protected override void OnPreClose() @@ -37,26 +34,6 @@ } protected override void UpdateButtonsState() { for (int i = 0; i < funcSelectImgList.Count; i++) { if (i == functionOrder) { funcSelectImgList[i].SetActive(true); funcUnSelectImgList[i].SetActive(false); titleNameList[i].color = UIHelper.GetUIColor(TextColType.titleSelectColor); } else { funcSelectImgList[i].SetActive(false); funcUnSelectImgList[i].SetActive(true); titleNameList[i].color = UIHelper.GetUIColor(TextColType.titleUnSelectColor); } } } protected override void OpenSubUIByTabIndex() { Main/System/KnapSack/Logic/ItemLogicUtility.cs
@@ -352,7 +352,7 @@ SinglePack singlePack = packModel.GetSinglePack(PackType.Item); if (singlePack == null) return false; int startLockIndex = singlePack.unlockedGridCount - GeneralDefine.initBagGridCount; int startLockIndex = singlePack.unlockedGridCount - PackManager.Instance.initBagGridCount; FuncConfigConfig _tagFuncModel = FuncConfigConfig.Get("OpenBagItem"); int haveCount = packModel.GetItemCountByID(PackType.Item, itemId); Equation.Instance.Clear(); Main/System/KnapSack/Logic/PackGirdCell.cs
New file @@ -0,0 +1,17 @@ using UnityEngine; /// <summary> /// 背包格子 /// </summary> public class PackGirdCell : MonoBehaviour { [SerializeField] ItemCell itemCell; [SerializeField] RedpointBehaviour redPoint; // 此处红点可以用图片表示 public void Display(int index) { var guid = PackManager.Instance.GetSinglePack(PackType.Item).itemGuidList[index]; if (string.IsNullOrEmpty(guid)) return; itemCell.Init(PackManager.Instance.GetItemByGuid(guid)); } } Main/System/KnapSack/Logic/PackGirdCell.cs.metacopy from Main/Component/UI/Common/ItemBehaviour.cs.meta copy to Main/System/KnapSack/Logic/PackGirdCell.cs.meta
File was copied from Main/Component/UI/Common/ItemBehaviour.cs.meta @@ -1,8 +1,7 @@ fileFormatVersion: 2 guid: a11c4ed088f00fb4baea8b08f0cfa42f timeCreated: 1501488202 licenseType: Free guid: 3c64a63d0c44fce40a3d1b90b18b2324 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 Main/System/KnapSack/Logic/RolePackLineCell.cs
New file @@ -0,0 +1,26 @@ using UnityEngine; /// <summary> /// 背包格子行 /// </summary> public class RolePackLineCell : CellView { [SerializeField] PackGirdCell[] itemCell; public void Display(int index) { var itemPack = PackManager.Instance.GetSinglePack(PackType.Item); for (int i = 0; i < itemCell.Length; i++) { if (index + i < itemPack.itemGuidList.Count) { itemCell[i].SetActive(true); itemCell[i].Display(index + i); } else { itemCell[i].SetActive(false); } } } } Main/System/KnapSack/Logic/RolePackLineCell.cs.meta
File was renamed from Main/Component/UI/Common/ItemBehaviour.cs.meta @@ -1,8 +1,7 @@ fileFormatVersion: 2 guid: a11c4ed088f00fb4baea8b08f0cfa42f timeCreated: 1501488202 licenseType: Free guid: b5df92a5e4b691444919db543a27de21 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 Main/System/KnapSack/Logic/RolePackWin.cs
New file @@ -0,0 +1,184 @@ using System; using UnityEngine; /// <summary> /// 背包界面 /// </summary> public class RolePackWin : UIBase { [SerializeField] ScrollerController packScroller; [SerializeField] ScrollerController composeScroller; [SerializeField] GroupButtonEx packBtn; [SerializeField] GroupButtonEx composeBtn; SinglePack itemPack; bool isRefreshPack = false; //是否刷新背包 /// </summary> protected override void InitComponent() { packBtn.AddListener(() => { functionOrder = 0; Refresh(); }); composeBtn.AddListener(() => { functionOrder = 1; Refresh(); }); } protected override void OnPreOpen() { itemPack = PackManager.Instance.GetSinglePack(PackType.Item); packScroller.OnRefreshCell += RefreshPackCell; composeScroller.OnRefreshCell += RefreshComposeCell; PackManager.Instance.refrechPackEvent += RefrechPackEvent; PackManager.Instance.RefreshItemEvent += RefreshItemEvent; if (functionOrder == 0) { packBtn.SelectBtn(); } else { composeBtn.SelectBtn(); } SortItems(); Refresh(); } protected override void OnPreClose() { packScroller.OnRefreshCell -= RefreshPackCell; composeScroller.OnRefreshCell -= RefreshComposeCell; PackManager.Instance.refrechPackEvent -= RefrechPackEvent; } float cdTime = 0f; void LateUpdate() { if (isRefreshPack) { //刷新cd0.2秒 if (Time.time > cdTime + 0.2f) { SortItems(); Refresh(); isRefreshPack = false; cdTime = Time.time; } } } void RefrechPackEvent(PackType type) { if (type != PackType.Item) { return; } //延迟0.2秒刷新 设置 isRefreshPack为true isRefreshPack = true; } void RefreshItemEvent(PackType type, int index, int itemID) { if (type != PackType.Item) { return; } isRefreshPack = true; } public override void Refresh() { packScroller.SetActive(functionOrder == 0); composeScroller.SetActive(functionOrder != 0); CreatePackScroller(); CreateComposeScroller(); } void SortItems() { itemPack.itemGuidList.Clear(); var itemDict = itemPack.GetAllItems(); foreach (var itemID in itemDict.Values) { itemPack.itemGuidList.Add(itemID.guid); } itemPack.itemGuidList.Sort(CmpItem); } int CmpItem(string guidA, string guidB) { var itemA = PackManager.Instance.GetItemByGuid(guidA); var itemB = PackManager.Instance.GetItemByGuid(guidB); var typeIndexA = Array.IndexOf(PackManager.Instance.itemPackSortTyps, itemA.config.Type); var typeIndexB = Array.IndexOf(PackManager.Instance.itemPackSortTyps, itemB.config.Type); if (typeIndexA != typeIndexB) { return typeIndexA - typeIndexB; } var qualityA = itemA.config.ItemColor; var qualityB = itemB.config.ItemColor; if (qualityA != qualityB) { return qualityB - qualityA; } var lvA = itemA.config.LV; var lvB = itemB.config.LV; if (lvA != lvB) { return lvB - lvA; } var itemIDA = itemA.config.ID; var itemIDB = itemB.config.ID; return itemIDA - itemIDB; } void CreatePackScroller() { if (functionOrder != 0) { return; } packScroller.Refresh(); for (int i = 0; i < itemPack.itemGuidList.Count; i++) { if (i % 5 == 0) { packScroller.AddCell(ScrollerDataType.Header, i); } } packScroller.Restart(); } void CreateComposeScroller() { if (functionOrder != 1) { return; } } void RefreshPackCell(ScrollerDataType type, CellView cell) { var _cell = cell as RolePackLineCell; _cell.Display(cell.index); } void RefreshComposeCell(ScrollerDataType type, CellView cell) { } } Main/System/KnapSack/Logic/RolePackWin.cs.metacopy from Main/Component/UI/Common/ItemBehaviour.cs.meta copy to Main/System/KnapSack/Logic/RolePackWin.cs.meta
File was copied from Main/Component/UI/Common/ItemBehaviour.cs.meta @@ -1,8 +1,7 @@ fileFormatVersion: 2 guid: a11c4ed088f00fb4baea8b08f0cfa42f timeCreated: 1501488202 licenseType: Free guid: bbbbfd91a59637f4cb7cee421f98052c MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 Main/System/KnapSack/Logic/SinglePack.cs
@@ -1,7 +1,4 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections.Generic; public class SinglePack { @@ -9,6 +6,9 @@ public int unlockedGridCount { get; private set; } //已开启背包格子数 private Dictionary<int, ItemModel> items = new Dictionary<int, ItemModel>(); //key 物品位置索引 private Dictionary<int, List<int>> itemIDs = new Dictionary<int, List<int>>(); //key 物品ID:物品位置索引 public List<string> itemGuidList = new List<string>(); //前端界面GUID排序,各个背包根据实际情况使用 public SinglePack(PackType type) { this.type = type; Main/System/KnapSack/Logic/composeLineCell.cs
New file @@ -0,0 +1,14 @@ using UnityEngine; /// <summary> /// 合成格子行 /// </summary> public class composeLineCell : CellView { [SerializeField] PackGirdCell[] itemCell; public void Display(int index) { } } Main/System/KnapSack/Logic/composeLineCell.cs.metacopy from Main/Component/UI/Common/ItemBehaviour.cs.meta copy to Main/System/KnapSack/Logic/composeLineCell.cs.meta
File was copied from Main/Component/UI/Common/ItemBehaviour.cs.meta @@ -1,8 +1,7 @@ fileFormatVersion: 2 guid: a11c4ed088f00fb4baea8b08f0cfa42f timeCreated: 1501488202 licenseType: Free guid: ff43611139197a9479fcc08c18d025f4 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 Main/System/KnapSack/New/CommonItemBaisc.cs
@@ -20,11 +20,12 @@ public ItemCellformat format { get { return m_Format; } set { m_Format = value; } } Image m_BgIcon; private Image bgIcon { get { private Image bgIcon { get { if (m_BgIcon == null) { LoadPrefab(); m_BgIcon = this.transform.GetComponent<Image>("Container_ItemCell/Img_BackGround"); } return m_BgIcon; @@ -32,11 +33,12 @@ } Image m_ItemIcon; private Image itemIcon { get { private Image itemIcon { get { if (m_ItemIcon == null) { LoadPrefab(); m_ItemIcon = this.transform.GetComponent<Image>("Container_ItemCell/Img_Icon"); } return m_ItemIcon; @@ -45,11 +47,12 @@ Image m_StateIcon; public Image stateIcon { get { public Image stateIcon { get { if (m_StateIcon == null) { LoadPrefab(); m_StateIcon = this.transform.GetComponent<Image>("Container_ItemCell/Img_State"); } return m_StateIcon; @@ -57,61 +60,99 @@ } Text m_CountText; public Text countText { get { public Text countText { get { if (m_CountText == null) { LoadPrefab(); m_CountText = this.transform.GetComponent<Text>("Container_ItemCell/Txt_Count"); } return m_CountText; } } Image m_CountryIcon; public Image countryIcon { get { if (m_CountryIcon == null) { m_CountryIcon = this.transform.GetComponent<Image>("Container_ItemCell/Img_Country"); } return m_CountryIcon; } } Image m_PieceIcon; public Image pieceIcon { get { if (m_PieceIcon == null) { m_PieceIcon = this.transform.GetComponent<Image>("Container_ItemCell/Img_Piece"); } return m_PieceIcon; } } Transform m_TimeForm; public Transform timeForm { get { if (m_TimeForm == null) { m_TimeForm = this.transform.Find("Container_ItemCell/Bg_Time"); } return m_TimeForm; } } Text m_TimeText; public Text timeText { get { if (m_TimeText == null) { m_TimeText = this.transform.GetComponent<Text>("Container_ItemCell/Bg_Time/Txt_Time"); } return m_TimeText; } } Button m_Button; public Button button { get { public Button button { get { if (m_Button == null) { LoadPrefab(); m_Button = this.GetComponent<Button>("Container_ItemCell"); } return m_Button; } } // EquipSuitEffect m_SuitEffect; // EquipSuitEffect suitEffect { // get { // if (m_SuitEffect == null) // { // LoadPrefab(); // //clone 会造成二次创建 // m_SuitEffect = transform.GetComponentInChildren<EquipSuitEffect>(); // if (m_SuitEffect == null) // m_SuitEffect = EquipSuitEffect.Create(transform as RectTransform); // } // return m_SuitEffect; // } // } //物品基础特效(物品表) ItemBaseEffect m_ItemBaseEffect; ItemBaseEffect itemBaseEffect { get { UIEffectPlayer m_ItemBaseEffect; UIEffectPlayer itemBaseEffect { get { if (m_ItemBaseEffect == null) { LoadPrefab(); //clone 会造成二次创建 m_ItemBaseEffect = transform.GetComponentInChildren<ItemBaseEffect>(); if (m_ItemBaseEffect == null) m_ItemBaseEffect = ItemBaseEffect.Create(transform as RectTransform); m_ItemBaseEffect = transform.GetComponentInChildren<UIEffectPlayer>(); } return m_ItemBaseEffect; } } // public bool suitEffectDirty { get; set; } GameObject cellContainer; protected void LoadPrefab() @@ -127,31 +168,11 @@ } if (cellContainer == null) { switch (format) { case ItemCellformat.Format_64x64: cellContainer = UIUtility.CreateWidget("ItemCell_64", "Container_ItemCell"); break; case ItemCellformat.Format_70x70: cellContainer = UIUtility.CreateWidget("ItemCell_70", "Container_ItemCell"); break; case ItemCellformat.Format_80x80: cellContainer = UIUtility.CreateWidget("ItemCell_80", "Container_ItemCell"); break; case ItemCellformat.Format_84x84: cellContainer = UIUtility.CreateWidget("ItemCell_84", "Container_ItemCell"); break; case ItemCellformat.Format_100x100: cellContainer = UIUtility.CreateWidget("ItemCell_100", "Container_ItemCell"); break; case ItemCellformat.Format_120x120: cellContainer = UIUtility.CreateWidget("ItemCell_120", "Container_ItemCell"); break; } cellContainer = UIUtility.CreateWidget("ItemCell_120", "Container_ItemCell"); if (cellContainer != null) { cellContainer.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one); cellContainer.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one * GetScale(format)); cellContainer.transform.SetAsFirstSibling(); } } @@ -159,7 +180,11 @@ public int itemId { get; private set; } PackManager packModel { get { return PackManager.Instance; } } // EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } } void OnEnable() { LoadPrefab(); } /// <summary> /// 初始化数据 bool值用来判断是否需要展示评分高低或者职业限制 @@ -191,7 +216,7 @@ bgIcon.SetActive(true); itemIcon.SetSprite(config.IconKey); ItemConfig itemConfig = ItemConfig.Get(itemId); bgIcon.SetItemBackGround(ItemLogicUtility.Instance.GetItemQuality(itemId, useDataDic), itemConfig.QualityEchoType); bgIcon.SetItemBackGround(ItemLogicUtility.Instance.GetItemQuality(itemId, useDataDic)); if (packModel.textCountShow.ContainsKey(itemId)) { countText.SetActive(true); @@ -217,29 +242,41 @@ } } // suitEffect.Display(itemId, suitEffectDirty); // suitEffectDirty = false; itemBaseEffect.Display(itemId); var compareReslut = isCompare ? Compare(type, itemId, score, guid) : 0; switch (compareReslut) DisPlayEffect(config); // var compareReslut = isCompare ? Compare(type, itemId, score, guid) : 0; // switch (compareReslut) // { // case -1: // stateIcon.SetActive(true); // stateIcon.SetSprite("EquipDownIcon"); // break; // case 0: // stateIcon.SetActive(false); // break; // case 1: // stateIcon.SetActive(true); // stateIcon.SetSprite("EquipUpIcon"); // break; // case 99: // stateIcon.SetActive(true); // stateIcon.SetSprite("EquipForbidIcon"); // break; // } if (config.Type == (int)ItemType.Hero) { case -1: stateIcon.SetActive(true); stateIcon.SetSprite("EquipDownIcon"); break; case 0: stateIcon.SetActive(false); break; case 1: stateIcon.SetActive(true); stateIcon.SetSprite("EquipUpIcon"); break; case 99: stateIcon.SetActive(true); stateIcon.SetSprite("EquipForbidIcon"); break; var heroConfig = HeroConfig.Get(itemId); countryIcon.SetActive(true); countryIcon.SetSprite("herocountry" + heroConfig.Country); } else { countryIcon.SetActive(false); } // pieceIcon.SetActive(); //待策划确定 } // / <summary> @@ -286,21 +323,43 @@ } } // int GetDogzEquipScore(int equipPlace) // { // var dogzModel = ModelCenter.Instance.GetModel<DogzModel>(); // ItemModel putOnModel = null; // dogzModel.TryGetDogzEquip(dogzModel.presentSelectDogz, equipPlace, out putOnModel); // return putOnModel == null ? 0 : putOnModel.score; // } // int GetSpiritWeaponScore(int equipPlace) // { // var spiritWeaponModel = ModelCenter.Instance.GetModel<SpiritWeaponModel>(); // var guid = spiritWeaponModel.GetSpiritWeapon((RoleEquipType)equipPlace); // var item = packModel.GetItemByGuid(guid); // return item != null ? item.score : 0; // } void DisPlayEffect(ItemConfig config) { if (config.BaseEffectID == 0) { if (itemBaseEffect != null) { itemBaseEffect.SetActive(false); } } else { itemBaseEffect.SetActive(true); itemBaseEffect.effectId = config.BaseEffectID; itemBaseEffect.Play(); } } float GetScale(ItemCellformat format) { switch (format) { case ItemCellformat.Format_120x120: return 1f; case ItemCellformat.Format_100x100: return 0.83f; case ItemCellformat.Format_84x84: return 0.7f; case ItemCellformat.Format_80x80: return 0.66f; case ItemCellformat.Format_70x70: return 0.58f; case ItemCellformat.Format_64x64: return 0.53f; default: return 1f; } } } Main/System/KnapSack/New/ItemCell.cs
@@ -1,14 +1,14 @@ using UnityEngine; using UnityEngine.UI; using System.Collections.Generic; using System; public class ItemCell : CommonItemBaisc { public override void Init(ItemModel model, bool isCompare = false) { if (model == null) { return; } base.Init(model, isCompare); } Main/System/KnapSack/PackManager.cs
@@ -3,12 +3,16 @@ using System.Linq; using UnityEngine; using LitJson; using System.Text.RegularExpressions; using System.Collections; using System.IO; public class PackManager : GameSystemManager<PackManager> //public class PackModel : Model, IBeforePlayerDataInitialize, IAfterPlayerDataInitialize, IPlayerLoginOk { public Dictionary<int, int> PackMaxCountDict = new Dictionary<int, int>(); //背包类型:背包格子最大数量 public Dictionary<int, int> PackInitCountDict = new Dictionary<int, int>(); //背包类型:初始数量 public int initBagGridCount { get; private set; } //初始物品背包格子数 public int[] itemPackSortTyps { get; private set; } //背包物品的按类型排序 public static string StrengthAttrShift_RecordKey = ""; public const string RecordKnapsackTitle = "RecordKnapsackTitle"; @@ -329,6 +333,7 @@ DeleteItemDictByGUID(type, guid); } } refrechPackEvent?.Invoke(type); } public void RemoveItem(H0709_tagClearItem clearItem) @@ -474,13 +479,54 @@ #region 玩家装备特殊逻辑 void ParseConfig() { var config = FuncConfigConfig.Get("CommonShowAwards"); commonShowAwardEvents = JsonMapper.ToObject<List<string>>(config.Numerical1); config= FuncConfigConfig.Get("InitBagCellCount"); initBagGridCount = int.Parse(config.Numerical1); PackInitCountDict = ConfigParse.ParseIntDict(config.Numerical2); config = FuncConfigConfig.Get("PackageSortPriority"); itemPackSortTyps = ConfigParse.GetMultipleStr<int>(config.Numerical1); ParsePackConfigIni(); } void ParsePackConfigIni() { string[] lines = LoadConfigIni("MapServerConfig"); foreach (string line in lines) { if (line.StartsWith("PackCnt") && line.Contains("=")) { string[] parts = line.Split('='); if (parts.Length == 2 && int.TryParse(parts[1], out int count)) { string packTypeStr = parts[0].Replace("PackCnt", ""); if (int.TryParse(packTypeStr, out int packTypeIndex)) { PackMaxCountDict[packTypeIndex] = count; } } } } } public string[] LoadConfigIni(string name) { string path = string.Empty; #if UNITY_EDITOR if (!AssetSource.isUseAssetBundle) { path = ResourcesPath.CONFIG_FODLER + "/" + name + ".ini"; } else #endif { path = AssetVersionUtility.GetAssetFilePath($"Config/{name}.ini"); } return File.ReadAllLines(path); } private void UpdateSecond() @@ -550,7 +596,11 @@ public SinglePack GetSinglePack(PackType type) { SinglePack singlePack = null; playerPackDict.TryGetValue(type, out singlePack); if (!playerPackDict.TryGetValue(type, out singlePack)) { singlePack = new SinglePack(type); playerPackDict.Add(type, singlePack); } return singlePack; } Main/System/Main/FuncsBaseWin.cs
@@ -9,7 +9,7 @@ public abstract class FunctionsBaseWin : UIBase { // 标签按钮组 public Button[] tabButtons; public GroupButtonEx[] tabButtons; // 当前打开的子界面 protected UIBase currentSubUI; @@ -19,8 +19,6 @@ /// </summary> protected override void InitComponent() { base.InitComponent(); // 初始化UI组件事件 InitButtonEvents(); } @@ -71,9 +69,6 @@ // 更新当前选中的标签索引 functionOrder = index; // 更新按钮状态 UpdateButtonsState(); // 关闭当前打开的子界面 CloseCurrentSubUI(); @@ -96,10 +91,7 @@ } /// <summary> /// 更新按钮状态 /// </summary> protected abstract void UpdateButtonsState(); /// <summary> /// 根据标签索引打开对应的子界面 Main/System/Main/MainWin.cs
@@ -121,22 +121,6 @@ } /// <summary> /// 更新按钮状态 /// </summary> protected override void UpdateButtonsState() { // 遍历所有按钮,设置选中状态 // for (int i = 0; i < tabButtons.Length; i++) // { // // bottomTabButtons[i].image.color = (i == currentTabIndex) ? Color.white : Color.gray; // } } /// <summary> /// 根据标签索引打开对应的子界面 /// </summary> @@ -154,7 +138,7 @@ Debug.Log("打开主城界面"); break; case 1: // currentSubUI = UIManager.Instance.OpenUI<CharacterUI>(); currentSubUI = UIManager.Instance.OpenWindow<RolePackWin>(); Debug.Log("打开内政界面"); break; case 2: Main/Utility/EnumHelper.cs
@@ -791,6 +791,7 @@ Equip_Wing = 113, // 翅膀 Guard_1 = 114, // 灵守 1 Guard_2 = 115, //灵守 2 Hero = 150, //武将 } Main/Utility/UIHelper.cs
@@ -113,13 +113,13 @@ } // 基于itemColor 下,ColorEx做二级区分 public static void SetItemBackGround(this Image _image, int itemColor, int ColorEx = 0) public static void SetItemBackGround(this Image _image, int itemColor) { if (_image == null) { return; } _image.SetSprite(string.Format("Common_Public_ItemColor{0}{1}", itemColor, ColorEx)); _image.SetSprite($"ItemBG{itemColor}"); } /// <summary> /// 剩余时间