/*+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= * TOOLBAR *+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=*/ void DrawToolBar() { GUIStyle b = new GUIStyle(GUI.skin.button); GUILayout.BeginArea(toolbarSection); GUILayout.BeginHorizontal(); // Create Simple Ball ChangeColor(Color.green); if (GUILayout.Button("+ Simple Ball", b, GUILayout.Width(100))) { BallData new_ball = SongEdit.CreateBall(typeof(SimpleBallData)); ballList.Add(new_ball); } ResetColor(); // Sort Balls ChangeColor(new Color(0.909f, 0.635f, 0.066f)); if (GUILayout.Button("Sort Balls", b, GUILayout.Width(80))) { game.SortBalls(); } ResetColor(); // Sort Notes ChangeColor(new Color(0.717f, 0.262f, 0.937f)); if (GUILayout.Button("Sort Notes", b, GUILayout.Width(80))) { game.SortNotes(); } ResetColor(); GUILayout.EndHorizontal(); GUILayout.EndArea(); }
void DrawBallDataList(Color color) { ballList = game.GetBallData(); GUIStyle s = new GUIStyle(GUI.skin.button); GUIStyle b = new GUIStyle(GUI.skin.button); s.alignment = TextAnchor.MiddleLeft; b.alignment = TextAnchor.MiddleCenter; var w = GUILayout.Width(100); var line_h = GUILayout.Height(20); float yPos = 0; List <BallLabel> labels = new List <BallLabel>(); newBalls.Clear(); deleteBalls.Clear(); typeChangeBalls.Clear(); //Ball Field foreach (BallData ball in ballList) { BallLabel ballLabel = new BallLabel(ball, yPos); if (isLabelVisible(ballLabel)) { DrawUILine(dividerLineColor); EditorGUILayout.BeginHorizontal(); yPos += ballLabel.height; //________Create New Ball___________________ ResetColor(); ChangeColor(Color.green); if (GUILayout.Button("+", b, GUILayout.Width(25), line_h)) { newBalls.Add(ball, ballList.IndexOf(ball)); } ResetColor(); //________Delete Ball___________________ ChangeColor(Color.red); if (GUILayout.Button("-", b, GUILayout.Width(25), line_h)) { deleteBalls.Add(ball); } ResetColor(); //________Refresh Ball___________________ ChangeColor(Color.yellow); if (GUILayout.Button("R", b, GUILayout.Width(25), line_h)) { //SongData.DeleteBall(ball); BallData repairedBall; if (ball.GetType() == typeof(SimpleBallData)) { repairedBall = SongEdit.CreateBall(typeof(SimpleBallData), ball.notes); } else { Debug.Log("its a bounce ball"); repairedBall = SongEdit.CreateBall(typeof(BounceBallData), ball.notes); } ballList.Add(repairedBall); SongEdit.DeleteBallAndNotes(ball); ballList.Remove(ball); game.SortBalls(); } ResetColor(); //________Ball Type___________________ GUILayout.Label("type:", GUILayout.Width(40), line_h); BallTypes ball_type = (BallTypes)EditorGUILayout.EnumPopup("", ball.type, s, w); if (ball_type != ball.type) { ball.type = ball_type; // if new type selected, set equal to type typeChangeBalls.Add(ball, ballList.IndexOf(ball)); EditorUtility.SetDirty(ball); } //________Enabled / Disabled Field___________________ //ball.enabled = GUILayout.Toggle(ball.enabled, "Enabled", s, w); if (Application.isPlaying) { float timeDiff = ball.notes[0].hitBeat - songController.GetSongTimeBeats(); if (Mathf.Abs(timeDiff) < 4.0f && timeDiff > 0.0f) { ChangeColor(Color.cyan); } else if (Mathf.Abs(timeDiff) < 2.0f) { ChangeColor(Color.yellow); } EditorGUILayout.ObjectField(ball, typeof(Object), true); ResetColor(); } EditorGUILayout.EndHorizontal(); DrawOptions(ball); if (ball.notes != null) { int numNotes = DrawNotes(ball); } } else { GUILayout.Space(60); yPos += 60; } } // --------- END BALL ITERATION -------------------------- foreach (KeyValuePair <BallData, int> pair in newBalls) { BallData new_ball = SongEdit.CreateBall(typeof(SimpleBallData)); ballList.Insert(pair.Value + 1, new_ball); } foreach (BallData ball in deleteBalls) { SongEdit.DeleteBallAndNotes(ball); ballList.Remove(ball); } foreach (KeyValuePair <BallData, int> pair in typeChangeBalls) { BallData ball = pair.Key; BallData new_ball = SongEdit.ChangeBallType(ball, ball.type); // create new ball and copy info ballList.Insert(pair.Value, new_ball); SongEdit.DeleteBallAndNotes(ball); ballList.Remove(ball); } }