少年修仙传客户端代码仓库
client_Wu Xijin
2019-06-13 033958214c0b16d7e7b93cc821b018c295251867
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Thursday, June 21, 2018
//--------------------------------------------------------
 
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
 
using UnityEngine.UI;
 
namespace Snxxz.UI
{
 
    public class FlyShoseConfirmwin : Window
    {
 
        public static UseEnvironment useEnvironment = UseEnvironment.Task;
        public static Action confirmCallBack;
 
        [SerializeField] Button m_CloseButton;
        [SerializeField] Button m_OKButton;
        [SerializeField] Button m_Cancel;
        [SerializeField] Toggle m_Toggle;
        [SerializeField] RichText m_ContentText;//内容
        [SerializeField] Text m_Text;
        [SerializeField] Button m_button;
        [SerializeField] Image m_Image;
 
        private int FlyShoseID = 0;
        private int NeedMoney = 1;
        private int progressRef = -1;
 
        TaskModel taskmodel { get { return ModelCenter.Instance.GetModel<TaskModel>(); } }
        PlayerMainDate mainModel { get { return ModelCenter.Instance.GetModel<PlayerMainDate>(); } }
 
        #region Built-in
 
        protected override void BindController()
        {
            var funconfig = FuncConfigConfig.Get("TransportPay");
            FlyShoseID = int.Parse(funconfig.Numerical1);
            NeedMoney = int.Parse(funconfig.Numerical2);
            m_Text.text = string.Format(Language.Get("FlyShoseConfirmwin_Text1"), NeedMoney);
            var config = ItemConfig.Get(FlyShoseID);
            m_Image.SetSprite(config.IconKey);
        }
 
        protected override void AddListeners()
        {
            m_CloseButton.AddListener(CloseClick);
            m_Cancel.AddListener(CloseClick);
            m_OKButton.AddListener(OnclickOKButton);
            m_Toggle.onValueChanged.AddListener(OnClickToggle);
            m_button.AddListener(() => { ItemTipUtility.Show(FlyShoseID); });
        }
 
        protected override void OnPreOpen()
        {
        }
 
        protected override void OnAfterOpen()
        {
            if (taskmodel.allMissionDict.ContainsKey(mainModel.FlyShoseTaskID))
            {
                string str = taskmodel.allMissionDict[mainModel.FlyShoseTaskID].InforList;
                var taskinfo = TASKINFOConfig.Get(str);
                if (taskinfo != null)
                {
                    m_ContentText.text = taskinfo.show_writing;
                }
                if (taskmodel.BountyDic.ContainsKey(mainModel.FlyShoseTaskID) || taskmodel.FairyAuDic.ContainsKey(mainModel.FlyShoseTaskID))
                {
                    var config = TASKINFOConfig.Get(str);
                    if (config != null)
                    {
                        string strRichA = TaskAllocation.Instance.GetTaskInfo(config.show_writing, mainModel.FlyShoseTaskID);
                        m_ContentText.text = strRichA;
                    }
                }
            }
        }
 
        protected override void OnPreClose()
        {
        }
 
        protected override void OnAfterClose()
        {
            confirmCallBack = null;
        }
 
        #endregion
        private void OnclickOKButton()
        {
            int NeedMoney = (int)UIHelper.GetMoneyCnt(1) ;
            if (NeedMoney >= 1)
            {
                switch (useEnvironment)
                {
                    case UseEnvironment.Task:
                        m_ContentText.ExcuteHref(1);
                        break;
                    case UseEnvironment.LocalMap:
                        if (confirmCallBack != null)
                        {
                            confirmCallBack();
                            confirmCallBack = null;
                        }
                        break;
                }
                Close();
            }
            else
            {
                WindowCenter.Instance.Open<RechargeTipWin>();
            }
        }
 
        private void OnClickToggle(bool _bool)
        {
            switch (useEnvironment)
            {
                case UseEnvironment.Task:
                    mainModel.IsFlyShoseBool = _bool;
                    break;
                case UseEnvironment.LocalMap:
                    break;
            }
        }
 
        public enum UseEnvironment
        {
            Task,
            LocalMap,
        }
 
    }
 
}