Esempio n. 1
0
//----------------------------------------------------------------------------------------------------------------------
        private static bool DrawPlaybackMode(SceneCachePlayer t)
        {
            t.ShowPlaybackInInspector(EditorGUILayout.Foldout(t.IsPlaybackInInspectorShown(), "Playback", true, GetDefaultFoldoutStyle()));
            if (!t.IsPlaybackInInspectorShown())
            {
                return(false);
            }

            bool changed = false;

            changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "SceneCache: Playback Mode",
                                                              guiFunc: () =>
                                                              (SceneCachePlaybackMode)EditorGUILayout.EnumPopup("Playback Mode", t.GetPlaybackMode()),
                                                              updateFunc: (SceneCachePlaybackMode mode) => {
                t.SetPlaybackMode(mode);
                SceneCachePlayerEditorUtility.RefreshSceneCache(t);
            }
                                                              );

            ++EditorGUI.indentLevel;
            changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "SceneCache: Time",
                                                              guiFunc: () => (EditorGUILayout.FloatField("Time", t.GetTime())),
                                                              updateFunc: (float time) => { t.SetTime(Mathf.Max(0, time)); });

            using (new EditorGUI.DisabledScope(t.GetPlaybackMode() == SceneCachePlaybackMode.Interpolate)) {
                changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "SceneCache: Frame",
                                                                  guiFunc: () => (EditorGUILayout.IntField("Frame", t.GetFrame())),
                                                                  updateFunc: (int frame) => { t.SetTimeByFrame(Mathf.Max(0, frame)); });
            }
            --EditorGUI.indentLevel;

            using (new EditorGUI.DisabledScope(t.GetPlaybackMode() == SceneCachePlaybackMode.Interpolate)) {
                changed |= SceneCachePlayerEditorUtility.DrawLimitedAnimationGUI(t.GetLimitedAnimationController(), t, t);
            }

            EditorGUILayout.Space();

            return(changed);
        }