コード例 #1
0
ファイル: Gen2.cs プロジェクト: colombmo/itsi-gamification
                    /// <summary>
                    /// Create Get Log state reply object
                    /// </summary>
                    /// <param name="reply">Raw 9 or 21-bit Get Log State reply</param>
                    public LogState(byte[] reply)
                    {
                        if (!((9 == reply.Length) || (20 == reply.Length)))
                        {
                            throw new ArgumentOutOfRangeException("GetLogState replies must be 9 or 20 bytes in length");
                        }
                        int offset = 0;
                        _LimitCount = new LimitCounter(reply, offset); offset += 4;
                        _SystemStat = new SystemStatus(reply, offset); offset += 4;
                        
                        if (20 == reply.Length)
                        {   
                            _SetShelLifeBlock0 = new ShelfLifeBlock0(reply, offset);
                            offset += 4;
                            _SetShelLifeBlock1 = new ShelfLifeBlock1(reply, offset);
                             offset += 4;
                             _remainingShelfLife = GetRemainingShelfLife(reply, offset);
                            offset += 3;
                        }

                        _StatFlags = new StatusFlags(reply[offset]); offset += 1;
                    }
コード例 #2
0
        private unsafe void CreateLsTbds(
            ParaProp        pap,
            LsTbd*          plsTbds,
            int             lsTbdCount
            )
        {
            for (int i = 0; i < lsTbdCount; i++)
            {
                TextTabProperties tab = (TextTabProperties)pap.Tabs[i];
                plsTbds[i].lskt = Convert.LsKTabFromTabAlignment(tab.Alignment);
                plsTbds[i].ur = TextFormatterImp.RealToIdeal(tab.Location);

                if (tab.TabLeader != 0)
                {
                    // Note: LS does not currently support surrogate character as tab leader and aligning character
                    plsTbds[i].wchTabLeader = (char)tab.TabLeader;

                    // tab leader requires state at display time for tab leader width fetching
                    _statusFlags |= StatusFlags.KeepState;
                }
                plsTbds[i].wchCharTab = (char)tab.AligningCharacter;
            }
        }
