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;
|
}
|
}
|