少年修仙传客户端代码仓库
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
 
namespace Snxxz.UI
{
    public class AddPointBehaviour : MonoBehaviour
    {
        [SerializeField] int m_Property;
        [SerializeField] Text m_PropertyName;
        [SerializeField] Text m_PropertyValue;
        [SerializeField] Text m_PropertyPreview;
        [SerializeField] RectTransform m_PointBottom;
        [SerializeField] Button m_Sub;
        [SerializeField] Button m_Add;
 
        public int property
        {
            get { return m_Property; }
        }
 
        public Text propertyName
        {
            get { return m_PropertyName; }
        }
 
        public Text propertyValue
        {
            get { return m_PropertyValue; }
        }
 
        public Text propertyPreview
        {
            get { return m_PropertyPreview; }
        }
 
        public RectTransform pointBottom
        {
            get
            {
                return m_PointBottom;
            }
        }
 
        public Action<int> onPreview;
        public Action<int, bool> onSub;
        public Action<int, bool> onAdd;
 
        private void Awake()
        {
            UIEventTrigger.Get(m_PropertyPreview.gameObject).OnNoParamsClick = () =>
            {
                if (onPreview != null)
                {
                    onPreview(property);
                }
            };
            UIEventTrigger.Get(m_Sub.gameObject).OnDown = OnSubDown;
            UIEventTrigger.Get(m_Sub.gameObject).OnUp = OnSubUp;
            UIEventTrigger.Get(m_Add.gameObject).OnDown = OnAddDown;
            UIEventTrigger.Get(m_Add.gameObject).OnUp = OnAddUp;
        }
 
        private void OnAddUp(GameObject go)
        {
            if (onAdd != null)
            {
                onAdd(property, false);
            }
        }
 
        private void OnAddDown(GameObject go)
        {
            if (onAdd != null)
            {
                onAdd(property, true);
            }
        }
 
        private void OnSubDown(GameObject go)
        {
            if (onSub != null)
            {
                onSub(property, true);
            }
        }
 
        private void OnSubUp(GameObject go)
        {
            if (onSub != null)
            {
                onSub(property, false);
            }
        }
    }
}