Exemplo n.º 1
0
        public ServiceBusArgumentsDisplayTests(ServiceBusArgumentsDisplayTestsFixture fixture)
            : base(fixture)
        {
            Waiters.WaitForAction(() => Dashboard.Api.IndexingQueueLength(limit: 1) == 0);

            _storageAccount = fixture.StorageAccount;
        }
Exemplo n.º 2
0
        private void DoPause(object s, EventArgs ea)
        {
            bool checkActive = s == this.Game;

            if (this.loadWaiter != null)
            {
                return;
            }
            this.loadWaiter = Waiters.Wait((Func <bool>)(() =>
            {
                if (this.GameState.Loading)
                {
                    return(false);
                }
                if (checkActive)
                {
                    return(Intro.Instance == null);
                }
                else
                {
                    return(true);
                }
            }), (Action)(() =>
            {
                this.loadWaiter = (IWaiter)null;
                if (checkActive && this.Game.IsActive || MainMenu.Instance != null)
                {
                    return;
                }
                this.GameState.Pause();
            }));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> GetTransaction(
            [ModelBinder(BinderType = typeof(UInt256ModelBinding))]
            uint256 txId,
            bool includeTransaction = true,
            string cryptoCode       = null)
        {
            var network = GetNetwork(cryptoCode, false);
            var chain   = this.ChainProvider.GetChain(network);
            var result  = await RepositoryProvider.GetRepository(network).GetSavedTransactions(txId);

            if (result.Length == 0)
            {
                var waiter = Waiters.GetWaiter(cryptoCode);
                if (waiter.RPCAvailable &&
                    waiter.HasTxIndex &&
                    await waiter.RPC.TryGetRawTransaction(txId) is Repository.SavedTransaction savedTransaction)
                {
                    result = new[] { savedTransaction };
                }
                else
                {
                    return(NotFound());
                }
            }
            var tx = Utils.ToTransactionResult(chain, result);

            if (!includeTransaction)
            {
                tx.Transaction = null;
            }
            return(Json(tx));
        }
Exemplo n.º 4
0
        //Add a waiter to the Waiter list include sex, name and age. And check the input.
        private void AddWaiter(object sender, RoutedEventArgs e)
        {
            Waiters waiter = new Waiters();
            waiter.EarnedMoney = 0.00m;
            waiter.HandledTable = 0;
            try
            {
                if (SexA.Text == "M" || SexA.Text == "F")
                {
                    waiter.Sex = SexA.Text;
                }
                else
                {
                    AddError.Content = "Your input has something wrong. Try again!";
                    return;
                }
                waiter.FirstName = FirstNameA.Text;
                waiter.LastName = LastNameA.Text;
                waiter.Age = Convert.ToInt32(AgeA.Text);
                FirstNameA.Text = "";
                LastNameA.Text = "";
                AgeA.Text = "";
                SexA.Text = "";
                AddError.Content = "";

                Db.db.Waiters.Add(waiter);
                Db.db.SaveChanges();
            }
            catch
            {
                AddError.Content = "Your input has something wrong. Try again!";
            }
            ShowWaiter();
        }
Exemplo n.º 5
0
        public async Task <GetFeeRateResult> GetFeeRate(int blockCount, string cryptoCode)
        {
            var network = GetNetwork(cryptoCode, true);

            if (!network.SupportEstimatesSmartFee)
            {
                throw new NBXplorerError(400, "fee-estimation-unavailable", $"{cryptoCode} does not support estimatesmartfee").AsException();
            }
            var waiter = Waiters.GetWaiter(network);
            var result = await waiter.RPC.SendCommandAsync("estimatesmartfee", blockCount);

            var obj             = (JObject)result.Result;
            var feeRateProperty = obj.Property("feerate");
            var rate            = feeRateProperty == null ? (decimal) - 1 : obj["feerate"].Value <decimal>();

            if (rate == -1)
            {
                throw new NBXplorerError(400, "fee-estimation-unavailable", $"It is currently impossible to estimate fees, please try again later.").AsException();
            }
            return(new GetFeeRateResult()
            {
                FeeRate = new FeeRate(Money.Coins(Math.Round(rate / 1000, 8)), 1),
                BlockCount = obj["blocks"].Value <int>()
            });
        }
Exemplo n.º 6
0
        public Task StartAsync(CancellationToken cancellationToken)
        {
            if (_Disposed)
            {
                throw new ObjectDisposedException(nameof(BrokerHostedService));
            }

            _senderBlock        = CreateClientBlock();
            _senderTransactions = CreateClientTransaction();

            _subscriptions.Add(_EventAggregator.Subscribe <Events.NewBlockEvent>(async o =>
            {
                var chain = ChainProvider.GetChain(o.CryptoCode);
                if (chain == null)
                {
                    return;
                }
                var block = chain.GetBlock(o.BlockId);
                if (block != null)
                {
                    var nbe = new Models.NewBlockEvent()
                    {
                        CryptoCode        = o.CryptoCode,
                        Hash              = block.Hash,
                        Height            = block.Height,
                        PreviousBlockHash = block?.Previous
                    };
                    await _senderBlock.Send(nbe);
                }
            }));


            _subscriptions.Add(_EventAggregator.Subscribe <Events.NewTransactionMatchEvent>(async o =>
            {
                var network = Waiters.GetWaiter(o.CryptoCode);
                if (network == null)
                {
                    return;
                }
                var chain = ChainProvider.GetChain(o.CryptoCode);
                if (chain == null)
                {
                    return;
                }
                var txe = new Models.NewTransactionEvent()
                {
                    TrackedSource      = o.Match.TrackedSource,
                    DerivationStrategy = o.Match.DerivationStrategy,
                    CryptoCode         = o.CryptoCode,
                    BlockId            = o.BlockId,
                    TransactionData    = Utils.ToTransactionResult(true, chain, new[] { o.SavedTransaction }),
                    Inputs             = o.Match.Inputs,
                    Outputs            = o.Match.Outputs
                };
                await _senderTransactions.Send(txe);
            }));

            Logs.Configuration.LogInformation("Starting Azure Service Bus Message Broker");
            return(Task.CompletedTask);
        }
Exemplo n.º 7
0
 public void FadeOutAndPause(float forSeconds)
 {
     if ((double)forSeconds == 0.0)
     {
         if (this.Cue == null || this.Cue.IsDisposed || this.Cue.State == SoundState.Paused)
         {
             return;
         }
         this.Cue.Pause();
     }
     else
     {
         if (this.Dead || this.fadePauseWaiter != null)
         {
             return;
         }
         float volumeFactor = this.VolumeFactor * this.VolumeLevel * this.VolumeMaster;
         this.fadePauseWaiter = Waiters.Interpolate((double)forSeconds, (Action <float>)(s => this.VolumeFactor = volumeFactor * (1f - s)), (Action)(() =>
         {
             if (this.Cue != null && !this.Cue.IsDisposed && this.Cue.State != SoundState.Paused)
             {
                 this.Cue.Pause();
             }
             this.fadePauseWaiter = (IWaiter)null;
         }));
         this.fadePauseWaiter.AutoPause = true;
     }
 }
Exemplo n.º 8
0
 private void ScheduleHit()
 {
     this.wutex2 = (IWaiter)null;
     this.wutex1 = Waiters.Wait(0.25, (Action)(() =>
     {
         Waiters.Wait(0.25, (Action)(() => this.wutex1 = (IWaiter)null));
         this.PlayerManager.Action = ActionType.HitBell;
         this.PlayerManager.Animation.Timing.Restart();
         this.SinceHit = TimeSpan.Zero;
         SoundEffectExtensions.EmitAt(this.sBellHit[(int)(this.CameraManager.Viewpoint - 1)], this.BellAo.Position);
         this.SoundManager.FadeVolume(0.25f, 1f, 2f);
         this.AngularVelocity += new Vector2(-FezMath.Dot(FezMath.ForwardVector(this.CameraManager.Viewpoint), Vector3.UnitZ), FezMath.Dot(FezMath.ForwardVector(this.CameraManager.Viewpoint), Vector3.UnitX)) * 0.075f;
         if (this.Solved)
         {
             return;
         }
         if (this.LastHit != Viewpoint.None && this.LastHit != this.CameraManager.Viewpoint)
         {
             this.Hits[this.CameraManager.Viewpoint] = 0;
         }
         this.LastHit = this.CameraManager.Viewpoint;
         Dictionary <Viewpoint, int> local_1;
         Viewpoint local_2;
         (local_1 = this.Hits)[local_2 = this.CameraManager.Viewpoint] = local_1[local_2] + 1;
         if (!Enumerable.All <KeyValuePair <Viewpoint, int> >((IEnumerable <KeyValuePair <Viewpoint, int> >) this.Hits, (Func <KeyValuePair <Viewpoint, int>, bool>)(kvp => kvp.Value == this.ExpectedHits[kvp.Key])))
         {
             return;
         }
         this.Solved = true;
         this.GameState.SaveData.ThisLevel.InactiveArtObjects.Add(this.BellAo.Id);
         this.LevelService.ResolvePuzzle();
         ServiceHelper.AddComponent((IGameComponent) new GlitchyDespawner(this.Game, this.BellAo, this.OriginalPosition));
     }));
     this.wutex1.AutoPause = true;
 }
Exemplo n.º 9
0
 private void TryAssembleCube()
 {
     if (this.AssembleScheduled || this.GameState.SaveData.CollectedParts != 8)
     {
         return;
     }
     this.AssembleScheduled = true;
     Waiters.Wait((Func <bool>)(() =>
     {
         if (!this.GameState.Loading && ActionTypeExtensions.AllowsLookingDirectionChange(this.PlayerManager.Action) && (this.SpeechBubble.Hidden && !this.GameState.ForceTimePaused) && (this.PlayerManager.CanControl && !ActionTypeExtensions.DisallowsRespawn(this.PlayerManager.Action) && (this.CameraManager.ViewTransitionReached && !this.PlayerManager.InDoorTransition)))
         {
             return(this.PlayerManager.CarriedInstance == null);
         }
         else
         {
             return(false);
         }
     }), (Action)(() => Waiters.Wait(0.0, (Action)(() =>
     {
         Vector3 local_0 = FezMath.DepthMask(this.CameraManager.Viewpoint);
         Vector3 local_1 = FezMath.ForwardVector(this.CameraManager.Viewpoint);
         TrileInstance local_3 = new TrileInstance((this.PlayerManager.Position + Vector3.UnitY * (float)(Math.Sin(this.timeAcc.TotalSeconds * 3.14159274101257) * 0.100000001490116 + 2.0) - FezMath.HalfVector) * (Vector3.One - local_0) - local_1 * (this.LevelManager.Size / 2f - local_0 * 2f) + local_0 * this.LevelManager.Size / 2f, Enumerable.Last <Trile>((IEnumerable <Trile>) this.LevelManager.TrileSet.Triles.Values, (Func <Trile, bool>)(x => x.ActorSettings.Type == ActorType.CubeShard)).Id);
         this.LevelManager.RestoreTrile(local_3);
         this.LevelMaterializer.CullInstanceIn(local_3);
         this.PlayerManager.ForcedTreasure = local_3;
         this.PlayerManager.Action = ActionType.FindingTreasure;
         this.AssembleScheduled = false;
     }))));
 }
Exemplo n.º 10
0
        private async Task UpdatePSBTCore(UpdatePSBTRequest update, NBXplorerNetwork network)
        {
            var repo = RepositoryProvider.GetRepository(network);
            var rpc  = Waiters.GetWaiter(network);

            await UpdateInputsUTXO(update, repo, rpc);

            if (update.DerivationScheme is DerivationStrategyBase)
            {
                foreach (var extpub in update.DerivationScheme.GetExtPubKeys().Select(e => e.GetWif(network.NBitcoinNetwork)))
                {
                    update.PSBT.GlobalXPubs.AddOrReplace(extpub, new RootedKeyPath(extpub, new KeyPath()));
                }
                await UpdateHDKeyPathsWitnessAndRedeem(update, repo);
            }

            foreach (var input in update.PSBT.Inputs)
            {
                input.TrySlimUTXO();
            }

            if (update.RebaseKeyPaths != null)
            {
                foreach (var rebase in update.RebaseKeyPaths)
                {
                    var rootedKeyPath = rebase.GetRootedKeyPath();
                    if (rootedKeyPath == null)
                    {
                        throw new NBXplorerException(new NBXplorerError(400, "missing-parameter", "rebaseKeyPaths[].rootedKeyPath is missing"));
                    }
                    update.PSBT.RebaseKeyPaths(rebase.AccountKey, rootedKeyPath);
                }
            }
        }
Exemplo n.º 11
0
        public async Task <IActionResult> GetStatus(string cryptoCode)
        {
            var network = GetNetwork(cryptoCode, false);
            var waiter  = Waiters.GetWaiter(network);
            var chain   = ChainProvider.GetChain(network);
            var repo    = RepositoryProvider.GetRepository(network);
            var now     = DateTimeOffset.UtcNow;


            var location = waiter.GetLocation();

            var blockchainInfoAsync = waiter.RPCAvailable ? waiter.RPC.GetBlockchainInfoAsyncEx() : null;
            var networkInfoAsync    = waiter.RPCAvailable ? waiter.RPC.GetNetworkInfoAsync() : null;
            await repo.Ping();

            var pingAfter = DateTimeOffset.UtcNow;

            GetBlockchainInfoResponse blockchainInfo = blockchainInfoAsync == null ? null : await blockchainInfoAsync;
            GetNetworkInfoResponse    networkInfo    = networkInfoAsync == null ? null : await networkInfoAsync;
            var status = new StatusResult()
            {
                NetworkType          = network.NBitcoinNetwork.NetworkType,
                CryptoCode           = network.CryptoCode,
                Version              = typeof(MainController).GetTypeInfo().Assembly.GetCustomAttribute <AssemblyFileVersionAttribute>().Version,
                SupportedCryptoCodes = Waiters.All().Select(w => w.Network.CryptoCode).ToArray(),
                RepositoryPingTime   = (pingAfter - now).TotalSeconds,
                IsFullySynched       = true
            };

            if (status.RepositoryPingTime > 30)
            {
                Logs.Explorer.LogWarning($"Repository ping exceeded 30 seconds ({(int)status.RepositoryPingTime}), please report the issue to NBXplorer developers");
            }

            if (blockchainInfo != null)
            {
                status.BitcoinStatus = new BitcoinStatus()
                {
                    IsSynched            = !waiter.IsSynchingCore(blockchainInfo),
                    Blocks               = (int)blockchainInfo.Blocks,
                    Headers              = (int)blockchainInfo.Headers,
                    VerificationProgress = blockchainInfo.VerificationProgress,
                    MinRelayTxFee        = new FeeRate(Money.Coins((decimal)networkInfo.relayfee), 1000),
                    IncrementalRelayFee  = new FeeRate(Money.Coins((decimal)networkInfo.incrementalfee), 1000),
                    Capabilities         = new NodeCapabilities()
                    {
                        CanScanTxoutSet  = waiter.RPC.Capabilities.SupportScanUTXOSet,
                        CanSupportSegwit = waiter.RPC.Capabilities.SupportSegwit
                    }
                };
                status.IsFullySynched &= status.BitcoinStatus.IsSynched;
            }
            status.ChainHeight     = chain.Height;
            status.SyncHeight      = location == null ? (int?)null : chain.FindFork(location).Height;
            status.IsFullySynched &= blockchainInfo != null &&
                                     waiter.State == BitcoinDWaiterState.Ready &&
                                     status.SyncHeight.HasValue &&
                                     blockchainInfo.Headers - status.SyncHeight.Value < 3;
            return(Json(status));
        }
Exemplo n.º 12
0
        public void ResolvePuzzle()
        {
            ++this.GameState.SaveData.ThisLevel.FilledConditions.SecretCount;
            List <Volume>       currentVolumes = this.PlayerManager.CurrentVolumes;
            Func <Volume, bool> predicate      = (Func <Volume, bool>)(x =>
            {
                if (x.ActorSettings != null)
                {
                    return(x.ActorSettings.IsPointOfInterest);
                }
                else
                {
                    return(false);
                }
            });
            Volume volume;

            if ((volume = Enumerable.FirstOrDefault <Volume>((IEnumerable <Volume>)currentVolumes, predicate)) != null && volume.Enabled)
            {
                volume.Enabled = false;
                this.GameState.SaveData.ThisLevel.InactiveVolumes.Add(volume.Id);
            }
            this.GameState.Save();
            SoundEffectExtensions.Emit(this.sSolvedSecret);
            this.SoundManager.MusicVolumeFactor = 0.125f;
            Waiters.Wait(2.75, (Action)(() => this.SoundManager.FadeVolume(0.125f, 1f, 3f))).AutoPause = true;
        }
Exemplo n.º 13
0
        private async Task UpdatePSBTCore(UpdatePSBTRequest update, NBXplorerNetwork network)
        {
            var repo = RepositoryProvider.GetRepository(network);
            var rpc  = Waiters.GetWaiter(network);

            await UpdateUTXO(update, repo, rpc);

            if (update.DerivationScheme is DerivationStrategyBase derivationScheme)
            {
                if (update.IncludeGlobalXPub is true)
                {
                    foreach (var extpub in derivationScheme.GetExtPubKeys().Select(e => e.GetWif(network.NBitcoinNetwork)))
                    {
                        update.PSBT.GlobalXPubs.AddOrReplace(extpub, new RootedKeyPath(extpub, new KeyPath()));
                    }
                }
                await UpdateHDKeyPathsWitnessAndRedeem(update, repo);
            }
            if (!update.AlwaysIncludeNonWitnessUTXO)
            {
                foreach (var input in update.PSBT.Inputs)
                {
                    input.TrySlimUTXO();
                }
            }


            HashSet <PubKey> rebased = new HashSet <PubKey>();

            if (update.RebaseKeyPaths != null)
            {
                if (update.RebaseKeyPaths.Any(r => r.AccountKey is null))
                {
                    throw new NBXplorerException(new NBXplorerError(400, "missing-parameter", "rebaseKeyPaths[].accountKey is missing"));
                }
                foreach (var rebase in update.RebaseKeyPaths.Where(r => rebased.Add(r.AccountKey.GetPublicKey())))
                {
                    if (rebase.AccountKeyPath == null)
                    {
                        throw new NBXplorerException(new NBXplorerError(400, "missing-parameter", "rebaseKeyPaths[].accountKeyPath is missing"));
                    }
                    update.PSBT.RebaseKeyPaths(rebase.AccountKey, rebase.AccountKeyPath);
                }
            }

            if (update.DerivationScheme is DerivationStrategyBase derivationScheme2)
            {
                var accountKeyPath = await repo.GetMetadata <RootedKeyPath>(
                    new DerivationSchemeTrackedSource(derivationScheme2), WellknownMetadataKeys.AccountKeyPath);

                if (accountKeyPath != null)
                {
                    foreach (var pubkey in derivationScheme2.GetExtPubKeys().Where(p => rebased.Add(p.PubKey)))
                    {
                        update.PSBT.RebaseKeyPaths(pubkey, accountKeyPath);
                    }
                }
            }
        }
Exemplo n.º 14
0
 protected override void Begin()
 {
     SoundEffectExtensions.EmitAt(this.pullSound, this.PlayerManager.Position);
     this.camOrigin = this.CameraManager.Center;
     this.PlayerManager.Velocity = Vector3.Zero;
     Waiters.Wait(0.5, (Action)(() => SoundEffectExtensions.EmitAt(this.landSound, this.PlayerManager.Position)));
     this.GomezService.OnHoist();
 }
Exemplo n.º 15
0
 protected override void Begin()
 {
     base.Begin();
     this.PlayerManager.Velocity = Vector3.Zero;
     this.camOrigin = this.CameraManager.Center;
     SoundEffectExtensions.EmitAt(this.sLowerToLedge, this.PlayerManager.Position);
     Waiters.Wait(0.579999983310699, (Action)(() => SoundEffectExtensions.EmitAt(this.sound, this.PlayerManager.Position)));
 }
Exemplo n.º 16
0
            private void Release()
            {
                _Operation = null;
                _Decrement = null;
                _Awaiter   = default;

                Waiters.Add(this);
            }
Exemplo n.º 17
0
            private void Release()
            {
                _Operation  = null;
                _Collection = null;
                _Awaiter    = default;

                Waiters.Add(this);
            }
 public void DeleteWaiter(Waiters item)
 {
     using (RestaurantContext context = new RestaurantContext())
     {
         var existing = context.Waiters.Find(item.WaiterID);
         context.Waiters.Remove(existing);
         context.SaveChanges();
     }
 }
Exemplo n.º 19
0
 protected override void TestConditions()
 {
     switch (this.PlayerManager.Action)
     {
     case ActionType.Idle:
     case ActionType.LookingLeft:
     case ActionType.LookingRight:
     case ActionType.LookingUp:
     case ActionType.LookingDown:
     case ActionType.Walking:
     case ActionType.Running:
     case ActionType.Sliding:
     case ActionType.Landing:
         if (this.PlayerManager.Background || (this.InputManager.Jump != FezButtonState.Pressed || !FezButtonStateExtensions.IsDown(this.InputManager.Down)) && (!ActionTypeExtensions.IsOnLedge(this.PlayerManager.Action) || this.InputManager.Down != FezButtonState.Pressed) || !this.PlayerManager.Grounded || (this.PlayerManager.Ground.First.GetRotatedFace(FezMath.VisibleOrientation(this.CameraManager.Viewpoint)) != CollisionType.TopOnly || !FezMath.AlmostEqual(this.InputManager.Movement.X, 0.0f)))
         {
             break;
         }
         TrileInstance trileInstance1 = this.PlayerManager.Ground.NearLow ?? this.PlayerManager.Ground.FarHigh;
         if (BoxCollisionResultExtensions.AnyHit(this.CollisionManager.CollideEdge(trileInstance1.Center + trileInstance1.TransformedSize * Vector3.UnitY * 0.498f, Vector3.Down * (float)Math.Sign(this.CollisionManager.GravityFactor), this.PlayerManager.Size * FezMath.XZMask / 2f, Direction2D.Vertical)))
         {
             this.PlayerManager.Position -= Vector3.UnitY * 0.01f * (float)Math.Sign(this.CollisionManager.GravityFactor);
             IPlayerManager playerManager = this.PlayerManager;
             Vector3        vector3       = playerManager.Velocity - 0.0075f * Vector3.UnitY * (float)Math.Sign(this.CollisionManager.GravityFactor);
             playerManager.Velocity = vector3;
             break;
         }
         else
         {
             if (this.PlayerManager.Grounded)
             {
                 TrileInstance trileInstance2 = this.LevelManager.NearestTrile(this.PlayerManager.Ground.First.Center, QueryOptions.None).Surface;
                 if (trileInstance2 != null && trileInstance2.Trile.ActorSettings.Type == ActorType.Ladder)
                 {
                     break;
                 }
             }
             this.PlayerManager.HeldInstance = this.PlayerManager.Ground.NearLow;
             Vector3        vector3_1     = FezMath.SideMask(this.CameraManager.Viewpoint);
             IPlayerManager playerManager = this.PlayerManager;
             Vector3        vector3_2     = playerManager.Velocity * vector3_1 * 0.5f;
             playerManager.Velocity    = vector3_2;
             this.PlayerManager.Action = ActionType.LowerToLedge;
             Waiters.Wait(0.3, (Action)(() =>
             {
                 if (this.PlayerManager.Action != ActionType.LowerToLedge)
                 {
                     return;
                 }
                 SoundEffectExtensions.EmitAt(this.sound, this.PlayerManager.Position);
                 this.PlayerManager.Velocity = Vector3.Zero;
             }));
             this.camOrigin = this.CameraManager.Center;
             break;
         }
     }
 }
 public void UpdateWaiter(Waiters item)
 {
     using (RestaurantContext context = new RestaurantContext())
     {
         var attached = context.Waiters.Attach(item);
         var existing = context.Entry <Waiters>(attached);
         existing.State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
 public int AddWaiter(Waiters item)
 {
     using (RestaurantContext context = new RestaurantContext())
     {
         // todo validation rules...
         var added = context.Waiters.Add(item);
         context.SaveChanges();
         return(added.WaiterID);
     }
 }
Exemplo n.º 22
0
 private void GlitchReboot()
 {
     ServiceHelper.AddComponent((IGameComponent) new Reboot(this.Game, "GOMEZ_HOUSE_END_32"));
     Waiters.Wait(0.100000001490116, (Action)(() =>
     {
         this.Destroy();
         this.Enabled = this.Visible = false;
     }));
     this.Enabled = false;
 }
        private async Task AddGeneralWaiter(int idRestaurant)
        {
            Waiters waiter = new Waiters();

            waiter.Idrestaurant    = idRestaurant;
            waiter.WaiterFirstName = "Meseros";
            waiter.WaiterLasName   = "General";
            _context.Waiters.Add(waiter);
            await _context.SaveChangesAsync();
        }
Exemplo n.º 24
0
 public CrumblerState(TrileInstance instance, CrumblersHost host)
 {
     ServiceHelper.InjectServices((object)this);
     this.Host           = host;
     this.Instance       = instance;
     this.OriginalCenter = instance.PhysicsState.Center;
     Waiters.Wait(0.5, new Action(this.StartCrumbling)).AutoPause = true;
     Waiters.Wait(2.5, new Action(this.Respawn)).AutoPause        = true;
     SoundEffectExtensions.EmitAt(host.sWarning, this.OriginalCenter, RandomHelper.Centered(0.00999999977648258));
 }
Exemplo n.º 25
0
        private BitcoinDWaiter GetWaiter(NBXplorerNetwork network)
        {
            var waiter = Waiters.GetWaiter(network);

            if (!waiter.RPCAvailable)
            {
                throw RPCUnavailable();
            }
            return(waiter);
        }
Exemplo n.º 26
0
            private void StartCrumbling()
            {
                SoundEffectExtensions.EmitAt(this.Host.sCrumble, this.OriginalCenter, RandomHelper.Centered(0.00999999977648258));
                Vector3 vector3_1 = FezMath.SideMask(this.CameraManager.Viewpoint);
                Vector3 vector3_2 = FezMath.ForwardVector(this.CameraManager.Viewpoint);
                bool    flag1     = (double)vector3_1.X != 0.0;
                bool    flag2     = flag1;
                int     num       = flag2 ? (int)vector3_2.Z : (int)vector3_2.X;
                Point   key       = new Point(flag1 ? this.Instance.Emplacement.X : this.Instance.Emplacement.Z, this.Instance.Emplacement.Y);

                this.LevelManager.WaitForScreenInvalidation();
                Limit limit;

                if (this.LevelManager.ScreenSpaceLimits.TryGetValue(key, out limit))
                {
                    limit.End += num;
                    TrileEmplacement id = new TrileEmplacement(flag1 ? key.X : limit.Start, key.Y, flag2 ? limit.Start : key.X);
                    while ((flag2 ? id.Z : id.X) != limit.End)
                    {
                        TrileInstance toRemove = this.LevelManager.TrileInstanceAt(ref id);
                        if (toRemove != null && !toRemove.Hidden && toRemove.Trile.ActorSettings.Type == ActorType.Crumbler)
                        {
                            toRemove.Hidden = true;
                            this.LevelMaterializer.CullInstanceOut(toRemove);
                            this.InstancesToClear.Add(toRemove);
                            ITrixelParticleSystems      particleSystems = this.ParticleSystems;
                            CrumblersHost.CrumblerState crumblerState   = this;
                            Game game = ServiceHelper.Game;
                            TrixelParticleSystem.Settings settings = new TrixelParticleSystem.Settings()
                            {
                                BaseVelocity      = Vector3.Zero,
                                Energy            = 0.1f,
                                ParticleCount     = (int)(20.0 / (double)this.InstancesToClear.Count),
                                GravityModifier   = 0.6f,
                                Crumble           = true,
                                ExplodingInstance = toRemove
                            };
                            TrixelParticleSystem trixelParticleSystem1;
                            TrixelParticleSystem trixelParticleSystem2 = trixelParticleSystem1 = new TrixelParticleSystem(game, settings);
                            crumblerState.System = trixelParticleSystem1;
                            TrixelParticleSystem system = trixelParticleSystem2;
                            particleSystems.Add(system);
                        }
                        if (flag2)
                        {
                            id.Z += num;
                        }
                        else
                        {
                            id.X += num;
                        }
                    }
                }
                Waiters.Wait(1.0, new Action(this.ClearTriles)).AutoPause = true;
            }
Exemplo n.º 27
0
        private TrileInstance TestSecretFor(bool condition, ArtObjectInstance ao, TrileInstance secretTrile, TrileInstance topMost)
        {
            Vector3 position = topMost.Position + Vector3.Up * 1.5f;

            if (condition)
            {
                if (secretTrile != null && secretTrile.Collected)
                {
                    ServiceHelper.AddComponent((IGameComponent) new GlitchyDespawner(this.Game, ao));
                    this.GameState.SaveData.ThisLevel.InactiveArtObjects.Add(ao.Id);
                    ao.Enabled = false;
                    this.TestAllSolved();
                    this.LevelService.ResolvePuzzle();
                    return((TrileInstance)null);
                }
                else
                {
                    if (secretTrile == null)
                    {
                        secretTrile = new TrileInstance(position, Enumerable.FirstOrDefault <Trile>(this.LevelManager.ActorTriles(ActorType.SecretCube)).Id);
                        ServiceHelper.AddComponent((IGameComponent) new GlitchyRespawner(this.Game, secretTrile)
                        {
                            DontCullIn = true
                        });
                    }
                    secretTrile.Position = position;
                    if (!secretTrile.Hidden)
                    {
                        this.LevelManager.UpdateInstance(secretTrile);
                    }
                }
            }
            else if (secretTrile != null)
            {
                if (secretTrile.Collected)
                {
                    ServiceHelper.AddComponent((IGameComponent) new GlitchyDespawner(this.Game, ao));
                    this.GameState.SaveData.ThisLevel.InactiveArtObjects.Add(ao.Id);
                    ao.Enabled = false;
                    this.TestAllSolved();
                    this.LevelService.ResolvePuzzle();
                    return((TrileInstance)null);
                }
                else
                {
                    ServiceHelper.AddComponent((IGameComponent) new GlitchyDespawner(this.Game, secretTrile));
                    TrileInstance rs = secretTrile;
                    Vector3       p  = position;
                    Waiters.Interpolate(2.5, (Action <float>)(_ => rs.Position = p));
                    return((TrileInstance)null);
                }
            }
            return(secretTrile);
        }
Exemplo n.º 28
0
        protected override void Begin()
        {
            base.Begin();
            SoundEffectExtensions.EmitAt(this.pullSound, this.PlayerManager.Position);
            Vector3 vector3 = FezMath.RightVector(this.CameraManager.Viewpoint) * (float)FezMath.Sign(this.PlayerManager.LookingDirection);

            this.camOrigin  = this.CameraManager.Center;
            this.gomezDelta = this.PlayerManager.Size * (vector3 + Vector3.UnitY * (float)Math.Sign(this.CollisionManager.GravityFactor)) / 2f;
            Waiters.Wait(0.579999983310699, (Action)(() => SoundEffectExtensions.EmitAt(this.landSound, this.PlayerManager.Position)));
            this.GomezService.OnHoist();
        }
Exemplo n.º 29
0
 public void UnmuteAmbience(string trackName, float fadeDuration)
 {
     if (this.ActiveAmbience != null)
     {
         this.ActiveAmbience.UnmuteTrack(trackName, fadeDuration);
     }
     else
     {
         Waiters.Wait((Func <bool>)(() => this.ActiveAmbience != null), (Action)(() => this.ActiveAmbience.UnmuteTrack(trackName, fadeDuration)));
     }
 }
Exemplo n.º 30
0
 public override void Update(GameTime gameTime)
 {
     if (this.GameState.Paused || this.GameState.InMap || (!this.CameraManager.ActionRunning || !FezMath.IsOrthographic(this.CameraManager.Viewpoint)) || this.GameState.Loading)
     {
         return;
     }
     if (this.DoCapture)
     {
         this.TimeAccumulator        += (float)(gameTime.ElapsedGameTime.TotalSeconds * 1.5);
         this.MotherCubeAo.Position   = Vector3.Lerp(this.MotherCubeAo.Position, this.OriginalPosition, 0.025f);
         this.MotherCubeAo.Rotation   = Quaternion.Slerp(this.MotherCubeAo.Rotation, Quaternion.CreateFromYawPitchRoll(FezMath.ToPhi(FezMath.VisibleOrientation(this.CameraManager.Viewpoint)), 0.0f, 0.0f), 0.025f);
         this.PlayerManager.Position  = Vector3.Lerp(this.PlayerManager.Position, this.PlayerManager.Position * FezMath.DepthMask(this.CameraManager.Viewpoint) + PyramidHost.DoorCenter.X * FezMath.SideMask(this.CameraManager.Viewpoint) + PyramidHost.DoorCenter.Y * Vector3.UnitY - Vector3.UnitY * 0.125f, 0.025f);
         this.GameState.SkipRendering = true;
         this.CameraManager.Center    = Vector3.Lerp(this.OriginalCenter, this.PlayerManager.Position, 0.025f);
         this.GameState.SkipRendering = false;
         this.UpdateRays((float)gameTime.ElapsedGameTime.TotalSeconds);
         if ((double)this.TimeAccumulator <= 6.0)
         {
             return;
         }
         this.GameState.SkipLoadScreen = true;
         this.LevelManager.ChangeLevel("HEX_REBUILD");
         Waiters.Wait((Func <bool>)(() => !this.GameState.Loading), (Action)(() =>
         {
             this.GameState.SkipLoadScreen = false;
             this.Clear();
             this.Visible = false;
         }));
         this.Enabled = false;
     }
     else
     {
         this.TimeAccumulator       += (float)(gameTime.ElapsedGameTime.TotalSeconds / 2.0);
         this.TimeAccumulator        = FezMath.WrapAngle(this.TimeAccumulator);
         this.MotherCubeAo.Rotation *= Quaternion.CreateFromAxisAngle(Vector3.UnitY, (float)(-gameTime.ElapsedGameTime.TotalSeconds * 0.375));
         Vector3 vector3 = new Vector3(0.0f, (float)Math.Sin((double)this.TimeAccumulator), 0.0f) / 2f;
         this.MotherCubeAo.Position = this.OriginalPosition + vector3;
         Vector2 vector2 = new Vector2(FezMath.Dot(this.PlayerManager.Center, FezMath.SideMask(this.CameraManager.Viewpoint)), this.PlayerManager.Center.Y);
         if ((double)Math.Abs(vector2.X - PyramidHost.DoorCenter.X) >= 1.0 || (double)Math.Abs(vector2.Y - (PyramidHost.DoorCenter.Y + vector3.Y)) >= 1.0 || (double)FezMath.AngleBetween(Vector3.Transform(-Vector3.UnitZ, this.MotherCubeAo.Rotation), FezMath.ForwardVector(this.CameraManager.Viewpoint)) >= 0.25)
         {
             return;
         }
         this.DoCapture                = true;
         this.TimeAccumulator          = 0.0f;
         this.PlayerManager.CanControl = false;
         this.PlayerManager.Action     = ActionType.Floating;
         this.PlayerManager.Velocity   = Vector3.Zero;
         this.OriginalCenter           = this.CameraManager.Center;
         this.eRotationDrone.FadeOutAndDie(1.5f);
         this.SoundManager.PlayNewSong(5f);
         SoundEffectExtensions.Emit(this.sWhiteOut).Persistent = true;
     }
 }
Exemplo n.º 31
0
        public FunctionWithoutInvocationsTests(FunctionWithoutInvocationsTestsFixture fixture) : base(fixture)
        {
            if (fixture.FunctionId == null)
            {
                Waiters.WaitForAction(() => Dashboard.Api.IndexingQueueLength(limit: 1) == 0);

                MethodInfo functionInfo = typeof(SingleFunction).GetMethod("Function");
                fixture.FunctionId = fixture.StorageAccount.MethodInfoToFunctionDefinitionId(functionInfo);
            }

            _functionDefinitionId = fixture.FunctionId;
        }