public static Offset<InputCommand> CreateInputCommand(FlatBufferBuilder builder,
 Offset<CommandFrame> frame = default(Offset<CommandFrame>))
   {
       builder.StartObject(1);
       InputCommand.AddFrame(builder, frame);
       return InputCommand.EndInputCommand(builder);
   }
Пример #2
0
 public Offset PostProcessWithCut(Offset cutOffset, out int cutIndex, out Offset botOffset)
 {
     Offset offset = PostProcess1();
     cutIndex = FindCutPoint(cutOffset);
     botOffset = _members[cutIndex - 1].BotOffset;
     return offset;
 }
 private FigureBase(PositionsCollection positions, byte positionNumber, Offset placement)
 {
     _positions = positions;
     _positionNumber = positionNumber;
     _sprite = _positions.GetPositionByNumber(positionNumber);
     _placement = placement;
 }
 protected FigureBase(Offset placement, PositionsCollection positions)
 {
     _positions = positions;
     _placement = placement;
     _positionNumber = 0;
     _sprite = _positions.GetPositionByNumber(0);
 }
Пример #5
0
        public Offset PostProcessWithCut(out AnonymousStruct lastStruct, out int beginIndex)
        {
            // just to satisfy c# compiler (can't you be smarter?)
            beginIndex = -1;

            AnonymousStruct last = (AnonymousStruct)_members.Last();
            Offset maxBotOffset = Offset.Zero;

            foreach (AnonymousStruct struc in _members)
            {
                Offset offset;
                if (object.ReferenceEquals(last, struc))
                {
                    Offset offsetBeforeCut;
                    offset = struc.PostProcessWithCut(
                        maxBotOffset,
                        out beginIndex,
                        out offsetBeforeCut
                    );
                    _botOffset = Offset.Max(maxBotOffset, offsetBeforeCut);
                }
                else
                {
                    offset = struc.PostProcessWithoutCut();
                }
                maxBotOffset = Offset.Max(offset, maxBotOffset);
            }
            lastStruct = last;
            return maxBotOffset;
        }
Пример #6
0
 internal ZoneRuleSet(List<ZoneRecurrence> rules, Offset standardOffset, int upperYear, ZoneYearOffset upperYearOffset)
 {
     this.rules = rules;
     this.StandardOffset = standardOffset;
     this.upperYear = upperYear;
     this.upperYearOffset = upperYearOffset;
 }
        public void Render(ISprite sprite, Offset offset)
        {
            if (sprite == null)
                throw new ArgumentNullException("sprite");
            if (offset == null)
                throw new ArgumentNullException("offset");

            var consoleColorBackup = Console.BackgroundColor;

            Console.Clear(); // yeaks!

            var width = sprite.Size.Width;
            var height = sprite.Size.Height;

            for (int i = widthBorderOffset; i < width + widthBorderOffset; i++)
            {
                Console.SetCursorPosition(i, 0);
                Console.Write('-');
                Console.SetCursorPosition(i, height + heightBorderOffset);
                Console.Write('-');
            }
            for (int j = heightBorderOffset; j < height + heightBorderOffset; j++)
            {
                Console.SetCursorPosition(0, j);
                Console.Write('|');
                Console.SetCursorPosition(width + widthBorderOffset, j);
                Console.Write('|');
            }
            Console.SetCursorPosition(0, 0);
            Console.Write('/');
            Console.SetCursorPosition(width + widthBorderOffset, 0);
            Console.Write('\\');
            Console.SetCursorPosition(0, height + heightBorderOffset);
            Console.Write('\\');
            Console.SetCursorPosition(width + widthBorderOffset, height + heightBorderOffset);
            Console.Write('/');

            var consoleBounds = new { Width = Console.WindowWidth, Height = Console.WindowHeight };
            for (var i = 0; i < sprite.Size.Width; i++)
            {
                for (var j = 0; j < sprite.Size.Height; j++)
                {
                    var x = offset.Left + i + widthBorderOffset;
                    var y = offset.Top + j + heightBorderOffset;

                    var brushBackground = sprite[i, j];

                    if (!((x >= 0) && (x < consoleBounds.Width) && (y >= 0)) || brushBackground == Color.Transparent)
                    {
                        continue;
                    }

                    Console.SetCursorPosition(x, y);
                    Console.BackgroundColor = brushBackground.ToConsoleColor();
                    Console.Write(_brushSymbol);
                }
            }

            Console.BackgroundColor = consoleColorBackup;
        }
Пример #8
0
 public static Offset<SecondTableInA> CreateSecondTableInA(FlatBufferBuilder builder,
     Offset<NamespaceC.TableInC> refer_to_cOffset = default(Offset<NamespaceC.TableInC>))
 {
     builder.StartObject(1);
     SecondTableInA.AddReferToC(builder, refer_to_cOffset);
     return SecondTableInA.EndSecondTableInA(builder);
 }
Пример #9
0
        public static int ToInt32FromBigEndian(byte[] input, int index, Offset offset)
        {
            if (input.Length == 0)
                return 0;

            if (index >= input.Length)
                throw new ArgumentOutOfRangeException("index");

            // If we're offset from the MinValue, calculate the lowest value possible with the given amount of input bytes
            int offsetValue = offset == Offset.Zero ? 0 : (-1 * (1 << Math.Min(input.Length - index, sizeof(int)) * 8 - 1));

            switch (input.Length - index)
            {
                case 1:
                    return offsetValue + input[index];

                case 2:
                    return offsetValue + (input[index] << 8 | input[index + 1]);

                case 3:
                    return offsetValue + (input[index] << 16 | input[index + 1] << 8 | input[index + 2]);

                default:
                    return offsetValue + (input[index] << 24 | input[index + 1] << 16 | input[index + 2] << 8 | input[index + 3]);
            }
        }
Пример #10
0
 public FigureO(Offset placement, Color color)
     : base(placement, new PositionsCollection(color, new List<int[,]> 
 {   _layout, 
     _layout, 
     _layout, 
     _layout }))
 {
 }
Пример #11
0
 public bool Equals(Offset offset)
 {
     // ReSharper disable once CompareOfFloatsByEqualityOperator
     if (X != offset.X) return false;
     // ReSharper disable once CompareOfFloatsByEqualityOperator
     if (Y != offset.Y) return false;
     return true;
 }
 /// <summary>
 /// Creates a zone with a single transition between two offsets.
 /// </summary>
 /// <param name="transitionPoint">The transition point as an <see cref="Instant"/>.</param>
 /// <param name="offsetBefore">The offset of local time from UTC before the transition.</param>
 /// <param name="offsetAfter">The offset of local time from UTC before the transition.</param>
 /// <param name="id">ID for the newly created time zone.</param>
 public SingleTransitionDateTimeZone(Instant transitionPoint, Offset offsetBefore, Offset offsetAfter, string id)
     : base(id, false, Offset.Min(offsetBefore, offsetAfter), Offset.Max(offsetBefore, offsetAfter))
 {
     EarlyInterval = new ZoneInterval(id + "-Early", null, transitionPoint,
         offsetBefore, Offset.Zero);
     LateInterval = new ZoneInterval(id + "-Late", transitionPoint, null,
         offsetAfter, Offset.Zero);
 }
Пример #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ZoneTransition"/> class.
 /// </summary>
 /// <remarks>
 /// </remarks>
 /// <param name="instant">The instant that this transistion occurs at.</param>
 /// <param name="name">The name for the time at this transition e.g. PDT or PST.</param>
 /// <param name="standardOffset">The standard offset at this transition.</param>
 /// <param name="savings">The actual offset at this transition.</param>
 internal ZoneTransition(Instant instant, String name, Offset standardOffset, Offset savings)
 {
     Preconditions.CheckNotNull(name, "name");
     this.Instant = instant;
     this.Name = name;
     this.StandardOffset = standardOffset;
     this.Savings = savings;
 }
Пример #14
0
 public Timezone(string name, string abbreviation, Offset? offset, bool tokenizeOnAbbreviation = true)
 {
     Name = name;
     Abbreviation = abbreviation;
     _offset = offset;
     TimezoneId = null;
     TokenizeOnAbbreviation = tokenizeOnAbbreviation;
 }
Пример #15
0
 public SymbolStyle()
 {
     SymbolOffset = new Offset();
     SymbolScale = 1f;
     Opacity = 1f;
     Width = 32;
     Height = 32;
 }
Пример #16
0
 /// <summary>
 /// Makes the id for this time zone. The format is "UTC+/-Offset".
 /// </summary>
 /// <param name="offset">The offset.</param>
 /// <returns>The generated id string.</returns>
 private static string MakeId(Offset offset)
 {
     if (offset == Offset.Zero)
     {
         return UtcId;
     }
     return UtcId + OffsetPattern.GeneralInvariantPattern.Format(offset);
 }
Пример #17
0
 internal ZoneRuleSet(string name, Offset standardOffset, Offset savings, int upperYear, ZoneYearOffset upperYearOffset)
 {
     this.name = name;
     this.StandardOffset = standardOffset;
     this.fixedSavings = savings;
     this.upperYear = upperYear;
     this.upperYearOffset = upperYearOffset;
 }
Пример #18
0
 private static PointDTO OffsetModulo(PointDTO p, Offset offset, SizeDTO boardSize)
 {
     return new PointDTO
     {
         X = (p.X + offset.DX + boardSize.Width)%boardSize.Width,
         Y = (p.Y + offset.DY + boardSize.Height)%boardSize.Height
     };
 }
Пример #19
0
 /// <summary>
 /// Creates a zone with a single transition between two offsets.
 /// </summary>
 /// <param name="transitionPoint">The transition point as an <see cref="Instant"/>.</param>
 /// <param name="offsetBefore">The offset of local time from UTC before the transition.</param>
 /// <param name="offsetAfter">The offset of local time from UTC before the transition.</param>
 public SingleTransitionZone(Instant transitionPoint, Offset offsetBefore, Offset offsetAfter)
     : base("Single", false, Offset.Min(offsetBefore, offsetAfter), Offset.Max(offsetBefore, offsetAfter))
 {
     earlyInterval = new ZoneInterval("Single-Early", Instant.MinValue, transitionPoint,
         offsetBefore, Offset.Zero);
     lateInterval = new ZoneInterval("Single-Late", transitionPoint, Instant.MaxValue,
         offsetAfter, Offset.Zero);
 }
Пример #20
0
 public static Offset<NamespaceC.TableInC> CreateTableInC(FlatBufferBuilder builder,
     Offset<NamespaceA.TableInFirstNS> refer_to_a1Offset = default(Offset<NamespaceA.TableInFirstNS>),
     Offset<SecondTableInA> refer_to_a2Offset = default(Offset<SecondTableInA>)) {
   builder.StartObject(2);
   TableInC.AddReferToA2(builder, refer_to_a2Offset);
   TableInC.AddReferToA1(builder, refer_to_a1Offset);
   return TableInC.EndTableInC(builder);
 }
Пример #21
0
 /// <summary>
 /// Makes the id for this time zone. The format is "UTC+/-Offset".
 /// </summary>
 /// <param name="offset">The offset.</param>
 /// <returns>The generated id string.</returns>
 private static string MakeId(Offset offset)
 {
     if (offset == Offset.Zero)
     {
         return UtcId;
     }
     return string.Format(CultureInfo.InvariantCulture,
         "{0}{1}", UtcId, OffsetPattern.GeneralInvariantPattern.Format(offset));
 }
Пример #22
0
 /// <summary>
 /// Gets the inclusive upper limit of time that this rule set applies to.
 /// </summary>
 /// <param name="savings">The daylight savings value during the final zone interval.</param>
 /// <returns>The <see cref="LocalInstant"/> of the upper limit for this rule set.</returns>
 internal Instant GetUpperLimit(Offset savings)
 {
     if (IsInfinite)
     {
         return Instant.AfterMaxValue;
     }
     var localInstant = upperYearOffset.GetOccurrenceForYear(upperYear);
     var offset = upperYearOffset.GetRuleOffset(StandardOffset, savings);
     return localInstant.SafeMinus(offset);
 }
Пример #23
0
   public static Offset<VariableData> CreateVariableData(FlatBufferBuilder builder,
 int id = 0,
 Offset<VariableParameters> parameters = default(Offset<VariableParameters>),
 VectorOffset keyFrames = default(VectorOffset))
   {
       builder.StartObject(3);
       VariableData.AddKeyFrames(builder, keyFrames);
       VariableData.AddParameters(builder, parameters);
       VariableData.AddId(builder, id);
       return VariableData.EndVariableData(builder);
   }
    VectorOffset createCurrentQuests(FlatBufferBuilder fbb)
    {
        Entity[] entities = metaPool.GetGroup(Matcher.AllOf(MetaGameMatcher.Quest, MetaGameMatcher.QuestTaskAmount)).GetEntities();
        int count = entities.Length;

        Offset<CurrentQuest>[] quests = new Offset<CurrentQuest>[count];
        for (int i = 0; i < count; i++) {
            var e = entities[i];
            StringOffset questName = fbb.CreateString(e.quest.id);
            quests[i] = CurrentQuest.CreateCurrentQuest(fbb, questName, e.questTaskAmount.toComplete, e.questTaskAmount.done, e.isQuestDone);
        }
        return GameData.CreateCurrentQuestsVector(fbb, quests);
    }
    VectorOffset createDefences(FlatBufferBuilder fbb)
    {
        Entity[] entities = corePool.GetGroup(CoreGameMatcher.Defence).GetEntities();
        int count = entities.Length;

        Offset<CityDefences>[] defences = new Offset<CityDefences>[count];
        for (int i = 0; i < count; i++) {
            var e = entities[i];
            StringOffset type = fbb.CreateString(e.type.value);
            Offset<TimeInterval> production = e.hasStartEndTime ? TimeInterval.CreateTimeInterval (fbb, e.startEndTime.start.GetMicrosecondsFromEpoch (), e.startEndTime.end.GetMicrosecondsFromEpoch ()) : default(Offset<TimeInterval>);
            defences[i] = CityDefences.CreateCityDefences(fbb, type, (sbyte)e.level.value, e.isDefenceUpgrading, production);
        }
        return GameData.CreateDefencesVector(fbb, defences);
    }
