void FrequencyJumps(ref FrequencyData data) { foldoutOpen = EditorGUILayout.Foldout(foldoutOpen, new GUIContent("Frequency Jumpers " + data.jumps.Length, "These jump the frequency up or down.")); if (effect.frequencyManualCurve) { foldoutOpen = false; } if (foldoutOpen) { EditorGUI.indentLevel++; int count = EditorGUILayout.IntField(new GUIContent("Jumper Count"), data.jumps.Length); if (count != data.jumps.Length) { if (count < 0) { count = 0; } FrequencyJump[] temp = new FrequencyJump[count]; for (int iii = 0; iii < data.jumps.Length || iii < count; iii++) { if (iii < data.jumps.Length && iii < count) { temp[iii] = data.jumps[iii]; } else if (iii < temp.Length) { temp[iii] = new FrequencyJump(); } } data.jumps = temp; } while (subFolds.Count != count) { if (subFolds.Count < count) { subFolds.Add(true); } else { subFolds.RemoveAt(subFolds.Count - 1); } } for (int iii = 0; iii < data.jumps.Length; iii++) { subFolds[iii] = EditorGUILayout.Foldout(subFolds[iii], new GUIContent("Jumper " + iii.ToString())); if (subFolds[iii]) { FrequencyJumpField(ref data.jumps[iii], ref data, iii); EditorGUILayout.Separator(); } } EditorGUI.indentLevel--; } }
public FrequencyEditor(SounderEffect e) { effect = e; data = effect.FrequencyData; if (e.FrequencyData.jumps.Length < 1) { foldoutOpen = false; } }
public void Copy(FrequencyData other) { range = new Range(other.range.min, other.range.max); frequency = other.frequency; delta = other.delta; deltaAccel = other.deltaAccel; jumps = new FrequencyJump[other.jumps.Length]; for (int iii = 0; iii < jumps.Length; iii++) { jumps[iii] = new FrequencyJump(other.jumps[iii]); } curveType = other.curveType; }
void FrequencyJumpField(ref FrequencyJump jump, ref FrequencyData data, int index) { string saveHash = AssetDatabase.GetAssetPath(effect).GetHashCode().ToString(); EditorGUI.indentLevel++; jump.start = EditorGUILayout.Slider(new GUIContent("Start Time", "Time the jumper starts. In Seconds."), jump.start, .0f, 1.0f); GUIHelpers.RangedSlider(ref jump.value, 1000.0f, "Jump " + index.ToString() + " Value", "How much the frequency changes. In Hertz.", saveHash, false); jump.repeatTime = EditorGUILayout.Slider(new GUIContent("Repeat Time", "Time to wait before each repeat. In Seconds."), jump.repeatTime, -.0f, 1.0f); jump.repeats = EditorGUILayout.IntSlider(new GUIContent("Jump Repeats", "How many times to repeat the jump. If negative repeats until the sound ends."), jump.repeats, -1, 25); EditorGUI.indentLevel--; }
public FrequencyData(FrequencyData o) { Copy(o); }