少年修仙传客户端代码仓库
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
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);
    }
 
 
}