少年修仙传客户端代码仓库
client_Hale
2019-01-18 da8327bb478ff84e3eb150ef5f1c88d5b48b2d89
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
using UnityEngine;
using System.IO;
 
namespace H2Engine
{
    public abstract class Bhv_Evt : MonoBehaviour
    {
        [HideInInspector]
        public int id;
        [HideInInspector]
        public Evt.E_EventType type;
 
#if UNITY_EDITOR
 
        [HideInInspector]
        protected bool showDetail = false;
 
        public abstract bool DrawUI(GUISkin guiSkin);
        public virtual void Save(BinaryWriter bw)
        {
            bw.Write((byte)type);
            bw.Write(id);
            bw.Write((float)System.Math.Round(transform.position.x));
            bw.Write((float)System.Math.Round(transform.position.y));
            bw.Write((float)System.Math.Round(transform.position.z));
        }
 
        public virtual void Load(BinaryReader br)
        {
            id = br.ReadInt32();
            float _x = br.ReadSingle();
            float _y = br.ReadSingle();
            float _z = br.ReadSingle();
            transform.position = new Vector3(_x, _y, _z);
        }
 
        public virtual void Export(BinaryWriter bw)
        {
            bw.Write((byte)type);
            bw.Write(id);
        }
#endif
    }
}