コード例 #3
0
            private void FormatLine(
                FullTextState           fullText,
                int                     cpFirst,
                int                     lineLength,
                int                     formatWidth,
                int                     finiteFormatWidth,
                int                     paragraphWidth,
                LineFlags               lineFlags,
                FormattedTextSymbols    collapsingSymbol
                )
            {
                _metrics._formatter = fullText.Formatter;
                Debug.Assert(_metrics._formatter != null);

                TextStore store = fullText.TextStore;
                TextStore markerStore = fullText.TextMarkerStore;
                FormatSettings settings = store.Settings;
                ParaProp pap = settings.Pap;

                _paragraphTextDecorations = pap.TextDecorations;
                if (_paragraphTextDecorations != null)
                {
                    if (_paragraphTextDecorations.Count != 0)
                    {
                        _defaultTextDecorationsBrush = pap.DefaultTextDecorationsBrush;
                    }
                    else
                    {
                        _paragraphTextDecorations = null;
                    }
                }

                // acquiring LS context
                TextFormatterContext context = _metrics._formatter.AcquireContext(fullText, IntPtr.Zero);

                LsLInfo plslineInfo = new LsLInfo();
                LsLineWidths lineWidths = new LsLineWidths();

                fullText.SetTabs(context);

                int lscpLineLength = 0; // line length in LSCP
                if (lineLength > 0)
                {
                    // line length is previously known (e.g. during optimal paragraph formatting),
                    // prefetch lsruns up to the specified line length.
                    lscpLineLength = PrefetchLSRuns(store, cpFirst, lineLength);
                }

                IntPtr ploline;
                LsErr lserr = context.CreateLine(
                    cpFirst,
                    lscpLineLength,
                    formatWidth,
                    lineFlags,
                    IntPtr.Zero,    // single-line formatting does not require break record
                    out ploline,
                    out plslineInfo,
                    out _depthQueryMax,
                    out lineWidths
                    );

                // Did we exceed the LineServices maximum line width?
                if (lserr == LsErr.TooLongParagraph)
                {
                    // Determine where to insert a fake line break. FullTextState.CpMeasured
                    // is a reasonable estimate since we know the nominal widths up to that
                    // point fit within the margin.
                    int cpLimit = fullText.CpMeasured;
                    int subtract = 1;

                    for (;;)
                    {
                        // The line must contain at least one character position.
                        if (cpLimit < 1)
                        {
                            cpLimit = 1;
                        }

                        store.InsertFakeLineBreak(cpLimit);

                        lserr = context.CreateLine(
                            cpFirst,
                            lscpLineLength,
                            formatWidth,
                            lineFlags,
                            IntPtr.Zero,    // single-line formatting does not require break record
                            out ploline,
                            out plslineInfo,
                            out _depthQueryMax,
                            out lineWidths
                            );

                        if (lserr != LsErr.TooLongParagraph || cpLimit == 1)
                        {
                            // We're done or can't chop off any more text.
                            break;
                        }
                        else
                        {
                            // Chop off more text and try again. Double the amount of
                            // text we chop off each time so we retry too many times.
                            cpLimit = fullText.CpMeasured - subtract;
                            subtract *= 2;
                        }
                    }
                }

                _ploline.Value = ploline;

                // get the exception in context before it is released
                Exception callbackException = context.CallbackException;

                // release the context
                context.Release();

                if(lserr != LsErr.None)
                {
                    GC.SuppressFinalize(this);
                    if(callbackException != null)
                    {
                        // rethrow exception thrown in callbacks
                        throw WrapException(callbackException);
                    }
                    else
                    {
                        // throw with LS error codes
                        TextFormatterContext.ThrowExceptionFromLsError(SR.Get(SRID.CreateLineFailure, lserr), lserr);
                    }
                }

                // keep context alive at least till here
                GC.KeepAlive(context);

                unsafe
                {
                    // construct text metrics for the line
                    _metrics.Compute(
                        fullText,
                        cpFirst,
                        paragraphWidth,
                        collapsingSymbol,
                        ref lineWidths,
                        &plslineInfo
                        );
                }

                // keep record for min width as we may be formatting min/max
                _textMinWidthAtTrailing = lineWidths.upMinStartTrailing - _metrics._textStart;

                if (collapsingSymbol != null)
                {
                    _collapsingSymbol = collapsingSymbol;
                    _textMinWidthAtTrailing += TextFormatterImp.RealToIdeal(collapsingSymbol.Width);
                }
                else
                {
                    // overflow detection for potential collapsible line
                    if (_metrics._textStart + _metrics._textWidthAtTrailing > finiteFormatWidth)
                    {
                        bool hasOverflowed = true;
                        if (_textFormattingMode == TextFormattingMode.Display)
                        {
                            // apply display-mode rounding before checking for overflow
                            double realWidth = Width;
                            double realFormatWidth = _metrics._formatter.IdealToReal(finiteFormatWidth);
                            hasOverflowed = (TextFormatterImp.CompareReal(realWidth, realFormatWidth, _textFormattingMode) > 0);
                        }

                        if (hasOverflowed)
                        {
                            // line has overflowed
                            _statusFlags |= StatusFlags.HasOverflowed;

                            // let's keep the full text state around. We'll need it later for collapsing
                            _fullText = fullText;
                        }
                    }
                }

                if (    fullText != null
                    &&  (   fullText.KeepState
                        ||  (_statusFlags & StatusFlags.KeepState) != 0
                        )
                    )
                {
                    // the state of full text is to be kept after formatting is done
                    _fullText = fullText;
                }

                // retain all line properties for interactive operations
                _ploc = context.Ploc;
                _cpFirst = cpFirst;
                _paragraphWidth = paragraphWidth;

                if (pap.RightToLeft)
                    _statusFlags |= StatusFlags.RightToLeft;

                if (plslineInfo.fForcedBreak != 0)
                    _statusFlags |= StatusFlags.IsTruncated;

                // retain the state of plsruns
                _plsrunVector = store.PlsrunVector;
                _lsrunsMainText = store.LsrunList;

                if (markerStore != null)
                    _lsrunsMarkerText = markerStore.LsrunList;

                // we store the text source in the line in case drawing code calls
                // the TextSource to find out the text effect index.
                // 
                _textSource = settings.TextSource;
            }
