少年修仙传客户端代码仓库
hch
2025-06-12 204ef05a831c9484e2abc561d27ecbff7c797453
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
using UnityEngine;
using System.IO;
 
namespace H2Engine
{
    public abstract class Bhv_Evt : MonoBehaviour
    {
        [HideInInspector]
        public int id;
        [HideInInspector]
        public Evt.E_EventType type;
 
        public virtual void Import(BinaryReader br)
        {
            type = (Evt.E_EventType)br.ReadByte();
            id = br.ReadByte();
        }
 
#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, 2));
            bw.Write((float)System.Math.Round(transform.position.y, 2));
            bw.Write((float)System.Math.Round(transform.position.z, 2));
        }
 
        public abstract void SaveJson(System.Text.StringBuilder stringBuilder);
        public abstract void LoadJson(LitJson.JsonData json);
 
        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
    }
}