Пример #26
0
 public Message(string jsonText)
 {
     IDictionary dict = TopUtils.ParseJson(jsonText);
     this._topic = dict["topic"] as string;
     this._message = dict["message"] as string;
     this._nextOffset = dict["nextOffset"] as string;
     this._offset = dict["offset"] as string;
     this._md5 = dict["md5"] as string;
     this._pubAppKey = dict["pubAppKey"] as string;
     //this._userId = long.Parse(dict["userId"] as string);
     this._userId = Convert.ToInt64(dict["userId"]);
     this._offsetDO = new Offset(_offset);
     this._nextOffsetDO = new Offset(_nextOffset);
 }
Пример #27
0
   public static Offset<Island> CreateIsland(FlatBufferBuilder builder,
 StringOffset name = default(StringOffset),
 StringOffset owner = default(StringOffset),
 sbyte level = 0,
 Offset<TimeInterval> production = default(Offset<TimeInterval>),
 VectorOffset defences = default(VectorOffset))
   {
       builder.StartObject(5);
       Island.AddDefences(builder, defences);
       Island.AddProduction(builder, production);
       Island.AddOwner(builder, owner);
       Island.AddName(builder, name);
       Island.AddLevel(builder, level);
       return Island.EndIsland(builder);
   }
Пример #28
0
        /// <summary>
        /// Use to add multiple offsets into a single offset that represents a coordinate system
        /// </summary>
        public static Offset operator +(Offset o1, Offset o2)
        {
            var addedOffset = new Offset();

            addedOffset.X = o1.X + o2.X;
            addedOffset.Y = o1.Y + o2.Y;
            addedOffset.Z = o1.Z + o2.Z;

            // Inverted coordinate systems cancel each other out (like multiplying a negative by a negative)
            addedOffset.InvertX = o1.InvertX != o2.InvertX;
            addedOffset.InvertY = o1.InvertY != o2.InvertY;
            addedOffset.InvertZ = o1.InvertZ != o2.InvertZ;

            return addedOffset;
        }
Пример #29
0
   public static Offset<rootData> CreaterootData(FlatBufferBuilder builder,
 Offset<mesh> dataMesh = default(Offset<mesh>),
 Offset<skeleton> dataSkeleton = default(Offset<skeleton>),
 Offset<animation> dataAnimation = default(Offset<animation>),
 Offset<uvSwapItemHolder> dataUvSwapItem = default(Offset<uvSwapItemHolder>),
 Offset<anchorPointsHolder> dataAnchorPoints = default(Offset<anchorPointsHolder>))
   {
       builder.StartObject(5);
       rootData.AddDataAnchorPoints(builder, dataAnchorPoints);
       rootData.AddDataUvSwapItem(builder, dataUvSwapItem);
       rootData.AddDataAnimation(builder, dataAnimation);
       rootData.AddDataSkeleton(builder, dataSkeleton);
       rootData.AddDataMesh(builder, dataMesh);
       return rootData.EndrootData(builder);
   }
 VectorOffset createBuildings(FlatBufferBuilder fbb)
 {
     Entity[] entities = corePool.GetGroup(CoreGameMatcher.Building).GetEntities();
     int count = entities.Length;
     Offset<Building>[] buildings = new Offset<Building>[count];
     for (int i = 0; i < count; i++) {
         var e = entities[i];
         var production = Production (fbb, e);
         StringOffset buildingType = fbb.CreateString (e.type.value);
         Offset<Position> position = Position.CreatePosition(fbb, (short)e.position.x, (short)e.position.y);
         VectorOffset storage = e.hasBuildingStorage ? TypeAmountVector(fbb, e.buildingStorage.items) : default(VectorOffset);;
         buildings[i] = Building.CreateBuilding(fbb, buildingType, (sbyte)e.level.value, position, e.isProductionPaused, production, storage);
     }
     return GameData.CreateBuildingsVector(fbb, buildings);
 }
Пример #31
0
 public static void AddMyData(FlatBufferBuilder builder, Offset <Login_my_DB> myDataOffset)
 {
     builder.AddOffset(4, myDataOffset.Value, 0);
 }
Пример #32
0
 public static void AddHeroAttr(FlatBufferBuilder builder, Offset <Attr> heroAttrOffset)
 {
     builder.AddOffset(40, heroAttrOffset.Value, 0);
 }
Пример #33
0
 /// <summary>
 /// Converts this date instance to its equivalent <see cref="ZonedDateTime"/> representation.
 /// <para/>
 /// The <see cref="ZonedDateTime"/> representation is initialized to the "UTC" time zone.
 /// </summary>
 /// <returns>
 /// The equivalent <see cref="ZonedDateTime"/> respresentation of this date time instance.
 /// </returns>
 public ZonedDateTime AsZonedDateTime() => this == default(DATE)
     ? default(ZonedDateTime)
     : new ZonedDateTime(new LocalDateTime(FULLYEAR, MONTH, MDAY, 0, 0, 0),
                         DateTimeZoneProviders.Tzdb["UTC"],
                         Offset.FromHours(0));
Пример #34
0
 public static void AddConfiguration(FlatBufferBuilder builder, Offset <FlatConfiguration> configurationOffset)
 {
     builder.AddOffset(2, configurationOffset.Value, 0);
 }
Пример #35
0
 public static void FinishAccountInfoBuffer(FlatBufferBuilder builder, Offset <AccountInfo> offset)
 {
     builder.Finish(offset.Value);
 }