コード例 #4
0
            private void DrawTextLine(
                DrawingContext      drawingContext,
                Point               origin,
                MatrixTransform     antiInversion
                )
            {
                Rect boundingBox = Rect.Empty;

                if (_ploline.Value != System.IntPtr.Zero)
                {
                    TextFormatterContext context;
                    LsErr lserr = LsErr.None;
                    LSRECT rect = new LSRECT(0, 0, _metrics._textWidthAtTrailing, _metrics._height);

                    // DrawingState needs to be properly disposed after performing actual drawing operations.
                    using (DrawingState drawingState = new DrawingState(drawingContext, origin, antiInversion, this))
                    {
                        context = _metrics._formatter.AcquireContext(
                            drawingState,
                            _ploc.Value
                            );

                        // set the collector and send the line to LS to draw

                        context.EmptyBoundingBox();

                        // LS line reference origin
                        LSPOINT lsRefOrigin = new LSPOINT(0, _metrics._baselineOffset);

                        lserr = UnsafeNativeMethods.LoDisplayLine(
                            _ploline.Value,
                            ref lsRefOrigin,
                            1,      // 0 - opaque, 1 - transparent
                            ref rect
                            );
                    }

                    boundingBox = context.BoundingBox;

                    // get the exception in context before it is released
                    Exception callbackException = context.CallbackException;

                    context.Release();

                    if(lserr != LsErr.None)
                    {
                        if(callbackException != null)
                        {
                            // rethrow exception thrown in callbacks
                            throw callbackException;
                        }
                        else
                        {
                            // throw with LS error codes
                            TextFormatterContext.ThrowExceptionFromLsError(SR.Get(SRID.CreateLineFailure, lserr), lserr);
                        }
                    }

                    // keep context alive at least til here
                    GC.KeepAlive(context);
                }

                if (_collapsingSymbol != null)
                {
                    // draw collapsing symbol if any
                    Point vectorToOrigin = new Point();
                    if (antiInversion != null)
                    {
                        vectorToOrigin = origin;
                        origin.X = origin.Y = 0;
                    }

                    boundingBox.Union(DrawCollapsingSymbol(drawingContext, origin, vectorToOrigin));
                }

                BuildOverhang(origin, boundingBox);
                _statusFlags |= StatusFlags.BoundingBoxComputed;
            }
コード例 #5
0
            /// <summary>
            /// Constructing a FullTextLine
            /// </summary>
            /// <param name="settings">text formatting settings</param>
            /// <param name="cpFirst">Line's first cp</param>
            /// <param name="lineLength">character length of the line</param>
            /// <param name="paragraphWidth">paragraph width</param>
            /// <param name="lineFlags">line formatting control flags</param>
            internal FullTextLine(
                FormatSettings          settings,
                int                     cpFirst,
                int                     lineLength,
                int                     paragraphWidth,
                LineFlags               lineFlags
                )
                : this(settings.TextFormattingMode, settings.Pap.Justify)
            {
                if (    (lineFlags & LineFlags.KeepState) != 0
                    ||  settings.Pap.AlwaysCollapsible)
                {
                    _statusFlags |= StatusFlags.KeepState;
                }

                int finiteFormatWidth = settings.GetFiniteFormatWidth(paragraphWidth);

                FullTextState fullText = FullTextState.Create(settings, cpFirst, finiteFormatWidth);

                // formatting the line
                FormatLine(
                    fullText,
                    cpFirst,
                    lineLength,
                    fullText.FormatWidth,
                    finiteFormatWidth,
                    paragraphWidth,
                    lineFlags,
                    null    // collapsingSymbol
                    );
            }
コード例 #6
0
 private FullTextLine(TextFormattingMode textFormattingMode, bool justify)
 {
     _textFormattingMode = textFormattingMode;
     if (justify)
     {
         _statusFlags |= StatusFlags.IsJustified;
     }
     _metrics = new TextMetrics();
     _ploline = new SecurityCriticalDataForSet<IntPtr>(IntPtr.Zero);
 }
