public override void DrawInspector() { #if UNITY_EDITOR sequence = (DanmakuSequence)EditorGUILayout.ObjectField("Sequence:", sequence, typeof(DanmakuSequence), false); rotationOffset = EditorGUILayout.Vector3Field("Rotation Offset:", rotationOffset); #endif }
public override void OnInspectorGUI() { DanmakuSequence dSequence = (DanmakuSequence)target; for (int i = 0; i < dSequence.sequence.Count; i++) { GUILayout.BeginHorizontal(); if (GUILayout.Button("^", GUILayout.Width(20)) && i != 0) { DanmakuAction da = dSequence.sequence[i - 1]; dSequence.sequence[i - 1] = dSequence.sequence[i]; dSequence.sequence[i] = da; return; } if (GUILayout.Button("v", GUILayout.Width(20)) && i != dSequence.sequence.Count - 1) { DanmakuAction da = dSequence.sequence[i + 1]; dSequence.sequence[i + 1] = dSequence.sequence[i]; dSequence.sequence[i] = da; return; } if (GUILayout.Button("dup", GUILayout.Width(35))) { DanmakuAction da = (DanmakuAction)Activator.CreateInstance(dSequence.sequence[i].GetType()); da.Copy(dSequence.sequence[i]); dSequence.sequence.Insert(i + 1, da); return; } if (GUILayout.Button("X", GUILayout.Width(20))) { dSequence.sequence.RemoveAt(i); return; } GUILayout.Label(dSequence.sequence[i].GetType().Name); GUILayout.EndHorizontal(); dSequence.sequence[i].DrawInspector(); GUILayout.Space(20); DrawUILine(Color.white); } if (GUILayout.Button("+", GUILayout.Width(30))) { GenericMenu menu = new GenericMenu(); foreach (string t in actionTypes.Keys) { string destination = t.Replace('.', '/'); menu.AddItem(new GUIContent(destination), true, OnActionSelected, t); } menu.ShowAsContext(); } if (GUI.changed) { EditorUtility.SetDirty(dSequence); } }
public DanmakuSequenceInfo(DanmakuSequence sequence, DanmakuConfig baseConfig, EntityTeams team, HitInfo hitInfo, string id = "") { this.sequence = sequence; this.baseConfig = baseConfig; this.id = id; this.team = team; this.hitInfo = hitInfo; }
private void OnActionSelected(object t) { DanmakuSequence dSequence = (DanmakuSequence)target; dSequence.sequence.Add((DanmakuAction)Activator.CreateInstance(actionTypes[(string)t])); }
public virtual void Fire(DanmakuSequence sequence, DanmakuConfig config, EntityTeams team, HitInfo hitInfo, string id = "") { sequences.Add(new DanmakuSequenceInfo(sequence, config, team, hitInfo, id)); }