public void ParseFrom(byte[] buffer, int offset, int size) { if (buffer == null) { return; } ProtoBufferReader reader = new ProtoBufferReader(buffer, offset, size); foreach (ProtoBufferObject obj in reader.ProtoBufferObjs) { switch (obj.FieldNumber) { case 1: ChallengeId = obj.Value; break; case 2: IsWin = obj.Value; break; case 3: MyDefenseData = new DefenseData(); MyDefenseData.ParseFrom(obj.Value); break; default: break; } } }
/// <summary> /// 挑战之后上传的挑战ID。 /// </summary> public UploadChallenge ( string challengeId, bool isWin, DefenseData myDefenseData ) : this() { ChallengeId = challengeId; IsWin = isWin; MyDefenseData = myDefenseData; }
/// <summary> /// 请求挑战成功。 /// </summary> public RequestChallengeOk ( int majorLevelId, int subLevelId, string challengeId, DefenseData bossData ) : this() { MajorLevelId = majorLevelId; SubLevelId = subLevelId; ChallengeId = challengeId; BossData = bossData; }
public void ParseFrom(byte[] buffer, int offset, int size) { if (buffer == null) { return; } ProtoBufferReader reader = new ProtoBufferReader(buffer, offset, size); foreach (ProtoBufferObject obj in reader.ProtoBufferObjs) { switch (obj.FieldNumber) { case 1: MajorLevelId = obj.Value; break; case 2: SubLevelId = obj.Value; break; case 3: ChallengeId = obj.Value; break; case 4: BossData = new DefenseData(); BossData.ParseFrom(obj.Value); break; case 5: var fellowData = new TeamAdd(); fellowData.ParseFrom(obj.Value); FellowDataList.Add(fellowData); break; default: break; } } }