コード例 #7
0
ファイル: HandShakePacket.cs プロジェクト: BeanHsiang/Greedy
        protected override void ParseBody()
        {
            this.Body.Position = 0;
            var protocolVersion = this.Body.ReadByte();
            this.ServerVersion = this.Body.ReadNulTerminatedString();
            this.ConnectionId = this.Body.ReadInt();
            this.AuthPluginDataPart1 = this.Body.ReadFixedBytes(8);
            this.Body.Position += 1;
            this.Capabilities = (CapabilityFlags)this.Body.ReadShort();
            this.CharacterSet = (CharacterSet)this.Body.ReadByte();
            this.Status = (StatusFlags)this.Body.ReadShort();
            this.Capabilities |= (CapabilityFlags)(this.Body.ReadShort() << 16);
            this.AuthPluginDataLength = (byte)this.Body.ReadByte();
            this.Body.Position += 10;

            if ((Capabilities & CapabilityFlags.CLIENT_SECURE_CONNECTION) > 0)
            {
                var length = Math.Max(13, this.AuthPluginDataLength - 8) - 1;
                this.AuthPluginDataPart2 = this.Body.ReadFixedBytes(length);
                this.Body.Position += 1;
            }

            if ((Capabilities & CapabilityFlags.CLIENT_PLUGIN_AUTH) > 0)
            {
                this.AuthPluginName = this.Body.ReadNulTerminatedString();
            }
        }
コード例 #8
0
ファイル: BplObject.cs プロジェクト: borkaborka/gmit
 private bool _getStatusFlag(StatusFlags flag) {
    return (_statusFlags & flag) != 0;
 }
コード例 #9
0
        /// <summary>
        /// Constructing a lightweight text line
        /// </summary>
        /// <param name="settings">text formatting settings</param>
        /// <param name="cpFirst">line first cp</param>
        /// <param name="paragraphWidth">paragraph width</param>
        /// <param name="runs">collection of simple runs</param>
        /// <param name="trailing">line trailing spaces</param>
        /// <param name="trailingSpaceWidth">line trailing spaces width</param>
        /// <Remarks>
        /// SimpleTextLine is constructed with Ideal width such that the line breaking
        /// behavior is consistent with the FullTextLine
        /// </Remarks>
        public SimpleTextLine(
            FormatSettings          settings,
            int                     cpFirst,
            int                     paragraphWidth,
            ArrayList               runs,
            ref int                 trailing,
            ref int                 trailingSpaceWidth
            )
        {
            // Compute line metrics
            int count = 0;

            _settings = settings;

            double realAscent = 0;
            double realDescent = 0;
            double realHeight = 0;

            ParaProp pap = settings.Pap;
            TextFormatterImp formatter = settings.Formatter;

            int idealWidth = 0;
            while(count < runs.Count)
            {
                SimpleRun run = (SimpleRun)runs[count];

                if(run.Length > 0)
                {
                    if(run.EOT)
                    {
                        // EOT run has no effect on height, it is part of trailing spaces
                        trailing += run.Length;
                        _cpLengthEOT += run.Length;
                    }
                    else
                    {
                        realHeight = Math.Max(realHeight, run.Height);
                        realAscent = Math.Max(realAscent, run.Baseline);
                        realDescent = Math.Max(realDescent, run.Height - run.Baseline);
                    }

                    _cpLength += run.Length;
                    idealWidth += run.IdealWidth;
                }
                count++;
            }

            // Roundtrip run baseline and height to take its precision back to the specified formatting resolution.
            //
            // We have to do this to guarantee sameness of line alignment metrics produced by fast and full path.
            // This is critical for TextBlock/TextFlow. They rely on the fact that line created during Measure must
            // yield the same metrics as one created during Render, while there is no guarantee that the paragraph
            // properties of that same line remains the same in both timings e.g. Measure may not specify
            // justification (which results in us formatting the line in fast path), while Render might
            // (which results in us formatting that same line in full path).

            _baselineOffset = formatter.IdealToReal(TextFormatterImp.RealToIdeal(realAscent));

            if (realAscent + realDescent == realHeight)
            {
                _height = formatter.IdealToReal(TextFormatterImp.RealToIdeal(realHeight));
            }
            else
            {
                _height = formatter.IdealToReal(TextFormatterImp.RealToIdeal(realAscent) + TextFormatterImp.RealToIdeal(realDescent));
            }

            if(_height <= 0)
            {
                //  line is empty (containing only EOP)
                //  we need to work out the line height

                // It needs to be exactly the same as in full path.
                _height = formatter.IdealToReal((int)Math.Round(pap.DefaultTypeface.LineSpacing(pap.EmSize, Constants.DefaultIdealToReal, Util.PixelsPerDip, _settings.TextFormattingMode)));
                _baselineOffset = formatter.IdealToReal((int)Math.Round(pap.DefaultTypeface.Baseline(pap.EmSize, Constants.DefaultIdealToReal, Util.PixelsPerDip, _settings.TextFormattingMode)));
            }

            // Initialize the array of runs and set the TrimTrailingUnderline flag
            // for runs that contain trailing spaces at the end of the line.
            _runs = new SimpleRun[count];
            for(int i = count - 1, t = trailing; i >= 0; --i)
            {
                SimpleRun run = (SimpleRun)runs[i];

                if (t > 0)
                {
                    run.TrimTrailingUnderline = true;
                    t -= run.Length;
                }

                _runs[i] = run;
            }

            _cpFirst = cpFirst;
            _trailing = trailing;

            int idealWidthAtTrailing = idealWidth - trailingSpaceWidth;

            if(pap.Align != TextAlignment.Left)
            {
                switch(pap.Align)
                {
                    case TextAlignment.Right:
                        _idealOffsetUnRounded = paragraphWidth - idealWidthAtTrailing;
                        _offset = formatter.IdealToReal(_idealOffsetUnRounded);
                        break;
                    case TextAlignment.Center:
                        // exactly consistent with FullTextLine
                        _idealOffsetUnRounded = (int)Math.Round((paragraphWidth - idealWidthAtTrailing) * 0.5);
                        _offset = formatter.IdealToReal(_idealOffsetUnRounded);
                        break;
                }
            }

            // converting all the ideal values to real values
            _width = formatter.IdealToReal(idealWidth);
            _widthAtTrailing = formatter.IdealToReal(idealWidthAtTrailing);
            _paragraphWidth = formatter.IdealToReal(paragraphWidth);

            // paragraphWidth == 0 means format width is unlimited and hence not overflowable.
            // we keep paragraphWidth for alignment calculation
            if (paragraphWidth > 0 && _widthAtTrailing > _paragraphWidth)
            {
                _statusFlags |= StatusFlags.HasOverflowed;
            }
        }
