...

Text file src/github.com/google/flatbuffers/tests/union_vector/Attacker.cs

Documentation: github.com/google/flatbuffers/tests/union_vector

     1// <auto-generated>
     2//  automatically generated by the FlatBuffers compiler, do not modify
     3// </auto-generated>
     4
     5using global::System;
     6using global::System.Collections.Generic;
     7using global::Google.FlatBuffers;
     8
     9public struct Attacker : IFlatbufferObject
    10{
    11  private Table __p;
    12  public ByteBuffer ByteBuffer { get { return __p.bb; } }
    13  public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_23_5_26(); }
    14  public static Attacker GetRootAsAttacker(ByteBuffer _bb) { return GetRootAsAttacker(_bb, new Attacker()); }
    15  public static Attacker GetRootAsAttacker(ByteBuffer _bb, Attacker obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
    16  public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
    17  public Attacker __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
    18
    19  public int SwordAttackDamage { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } }
    20  public bool MutateSwordAttackDamage(int sword_attack_damage) { int o = __p.__offset(4); if (o != 0) { __p.bb.PutInt(o + __p.bb_pos, sword_attack_damage); return true; } else { return false; } }
    21
    22  public static Offset<Attacker> CreateAttacker(FlatBufferBuilder builder,
    23      int sword_attack_damage = 0) {
    24    builder.StartTable(1);
    25    Attacker.AddSwordAttackDamage(builder, sword_attack_damage);
    26    return Attacker.EndAttacker(builder);
    27  }
    28
    29  public static void StartAttacker(FlatBufferBuilder builder) { builder.StartTable(1); }
    30  public static void AddSwordAttackDamage(FlatBufferBuilder builder, int swordAttackDamage) { builder.AddInt(0, swordAttackDamage, 0); }
    31  public static Offset<Attacker> EndAttacker(FlatBufferBuilder builder) {
    32    int o = builder.EndTable();
    33    return new Offset<Attacker>(o);
    34  }
    35  public AttackerT UnPack() {
    36    var _o = new AttackerT();
    37    this.UnPackTo(_o);
    38    return _o;
    39  }
    40  public void UnPackTo(AttackerT _o) {
    41    _o.SwordAttackDamage = this.SwordAttackDamage;
    42  }
    43  public static Offset<Attacker> Pack(FlatBufferBuilder builder, AttackerT _o) {
    44    if (_o == null) return default(Offset<Attacker>);
    45    return CreateAttacker(
    46      builder,
    47      _o.SwordAttackDamage);
    48  }
    49}
    50
    51public class AttackerT
    52{
    53  [Newtonsoft.Json.JsonProperty("sword_attack_damage")]
    54  public int SwordAttackDamage { get; set; }
    55
    56  public AttackerT() {
    57    this.SwordAttackDamage = 0;
    58  }
    59}
    60
    61
    62static public class AttackerVerify
    63{
    64  static public bool Verify(Google.FlatBuffers.Verifier verifier, uint tablePos)
    65  {
    66    return verifier.VerifyTableStart(tablePos)
    67      && verifier.VerifyField(tablePos, 4 /*SwordAttackDamage*/, 4 /*int*/, 4, false)
    68      && verifier.VerifyTableEnd(tablePos);
    69  }
    70}

View as plain text