少年修仙传客户端代码仓库
Client_PangDeRong
2018-10-11 e95c5f16624be17dc1ac96b2c28c7996928c5d8d
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
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Snxxz.UI
{
    public class OperationFlashRushToBuy : OperationBase
    {
        public List<FlashSaleShop> flashShops = new List<FlashSaleShop>();
 
        public bool TryGetFlashShop(int dayIndex,int timeIndex ,out FlashSaleShop flashSaleShop)
        {
           flashSaleShop = default(FlashSaleShop);
           for (int i = 0; i < flashShops.Count; i++)
            {
                var shop = flashShops[i];
                if (shop.dayIndex == dayIndex
                    && shop.timeIndex == timeIndex)
                {
                    return true;
                }
            }
            return false;
        }
 
        public override bool SatisfyOpenCondition()
        {
            return PlayerDatas.Instance.baseData.LV >= limitLv;
        }
 
        public override void Reset()
        {
            base.Reset();
            flashShops.Clear();
        }
 
        public override string ToDisplayTime()
        {
            var textBuilder = OperationTimeHepler.textBuilder;
            textBuilder.Length = 0;
            textBuilder.Append(startDate.ToDisplay());
            if (startDate != endDate)
            {
                textBuilder.Append("—");
                textBuilder.Append(endDate.ToDisplay());
            }
            return textBuilder.ToString();
        }
 
        public void ParsePackage(HAA17_tagMCFlashSaleInfo package)
        {
            for (int i = 0; i < package.ShopCount; i++)
            {
                var gift = new FlashSaleShop();
                var shop = package.ShopInfo[i];
                gift.dayIndex = shop.DayIndex;
                gift.timeIndex = shop.TimeIndex;
                gift.items = new FlashSaleItem[shop.GiftbagCount];
                for (int k = 0; k < shop.GiftbagCount; k++)
                {
                    var item = new FlashSaleItem();
                    var saleItem = shop.GiftbagInfo[k];
                    item.shopId = (int)saleItem.GiftID;
                    item.limitNum = saleItem.BuyCountLimit;
                    item.fullServerLimitNum = saleItem.ServerBuyCountLimit;
                    item.moneyType = saleItem.MoneyType;
                    item.moneyNumber = (int)saleItem.MoneyNumber;
                    item.moneyOriginal = (int)saleItem.MoneyOriginal;
                    item.itemId = (int)saleItem.ItemID;
                    item.itemCount = saleItem.ItemCount;
                    item.isBind = saleItem.IsBind;
                    gift.items[k] = item;
                }
                flashShops.Add(gift);
            }
        }
 
     
        public struct FlashSaleShop
        {
            public int dayIndex; // 活动第几天
            public int timeIndex;//第几个时间段
            public FlashSaleItem[] items;
        }
 
        public struct FlashSaleItem
        {
            public int shopId;
            public int limitNum;//个人限购数量
            public int fullServerLimitNum; //个人限购数量
            public int moneyType;
            public int moneyNumber;
            public int moneyOriginal;
            public int itemId;
            public int itemCount;
            public int isBind;
        }
    }
}