少年修仙传客户端代码仓库
client_Wu Xijin
2019-03-08 afb266da01d7fb99af1cee0dd4749ca3a56a3e2f
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
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Thursday, February 28, 2019
//--------------------------------------------------------
using System;
using System.Collections.Generic;
using Snxxz.UI;
using System.Linq;
 
namespace Snxxz.UI
{
    [XLua.LuaCallCSharp]
    public class AuctionConfigClass
    {
        public int JobEntry;//选择职业条目
        public int TypeEntry;//类型条目
        public bool JobTipBool;//选择职业条目是否显示
        public bool TypeTipBool;//类型条目是否显示
        public AuctionConfig Config;
    }
    public class AuctionHelpModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk
    {
        public List<AuctionConfig> FullServiceAuctionList = new List<AuctionConfig>();//全服拍卖列表
        public Dictionary<int, AuctionConfigClass> FullServiceAuctionDic = new Dictionary<int, AuctionConfigClass>();//全服拍卖选择记录
        public List<AuctionItemConfig> AuctionItemList = new List<AuctionItemConfig>();//拍卖物品表
        AuctionInquiryModel model { get { return ModelCenter.Instance.GetModel<AuctionInquiryModel>(); } }
       
        public int AuctionTaxrate1 = 0;//全服拍品税率
        public int AuctionTaxrate2 = 0;//仙盟拍品税率
        public int AuctionTaxrate3 = 0;//仙盟拍品个人税率
        private int selectedGenreNow = 0;
        public int SelectedGenreNow//当前选择的页签
        {
            get { return selectedGenreNow; }
            set { selectedGenreNow = value; }
        }
        private ItemModel itemModel;//当前选择想要上架的物品
        public ItemModel ItemModel
        {
            get { return itemModel; }
            set { itemModel = value; }
        }
        private bool wait = true;
        public bool Wait
        {
            get { return wait; }
            set { wait = value; }
        }
        public override void Init()
        {
            var AuctionTaxrateConfig = FuncConfigConfig.Get("AuctionTaxrate");
            AuctionTaxrate1 = int.Parse(AuctionTaxrateConfig.Numerical1);
            AuctionTaxrate2 = int.Parse(AuctionTaxrateConfig.Numerical2);
            AuctionTaxrate3 = int.Parse(AuctionTaxrateConfig.Numerical3);
            GetAuctionList();
            AuctionItemList = AuctionItemConfig.GetValues();
        }
 
        public void OnBeforePlayerDataInitialize()
        {
            GlobalTimeEvent.Instance.secondEvent -= secondEvent;
        }
 
        public void OnPlayerLoginOk()
        {
            wait = true;
            GlobalTimeEvent.Instance.secondEvent += secondEvent;
        }
 
 
 
        public override void UnInit()
        {
 
        }
 
        private void secondEvent()
        {
            if (!wait)
            {
                wait = true;
            }
        }
 
        private void GetAuctionList()//全服获取拍卖列表
        {
            FullServiceAuctionDic.Clear();
            var config = AuctionConfig.GetValues();
            foreach (var value in config)
            {
                FullServiceAuctionList.Add(value);
                if (!FullServiceAuctionDic.ContainsKey(value.Id))
                {
                    AuctionConfigClass AuctionConfig = new AuctionConfigClass();
                    AuctionConfig.JobEntry = 0;
                    AuctionConfig.TypeEntry = 0;
                    AuctionConfig.JobTipBool = value.ChooseItem1 != null && value.ChooseItem1.Length > 0;
                    AuctionConfig.TypeTipBool = value.ChooseItem2 != null && value.ChooseItem2.Length > 0;
                    AuctionConfig.Config = value;
                    FullServiceAuctionDic.Add(value.Id, AuctionConfig);
                }
            }
 
        }     
 
        public List<AuctionItemConfig> GetAuctionItemList(int index)//获取关注列表
        {
            List<AuctionItemConfig> auctionItemList = new List<AuctionItemConfig>();
            for (int i = 0; i < AuctionItemList.Count; i++)
            {
                var auctionItem = AuctionItemList[i];
                if (auctionItem.ItemType == index)
                {
                    auctionItemList.Add(auctionItem);
                }
            }
            auctionItemList.Sort(Compare);
            return auctionItemList;
        }
 
        int Compare(AuctionItemConfig x, AuctionItemConfig y)//数组排列
        {
            bool havex = IsConcernedAbout(x.ItemID);
            bool havey = IsConcernedAbout(y.ItemID);
            if (havex.CompareTo(havey) != 0)
            {
                return -havex.CompareTo(havey);
            }
            if (x.Sortpriority.CompareTo(y.Sortpriority) != 0)
            {
                return x.Sortpriority.CompareTo(y.Sortpriority);
            }
            return 1;
        }
 
        private bool IsConcernedAbout(int itemID)
        {
            bool isBool = false;
            if (model.AttentionAuctionItemIDdic.ContainsKey(itemID))
            {
                isBool = true;
            }
            return isBool;
        }
    }
 
}