示例#1
0
        public bool Equals([NotNull] Game other)
        {
            if (ReferenceEquals(other, null))
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            if (!Id.Equals(other.Id))
            {
                return(false);
            }

            if (!Type.Equals(other.Type))
            {
                return(false);
            }

            if (!ReleaseTime.Equals(other.ReleaseTime))
            {
                return(false);
            }

            return(Time.Equals(other.Time));
        }
示例#2
0
        public override void Update(GameTime gameTime)
        {
            float diff = 30 - (float)gameTime.TotalGameTime.Subtract(ReleaseTime).TotalSeconds * 60;

            if (diff <= 0)
            {
                diff = .01f;
            }
            Velocity.X = (TargetPlayer.Character.Hitbox.Center.X - Position.X) / diff;
            Velocity.Y = (TargetPlayer.Character.Hitbox.Center.Y - Position.Y) / diff;
            VelocityZ  = (TargetPlayer.Character.PositionZ - PositionZ) / diff;
            Position  += Velocity;
            PositionZ += VelocityZ;

            if (Knocked == true)
            {
                SourcePosition = Position;
                Position.X     = SourcePosition.X + Velocity.X * (float)gameTime.TotalGameTime.Subtract(ReleaseTime).TotalSeconds * 60;
                Position.Y     = SourcePosition.Y + Velocity.Y * (float)ReleaseTime.Subtract(gameTime.TotalGameTime).TotalSeconds * 60 + .5F * (float)Math.Pow(ReleaseTime.Subtract(gameTime.TotalGameTime).TotalSeconds * 60, 2) / 2F;
                if (gameTime.TotalGameTime.Subtract(ReleaseTime).TotalSeconds * 60 >= 60)
                {
                    Knocked = false;
                }
            }
            Hitbox.Width  = Sprite.Width;
            Hitbox.Height = Sprite.Height;
            Hitbox.X      = (int)Position.X;
            Hitbox.Y      = (int)Position.Y + (int)PositionZ;
            rotation     += (float)gameTime.ElapsedGameTime.TotalSeconds * 15;
            float circle = MathHelper.Pi * 2;

            rotation = rotation % circle;
        }
示例#3
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = (int)Type;
         hashCode = (hashCode * 397) + Id.GetHashCode(StringComparison.InvariantCulture);
         hashCode = (hashCode * 397) + ReleaseTime.GetHashCode();
         hashCode = (hashCode * 397) + Time.GetHashCode();
         return(hashCode);
     }
 }
示例#4
0
        public override void Update(GameTime gameTime)
        {
            if (gameTime.TotalGameTime.Subtract(ReleaseTime).TotalSeconds * 60 >= 60)
            {
                MarkForDelete = true;
            }
            Position.X    = SourcePosition.X + Velocity.X * (float)gameTime.TotalGameTime.Subtract(ReleaseTime).TotalSeconds * 60;
            Position.Y    = SourcePosition.Y + Velocity.Y * (float)ReleaseTime.Subtract(gameTime.TotalGameTime).TotalSeconds * 60 + .5F * (float)Math.Pow(ReleaseTime.Subtract(gameTime.TotalGameTime).TotalSeconds * 60, 2) / 2F;
            Hitbox.Width  = Sprite.Width;
            Hitbox.Height = Sprite.Height;
            Hitbox.X      = (int)Position.X - 25;
            Hitbox.Y      = (int)Position.Y - 25;
            rotation     += (float)gameTime.ElapsedGameTime.TotalSeconds * 15;
            float circle = MathHelper.Pi * 2;

            rotation = rotation % circle;
        }
示例#5
0
        /// <summary>
        /// 获取相同md5对象
        /// </summary>
        /// <returns></returns>
        public async Task <CrawlStatistics> FindHistorySameByMd5()
        {
            var filter = Builders <CrawlStatistics> .Filter.And(
                Builders <CrawlStatistics> .Filter.Eq(s => s.UrlMd5, UrlMd5),
                Builders <CrawlStatistics> .Filter.Eq(s => s.DownloadStatus, DownloadStatus),
                Builders <CrawlStatistics> .Filter.Ne(s => s.Id, Id),
                Builders <CrawlStatistics> .Filter.Gte(s => s.ReleaseTime, ReleaseTime.AddDays(-2)),
                Builders <CrawlStatistics> .Filter.Lte(s => s.ReleaseTime, ReleaseTime));

            var sort = Builders <CrawlStatistics> .Sort.Descending(s => s.ReleaseTime);

            var options = new FindOptions <CrawlStatistics>()
            {
                Sort  = sort,
                Limit = 1
            };

            using (var cursor = await _collection.FindAsync(filter, options))
            {
                return(await cursor.SingleOrDefaultAsync());
            }
        }
