Esempio n. 1
0
        private void btnCreateAuthor_Click(object sender, EventArgs e)
        {
            var authorDetails = new AuthorCreate(_client);

            if (authorDetails.ShowDialog(this) == DialogResult.OK)
            {
                if (!SetControl(_authorListControl)) // authors list is active already
                {
                    _currentControl.Reload();
                }
            }
        }
Esempio n. 2
0
        public static PropertyAccessor Access(IReloadable target)
        {
            target.Reload(accessor);

            // Returning the accessor directly allows targets to also retrieve any non-reloadable values.
            return(accessor);
        }
Esempio n. 3
0
        /// <summary>
        /// call in every frame of update
        /// </summary>
        public void UpdateControls()
        {
            if (Input.GetButton("Fire1"))
            {
                shootable?.Attack();
            }

            if (Input.GetButton("Fire2"))
            {
                gunHolder.localRotation = Quaternion.identity;
                if (currentEquippedWeaponIndex >= 0)
                {
                    weapons[currentEquippedWeaponIndex].transform.parent        = aimPosition;
                    weapons[currentEquippedWeaponIndex].transform.localRotation = Quaternion.identity;
                }
                aimable?.Aim();
            }
            else
            {
                if (cam != null)
                {
                    PointGunAtTarget();
                }
                if (currentEquippedWeaponIndex >= 0)
                {
                    weapons[currentEquippedWeaponIndex].transform.parent = gunHolder;
                }
                aimable?.StopAiming();
            }
            weapons[currentEquippedWeaponIndex].transform.localPosition = Vector3.Lerp(weapons[currentEquippedWeaponIndex].transform.localPosition, Vector3.zero, Time.deltaTime * 10);
            if (Input.GetKey(KeyCode.Space))
            {
                melee?.Attack();
            }
            if (Input.GetKey(KeyCode.R))
            {
                reloadable?.Reload();
            }

            if (weapons.Length == 0)
            {
                return;
            }
            if (Input.GetKey(KeyCode.Alpha1))
            {
                EquipWeapon(0);
            }
            if (Input.GetKey(KeyCode.Alpha2))
            {
                EquipWeapon(1);
            }
            if (Input.GetKey(KeyCode.Alpha3))
            {
                EquipWeapon(2);
            }
            if (Input.GetKey(KeyCode.Alpha4))
            {
                EquipWeapon(3);
            }
        }
Esempio n. 4
0
    void Update()
    {
        if (fireKey.KeyActive())
        {
            if (fireMech != null && ammoSys != null)
            {
                FireWeapon();
                FpsEvents.FpsUpdateHud();
            }
        }

        if (reloadKey.KeyActive())
        {
            if (reloadable != null)
            {
                reloadable.Reload();
                FpsEvents.FpsUpdateHud();
            }
        }

        if (scopeKey.KeyActive())
        {
            if (scope != null)
            {
                scope.Scope();
                FpsEvents.FpsUpdateHud();
            }
        }
    }
Esempio n. 5
0
 public void Reload()
 {
     if (_reloadableWeapon != null && _reloadableWeapon.Reload())
     {
         OnReloadWeapon.Invoke();
     }
 }
Esempio n. 6
0
        /// <summary>
        /// 刷新数据
        /// </summary>
        /// <param name="table">公共数据容器</param>
        /// <returns>是否刷新成功</returns>
        public override bool ReloadData(System.Collections.Hashtable table)
        {
            if (this.data != null)
            {
                if (this.data is IReloadable)
                {
                    IReloadable obj         = this.Data as IReloadable;
                    string      forceReload = table["forceReload"] as string;

                    if (forceReload == null || forceReload == "0") // 检查是否需要强制刷新
                    {
                        obj.Reload();
                        this.Text = obj.ToString();

                        if (obj.RequestEdit()) // 检查是否需要重新编辑
                        {
                            string requestReloadID = table["requestReloadID"] as string;

                            if (string.IsNullOrEmpty(requestReloadID))
                            {
                                requestReloadID = this.id.ToString();
                            }
                            else
                            {
                                requestReloadID += string.Format(",{0}", this.id.ToString());
                            }

                            table["requestReloadID"] = requestReloadID;
                        }
                    }
                    else
                    {
                        obj.ForceReload();
                        this.Text = obj.ToString();
                    }
                }
                else if (dataType == "AILine") // 连接线的显示需要单独刷一下
                {
                    string displayText = this.data as string;
                    int    index       = displayText.IndexOf(":");

                    if (index != -1)
                    {
                        this.text = displayText.Substring(index + 1);
                    }
                }
            }

            // 刷新Tip文本
            if (this.data is IFullTextConvertable)
            {
                this.TooltipText = (this.data as IFullTextConvertable).ToFullText();
            }

            return(true);
        }
Esempio n. 7
0
        public static PropertyAccessor Access(IReloadable target = null)
        {
            if (target != null && !target.Reload(accessor, out var message))
            {
                // By triggering a failure here, bad properties will be detected on object creation (rather than only
                // on reload via the terminal).
                Debug.Fail(message);
            }

            return(accessor);
        }
Esempio n. 8
0
 private async Task LoadSafe()
 {
     try
     {
         await _instance.Reload(_token).ConfigureAwait(false);
     }
     catch (OperationCanceledException)
     {
         throw;
     }
     catch (Exception e)
     {
         _logger.ErrorFormat($"(MAJOR)({_cacheName}) reload error.", e);
     }
 }