Пример #36
0
    public void findteambt()
    {
        serverMessagelist = new List <ByteBuffer>();

        findteam_bt = GameObject.Find("findteam");
        findteam_bt.SetActive(false);

        var bossstart = GameObject.Find("bossreadystart_sc").GetComponent <bossreadystart>();

        user1slot  = bossstart.user1slot;
        user2slot  = bossstart.user2slot;
        user3slot  = bossstart.user3slot;
        user4slot  = bossstart.user4slot;
        tcpclosebt = bossstart.tcpclosebt;
        finding    = bossstart.finding;
        playerborn = bossstart.playerborn;


        finding.enabled = true;

        tcpclosebt.SetActive(true);
        // playerborn.SetActive(false);

        //내 정보를 서버에 보낸다
        socketConnection = new TcpClient("49.247.131.90", 4345);
        //tcp 통신으로 내가 1번이면
        //데이터 직렬화를 위한 객체생성 (id, nickname, userindex, level, power,hp )
        builder = new FlatBufferBuilder(1024);
        var idoffset       = builder.CreateString(PlayerPrefs.GetString("id"));
        var nicknameoffset = builder.CreateString(PlayerPrefs.GetString("nickname"));

        Player.StartPlayer(builder);
        Player.AddStartstate(builder, PlayerStart.Match);
        Player.AddUserindex(builder, PlayerPrefs.GetInt("userindex"));
        Player.AddId(builder, idoffset);
        Player.AddNickname(builder, nicknameoffset);
        Player.AddLevel(builder, PlayerPrefs.GetInt("level"));


        string totalpower_pp = PlayerPrefs.GetString("totalpower");
        // int totalpower = int.Parse(totalpower_pp);
        int totalpower;

        int.TryParse(totalpower_pp, out totalpower);

        string totalhp_pp = PlayerPrefs.GetString("totalhp");
        //  int totalhp = int.Parse(totalhp_pp);
        int totalhp;

        int.TryParse(totalhp_pp, out totalhp);

        string gunid_pp = PlayerPrefs.GetString("gunid");
        // int gunid = int.Parse(gunid_pp);
        int gunid;

        int.TryParse(gunid_pp, out gunid);

        string armorid_pp = PlayerPrefs.GetString("armorid");
        //  int armorid = int.Parse(armorid_pp);
        int armorid;

        int.TryParse(armorid_pp, out armorid);

        string skill1id_pp = PlayerPrefs.GetString("skill1id");
        //  int skill1id = int.Parse(skill1id_pp);
        int skill1id;

        int.TryParse(skill1id_pp, out skill1id);

        string skill2id_pp = PlayerPrefs.GetString("skill2id");
        // int skill2id = int.Parse(skill2id_pp);
        int skill2id;

        int.TryParse(skill2id_pp, out skill2id);

        Player.AddPower(builder, totalpower);
        Player.AddHp(builder, totalhp);
        Player.AddGunid(builder, gunid);
        Player.AddArmorid(builder, armorid);
        Player.AddSkill1id(builder, skill1id);
        Player.AddSkill2id(builder, skill2id);

        Offset <Player> pypplayer = Player.EndPlayer(builder);


        Game.StartGame(builder);
        Game.AddPlayer(builder, pypplayer);
        Game.AddTablenum(builder, 0);
        Offset <Game> game = Game.EndGame(builder);

        builder.Finish(game.Value);
        sendBuffer = builder.SizedByteArray();
        sendbb     = new ByteBuffer(sendBuffer);


        //소켓 연결
        stream = socketConnection.GetStream();
        if (stream.CanWrite)
        {
            stream.Write(sendBuffer, 0, sendBuffer.Length);
            stream.Flush();
        }


        Debug.Log("Client send 3");

        //데이터 받는 쓰레드 시작serverMessage2
        thread = new Thread(Receiving);
        thread.Start();

        // findbutton.gameObject.SetActive(false);
        // finding.enabled = true;
        tcpclosebt.gameObject.SetActive(true);

        //데이터 보내는 코루틴 시작
        Time.timeScale = 1f;

        Coroutine_receive = StartCoroutine(receive());

        Debug.Log("Client send 4");
    }
Пример #37
0
 public override void paint(PaintingContext context, Offset offset)
 {
     base.paint(context, offset);
     paintImageSpan(context, offset);
 }
Пример #38
0
        private protected async Task WriteRecordBatchInternalAsync(RecordBatch recordBatch,
                                                                   CancellationToken cancellationToken = default)
        {
            // TODO: Truncate buffers with extraneous padding / unused capacity

            if (!HasWrittenSchema)
            {
                await WriteSchemaAsync(Schema, cancellationToken).ConfigureAwait(false);

                HasWrittenSchema = true;
            }

            (ArrowRecordBatchFlatBufferBuilder recordBatchBuilder, VectorOffset fieldNodesVectorOffset) =
                PreparingWritingRecordBatch(recordBatch);

            VectorOffset buffersVectorOffset = Builder.EndVector();

            // Serialize record batch

            StartingWritingRecordBatch();

            Offset <Flatbuf.RecordBatch> recordBatchOffset = Flatbuf.RecordBatch.CreateRecordBatch(Builder, recordBatch.Length,
                                                                                                   fieldNodesVectorOffset,
                                                                                                   buffersVectorOffset);

            long metadataLength = await WriteMessageAsync(Flatbuf.MessageHeader.RecordBatch,
                                                          recordBatchOffset, recordBatchBuilder.TotalLength,
                                                          cancellationToken).ConfigureAwait(false);

            // Write buffer data

            IReadOnlyList <ArrowRecordBatchFlatBufferBuilder.Buffer> buffers = recordBatchBuilder.Buffers;

            long bodyLength = 0;

            for (int i = 0; i < buffers.Count; i++)
            {
                ArrowBuffer buffer = buffers[i].DataBuffer;
                if (buffer.IsEmpty)
                {
                    continue;
                }

                await WriteBufferAsync(buffer, cancellationToken).ConfigureAwait(false);

                int paddedLength = checked ((int)BitUtility.RoundUpToMultipleOf8(buffer.Length));
                int padding      = paddedLength - buffer.Length;
                if (padding > 0)
                {
                    await WritePaddingAsync(padding).ConfigureAwait(false);
                }

                bodyLength += paddedLength;
            }

            // Write padding so the record batch message body length is a multiple of 8 bytes

            int bodyPaddingLength = CalculatePadding(bodyLength);

            await WritePaddingAsync(bodyPaddingLength).ConfigureAwait(false);

            FinishedWritingRecordBatch(bodyLength + bodyPaddingLength, metadataLength);
        }
Пример #39
0
 public static FieldType Build <T>(Flatbuf.Type type, Offset <T> offset)
     where T : struct =>
 new FieldType(type, offset.Value);
Пример #40
0
 public void setIMEPos(Offset imeGlobalPos)
 {
 }
Пример #41
0
 public static void AddStartPos(FlatBufferBuilder builder, Offset <Vec3> StartPosOffset)
 {
     builder.AddStruct(5, StartPosOffset.Value, 0);
 }
Пример #42
0
 public static void AddTargetPos(FlatBufferBuilder builder, Offset <Vec3> targetPosOffset)
 {
     builder.AddStruct(4, targetPosOffset.Value, 0);
 }
 public static void AddFix(FlatBufferBuilder builder, Offset <UdpMessages.ServerClientMessages.MatchStartMessageFix> fixOffset)
 {
     builder.AddStruct(0, fixOffset.Value, 0);
 }
Пример #44
0
 private static int GetAtOffset(int[] array, Offset offset)
 {
     return(array[(long)offset]);
 }
Пример #45
0
 public static void FinishGetGameRewardsRspBuffer(FlatBufferBuilder builder, Offset <GetGameRewardsRsp> offset)
 {
     builder.Finish(offset.Value);
 }
Пример #46
0
 void _doubleTapTimeout()
 {
     this._doubleTapTimer = null;
     this._lastTapOffset  = null;
 }
Пример #47
0
 /// <summary>
 ///     Returns the hash code for this RequestMessage instance.
 /// </summary>
 /// <returns>An integer representing the hash code of this instace of the RequestMessage class.</returns>
 public override int GetHashCode()
 {
     return(MessageLength.GetHashCode() ^ Id.GetHashCode() ^ Index.GetHashCode() ^ Offset.GetHashCode() ^
            Length.GetHashCode());
 }
Пример #48
0
        public override int GetHashCode()
        {
            int result = 17;

            unchecked
            {
                if (Uri != null)
                {
                    result = (result * 31) + Uri.GetHashCode();
                }

                result = (result * 31) + Offset.GetHashCode();
                result = (result * 31) + Length.GetHashCode();
                if (MimeType != null)
                {
                    result = (result * 31) + MimeType.GetHashCode();
                }

                if (Hashes != null)
                {
                    foreach (var value_0 in Hashes)
                    {
                        result = result * 31;
                        if (value_0 != null)
                        {
                            result = (result * 31) + value_0.GetHashCode();
                        }
                    }
                }

                if (Properties != null)
                {
                    // Use xor for dictionaries to be order-independent.
                    int xor_0 = 0;
                    foreach (var value_1 in Properties)
                    {
                        xor_0 ^= value_1.Key.GetHashCode();
                        if (value_1.Value != null)
                        {
                            xor_0 ^= value_1.Value.GetHashCode();
                        }
                    }

                    result = (result * 31) + xor_0;
                }

                if (Tags != null)
                {
                    foreach (var value_2 in Tags)
                    {
                        result = result * 31;
                        if (value_2 != null)
                        {
                            result = (result * 31) + value_2.GetHashCode();
                        }
                    }
                }
            }

            return(result);
        }
Пример #49
0
 public static void FinishSizePrefixedFlatInferenceRequestBuffer(FlatBufferBuilder builder, Offset <FlatInferenceRequest> offset)
 {
     builder.FinishSizePrefixed(offset.Value);
 }
Пример #50
0
        private void paintImageSpan(PaintingContext context, Offset offset)
        {
            var canvas = context.canvas;
            var bounds = offset & size;

            canvas.save();
            var textOffset = 0;

            foreach (var span in text.children)
            {
                if (span is ImageSpan imageSpan)
                {
                    var offsetForCaret = getOffsetForCaret(
                        new TextPosition(offset: textOffset),
                        bounds
                        );
                    if (textOffset != 0 &&
                        offsetForCaret.dx == 0F &&
                        offsetForCaret.dy == 0F)
                    {
                        return;
                    }

                    var topLeftOffset = new Offset(
                        offset.dx + offsetForCaret.dx - (textOffset == 0 ? 0 : 0),
                        offset.dy + offsetForCaret.dy
                        );
                    if (imageSpan.imageResolver.image == null)
                    {
                        canvas.drawRect(
                            rect: Rect.fromLTWH(
                                topLeftOffset.dx + imageSpan.margin.left,
                                topLeftOffset.dy + imageSpan.margin.top,
                                imageSpan.innerWidth,
                                imageSpan.innerHeight
                                ),
                            paint: ImagePlaceholderBackgroundPaint);
                        var textBlobBuilder = new TextBlobBuilder();
                        var text            = $"{(char) Icons.MaterialImage.codePoint}";
                        var iconSize        = imageSpan.innerWidth > imageSpan.innerHeight * 3
                            ? imageSpan.innerHeight * 3 / 4
                            : imageSpan.innerWidth / 4;
                        textBlobBuilder.allocRunPos(
                            style: new TextStyle(
                                fontFamily: Icons.MaterialImage.fontFamily,
                                fontSize: iconSize
                                ),
                            text: text,
                            offset: 0,
                            size: text.Length);
                        var rect = topLeftOffset & new Size(imageSpan.innerWidth, imageSpan.innerHeight);
                        textBlobBuilder.setBounds(rect);
                        canvas.drawTextBlob(
                            textBlobBuilder.make(),
                            new Offset(
                                rect.left + (rect.width - iconSize) / 2,
                                rect.top + (rect.height + iconSize) / 2),
                            ImagePlaceholderPaint);

                        imageSpan.imageResolver.Resolve((imageInfo, synchronousCall) =>
                        {
                            if (synchronousCall)
                            {
                                ImageUtils.paintImage(
                                    canvas: canvas,
                                    rect: topLeftOffset & new Size(imageSpan.width, imageSpan.height),
                                    image: imageSpan.imageResolver.image,
                                    fit: BoxFit.scaleDown,
                                    alignment: Alignment.center
                                    );
                            }
                            else
                            {
                                if (owner == null || !owner.debugDoingPaint)
                                {
                                    markNeedsPaint();
                                }
                            }
                        });
                        textOffset += imageSpan.toPlainText().Length;

                        continue;
                    }

                    ImageUtils.paintImage(
                        canvas: canvas,
                        rect: Rect.fromLTWH(
                            topLeftOffset.dx + imageSpan.margin.left,
                            topLeftOffset.dy + imageSpan.margin.top,
                            imageSpan.innerWidth,
                            imageSpan.innerHeight
                            ),
                        image: imageSpan.imageResolver.image,
                        fit: BoxFit.scaleDown,
                        alignment: Alignment.center
                        );
                }

                textOffset += span.toPlainText().Length;
            }

            canvas.restore();
        }
Пример #51
0
        public override Widget build(BuildContext context)
        {
            base.build(context);
            D.assert(WidgetsD.debugCheckHasDirectionality(context));
            TextEditingController     controller = _effectiveController;
            List <TextInputFormatter> formatters = widget.inputFormatters ?? new List <TextInputFormatter>();
            bool   enabled      = widget.enabled ?? true;
            Offset cursorOffset =
                new Offset(
                    CupertinoTextFieldUtils._iOSHorizontalCursorOffsetPixels / MediaQuery.of(context).devicePixelRatio,
                    0);

            if (widget.maxLength != null && widget.maxLengthEnforced)
            {
                formatters.Add(new LengthLimitingTextInputFormatter(widget.maxLength));
            }

            CupertinoThemeData themeData     = CupertinoTheme.of(context);
            TextStyle          resolvedStyle = widget.style?.copyWith(
                color: CupertinoDynamicColor.resolve(widget.style?.color, context),
                backgroundColor: CupertinoDynamicColor.resolve(widget.style?.backgroundColor, context)
                );
            TextStyle textStyle = themeData.textTheme.textStyle.merge(resolvedStyle);
            TextStyle resolvedPlaceholderStyle = widget.placeholderStyle?.copyWith(
                color: CupertinoDynamicColor.resolve(widget.placeholderStyle?.color, context),
                backgroundColor: CupertinoDynamicColor.resolve(widget.placeholderStyle?.backgroundColor, context)
                );
            TextStyle  placeholderStyle   = textStyle.merge(resolvedPlaceholderStyle);
            Brightness?keyboardAppearance = widget.keyboardAppearance ?? CupertinoTheme.brightnessOf(context);

            Color cursorColor   = CupertinoDynamicColor.resolve(widget.cursorColor, context) ?? themeData.primaryColor;
            Color disabledColor = CupertinoDynamicColor.resolve(CupertinoTextFieldUtils._kDisabledBackground, context);

            Color     decorationColor = CupertinoDynamicColor.resolve(widget.decoration?.color, context);
            BoxBorder border          = widget.decoration?.border;
            Border    resolvedBorder  = border as Border;

            if (border is Border)
            {
                BorderSide resolveBorderSide(BorderSide side)
                {
                    return(side == BorderSide.none
                        ? side
                        : side.copyWith(color: CupertinoDynamicColor.resolve(side.color, context)));
                }

                resolvedBorder = (Border)(border == null || border.GetType() != typeof(Border)
                    ? border
                    : new Border(
                                              top: resolveBorderSide(((Border)border).top),
                                              left: resolveBorderSide(((Border)border).left),
                                              bottom: resolveBorderSide(((Border)border).bottom),
                                              right: resolveBorderSide(((Border)border).right)
                                              ));
            }

            BoxDecoration effectiveDecoration = widget.decoration?.copyWith(
                border: resolvedBorder,
                color: enabled ? decorationColor : (decorationColor == null ? disabledColor : decorationColor)
                );

            Widget paddedEditable = new Padding(
                padding: widget.padding,
                child: new RepaintBoundary(
                    child: new EditableText(
                        key: editableTextKey,
                        controller: controller,
                        readOnly: widget.readOnly,
                        toolbarOptions: widget.toolbarOptions,
                        showCursor: widget.showCursor,
                        showSelectionHandles: _showSelectionHandles,
                        focusNode: _effectiveFocusNode,
                        keyboardType: widget.keyboardType,
                        textInputAction: widget.textInputAction,
                        textCapitalization: widget.textCapitalization,
                        style: textStyle,
                        strutStyle: widget.strutStyle,
                        textAlign: widget.textAlign,
                        autofocus: widget.autofocus,
                        obscureText: widget.obscureText,
                        autocorrect: widget.autocorrect,
                        smartDashesType: widget.smartDashesType,
                        smartQuotesType: widget.smartQuotesType,
                        enableSuggestions: widget.enableSuggestions,
                        maxLines: widget.maxLines,
                        minLines: widget.minLines,
                        expands: widget.expands,
                        selectionColor: CupertinoTheme.of(context).primaryColor.withOpacity(0.2f),
                        selectionControls: widget.selectionEnabled
                        ? CupertinoTextFieldUtils.cupertinoTextSelectionControls : null,
                        onChanged: widget.onChanged,
                        onSelectionChanged: _handleSelectionChanged,
                        onEditingComplete: widget.onEditingComplete,
                        onSubmitted: widget.onSubmitted,
                        inputFormatters: formatters,
                        rendererIgnoresPointer: true,
                        cursorWidth: widget.cursorWidth,
                        cursorRadius: widget.cursorRadius,
                        cursorColor: cursorColor,
                        cursorOpacityAnimates: true,
                        cursorOffset: cursorOffset,
                        paintCursorAboveText: true,
                        backgroundCursorColor: CupertinoDynamicColor.resolve(CupertinoColors.inactiveGray, context),
                        selectionHeightStyle: widget.selectionHeightStyle,
                        selectionWidthStyle: widget.selectionWidthStyle,
                        scrollPadding: widget.scrollPadding,
                        keyboardAppearance: keyboardAppearance,
                        dragStartBehavior: widget.dragStartBehavior,
                        scrollController: widget.scrollController,
                        scrollPhysics: widget.scrollPhysics,
                        enableInteractiveSelection: widget.enableInteractiveSelection
                        )
                    )
                );

            return(new IgnorePointer(
                       ignoring: !enabled,
                       child: new Container(
                           decoration: effectiveDecoration,
                           child: _selectionGestureDetectorBuilder.buildGestureDetector(
                               behavior: HitTestBehavior.translucent,
                               child: new Align(
                                   alignment: new Alignment(-1.0f, _textAlignVertical.y),
                                   widthFactor: 1.0f,
                                   heightFactor: 1.0f,
                                   child: _addTextDependentAttachments(paddedEditable, textStyle, placeholderStyle)
                                   )
                               )
                           )

                       ));
        }
