Ejemplo n.º 1
0
        /// <summary>
        /// Constructor.
        /// Read a node from extended stream.
        /// </summary>
        /// <param name="stream">StreamEx object to read from.</param>
        public OwlNode(StreamEx stream)
            : this()
        {
            #if !DEBUG
            try
            {
            #endif
            // Read OwlNode ID
            id = stream.ReadVInt();

            // Read Child Count
            var childCount = stream.ReadVInt();

            // Read Data Length
            var dataLength = stream.ReadVInt();

            // Read Child Nodes
            for (int i = 0; i < childCount; i++)
                children.Add(new OwlNode(stream));

            // Read Data
            Int64 dataStart = stream.Position;
            data = new PartialStreamEx(stream, dataStart, dataLength);

            // Debug Asserts
            Debug.Assert((dataStart + dataLength) < stream.Length, "Invalid Data Length or Position",
                "dataStart = {0}; dataLength = {1}", dataStart, dataLength);
            #if !DEBUG
            }
            catch (Exception x)
            {
                throw new InvalidDataException("Failed to read Owl.OwlNode from stream.", x);
            }
            #endif
        }
Ejemplo n.º 2
0
        public void VIntTest_EncodeDecode()
        {
            for (int i = 0; i < 1000000; i++)
            {
                Int64 number = libWyvernzora.Utilities.RandomEx.Instance.NextInt64();

                if (number > VInt.MaxValue || number < VInt.MinValue) continue;

                VInt x = new VInt(number);

                Byte[] b = x.Encode();

                VInt y = new VInt(b);

                Assert.AreEqual(number, y);
            }

            for (int i = 0; i < 1000000; i++)
            {
                Int32 number = libWyvernzora.Utilities.RandomEx.Instance.NextInt32();

                if (number > VInt.MaxValue || number < VInt.MinValue) continue;

                VInt x = new VInt(number);

                Byte[] b = x.Encode();

                VInt y = new VInt(b);

                Assert.AreEqual(number, y);
            }

            for (int i = 0; i < 1000000; i++)
            {
                Int16 number = libWyvernzora.Utilities.RandomEx.Instance.NextInt16();

                if (number > VInt.MaxValue || number < VInt.MinValue) continue;

                VInt x = new VInt(number);

                Byte[] b = x.Encode();

                VInt y = new VInt(b);

                Assert.AreEqual(number, y);
            }
        }
 public override EbmlElement Create(VInt dataSize, long position, EbmlElement?parent)
 {
     return(new ChapterTranslateID(dataSize, position, parent));
 }
Ejemplo n.º 4
0
 public override EbmlElement Create(VInt dataSize, long position, EbmlElement?parent)
 {
     return(new TrackPlaneUID(dataSize, position, parent));
 }
Ejemplo n.º 5
0
 public override EbmlElement Create(VInt dataSize, long position, EbmlElement?parent)
 {
     return(new Segment(dataSize, position, parent));
 }
Ejemplo n.º 6
0
 public ProjectionType(VInt dataSize, long position, EbmlElement?parent)
     : base(dataSize, position, parent)
 {
 }
Ejemplo n.º 7
0
 public override EbmlElement Create(VInt dataSize, long position, EbmlElement?parent)
 {
     return(new CbSubsamplingVert(dataSize, position, parent));
 }
Ejemplo n.º 8
0
 public override EbmlElement Create(VInt dataSize, long position, EbmlElement?parent)
 {
     return(new EncryptedBlock(dataSize, position, parent));
 }
Ejemplo n.º 9
0
 public ChapterStringUID(VInt dataSize, long position, EbmlElement?parent)
     : base(dataSize, position, parent)
 {
 }
Ejemplo n.º 10
0
 public CodecID(VInt dataSize, long position, EbmlElement?parent)
     : base(dataSize, position, parent)
 {
 }
Ejemplo n.º 11
0
 public EditionEntry(VInt dataSize, long position, EbmlElement?parent)
     : base(dataSize, position, parent)
 {
 }
Ejemplo n.º 12
0
 public TrackOverlay(VInt dataSize, long position, EbmlElement?parent)
     : base(dataSize, position, parent)
 {
 }
