예제 #1
0
        public void SetData(FinalPlayerData Data)
        {
            Vector3 position = mDMono.transform.parent.localPosition;

            position.x = mDMono.transform.parent.localPosition.x > 0 ? 1700 : -1700;
            mDMono.transform.parent.localPosition = position;

            ItemData = Data ?? new FinalPlayerData();

            if (ItemData == null || ItemData.Name == null)
            {
                Empty.CustomSetActive(true);
                Filled.CustomSetActive(false);
                SetMysterious(true);
            }
            else
            {
                Empty.CustomSetActive(false);
                Filled.CustomSetActive(true);
                Replace.CustomSetActive(false);
                Icon.spriteName  = ItemData.IconName;
                Frame.spriteName = ItemData.FrameName;
                Name.text        = Name.transform.GetChild(0).GetComponent <UILabel>().text = ItemData.Name;
                LadderRank.text  = LadderRank.transform.GetChild(0).GetComponent <UILabel>().text = string.Format(EB.Localizer.GetString("ID_LADDER_RANK") + ":[fff348]{0}", (ItemData.LadderRank > 0 ? ItemData.LadderRank.ToString() : EB.Localizer.GetString("ID_ARENA_RANK_OUT_OF_RANGE")));
                Dead.CustomSetActive(ItemData.Dead);

                SetMysterious();
            }
        }
예제 #2
0
        protected override async Task PushNext(OrderChange obj)
        {
            var ch = obj.Clone();
            await base.PushNext(obj);

            var e = new OrderChangeEventArgs(ch);

            switch (ch.Type)
            {
            case OrderEventType.Canceled:
                Canceled?.Invoke(this, e);
                break;

            case OrderEventType.Filled:
                Filled?.Invoke(this, e);
                break;

            case OrderEventType.Match:
                Match?.Invoke(this, e);
                break;

            case OrderEventType.Open:
                Open?.Invoke(this, e);
                break;

            case OrderEventType.Update:
                Update?.Invoke(this, e);
                break;
            }
        }
예제 #3
0
        public void Push(T[] buffer, bool isLastBuffer)
        {
            Buffers.Add(buffer);
            reachLast = isLastBuffer;

            if (IsFilled)
            {
                Filled?.Invoke(this, EventArgs.Empty);
            }
        }
예제 #4
0
        public void Push(T[] buffer, bool isLastBuffer)
        {
            Buffers.Add(buffer);
            BufferedDataCount += buffer.Length;
            reachLast          = isLastBuffer;

            if (IsFilled)
            {
                Filled?.Invoke(this, EventArgs.Empty);
            }
        }
 /// <summary>
 /// Returns a string that represents the current object.
 /// </summary>
 /// <returns>
 /// A string that represents the current object.
 /// </returns>
 public override string ToString()
 {
     return($"OrderId: {OrderId.ToStringInvariant()}, " +
            $"Status: {Status}, " +
            $"Filled: {Filled.ToStringInvariant()}, " +
            $"Remaining: {Remaining.ToStringInvariant()}, " +
            $"AverageFillPrice: {AverageFillPrice.ToStringInvariant()}, " +
            $"PermId: {PermId.ToStringInvariant()}, " +
            $"ParentId: {ParentId.ToStringInvariant()}, " +
            $"LastFillPrice: {LastFillPrice.ToStringInvariant()}, " +
            $"ClientId: {ClientId.ToStringInvariant()}, " +
            $"WhyHeld: {WhyHeld}");
 }
예제 #6
0
        // returns any overflow
        public int IncreaseAmount(int increase)
        {
            int left     = Requirement - CurrentAmount;
            int overflow = increase - left;

            CurrentAmount = Mathf.Min(CurrentAmount + increase, Requirement);

            if (!IsFilled && CurrentAmount == Requirement)
            {
                IsFilled = true;
                Filled.Invoke();
            }

            return(overflow);
        }
