406 【功能优化】属性查看优化 点击武将头顶血条,怒气条,buff区域显示buff详情
3个文件已修改
6个文件已添加
205 ■■■■■ 已修改文件
Main/Common/EventName.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/Main.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/Battle/UIComp/BattleHeroInfoBar.cs 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/OtherPlayerDetail/BuffInfoCell.cs 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/OtherPlayerDetail/BuffInfoCell.cs.meta 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/OtherPlayerDetail/BuffInfoWin.cs 83 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/OtherPlayerDetail/BuffInfoWin.cs.meta 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/ViewNPC/ViewBuffManager.cs 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/ViewNPC/ViewBuffManager.cs.meta 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/Common/EventName.cs
@@ -20,6 +20,7 @@
    public const string BATTLE_TIANZI_REFRESH_HP = "BATTLE_TIANZI_REFRESH_HP";//天子考验 刷新血量
    
    public const string BATTLE_CLICK_HERO = "BATTLE_CLICK_HERO";//点击英雄
    public const string BATTLE_CLICK_BUFF = "BATTLE_CLICK_BUFF";//点击Buff
    public const string SOUND_EFFECT_VOLUME_CHANGE = "SOUND_EFFECT_VOLUME_CHANGE";    //音效声音大小调整
Main/Main.cs
@@ -111,6 +111,7 @@
        managers.Add(HeroDebutManager.Instance);
        managers.Add(GeneralActInfoManager.Instance);
        managers.Add(QunyingManager.Instance);
        managers.Add(ViewBuffManager.Instance);
        foreach (var manager in managers)
        {
Main/System/Battle/UIComp/BattleHeroInfoBar.cs
@@ -54,7 +54,7 @@
    protected List<TipsInfo> messages = new List<TipsInfo>();
    protected List<BattleTips> tipsList = new List<BattleTips>();
    protected List<HB428_tagSCBuffRefresh> buffList = new List<HB428_tagSCBuffRefresh>();
    [SerializeField] ButtonEx buffInfoButton;
    protected Sequence hpTween;
    protected Tween xpTween;
    protected Tween shieldTween1;
@@ -198,6 +198,23 @@
                        cell.SetActive(false);
                    }
                }
                buffInfoButton.SetListener(() =>
                {
                    if (datas.IsNullOrEmpty()) return;
                    string clickBuffBattleName = battleObject?.battleField?.ToString();
                    if (clickBuffBattleName == BattleConst.StoryBattleField) return;
                    EventBroadcast.Instance.Broadcast(EventName.BATTLE_CLICK_BUFF, new BattleClickBuffData()
                    {
                        isMySide = battleObject?.Camp == BattleCamp.Red,
                        heroID = (battleObject as HeroBattleObject)?.teamHero?.heroId ?? 0,
                        skinID = (battleObject as HeroBattleObject)?.teamHero?.SkinID ?? 0,
                        datas = datas,
                    });
                });
            }
            else
            {
Main/System/OtherPlayerDetail/BuffInfoCell.cs
New file
@@ -0,0 +1,33 @@
using UnityEngine;
public class BuffInfoCell : CellView
{
    [SerializeField] TextEx buffNameText;
    [SerializeField] TextEx roundText;
    [SerializeField] ImageEx buffImage;
    [SerializeField] TextEx buffCountText;
    [SerializeField] RichText descText;
    public void Display(int index, BattleClickBuffData data)
    {
        if (data.datas?.Count <= index) return;
        var info = data.datas[index];
        var config = SkillConfig.Get((int)info.SkillID);
        if (config == null) return;
        buffImage.SetOrgSprite(config.BuffIconName, "BuffIcon");
        buffCountText.text = info.Layer == 0 ? "" : info.Layer.ToString();
        buffNameText.text = UIHelper.AppendColor(config.IsDebuff() ? TextColType.Red : TextColType.LightGreen, config.SkillName);
        descText.text = config.Description;
        roundText.text = info.LastTime <= 0 ? "" : Language.Get("BuffInfo01", info.LastTime);
        //Debug.Log($"技能ID {info.SkillID} 技能名称 {config.SkillName} 技能描述 {config.Description}");
    }
    public float GetTextHeight(string content)
    {
        descText.text = content;
        return string.IsNullOrEmpty(content) ? 0 : descText.preferredHeight + 80;
    }
}
Main/System/OtherPlayerDetail/BuffInfoCell.cs.meta
New file
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c9e2789d8b3a4e047b0cfbfbc2d0c06d
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
Main/System/OtherPlayerDetail/BuffInfoWin.cs
New file
@@ -0,0 +1,83 @@
using System;
using UnityEngine;
public class BuffInfoWin : UIBase
{
    [SerializeField] BuffInfoCell buffInfoCell;
    [SerializeField] ImageEx teamImage;
    [SerializeField] ImageEx heroImage;
    [SerializeField] TextEx heroNameText;
    [SerializeField] ScrollerController buffScroller;
    ViewBuffManager manager => ViewBuffManager.Instance;
    BattleClickBuffData data;
    protected override void OnPreOpen()
    {
        buffScroller.OnRefreshCell += OnRefreshCell;
        buffScroller.OnGetDynamicSize += OnGetWorldChatDynamicSize;
        data = manager.currentBuffData;
        var heroConfig = HeroConfig.Get(data.heroID);
        if (heroConfig == null) return;
        var heroSkinConfig = HeroSkinConfig.Get(data.skinID);
        if (heroSkinConfig == null) return;
        teamImage.SetSprite(data.isMySide ? "OtherHeroDetailBGBlue" : "OtherHeroDetailBGRed");
         var sprite = UILoader.LoadSprite("HeroHead", HeroSkinConfig.Get(data.skinID).SquareIcon);
        if (sprite == null)
        {
            // 内网未配置时
            heroImage.SetSprite("herohead_default");
        }
        else
        {
            heroImage.overrideSprite = sprite;
        }
        heroNameText.text = heroConfig.Name;
        CreateScroller();
    }
    protected override void OnPreClose()
    {
        buffScroller.OnRefreshCell -= OnRefreshCell;
        buffScroller.OnGetDynamicSize -= OnGetWorldChatDynamicSize;
    }
    public bool TryGetSkillConfig(int index, out SkillConfig config)
    {
        config = null;
        if (data.datas?.Count <= index)
            return false;
        config = SkillConfig.Get((int)data.datas[index].SkillID);
        return config != null;
    }
    private bool OnGetWorldChatDynamicSize(ScrollerDataType type, int index, out float height)
    {
        height = 0;
        if (!TryGetSkillConfig(index, out SkillConfig config))
            return false;
        height = buffInfoCell.GetTextHeight(config.Description);
        return true;
    }
    private void OnRefreshCell(ScrollerDataType type, CellView cell)
    {
        var _cell = cell.GetComponent<BuffInfoCell>();
        _cell?.Display(cell.index, data);
    }
    private void CreateScroller()
    {
        buffScroller.Refresh();
        for (int i = 0; i < data.datas.Count; i++)
        {
            buffScroller.AddCell(ScrollerDataType.Header, i);
        }
        buffScroller.Restart();
    }
}
Main/System/OtherPlayerDetail/BuffInfoWin.cs.meta
New file
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a35bb00628d0ac543b6f512d9d81f1e9
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
Main/System/ViewNPC/ViewBuffManager.cs
New file
@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using LitJson;
public class ViewBuffManager : GameSystemManager<ViewBuffManager>
{
    public override void Init()
    {
        EventBroadcast.Instance.AddListener<BattleClickBuffData>(EventName.BATTLE_CLICK_BUFF, OnBattleClickBuff);
    }
    public override void Release()
    {
        EventBroadcast.Instance.RemoveListener<BattleClickBuffData>(EventName.BATTLE_CLICK_BUFF, OnBattleClickBuff);
    }
    public BattleClickBuffData currentBuffData;
    private void OnBattleClickBuff(BattleClickBuffData data)
    {
        currentBuffData = data;
        if (!UIManager.Instance.IsOpened<BuffInfoWin>())
        {
            UIManager.Instance.OpenWindow<BuffInfoWin>();
        }
    }
}
public struct BattleClickBuffData
{
    public bool isMySide;
    public int heroID;
    public int skinID;
    public List<HB428_tagSCBuffRefresh> datas;
}
Main/System/ViewNPC/ViewBuffManager.cs.meta
New file
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 544777c3539c4e3499b725ddc666a1ee
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant: