コード例 #1
0
ファイル: PlayerPacketTests.cs プロジェクト: silky/ModernUO
        public void TestDragEffect()
        {
            var src    = new Entity(0x1, new Point3D(1000, 100, 10), Map.Felucca);
            var targ   = new Entity(0x2, new Point3D(1125, 125, 5), Map.Felucca);
            var itemID = 0x384;
            var hue    = 1024;
            var amount = 25;

            var data = new DragEffect(src, targ, itemID, hue, amount).Compile();

            Span <byte> expectedData = stackalloc byte[26];
            var         pos          = 0;

            expectedData.Write(ref pos, (byte)0x23); // Packet ID
            expectedData.Write(ref pos, (ushort)itemID);

#if NO_LOCAL_INIT
            expectedData.Write(ref pos, (byte)0);
#else
            pos++;
#endif

            expectedData.Write(ref pos, (ushort)hue);
            expectedData.Write(ref pos, (ushort)amount);
            expectedData.Write(ref pos, src.Serial);
            expectedData.Write(ref pos, src.Location);
            expectedData.Write(ref pos, targ.Serial);
            expectedData.Write(ref pos, targ.Location);

            AssertThat.Equal(data, expectedData);
        }
コード例 #2
0
ファイル: Piece.cs プロジェクト: jclarkrichards/RubiksTacToe
    bool _locked      = false;          // true if we want to force a piece to be unmoveable (locked)

    // Use this for initialization
    void Awake()
    {
        sides            = new Transform[2];
        sides[0]         = transform.FindChild("Gold");
        sides[1]         = transform.FindChild("Silver");
        previousPosition = this.transform.position;
        drag             = new DragEffect(transform.position, -25, 25, 2, 2);
    }
コード例 #3
0
ファイル: PlayerPacketTests.cs プロジェクト: tateima/PathOfUO
        public void TestDragEffect(
            uint srcSerial, int srcX, int srcY, int srcZ,
            uint trgSerial, int trgX, int trgY, int trgZ,
            int itemId, int hue, int amount
            )
        {
            var src  = new Entity(srcSerial, new Point3D(srcX, srcY, srcZ), null);
            var targ = new Entity(trgSerial, new Point3D(trgX, trgY, trgZ), null);

            var expected = new DragEffect(src, targ, itemId, hue, amount).Compile();

            using var ns = PacketTestUtilities.CreateTestNetState();
            ns.SendDragEffect(
                src.Serial, src.Location,
                targ.Serial, targ.Location,
                itemId, hue, amount
                );

            var result = ns.SendPipe.Reader.TryRead();

            AssertThat.Equal(result.Buffer[0].AsSpan(0), expected);
        }
コード例 #4
0
        public void CreateEffect
        (
            GraphicEffectType type,
            uint source,
            uint target,
            ushort graphic,
            ushort hue,
            ushort srcX,
            ushort srcY,
            sbyte srcZ,
            ushort targetX,
            ushort targetY,
            sbyte targetZ,
            byte speed,
            int duration,
            bool fixedDir,
            bool doesExplode,
            bool hasparticles,
            GraphicEffectBlendMode blendmode
        )
        {
            if (hasparticles)
            {
                Log.Warn("Unhandled particles in an effects packet.");
            }

            GameEffect effect;

            if (hue != 0)
            {
                hue++;
            }

            duration *= Constants.ITEM_EFFECT_ANIMATION_DELAY;

            switch (type)
            {
            case GraphicEffectType.Moving:
                if (graphic <= 0)
                {
                    return;
                }

                // TODO: speed == 0 means run at standard frameInterval got from anim.mul?
                if (speed == 0)
                {
                    speed++;
                }

                effect = new MovingEffect
                         (
                    this,
                    source,
                    target,
                    srcX,
                    srcY,
                    srcZ,
                    targetX,
                    targetY,
                    targetZ,
                    graphic,
                    hue,
                    fixedDir,
                    duration,
                    speed
                         )
                {
                    Blend = blendmode,
                    CanCreateExplosionEffect = doesExplode
                };

                break;

            case GraphicEffectType.DragEffect:

                if (graphic <= 0)
                {
                    return;
                }

                if (speed == 0)
                {
                    speed++;
                }

                effect = new DragEffect
                         (
                    this,
                    source,
                    target,
                    srcX,
                    srcY,
                    srcZ,
                    targetX,
                    targetY,
                    targetZ,
                    graphic,
                    hue,
                    duration,
                    speed
                         )
                {
                    Blend = blendmode,
                    CanCreateExplosionEffect = doesExplode
                };

                break;

            case GraphicEffectType.Lightning:
                effect = new LightningEffect
                         (
                    this,
                    source,
                    srcX,
                    srcY,
                    srcZ,
                    hue
                         );

                break;

            case GraphicEffectType.FixedXYZ:

                if (graphic <= 0)
                {
                    return;
                }

                effect = new FixedEffect
                         (
                    this,
                    srcX,
                    srcY,
                    srcZ,
                    graphic,
                    hue,
                    duration,
                    0     //speed [use 50ms]
                         )
                {
                    Blend = blendmode
                };

                break;

            case GraphicEffectType.FixedFrom:

                if (graphic <= 0)
                {
                    return;
                }

                effect = new FixedEffect
                         (
                    this,
                    source,
                    srcX,
                    srcY,
                    srcZ,
                    graphic,
                    hue,
                    duration,
                    0     //speed [use 50ms]
                         )
                {
                    Blend = blendmode
                };

                break;

            case GraphicEffectType.ScreenFade:
                Log.Warn("Unhandled 'Screen Fade' effect.");

                return;

            default:
                Log.Warn("Unhandled effect.");

                return;
            }


            PushToBack(effect);
        }
コード例 #5
0
 // Use this for initialization
 void Start()
 {
     drag = new DragEffect(transform.position, -25, 25, 2, 5);
 }
コード例 #6
0
 private void OnAnyDragEffectFinished(DragEffect effect)
 {
     OnAnyEntityEnterCell(effect.Caster, BoardNavigator.Instance.NearestCell(effect.Caster.transform.position));
 }
コード例 #7
0
ファイル: DragEvent.cs プロジェクト: Yuri05/OSPSuite.Core
 public void SetEffectForType <T>(DragEffect matchEffect = DragEffect.Move, DragEffect notMatchEffect = DragEffect.None)
 {
     Effect = TypeBeingDraggedIs <string>() ? DragEffect.Move : DragEffect.None;
 }