コード例 #10
0
        /// <summary>
        /// Draw a simple text line
        /// </summary>
        /// <returns>a drawing bounding box</returns>
        private void DrawTextLine(
            DrawingContext drawingContext,
            Point          origin
            )
        {
            if (_runs.Length <= 0)
            {
                _boundingBox = Rect.Empty;
                _statusFlags |= StatusFlags.BoundingBoxComputed;
                return;
            }

            int idealXRelativeToOrigin = _idealOffsetUnRounded;
            double y = origin.Y + Baseline;

            if (drawingContext != null)
            {
                drawingContext.PushGuidelineY1(y);
            }

            Rect boundingBox = Rect.Empty;

            try
            {
                foreach (SimpleRun run in _runs)
                {
                    boundingBox.Union(
                        run.Draw(
                            drawingContext,
                            _settings.Formatter.IdealToReal(idealXRelativeToOrigin) + origin.X,
                            y,
                            false
                            )
                        );

                    idealXRelativeToOrigin += run.IdealWidth;
                }
            }
            finally
            {
                if (drawingContext != null)
                {
                    drawingContext.Pop();
                }
            }

            if(boundingBox.IsEmpty)
            {
                boundingBox = new Rect(Start, 0, 0, 0);
            }
            else
            {
                boundingBox.X -= origin.X;
                boundingBox.Y -= origin.Y;
            }

            _boundingBox = boundingBox;
            _statusFlags |= StatusFlags.BoundingBoxComputed;
        }
