コード例 #1
0
 public VMDFormat(BinaryReader bin, string path, string clip_name)
 {
     try
     {
         this.clip_name = clip_name;
         header         = new Header(bin);
         read_count++;
         motion_list = new MotionList(bin);
         read_count++;
         skin_list = new SkinList(bin);
         read_count++;
         camera_list = new CameraList(bin);
         read_count++;
         light_list = new LightList(bin);
         read_count++;
         self_shadow_list = new SelfShadowList(bin);
         read_count++;
     }
     catch (EndOfStreamException ex)
     {
         Debug.Log((object)ex.Message);
         if (read_count <= 0)
         {
             header = null;
         }
         if (read_count <= 1 || motion_list.motion_count == 0)
         {
             motion_list = null;
         }
         if (read_count <= 2 || skin_list.skin_count == 0)
         {
             skin_list = null;
         }
         if (read_count <= 3 || camera_list.camera_count == 0)
         {
             camera_list = null;
         }
         if (read_count <= 4 || light_list.light_count == 0)
         {
             light_list = null;
         }
         if (read_count <= 5 || self_shadow_list.self_shadow_count == 0)
         {
             self_shadow_list = null;
         }
     }
 }
コード例 #2
0
 public VMDFormat(BinaryReader bin, string path, string clip_name)
 {
     // 読み込み失敗した場合はだいたいデータがない
     // 失敗しても読み込み続けることがあるので例外でキャッチして残りはnullにしておく
     try {
         this.clip_name        = clip_name;
         this.header           = new MMD.VMD.VMDFormat.Header(bin); read_count++;
         this.motion_list      = new MMD.VMD.VMDFormat.MotionList(bin); read_count++;
         this.skin_list        = new MMD.VMD.VMDFormat.SkinList(bin); read_count++;
         this.camera_list      = new MMD.VMD.VMDFormat.CameraList(bin); read_count++;
         this.light_list       = new MMD.VMD.VMDFormat.LightList(bin); read_count++;
         this.self_shadow_list = new MMD.VMD.VMDFormat.SelfShadowList(bin); read_count++;
     } catch (EndOfStreamException e) {
         Debug.Log(e.Message);
         if (read_count <= 0)
         {
             this.header = null;
         }
         if (read_count <= 1 || this.motion_list.motion_count <= 0)
         {
             this.motion_list = null;
         }
         if (read_count <= 2 || this.skin_list.skin_count <= 0)
         {
             this.skin_list = null;
         }
         if (read_count <= 3 || this.camera_list.camera_count <= 0)
         {
             this.camera_list = null;
         }
         if (read_count <= 4 || this.light_list.light_count <= 0)
         {
             this.light_list = null;
         }
         if (read_count <= 5 || this.self_shadow_list.self_shadow_count <= 0)
         {
             this.self_shadow_list = null;
         }
     }
 }
コード例 #3
0
			public VMDFormat(BinaryReader bin, string path, string clip_name)
			{
				// 読み込み失敗した場合はだいたいデータがない
				// 失敗しても読み込み続けることがあるので例外でキャッチして残りはnullにしておく
				try {
					this.clip_name = clip_name;
					this.header = new MMD.VMD.VMDFormat.Header(bin); read_count++;
					this.motion_list = new MMD.VMD.VMDFormat.MotionList(bin); read_count++;
					this.skin_list = new MMD.VMD.VMDFormat.SkinList(bin); read_count++;
					this.camera_list = new MMD.VMD.VMDFormat.CameraList(bin); read_count++;
					this.light_list = new MMD.VMD.VMDFormat.LightList(bin); read_count++;
					this.self_shadow_list = new MMD.VMD.VMDFormat.SelfShadowList(bin); read_count++;
				} catch (EndOfStreamException e) {
					Debug.Log(e.Message);
					if (read_count <= 0)
						this.header = null;
					if (read_count <= 1 || this.motion_list.motion_count <= 0)
						this.motion_list = null;
					if (read_count <= 2 || this.skin_list.skin_count <= 0)
						this.skin_list = null;
					if (read_count <= 3 || this.camera_list.camera_count <= 0)
						this.camera_list = null;
					if (read_count <= 4 || this.light_list.light_count <= 0)
						this.light_list = null;
					if (read_count <= 5 || this.self_shadow_list.self_shadow_count <= 0) 
						this.self_shadow_list = null;
				}
			}