Ejemplo n.º 13
0
 public TrickTrackSegmentUID(VInt dataSize, long position, EbmlElement?parent)
     : base(dataSize, position, parent)
 {
 }
 public override EbmlElement Create(VInt dataSize, long position, EbmlElement?parent)
 {
     return(new TrackTranslateCodec(dataSize, position, parent));
 }
 public TrackTranslateCodec(VInt dataSize, long position, EbmlElement?parent)
     : base(dataSize, position, parent)
 {
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Constructor.
 /// Create an empty node with the specified ID.
 /// Length is calculated at write-time.
 /// </summary>
 /// <param name="id">Desired ID for the new node.</param>
 public OwlNode(Int64 id)
     : this()
 {
     this.id = new VInt(id);
     data = new StreamEx(new MemoryStream()); // Buffer for stream.
 }
Ejemplo n.º 17
0
        public override void Enter(AGE.Action _action, Track _track)
        {
            PoolObjHandle <ActorRoot> actorHandle = new PoolObjHandle <ActorRoot>(null);

            this.done_     = false;
            this.lastTime_ = 0;
            base.Enter(_action, _track);
            VInt3 attackerPos = this.attackerPos;

            if (this.attackerId != -1)
            {
                if (_action.GetGameObject(this.attackerId) == null)
                {
                    return;
                }
                actorHandle = _action.GetActorHandle(this.attackerId);
                if (actorHandle == 0)
                {
                    return;
                }
                attackerPos = actorHandle.handle.location;
            }
            this.actor_ = _action.GetActorHandle(this.targetId);
            if (this.actor_ != 0)
            {
                if (!this.actor_.handle.isMovable)
                {
                    this.actor_.Release();
                    this.done_ = true;
                }
                else
                {
                    if (this.dirType == BeatBackDirType.Position)
                    {
                        VInt3 num2 = this.actor_.handle.location - attackerPos;
                        num2.y             = 0;
                        this.moveDirection = num2.NormalizeTo(0x3e8);
                    }
                    else if (this.dirType == BeatBackDirType.Directional)
                    {
                        if (actorHandle == 0)
                        {
                            this.done_ = true;
                            return;
                        }
                        this.moveDirection = actorHandle.handle.forward;
                    }
                    if (this.enableRotate)
                    {
                        this.fromRot = this.actor_.handle.rotation;
                        this.actor_.handle.MovementComponent.SetRotate(-this.moveDirection, true);
                        if (this.rotationTime > 0)
                        {
                            this.toRot = Quaternion.LookRotation((Vector3)this.actor_.handle.forward);
                        }
                        else
                        {
                            this.actor_.handle.rotation = Quaternion.LookRotation((Vector3)this.actor_.handle.forward);
                        }
                    }
                    int initSpeed = this.initSpeed;
                    this.motionControler = new AccelerateMotionControler();
                    if (this.atteDistance > 0)
                    {
                        VInt3 num4 = this.actor_.handle.location - attackerPos;
                        VInt  num5 = num4.magnitude2D;
                        if (num5.i > this.atteDistance)
                        {
                            initSpeed = 0;
                        }
                        else
                        {
                            initSpeed = ((this.atteDistance - num5.i) * this.initSpeed) / this.atteDistance;
                        }
                    }
                    this.motionControler.InitMotionControler(initSpeed, this.accelerateSpeed);
                    this.actor_.handle.ObjLinker.AddCustomMoveLerp(new CustomMoveLerpFunc(this.ActionMoveLerp));
                }
            }
        }
Ejemplo n.º 18
0
 public EncryptedBlock(VInt dataSize, long position, EbmlElement?parent)
     : base(dataSize, position, parent)
 {
 }
Ejemplo n.º 19
0
 public ReferenceTimestamp(VInt dataSize, long position, EbmlElement?parent)
     : base(dataSize, position, parent)
 {
 }
Ejemplo n.º 20
0
 public CbSubsamplingVert(VInt dataSize, long position, EbmlElement?parent)
     : base(dataSize, position, parent)
 {
 }
Ejemplo n.º 21
0
 public override EbmlElement Create(VInt dataSize, long position, EbmlElement?parent)
 {
     return(new ReferenceTimestamp(dataSize, position, parent));
 }
Ejemplo n.º 22
0
 internal EbmlHead(VInt dataSize, long position, EbmlElement?parent)
     : base(dataSize, position, parent)
 {
 }
Ejemplo n.º 23
0
 public void LateUpdate(int nDelta)
 {
     if (((this.skillSlot != null) && (this.skillSlot.SkillObj != null)) && (this.skillSlot.SkillObj.cfgData != null))
     {
         if ((this.effectHideFrameNum > 0) && (Time.frameCount > this.effectHideFrameNum))
         {
             this.ForceSetGuildPrefabShow(false);
             this.effectHideFrameNum = 0;
         }
         this.pressTime += nDelta;
         if (this.effectPrefab != null)
         {
             if (this.bMoveFlag)
             {
                 Vector3 vector = (Vector3)((this.deltaDirection * this.moveSpeed) * nDelta);
                 this.deltaPosition += vector;
                 if (this.deltaPosition.magnitude >= this.movePosition.magnitude)
                 {
                     this.bMoveFlag        = false;
                     this.useSkillPosition = this.skillSlot.Actor.handle.gameObject.transform.position + this.useOffsetPosition;
                     this.effectPrefab.transform.position = this.useSkillPosition;
                 }
                 else
                 {
                     this.useSkillPosition  = this.effectPrefab.transform.position + vector;
                     this.useSkillPosition += this.skillSlot.Actor.handle.gameObject.transform.position - this.rootRosition;
                     this.effectPrefab.transform.position = this.useSkillPosition;
                     this.rootRosition = this.skillSlot.Actor.handle.gameObject.transform.position;
                 }
             }
             else
             {
                 this.useSkillPosition += this.skillSlot.Actor.handle.gameObject.transform.position - this.rootRosition;
                 this.effectPrefab.transform.position = this.useSkillPosition;
                 this.rootRosition = this.skillSlot.Actor.handle.gameObject.transform.position;
             }
             if (this.bRotateFlag)
             {
                 float y = this.rotateSpeed * nDelta;
                 this.deltaAngle += y;
                 if (this.deltaAngle >= this.rotateAngle)
                 {
                     this.bRotateFlag       = false;
                     this.useSkillDirection = this.rotateDirection;
                     this.effectPrefab.transform.forward = this.useSkillDirection;
                 }
                 else
                 {
                     Vector3 forward = this.effectPrefab.transform.forward;
                     if (Vector3.Cross(this.useSkillDirection, this.rotateDirection).y < 0f)
                     {
                         forward = (Vector3)(Quaternion.Euler(0f, -y, 0f) * forward);
                     }
                     else
                     {
                         forward = (Vector3)(Quaternion.Euler(0f, y, 0f) * forward);
                     }
                     this.useSkillDirection = forward;
                     this.effectPrefab.transform.forward = this.useSkillDirection;
                 }
             }
             VInt groundY = 0;
             if (PathfindingUtility.GetGroundY((VInt3)this.effectPrefab.transform.position, out groundY))
             {
                 Vector3 position = this.effectPrefab.transform.position;
                 position.y = ((float)groundY) + 0.3f;
                 this.effectPrefab.transform.position = position;
             }
         }
         if ((this.effectWarnPrefab != null) && (this.effectPrefab != null))
         {
             this.effectWarnPrefab.transform.position = this.effectPrefab.transform.position;
             this.effectWarnPrefab.transform.forward  = this.effectPrefab.transform.forward;
         }
         this.SetUseSkillTarget();
     }
 }
Ejemplo n.º 24
0
 public Segment(VInt dataSize, long position, EbmlElement?parent)
     : base(dataSize, position, parent)
 {
 }
Ejemplo n.º 25
0
 public BitsPerChannel(VInt dataSize, long position, EbmlElement?parent)
     : base(dataSize, position, parent)
 {
 }
Ejemplo n.º 26
0
 public TrackPlaneUID(VInt dataSize, long position, EbmlElement?parent)
     : base(dataSize, position, parent)
 {
 }
Ejemplo n.º 27
0
 public override EbmlElement Create(VInt dataSize, long position, EbmlElement?parent)
 {
     return(new BitsPerChannel(dataSize, position, parent));
 }
 public ChapterTranslateID(VInt dataSize, long position, EbmlElement?parent)
     : base(dataSize, position, parent)
 {
 }
Ejemplo n.º 29
0
 public override EbmlElement Create(VInt dataSize, long position, EbmlElement?parent)
 {
     return(new DocTypeVersion(dataSize, position, parent));
 }
Ejemplo n.º 30
0
 /// <summary>
 /// Writes a signed variable-bit integer to the StreamEx.
 /// </summary>
 /// <param name="b">Variable-bit integer.</param>
 /// <param name="width">Desired width of the VInt representation; if negative, default width will be used.</param>
 /// <exception cref="ArgumentException">Throws ArgumentException if the specified width is positive and less than necessary width to contain the VInt value.</exception>
 public void WriteVInt(VInt b, Int32 width = -1)
 {
     WriteBytes(b.Encode(width));
 }
Ejemplo n.º 31
0
 internal DocTypeVersion(VInt dataSize, long position, EbmlElement?parent)
     : base(dataSize, position, parent)
 {
 }
Ejemplo n.º 32
0
 /// <summary>
 /// Default constructor.
 /// Initializes the children collection.
 /// </summary>
 protected OwlNode()
 {
     id = new VInt(-1);
     children = new List<OwlNode>();
 }
 public TransferCharacteristics(VInt dataSize, long position, EbmlElement?parent)
     : base(dataSize, position, parent)
 {
 }
 public override EbmlElement Create(VInt dataSize, long position, EbmlElement?parent)
 {
     return(new TransferCharacteristics(dataSize, position, parent));
 }
Ejemplo n.º 35
0
 public BlockGroup(VInt dataSize, long position, EbmlElement?parent)
     : base(dataSize, position, parent)
 {
 }