Esempio n. 9
0
        private void localizeFile_Click(object sender, EventArgs e)
        {
            ProcessStartInfo start = new ProcessStartInfo();
            string           generateLocPythonFile = Application.StartupPath + "/scripts/generate_loc_keys.py";

            start.FileName = generateLocPythonFile;
            string filePath = mFileData.Path;
            string modName  = ModuleDataManager.GetInstance().TryReplaceModsDirectory(mFileData.Path, "", "");

            modName = ModuleDataManager.GetInstance().TryReplaceSteamUploadsDirectory(modName, "", "");
            modName = modName.Split('/')[1];
            string modsRoot = ModuleDataManager.GetInstance().GetParentDirectoryByModName(modName);

            start.Arguments = string.Format("-r {0} {1}", modsRoot, filePath);
            ////MessageBox.Show("executing command: " + generateLocPythonFile + " -r " + modsRoot + " " + filePath);

            Process myProcess = Process.Start(start);

            if (myProcess == null)
            {
                MessageBox.Show("Could not launch generate_loc_keys.py");
                return;
            }

            myProcess.WaitForExit();

            if (myProcess.ExitCode != 0)
            {
                if (myProcess.ExitCode == 777)
                {
                    MessageBox.Show(string.Format("Error running generate_loc_keys.py - your en.json has an invalid format.\n\nExit code: {0}", myProcess.ExitCode.ToString()), "Error: Invalid localization JSON Format");
                }
                else
                {
                    MessageBox.Show(string.Format("Error running generate_loc_keys.py.\n\nExit code: {0}", myProcess.ExitCode.ToString()), "Error");
                }
            }

            if (mOwner != null)
            {
                mOwner.Reload();
            }
        }
Esempio n. 10
0
        private void localizeFile_Click(object sender, EventArgs e)
        {
            ProcessStartInfo start = new ProcessStartInfo();
            string           generateLocPythonFile = System.IO.Path.GetDirectoryName(Application.ExecutablePath) + "/scripts/generate_loc_keys.py";

            start.FileName = generateLocPythonFile;
            string filePath = mFileData.Path;
            string modsRoot = ModuleDataManager.GetInstance().ModsDirectoryPath;

            start.Arguments = string.Format("-r {0} {1}", modsRoot, filePath);
            ////MessageBox.Show("executing command: " + generateLocPythonFile + " -r " + modsRoot + " " + filePath);

            Process myProcess = Process.Start(start);

            myProcess.WaitForExit();
            if (mOwner != null)
            {
                mOwner.Reload();
            }
        }
Esempio n. 11
0
    public override void Do()
    {
        if (!isReady)
        {
            Debug.Log("Skill is still on cooldown " + timer);
            return;
        }
        Dictionary <HexTile, Tower> towers = TowerManager.Instance.GetTowers();

        //Debug.Log("Reloaded");
        foreach (var tower in towers.Values)
        {
            IReloadable reloadable = tower as IReloadable;
            if (reloadable != null)
            {
                reloadable.Reload();
            }
        }
        isReady = false;
        timer   = cooldown;
    }
Esempio n. 12
0
    public void ReloadAll()
    {
        Debug.Log("Attempting to reload all; " + reloadableObjects.Count);
        foreach (GameObject reloadableObject in reloadableObjects)
        {
            Debug.Log("Reloading: " + reloadableObject.name);
            //Debug.Log("IReloadable is: " + reloadableObject.GetComponent("IReloadable").name);
            //reloadableObject.GetComponent<IReloadable>().Reload();

            MonoBehaviour[] list = reloadableObject.GetComponents <MonoBehaviour>();
            foreach (MonoBehaviour mb in list)
            {
                Debug.Log("MonoBehaviour found: " + mb);
                if (mb is IReloadable)
                {
                    Debug.Log("IReloadable of: " + mb);
                    IReloadable ir = mb as IReloadable;
                    //reloadableObject.GetComponent<IReloadable>().Reload();
                    ir.Reload();
                }
            }
        }
    }
Esempio n. 13
0
    void Update()
    {
        if (drawKey.KeyActive())
        {
            Debug.Log("Drawing");
            if (drawRelease != null)
            {
                if (fireMech.PeekCooled())
                {
                    drawRelease.Draw();
                }
            }
        }

        if (releaseKey.KeyActive())
        {
            if (drawRelease.Drawn())
            {
                if (fireMech != null && ammoSys != null && drawRelease != null)
                {
                    FireWeapon();
                    FpsEvents.FpsUpdateHud();
                }
            }
            drawRelease.Release();
        }

        if (reloadKey.KeyActive())
        {
            if (reloadable != null)
            {
                reloadable.Reload();
                FpsEvents.FpsUpdateHud();
            }
        }
    }
Esempio n. 14
0
 public void PerformAction() => Obj.Reload();
Esempio n. 15
0
        private void DoReload()
        {
            IReloadable action = tvProjects.SelectedNode.Tag as IReloadable;

            action.Reload();
        }
Esempio n. 16
0
 private void btnReload_Click(Object sender, EventArgs e)
 {
     _currentControl?.Reload();
 }
Esempio n. 17
0
    private void ExecuteReload()
    {
        IReloadable reloadable = GetComponent <IReloadable>();

        reloadable?.Reload();
    }