コード例 #11
0
ファイル: CoreView.cs プロジェクト: ddebowczyk/CoreSociety
 private void RenderStatus(StatusFlags status)
 {
     if ((status & StatusFlags.Green) > 0)
         Blit(new Rectangle(5, 0, 9, 6));
     if ((status & StatusFlags.Yellow) > 0)
         Blit(new Rectangle(18, 0, 9, 6));
     if ((status & StatusFlags.Red) > 0)
         Blit(new Rectangle(31, 0, 9, 6));
     if ((status & StatusFlags.Blue) > 0)
         Blit(new Rectangle(44, 0, 9, 6));
 }
コード例 #12
0
ファイル: CoreView.cs プロジェクト: ddebowczyk/CoreSociety
 public void Render(Core core, int chargeGoal, StatusFlags status, Color gridColor)
 {
     //Clear
     Graphics gfx = Graphics.FromImage(_bitmap);
     gfx.Clear(Color.Transparent);
     Rectangle r = new Rectangle(0, 0, _lowSrc.Width, _lowSrc.Height);
     Rectangle r2 = r;
     r2.Inflate(-2, -2);
     gfx.FillRectangle(new SolidBrush(gridColor), r2);
     gfx.DrawImage(_lowSrc, r, r, GraphicsUnit.Pixel);
     //Render Memory
     int i = 0;
     for (int y = 0; y < 16; y++)
         for (int x = 0; x < 16; x++)
         {
             int data = core.Memory[i++];
             _bitmap.SetPixel(5 + x * K, y * K + 7, Palette[(data & 0xF000) >> 12]);
             _bitmap.SetPixel(6 + x * K, y * K + 7, Palette[(data & 0xF00) >> 8]);
             _bitmap.SetPixel(5 + x * K, y * K + 8, Palette[(data & 0xF0) >> 4]);
             _bitmap.SetPixel(6 + x * K, y * K + 8, Palette[data & 0xF]);
         }
     //Render Energy-Levels
     RenderVEnergyBar(core.Energy, 0);
     RenderVEnergyBar(core.Shield, 52);
     RenderHEnergyBar(core.Charge, chargeGoal, 53);
     //Render IP
     int px = 5 + K * (core.InstructionPointer % 16);
     int py = 7 + K * (core.InstructionPointer / 16);
     //Color instrColor = Palette[(core.Memory[core.InstructionPointer] & 0xF000) >> 12];
     //Pen pen = new Pen(instrColor);
     Pen pen = new Pen(InstructionFrameColor);
     gfx.DrawRectangle(pen, new Rectangle(px - 1, py - 1, 3, 3));
     //pen = new Pen(Color.FromArgb(32, Color.White));
     //Graphics.FromImage(_bitmap).DrawRectangle(pen, new Rectangle(px - 2, py - 2, 5, 5));
     RenderStatus(status);
 }
コード例 #13
0
ファイル: BplObject.cs プロジェクト: borkaborka/gmit
 private void _setStatusFlag(StatusFlags flag, bool setTrue) {
    if (setTrue) {
       _statusFlags |= flag;
    } else {
       _statusFlags &= ~flag;
    }
 }
