Ejemplo n.º 1
0
        public virtual void DrawGUISetting_Tracks(float playTime)
        {
            using (new GUILayoutBeginVerticalScope(EditorStyles.helpBox))
            {
                using (new GUILayoutBeginScrollViewScope(ref scrollPosition))
                {
                    for (int i = 0; i < tracks.Length; i++)
                    {
                        TimelinableTrackBase track = tracks[i];
                        using (new GUILayoutToggleAreaScope(track.toggleTween,
                                                            string.Format("track[{0}]:{1}", i, track.name), () =>
                        {
                            using (new GUIEnabledScope(track.IsCanAddItemInfo()))
                            {
                                if (GUILayout.Button("addItemInfo", GUILayout.Width(80)))
                                {
                                    var toAddItemInfoType = this.GetFieldInfo("_tracks").FieldType
                                                            .GetElementType()
                                                            .GetFieldInfo("_itemInfoes").FieldType.GetElementType();
                                    var toAddItemInfo =
                                        toAddItemInfoType.CreateInstance <TimelinableItemInfoBase>();
                                    toAddItemInfo.time = track.curTime;
                                    track.AddItemInfo(toAddItemInfo);
                                }
                            }

                            if (GUILayout.Button("+", GUILayout.Width(32)))
                            {
                                var cloneTrack = tracks.GetType().GetElementType()
                                                 .CreateInstance <TimelinableTrackBase>();
                                cloneTrack.CopyFrom(track);
                                AddTrack(cloneTrack);
                            }

                            if (tracks.Length != 1 || i != 0)
                            {
                                if (GUILayout.Button("-", GUILayout.Width(32)))
                                {
                                    RemoveTrack(track);
                                }
                            }
                        }))
                        {
                            track.DrawGUISetting();
                        }

                        Array.Sort(track.itemInfoes);
                        track.Retime(playTime);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public virtual void DrawGUISetting(TimelinableTrackBase track)
        {
            string title = string.Format("{0}[{1}]<color=red>{2}</color>",
                                         name, track.itemInfoes.IndexOf(this), isSelected ? "*选中" : "");

            using (new GUILayoutToggleAreaScope(toggleTween, title, () =>
            {
                using (new GUIEnabledScope(track.itemInfoLibrary != null && track.IsItemInfoCanAddToLibrary()))
                {
                    if (GUILayout.Button("addToLibrary", GUILayout.Width(100)))
                    {
                        var toAddItemInfo = GetType().CreateInstance <TimelinableItemInfoBase>();
                        toAddItemInfo.CopyFrom(this);
                        track.itemInfoLibrary.AddItemInfo(toAddItemInfo);
                    }
                }

                if (GUILayout.Button("add", GUILayout.Width(64)))
                {
                    var toAddItemInfo = GetType().CreateInstance <TimelinableItemInfoBase>();
                    toAddItemInfo.CopyFrom(this);
                    toAddItemInfo.time = track.curTime;
                    track.AddItemInfo(toAddItemInfo);
                }

                if (GUILayout.Button("delete", GUILayout.Width(64)))
                {
                    isSelected = false;
                    track.RemoveItemInfo(this);
                }
            }))
            {
                name     = EditorGUILayout.TextField("itemInfo_name", name);
                time     = EditorGUILayout.FloatField("time", time).Minimum(0);
                duration = EditorGUILayout.FloatField("duration", duration).Minimum(0);

                DrawGUISetting_Detail();
            }
        }