public void ShowCardFlavorTexts() { // PER BUILDING BASIS GUILayout.BeginArea(new Rect(5, 350, 600, 300)); // ------------------------------------- Building buildingFlavorScrollPos = GUILayout.BeginScrollView(buildingScrollPos, GUILayout.Width(600), GUILayout.Height(100)); GUILayout.BeginHorizontal(); GUILayout.Label("Intro Flavor : " + curBuildingData.BuildingName, EditorStyles.boldLabel, GUILayout.Width(130)); bool addBldgFlavor = GUILayout.Button("Add Text", GUILayout.MaxWidth(100)); if (addBldgFlavor) { string tmp = "New Introduction"; curBuildingData.introductionMessages.Add(tmp); } GUILayout.EndHorizontal(); for (int i = 0; i < curBuildingData.introductionMessages.Count; i++) { GUILayout.BeginHorizontal(); GUILayout.Label("Introduction Flavor[" + (i + 1) + "]:", EditorStyles.boldLabel, GUILayout.MaxWidth(140)); curBuildingData.introductionMessages[i] = GUILayout.TextField(curBuildingData.introductionMessages[i], GUILayout.MaxWidth(350)); bool removeFlavor = GUILayout.Button("-", GUILayout.MaxWidth(50)); if (removeFlavor) { curBuildingData.introductionMessages.RemoveAt(i); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); // ------------------------------- Card cardFlavorScrollPos = GUILayout.BeginScrollView(cardFlavorScrollPos, GUILayout.Width(600), GUILayout.Height(100)); GUILayout.BeginHorizontal(); GUILayout.Label("Card Flavor : " + curSelectedCard.cardName, EditorStyles.boldLabel, GUILayout.Width(150)); bool addPositiveCardFlavor = GUILayout.Button("Positive Text", GUILayout.MaxWidth(100)); bool addNegativeCardFlavor = GUILayout.Button("Negative Text", GUILayout.MaxWidth(100)); if (addPositiveCardFlavor) { string tmp = "New Positivity"; curSelectedCard.cardPosMesg.Add(tmp); } if (addNegativeCardFlavor) { string tmp = "New Negativity"; curSelectedCard.cardNegMesg.Add(tmp); } GUILayout.EndHorizontal(); if (curSelectedCard.cardPosMesg == null) { curSelectedCard.cardPosMesg = new List <string>(); } for (int i = 0; i < curSelectedCard.cardPosMesg.Count; i++) { GUILayout.BeginHorizontal(); GUILayout.Label("Positive Flavor[" + (i + 1) + "]:", EditorStyles.boldLabel, GUILayout.MaxWidth(140)); curSelectedCard.cardPosMesg[i] = GUILayout.TextField(curSelectedCard.cardPosMesg[i], GUILayout.MaxWidth(350)); bool removeFlavor = GUILayout.Button("-", GUILayout.MaxWidth(50)); if (removeFlavor) { curSelectedCard.cardPosMesg.RemoveAt(i); } GUILayout.EndHorizontal(); } if (curSelectedCard.cardNegMesg == null) { curSelectedCard.cardNegMesg = new List <string>(); } for (int i = 0; i < curSelectedCard.cardNegMesg.Count; i++) { GUILayout.BeginHorizontal(); GUILayout.Label("Negative Flavor[" + (i + 1) + "]:", EditorStyles.boldLabel, GUILayout.MaxWidth(140)); curSelectedCard.cardNegMesg[i] = GUILayout.TextField(curSelectedCard.cardNegMesg[i], GUILayout.MaxWidth(350)); bool removeFlavor = GUILayout.Button("-", GUILayout.MaxWidth(50)); if (removeFlavor) { curSelectedCard.cardNegMesg.RemoveAt(i); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); // ----------------------------------- Actions actionFlavorScrollPos = GUILayout.BeginScrollView(actionFlavorScrollPos, GUILayout.Width(600), GUILayout.Height(100)); GUILayout.BeginHorizontal(); GUILayout.Label("Action Flavor", EditorStyles.boldLabel, GUILayout.Width(80)); List <string> actionList = new List <string>(); for (int i = 0; i < curSelectedCard.actionTypes.Count; i++) { string tmp = "Action " + (i + 1).ToString(); actionList.Add(tmp); } selectedActionIdx = EditorGUILayout.Popup(selectedActionIdx, actionList.ToArray(), GUILayout.Width(70)); if (curSelectedCard != null) { curSelectedAction = curSelectedCard.actionTypes[selectedActionIdx]; if (curSelectedAction.AcceptMesg == null) { curSelectedAction.AcceptMesg = new List <string>(); } if (curSelectedAction.DenyMesg == null) { curSelectedAction.DenyMesg = new List <string>(); } } bool addPositiveActionFlavor = GUILayout.Button("Positive Text", GUILayout.MaxWidth(100)); bool addNegativeActionFlavor = GUILayout.Button("Negative Text", GUILayout.MaxWidth(100)); if (addPositiveActionFlavor) { string tmp = "New Positivity"; curSelectedAction.AcceptMesg.Add(tmp); } if (addNegativeActionFlavor) { string tmp = "New Negativity"; curSelectedAction.DenyMesg.Add(tmp); } GUILayout.EndHorizontal(); if (curSelectedAction.AcceptMesg == null) { curSelectedAction.AcceptMesg = new List <string>(); } for (int i = 0; i < curSelectedAction.AcceptMesg.Count; i++) { GUILayout.BeginHorizontal(); GUILayout.Label("Positive Flavor[" + (i + 1) + "]:", EditorStyles.boldLabel, GUILayout.MaxWidth(140)); curSelectedAction.AcceptMesg[i] = GUILayout.TextField(curSelectedAction.AcceptMesg[i], GUILayout.MaxWidth(350)); bool removeFlavor = GUILayout.Button("-", GUILayout.MaxWidth(50)); if (removeFlavor) { curSelectedAction.AcceptMesg.RemoveAt(i); } GUILayout.EndHorizontal(); } if (curSelectedAction.DenyMesg == null) { curSelectedAction.DenyMesg = new List <string>(); } for (int i = 0; i < curSelectedAction.DenyMesg.Count; i++) { GUILayout.BeginHorizontal(); GUILayout.Label("Negative Flavor[" + (i + 1) + "]:", EditorStyles.boldLabel, GUILayout.MaxWidth(140)); curSelectedAction.DenyMesg[i] = GUILayout.TextField(curSelectedAction.DenyMesg[i], GUILayout.MaxWidth(350)); bool removeFlavor = GUILayout.Button("-", GUILayout.MaxWidth(50)); if (removeFlavor) { curSelectedAction.DenyMesg.RemoveAt(i); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); GUILayout.EndArea(); }
public void ShowBuildingList() { bool addBuilding = false; bool saveBuilding = false; bool removeBuilding = false; EditorStyles.textField.wordWrap = true; GUILayout.BeginArea(new Rect(680, 10, 400, position.height - 375)); GUILayout.BeginHorizontal(); GUILayout.Box("Building List", titleText, GUILayout.Width(295), GUILayout.Height(20)); GUILayout.EndHorizontal(); buildingScrollPos = GUILayout.BeginScrollView(buildingScrollPos, new GUIStyle("RL Background"), GUILayout.Width(300), GUILayout.Height(position.height - 400)); if (curBuildingStorageData != null && curBuildingStorageData.buildingOperationList != null && curBuildingStorageData.buildingOperationList.Count > 0) { for (int i = 0; i < curBuildingStorageData.buildingOperationList.Count; i++) { bool isClicked = false; string listName = ""; GUILayout.BeginHorizontal(); isClicked = GUILayout.Button(curBuildingStorageData.buildingOperationList[i].BuildingName, (selectedBuildingData != null && curBuildingStorageData.buildingOperationList[i].BuildingName == selectedBuildingData.BuildingName) ? selectedText : notSelectedText, GUILayout.Width(300)); if (!string.IsNullOrEmpty(curBuildingStorageData.buildingOperationList[i].BuildingName)) { listName = "[" + curBuildingStorageData.buildingOperationList[i].BuildingName + "]"; } GUILayout.EndHorizontal(); if (isClicked) { if (curBuildingStorageData.buildingOperationList[i] != null) { selectedBuildingData = curBuildingStorageData.buildingOperationList[i]; selectedBuildingIdx = i; curBuildingData = selectedBuildingData; if (selectedBuildingData.buildingCard != null && selectedBuildingData.buildingCard.Count > 0) { curSelectedCard = selectedBuildingData.buildingCard[0]; } else { curSelectedCard = null; } selectedCardIdx = 0; GUI.FocusControl(null); isClicked = false; } } } } GUILayout.EndScrollView(); GUILayout.EndArea(); GUILayout.BeginArea(new Rect(680, position.height - 360, 400, 225)); GUILayout.BeginHorizontal(); saveBuilding = GUILayout.Button((curBuildingData == selectedBuildingData) ? "Modify" : "Save", GUILayout.MaxWidth(100)); addBuilding = GUILayout.Button("Create New", GUILayout.MaxWidth(100)); if (selectedBuildingData != null && curBuildingStorageData.buildingOperationList.Find(x => x.BuildingName == selectedBuildingData.BuildingName) != null) { removeBuilding = GUILayout.Button("Remove", GUILayout.MaxWidth(100)); } GUILayout.EndHorizontal(); GUILayout.EndArea(); if (saveBuilding) { if (curBuildingStorageData.buildingOperationList.Contains(curBuildingData)) { selectedBuildingData = curBuildingData; } else { curBuildingStorageData.buildingOperationList.Add(curBuildingData); curBuildingData = new BuildingInformationData(); } Save(); selectedBuildingData = null; curSelectedCard = null; curBuildingData = new BuildingInformationData(); curSelectedAction = null; selectedActionIdx = 0; } if (addBuilding) { selectedBuildingData = null; curBuildingData = new BuildingInformationData(); curSelectedCard = null; GUI.FocusControl(null); } if (removeBuilding) { removeBuilding = false; if (selectedBuildingData != null) { curBuildingStorageData.buildingOperationList.RemoveAt(selectedBuildingIdx); selectedBuildingData = null; } Save(); GUI.FocusControl(null); } }