private IEnumerator InternalFadeIn() { transitioning = true; RectTransform rect = GetComponent <RectTransform>(); const float kLength = 0.2f; const float kMovement = 100f; for (float time = 0f; time < kLength; time += Time.deltaTime) { float progress = time / kLength; currentGroup.alpha = progress; rect.anchoredPosition = new Vector2( 0f, PanelTransitioner.Damp(-kMovement, 0f, progress)); yield return(null); } currentGroup.alpha = 1f; rect.anchoredPosition = Vector2.zero; transitioning = false; if (defaultSelected != null) { EventSystem.current.SetSelectedGameObject(defaultSelected); } }
protected override void OnClickCard(GameObject o) { EditorContext.Reset(); EditorContext.trackPath = Path.Combine(cardToTrack[o].folder, Paths.kTrackFilename); EditorContext.track = cardToTrack[o].track; PanelTransitioner.TransitionTo(trackSetupPanel, TransitionToPanel.Direction.Right); }
private void OnCreateButtonClick(string title, string artist) { // Attempt to create track directory. Contains timestamp // so collisions are very unlikely. string filteredTitle = Paths.FilterString(title); string filteredArtist = Paths.FilterString(artist); string timestamp = DateTime.Now.ToString("yyyyMMddHHmmss"); string newDir = Path.Combine(Paths.GetTrackFolder(), $"{filteredArtist} - {filteredTitle} - {timestamp}"); try { Directory.CreateDirectory(newDir); } catch (Exception e) { messageDialog.Show($"An error occurred when " + $"creating {newDir}:\n\n{e.Message}"); return; } // Create empty track. Track track = new Track(title, artist); string filename = Path.Combine(newDir, Paths.kTrackFilename); try { track.SaveToFile(filename); } catch (Exception e) { messageDialog.Show($"An error occurred when " + $"writing to {filename}:\n\n{e.Message}"); return; } EditorContext.Reset(); EditorContext.trackPath = filename; EditorContext.track = track; PanelTransitioner.TransitionTo(trackSetupPanel, TransitionToPanel.Direction.Right); }
private IEnumerator InternalFadeOut() { transitioning = true; RectTransform rect = GetComponent <RectTransform>(); const float kLength = 0.2f; const float kMovement = 100f; for (float time = 0f; time < kLength; time += Time.deltaTime) { float progress = time / kLength; currentGroup.alpha = 1f - progress; rect.anchoredPosition = new Vector2( 0f, PanelTransitioner.Damp(0f, -kMovement, progress)); yield return(null); } currentGroup.alpha = 0f; previousGroup.interactable = true; EventSystem.current.SetSelectedGameObject(previousSelected); transitioning = false; gameObject.SetActive(false); }
public virtual void Invoke() { PanelTransitioner.TransitionTo(target, targetAppearsFrom); }
public void ForceTransition() { PanelTransitioner.TransitionTo(target, targetAppearsFrom); }
// Start is called before the first frame update void Start() { instance = this; }
static PanelTransitioner() { instance = null; transitioning = false; }