using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
|
using vnxbqy.UI;
|
|
public enum HangUpAutoBoolType
|
{
|
curFixedScreen = 0, //固定屏
|
curFollowScreen, //跟随屏
|
whiteEquip, //白色装备
|
purpleEquip,
|
gem, //宝石
|
drug, //药品(改贵重物品)
|
necklaces, //项链、仙器
|
coins, //金币
|
other,
|
isAutoDrop, //是否自动拾取
|
isAutoHangUp, //是否挂机
|
isAutoBuyDrug, //是否自动买药
|
isAutoSell, //是否自动出售
|
isAutoDevour,//是否自动吞噬
|
isAutoReborn,//是否自动买活
|
//后续IL开发添加预设
|
default1,
|
default2,
|
default3,
|
default4,
|
default5,
|
default6,
|
default7,
|
default8,
|
default9,
|
default10,
|
}
|
|
|
public class HangUpSetModel : Singleton<HangUpSetModel>
|
|
{
|
const string HpSet_Key = "HpSet";
|
const string HangUpBoolSet_Key = "HangUpBoolSet";
|
|
public HangUpSetModel()
|
{
|
}
|
|
#region 缓存数据
|
public float hpSet { get; private set; }
|
public void GetLoginHpSet()
|
{
|
hpSet = SettingMgr.Instance.GetAccountSetFloatInfo(HpSet_Key, 90);
|
}
|
|
public Dictionary<HangUpAutoBoolType, bool> hangUpSetDict { get; private set; }
|
public void GetLoginBoolSet()
|
{
|
hangUpSetDict = new Dictionary<HangUpAutoBoolType, bool>();
|
for(int i = 0; i < 15; i++)
|
{
|
if(!hangUpSetDict.ContainsKey((HangUpAutoBoolType)i))
|
{
|
bool isOpen = SettingMgr.Instance.GetAccountSetBoolInfo(((HangUpAutoBoolType)i).ToString());
|
hangUpSetDict.Add((HangUpAutoBoolType)i, isOpen);
|
}
|
|
}
|
}
|
#endregion
|
|
#region 设置参数
|
|
public void SetHpSet(float value)
|
{
|
hpSet = value;
|
SettingMgr.Instance.SetAccountSetStr(HpSet_Key, value.ToString());
|
}
|
|
public float GetHpSet()
|
{
|
return hpSet;
|
}
|
|
#endregion
|
|
public void SetBoolSetStr(HangUpAutoBoolType dropType, bool isOpen)
|
{
|
SettingMgr.Instance.SetAccountSetStr(dropType.ToString(), isOpen.ToString());
|
|
if (hangUpSetDict != null)
|
{
|
if (hangUpSetDict.ContainsKey(dropType))
|
{
|
hangUpSetDict[dropType] = isOpen;
|
}
|
}
|
|
if (dropType == HangUpAutoBoolType.isAutoDevour || dropType == HangUpAutoBoolType.isAutoReborn)
|
{
|
SendSystemQuest();
|
}
|
|
if (isOpen)
|
{
|
switch (dropType)
|
{
|
case HangUpAutoBoolType.isAutoSell:
|
SettingEffectMgr.Instance.RefreshBagItem();
|
break;
|
case HangUpAutoBoolType.isAutoDevour:
|
SettingEffectMgr.Instance.RefreshBagItem();
|
break;
|
}
|
}
|
}
|
|
public bool GetBool(HangUpAutoBoolType type)
|
{
|
if(hangUpSetDict != null)
|
{
|
bool isOpen = false;
|
hangUpSetDict.TryGetValue(type, out isOpen);
|
return isOpen;
|
}
|
else
|
{
|
return SettingMgr.Instance.GetAccountSetBoolInfo(type.ToString());
|
}
|
|
}
|
|
private void SendSystemQuest()
|
{
|
CB204_tagCMSystem cB204_TagCMSystem = new CB204_tagCMSystem();
|
byte autoEat = 0;
|
byte autoReborn = 0;
|
if (GetBool(HangUpAutoBoolType.isAutoDevour))
|
{
|
autoEat = 1;
|
}
|
|
if (GetBool(HangUpAutoBoolType.isAutoReborn))
|
{
|
autoReborn = 1;
|
}
|
|
cB204_TagCMSystem.AutoEat = autoEat;
|
cB204_TagCMSystem.AutoReborn = autoReborn;
|
GameNetSystem.Instance.SendInfo(cB204_TagCMSystem);
|
}
|
|
|
}
|