//转化成Protobuffer类型函数 public DramaModuleCommandInfoV1 ToPB() { DramaModuleCommandInfoV1 v = new DramaModuleCommandInfoV1(); v.CommandType = CommandType; v.StartTime = StartTime; v.DurationTime = DurationTime; v.CreateObjectType = CreateObjectType; v.CreateNPCid = CreateNPCid; v.CreateNpcTransform = CreateNpcTransform.ToPB(); v.Trigger = Trigger; v.SubtitleStyle = SubtitleStyle; v.SubtitleID = SubtitleID; v.SubtitleTargetType = SubtitleTargetType; v.SubtitleTargetConfigId = SubtitleTargetConfigId; v.TranslatePostion = TranslatePostion.ToPB(); v.TranslateTime = TranslateTime; v.TranslateCurve = TranslateCurve; v.TranslateTargetType = TranslateTargetType; v.TranslateTargetId = TranslateTargetId; v.SkillId = SkillId; v.SkllTargetId = SkllTargetId; v.SkillPostion = SkillPostion.ToPB(); v.SkillTargetType = SkillTargetType; v.MusicFileName = MusicFileName; v.SoundFileName = SoundFileName; v.CameraPointType = CameraPointType; for (int i = 0; i < (int)CameraPoints.Count; i++) { v.CameraPoints.Add(CameraPoints[i].ToPB()); } v.FreeType = FreeType; return(v); }
//从Protobuffer类型初始化 public void FromPB(DramaModuleCommandInfoV1 v) { if (v == null) { return; } CommandType = v.CommandType; StartTime = v.StartTime; DurationTime = v.DurationTime; CreateObjectType = v.CreateObjectType; CreateNPCid = v.CreateNPCid; CreateNpcTransform.FromPB(v.CreateNpcTransform); Trigger = v.Trigger; SubtitleStyle = v.SubtitleStyle; SubtitleID = v.SubtitleID; SubtitleTargetType = v.SubtitleTargetType; SubtitleTargetConfigId = v.SubtitleTargetConfigId; TranslatePostion.FromPB(v.TranslatePostion); TranslateTime = v.TranslateTime; TranslateCurve = v.TranslateCurve; TranslateTargetType = v.TranslateTargetType; TranslateTargetId = v.TranslateTargetId; SkillId = v.SkillId; SkllTargetId = v.SkllTargetId; SkillPostion.FromPB(v.SkillPostion); SkillTargetType = v.SkillTargetType; MusicFileName = v.MusicFileName; SoundFileName = v.SoundFileName; CameraPointType = v.CameraPointType; CameraPoints.Clear(); for (int i = 0; i < v.CameraPoints.Count; i++) { CameraPoints.Add(new DramaModuleCameraPointWraperV1()); } for (int i = 0; i < v.CameraPoints.Count; i++) { CameraPoints[i].FromPB(v.CameraPoints[i]); } FreeType = v.FreeType; }