public void DrawAchievementList() { if (GUILayout.Button(HideAll ? "Show All" : "Hide All", GUILayout.Width(70))) { for (int i = 0; i < Hidden.Count; i++) { Hidden[i] = HideAll; } HideAll = !HideAll; } for (int i = 0; i < MyTarget.AchievementList.Count; i++) { DrawAchievement(serializedObject.FindProperty("AchievementList").GetArrayElementAtIndex(i), i); } GUILayout.Space(10); if (GUILayout.Button("Add")) { MyTarget.AchievementList.Add(new AchievementInfromation()); MyTarget.States.Add(new AchievementState()); MyTarget.SaveAchievementState(); Hidden.Add(false); } CET.HorizontalLine(); EditorGUILayout.PropertyField(serializedObject.FindProperty("UseFinalAchievement")); GUILayout.Label("Define an achievement which will be unlocked once all other have been completed"); if (MyTarget.UseFinalAchievement) { EditorGUILayout.PropertyField(serializedObject.FindProperty("FinalAchievementKey")); } CET.HorizontalLine(); }
public void DrawSettings() { EditorGUILayout.PropertyField(serializedObject.FindProperty("DisplayTime")); EditorGUILayout.PropertyField(serializedObject.FindProperty("NumberOnScreen")); EditorGUILayout.PropertyField(serializedObject.FindProperty("DisplayAchievements")); if (MyTarget.DisplayAchievements) { EditorGUILayout.PropertyField(serializedObject.FindProperty("StackLocation")); } EditorGUILayout.PropertyField(serializedObject.FindProperty("ShowExactProgress")); EditorGUILayout.PropertyField(serializedObject.FindProperty("AutoSave")); EditorGUILayout.PropertyField(serializedObject.FindProperty("AutoLoad")); CET.HorizontalLine(); GUILayout.BeginVertical(ManageBackground); for (int i = 0; i < MyTarget.AchievementList.Count; i++) { Rect ProgressBarRect; Rect r = EditorGUILayout.BeginHorizontal(ManageInsideBackground); GUILayout.Label("[" + i + "] " + MyTarget.AchievementList[i].DisplayName + " (" + MyTarget.AchievementList[i].Key + ")", GUILayout.Width(250)); if (MyTarget.AchievementList[i].Progression) { float Progress = MyTarget.States[i].Progress / MyTarget.AchievementList[i].ProgressGoal; ProgressBarRect = EditorGUILayout.BeginHorizontal(ProgressBar, GUILayout.ExpandWidth(true)); GUILayout.Label(""); EditorGUILayout.EndHorizontal(); EditorGUI.ProgressBar(ProgressBarRect, Progress, "" + MyTarget.States[i].Progress + " / " + MyTarget.AchievementList[i].ProgressGoal + " (" + (Progress * 100) + "%)"); } else { GUILayout.Label(MyTarget.States[i].Achieved ? "True" : "False"); } EditorGUILayout.EndHorizontal(); GUILayout.Space(2); } GUILayout.EndVertical(); CET.HorizontalLine(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Save States")) { MyTarget.SaveAchievementState(); } if (GUILayout.Button("Reset States")) { MyTarget.ResetAchievementState(); } if (!MyTarget.AutoLoad && GUILayout.Button("Load States")) { MyTarget.LoadAchievementState(); } GUILayout.EndHorizontal(); CET.HorizontalLine(); GUILayout.Space(20); EditorGUILayout.PropertyField(serializedObject.FindProperty("Stack")); }
public void DrawSettings() { EditorGUILayout.PropertyField(serializedObject.FindProperty("DisplayTime")); EditorGUILayout.PropertyField(serializedObject.FindProperty("NumberOnScreen")); EditorGUILayout.PropertyField(serializedObject.FindProperty("DisplayAchievements")); EditorGUILayout.PropertyField(serializedObject.FindProperty("SpoilerAchievementMessage")); if (MyTarget.DisplayAchievements) { EditorGUILayout.PropertyField(serializedObject.FindProperty("StackLocation")); } EditorGUILayout.PropertyField(serializedObject.FindProperty("ShowExactProgress")); EditorGUILayout.PropertyField(serializedObject.FindProperty("AutoSave")); EditorGUILayout.PropertyField(serializedObject.FindProperty("ProgressMadeSound")); EditorGUILayout.PropertyField(serializedObject.FindProperty("AchievedSound")); CET.HorizontalLine(); GUILayout.BeginVertical(ManageBackground); for (int i = 0; i < MyTarget.AchievementList.Count; i++) { Rect ProgressBarRect; Rect r = EditorGUILayout.BeginHorizontal(ManageInsideBackground); GUILayout.Label("[" + i + "] " + MyTarget.AchievementList[i].DisplayName + " (" + MyTarget.AchievementList[i].Key + ")", GUILayout.Width(250)); if (MyTarget.AchievementList[i].Progression) { float Progress = MyTarget.States[i].Progress / MyTarget.AchievementList[i].ProgressGoal; ProgressBarRect = EditorGUILayout.BeginHorizontal(ProgressBar, GUILayout.ExpandWidth(true)); GUILayout.Label(""); EditorGUILayout.EndHorizontal(); EditorGUI.ProgressBar(ProgressBarRect, Progress, "" + MyTarget.States[i].Progress + " / " + MyTarget.AchievementList[i].ProgressGoal + " (" + (Progress * 100) + "%)"); } else { GUILayout.Label(MyTarget.States[i].Achieved ? "True" : "False"); } if (MyTarget.UseFinalAchievement && MyTarget.FinalAchievementKey.Equals(MyTarget.AchievementList[i].Key)) { GUILayout.Box(Resources.Load <Texture2D>("CompleteAllIcon"), RowButton); } EditorGUILayout.EndHorizontal(); GUILayout.Space(2); } GUILayout.EndVertical(); CET.HorizontalLine(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Manual Save")) { MyTarget.SaveAchievementState(); } if (GUILayout.Button("Reset All States")) { if (EditorUtility.DisplayDialog("Reset Confirmation", "Are you sure you want to reset all achevement states?", "Reset", "Cancel")) { MyTarget.ResetAchievementState(); } } GUILayout.EndHorizontal(); CET.HorizontalLine(); }