示例#6
0
 await AddEvent(EventType.UserHosted, User, ReleaseTime, Description);
示例#7
0
        public void Handle(InputArgs e)
        {
            var eventInjected     = false; // There is one case in which we inject the given event ourselves.
            var isModifier        = e.Input.IsModifierKey();
            var standardModifiers = _modifiers.ToStandardModifiers();

            // Try to release the modifiers to release.
            if (_modifiersToRelease != Modifiers.None && _timeOfRelease == ReleaseTime.AtNextEvent)
            {
                Env.CreateInjector().Add(_modifiersToRelease, false).Run();
                _modifiersToRelease = Modifiers.None;
            }

            // When there are still modifiers to release, all down events are captured (ignored). This makes things easier, as we can now assume
            // that there are no modifiers to release for down events that are not yet captured.
            if (_modifiersToRelease != Modifiers.None && e.Down)
            {
                e.Capture = true;
            }

            // Handle a down event.
            if (e.Down && !e.Capture)
            {
                HandleDownEvent(e);
            }

            // If there are standard modifiers virtually active and a non-modifier key down event is not captured, these modifiers need to be
            // injected.
            if (e.Down && !isModifier && !e.Capture && standardModifiers != Modifiers.None)
            {
                // A mouse event is handled separately.
                if (e.Input.IsMouseInput())
                {
                    // Inject the key down events of the modifiers. These injections occur during the hook procedure of the mouse event, and will
                    // therefore arrive in time.
                    Env.CreateInjector().Add(standardModifiers, true).Run();

                    _modifiersToRelease |= standardModifiers;

                    // Specify when to release the modifiers.
                    _timeOfRelease = e.Input == Input.WheelDown || e.Input == Input.WheelUp ? ReleaseTime.AtNextEvent : ReleaseTime.AfterMouseUpEvent;
                }
                else
                {
                    e.Capture     = true;
                    eventInjected = true;
                    // Inject the modifier down events, the key down event, and the modifier up events.
                    Env.CreateInjector().Add(standardModifiers, true).Add(e.Input, true).Add(standardModifiers, false).Run();
                }
            }

            // For a non-modifier key down, or a modifier key down that is captured, the stuck modifiers are reset and the almost stuck modifiers
            // are cleared.
            if (e.Down && (!isModifier || e.Capture))
            {
                DeactivateStuckModifiers();
                _almostStuckModifiers = Modifiers.None;
            }

            // Update time of release.
            if (_modifiersToRelease != Modifiers.None && _timeOfRelease == ReleaseTime.AfterMouseUpEvent && e.Up && e.Input.IsMouseInput())
            {
                _timeOfRelease = ReleaseTime.AtNextEvent;
            }

            // A modifier key that is not captured affects the virtual modifier state.
            if (isModifier && !e.Capture)
            {
                UpdateVirtualModifiers(e);
            }

            // Capture all modifiers and some non-modifier key up events.
            if (isModifier)
            {
                // Capture all modifiers. Only injected modifiers will get through.
                e.Capture = true;
            }
            else
            {
                // For a non-modifier key down event, add the key to the captured keys.
                if (e.Capture && e.Down && !eventInjected)
                {
                    _captured.Add(e.Input);
                }
                // For a non-modifier key up event for which the key down was captured, also capture the key up.
                else if (e.Up && _captured.Contains(e.Input))
                {
                    e.Capture = true;
                    _captured.Remove(e.Input);
                }
            }
        }
