少年修仙传客户端代码仓库
client_Wu Xijin
2019-03-14 f3e4c2075426ddd7fe92e4dd0e4025a8715d794e
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
using System.IO;
using UnityEngine;
 
namespace H2Engine
{
    [System.Serializable]
    public class Evt_RefreshMonster : Evt
    {
        public enum E_OverCondition
        {
            DeadCount,
            Time,
        }
 
        public enum E_RefreshType
        {
            All,
            OneByOneTime,// 根据时间刷新
            OneByOnePrevDie,// 前一只刷出已死亡
        }
 
        public MonsterData[] monsters;
        public E_OverCondition overCondition = E_OverCondition.DeadCount;
        public E_RefreshType refreshType = E_RefreshType.All;
        /// <summary>
        /// 参数
        /// <para>当使用OverCondition类型为DeadCount的时候为个数</para>
        /// <para>当使用OverCondition类型为Time的时候为时间(毫秒)</para>
        /// </summary>
        public int conditionParam;
        /// <summary>
        /// 刷新参数
        /// <para>刷新类型: OneByOneTime, 作为时间(毫秒)</para>
        /// </summary>
        public int refreshParam;
        public int nextEventID = -1;
 
        public override void Load(BinaryReader br)
        {
            base.Load(br);
            overCondition = (Evt_RefreshMonster.E_OverCondition)br.ReadByte();
            refreshType = (Evt_RefreshMonster.E_RefreshType)br.ReadByte();
            refreshParam = br.ReadInt32();
            conditionParam = br.ReadInt32();
            nextEventID = br.ReadInt32();
            int _count = br.ReadInt32();
            monsters = new MonsterData[_count];
            for (int i = 0; i < _count; ++i)
            {
                monsters[i] = new MonsterData();
                monsters[i].Load(br);
            }
        }
 
        /*
            float delay = Time.now
            float interval
            int index
 
            update
                if refreshType == all
                    for index = 0; index < monsters.Length; ++index
                        doRefresh(monsters[index]);
                else if refreshType == onebyoneTime
                    if Time.now - delay > interval
                        doRefresh(monster[index]);
                        index++;
                        delay = Time.now;
                else if refreshType == onebyoneDie
                    if prevNpc.isDie
                        prevNpc = doRefresh(monster[index]);
                        index++;
 
            int deadCount
            float overTime = conditionParam * 0.001f;
            float timePast = Time.now
 
            over
                if condition == None
                    return true;
                else if condition == DeadCount
                    return deadCount > monsters.Length || deadCount > conditionParam;
                else if condition == Time
                    return Time.now - timePast >= overTime;
         */
    }
}