hch
2025-08-31 108997fd934885b21c7cc7af3fcde171d5c3cca9
Main/System/Main/HomeWin.cs
@@ -12,6 +12,7 @@
    //经验区
    [SerializeField] Text playerLevelText;
    [SerializeField] SmoothSlider expSlider;
    [SerializeField] Button officialUpBtn;
    //任务区
    [SerializeField] Button taskButton; //引导或者领取任务奖励
@@ -27,15 +28,15 @@
    [SerializeField] Button changeHeroPosBtn;
    //等级
    [SerializeField] Button officialUpBtn;
    //卡牌
    [SerializeField] HeroFightingCardCell[] heroFightingCardCells;
    //底部功能
    [SerializeField] Button autoBtn;
    [SerializeField] Image autoCloseImg;
    [SerializeField] UIEffectPlayer autoOpenEffect;
    [SerializeField] Button  blessLVBtn;
    [SerializeField] Button blessLVBtn;
    [SerializeField] Text blessLVText;
    //其他功能入口
@@ -97,7 +98,7 @@
            UIManager.Instance.OpenWindow<BlessLVWin>();
        });
        officialUpBtn.AddListener(()=>
        officialUpBtn.AddListener(() =>
        {
            if (RealmConfig.GetKeys().Count <= PlayerDatas.Instance.baseData.realmLevel)
                return;
@@ -115,6 +116,8 @@
        RefreshRecharge();
        ShowBlessLV();
        DisplayAutoFight();
        DisplayCard(TeamType.Story);
    }
    protected override void OnPreOpen()
@@ -123,6 +126,8 @@
        TaskManager.Instance.OnTaskUpdate += UpdateTask;
        BlessLVManager.Instance.OnBlessLVUpdateEvent += ShowBlessLV;
        AutoFightModel.Instance.ChangeAutoEvent += DisplayAutoFight;
        TeamManager.Instance.OnTeamChange += DisplayCard;
        UIManager.Instance.OnCloseWindow += OnCloseWindow;
        Display();
        // var battleWin = UIManager.Instance.OpenWindow<BattleWin>();
        // battleWin.SetBattleField(BattleManager.Instance.storyBattleField);
@@ -136,6 +141,8 @@
        TaskManager.Instance.OnTaskUpdate -= UpdateTask;
        BlessLVManager.Instance.OnBlessLVUpdateEvent -= ShowBlessLV;
        AutoFightModel.Instance.ChangeAutoEvent -= DisplayAutoFight;
        TeamManager.Instance.OnTeamChange -= DisplayCard;
        UIManager.Instance.OnCloseWindow -= OnCloseWindow;
        //  关闭的时候把战斗界面也给关了 虽然是在外面开的
        UIManager.Instance.CloseWindow<BattleWin>();
@@ -158,7 +165,7 @@
    }
    void RefreshRecharge()
    {
    {
        monthCardBtn.SetActive(!InvestModel.Instance.IsInvested(InvestModel.monthCardType));
    }
@@ -181,7 +188,7 @@
            autoOpenEffect.Stop();
        }
    }
    /// <summary>
    /// 更新玩家信息
    /// </summary>
@@ -201,7 +208,7 @@
    void UpdateTask()
    {
    {
        var task = TaskManager.Instance.mainTask;
        if (task.TaskID == 0)
        {
@@ -213,9 +220,9 @@
            var taskConfig = TaskConfig.Get(task.TaskID);
            taskText.text = taskConfig.TaskDescribe;
            taskNumText.text = string.Format("({0}/{1})", task.CurValue, taskConfig.NeedValue);
            taskNumText.color = task.CurValue >= taskConfig.NeedValue ? UIHelper.GetUIColor(TextColType.NavyYellow) :  UIHelper.GetUIColor(TextColType.Red);
            taskNumText.color = task.CurValue >= taskConfig.NeedValue ? UIHelper.GetUIColor(TextColType.NavyYellow) : UIHelper.GetUIColor(TextColType.Red);
            if (TaskManager.Instance.GetMainTaskState() == 2)
            {
            {
                taskEffect.Play();
            }
            else
@@ -242,4 +249,24 @@
            //根据任务类型引导
        }
    }
    void DisplayCard(TeamType teamType)
    {
        if (teamType != TeamType.Story)
            return;
        //显示卡牌
        for (int i = 0; i < heroFightingCardCells.Length; i++)
        {
            heroFightingCardCells[i].Display(i);
        }
    }
    private void OnCloseWindow(UIBase closeUI)
    {
        //其他武将功能产生数据变化,需要刷新武将列表
        if (closeUI is HeroTrainWin)
        {
            DisplayCard(TeamType.Story);
        }
    }
}