Пример #52
0
        public static IEnumerable <PointerEvent> expand(IEnumerable <PointerData> data, float devicePixelRatio)
        {
            foreach (PointerData datum in data)
            {
                var    position    = new Offset(datum.physicalX, datum.physicalY) / devicePixelRatio;
                Offset delta       = new Offset(datum.physicalDeltaX, datum.physicalDeltaY) / devicePixelRatio;
                var    radiusMinor = _toLogicalPixels(datum.radiusMinor, devicePixelRatio);
                var    radiusMajor = _toLogicalPixels(datum.radiusMajor, devicePixelRatio);
                var    radiusMin   = _toLogicalPixels(datum.radiusMin, devicePixelRatio);
                var    radiusMax   = _toLogicalPixels(datum.radiusMax, devicePixelRatio);
                var    timeStamp   = datum.timeStamp;
                var    kind        = datum.kind;
                // TODO: datum.signalKind is not nullable, "else" could not be reached
                if (datum.signalKind == ui.PointerSignalKind.none)
                {
                    switch (datum.change)
                    {
                    case PointerChange.add: {
                        yield return(new PointerAddedEvent(
                                         timeStamp: timeStamp,
                                         kind: kind,
                                         device: datum.device,
                                         position: position,
                                         obscured: datum.obscured,
                                         pressureMin: datum.pressureMin,
                                         pressureMax: datum.pressureMax,
                                         distance: datum.distance,
                                         distanceMax: datum.distanceMax,
                                         radiusMin: radiusMin,
                                         radiusMax: radiusMax,
                                         orientation: datum.orientation,
                                         tilt: datum.tilt
                                         ));

                        break;
                    }

                    case PointerChange.hover: {
                        yield return(new PointerHoverEvent(
                                         timeStamp: timeStamp,
                                         kind: kind,
                                         device: datum.device,
                                         position: position,
                                         delta: delta,
                                         buttons: datum.buttons,
                                         obscured: datum.obscured,
                                         pressureMin: datum.pressureMin,
                                         pressureMax: datum.pressureMax,
                                         distance: datum.distance,
                                         distanceMax: datum.distanceMax,
                                         size: datum.size,
                                         radiusMajor: radiusMajor,
                                         radiusMinor: radiusMinor,
                                         radiusMin: radiusMin,
                                         radiusMax: radiusMax,
                                         orientation: datum.orientation,
                                         tilt: datum.tilt,
                                         synthesized: datum.synthesized
                                         ));

                        break;
                    }

                    case PointerChange.down: {
                        yield return(new PointerDownEvent(
                                         timeStamp: timeStamp,
                                         pointer: datum.pointerIdentifier,
                                         kind: kind,
                                         device: datum.device,
                                         position: position,
                                         buttons: gesture_._synthesiseDownButtons(datum.buttons, kind),
                                         obscured: datum.obscured,
                                         pressure: datum.pressure,
                                         pressureMin: datum.pressureMin,
                                         pressureMax: datum.pressureMax,
                                         distanceMax: datum.distanceMax,
                                         size: datum.size,
                                         radiusMajor: radiusMajor,
                                         radiusMinor: radiusMinor,
                                         radiusMin: radiusMin,
                                         radiusMax: radiusMax,
                                         orientation: datum.orientation,
                                         tilt: datum.tilt
                                         ));
                    }
                    break;

                    case PointerChange.move: {
                        yield return(new PointerMoveEvent(
                                         timeStamp: timeStamp,
                                         pointer: datum.pointerIdentifier,
                                         kind: kind,
                                         device: datum.device,
                                         position: position,
                                         delta: delta,
                                         buttons: gesture_._synthesiseDownButtons(datum.buttons, kind),
                                         obscured: datum.obscured,
                                         pressure: datum.pressure,
                                         pressureMin: datum.pressureMin,
                                         pressureMax: datum.pressureMax,
                                         distanceMax: datum.distanceMax,
                                         size: datum.size,
                                         radiusMajor: radiusMajor,
                                         radiusMinor: radiusMinor,
                                         radiusMin: radiusMin,
                                         radiusMax: radiusMax,
                                         orientation: datum.orientation,
                                         tilt: datum.tilt,
                                         platformData: datum.platformData,
                                         synthesized: datum.synthesized
                                         ));
                    }
                    break;

                    case PointerChange.up:
                        yield return(new PointerUpEvent(
                                         timeStamp: timeStamp,
                                         pointer: datum.pointerIdentifier,
                                         kind: kind,
                                         device: datum.device,
                                         position: position,
                                         buttons: datum.buttons,
                                         obscured: datum.obscured,
                                         pressure: datum.pressure,
                                         pressureMin: datum.pressureMin,
                                         pressureMax: datum.pressureMax,
                                         distance: datum.distance,
                                         distanceMax: datum.distanceMax,
                                         size: datum.size,
                                         radiusMajor: radiusMajor,
                                         radiusMinor: radiusMinor,
                                         radiusMin: radiusMin,
                                         radiusMax: radiusMax,
                                         orientation: datum.orientation,
                                         tilt: datum.tilt
                                         ));

                        break;

                    case PointerChange.cancel: {
                        yield return(new PointerCancelEvent(
                                         timeStamp: timeStamp,
                                         pointer: datum.pointerIdentifier,
                                         kind: kind,
                                         device: datum.device,
                                         position: position,
                                         buttons: datum.buttons,
                                         obscured: datum.obscured,
                                         pressureMin: datum.pressureMin,
                                         pressureMax: datum.pressureMax,
                                         distance: datum.distance,
                                         distanceMax: datum.distanceMax,
                                         size: datum.size,
                                         radiusMajor: radiusMajor,
                                         radiusMinor: radiusMinor,
                                         radiusMin: radiusMin,
                                         radiusMax: radiusMax,
                                         orientation: datum.orientation,
                                         tilt: datum.tilt
                                         ));
                    }
                    break;

                    case ui.PointerChange.remove:
                        yield return(new PointerRemovedEvent(
                                         timeStamp: timeStamp,
                                         kind: kind,
                                         device: datum.device,
                                         position: position,
                                         obscured: datum.obscured,
                                         pressureMin: datum.pressureMin,
                                         pressureMax: datum.pressureMax,
                                         distanceMax: datum.distanceMax,
                                         radiusMin: radiusMin,
                                         radiusMax: radiusMax
                                         ));

                        break;

                    default:
                        //TODO: PUT KEYBOARD TO A PROPRER POSITION
                        if (datum.kind == PointerDeviceKind.keyboard)
                        {
                            var keyBoardEvent = new Event();
                            if (datum.change == PointerChange.kMouseDown)
                            {
                                keyBoardEvent.type = EventType.KeyDown;
                            }
                            else if (datum.change == PointerChange.kMouseUp)
                            {
                                keyBoardEvent.type = EventType.KeyUp;
                            }
                            keyBoardEvent.keyCode = (KeyCode)datum.buttons;
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
                            keyBoardEvent.shift   = (datum.modifier & (1 << (int)FunctionKey.shift)) > 0;
                            keyBoardEvent.alt     = (datum.modifier & (1 << (int)FunctionKey.alt)) > 0;
                            keyBoardEvent.command = (datum.modifier & (1 << (int)FunctionKey.command)) > 0;
                            keyBoardEvent.control = (datum.modifier & (1 << (int)FunctionKey.control)) > 0;
#endif
                            RawKeyboard.instance._handleKeyEvent(keyBoardEvent);
                            TextInput.OnGUI();
                        }
                        break;
                    }
                }
                else
                {
                    switch (datum.signalKind)
                    {
                    case ui.PointerSignalKind.scroll:
                        Offset scrollDelta =
                            new Offset(datum.scrollDeltaX, datum.scrollDeltaY) / devicePixelRatio;
                        yield return(new PointerScrollEvent(
                                         timeStamp: timeStamp,
                                         kind: kind,
                                         device: datum.device,
                                         position: position,
                                         scrollDelta: scrollDelta
                                         ));

                        break;

                    case ui.PointerSignalKind.none:
                        D.assert(false);     // This branch should already have 'none' filtered out.
                        break;

                    case ui.PointerSignalKind.editorDragMove: {
                        yield return(new PointerDragFromEditorHoverEvent(
                                         timeStamp: timeStamp,
                                         pointer: datum.pointerIdentifier,
                                         kind: kind,
                                         device: datum.device,
                                         position: position
                                         ));

                        break;
                    }

                    case ui.PointerSignalKind.editorDragRelease: {
                        yield return(new PointerDragFromEditorReleaseEvent(
                                         timeStamp: timeStamp,
                                         pointer: datum.pointerIdentifier,
                                         kind: kind,
                                         device: datum.device,
                                         position: position
                                         ));

                        break;
                    }

                    case ui.PointerSignalKind.unknown:
                        // Ignore unknown signals.
                        break;
                    }
                }
            }
        }
 public void SetPlayerData(Offset offset, bool value)
 {
     //GameManger._instance.playerData.(offset)
     gameManager.Write(Program, value, 0x0, playerData, HollowKnight.PlayerData.GetOffset(offset));
 }
