Example #1
0
        public void ReloadWeapon()
        {
            if (!inReload)
            {
                inReload = true;
                onReload.Invoke(this);

                if (enableAmmunitionStock && enableMagazine && magazineType == MagazineType.Unit)
                {
                    float reloadValue = magazineCapacity - magazineValue;

                    if (ammunitionCurrentStock >= reloadValue)
                    {
                        ammunitionCurrentStock -= reloadValue;
                        StartCoroutine(WaitReload(magazineCapacity));
                    }
                    else
                    {
                        reloadValue            = ammunitionCurrentStock;
                        ammunitionCurrentStock = 0;
                        StartCoroutine(WaitReload(reloadValue + magazineValue));
                    }
                }
                else
                {
                    StartCoroutine(WaitReload(magazineCapacity));
                }
            }
            ;
        }
Example #2
0
        public void Reload()
        {
            while (true)
            {
                if (Magazines <= 0)
                {
                    if (photonView.IsMine)
                    {
                        Notification.ErrorMessage("No more magazines!");
                    }
                    return;
                }

                // Raise animation trigger
                if (!_isReloading)
                {
                    _isReloading = true;
                    Owner.GetComponent <Animator>().SetTrigger(ReloadAnimationTrigger);
                    continue;
                }

                _isReloading = false;

                // Called during animation
                if (photonView.IsMine)
                {
                    Magazines        -= 1;
                    BulletsInMagazine = BulletsPerMagazine;
                    OnReload?.Invoke(BulletsInMagazine, Magazines);
                }

                break;
            }
        }
Example #3
0
        private void TryReload(float elapsedTime)
        {
            if (reloadLeft <= 0)
            {
                IsReloading = false;
                return;
            }

            IsReloading = true;
            reloadLeft -= elapsedTime;
            if (reloadLeft > 0)
            {
                return;
            }
            int toMove;

            if (ammoReserves >= 0)
            {
                toMove = Math.Min(clipSize - currentlyInClip, ammoReserves);
            }
            else
            {
                toMove = clipSize - currentlyInClip;
            }

            if (ammoReserves >= 0)
            {
                ammoReserves -= toMove;
            }

            currentlyInClip += toMove;
            OnReload?.Invoke(this);
        }
Example #4
0
 private void toolStripButtonReload_Click(object sender, EventArgs e)
 {
     OnReload?.Invoke(this, new ReloadEventArgs()
     {
         Text = Code
     });
     Edited = false;
 }
        public void Reload()
        {
            Cache.Clear();
            Patches.Clear();

            _yamlPatchLoader.Load();
            OnReload?.Invoke();
        }
Example #6
0
    private void OnExitButtonClicked_ReloadScene()
    {
        ballBehaviour.RestartBall();
        ReloadBlocks();
        isReadyToReload = false;

        OnReload?.Invoke();
    }
Example #7
0
 public void Reload()
 {
     if (!isReloading && projectilesRemaningInMag != projectilesPerMag)
     {
         StartCoroutine(AnimateReload());
         AudioManager.instance.PlaySound(reloadAudio, transform.position);
         OnReload?.Invoke();
     }
 }
Example #8
0
        private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            try
            {
                Angajati newAngajat = new Angajati
                {
                    Nume          = txtNume.Text,
                    CodFunctie    = Int32.Parse(txtFunctie.Text),
                    CodSucursala  = Int32.Parse(txtSucursala.Text),
                    CodSalariu    = Int32.Parse(txtSalariu.Text),
                    Telefon       = txtTelefon.Text,
                    DataAngajarii = dataAngajarePicker.SelectedDate.GetValueOrDefault()
                };

                VerifyInput(newAngajat, txtPassword.Password);

                string pass  = txtPassword.Password;
                byte[] array = Encoding.ASCII.GetBytes(pass);

                HashAlgorithm sha            = SHA256.Create();
                byte[]        HashedPassword = sha.ComputeHash(array);


                var context = new BancaEntities();


                context.Angajatis.Add(newAngajat);
                context.SaveChanges();

                //vad ce IdAngajat are cel nou creat
                var idNewAngajat = (context.Angajatis.Where(s => s.Nume.ToString() == txtNume.Text).SingleOrDefault()).CodAngajat;



                //ii pun in UtilizatoriAngajati, Id-ul si parola asociata
                var NewUser = new UtilizatoriAngajati()
                {
                    // password = HashedPassword,
                    angajatID = idNewAngajat,
                    createdOn = dataAngajarePicker.SelectedDate.GetValueOrDefault()
                };

                context.UtilizatoriAngajatis.Add(NewUser);
                context.SaveChanges();

                MessageBox.Show("Ati fost adaugat cu succes\nAveti codul unic: ", idNewAngajat.ToString());

                MyWindow = new HomeWindow(newAngajat);
                Hide();
                MyWindow.Show();
            }
            catch (System.Data.Entity.Infrastructure.DbUpdateException sqlEx)
            {
                MessageBox.Show(GetCorrectError(sqlEx), "Error!");
                OnReload?.Invoke();
            }
        }
Example #9
0
 public virtual void Reload()
 {
     if (RuntimeValues.ReloadTime > 0 ||
         RuntimeValues.ShotAmmo <= 0)
     {
         return;
     }
     OnReload?.Invoke(this);
 }
