少年修仙传客户端代码仓库
client_Wu Xijin
2019-03-05 efa5f8d07fc3321f6ac5f5d97fb422db28d0886f
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
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
 
using System.Linq;
 
namespace Snxxz.UI
{
    public class PracticeTypeCell : CellView
    {
        [SerializeField] public GameObject unSelectImg;
        [SerializeField] public GameObject selectImg;
        [SerializeField] public Text nameText;
        [SerializeField] public Slider progressSlider;
        [SerializeField] public Text progressText;
        [SerializeField] public Button cellBtn;
        [SerializeField] public Transform arrowIcon;
        [SerializeField] public RedpointBehaviour redpoint;
 
        RealmPracticeModel practiceModel { get { return ModelCenter.Instance.GetModel<RealmPracticeModel>(); } }
 
        public void Init(int firstType,int selectFirstType,bool isDoubleClick)
        {
            redpoint.redpointId = practiceModel.realmFirstTypeDict[firstType].id;
            nameText.text = practiceModel.GetPracticePointStr(firstType);
 
            List<int> secondTypelist = practiceModel.GetAllOpenRealmPra()[firstType].Keys.ToList();
            if(secondTypelist[0] != 0)
            {
                arrowIcon.gameObject.SetActive(true);
            }
            else
            {
                arrowIcon.gameObject.SetActive(false);
            }
 
            if(selectFirstType == firstType)
            {
                selectImg.SetActive(true);
                unSelectImg.SetActive(false);
                if(secondTypelist[0] != 0)
                {
                    if(isDoubleClick)
                    {
                        arrowIcon.localRotation = Quaternion.Euler(0, 0, 0);
                    }
                    else
                    {
                        arrowIcon.localRotation = Quaternion.Euler(0, 0, -90);
                    }
                  
                }
            }
            else
            {
                arrowIcon.localRotation = Quaternion.Euler(0, 0,0);
                unSelectImg.SetActive(true);
                selectImg.SetActive(false);
            }
 
            RefreshProgress(firstType);
        }
 
        public void RefreshProgress(int practiceType)
        {
            progressSlider.minValue = 0;
            progressSlider.maxValue = practiceModel.GetRealmPraPointByType(practiceType);
            progressSlider.value = practiceModel.GetRealmPraPointByType(practiceType,0,false);
            string precent = "";
            float precentValue = (float)(progressSlider.value / progressSlider.maxValue)*100;
            if(precentValue > 0 && precentValue < 1)
            {
                precentValue = 1;
            }
            precent = StringUtility.Contact((float)Math.Round(precentValue,1),"%");
            progressText.text = precent;
        }
    }
}