Merge pull request #81 from harochen75/main

fix[protocol] typescript compatible
This commit is contained in:
godotg
2023-11-18 17:54:21 +08:00
committed by GitHub
@@ -205,7 +205,7 @@ public abstract class GenerateTsUtils {
var field = fields[i];
var fieldRegistration = fieldRegistrations[i];
if (field.isAnnotationPresent(Compatible.class)) {
tsBuilder.append(TAB + TAB).append("if (buffer.compatibleRead(beforeReadIndex, length)) {").append(LS);
tsBuilder.append(TAB + TAB).append("if (!buffer.compatibleRead(beforeReadIndex, length)) {").append(LS);
var compatibleReadObject = tsSerializer(fieldRegistration.serializer()).readObject(tsBuilder, 3, field, fieldRegistration);
tsBuilder.append(TAB + TAB+ TAB).append(StringUtils.format("packet.{} = {};", field.getName(), compatibleReadObject)).append(LS);
tsBuilder.append(TAB + TAB).append("}").append(LS);