Пример #54
0
 public static Offset <AccountInfo> CreateAccountInfo(FlatBufferBuilder builder,
                                                      int idx = 0,
                                                      StringOffset accountIdOffset = default(StringOffset),
                                                      int avatarId = 0,
                                                      uint corpLv  = 0,
                                                      uint corpXp  = 0,
                                                      VectorOffset arousalsOffset = default(VectorOffset),
                                                      VectorOffset skillsOffset   = default(VectorOffset),
                                                      VectorOffset skillpsOffset  = default(VectorOffset),
                                                      VectorOffset heroStarOffset = default(VectorOffset),
                                                      VectorOffset heroLvOffset   = default(VectorOffset),
                                                      StringOffset nameOffset     = default(StringOffset),
                                                      uint vip = 0,
                                                      VectorOffset avatarlockedsOffset = default(VectorOffset),
                                                      int gs                             = 0,
                                                      long pvpScore                      = 0,
                                                      int pvpRank                        = 0,
                                                      VectorOffset equipsOffset          = default(VectorOffset),
                                                      VectorOffset equipUpgradeOffset    = default(VectorOffset),
                                                      VectorOffset equipStarOffset       = default(VectorOffset),
                                                      VectorOffset avatarEquipsOffset    = default(VectorOffset),
                                                      VectorOffset allFashionsOffset     = default(VectorOffset),
                                                      VectorOffset generalsOffset        = default(VectorOffset),
                                                      VectorOffset genstarOffset         = default(VectorOffset),
                                                      VectorOffset genrelsOffset         = default(VectorOffset),
                                                      VectorOffset genrellvOffset        = default(VectorOffset),
                                                      VectorOffset avatarJadeOffset      = default(VectorOffset),
                                                      VectorOffset destGeneralJadeOffset = default(VectorOffset),
                                                      int dg                             = 0,
                                                      int dglv                           = 0,
                                                      VectorOffset dgssOffset            = default(VectorOffset),
                                                      StringOffset guuidOffset           = default(StringOffset),
                                                      StringOffset gnameOffset           = default(StringOffset),
                                                      int gpos                           = 0,
                                                      StringOffset postOffset            = default(StringOffset),
                                                      long postt                         = 0,
                                                      VectorOffset pskillidOffset        = default(VectorOffset),
                                                      VectorOffset cskillidOffset        = default(VectorOffset),
                                                      VectorOffset tskillidOffset        = default(VectorOffset),
                                                      StringOffset titleOffset           = default(StringOffset),
                                                      VectorOffset titlesOffset          = default(VectorOffset),
                                                      Offset <Attr> heroAttrOffset       = default(Offset <Attr>),
                                                      int heroSwing                      = 0,
                                                      uint magicPetfigure                = 0)
 {
     builder.StartObject(43);
     AccountInfo.AddPostt(builder, postt);
     AccountInfo.AddPvpScore(builder, pvpScore);
     AccountInfo.AddMagicPetfigure(builder, magicPetfigure);
     AccountInfo.AddHeroSwing(builder, heroSwing);
     AccountInfo.AddHeroAttr(builder, heroAttrOffset);
     AccountInfo.AddTitles(builder, titlesOffset);
     AccountInfo.AddTitle(builder, titleOffset);
     AccountInfo.AddTskillid(builder, tskillidOffset);
     AccountInfo.AddCskillid(builder, cskillidOffset);
     AccountInfo.AddPskillid(builder, pskillidOffset);
     AccountInfo.AddPost(builder, postOffset);
     AccountInfo.AddGpos(builder, gpos);
     AccountInfo.AddGname(builder, gnameOffset);
     AccountInfo.AddGuuid(builder, guuidOffset);
     AccountInfo.AddDgss(builder, dgssOffset);
     AccountInfo.AddDglv(builder, dglv);
     AccountInfo.AddDg(builder, dg);
     AccountInfo.AddDestGeneralJade(builder, destGeneralJadeOffset);
     AccountInfo.AddAvatarJade(builder, avatarJadeOffset);
     AccountInfo.AddGenrellv(builder, genrellvOffset);
     AccountInfo.AddGenrels(builder, genrelsOffset);
     AccountInfo.AddGenstar(builder, genstarOffset);
     AccountInfo.AddGenerals(builder, generalsOffset);
     AccountInfo.AddAllFashions(builder, allFashionsOffset);
     AccountInfo.AddAvatarEquips(builder, avatarEquipsOffset);
     AccountInfo.AddEquipStar(builder, equipStarOffset);
     AccountInfo.AddEquipUpgrade(builder, equipUpgradeOffset);
     AccountInfo.AddEquips(builder, equipsOffset);
     AccountInfo.AddPvpRank(builder, pvpRank);
     AccountInfo.AddGs(builder, gs);
     AccountInfo.AddAvatarlockeds(builder, avatarlockedsOffset);
     AccountInfo.AddVip(builder, vip);
     AccountInfo.AddName(builder, nameOffset);
     AccountInfo.AddHeroLv(builder, heroLvOffset);
     AccountInfo.AddHeroStar(builder, heroStarOffset);
     AccountInfo.AddSkillps(builder, skillpsOffset);
     AccountInfo.AddSkills(builder, skillsOffset);
     AccountInfo.AddArousals(builder, arousalsOffset);
     AccountInfo.AddCorpXp(builder, corpXp);
     AccountInfo.AddCorpLv(builder, corpLv);
     AccountInfo.AddAvatarId(builder, avatarId);
     AccountInfo.AddAccountId(builder, accountIdOffset);
     AccountInfo.AddIdx(builder, idx);
     return(AccountInfo.EndAccountInfo(builder));
 }
