少年修仙传客户端代码仓库
hch
2025-06-12 204ef05a831c9484e2abc561d27ecbff7c797453
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using System;
using System.Collections;
using System.Collections.Generic;
 
using UnityEngine;
using UnityEngine.UI;
 
namespace vnxbqy.UI
{
    
    public class GatherSoulItemBehaviour : MonoBehaviour
    {
        [SerializeField] Button m_Func;
        [SerializeField] Image m_IconBG;
        [SerializeField] Image m_Icon;
        [SerializeField] ScaleTween m_IconTween;
        [SerializeField] Text m_Level;
        [SerializeField] Slider m_ExpSlider;
        [SerializeField] Text m_Count;
        [SerializeField] Image m_Redpoint;
 
 
        GatheringSoulModel model
        {
            get { return ModelCenter.Instance.GetModel<GatheringSoulModel>(); }
        }
 
        int m_SoulID;
 
 
        private void Awake()
        {
            if (m_Func != null)
            {
                m_Func.AddListener(OnFunc);
            }
        }
 
 
        public void Display(int soulID)
        {
            m_SoulID = soulID;
            var config = GatherTheSoulConfig.Get(soulID);
            if (config == null)
            {
                return;
            }
 
            if (config.HoleNum == model.selectEmptyHole && Time.time - model.selectSoulTime < 0.1)
            {
                m_IconTween.Play();
            }
 
            m_Icon.SetSprite(string.Format("FuncSoul_{0}", soulID));
            m_IconBG.SetItemBackGround(config.SoulColor);
            m_Level.text = Language.Get("PlayerDetail_Level", model.GetSoulLevel(soulID));
            var nextLVConfig = GatherTheSoulLVConfig.GetSoulLVConfig(soulID, model.GetSoulLevel(soulID) + 1);
            if (nextLVConfig == null)
            {
                m_ExpSlider.SetActive(false);
                m_Redpoint.SetActive(false);
            }
            else
            {
                m_ExpSlider.SetActive(true);
                var itemCount = model.GetSoulItemCount(soulID);
                m_ExpSlider.value = model.GetSoulItemCount(soulID) / (float)nextLVConfig.NeedPiece;
                m_Count.text = string.Format("{0}/{1}", itemCount, nextLVConfig.NeedPiece);
 
                m_Redpoint.SetActive(nextLVConfig.NeedSoulValue <= 0 && itemCount >= nextLVConfig.NeedPiece);
            }
        }
 
 
        void OnFunc()
        {
            if (m_SoulID == 0) return;
 
            model.selectSoulID = m_SoulID;
            WindowCenter.Instance.Open<GatherSoulLevelUpWin>();
        }
    }
}