コード例 #1
0
        private void CreateClipView(Type clipType)
        {
            ClipModel clipModel = ReflectionHelper.CreateInstance(clipType) as ClipModel;

            clipModel.SetStart(0);
            clipModel.SetEnd(1);
            AddClip(clipModel);
        }
コード例 #2
0
        public override void OnInspectorGUI()
        {
            if (!ContextDataCache.TryGetContextData <GUIStyle>("BigLabel", out var bigLabel))
            {
                bigLabel.value              = new GUIStyle(GUI.skin.label);
                bigLabel.value.fontSize     = 18;
                bigLabel.value.fontStyle    = FontStyle.Bold;
                bigLabel.value.alignment    = TextAnchor.MiddleLeft;
                bigLabel.value.stretchWidth = true;
            }

            ClipModel clipModel = Target as ClipModel;

            GUILayoutExtension.VerticalGroup(() =>
            {
                GUILayout.Label("Clip:" + clipModel.TitleName, bigLabel.value);
            });

            float tStart = EditorGUILayout.FloatField("Start", clipModel.StartTime);

            if (tStart != clipModel.StartTime)
            {
                clipModel.SetStart((float)tStart);
            }

            float tEnd = EditorGUILayout.FloatField("End", clipModel.EndTime);

            if (tEnd != clipModel.EndTime)
            {
                clipModel.SetEnd((float)tEnd);
            }

            EditorGUI.BeginDisabledGroup(true);
            EditorGUILayout.FloatField("Duration", clipModel.DurationTime);
            EditorGUI.EndDisabledGroup();

            foreach (var field in Fields)
            {
                if (field.Name == "StartTime" || field.Name == "EndTime" || field.Name == "DurationTime")
                {
                    continue;
                }
                DrawFields(field);
            }
        }