hch
2025-12-29 c30c3ae263229fa694ed2322c5c811f5e559de87
351 【内政】红颜系统
4个文件已添加
2个文件已修改
280 ■■■■■ 已修改文件
Main/System/BeautyMM/BeautyMMActiveWin.cs 119 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/BeautyMM/BeautyMMActiveWin.cs.meta 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/BeautyMM/BeautyMMManager.cs 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/BeautyMM/BeautyMMShowWin.cs 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/BeautyMM/BeautyMMUpgradeWin.cs 105 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/BeautyMM/BeautyMMUpgradeWin.cs.meta 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/BeautyMM/BeautyMMActiveWin.cs
New file
@@ -0,0 +1,119 @@
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
public class BeautyMMActiveWin : UIBase
{
    [SerializeField] Image qualityImg;
    [SerializeField] Text qualityText1; // 品质分两字显示,注意海外版本
    [SerializeField] Text qualityText2;
    [SerializeField] Text nameText;
    [SerializeField] Button descBtn;
    [SerializeField] ImageEx roleImg;
    [SerializeField] Text[] talentTexts;
    int mmID;
    BeautyConfig mmConfig;
    protected override void InitComponent()
    {
        descBtn.AddListener(() =>
        {
            SmallTipWin.showText = mmConfig.Desc;
            SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
            SmallTipWin.isDownShow = true;
            UIManager.Instance.OpenWindow<SmallTipWin>();
        });
    }
    protected override void OnPreOpen()
    {
        mmID = functionOrder;
        Display();
    }
    void Display()
    {
        mmConfig = BeautyConfig.Get(mmID);
        qualityImg.SetSprite($"mmMark{mmConfig.BeautyQuality}");
        string qualityStr = Language.Get($"CommonQuality{mmConfig.BeautyQuality}");
        qualityText1.text = qualityStr[0].ToString();
        qualityText2.text = qualityStr.Substring(1);
        nameText.text = mmConfig.Name;
        var skinID = BeautyMMManager.Instance.GetUsedSkinID(mmID);
        var skinConfig = BeautySkinConfig.Get(skinID);
        roleImg.SetOrgSprite(skinConfig.BigRole, "BeautyMMBigRole");
        roleImg.SetNativeSize();
        ShowTalent();
    }
    void ShowTalent()
    {
        //先显示天赋属性,再显示天赋特性
        var attrs = BeautyMMManager.Instance.GetMMTalentAttrForUI(mmID, true);
        int talentIndex = 0;
        if (attrs.IsNullOrEmpty())
        {
            talentIndex = 0;
        }
        else
        {
            foreach (var attr in attrs)
            {
                if (talentIndex < talentTexts.Length)
                {
                    talentTexts[talentIndex].SetActive(true);
                    string format = "{0}" + UIHelper.AppendColor(TextColType.Green, "+{1}");
                    talentTexts[talentIndex].text = PlayerPropertyConfig.GetFullDescription(attr.Key, attr.Value, format);
                }
                else
                {
                    break;
                }
                talentIndex++;
            }
        }
        var talentValue = BeautyMMManager.Instance.GetMMTalentEffectForUI(mmID);
        for (int i = talentIndex; i < talentTexts.Length; i++)
        {
            if (i == talentIndex && mmConfig.EffType != 0)
            {
                //天赋效果约定最多一个
                talentTexts[talentIndex].SetActive(true);
                switch (mmConfig.EffType)
                {
                    case 1:
                        talentTexts[i].text = Language.Get($"BeautyMMTalent1", talentValue);
                        break;
                    case 2:
                        talentTexts[i].text = Language.Get($"BeautyMMTalent2", talentValue / 100, ItemConfig.Get(mmConfig.EffTypeValue).ItemName);
                        break;
                    case 3:
                        talentTexts[i].text = Language.Get($"BeautyMMTalent3", talentValue);
                        break;
                    case 4:
                        talentTexts[i].text = Language.Get($"BeautyMMTalent4", ItemConfig.Get(mmConfig.EffTypeValue).ItemName, talentValue);
                        break;
                }
            }
            else
            {
                talentTexts[i].SetActive(false);
            }
        }
    }
}
Main/System/BeautyMM/BeautyMMActiveWin.cs.meta
New file
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e51fde590d241a4488944e97e15a5d52
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
Main/System/BeautyMM/BeautyMMManager.cs
@@ -77,8 +77,24 @@
    public void UpdateBeautyMMData(HB130_tagSCBeautyInfo data)
    {
        int activeMMID = 0;
        foreach (var beauty in data.BeautyList)
        {
            if (DTC0403_tagPlayerLoginLoadOK.finishedLogin)
            {
                if (beautyMMDataDict.ContainsKey(beauty.BeautyID))
                {
                    if (beautyMMDataDict[beauty.BeautyID].State != beauty.State)
                    {
                       activeMMID = beauty.BeautyID;
                    }
                }
                else if (beauty.State != 0)
                {
                    activeMMID = beauty.BeautyID;
                }
            }
            beautyMMDataDict[beauty.BeautyID] = new BeautyMMData()
            {
                State = beauty.State,
@@ -100,6 +116,11 @@
        UpdateRedpoint();
        RefreshAllTalen();
        OnBeautyMMDataUpdate?.Invoke();
        if (activeMMID > 0)
        {
            UIManager.Instance.OpenWindow<BeautyMMActiveWin>(activeMMID);
        }
    }
    //0 全部 1 已激活 2 未激活
Main/System/BeautyMM/BeautyMMShowWin.cs
@@ -47,6 +47,7 @@
    BeautyConfig mmConfig;
    List<int> itemlist = new List<int>();
    int beforeRank = 0;
    protected override void InitComponent()
    {
        descBtn.AddListener(() =>
@@ -131,6 +132,12 @@
    void OnBeautyMMDataUpdate()
    {
        var mmData = BeautyMMManager.Instance.GetBeautyMMData(mmID);
        var nowRank = mmData != null ? mmData.LV / BeautyMMManager.Instance.needLVForTalent : 0;
        if (beforeRank != nowRank)
        {
            UIManager.Instance.OpenWindow<BeautyMMUpgradeWin>(mmID);
        }
        Display();
    }
@@ -164,8 +171,8 @@
        activeTipText.text = !isActive ? GetActiveTip(mmConfig) : "";
        var mmData = BeautyMMManager.Instance.GetBeautyMMData(mmID);
        var rank = mmData != null ? mmData.LV / BeautyMMManager.Instance.needLVForTalent + 1 : 1;
        lvNameText.text = Language.Get($"BeautyMMLVName{rank}");
        beforeRank = mmData != null ? mmData.LV / BeautyMMManager.Instance.needLVForTalent : 0;
        lvNameText.text = Language.Get($"BeautyMMLVName{beforeRank + 1}");
        lvText.text = mmData != null ? mmData.LV.ToString() : "0";
@@ -217,7 +224,7 @@
            ShowTalent();
            nextLVTalentTipRect.SetActive(true);
            nextLVTalentTip.text = Language.Get("BeautyMM26", rank * BeautyMMManager.Instance.needLVForTalent);
            nextLVTalentTip.text = Language.Get("BeautyMM26", beforeRank * BeautyMMManager.Instance.needLVForTalent);
            giftOPRect.SetActive(true);
            fullRect.SetActive(false);
        }
Main/System/BeautyMM/BeautyMMUpgradeWin.cs
New file
@@ -0,0 +1,105 @@
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
public class BeautyMMUpgradeWin : UIBase
{
    [SerializeField] Text titleText;
    [SerializeField] Text title2Text;
    [SerializeField] ImageEx roleImg;
    [SerializeField] Text[] talentTexts;
    int mmID;
    BeautyConfig mmConfig;
    protected override void OnPreOpen()
    {
        mmID = functionOrder;
        Display();
    }
    void Display()
    {
        mmConfig = BeautyConfig.Get(mmID);
        var skinID = BeautyMMManager.Instance.GetUsedSkinID(mmID);
        var skinConfig = BeautySkinConfig.Get(skinID);
        roleImg.SetOrgSprite(skinConfig.BigRole, "BeautyMMBigRole");
        roleImg.SetNativeSize();
        var mmData = BeautyMMManager.Instance.GetBeautyMMData(mmID);
        int rank = 0;
        if (mmData != null)
        {
            rank = mmData.LV / BeautyMMManager.Instance.needLVForTalent;
        }
        titleText.text = Language.Get($"BeautyMMLVName{rank}");
        title2Text.text = Language.Get($"BeautyMMLVName{rank + 1}");
        ShowTalent();
    }
    void ShowTalent()
    {
        //先显示天赋属性,再显示天赋特性
        var attrs = BeautyMMManager.Instance.GetMMTalentAttrForUI(mmID, true);
        int talentIndex = 0;
        if (attrs.IsNullOrEmpty())
        {
            talentIndex = 0;
        }
        else
        {
            foreach (var attr in attrs)
            {
                if (talentIndex < talentTexts.Length)
                {
                    talentTexts[talentIndex].SetActive(true);
                    string format = "{0}" + UIHelper.AppendColor(TextColType.Green, "+{1}");
                    talentTexts[talentIndex].text = PlayerPropertyConfig.GetFullDescription(attr.Key, attr.Value, format);
                }
                else
                {
                    break;
                }
                talentIndex++;
            }
        }
        var talentValue = BeautyMMManager.Instance.GetMMTalentEffectForUI(mmID);
        for (int i = talentIndex; i < talentTexts.Length; i++)
        {
            if (i == talentIndex && mmConfig.EffType != 0)
            {
                //天赋效果约定最多一个
                talentTexts[talentIndex].SetActive(true);
                switch (mmConfig.EffType)
                {
                    case 1:
                        talentTexts[i].text = Language.Get($"BeautyMMTalent1", talentValue);
                        break;
                    case 2:
                        talentTexts[i].text = Language.Get($"BeautyMMTalent2", talentValue / 100, ItemConfig.Get(mmConfig.EffTypeValue).ItemName);
                        break;
                    case 3:
                        talentTexts[i].text = Language.Get($"BeautyMMTalent3", talentValue);
                        break;
                    case 4:
                        talentTexts[i].text = Language.Get($"BeautyMMTalent4", ItemConfig.Get(mmConfig.EffTypeValue).ItemName, talentValue);
                        break;
                }
            }
            else
            {
                talentTexts[i].SetActive(false);
            }
        }
    }
}
Main/System/BeautyMM/BeautyMMUpgradeWin.cs.meta
New file
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d400e22d3cc9c44459190d0ae0f73d9c
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant: