/// <summary> /// Draws a play button for the given selection. /// </summary> public static void PlayButton(T timer) { string textureName = timer.isPlaying ? PAUSE_NAME : PLAY_NAME; Texture2D buttonTexture = EditorResourceCache.GetResource <Texture2D>("HydraCommon", "Textures", textureName); if (!GUILayout.Button(buttonTexture, ButtonStyle())) { return; } List <T> timerAndChildren = GetTimerAndChildren(timer); bool playState = GetPlayState(timerAndChildren); for (int index = 0; index < timerAndChildren.Count; index++) { if (playState) { timerAndChildren[index].Pause(); } else { timerAndChildren[index].Play(); } } }
/// <summary> /// Draws the lock field. /// </summary> /// <param name="position">Position.</param> /// <param name="prop">Property.</param> private void LockField(Rect position, SerializedProperty prop) { Texture2D trueTexture = EditorResourceCache.GetResource <Texture2D>("HydraCommon", "Textures", PADLOCK_CLOSED_NAME); Texture2D falseTexture = EditorResourceCache.GetResource <Texture2D>("HydraCommon", "Textures", PADLOCK_OPEN_NAME); HydraEditorUtils.ToggleTexturesField(position, GUIContent.none, prop, trueTexture, falseTexture); }
/// <summary> /// Draws a restart button for the given selection. /// </summary> public static void RestartButton(T timer) { Texture2D buttonTexture = EditorResourceCache.GetResource <Texture2D>("HydraCommon", "Textures", RESTART_NAME); if (!GUILayout.Button(buttonTexture, ButtonStyle())) { return; } List <T> timerAndChildren = GetTimerAndChildren(timer); for (int index = 0; index < timerAndChildren.Count; index++) { timerAndChildren[index].Restart(); } }