少年修仙传客户端代码仓库
lcy
2024-12-16 a39c35fc6449430cd02bccb681c4a0a880e46cd9
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
public enum ChatBoolType
{
    ChannelSystem = 0 , //系统频道
    ChannelWorld,//世界频道
    ChannelATeam,//组队频道
    ChannelTeam,//队伍频道
    ChannelBugle,//喇叭频道
    ChannelGrad,//仙盟频道
    ChannelArea,//区域频道
    //ChannelAlliance,//同盟频道
 
    Voice1,
    Voice2,
    Voice3,
 
    GradVoiceWifi,  //仙盟语音Wifi
    PrivateChatVoiceWifi,//私聊语音Wifi
    TeamVoiceWifi,//队伍语音Wifi
    WorldVoiceWifi,//世界语音Wifi
    AreaVoiceWifi,//区域语音Wifi
   // AllianceVoiceWifi, //同盟语音Wifi
 
    GradVoice4G,//仙盟语音4G
    PrivatChatVoice4G,//私聊语音4G
    TeamVoice4G,//队伍语音4G
    WorldVoice4G,//世界语音4G
    AreaVoice4G,//区域语音4G
                //AllianceVoice4G, //同盟语音4G
                //后续IL开发添加预设
    default1,
    default2,
    default3,
    default4,
    default5,
    default6,
    default7,
    default8,
    default9,
    default10,
}
 
 
public class ChatSetting : Singleton<ChatSetting>
 
{
    const string ChatBoolSet_Key = "ChatBoolSet";
 
    public event Action<ChatBoolType, bool> RefreshChatSetAct;
 
    #region 缓存数据
    public Dictionary<ChatBoolType, bool> boolSetDict { get; private set; }
    public void GetLoginBoolSet()
    {
        boolSetDict = new Dictionary<ChatBoolType, bool>();
        for (int i = 0; i < 20; i++)
        {
            if (!boolSetDict.ContainsKey((ChatBoolType)i))
            {
                boolSetDict.Add((ChatBoolType)i, SettingMgr.Instance.GetAccountSetBoolInfo(((ChatBoolType)i).ToString()));
            }
 
        }
    }
    #endregion
 
    public void SetBoolSetStr(ChatBoolType type, bool isOpen)
    {
        SettingMgr.Instance.SetAccountSetStr(type.ToString(),isOpen.ToString());
        switch (type) {
            case ChatBoolType.ChannelSystem:
                ChatCtrl.Inst.SetChatChannelShow(ChatInfoType.System, isOpen);
                break;
            case ChatBoolType.ChannelWorld:
                ChatCtrl.Inst.SetChatChannelShow(ChatInfoType.World, isOpen);
                break;
            case ChatBoolType.ChannelATeam:
                ChatCtrl.Inst.SetChatChannelShow(ChatInfoType.Invite, isOpen);
                break;
            case ChatBoolType.ChannelTeam:
                ChatCtrl.Inst.SetChatChannelShow(ChatInfoType.Team, isOpen);
                break;
            case ChatBoolType.ChannelBugle:
                ChatCtrl.Inst.SetChatChannelShow(ChatInfoType.Trumpet, isOpen);
                break;
            case ChatBoolType.ChannelGrad:
                ChatCtrl.Inst.SetChatChannelShow(ChatInfoType.Fairy, isOpen);
                break;
            case ChatBoolType.ChannelArea:
                ChatCtrl.Inst.SetChatChannelShow(ChatInfoType.Area, isOpen);
                break;
        }
 
        if (boolSetDict != null)
        {
            if (boolSetDict.ContainsKey(type))
            {
                boolSetDict[type] = isOpen;
            }
        }
 
        if(RefreshChatSetAct != null)
        {
            RefreshChatSetAct(type,isOpen);
        }
    }
 
    public bool GetBool(ChatBoolType type)
    {
        if (boolSetDict != null)
        {
            bool isOpen = false;
            boolSetDict.TryGetValue(type, out isOpen);
            return isOpen;
        }
        else
        {
            return SettingMgr.Instance.GetAccountSetBoolInfo(type.ToString());
        }
    }
 
    public bool GetAutoPlayVoice(ChatInfoType type, int netState)
    {
        if (netState == 0)
        {
            return false;
        }
        switch (type)
        {
            case ChatInfoType.World:
                if (netState == 2)
                {
                    return GetBool(ChatBoolType.WorldVoiceWifi);
                }
                else
                {
                    return GetBool(ChatBoolType.WorldVoice4G);
                }
            case ChatInfoType.Area:
                if (netState == 2)
                {
                    return GetBool(ChatBoolType.AreaVoiceWifi);
                }
                else
                {
                    return GetBool(ChatBoolType.AreaVoice4G);
                }
            case ChatInfoType.Team:
                if (netState == 2)
                {
                    return GetBool(ChatBoolType.TeamVoiceWifi);
                }
                else
                {
                    return GetBool(ChatBoolType.TeamVoice4G);
                }
            case ChatInfoType.Fairy:
                if (netState == 2)
                {
                    return GetBool(ChatBoolType.GradVoiceWifi);
                }
                else
                {
                    return GetBool(ChatBoolType.GradVoice4G);
                }
            case ChatInfoType.Friend:
                if (netState == 2)
                {
                    return GetBool(ChatBoolType.PrivateChatVoiceWifi);
                }
                else
                {
                    return GetBool(ChatBoolType.PrivatChatVoice4G);
                }
            case ChatInfoType.CrossServer:
                return false;
        }
        return false;
    }
}