少年修仙传客户端代码仓库
client_linchunjie
2018-10-18 f93c57bfd57f97e78c3a00a29f302f5e8c83cdee
System/SystemSetting/HangUpSetModel.cs
@@ -1,169 +1,169 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TableConfig;
using Snxxz.UI;
public enum HangUpAutoBoolType
{
    curFixedScreen = 0, //固定屏
    curFollowScreen, //跟随屏
    whiteEquip, //白色装备
    purpleEquip,
    gem, //宝石
    drug, //药品
    necklaces, //项链、仙器
    coins, //金币
    other,
    isAutoDrop, //是否自动拾取
    isAutoHangUp, //是否挂机
    isAutoBuyDrug, //是否自动买药
    isAutoSell, //是否自动出售
    isAutoDevour,//是否自动吞噬
    isAutoReborn,//是否自动买活
}
public class HangUpSetModel : Singleton<HangUpSetModel>
{
    const string HpSet_Key = "HpSet";
    const string HangUpBoolSet_Key = "HangUpBoolSet";
    public int maxOfflinePluginTime { get; private set; }
    public HangUpSetModel()
    {
        maxOfflinePluginTime = int.Parse(ConfigManager.Instance.GetTemplate<FuncConfigConfig>("TJG").Numerical3);
    }
    #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);
    }
    public int offlinePluginTime { get; private set; }
    public void SetOfflinePluginTime(int time)
    {
        offlinePluginTime = time;
    }
    public string GetOfflinePluginTimeStr()
    {
        TimeSpan timeSpan = TimeSpan.FromSeconds(offlinePluginTime);
        string s = "";
        if (timeSpan.Hours > 0)
        {
            s = Language.Get("ItemOverdue103", timeSpan.Hours);
        }
        if (timeSpan.Minutes > 0)
        {
            s = StringUtility.Contact(s, Language.Get("ItemOverdue104", timeSpan.Minutes));
        }
        if (s == "")
        {
            s = Language.Get("ItemOverdue104", 0);
        }
        return s;
    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TableConfig;
using Snxxz.UI;
public enum HangUpAutoBoolType
{
    curFixedScreen = 0, //固定屏
    curFollowScreen, //跟随屏
    whiteEquip, //白色装备
    purpleEquip,
    gem, //宝石
    drug, //药品
    necklaces, //项链、仙器
    coins, //金币
    other,
    isAutoDrop, //是否自动拾取
    isAutoHangUp, //是否挂机
    isAutoBuyDrug, //是否自动买药
    isAutoSell, //是否自动出售
    isAutoDevour,//是否自动吞噬
    isAutoReborn,//是否自动买活
}
public class HangUpSetModel : Singleton<HangUpSetModel>
{
    const string HpSet_Key = "HpSet";
    const string HangUpBoolSet_Key = "HangUpBoolSet";
    public int maxOfflinePluginTime { get; private set; }
    public HangUpSetModel()
    {
        maxOfflinePluginTime = int.Parse(Config.Instance.Get<FuncConfigConfig>("TJG").Numerical3);
    }
    #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);
    }
    public int offlinePluginTime { get; private set; }
    public void SetOfflinePluginTime(int time)
    {
        offlinePluginTime = time;
    }
    public string GetOfflinePluginTimeStr()
    {
        TimeSpan timeSpan = TimeSpan.FromSeconds(offlinePluginTime);
        string s = "";
        if (timeSpan.Hours > 0)
        {
            s = Language.Get("ItemOverdue103", timeSpan.Hours);
        }
        if (timeSpan.Minutes > 0)
        {
            s = StringUtility.Contact(s, Language.Get("ItemOverdue104", timeSpan.Minutes));
        }
        if (s == "")
        {
            s = Language.Get("ItemOverdue104", 0);
        }
        return s;
    }
}