/// <summary>
        /// 读取所有碰撞数据
        /// </summary>
        private void ReadcolliderData()
        {
            Type[] types = typeof(ColliderDataSupporter).Assembly.GetTypes();
            foreach (Type type in types)
            {
                if (!type.IsSubclassOf(typeof(B2S_ColliderDataStructureBase)))
                {
                    continue;
                }

                BsonClassMap.LookupClassMap(type);
            }

            if (File.Exists($"{this.colliderDataPath}/{this.colliderDataName[0]}.bytes"))
            {
                byte[] mfile0 = File.ReadAllBytes($"{this.colliderDataPath}/{this.colliderDataName[0]}.bytes");
                //这里不进行长度判断会报错,正在试图访问一个已经关闭的流,咱也不懂,咱也不敢问
                if (mfile0.Length > 0)
                {
                    this.BoxColliderDatas =
                        BsonSerializer.Deserialize <ColliderDataSupporter>(mfile0);
                }
                //Log.Info($"已经读取矩形数据,数据大小为{mfile0.Length}");
            }

            if (File.Exists($"{this.colliderDataPath}/{this.colliderDataName[1]}.bytes"))
            {
                byte[] mfile1 = File.ReadAllBytes($"{this.colliderDataPath}/{this.colliderDataName[1]}.bytes");
                if (mfile1.Length > 0)
                {
                    this.CircleColliderDatas =
                        BsonSerializer.Deserialize <ColliderDataSupporter>(mfile1);
                }
                //Log.Info($"已经读取圆形数据,数据大小为{mfile1.Length}");
            }

            if (File.Exists($"{this.colliderDataPath}/{this.colliderDataName[2]}.bytes"))
            {
                byte[] mfile2 = File.ReadAllBytes($"{this.colliderDataPath}/{this.colliderDataName[2]}.bytes");
                if (mfile2.Length > 0)
                {
                    this.PolygonColliderDatas =
                        BsonSerializer.Deserialize <ColliderDataSupporter>(mfile2);
                }

                //Log.Info($"已经读取多边形数据,数据大小为{mfile2.Length}");
            }
        }
 public B2S_BoxColliderVisualHelper(ColliderNameAndIdInflectSupporter colliderNameAndIdInflectSupporter,
                                    ColliderDataSupporter colliderDataSupporter) : base(colliderNameAndIdInflectSupporter, colliderDataSupporter)
 {
 }
Example #3
0
 public B2S_ColliderVisualHelperBase(ColliderNameAndIdInflectSupporter colliderNameAndIdInflectSupporter,
                                     ColliderDataSupporter colliderDataSupporter)
 {
     this.MColliderNameAndIdInflectSupporter = colliderNameAndIdInflectSupporter;
     this.MColliderDataSupporter             = colliderDataSupporter;
 }