コード例 #14
0
        private void ReadBACData()
        {
            var BAC = (int)Util.Memory.ReadInt((int)Util.Memory.ReadInt(_BaseOffset + 0xB0) + 0x8);

            if (BAC != bac_off && BAC != 0)
            {
                //Gotta load BCM
                var tmpfile = File.Create(System.IO.Path.GetTempPath() + "/tmp.bac", 0x4000);
                var tmparr = Util.Memory.ReadAOB(BAC, 0xA0000);
                tmpfile.Write(tmparr, 0, tmparr.Length);
                tmpfile.Close();
                bac = BACFile.FromFilename(System.IO.Path.GetTempPath() + "/tmp.bac", bcm);
                bac_off = BAC;
            }
            //Not in a match
            if (BAC == 0)
                return;

            var BAC_data = (int)Util.Memory.ReadInt(_BaseOffset + 0xB0);
            var XChange = X;

            X = Util.Memory.ReadFloat(_BaseOffset + 0x16D0);
            Y = Util.Memory.ReadFloat(_BaseOffset + 0x74);
            XChange = XChange - X;
            XVelocity = Util.Memory.ReadFloat(_BaseOffset + 0xe0);
            if (XVelocity == 0 && XChange != 0)
            {
                XVelocity = XChange;
                //Console.WriteLine("Using {0} for XVel due to XChange", XChange);
            }
            YVelocity = Util.Memory.ReadFloat(_BaseOffset + 0xe4);
            XAcceleration = Util.Memory.ReadFloat(_BaseOffset + 0x100);
            YAcceleration = Util.Memory.ReadFloat(_BaseOffset + 0x104);

            Meter = (int)Util.Memory.ReadShort(_BaseOffset + 0x6C3A);
            Revenge = (int)Util.Memory.ReadShort(_BaseOffset + 0x6C4E);


            Flags = (StatusFlags)Util.Memory.ReadInt(_BaseOffset + 0xBC);
            LastScriptIndex = ScriptIndex;

            ScriptIndex = (int)Util.Memory.ReadInt(BAC_data + 0x18);
            LastScriptName = ScriptName;
            var script = bac.Scripts.Where(x => x.Index == ScriptIndex).FirstOrDefault();
            if (script == null)
                ScriptName = ScriptIndex.ToString();
            else
                ScriptName = script.Name;
            if (ScriptName == "")
                return;
            ScriptTickTotal = Util.Memory.ReadInt(BAC_data + 0x24) / 0x10000;
            ScriptTickHitboxStart = Util.Memory.ReadInt(BAC_data + 0x28) / 0x10000;
            ScriptTickHitboxEnd = Util.Memory.ReadInt(BAC_data + 0x2C) / 0x10000;
            ScriptTickIASA = Util.Memory.ReadInt(BAC_data + 0x30) / 0x10000;
            ScriptTick = Util.Memory.ReadInt(BAC_data + 0x3C) / 0x10000;

            ScriptSpeed = Util.Memory.ReadInt(BAC_data + 0x18 + 0xC0) / 0x10000;


            if (ScriptTickIASA == 0)
                ScriptTickIASA = ScriptTickTotal;

            ComputeTickstoFrames(BAC);
            ComputeAttackData(BAC);

            if (ScriptFrameHitboxStart != 0)
            {
                if (ScriptFrame <= ScriptFrameHitboxStart)
                {
                    State = CharState.Startup;
                    StateTimer = ScriptFrameHitboxStart - ScriptFrame;

                }
                else if (ScriptFrame <= ScriptFrameHitboxEnd)
                {
                    State = CharState.Active;
                    StateTimer = ScriptFrameHitboxEnd - ScriptFrame;
                }
                else if (ScriptFrameIASA > 0 && ScriptFrame <= ScriptFrameIASA)
                {
                    State = CharState.Recovery;
                    StateTimer = ScriptFrameIASA - ScriptFrame;
                }
                else if (ScriptFrame <= ScriptFrameTotal)
                {
                    State = CharState.Recovery;
                    StateTimer = ScriptFrameTotal - ScriptFrame;
                }
                else
                {
                    State = CharState.Neutral;
                }
            }
            else
            {
                State = CharState.Neutral;
                StateTimer = -1;
                AState = AttackState.None;
            }
        }
コード例 #15
0
ファイル: NullTTSEngine.cs プロジェクト: glwu/acat
 /// <summary>
 /// Constructor
 /// </summary>
 public NullTTSEngine()
 {
     _currentStatus = StatusFlags.None;
     EvtVoiceChanged = null;
     EvtStatusChanged = null;
 }
コード例 #16
0
 /// <summary>
 /// Initializes a new instance of the TTSStatusChangedEventArgs class
 /// </summary>
 /// <param name="flags"></param>
 public TTSStatusChangedEventArgs(StatusFlags flags)
 {
     Status = flags;
 }
コード例 #17
0
ファイル: GridView.cs プロジェクト: ddebowczyk/CoreSociety
 public void Render(Core core, StatusFlags statusFlags)
 {
     if (_data != null && _buffer != null)
     {
         Graphics gfx = Graphics.FromImage(_buffer);
         int x, y;
         if(_data.Entries.Find(e => e.Core == core, out x, out y))
         {
             _coreView.Render(core, _interpreter.GetNextInstructionCost(core), statusFlags, _data.Entries[y, x].Color);
             gfx.DrawImage(_coreView.Image, x * (_coreView.Width + _coreMargin), y * (_coreView.Height + _coreMargin));
         }
     }
     Invalidate();
 }