public void ChangeUIItem(Utils.ItemGatherable itemTarget, bool value) { uiItemImage[(int)itemTarget].SetActive(value); }
public void LayoutForType(Step s) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField((stepIndex++).ToString(), GUILayout.Width(20)); if (listeOfCondYes.Contains(stepIndex - 1)) { listeOfCondYes.Remove(stepIndex - 1); EditorGUILayout.LabelField("y", GUILayout.Width(6)); } if (listeOfCondNo.Contains(stepIndex - 1)) { listeOfCondNo.Remove(stepIndex - 1); EditorGUILayout.LabelField("n", GUILayout.Width(6)); } s.type = (Utils.StepType)EditorGUILayout.Popup((int)s.type, System.Enum.GetNames(typeof(Utils.StepType))); s.grid[0, s.y] = Utils.enumToString(s.type); //s.type = (Utils.StepType)EditorGUI.EnumPopup(new Rect(3, 30, 25, 15), s.type); switch (s.type) { case Utils.StepType.Description: s.grid[1, s.y] = EditorGUILayout.TextField(s.grid[1, s.y]); break; case Utils.StepType.Dialogue: s.grid[1, s.y] = EditorGUILayout.TextField(s.grid[1, s.y]); s.grid[2, s.y] = EditorGUILayout.TextField(s.grid[2, s.y]); break; case Utils.StepType.Animation: //TO DO : this int indexOfAnimator = 0; if (!int.TryParse(s.grid[1, s.y], out indexOfAnimator)) { //need to fix this : save only if change , else tmp view s.grid[1, s.y] = (0).ToString(); } indexOfAnimator = Mathf.Min(indexOfAnimator, AnimationHandler.animatorsName.Count - 1); s.grid[1, s.y] = (EditorGUILayout.Popup(indexOfAnimator, AnimationHandler.animatorsName.ToArray())).ToString(); //popup for trigger or bool string[] popupList = { "Trigger", "Bool" }; int res = EditorGUILayout.Popup((s.grid[2, s.y] == true.ToString()) ? 0 : 1, popupList); s.grid[2, s.y] = (res == 0).ToString(); int indexOfParam = 0; if (!int.TryParse(s.grid[3, s.y], out indexOfParam)) { //need to fix this : save only if change , else tmp view s.grid[3, s.y] = (0).ToString(); } if (res == 0) { //Debug.Log(triggerPerAnimator.Count + " trgg count / indexOfAnimator : " + indexOfAnimator); indexOfParam = Mathf.Min(indexOfParam, triggerPerAnimator[indexOfAnimator].Count - 1); s.grid[3, s.y] = (EditorGUILayout.Popup(indexOfParam, triggerPerAnimator[indexOfAnimator].ToArray())).ToString(); s.grid[4, s.y] = ""; //Default value when trigger } else { //Debug.Log(boolParamPerAnimator.Count + " bool count / indexOfAnimator : " + indexOfAnimator); indexOfParam = Mathf.Min(indexOfParam, boolParamPerAnimator[indexOfAnimator].Count - 1); s.grid[3, s.y] = (EditorGUILayout.Popup(indexOfParam, boolParamPerAnimator[indexOfAnimator].ToArray())).ToString(); s.grid[4, s.y] = EditorGUILayout.Toggle(s.grid[4, s.y] == true.ToString()).ToString(); // } //Normaly : it's work ! break; case Utils.StepType.Bruitage: s.grid[1, s.y] = EditorGUILayout.TextField(s.grid[1, s.y]); //index of fx ---> into a string ? s.grid[2, s.y] = EditorGUILayout.Toggle(s.grid[2, s.y] == true.ToString()) ? true.ToString() : false.ToString(); //random ou non donc booléan break; case Utils.StepType.Musique: s.grid[1, s.y] = EditorGUILayout.TextField(s.grid[1, s.y]); //index of musique ---> into a string ? s.grid[2, s.y] = EditorGUILayout.TextField(s.grid[2, s.y]); //delay break; case Utils.StepType.Salle: int indexOfRoom = 0; if (int.TryParse(s.grid[1, s.y], out indexOfRoom)) { s.grid[1, s.y] = (EditorGUILayout.Popup(indexOfRoom, roomsName.ToArray())).ToString(); } else { s.grid[1, s.y] = (EditorGUILayout.Popup(0, roomsName.ToArray())).ToString(); } break; case Utils.StepType.GoFight: EditorGUILayout.LabelField("For now, empty ! But soon : a list of ennemy ?"); break; case Utils.StepType.Decor: //empty yet break; case Utils.StepType.Next: s.grid[1, s.y] = EditorGUILayout.TextField(s.grid[1, s.y]); //CSV enum --> path break; case Utils.StepType.Condition: s.grid[1, s.y] = EditorGUILayout.TextField(s.grid[1, s.y]); //value to check s.grid[2, s.y] = EditorGUILayout.TextField(s.grid[2, s.y]); //path if win //ENUM s.grid[3, s.y] = EditorGUILayout.TextField(s.grid[3, s.y]); //path if not //ENUM //TO DO : create an auto-button who create two choice depend on the current inter+choice if 2 or 3 is empty. break; case Utils.StepType.NextLine: int lineToGoTo = 0; if (!int.TryParse(s.grid[1, s.y], out lineToGoTo)) { s.grid[1, s.y] = (0).ToString(); } s.grid[1, s.y] = (EditorGUILayout.IntField(lineToGoTo)).ToString(); //int value. The line to go. break; //////TO DO : /// add a breaEditorGUILayoutk line under it, and make a little "icon" or something where it point case Utils.StepType.ConditionLine: s.grid[1, s.y] = EditorGUILayout.TextField(s.grid[1, s.y]); //value to check int lineIfWin, lineIfLoose = 0; if (!int.TryParse(s.grid[2, s.y], out lineIfWin)) { s.grid[2, s.y] = (0).ToString(); } if (!int.TryParse(s.grid[3, s.y], out lineIfLoose)) { s.grid[3, s.y] = (0).ToString(); } s.grid[2, s.y] = (EditorGUILayout.IntField(lineIfWin)).ToString(); //int value. The line to go. s.grid[3, s.y] = (EditorGUILayout.IntField(lineIfLoose)).ToString(); //int value. The line to go. //TO DO : a check if line is too high //////TO DO : /// add a break line under it, and make a little "icon" or something where it point for TRUE and FALSE listeOfCondYes.Add(lineIfWin); listeOfCondNo.Add(lineIfLoose); break; case Utils.StepType.ChangeValeur: //boolean only s.grid[1, s.y] = EditorGUILayout.TextField(s.grid[1, s.y]); //value name s.grid[2, s.y] = EditorGUILayout.Toggle(s.grid[2, s.y] == true.ToString()) ? true.ToString() : false.ToString(); //will be store in a dico break; case Utils.StepType.ChangeZone: if (!int.TryParse(s.grid[1, s.y], out indexOfRoom)) { s.grid[1, s.y] = (0).ToString(); } indexOfRoom = Mathf.Min(indexOfRoom, roomsName.Count - 1); s.grid[1, s.y] = (EditorGUILayout.Popup(indexOfRoom, roomsName.ToArray())).ToString(); int indexOfZone = 0; if (!int.TryParse(s.grid[2, s.y], out indexOfZone)) { s.grid[2, s.y] = 0.ToString(); } indexOfZone = Mathf.Min(indexOfZone, zoneName[indexOfRoom].Count - 1); s.grid[2, s.y] = (EditorGUILayout.Popup(indexOfZone, zoneName[indexOfRoom].ToArray())).ToString(); s.grid[3, s.y] = EditorGUILayout.Toggle(s.grid[3, s.y] == true.ToString()) ? true.ToString() : false.ToString(); //Active or not break; case Utils.StepType.ChangeInteraction: if (!int.TryParse(s.grid[1, s.y], out indexOfRoom)) { s.grid[1, s.y] = (0).ToString(); } indexOfRoom = Mathf.Min(indexOfRoom, roomsName.Count - 1); s.grid[1, s.y] = (EditorGUILayout.Popup(indexOfRoom, roomsName.ToArray())).ToString(); indexOfZone = 0; if (!int.TryParse(s.grid[2, s.y], out indexOfZone)) { s.grid[2, s.y] = (0).ToString(); } indexOfZone = Mathf.Min(indexOfZone, zoneName[indexOfRoom].Count - 1); s.grid[2, s.y] = (EditorGUILayout.Popup(indexOfZone, zoneName[indexOfRoom].ToArray())).ToString(); int indexOfInter = 0; if (!int.TryParse(s.grid[3, s.y], out indexOfInter)) { s.grid[3, s.y] = (0).ToString(); } indexOfInter = Mathf.Min(indexOfInter, interName[indexOfRoom][indexOfZone].Count - 1); s.grid[3, s.y] = (EditorGUILayout.Popup(indexOfInter, interName[indexOfRoom][indexOfZone].ToArray())).ToString(); s.grid[4, s.y] = EditorGUILayout.Toggle(s.grid[4, s.y] == true.ToString()) ? true.ToString() : false.ToString(); //Active or not break; case Utils.StepType.ChangeState: if (!int.TryParse(s.grid[1, s.y], out indexOfRoom)) { s.grid[1, s.y] = (0).ToString(); } indexOfRoom = Mathf.Min(indexOfRoom, roomsName.Count - 1); s.grid[1, s.y] = (EditorGUILayout.Popup(indexOfRoom, roomsName.ToArray())).ToString(); indexOfZone = 0; if (!int.TryParse(s.grid[2, s.y], out indexOfZone)) { s.grid[2, s.y] = (0).ToString(); } indexOfZone = Mathf.Min(indexOfZone, zoneName[indexOfRoom].Count - 1); s.grid[2, s.y] = (EditorGUILayout.Popup(indexOfZone, zoneName[indexOfRoom].ToArray())).ToString(); int indexOfState = 0; if (!int.TryParse(s.grid[3, s.y], out indexOfState)) { s.grid[3, s.y] = (0).ToString(); } indexOfState = Mathf.Min(indexOfState, interName[indexOfRoom][indexOfZone].Count - 1); s.grid[3, s.y] = (EditorGUILayout.Popup(indexOfState, statesName[indexOfRoom][indexOfZone])).ToString(); s.grid[4, s.y] = EditorGUILayout.Toggle(s.grid[4, s.y] == true.ToString()) ? true.ToString() : false.ToString(); //Active or not break; case Utils.StepType.AddItem: //ok, I need to either change that or to automize it if (s.grid[1, s.y] == null) { s.grid[1, s.y] = "balai"; } Utils.ItemGatherable valA = Utils.itemStringToEnum(s.grid[1, s.y]); s.grid[1, s.y] = ((Utils.ItemGatherable)EditorGUILayout.Popup((int)valA, System.Enum.GetNames(typeof(Utils.ItemGatherable)))).ToString(); break; case Utils.StepType.RemoveItem: if (s.grid[1, s.y] == null) { s.grid[1, s.y] = "balai"; } Utils.ItemGatherable valR = Utils.itemStringToEnum(s.grid[1, s.y]); s.grid[1, s.y] = ((Utils.ItemGatherable)EditorGUILayout.Popup((int)valR, System.Enum.GetNames(typeof(Utils.ItemGatherable)))).ToString(); break; case Utils.StepType.CinematicBar: s.grid[1, s.y] = EditorGUILayout.Toggle(s.grid[1, s.y] == true.ToString()) ? true.ToString() : false.ToString(); //Display or hide if (!float.TryParse(s.grid[2, s.y], out float speed)) { s.grid[2, s.y] = (1.0f).ToString(); } s.grid[2, s.y] = (EditorGUILayout.FloatField(speed)).ToString(); //speed of it break; default: Debug.LogError("... How ?"); break; } if (GUILayout.Button("Remove")) { stepToRemove = s; } EditorGUILayout.EndHorizontal(); if (s.type == Utils.StepType.NextLine) { EditorGUILayout.Separator(); } }