lcy
2025-12-03 b9a6e7e896b451e9c915e782a1789b2afe079cc9
Main/System/Main/HomeWin.cs
@@ -11,7 +11,6 @@
/// </summary>
public class HomeWin : UIBase
{
    //经验区
    [SerializeField] Text playerLevelText;
    [SerializeField] SmoothSlider expSlider;
@@ -68,7 +67,24 @@
    [SerializeField] Button horseBtn;
    [SerializeField] HorseController horseImg;
    [SerializeField] Text horseLVText;
    //聊天
    [SerializeField] Button chatBtn;
    [SerializeField] Transform transFastChat;
    [SerializeField] InputField inputFastChat;
    [SerializeField] ButtonEx btnFastChatSend;
    [SerializeField] ImageEx imgFastChatSend;
    [SerializeField] TextEx txtFastChatSend;
    [SerializeField] ButtonEx btnFastChatClose;
    [SerializeField] ButtonEx btnChatWin;
    [SerializeField] TextEx txtChatChannel;
    [SerializeField] Transform transChatBulletView;
    GameObject chatBulletViewPrefab;
    /// <summary>
    /// 初始化组件
    /// </summary>
@@ -122,12 +138,55 @@
        });
        restBtn.AddListener(GotoRest);
        funcColBtn.AddListener(()=>
        funcColBtn.AddListener(() =>
        {
            rightFuncInHome.ShowFuncCol(true);
        });
        horseBtn.AddListener(OpenHorse);
        chatBtn.SetListener(() =>
        {
            if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Chat, true))
                return;
            transFastChat.SetActive(true);
            chatBtn.SetActive(false);
            UpdateChat(ChatManager.Instance.nowChatTab);
        });
        btnFastChatClose.SetListener(() =>
        {
            transFastChat.SetActive(false);
            chatBtn.SetActive(true);
        });
        btnChatWin.SetListener(() =>
        {
            transFastChat.SetActive(false);
            chatBtn.SetActive(true);
            UIManager.Instance.OpenWindow<ChatWin>();
        });
        btnFastChatSend.SetListener(() =>
        {
            // 如果在聊天输入界面无输入文字点击发送,则关闭聊天输入界面
            if (string.IsNullOrEmpty(inputFastChat.text))
            {
                transFastChat.SetActive(false);
                chatBtn.SetActive(true);
                return;
            }
            if (!ChatManager.Instance.CheckChatLimit(inputFastChat.text, out int errorCode))
            {
                ChatManager.Instance.ShowChatErrorTip(errorCode);
                return;
            }
            ChatManager.Instance.SendChatInfo(ChatManager.Instance.nowChatChannel, inputFastChat.text);
            ChatManager.Instance.AddChatChannelSendTime(ChatManager.Instance.nowChatChannel, TimeUtility.AllSeconds);
            UpdateSendButton();
            inputFastChat.text = string.Empty;
        });
    }
@@ -148,6 +207,12 @@
        officialTip.SetActive(OfficialRankManager.Instance.CanOfficialLVUP());
        DisplayHorse();
        DisplayChatBulletView();
        chatBtn.SetActive(true);
        transFastChat.SetActive(false);
        inputFastChat.characterLimit = ChatManager.Instance.characterLimit;
        UpdateSendButton();
    }
    protected override void OnPreOpen()
@@ -167,6 +232,8 @@
        FirstChargeManager.Instance.OnFirstChargeTaskUpdateEvent += OnFirstChargeTaskUpdateEvent;
        OfficialRankManager.Instance.RealmMissionRefreshEvent += OnOfficialCanLVUpEvent;
        HorseManager.Instance.OnHorseUpdateEvent += DisplayHorse;
        ChatManager.Instance.OnChatTabChangeEvent += OnChatTabChangeEvent;
        GuildManager.Instance.EnterOrQuitGuildEvent += EnterOrQuitGuildEvent;
        Display();
        DisplayFirstChargeBtn();
@@ -195,8 +262,54 @@
        FirstChargeManager.Instance.OnFirstChargeTaskUpdateEvent -= OnFirstChargeTaskUpdateEvent;
        OfficialRankManager.Instance.RealmMissionRefreshEvent -= OnOfficialCanLVUpEvent;
        HorseManager.Instance.OnHorseUpdateEvent -= DisplayHorse;
        ChatManager.Instance.OnChatTabChangeEvent -= OnChatTabChangeEvent;
        GuildManager.Instance.EnterOrQuitGuildEvent -= EnterOrQuitGuildEvent;
        //  关闭的时候把战斗界面也给关了 虽然是在外面开的
        UIManager.Instance.CloseWindow<BattleWin>();
    }
    private void UpdateSendButton()
    {
        bool isCanSend = ChatManager.Instance.IsCanSend(ChatManager.Instance.nowChatChannel, out int remainingSeconds);
        btnFastChatSend.interactable = isCanSend;
        imgFastChatSend.gray = !isCanSend;
        txtFastChatSend.text = isCanSend ? Language.Get("Chat11") : Language.Get("Chat14", remainingSeconds);
        txtFastChatSend.colorType = isCanSend ? TextColType.NavyBrown : TextColType.LightWhite;
    }
    private void EnterOrQuitGuildEvent(bool obj)
    {
        if (!obj)
        {
            UpdateChat(ChatManager.Instance.nowChatTab);
        }
    }
    private void OnChatTabChangeEvent(ChatTab tab)
    {
        UpdateChat(tab);
    }
    void UpdateChat(ChatTab tab)
    {
        txtChatChannel.text = ChatManager.Instance.GetChatTabName(tab);
    }
    void DisplayChatBulletView()
    {
        if (chatBulletViewPrefab == null)
        {
            chatBulletViewPrefab = UIUtility.CreateWidget("ChatBulletView", "ChatBulletView");
        }
        chatBulletViewPrefab.transform.SetParentEx(transChatBulletView.transform, Vector3.zero, Quaternion.identity, Vector3.one);
        // 新增:确保 ChatBulletView 组件启用
        // var chatBulletView = chatBulletViewPrefab.GetComponent<ChatBulletView>();
        // if (chatBulletView != null)
        // {
        //     chatBulletView.enabled = true;
        // }
    }
    void OnOfficialCanLVUpEvent()
@@ -308,7 +421,7 @@
        if (showEffect)
        {
            headEffect.transform.DOLocalMove(new Vector3(400 * expSlider.value - 200 - 24, 0, 0), 0.5f);
            headEffect.Play(closePMA:true);
            headEffect.Play(closePMA: true);
        }
    }
@@ -358,7 +471,7 @@
            GameNetSystem.Instance.SendInfo(getReward);
            return;
        }
        TaskManager.Instance.ClickTask();
    }
@@ -509,6 +622,7 @@
    private void OnSecondEvent()
    {
        DisplayFirstChargeBtn();
        UpdateSendButton();
    }
    void OnUnLockHeroCountEvent()
@@ -525,7 +639,7 @@
            //equipShowSwitch;//当前配置的坐骑外观ID存储在(最大支持 1~999)
            var skinConfig = HorseSkinConfig.Get(HorseManager.Instance.GetUsingHorseSkinID(true));
            horseImg.Create(skinConfig.SkinID, 0, 0.6f);
            horseLVText.text = Language.Get("Horse8",HorseManager.Instance.classLV, HorseManager.Instance.horseLV);
            horseLVText.text = Language.Get("Horse8", HorseManager.Instance.classLV, HorseManager.Instance.horseLV);
        }
        else
        {