public void Sort(object sender, Comparison <ISpectrum> comparison, SwapHandler swap, IncludeRule irule) { short direction; if (currentSortOrder == SortOrder.Ascending) { currentSortOrder = SortOrder.Descending; direction = -1; } else { currentSortOrder = SortOrder.Ascending; direction = 1; } int left = 1; while (!irule(sender, ((DataGridViewSpectrumRow)Rows[left]).Spectrum)) { if (++left >= RowCount) { break; } } if (left < RowCount) { QuickSort(sender, left, RowCount, comparison, swap, irule, direction); } }
// Use this for initialization void Start() { // dynamic allocate size ParticleSystem ps = GetComponentInChildren <ParticleSystem> (); if (ps) { ps.startSize = distance / 4; } // generate line cast Debug.DrawLine(caster.transform.position, caster.transform.position + transform.forward * distance, Color.green, 2.0f); RaycastHit hitInfo; if (Physics.Raycast(caster.transform.position, transform.forward, out hitInfo, distance, collideLayer)) { Debug.Log("[Spell] Raycast hit"); GameObject gb = hitInfo.transform.gameObject; SwapHandler swapHandler = gb.GetComponent <SwapHandler>(); if (swapHandler) { swapHandler.onSwapHandler(caster); } } }
private void Start() { if (swhandler == null) { swhandler = FindObjectOfType <SwapHandler>(); swhandler.ActivateSwapMode.AddListener(OnSwapActivated); swhandler.DeActivateSwapMode.AddListener(OnSwapDeActivated); } }
public SuiDaoClient( LoginDataGetter loginDataGetter, ILogger <FastTunnelClient> logger, SwapHandler newCustomerHandler, LogHandler logHandler, IConfiguration _configuration, IOptionsMonitor <DefaultClientConfig> configuration) : base(logger, newCustomerHandler, logHandler, configuration) { this.suiDaoLoginData = loginDataGetter; }
private void QuickSort(object sender, int left, int right, Comparison <ISpectrum> comparison, SwapHandler swap, IncludeRule irule, short direction) { if (left < right) { ISpectrum ispectrum; ISpectrum leftspectrum = ((DataGridViewSpectrumRow)Rows[left]).Spectrum; int m = left; for (int i = left + 1; i < right; i++) { if (irule(sender, ispectrum = ((DataGridViewSpectrumRow)Rows[i]).Spectrum)) { //ispectrum = ((DataGridViewSpectrumRow)Rows[i]).Spectrum; if (direction * comparison(ispectrum, leftspectrum) < 0) { m++; while (!irule(sender, ((DataGridViewSpectrumRow)Rows[m]).Spectrum)) { if (++m >= i) { break; } } if (i != m) { SwapRows(m, i); if (swap != null) { swap(m - 1, i - 1); } } } }// else m++; } SwapRows(left, m); if (swap != null) { swap(left - 1, m - 1); } QuickSort(sender, left, m, comparison, swap, irule, direction); m++; if (m < right) { while (!irule(sender, ((DataGridViewSpectrumRow)Rows[m]).Spectrum)) { if (++m >= right) { break; } } QuickSort(sender, m, right, comparison, swap, irule, direction); } } }