void RanderEvent(GEventStyle style) { if (style is GActionStyle) { } if (style is GEffectStyle) { GEffectStyle s = style as GEffectStyle; s.res = EditorGUILayout.TextField("资源名:", s.res); if (style is GEffectSequenceStyle) { GEffectSequenceStyle seq = style as GEffectSequenceStyle; seq.eType = (eEffectSequenceType)EditorGUILayout.EnumPopup("类型:", seq.eType); seq.intervals = drawIntArr("间隔", seq.intervals); } s.locator = drawLocator(s.locator, "开始挂点"); } if (style is GMissileStyle) { GMissileStyle s = style as GMissileStyle; s.res = EditorGUILayout.TextField("资源名:", s.res); if (style is GMissileSequenceStyle) { GMissileSequenceStyle seq = style as GMissileSequenceStyle; seq.eType = (eMissileSequenceType)EditorGUILayout.EnumPopup("类型:", seq.eType); seq.intervals = drawIntArr("间隔", seq.intervals); } } if (style is GTargetStyle) { drawGTargetStyle(style as GTargetStyle); } }
private int DrawTreeTimeline(GPEditor.TimelineWindow.TreeNode node, int level) { if (object.Equals(node, null) || string.IsNullOrEmpty(node.name)) { return(level); } treeIndex2++; EditorGUILayout.BeginHorizontal(); GEvent evt = node.evt; if (evt == curEvent) { GUI.contentColor = Color.green; } else { GUI.contentColor = Color.white; } GEventStyle tStyle = evt.mStyle; FrameRange validRange = evt.GetMaxFrameRange(); FrameRange rang = tStyle.range; float sliderStartFrame = rang.Start; float sliderEndFrame = rang.End; EditorGUI.BeginChangeCheck(); float allW = position.width - 150f; float evtW = allW * (float)validRange.Length / evt.root.Length; float startX = allW * (float)validRange.Start / evt.root.Length; GUILayout.Space(startX); if (GUILayout.Button(tStyle.Attr.name, GUILayout.Width(60f))) { SetSelect(node); } GUILayout.Label(validRange.Start.ToString(), GUILayout.Width(30f)); EditorGUILayout.MinMaxSlider(ref sliderStartFrame, ref sliderEndFrame, validRange.Start, validRange.End, GUILayout.Width(evtW)); GUILayout.Label(validRange.End.ToString(), GUILayout.Width(30f)); if (EditorGUI.EndChangeCheck()) { rang.Start = (int)sliderStartFrame; rang.End = (int)sliderEndFrame; tStyle.range = rang; rootNode.isChange = true; evt.OnStyleChange(); SetSelect(node); } EditorGUILayout.EndHorizontal(); EventType eType = Event.current.type; if (node.Length == 0) { return(level); } for (int i = 0; i < node.childs.Count; i++) { DrawTreeTimeline(node.childs[i], level + 1); } return(level); }
void AddEventMenu(object param) { KeyValuePair <Type, TreeNode> kvp = (KeyValuePair <Type, TreeNode>)param; GEventStyle tl = kvp.Value.obj as GEventStyle; //Undo.RecordObjects(new UnityEngine.Object[] { tl, kvp.Value, this }, "add Event"); GEventStyle s = tl.AddStyle(kvp.Key); kvp.Value.Add(s, s.typeName); kvp.Value.isOpen = true; }
void AddEventMenu(object param) { KeyValuePair <Type, TreeNode> kvp = (KeyValuePair <Type, TreeNode>)param; GEventStyle tl = kvp.Value.style; kvp.Value.isOpen = true; //Undo.RecordObjects(new UnityEngine.Object[] { tl, kvp.Value, this }, "add Event"); GEventStyle newStyle = tl.CreatStyle(kvp.Key); GEvent parent = curTimline.Get(tl); parent.AddChild(newStyle); SetSelect(kvp.Value.Add(newStyle, newStyle.Attr.name)); rootNode.isChange = true; }
void DeleteEvent(object param) { TreeNode node = (TreeNode)param; if (object.Equals(node.parent, null)) { return; } GTimelineStyle tl = node.parent.obj as GTimelineStyle; GEventStyle eS = node.obj as GEventStyle; // Undo.RecordObjects(new UnityEngine.Object[] { tl,node, this }, "delete Event"); tl.styles.Remove(eS); node.parent.childs.Remove(node); }
public static bool RefreshStyle(GEventStyle style, bool b) { for (int i = style.styles.Count - 1; i >= 0; i--) { if (style.styles[i].Attr.Obsolete) { style.styles.RemoveAt(i); b = true; } else { b |= RefreshStyle(style.styles[i], b); } } return(b); }
void DeleteEvent(object param) { TreeNode node = (TreeNode)param; if (object.Equals(node.parent, null)) { return; } GEventStyle tl = node.parent.style; GEvent parent = curTimline.Get(tl); parent.Remove(curEvent); node.parent.childs.Remove(node); SetSelect(node.parent); rootNode.isChange = true; }
void DuplicateMenu(object param) { TreeNode node = (TreeNode)param; if (object.Equals(node.parent, null)) { return; } GEventStyle tl = node.parent.style; GEventStyle clone = (node.style).Clone() as GEventStyle; GEvent parent = curTimline.Get(tl); parent.AddChild(clone); SetSelect(node.parent.AddEventData(clone, 0)); rootNode.isChange = true; }
public TreeNode Add(GTimelineStyle style, int depth) { depth++; if (depth > 10) { Debug.LogError("超出深度上限=10"); return(null); } TreeNode d = Add(style, style.name); d.isOpen = false; for (int i = 0; i < style.styles.Count; i++) { GEventStyle evt = style.styles[i]; d.AddEventData(evt, depth); } return(d); }
public TreeNode AddEventData(GEventStyle data, int depth) { if (data == null) { return(null); } TreeNode node = null; if (data is GPlayTimelineStyle) { string tName = (data as GPlayTimelineStyle).styleRes; if (!object.Equals(this.parent, null) && tName == this.parent.name) { Debug.LogError("错误的名字,timeLineName不能是自己"); return(null); } if (string.IsNullOrEmpty(tName) || !allDic.ContainsKey(tName)) { node = Add(data, data.typeName + "[" + tName + "]"); return(node); } GTimelineStyle ts = allDic[tName]; node = Add(data, data.typeName + "[" + tName + "]"); node.Add(ts, depth); } else { node = Add(data, data.typeName); } for (int i = 0; i < data.styles.Count; i++) { GEventStyle evt = data.styles[i]; node.AddEventData(evt, depth); } return(node); }
public TreeNode AddEventData(GEventStyle data, int depth) { if (data == null) { return(null); } TreeNode node = null; //if (data is GTriggerTimelineStyle) //{ // string tName = (data as GTriggerTimelineStyle).styleRes; // if (!object.Equals(this.parent, null) && tName == this.parent.name) // { // Debug.LogError("错误的名字,timeLineName不能是自己"); // return null; // } // if(string.IsNullOrEmpty(tName) || !allDic.ContainsKey(tName)) // { // node = Add(data, data.Attr.name + "[" + tName + "]"); // return node; // } // GTimelineStyle ts = allDic[tName]; // node = Add(data, data.Attr.name + "[" + tName + "]"); // node.Add(ts, depth); //} //else //{ node = Add(data, data.Attr.name); //} for (int i = 0; i < data.styles.Count; i++) { GEventStyle evt = data.styles[i]; node.AddEventData(evt, depth); } return(node); }
void OnGUI() { if (curEvt == null) { return; } //if (SkillWindow.Inst == null) //{ // this.Close(); // return; //} mScrollPos = EditorGUILayout.BeginScrollView(mScrollPos); EditorGUILayout.BeginVertical(); drawRoot(curEvt.root.lStyle); GEventStyle style = curEvt.mStyle; GUILayout.Label(style.Attr.name + " id:" + curEvt.id); FrameRange rang = style.range; FrameRange validRange = curEvt.GetMaxFrameRange(); if (!(style is GTimelineStyle)) { EditorGUI.BeginChangeCheck(); EditorGUILayout.BeginHorizontal(); GUILayout.Label("Range "); GUILayout.Label("S:", EditorStyles.label); GUI.SetNextControlName(FRAMERANGE_START_FIELD_ID); rang.Start = EditorGUILayout.IntField(style.Start); GUILayout.Label("E:", EditorStyles.label); rang.End = EditorGUILayout.IntField(style.End); EditorGUILayout.EndHorizontal(); EditorGUI.BeginChangeCheck(); EditorGUILayout.BeginHorizontal(); GUILayout.Label("t:" + curEvt.LengthTime + "s", GUILayout.Width(30f)); GUILayout.Space(20f);//EditorGUIUtility.labelWidth GUILayout.Label(validRange.Start.ToString(), GUILayout.Width(30f)); float sliderStartFrame = rang.Start; float sliderEndFrame = rang.End; EditorGUILayout.MinMaxSlider(ref sliderStartFrame, ref sliderEndFrame, validRange.Start, validRange.End); GUILayout.Label(validRange.End.ToString(), GUILayout.Width(30f)); EditorGUILayout.EndHorizontal(); if (EditorGUI.EndChangeCheck()) { rang.Start = (int)sliderStartFrame; rang.End = (int)sliderEndFrame; } rang = FrameRange.Resize(rang, validRange); } else { } if (rang != style.range) { rootNode.isChange = true; } style.range = rang; RanderEvent(style); curEvt.OnStyleChange(); EditorGUILayout.EndVertical(); EditorGUILayout.EndScrollView(); }