少年修仙传客户端代码仓库
client_linchunjie
2018-09-13 0c0f5edbef8129a4a2917da0b33cd68c4ee28f5e
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
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Snxxz.UI
{
    public class OperationFlashSale : OperationBase
    {
        public List<FlashSale> flashShops = new List<FlashSale>();
 
        public int IndexOfFlashShop()
        {
            if (flashShops.Count == 1)
            {
                return 0;
            }
            var _timeIndex = IndexOfOpenTime(TimeUtility.ServerNow);
            if (_timeIndex == -1)
            {
                return -1;
            }
            return Mathf.Min(flashShops.Count - 1, allDay ? 0 : _timeIndex);
        }
 
        public FlashSaleGift GetFlashSaleGift(int _index, int _id)
        {
            if (_index < flashShops.Count)
            {
                for (int i = 0; i < flashShops[_index].gifts.Length; i++)
                {
                    if (flashShops[_index].gifts[i].id == _id)
                    {
                        return flashShops[_index].gifts[i];
                    }
                }
            }
            return default(FlashSaleGift);
        }
 
        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 int GetSurplusTime(int index)
        {
            if (!InTime(TimeUtility.ServerNow))
            {
                return 0;
            }
            var seconds = 0;
            if (times.Count == 0)
            {
                DateTime endOperationTime = new DateTime(TimeUtility.Year, TimeUtility.Month,
                        TimeUtility.Day, 0, 0, 0);
                endOperationTime = endOperationTime.AddDays(1);
                seconds = (int)(endOperationTime - TimeUtility.ServerNow).TotalSeconds;
            }
            if (index >= 0 && index < times.Count)
            {
                var _endTime = times[index];
                DateTime endOperationTime = new DateTime(TimeUtility.Year, TimeUtility.Month,
                        TimeUtility.Day, _endTime.endHour, _endTime.endMinute, 0);
                seconds = (int)(endOperationTime - TimeUtility.ServerNow).TotalSeconds;
            }
            return seconds;
        }
 
        public struct FlashSale
        {
            public FlashSaleGift[] gifts;
        }
 
        public struct FlashSaleGift
        {
            public int id;
            public int limitNum;
            public int moneyType;
            public int moneyNumber;
            public int moneyOriginal;
            public FlashSaleItem[] items;
        }
 
        public struct FlashSaleItem
        {
            public int itemId;
            public int itemCount;
            public int isBind;
            public bool isMainItem;
        }
    }
}