예제 #7
0
 public override void draw(CanvasDrawEventArgs args)
 {
     for (int i = 0; i < VerticalBlocks + 1; i++)
     {
         args.DrawingSession.DrawLine(x(), y() + (float)(Tetrimino.Size.Height * i), x() + Width, y() + (float)(Tetrimino.Size.Height * i), Colors.Black);
     }
     for (int i = 0; i < HorizontalBlocks + 1; i++)
     {
         args.DrawingSession.DrawLine(x() + (float)(Tetrimino.Size.Height * i), y(), x() + (float)(Tetrimino.Size.Height * i), y() + Height, Colors.Black);
     }
     for (int i = 0; i < Filled.GetLength(1); i++)
     {
         for (int j = 0; j < Filled.GetLength(0); j++)
         {
             if (Filled[j, i])
             {
                 args.DrawingSession.DrawImage(Tetrimino.Graphics[FilledColor[j, i]], j * Tetrimino.Size.Width + x(), i * Tetrimino.Size.Height + y());
             }
         }
     }
 }
예제 #8
0
        public override bool isCollision(float x, float y)
        {
            float boxX, boxY, boxW = (float)Tetrimino.Size.Width, boxH = (float)Tetrimino.Size.Height;

            for (int i = 0; i < Filled.GetLength(1); i++)
            {
                for (int j = 0; j < Filled.GetLength(0); j++)
                {
                    if (!Filled[j, i])
                    {
                        continue;
                    }
                    boxX = j * boxW;
                    boxY = i * boxH - boxH;
                    if (x >= boxX && x <= boxX + boxW && y >= boxY && y <= boxY + boxH)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
예제 #9
0
    public override string ToString()
    {
        string dateDueString, dateFilledString;

        if (DateDue.HasValue)
        {
            dateDueString = DateDue.Value.ToString();
        }
        else
        {
            dateDueString = "<No due date>";
        }

        if (DateFilled.HasValue)
        {
            dateFilledString = DateFilled.Value.ToString();
        }
        else
        {
            dateFilledString = "<Not completed>";
        }

        return(string.Format("Customer: {0}; DateReceived: {1}; DateDue: {2}; Filled?: {3}; DateFilled: {4}; Open: {5}; Total Value: {6}; Total Quantities: {7}", Customer.FullName(), DateReceived.ToString(), dateDueString, Filled.ToString(), dateFilledString, Open.ToString(), TotalValue().ToString(), TotalQuantity().ToString()));
    }
예제 #10
0
        private unsafe void ReadCallback(int frameCountMin, int frameCountMax)
        {
            int         writeFrames = frameCountMax;
            int         framesLeft  = writeFrames;
            UnionBuffer unionBuffer = new UnionBuffer();

            for (; ;)
            {
                int frameCount = framesLeft;

                var areas = _instream.BeginRead(ref frameCount);

                if (frameCount == 0)
                {
                    break;
                }

                if (areas.IsEmpty)
                {
                    // Due to an overflow there is a hole. Fill the ring buffer with
                    // silence for the size of the hole.
                    Console.Error.WriteLine("Dropped {0} frames due to internal overflow", frameCount);
                }
                else
                {
                    for (int frame = 0; frame < frameCount; frame += 1)
                    {
                        int chCount  = _instream.Layout.ChannelCount;
                        int copySize = _instream.BytesPerSample;
                        unionBuffer.Bytes = new byte[copySize];

                        fixed(byte *buffer = unionBuffer.Bytes)
                        {
                            for (int ch = 0; ch < chCount; ch += 1)
                            {
                                var area = areas.GetArea(ch);
                                Buffer.MemoryCopy((void *)area.Pointer, buffer, copySize, copySize);
                                _ringBuffer.Enqueue(unionBuffer.Bytes, 0, copySize);
                                area.Pointer += area.Step;
                            }
                        }
                    }
                }

                _instream.EndRead();

                framesLeft -= frameCount;
                if (framesLeft <= 0)
                {
                    break;
                }
            }

            int length = (int)_ringBuffer.GetLength();

            if (length >= FlushCount)
            {
                if (_flushBuffer == null || _flushBuffer.Length != length)
                {
                    _flushBuffer = new byte[length];
                }

                _ringBuffer.Dequeue(_flushBuffer);
                Filled?.Invoke(this, new FillEventArgs(_flushBuffer, 0, length));
            }
        }