Example #10
0
 private void _scintilla_KeyDown(object sender, KeyEventArgs e)
 {
     System.Diagnostics.Debug.WriteLine(e.KeyCode);
     if (e.Control && e.KeyCode == Keys.S)
     {
         OnReload?.Invoke(this, new ReloadEventArgs()
         {
             Text = Code
         });
     }
 }
Example #11
0
        private async void ReloadAsync(int seconds)
        {
            for (var i = 0; i < 100; i++)
            {
                if (breakReload)
                {
                    return;
                }
                await Task.Delay(seconds * 10);

                OnReload?.Invoke(i);
            }
            canActivate = true;
        }
Example #12
0
        public static void ReloadRules(Rule r)
        {
            var res = ReloadRules(r.Query);

            if (res)
            {
                r.Complete();
                OnReload?.Invoke();
            }
            else
            {
                r.Error(new Exception("ReloadRules.Fail"));
            }
        }
Example #13
0
 public void AskForSave()
 {
     if (Edited)
     {
         var result = MessageBox.Show(this, "Python code changed. Do you want to save?", "Code changed",
                                      MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (result == DialogResult.Yes)
         {
             OnReload?.Invoke(this, new ReloadEventArgs()
             {
                 Text = Code
             });
         }
     }
 }
Example #14
0
        private void Init()
        {
            controls = new Controls();
            controls.Enable();

            controls.Player.CrouchSwitch.performed += ctx => onCrouchSwitch?.Invoke();
            controls.Player.Action.performed       += ctx => onAction?.Invoke();
            controls.Player.SwitchCamera.performed += ctx => onSwitchCamera?.Invoke();
            controls.Player.Reload.performed       += ctx => onReload?.Invoke();
            controls.Player.Kick.performed         += ctx => onKick?.Invoke();
            controls.UI.Cheats.performed           += ctx => onCheats?.Invoke();
            controls.UI.Pause.performed            += ctx => onPause?.Invoke();
            controls.UI.Hide.performed             += ctx => onHide?.Invoke();

            Load();
        }
Example #15
0
        /// <summary>
        /// Start reloading.
        /// </summary>
        public virtual void Reload()
        {
            if (ammo >= maxAmmo || reservedAmmo <= 0)
            {
                return;
            }

            nextFire  = Time.time + reloadTime;
            reloading = true;
            reloadSound.Play();
            reservedAmmo += ammo;
            int intermediateAmmo = reservedAmmo > maxAmmo ? maxAmmo : reservedAmmo;

            reservedAmmo -= intermediateAmmo;
            ammo          = intermediateAmmo;
            onReload?.Invoke();
        }
Example #16
0
 void Reload()
 {
     OutSignal           = curFilter.GenerateOutput(curSignal, maxLength);
     InputSignalAsArray  = curSignal.ToDoubleArray(maxLength);
     OutputSignalAsArray = OutSignal.ToDoubleArray(maxLength);
     if (IsPowerOf2(maxLength))
     {
         InputSignalFTAsArray  = FastFourierTransform.Transform(InputSignalAsArray).Select(x => x.R).ToArray();
         OutputSignalFTAsArray = FastFourierTransform.Transform(OutputSignalAsArray).Select(x => x.R).ToArray();
     }
     else
     {
         InputSignalFTAsArray  = new double[] { 0 };
         OutputSignalFTAsArray = new double[] { 0 };
     }
     OnReload?.Invoke(this, null);
 }
Example #17
0
 private async Task CreatePenjualanAsync()
 {
     try
     {
         dbo.Penjualans.Add(ModelPenjualan);
         dbo.SaveChanges();
         MessageBox.Show("Berhasil menambahkan data");
         ModelPenjualan = new Penjualan();
         OnReload?.Invoke();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Gagal menambahkan data");
     }
     finally
     {
         await ReadPenjualanAsync();
     }
 }
Example #18
0
        public virtual void Reload()
        {
            //Don't reload more than we need to
            //(p.s in some other systems you throw out your whole magazine, so that'd be implemented somehow else lmao)
            int amountToReaload = MagazineSize - CurrentAmmoCount;

            if (TotalAmmoCount >= amountToReaload)
            {
                TotalAmmoCount  -= amountToReaload;
                CurrentAmmoCount = MagazineSize;
            }
            else
            {
                CurrentAmmoCount += TotalAmmoCount;
                TotalAmmoCount    = 0;
            }

            OnReload?.Invoke();
        }
Example #19
0
 private async Task CreateBarangAsync()
 {
     try
     {
         dbo.Barangs.Add(ModelBarang);
         dbo.SaveChanges();
         MessageBox.Show("Berhasil menambahkan data");
         ModelBarang = new Barang();
         OnReload?.Invoke();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Gagal menambahkan data");
     }
     finally
     {
         await ReadBarangAsync();
     }
 }
Example #20
0
        public static void Reload()
        {
            if (CurrentStyle == null)
            {
                return;
            }

            CurrentStyle.ClearCache();
            for (int i = themeItems.Count - 1; i >= 0; i--)
            {
                StyleItem       styleItem = themeItems[i];
                StyleItemLine[] theme     = CurrentStyle.GetApplicableBody(styleItem.Selectors);
                foreach (StyleItemLine styleItemLine in theme)
                {
                    styleItem.Apply(styleItemLine);
                }
            }

            OnReload?.Invoke();
        }
 public void Reload()
 {
     OnReload?.Invoke();
     ReloadCount++;
 }
Example #22
0
 private void ChangeToNormal()
 {
     OnReload?.Invoke();
 }
 protected virtual void DispatchOnReload() => OnReload?.Invoke();