Пример #55
0
        protected virtual async Task <Block> WriteRecordBatchInternalAsync(RecordBatch recordBatch,
                                                                           CancellationToken cancellationToken = default)
        {
            // TODO: Truncate buffers with extraneous padding / unused capacity

            if (!HasWrittenSchema)
            {
                await WriteSchemaAsync(Schema, cancellationToken);

                HasWrittenSchema = true;
            }

            var recordBatchBuilder = new ArrowRecordBatchFlatBufferBuilder();

            Builder.Clear();

            // Serialize field nodes

            var fieldCount       = Schema.Fields.Count;
            var fieldNodeOffsets = new Offset <Flatbuf.FieldNode> [fieldCount];

            Flatbuf.RecordBatch.StartNodesVector(Builder, fieldCount);

            for (var i = 0; i < fieldCount; i++)
            {
                var fieldArray = recordBatch.Column(i);
                fieldNodeOffsets[i] =
                    Flatbuf.FieldNode.CreateFieldNode(Builder, fieldArray.Length, fieldArray.NullCount);
            }

            var fieldNodesVectorOffset = Builder.EndVector();

            // Serialize buffers

            for (var i = 0; i < fieldCount; i++)
            {
                var fieldArray = recordBatch.Column(i);
                fieldArray.Accept(recordBatchBuilder);
            }

            var buffers       = recordBatchBuilder.Buffers;
            var bufferOffsets = new Offset <Flatbuf.Buffer> [buffers.Count];

            Flatbuf.RecordBatch.StartBuffersVector(Builder, buffers.Count);

            for (var i = buffers.Count - 1; i >= 0; i--)
            {
                bufferOffsets[i] = Flatbuf.Buffer.CreateBuffer(Builder,
                                                               buffers[i].Offset, buffers[i].Length);
            }

            var buffersVectorOffset = Builder.EndVector();

            // Serialize record batch

            var recordBatchOffset = Flatbuf.RecordBatch.CreateRecordBatch(Builder, recordBatch.Length,
                                                                          fieldNodesVectorOffset,
                                                                          buffersVectorOffset);

            var metadataOffset = BaseStream.Position;

            await WriteMessageAsync(Flatbuf.MessageHeader.RecordBatch,
                                    recordBatchOffset, recordBatchBuilder.TotalLength,
                                    cancellationToken);

            var metadataLength = BaseStream.Position - metadataOffset;

            // Write buffer data

            var lengthOffset = BaseStream.Position;

            for (var i = 0; i < buffers.Count; i++)
            {
                if (buffers[i].DataBuffer.IsEmpty)
                {
                    continue;
                }


                await WriteBufferAsync(buffers[i].DataBuffer, cancellationToken);
            }

            // Write padding so the record batch message body length is a multiple of 8 bytes

            var bodyLength        = Convert.ToInt32(BaseStream.Position - lengthOffset);
            var bodyPaddingLength = CalculatePadding(bodyLength);

            await WritePaddingAsync(bodyPaddingLength);

            return(new Block(
                       offset: Convert.ToInt32(metadataOffset),
                       length: bodyLength + bodyPaddingLength,
                       metadataLength: Convert.ToInt32(metadataLength)));
        }
Пример #56
0
 public override string ToString()
 {
     return($"{{{nameof(Offset)}={Offset.ToString("X")}, {nameof(Datas)}={string.Join(",", Datas.Select(x => x.ToString("X")).ToList())}}}");
 }
Пример #57
0
 public static void AddReferToC(FlatBufferBuilder builder, Offset <NamespaceC.TableInC> referToCOffset)
 {
     builder.AddOffset(0, referToCOffset.Value, 0);
 }
        public void NodaTimeOffset_SerializesToExpectedText(Offset input, string expected)
        {
            var actual = input.ToJson();

            Assert.That(actual, Is.EqualTo(expected));
        }
 public static void FinishTestBufferBuffer(FlatBufferBuilder builder, Offset <HashLockTransactionBuffer> offset)
 {
     builder.Finish(offset.Value);
 }
Пример #60
0
 public static void FinishGachaBuffer(FlatBufferBuilder builder, Offset <Gacha> offset)
 {
     builder.Finish(offset.Value);
 }