示例#8
0
 public int CompareTo(Version other)
 {
     return(ReleaseTime.CompareTo(other.ReleaseTime));
 }
        public bool Equals(DestinyActivityDefinition input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     DisplayProperties == input.DisplayProperties ||
                     (DisplayProperties != null && DisplayProperties.Equals(input.DisplayProperties))
                     ) &&
                 (
                     OriginalDisplayProperties == input.OriginalDisplayProperties ||
                     (OriginalDisplayProperties != null && OriginalDisplayProperties.Equals(input.OriginalDisplayProperties))
                 ) &&
                 (
                     SelectionScreenDisplayProperties == input.SelectionScreenDisplayProperties ||
                     (SelectionScreenDisplayProperties != null && SelectionScreenDisplayProperties.Equals(input.SelectionScreenDisplayProperties))
                 ) &&
                 (
                     ReleaseIcon == input.ReleaseIcon ||
                     (ReleaseIcon != null && ReleaseIcon.Equals(input.ReleaseIcon))
                 ) &&
                 (
                     ReleaseTime == input.ReleaseTime ||
                     (ReleaseTime.Equals(input.ReleaseTime))
                 ) &&
                 (
                     ActivityLightLevel == input.ActivityLightLevel ||
                     (ActivityLightLevel.Equals(input.ActivityLightLevel))
                 ) &&
                 (
                     DestinationHash == input.DestinationHash ||
                     (DestinationHash.Equals(input.DestinationHash))
                 ) &&
                 (
                     PlaceHash == input.PlaceHash ||
                     (PlaceHash.Equals(input.PlaceHash))
                 ) &&
                 (
                     ActivityTypeHash == input.ActivityTypeHash ||
                     (ActivityTypeHash.Equals(input.ActivityTypeHash))
                 ) &&
                 (
                     Tier == input.Tier ||
                     (Tier.Equals(input.Tier))
                 ) &&
                 (
                     PgcrImage == input.PgcrImage ||
                     (PgcrImage != null && PgcrImage.Equals(input.PgcrImage))
                 ) &&
                 (
                     Rewards == input.Rewards ||
                     (Rewards != null && Rewards.SequenceEqual(input.Rewards))
                 ) &&
                 (
                     Modifiers == input.Modifiers ||
                     (Modifiers != null && Modifiers.SequenceEqual(input.Modifiers))
                 ) &&
                 (
                     IsPlaylist == input.IsPlaylist ||
                     (IsPlaylist != null && IsPlaylist.Equals(input.IsPlaylist))
                 ) &&
                 (
                     Challenges == input.Challenges ||
                     (Challenges != null && Challenges.SequenceEqual(input.Challenges))
                 ) &&
                 (
                     OptionalUnlockStrings == input.OptionalUnlockStrings ||
                     (OptionalUnlockStrings != null && OptionalUnlockStrings.SequenceEqual(input.OptionalUnlockStrings))
                 ) &&
                 (
                     PlaylistItems == input.PlaylistItems ||
                     (PlaylistItems != null && PlaylistItems.SequenceEqual(input.PlaylistItems))
                 ) &&
                 (
                     ActivityGraphList == input.ActivityGraphList ||
                     (ActivityGraphList != null && ActivityGraphList.SequenceEqual(input.ActivityGraphList))
                 ) &&
                 (
                     Matchmaking == input.Matchmaking ||
                     (Matchmaking != null && Matchmaking.Equals(input.Matchmaking))
                 ) &&
                 (
                     GuidedGame == input.GuidedGame ||
                     (GuidedGame != null && GuidedGame.Equals(input.GuidedGame))
                 ) &&
                 (
                     DirectActivityModeHash == input.DirectActivityModeHash ||
                     (DirectActivityModeHash.Equals(input.DirectActivityModeHash))
                 ) &&
                 (
                     DirectActivityModeType == input.DirectActivityModeType ||
                     (DirectActivityModeType.Equals(input.DirectActivityModeType))
                 ) &&
                 (
                     Loadouts == input.Loadouts ||
                     (Loadouts != null && Loadouts.SequenceEqual(input.Loadouts))
                 ) &&
                 (
                     ActivityModeHashes == input.ActivityModeHashes ||
                     (ActivityModeHashes != null && ActivityModeHashes.SequenceEqual(input.ActivityModeHashes))
                 ) &&
                 (
                     ActivityModeTypes == input.ActivityModeTypes ||
                     (ActivityModeTypes != null && ActivityModeTypes.SequenceEqual(input.ActivityModeTypes))
                 ) &&
                 (
                     IsPvP == input.IsPvP ||
                     (IsPvP != null && IsPvP.Equals(input.IsPvP))
                 ) &&
                 (
                     InsertionPoints == input.InsertionPoints ||
                     (InsertionPoints != null && InsertionPoints.SequenceEqual(input.InsertionPoints))
                 ) &&
                 (
                     ActivityLocationMappings == input.ActivityLocationMappings ||
                     (ActivityLocationMappings != null && ActivityLocationMappings.SequenceEqual(input.ActivityLocationMappings))
                 ) &&
                 (
                     Hash == input.Hash ||
                     (Hash.Equals(input.Hash))
                 ) &&
                 (
                     Index == input.Index ||
                     (Index.Equals(input.Index))
                 ) &&
                 (
                     Redacted == input.Redacted ||
                     (Redacted != null && Redacted.Equals(input.Redacted))
                 ));
        }