bool DrawNotificationCategoryGroup(SerializedProperty property) { SerializedProperty name = property.FindPropertyRelative(NotificationCategoryGroup_Name); SerializedProperty id = property.FindPropertyRelative(NotificationCategoryGroup_Id); string key = property.propertyPath; if (!notificationFoldoutStates.ContainsKey(key)) { notificationFoldoutStates.Add(key, false); } EditorGUILayout.BeginVertical(EM_GUIStyleManager.GetCustomStyle("Item Box")); string foldoutLabel = string.IsNullOrEmpty(name.stringValue) ? "[Untitled Category Group]" : name.stringValue; EditorGUI.indentLevel++; notificationFoldoutStates[key] = EditorGUILayout.Foldout(notificationFoldoutStates[key], foldoutLabel, true); if (notificationFoldoutStates[key]) { EditorGUILayout.PropertyField(name); EditorGUILayout.PropertyField(id); } EditorGUI.indentLevel--; EditorGUILayout.EndVertical(); return(notificationFoldoutStates[key]); }
/// <summary> /// Draws the array element control toolbox with standard buttons (Move Up, Move Down, Delete). /// </summary> /// <param name="buttonResults">Button results.</param> /// <param name="allowMoveUp">If set to <c>true</c> allow move up.</param> /// <param name="allowMoveDown">If set to <c>true</c> allow move down.</param> static void DrawArrayElementControlToolbox(ref ArrayItemToolboxButtonResults buttonResults, bool allowMoveUp = true, bool allowMoveDown = true) { EditorGUILayout.BeginVertical(EM_GUIStyleManager.GetCustomStyle("Tool Box"), GUILayout.Width(EM_GUIStyleManager.toolboxWidth), GUILayout.Height(EM_GUIStyleManager.toolboxHeight)); // Move up button. EditorGUI.BeginDisabledGroup(!allowMoveUp); if (GUILayout.Button(EM_Constants.UpSymbol, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true))) { buttonResults.isMoveUpButton = true; } EditorGUI.EndDisabledGroup(); // Delete button. if (GUILayout.Button(EM_Constants.DeleteSymbol, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true))) { // DeleteArrayElementAtIndex seems working fine even while iterating // through the array, but it's still a better idea to move it outside the loop. buttonResults.isDeleteButton = true; } // Move down button. EditorGUI.BeginDisabledGroup(!allowMoveDown); if (GUILayout.Button(EM_Constants.DownSymbol, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true))) { buttonResults.isMoveDownButton = true; } EditorGUI.EndDisabledGroup(); EditorGUILayout.EndVertical(); }
void UtilityModuleGUI() { EditorGUILayout.BeginVertical(EM_GUIStyleManager.GetCustomStyle("Module Box")); EM_EditorGUI.ModuleLabel(UtilityModuleLabel); // Rating Request settings EditorGUILayout.Space(); EditorGUILayout.LabelField("[STORE REVIEW] REQUEST DIALOG CONFIG", EditorStyles.boldLabel); // Appearance EditorGUILayout.LabelField("Appearance", EditorStyles.boldLabel); EditorGUILayout.HelpBox("All instances of " + RatingDialogContent.PRODUCT_NAME_PLACEHOLDER + " in titles and messages will be replaced by the actual Product Name given in PlayerSettings.", MessageType.Info); EditorGUI.indentLevel++; EditorGUILayout.PropertyField(RatingRequestProperties.defaultRatingDialogContent.property, RatingRequestProperties.defaultRatingDialogContent.content, true); EditorGUI.indentLevel--; // Behaviour EditorGUILayout.Space(); EditorGUILayout.LabelField("Behaviour", EditorStyles.boldLabel); EditorGUILayout.PropertyField(RatingRequestProperties.minimumAcceptedStars.property, RatingRequestProperties.minimumAcceptedStars.content); EditorGUILayout.PropertyField(RatingRequestProperties.supportEmail.property, RatingRequestProperties.supportEmail.content); EditorGUILayout.PropertyField(RatingRequestProperties.iosAppId.property, RatingRequestProperties.iosAppId.content); // Display constraints EditorGUILayout.Space(); EditorGUILayout.LabelField("Display Constraints", EditorStyles.boldLabel); EditorGUILayout.PropertyField(RatingRequestProperties.annualCap.property, RatingRequestProperties.annualCap.content); EditorGUILayout.PropertyField(RatingRequestProperties.delayAfterInstallation.property, RatingRequestProperties.delayAfterInstallation.content); EditorGUILayout.PropertyField(RatingRequestProperties.coolingOffPeriod.property, RatingRequestProperties.coolingOffPeriod.content); EditorGUILayout.PropertyField(RatingRequestProperties.ignoreConstraintsInDevelopment.property, RatingRequestProperties.ignoreConstraintsInDevelopment.content); EditorGUILayout.EndVertical(); }
// Draw leaderboard or achievement item. void DrawGameServiceItem(SerializedProperty property, string label) { SerializedProperty name = property.FindPropertyRelative(GameServiceItem_NameProperty); SerializedProperty iosId = property.FindPropertyRelative(GameServiceItem_IOSIdProperty); SerializedProperty androidId = property.FindPropertyRelative(GameServiceItem_AndroidIdProperty); EditorGUILayout.BeginVertical(EM_GUIStyleManager.GetCustomStyle("Item Box")); EditorGUILayout.LabelField(string.IsNullOrEmpty(name.stringValue) ? "New " + label : name.stringValue, EditorStyles.boldLabel); name.stringValue = EditorGUILayout.TextField("Name", name.stringValue); iosId.stringValue = EditorGUILayout.TextField("iOS Id", iosId.stringValue); // For Android Id, display a popup of Android leaderboards & achievements for the user to select // then assign its associated id to the property. EditorGUI.BeginChangeCheck(); int currentIndex = Mathf.Max(System.Array.IndexOf(gpgsIds, EM_EditorUtil.GetKeyForValue(gpgsIdDict, androidId.stringValue)), 0); int newIndex = EditorGUILayout.Popup("Android Id", currentIndex, gpgsIds); if (EditorGUI.EndChangeCheck()) { // Position 0 is [None]. if (newIndex == 0) { androidId.stringValue = string.Empty; } else { // Record the new android Id. string newName = gpgsIds[newIndex]; androidId.stringValue = gpgsIdDict[newName]; } } EditorGUILayout.EndVertical(); }
void DrawIAPProduct(SerializedProperty property) { // Get members. SerializedProperty name = property.FindPropertyRelative(IAPProduct_NameProperty); SerializedProperty type = property.FindPropertyRelative(IAPProduct_TypeProperty); SerializedProperty id = property.FindPropertyRelative(IAPProduct_IdProperty); SerializedProperty price = property.FindPropertyRelative(IAPProduct_PriceProperty); SerializedProperty description = property.FindPropertyRelative(IAPProduct_DescriptionProperty); SerializedProperty storeSpecificIds = property.FindPropertyRelative(IAPProduct_StoreSpecificIdsProperty); SerializedProperty isEditingAdvanced = property.FindPropertyRelative(IAPProduct_IsEditingAdvanced); // Main content section. EditorGUILayout.BeginVertical(EM_GUIStyleManager.GetCustomStyle("Item Box")); // Required settings EditorGUILayout.LabelField(string.IsNullOrEmpty(name.stringValue) ? "New Product" : name.stringValue, EditorStyles.boldLabel); name.stringValue = EditorGUILayout.TextField(IAPProduct_NameContent, name.stringValue); type.enumValueIndex = EditorGUILayout.Popup(IAPProduct_TypeContent.text, type.enumValueIndex, type.enumDisplayNames); id.stringValue = EditorGUILayout.TextField(IAPProduct_IdContent, id.stringValue); // Advanced settings EditorGUI.indentLevel++; isEditingAdvanced.boolValue = EditorGUILayout.Foldout(isEditingAdvanced.boolValue, "More (Optional)"); if (isEditingAdvanced.boolValue) { price.stringValue = EditorGUILayout.TextField(IAPProduct_PriceContent, price.stringValue); description.stringValue = EditorGUILayout.TextField(IAPProduct_DescriptionContent, description.stringValue, EM_GUIStyleManager.WordwrapTextField, GUILayout.Height(EditorGUIUtility.singleLineHeight * 3)); // Store-specific Ids section. EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(IAPProduct_StoreSpecificIdsContent); EditorGUI.BeginChangeCheck(); storeSpecificIds.arraySize = EditorGUILayout.IntField(storeSpecificIds.arraySize, GUILayout.Width(50)); if (EditorGUI.EndChangeCheck()) { // Won't allow values larger than the number of available stores. int storeNum = System.Enum.GetNames(typeof(IAPStore)).Length; storeSpecificIds.arraySize = Mathf.Clamp(storeSpecificIds.arraySize, 0, storeNum); } EditorGUILayout.EndHorizontal(); for (int i = 0; i < storeSpecificIds.arraySize; i++) { SerializedProperty element = storeSpecificIds.GetArrayElementAtIndex(i); SerializedProperty specificStore = element.FindPropertyRelative(StoreSpecificIds_StoreProperty); SerializedProperty specificId = element.FindPropertyRelative(StoreSpecificIds_IdProperty); EditorGUILayout.BeginHorizontal(); specificStore.enumValueIndex = EditorGUILayout.Popup(specificStore.enumValueIndex, specificStore.enumDisplayNames); specificId.stringValue = EditorGUILayout.TextField(specificId.stringValue); EditorGUILayout.EndHorizontal(); } } EditorGUI.indentLevel--; EditorGUILayout.EndVertical(); }
void DrawNotificationCategory(SerializedProperty prop) { var id = prop.FindPropertyRelative(NotificationCategory_Id); var groupId = prop.FindPropertyRelative(NotificationCategory_GroupId); var name = prop.FindPropertyRelative(NotificationCategory_Name); var description = prop.FindPropertyRelative(NotificationCategory_Description); var importance = prop.FindPropertyRelative(NotificationCategory_Importance); var enableBadge = prop.FindPropertyRelative(NotificationCategory_EnableBadge); var lights = prop.FindPropertyRelative(NotificationCategory_Lights); var lightColor = prop.FindPropertyRelative(NotificationCategory_LightColor); var vibration = prop.FindPropertyRelative(NotificationCategory_Vibration); var vibrationPattern = prop.FindPropertyRelative(NotificationCategory_VibrationPattern); var lockScreenVisibility = prop.FindPropertyRelative(NotificationCategory_LockScreenVisibility); var sound = prop.FindPropertyRelative(NotificationCategory_Sound); var soundName = prop.FindPropertyRelative(NotificationCategory_SoundName); var actionButtons = prop.FindPropertyRelative(NotificationCategory_ActionButtons); EditorGUILayout.BeginVertical(EM_GUIStyleManager.GetCustomStyle("Item Box")); EditorGUILayout.LabelField(string.IsNullOrEmpty(name.stringValue) ? "New Category" : name.stringValue, EditorStyles.boldLabel); EditorGUILayout.Space(); EditorGUILayout.PropertyField(name); EditorGUILayout.PropertyField(id); EditorGUILayout.PropertyField(description); // Dispaly group IDs as a drop down. DrawNotificationCategoryGroupId(groupId); EditorGUILayout.PropertyField(enableBadge); EditorGUILayout.PropertyField(importance); EditorGUILayout.PropertyField(lights); if (lights.enumValueIndex == (int)NotificationCategory.LightOptions.Custom) { EditorGUILayout.PropertyField(lightColor); } EditorGUILayout.PropertyField(vibration); if (vibration.enumValueIndex == (int)NotificationCategory.VibrationOptions.Custom) { DrawNotificationVibrationPattern(vibrationPattern); } EditorGUILayout.PropertyField(lockScreenVisibility); EditorGUILayout.PropertyField(sound); if (sound.enumValueIndex == (int)NotificationCategory.SoundOptions.Custom) { EditorGUILayout.PropertyField(soundName); } // Action buttons. DrawNotificationActionButtonsArray(actionButtons); EditorGUILayout.EndVertical(); }
public static bool ModuleToggle(bool toggle, string label) { bool result = EditorGUILayout.Toggle( toggle, EM_GUIStyleManager.GetCustomStyle("Module Toggle"), GUILayout.Width(44)); return(result); }
public static void ModuleLabel(string label) { EditorGUILayout.LabelField( label, EM_GUIStyleManager.GetCustomStyle("Module Toggle Label"), GUILayout.ExpandWidth(true), GUILayout.Height(MODULE_LABEL_HEIGHT) ); }
private bool DrawUppercaseSectionWithToggle(string key, string sectionName, bool toggle, Action drawer, Texture2D sectionIcon = null) { if (!uppercaseSectionsFoldoutStates.ContainsKey(key)) { uppercaseSectionsFoldoutStates.Add(key, true); } bool foldout = uppercaseSectionsFoldoutStates[key]; EditorGUILayout.BeginVertical(EM_GUIStyleManager.GetCustomStyle("Uppercase Section Box"), GUILayout.MinHeight(foldout ? 30 : 0)); EditorGUILayout.BeginHorizontal(foldout ? EM_GUIStyleManager.UppercaseSectionHeaderExpand : EM_GUIStyleManager.UppercaseSectionHeaderCollapse); // Header icon. EditorGUILayout.LabelField(new GUIContent(sectionIcon ?? EM_GUIStyleManager.UppercaseSectionHeaderIcon), EM_GUIStyleManager.GetCustomStyle("Uppercase Section Header Icon"), GUILayout.Width(DefaultSectionHeaderIconWidth), GUILayout.Height(DefaultSectionHeaderIconHeight)); // The toggle. var headerRect = GUILayoutUtility.GetLastRect(); var toogleX = headerRect.x + EditorGUIUtility.currentViewWidth - 100; var toggleRect = new Rect(toogleX, headerRect.y - 2, 40, 24); var result = EditorGUI.Toggle(toggleRect, toggle, EM_GUIStyleManager.GetCustomStyle("Module Toggle")); // Header label (and button). if (GUILayout.Button(sectionName, EM_GUIStyleManager.GetCustomStyle("Uppercase Section Header Label"))) { uppercaseSectionsFoldoutStates[key] = !uppercaseSectionsFoldoutStates[key]; } // The expand/collapse icon. var buttonRect = GUILayoutUtility.GetLastRect(); var iconRect = new Rect(buttonRect.x + buttonRect.width - ChevronIconWidth - ChevronIconRightMargin, buttonRect.y, ChevronIconWidth, buttonRect.height); GUI.Label(iconRect, GetChevronIcon(foldout), EM_GUIStyleManager.GetCustomStyle("Uppercase Section Header Chevron")); EditorGUILayout.EndHorizontal(); // Draw the section content. if (foldout) { GUILayout.Space(5); } if (foldout && drawer != null) { drawer(); } EditorGUILayout.EndVertical(); return(result); }
void DrawNotificationCategoryGroup(SerializedProperty property) { SerializedProperty name = property.FindPropertyRelative(NotificationCategoryGroup_Name); SerializedProperty id = property.FindPropertyRelative(NotificationCategoryGroup_Id); EditorGUILayout.BeginVertical(EM_GUIStyleManager.GetCustomStyle("Item Box")); EditorGUILayout.LabelField(string.IsNullOrEmpty(name.stringValue) ? "New Category Group" : name.stringValue, EditorStyles.boldLabel); EditorGUILayout.Space(); EditorGUILayout.PropertyField(name); EditorGUILayout.PropertyField(id); EditorGUILayout.Space(); EditorGUILayout.EndVertical(); }
/// <summary> /// Draws the array element control toolbox with standard buttons (Move Up, Move Down, Delete). /// </summary> /// <param name="buttonResults">Button results.</param> /// <param name="foldout">Foldout.</param> /// <param name="allowMoveUp">If set to <c>true</c> allow move up.</param> /// <param name="allowMoveDown">If set to <c>true</c> allow move down.</param> static void DrawArrayElementControlToolbox(ref ArrayItemToolboxButtonResults buttonResults, bool foldout, bool allowMoveUp = true, bool allowMoveDown = true) { GUIContent deleteContent = EditorGUIUtility.IconContent("Toolbar Minus"); GUIStyle deleteButtonStyle = new GUIStyle(GUIStyle.none) { fixedHeight = EM_GUIStyleManager.smallButtonHeight, fixedWidth = EM_GUIStyleManager.smallButtonWidth, padding = new RectOffset(2, 0, 4, 0), }; GUIStyle moveButtonsStyle = new GUIStyle(GUIStyle.none) { fixedHeight = 20, fixedWidth = 20, }; EditorGUILayout.BeginVertical(EM_GUIStyleManager.GetCustomStyle("Tool Box"), GUILayout.Width(EM_GUIStyleManager.toolboxWidth)); if (foldout) { // Move up button. EditorGUI.BeginDisabledGroup(!allowMoveUp); if (GUILayout.Button(EM_GUIStyleManager.ArrowUp, moveButtonsStyle)) { buttonResults.isMoveUpButton = true; } EditorGUI.EndDisabledGroup(); } // Delete button. if (GUILayout.Button(deleteContent, deleteButtonStyle)) { // DeleteArrayElementAtIndex seems working fine even while iterating // through the array, but it's still a better idea to move it outside the loop. buttonResults.isDeleteButton = true; } // Move down button. if (foldout) { EditorGUI.BeginDisabledGroup(!allowMoveDown); if (GUILayout.Button(EM_GUIStyleManager.ArrowDown, moveButtonsStyle)) { buttonResults.isMoveDownButton = true; } EditorGUI.EndDisabledGroup(); } EditorGUILayout.EndVertical(); }
// Draw leaderboard or achievement item. bool DrawGameServiceItem(SerializedProperty property, string label) { SerializedProperty name = property.FindPropertyRelative(GameServiceItem_NameProperty); SerializedProperty iosId = property.FindPropertyRelative(GameServiceItem_IOSIdProperty); SerializedProperty androidId = property.FindPropertyRelative(GameServiceItem_AndroidIdProperty); EditorGUILayout.BeginVertical(EM_GUIStyleManager.GetCustomStyle("Item Box")); string key = property.propertyPath; if (!gameServiceFoldoutStates.ContainsKey(key)) { gameServiceFoldoutStates.Add(key, false); } string foldoutLabel = string.IsNullOrEmpty(name.stringValue) ? "[Untitled " + label + "]" : name.stringValue; EditorGUI.indentLevel++; gameServiceFoldoutStates[key] = EditorGUILayout.Foldout(gameServiceFoldoutStates[key], foldoutLabel, true); if (gameServiceFoldoutStates[key]) { name.stringValue = EditorGUILayout.TextField("Name", name.stringValue); iosId.stringValue = EditorGUILayout.TextField("iOS Id", iosId.stringValue); // For Android Id, display a popup of Android leaderboards & achievements for the user to select // then assign its associated id to the property. EditorGUI.BeginChangeCheck(); int currentIndex = Mathf.Max(System.Array.IndexOf(gpgsIds, EM_EditorUtil.GetKeyForValue(gpgsIdDict, androidId.stringValue)), 0); int newIndex = EditorGUILayout.Popup("Android Id", currentIndex, gpgsIds); if (EditorGUI.EndChangeCheck()) { // Position 0 is [None]. if (newIndex == 0) { androidId.stringValue = string.Empty; } else { // Record the new android Id. string newName = gpgsIds[newIndex]; androidId.stringValue = gpgsIdDict[newName]; } } } EditorGUI.indentLevel--; EditorGUILayout.EndVertical(); return(gameServiceFoldoutStates[key]); }
/// <summary> /// Draws our custom header. /// </summary> protected override void OnHeaderGUI() { EditorGUILayout.BeginHorizontal(EM_GUIStyleManager.GetCustomStyle("Inspector Header")); // EM icon. GUILayout.Label(new GUIContent(EM_GUIStyleManager.EasyMobileIcon), EM_GUIStyleManager.InspectorHeaderIcon); EditorGUILayout.BeginVertical(); // EM title. #if EASY_MOBILE_PRO string title = "EASY MOBILE Pro"; #else string title = "EASY MOBILE Basic"; #endif EditorGUILayout.LabelField(title, EM_GUIStyleManager.InspectorHeaderTitle); // EM version. EditorGUILayout.LabelField("Version " + EM_Constants.versionString, EM_GUIStyleManager.InspectorHeaderSubtitle); EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); }
public static bool ModuleToggle(bool toggle, string label) { EditorGUILayout.BeginHorizontal(GUILayout.Height(24)); EditorGUILayout.LabelField( label, EM_GUIStyleManager.GetCustomStyle("Module Toggle Label"), GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true) ); bool result = EditorGUILayout.Toggle( toggle, EM_GUIStyleManager.GetCustomStyle("Module Toggle"), GUILayout.Width(44), GUILayout.ExpandHeight(true) ); EditorGUILayout.EndHorizontal(); return(result); }
private bool DrawUppercaseSectionWithToggle(string key, string sectionName, bool toggle, Action drawer, Texture2D sectionIcon = null, bool defaultFoldout = true) { if (!uppercaseSectionsFoldoutStates.ContainsKey(key)) { uppercaseSectionsFoldoutStates.Add(key, defaultFoldout); } if (!uppercaseSectionsToggleStates.ContainsKey(key)) { uppercaseSectionsToggleStates.Add(key, false); } bool foldout = uppercaseSectionsFoldoutStates[key]; EditorGUILayout.BeginVertical(); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); float horizontalSize = GUILayoutUtility.GetLastRect().width; EditorGUILayout.BeginVertical(EM_GUIStyleManager.GetCustomStyle("Uppercase Section Box"), GUILayout.MinHeight(foldout ? 30 : 0)); EditorGUILayout.BeginHorizontal(foldout ? EM_GUIStyleManager.UppercaseSectionHeaderExpand : EM_GUIStyleManager.UppercaseSectionHeaderCollapse); // Header icon. EditorGUILayout.LabelField(new GUIContent(sectionIcon ?? EM_GUIStyleManager.UppercaseSectionHeaderIcon), EM_GUIStyleManager.GetCustomStyle("Uppercase Section Header Icon"), GUILayout.Width(DefaultSectionHeaderIconWidth), GUILayout.Height(DefaultSectionHeaderIconHeight)); // The toggle. var headerRect = GUILayoutUtility.GetLastRect(); var toogleX = horizontalSize - 40 - 5 - ChevronIconWidth - ChevronIconRightMargin; var toggleRect = new Rect(toogleX, headerRect.y - 2, 40, 24); var result = EditorGUI.Toggle(toggleRect, toggle, EM_GUIStyleManager.GetCustomStyle("Module Toggle")); // Expand or contract the foldout according to the toggle state. if ((result && !uppercaseSectionsToggleStates[key]) || (!result && uppercaseSectionsToggleStates[key])) { // Just toggled on or off. uppercaseSectionsFoldoutStates[key] = result; foldout = uppercaseSectionsFoldoutStates[key]; } // Save toggle state. uppercaseSectionsToggleStates[key] = result; // Header label (and button to control the foldout). if (GUILayout.Button(sectionName, EM_GUIStyleManager.GetCustomStyle("Uppercase Section Header Label"))) { uppercaseSectionsFoldoutStates[key] = !uppercaseSectionsFoldoutStates[key]; } // The expand/collapse icon. var buttonRect = GUILayoutUtility.GetLastRect(); var iconRect = new Rect(buttonRect.x + buttonRect.width - ChevronIconWidth - ChevronIconRightMargin, buttonRect.y, ChevronIconWidth, buttonRect.height); GUI.Label(iconRect, GetChevronIcon(foldout), EM_GUIStyleManager.GetCustomStyle("Uppercase Section Header Chevron")); EditorGUILayout.EndHorizontal(); // Draw the section content. if (foldout) { GUILayout.Space(5); } if (foldout && drawer != null) { drawer(); } EditorGUILayout.EndVertical(); return(result); }
bool DrawIAPProduct(SerializedProperty property) { // Get members. SerializedProperty name = property.FindPropertyRelative(IAPProduct_NameProperty); SerializedProperty type = property.FindPropertyRelative(IAPProduct_TypeProperty); SerializedProperty id = property.FindPropertyRelative(IAPProduct_IdProperty); SerializedProperty price = property.FindPropertyRelative(IAPProduct_PriceProperty); SerializedProperty description = property.FindPropertyRelative(IAPProduct_DescriptionProperty); SerializedProperty storeSpecificIds = property.FindPropertyRelative(IAPProduct_StoreSpecificIdsProperty); SerializedProperty isEditingAdvanced = property.FindPropertyRelative(IAPProduct_IsEditingAdvanced); // Main content section. EditorGUILayout.BeginVertical(EM_GUIStyleManager.GetCustomStyle("Item Box")); // Foldout string key = property.propertyPath; string foldoutLabel = string.IsNullOrEmpty(name.stringValue) ? "[Untitled Product]" : name.stringValue; if (!iapFoldoutStates.ContainsKey(key)) { iapFoldoutStates.Add(key, false); } EditorGUI.indentLevel++; iapFoldoutStates[key] = EditorGUILayout.Foldout(iapFoldoutStates[key], foldoutLabel, true); if (iapFoldoutStates[key]) { // Required settings name.stringValue = EditorGUILayout.TextField(IAPProduct_NameContent, name.stringValue); type.enumValueIndex = EditorGUILayout.Popup(IAPProduct_TypeContent.text, type.enumValueIndex, type.enumDisplayNames); id.stringValue = EditorGUILayout.TextField(IAPProduct_IdContent, id.stringValue); // Advanced settings EditorGUI.indentLevel++; isEditingAdvanced.boolValue = EditorGUILayout.Foldout(isEditingAdvanced.boolValue, "More (Optional)", true); if (isEditingAdvanced.boolValue) { price.stringValue = EditorGUILayout.TextField(IAPProduct_PriceContent, price.stringValue); description.stringValue = EditorGUILayout.TextField(IAPProduct_DescriptionContent, description.stringValue, EM_GUIStyleManager.WordwrapTextField, GUILayout.Height(EditorGUIUtility.singleLineHeight * 3)); // Store-specific Ids section. int storeNum = System.Enum.GetNames(typeof(IAPStore)).Length; GUIContent plusButton = EditorGUIUtility.IconContent("Toolbar Plus"); GUIContent minusButton = EditorGUIUtility.IconContent("Toolbar Minus"); GUIStyle buttonsStyle = new GUIStyle(GUIStyle.none) { fixedHeight = EM_GUIStyleManager.smallButtonHeight, fixedWidth = EM_GUIStyleManager.smallButtonWidth, }; EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(IAPProduct_StoreSpecificIdsContent); // Draw plus button. bool canAdd = true; if (storeSpecificIds.arraySize >= storeNum) // Won't allow values larger than the number of available stores. { canAdd = false; } EditorGUI.BeginDisabledGroup(!canAdd); if (GUILayout.Button(plusButton, buttonsStyle)) { storeSpecificIds.arraySize++; } EditorGUI.EndDisabledGroup(); // Draw minus button. bool canDelete = true; if (storeSpecificIds.arraySize < 1) { canDelete = false; } EditorGUI.BeginDisabledGroup(!canDelete); if (GUILayout.Button(minusButton, buttonsStyle)) { storeSpecificIds.arraySize--; } EditorGUI.EndDisabledGroup(); EditorGUILayout.EndHorizontal(); for (int i = 0; i < storeSpecificIds.arraySize; i++) { SerializedProperty element = storeSpecificIds.GetArrayElementAtIndex(i); SerializedProperty specificStore = element.FindPropertyRelative(StoreSpecificIds_StoreProperty); SerializedProperty specificId = element.FindPropertyRelative(StoreSpecificIds_IdProperty); EditorGUILayout.BeginHorizontal(); specificStore.enumValueIndex = EditorGUILayout.Popup(specificStore.enumValueIndex, specificStore.enumDisplayNames); specificId.stringValue = EditorGUILayout.TextField(specificId.stringValue); EditorGUILayout.EndHorizontal(); } } EditorGUI.indentLevel--; } EditorGUI.indentLevel--; EditorGUILayout.EndVertical(); return(iapFoldoutStates[key]); }
void AdModuleGUI() { EditorGUILayout.BeginVertical(EM_GUIStyleManager.GetCustomStyle("Module Box")); EditorGUI.BeginChangeCheck(); isAdModuleEnable.boolValue = EM_EditorGUI.ModuleToggle(isAdModuleEnable.boolValue, AdModuleLabel); if (EditorGUI.EndChangeCheck()) { GameObject prefab = EM_EditorUtil.GetMainPrefab(); if (!isAdModuleEnable.boolValue) { EM_Manager.DisableAdModule(prefab); } else { EM_Manager.EnableAdModule(prefab); } } // Now draw the GUI. if (!isAdModuleEnable.boolValue) { EditorGUILayout.Space(); EditorGUILayout.HelpBox(AdModuleIntro, MessageType.Info); } else { // AdMob setup EditorGUILayout.Space(); EditorGUILayout.LabelField("ADMOB SETUP", EditorStyles.boldLabel); #if !EM_ADMOB EditorGUILayout.HelpBox(AdMobImportInstruction, MessageType.Warning); EditorGUILayout.Space(); if (GUILayout.Button("Download Google Mobile Ads Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EM_ExternalPluginManager.DownloadGoogleMobileAdsPlugin(); } #else EditorGUILayout.HelpBox(AdMobAvailMsg, MessageType.Info); EditorGUILayout.Space(); if (GUILayout.Button("Download Google Mobile Ads Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EM_ExternalPluginManager.DownloadGoogleMobileAdsPlugin(); } EditorGUILayout.Space(); EditorGUI.indentLevel++; EditorGUILayout.PropertyField(AdProperties.iosAdMobConfig.property, AdProperties.iosAdMobConfig.content, true); EditorGUILayout.PropertyField(AdProperties.androidAdMobConfig.property, AdProperties.androidAdMobConfig.content, true); EditorGUI.indentLevel--; #endif // Chartboost setup EditorGUILayout.Space(); EditorGUILayout.LabelField("CHARTBOOST SETUP", EditorStyles.boldLabel); #if !EM_CHARTBOOST EditorGUILayout.HelpBox(ChartboostImportInstruction, MessageType.Warning); EditorGUILayout.Space(); if (GUILayout.Button("Download Chartboost Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EM_ExternalPluginManager.DownloadChartboostPlugin(); } #else EditorGUILayout.HelpBox(ChartboostAvailMsg, MessageType.Info); EditorGUILayout.Space(); if (GUILayout.Button("Download Chartboost Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EM_ExternalPluginManager.DownloadChartboostPlugin(); } if (GUILayout.Button("Setup Chartboost", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { // Open Chartboost settings window. ChartboostSDK.CBSettings.Edit(); } #endif // Heyzap setup EditorGUILayout.Space(); EditorGUILayout.LabelField("HEYZAP SETUP", EditorStyles.boldLabel); #if !EM_HEYZAP EditorGUILayout.HelpBox(HeyzapImportInstruction, MessageType.Warning); EditorGUILayout.Space(); if (GUILayout.Button("Download Heyzap Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EM_ExternalPluginManager.DownloadHeyzapPlugin(); } #else EditorGUILayout.HelpBox(HeyzapAvailMsg, MessageType.Info); EditorGUILayout.Space(); if (GUILayout.Button("Download Heyzap Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EM_ExternalPluginManager.DownloadHeyzapPlugin(); } EditorGUILayout.Space(); AdProperties.heyzapPublisherId.property.stringValue = EditorGUILayout.TextField(AdProperties.heyzapPublisherId.content, AdProperties.heyzapPublisherId.property.stringValue); AdProperties.heyzapShowTestSuite.property.boolValue = EditorGUILayout.Toggle(AdProperties.heyzapShowTestSuite.content, AdProperties.heyzapShowTestSuite.property.boolValue); #endif // UnityAds setup EditorGUILayout.Space(); EditorGUILayout.LabelField("UNITY ADS SETUP", EditorStyles.boldLabel); #if !UNITY_ADS EditorGUILayout.HelpBox(UnityAdsUnvailableWarning, MessageType.Warning); #else EditorGUILayout.HelpBox(UnityAdsAvailableMsg, MessageType.Info); #endif // Ads auto-load setup EditorGUILayout.Space(); EditorGUILayout.LabelField("AUTO AD-LOADING CONFIG", EditorStyles.boldLabel); AdProperties.autoLoadDefaultAds.property.boolValue = EditorGUILayout.Toggle(AdProperties.autoLoadDefaultAds.content, AdProperties.autoLoadDefaultAds.property.boolValue); AdProperties.adCheckingInterval.property.floatValue = EditorGUILayout.FloatField(AdProperties.adCheckingInterval.content, AdProperties.adCheckingInterval.property.floatValue); AdProperties.adLoadingInterval.property.floatValue = EditorGUILayout.FloatField(AdProperties.adLoadingInterval.content, AdProperties.adLoadingInterval.property.floatValue); EditorGUILayout.Space(); EditorGUILayout.LabelField("DEFAULT AD NETWORKS", EditorStyles.boldLabel); EditorGUI.indentLevel++; EditorGUILayout.PropertyField(AdProperties.iosDefaultAdNetworks.property, AdProperties.iosDefaultAdNetworks.content, true); EditorGUILayout.PropertyField(AdProperties.androidDefaultAdNetworks.property, AdProperties.androidDefaultAdNetworks.content, true); EditorGUI.indentLevel--; // Now check if there's any default ad network that doesn't have plugin imported and show warnings. AdSettings.DefaultAdNetworks iosDefault = EM_Settings.Advertising.IosDefaultAdNetworks; AdSettings.DefaultAdNetworks androidDefault = EM_Settings.Advertising.AndroidDefaultAdNetworks; List <AdNetwork> usedNetworks = new List <AdNetwork>(); AddWithoutRepeat(usedNetworks, (AdNetwork)iosDefault.bannerAdNetwork); AddWithoutRepeat(usedNetworks, (AdNetwork)iosDefault.interstitialAdNetwork); AddWithoutRepeat(usedNetworks, (AdNetwork)iosDefault.rewardedAdNetwork); AddWithoutRepeat(usedNetworks, (AdNetwork)androidDefault.bannerAdNetwork); AddWithoutRepeat(usedNetworks, (AdNetwork)androidDefault.interstitialAdNetwork); AddWithoutRepeat(usedNetworks, (AdNetwork)androidDefault.rewardedAdNetwork); bool addedSpace = false; foreach (AdNetwork network in usedNetworks) { if (!IsPluginAvail(network)) { if (!addedSpace) { EditorGUILayout.Space(); addedSpace = true; } EditorGUILayout.HelpBox("Default ad network " + network.ToString() + " has no SDK. Please import its plugin.", MessageType.Warning); } } } EditorGUILayout.EndVertical(); }
void GameServiceModuleGUI() { EditorGUILayout.BeginVertical(EM_GUIStyleManager.GetCustomStyle("Module Box")); EditorGUI.BeginChangeCheck(); isGameServiceModuleEnable.boolValue = EM_EditorGUI.ModuleToggle(isGameServiceModuleEnable.boolValue, GameServiceModuleLabel); // Update the main prefab according to the toggle state. if (EditorGUI.EndChangeCheck()) { GameObject prefab = EM_EditorUtil.GetMainPrefab(); if (!isGameServiceModuleEnable.boolValue) { EM_PluginManager.DisableGameServiceModule(prefab); } else { EM_PluginManager.EnableGameServiceModule(prefab); } } // Now draw the GUI. if (!isGameServiceModuleEnable.boolValue) { EditorGUILayout.Space(); EditorGUILayout.HelpBox(GameServiceModuleIntro, MessageType.Info); } else { #if UNITY_ANDROID && !EM_GPGS EditorGUILayout.Space(); EditorGUILayout.HelpBox(AndroidGPGSImportInstruction, MessageType.Error); EditorGUILayout.Space(); if (GUILayout.Button("Download Google Play Games Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EM_ExternalPluginManager.DownloadGooglePlayGamesPlugin(); } #elif UNITY_ANDROID && EM_GPGS EditorGUILayout.Space(); EditorGUILayout.HelpBox(AndroidGPGSAvailMsg, MessageType.Info); EditorGUILayout.Space(); if (GUILayout.Button("Download Google Play Games Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EM_ExternalPluginManager.DownloadGooglePlayGamesPlugin(); } // Android Google Play Games setup EditorGUILayout.Space(); EditorGUILayout.LabelField("GOOGLE PLAY GAMES SETUP", EditorStyles.boldLabel); // GPGPS debug log GameServiceProperties.gpgsDebugLog.property.boolValue = EditorGUILayout.Toggle(GameServiceProperties.gpgsDebugLog.content, GameServiceProperties.gpgsDebugLog.property.boolValue); // GPGS (optional) Web App Client ID. EditorGUILayout.Space(); EditorGUILayout.LabelField("Web App Client ID (Optional)", EditorStyles.boldLabel); EditorGUILayout.HelpBox("The web app client ID is needed to access the user's ID token and call other APIs on behalf of the user. It is not required for Game Services. " + "Enter your oauth2 client ID below. To obtain this ID, generate a web linked app in Developer Console.\n" + "Example: 123456789012-abcdefghijklm.apps.googleusercontent.com", MessageType.None); sGPGSWebClientId = EditorGUILayout.TextField("Web Client Id", sGPGSWebClientId); // Text area to input the Android Xml resource. EditorGUILayout.Space(); EditorGUILayout.LabelField(GameServiceProperties.gpgsXmlResources.content, EditorStyles.boldLabel); EditorGUILayout.HelpBox(AndroidGPGPSSetupInstruction, MessageType.None); // Draw text area inside a scroll view. androidResourcesTextAreaScroll = GUILayout.BeginScrollView(androidResourcesTextAreaScroll, false, false, GUILayout.Height(EditorGUIUtility.singleLineHeight * 10)); GameServiceProperties.gpgsXmlResources.property.stringValue = EditorGUILayout.TextArea( GameServiceProperties.gpgsXmlResources.property.stringValue, GUILayout.Height(EditorGUIUtility.singleLineHeight * 100), GUILayout.ExpandHeight(true)); EditorGUILayout.EndScrollView(); EditorGUILayout.Space(); // Replicate the "Setup" button within the Android GPGS setup window. if (GUILayout.Button("Setup Google Play Games", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EditorApplication.delayCall += SetupAndroidGPGSButtonHandler; } #endif #if !UNITY_ANDROID || (UNITY_ANDROID && EM_GPGS) // Auto-init config EditorGUILayout.Space(); EditorGUILayout.LabelField("AUTO-INIT CONFIG", EditorStyles.boldLabel); GameServiceProperties.autoInit.property.boolValue = EditorGUILayout.Toggle(GameServiceProperties.autoInit.content, GameServiceProperties.autoInit.property.boolValue); EditorGUI.BeginDisabledGroup(!GameServiceProperties.autoInit.property.boolValue); GameServiceProperties.autoInitDelay.property.floatValue = EditorGUILayout.FloatField(GameServiceProperties.autoInitDelay.content, GameServiceProperties.autoInitDelay.property.floatValue); EditorGUI.EndDisabledGroup(); GameServiceProperties.androidMaxLoginRequest.property.intValue = EditorGUILayout.IntField(GameServiceProperties.androidMaxLoginRequest.content, GameServiceProperties.androidMaxLoginRequest.property.intValue); if (!GameServiceProperties.autoInit.property.boolValue) { EditorGUILayout.Space(); EditorGUILayout.HelpBox(GameServiceManualInitInstruction, MessageType.Info); } // Saved Games config. #if EASY_MOBILE_PRO EditorGUILayout.Space(); EditorGUILayout.LabelField("SAVED GAMES CONFIG", EditorStyles.boldLabel); GameServiceProperties.enableSavedGames.property.boolValue = EditorGUILayout.Toggle(GameServiceProperties.enableSavedGames.content, GameServiceProperties.enableSavedGames.property.boolValue); if (GameServiceProperties.enableSavedGames.property.boolValue) { EditorGUILayout.PropertyField(GameServiceProperties.autoConflictResolutionStrategy.property, GameServiceProperties.autoConflictResolutionStrategy.content); EditorGUILayout.PropertyField(GameServiceProperties.gpgsDataSource.property, GameServiceProperties.gpgsDataSource.content); } #endif // Leaderboard setup. EditorGUILayout.Space(); EditorGUILayout.LabelField("LEADERBOARD SETUP", EditorStyles.boldLabel); DrawGameServiceItemArray("Leaderboard", GameServiceProperties.leaderboards, ref isLeadeboardsFoldout); // Achievement setup. EditorGUILayout.Space(); EditorGUILayout.LabelField("ACHIEVEMENT SETUP", EditorStyles.boldLabel); DrawGameServiceItemArray("Achievement", GameServiceProperties.achievements, ref isAchievementsFoldout); // Constant generation. EditorGUILayout.Space(); EditorGUILayout.LabelField("CONSTANTS GENERATION", EditorStyles.boldLabel); EditorGUILayout.HelpBox(GameServiceConstantGenerationIntro, MessageType.None); EditorGUILayout.Space(); if (GUILayout.Button("Generate Constants Class", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { GenerateGameServiceConstants(); } #endif } EditorGUILayout.EndVertical(); }
void IAPModuleGUI() { EditorGUILayout.BeginVertical(EM_GUIStyleManager.GetCustomStyle("Module Box")); EditorGUI.BeginChangeCheck(); isIAPModuleEnable.boolValue = EM_EditorGUI.ModuleToggle(isIAPModuleEnable.boolValue, IAPModuleLabel); if (EditorGUI.EndChangeCheck()) { GameObject prefab = EM_EditorUtil.GetMainPrefab(); if (!isIAPModuleEnable.boolValue) { EM_PluginManager.DisableIAPModule(prefab); } else { EM_PluginManager.EnableIAPModule(prefab); } } // Now draw the GUI. if (!isIAPModuleEnable.boolValue) { EditorGUILayout.Space(); EditorGUILayout.HelpBox(IAPModuleIntro, MessageType.Info); } else { #if !EM_UIAP EditorGUILayout.Space(); EditorGUILayout.HelpBox(UnityIAPEnableInstruction, MessageType.Error); #else // Select target Android store, like using the Window > Unity IAP > Android > Target ... menu item. EditorGUILayout.Space(); EditorGUILayout.LabelField("[ANDROID] TARGET STORE", EditorStyles.boldLabel); EditorGUI.BeginChangeCheck(); IAPProperties.targetAndroidStore.property.enumValueIndex = EditorGUILayout.Popup( IAPProperties.targetAndroidStore.content.text, IAPProperties.targetAndroidStore.property.enumValueIndex, IAPProperties.targetAndroidStore.property.enumDisplayNames ); if (EditorGUI.EndChangeCheck()) { SetTargetAndroidStore((IAPAndroidStore)IAPProperties.targetAndroidStore.property.enumValueIndex); } // Receipt validation EditorGUILayout.Space(); EditorGUILayout.LabelField("RECEIPT VALIDATION", EditorStyles.boldLabel); EditorGUILayout.HelpBox("Unity IAP offers local receipt validation for extra security. Apple stores and Google Play store only.", MessageType.None); // iOS store. EditorGUI.BeginDisabledGroup(!isAppleTangleValid); IAPProperties.validateAppleReceipt.property.boolValue = EditorGUILayout.Toggle(IAPProperties.validateAppleReceipt.content, IAPProperties.validateAppleReceipt.property.boolValue); EditorGUI.EndDisabledGroup(); // Always disable the option if AppleTangle is not valid. if (!isAppleTangleValid) { IAPProperties.validateAppleReceipt.property.boolValue = false; } // Google Play store. bool isTargetingGooglePlay = IAPProperties.targetAndroidStore.property.enumValueIndex == (int)IAPAndroidStore.GooglePlay; EditorGUI.BeginDisabledGroup(!isGooglePlayTangleValid); IAPProperties.validateGooglePlayReceipt.property.boolValue = EditorGUILayout.Toggle(IAPProperties.validateGooglePlayReceipt.content, IAPProperties.validateGooglePlayReceipt.property.boolValue); EditorGUI.EndDisabledGroup(); // Always disable the option if GooglePlayTangle is not valid. if (!isGooglePlayTangleValid) { IAPProperties.validateGooglePlayReceipt.property.boolValue = false; } if (!isAppleTangleValid || (!isGooglePlayTangleValid && isTargetingGooglePlay)) { string rvMsg = "Please go to Window > Unity IAP > IAP Receipt Validation Obfuscator and create obfuscated secrets to enable receipt validation for Apple stores and Google Play store."; if (!isAppleTangleValid) { rvMsg += " Note that you don't need to provide a Google Play public key if you're only targeting Apple stores."; } else { rvMsg = rvMsg.Replace("Apple stores and ", ""); } if (isGooglePlayTangleValid || !isTargetingGooglePlay) { rvMsg = rvMsg.Replace(" and Google Play store", ""); } EditorGUILayout.HelpBox(rvMsg, MessageType.Warning); } // Product list EditorGUILayout.Space(); EditorGUILayout.LabelField("PRODUCTS", EditorStyles.boldLabel); EMProperty products = IAPProperties.products; if (products.property.arraySize > 0) { EditorGUI.indentLevel++; isIAPProductsFoldout = EditorGUILayout.Foldout(isIAPProductsFoldout, products.property.arraySize + " " + products.content.text); EditorGUI.indentLevel--; if (isIAPProductsFoldout) { // Draw the array of IAP products. DrawArrayProperty(products.property, DrawIAPProduct); // Detect duplicate product names. string duplicateName = EM_EditorUtil.FindDuplicateFieldInArrayProperty(products.property, IAPProduct_NameProperty); if (!string.IsNullOrEmpty(duplicateName)) { EditorGUILayout.Space(); EditorGUILayout.HelpBox("Found duplicate name of \"" + duplicateName + "\".", MessageType.Warning); } } } else { EditorGUILayout.HelpBox("No products added.", MessageType.None); } EditorGUILayout.Space(); if (GUILayout.Button("Add New Product", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { // Add new IAP product. AddNewProduct(products.property); // Open the foldout if it's closed. isIAPProductsFoldout = true; } // Constant generation. EditorGUILayout.Space(); EditorGUILayout.LabelField("CONSTANTS GENERATION", EditorStyles.boldLabel); EditorGUILayout.HelpBox(IAPConstantGenerationIntro, MessageType.None); EditorGUILayout.Space(); if (GUILayout.Button("Generate Constants Class", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { GenerateIAPConstants(); } #endif } EditorGUILayout.EndVertical(); }
public override void OnInspectorGUI() { // Update the serializedProperty - always do this in the beginning of OnInspectorGUI. serializedObject.Update(); // Disable the UI when the editor is compiling. EditorGUI.BeginDisabledGroup(EditorApplication.isCompiling); // Not switching mode if the editor is compiling. if (!EditorApplication.isCompiling) { currentUIMode = isSelectingModule.boolValue ? UIMode.HomePage : UIMode.ModulePage; } /// Body. EditorGUILayout.Space(); if (currentUIMode == UIMode.HomePage) { scrollPos = GUILayout.BeginScrollView(scrollPos); DrawSelectModulePage(); GUILayout.EndScrollView(); } else { EditorGUILayout.BeginVertical(EM_GUIStyleManager.FullWidthBottomSeparatorBox); if (GUILayout.Button(new GUIContent("Back To Home", EM_GUIStyleManager.HomeIcon), EM_GUIStyleManager.GetCustomStyle("Module Back Button Text"))) { isSelectingModule.boolValue = true; } EditorGUILayout.EndVertical(); scrollPos = GUILayout.BeginScrollView(scrollPos); GetModuleDrawAction((Module)activeModuleIndex.intValue)(); GUILayout.EndScrollView(); } EditorGUI.EndDisabledGroup(); // Apply changes to the serializedProperty - always do this in the end of OnInspectorGUI. serializedObject.ApplyModifiedProperties(); }
// Draw leaderboard or achievement item. void DrawIAPProduct(SerializedProperty property, ref bool isDeleteButton, ref bool isMoveUpButton, ref bool isMoveDownButton, bool allowMoveUp = true, bool allowMoveDown = true) { // Get members. SerializedProperty name = property.FindPropertyRelative(IAPProduct_NameProperty); SerializedProperty type = property.FindPropertyRelative(IAPProduct_TypeProperty); SerializedProperty id = property.FindPropertyRelative(IAPProduct_IdProperty); SerializedProperty price = property.FindPropertyRelative(IAPProduct_PriceProperty); SerializedProperty description = property.FindPropertyRelative(IAPProduct_DescriptionProperty); SerializedProperty storeSpecificIds = property.FindPropertyRelative(IAPProduct_StoreSpecificIdsProperty); SerializedProperty isEditingAdvanced = property.FindPropertyRelative(IAPProduct_IsEditingAdvanced); EditorGUILayout.BeginHorizontal(); // Main content section. EditorGUILayout.BeginVertical(EM_GUIStyleManager.GetCustomStyle("Item Box")); // Required settings EditorGUILayout.LabelField(string.IsNullOrEmpty(name.stringValue) ? "New Product" : name.stringValue, EditorStyles.boldLabel); name.stringValue = EditorGUILayout.TextField(IAPProduct_NameContent, name.stringValue); type.enumValueIndex = EditorGUILayout.Popup(IAPProduct_TypeContent.text, type.enumValueIndex, type.enumDisplayNames); id.stringValue = EditorGUILayout.TextField(IAPProduct_IdContent, id.stringValue); // Advanced settings EditorGUI.indentLevel++; isEditingAdvanced.boolValue = EditorGUILayout.Foldout(isEditingAdvanced.boolValue, "More (Optional)"); if (isEditingAdvanced.boolValue) { price.stringValue = EditorGUILayout.TextField(IAPProduct_PriceContent, price.stringValue); description.stringValue = EditorGUILayout.TextField(IAPProduct_DescriptionContent, description.stringValue, EM_GUIStyleManager.WordwrapTextField, GUILayout.Height(EditorGUIUtility.singleLineHeight * 3)); // Store-specific Ids section. EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(IAPProduct_StoreSpecificIdsContent); EditorGUI.BeginChangeCheck(); storeSpecificIds.arraySize = EditorGUILayout.IntField(storeSpecificIds.arraySize, GUILayout.Width(50)); if (EditorGUI.EndChangeCheck()) { // Won't allow values larger than the number of available stores. int storeNum = System.Enum.GetNames(typeof(IAPStore)).Length; if (storeSpecificIds.arraySize > storeNum) { storeSpecificIds.arraySize = storeNum; } } EditorGUILayout.EndHorizontal(); for (int i = 0; i < storeSpecificIds.arraySize; i++) { SerializedProperty element = storeSpecificIds.GetArrayElementAtIndex(i); SerializedProperty specificStore = element.FindPropertyRelative(StoreSpecificIds_StoreProperty); SerializedProperty specificId = element.FindPropertyRelative(StoreSpecificIds_IdProperty); EditorGUILayout.BeginHorizontal(); specificStore.enumValueIndex = EditorGUILayout.Popup(specificStore.enumValueIndex, specificStore.enumDisplayNames); specificId.stringValue = EditorGUILayout.TextField(specificId.stringValue); EditorGUILayout.EndHorizontal(); } } EditorGUI.indentLevel--; EditorGUILayout.EndVertical(); // The toolbox section. EditorGUILayout.BeginVertical(EM_GUIStyleManager.GetCustomStyle("Tool Box"), GUILayout.Width(EM_GUIStyleManager.toolboxWidth), GUILayout.Height(EM_GUIStyleManager.toolboxHeight)); // Move up button. EditorGUI.BeginDisabledGroup(!allowMoveUp); if (GUILayout.Button(EM_Constants.UpSymbol, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true))) { isMoveUpButton = true; } EditorGUI.EndDisabledGroup(); // Delete button. if (GUILayout.Button(EM_Constants.DeleteSymbol, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true))) { // DeleteArrayElementAtIndex seems working fine even while iterating // through the array, but it's still a better idea to move it outside the loop. isDeleteButton = true; } // Move down button. EditorGUI.BeginDisabledGroup(!allowMoveDown); if (GUILayout.Button(EM_Constants.DownSymbol, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true))) { isMoveDownButton = true; } EditorGUI.EndDisabledGroup(); EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); }
bool DrawNotificationCategory(SerializedProperty prop) { var id = prop.FindPropertyRelative(NotificationCategory_Id); var groupId = prop.FindPropertyRelative(NotificationCategory_GroupId); var name = prop.FindPropertyRelative(NotificationCategory_Name); var description = prop.FindPropertyRelative(NotificationCategory_Description); var importance = prop.FindPropertyRelative(NotificationCategory_Importance); var enableBadge = prop.FindPropertyRelative(NotificationCategory_EnableBadge); var lights = prop.FindPropertyRelative(NotificationCategory_Lights); var lightColor = prop.FindPropertyRelative(NotificationCategory_LightColor); var vibration = prop.FindPropertyRelative(NotificationCategory_Vibration); var vibrationPattern = prop.FindPropertyRelative(NotificationCategory_VibrationPattern); var lockScreenVisibility = prop.FindPropertyRelative(NotificationCategory_LockScreenVisibility); var sound = prop.FindPropertyRelative(NotificationCategory_Sound); var soundName = prop.FindPropertyRelative(NotificationCategory_SoundName); var actionButtons = prop.FindPropertyRelative(NotificationCategory_ActionButtons); EditorGUILayout.BeginVertical(EM_GUIStyleManager.GetCustomStyle("Item Box")); string key = prop.propertyPath; if (!notificationFoldoutStates.ContainsKey(key)) { notificationFoldoutStates.Add(key, false); } string foldoutLabel = string.IsNullOrEmpty(name.stringValue) ? "[Untitled Category]" : name.stringValue; EditorGUI.indentLevel++; notificationFoldoutStates[key] = EditorGUILayout.Foldout(notificationFoldoutStates[key], foldoutLabel, true); if (notificationFoldoutStates[key]) { EditorGUILayout.Space(); EditorGUILayout.PropertyField(name); EditorGUILayout.PropertyField(id); EditorGUILayout.PropertyField(description); // Dispaly group IDs as a drop down. DrawNotificationCategoryGroupId(groupId); EditorGUILayout.PropertyField(enableBadge); EditorGUILayout.PropertyField(importance); EditorGUILayout.PropertyField(lights); if (lights.enumValueIndex == (int)NotificationCategory.LightOptions.Custom) { EditorGUILayout.PropertyField(lightColor); } EditorGUILayout.PropertyField(vibration); if (vibration.enumValueIndex == (int)NotificationCategory.VibrationOptions.Custom) { DrawNotificationVibrationPattern(vibrationPattern); } EditorGUILayout.PropertyField(lockScreenVisibility); EditorGUILayout.PropertyField(sound); if (sound.enumValueIndex == (int)NotificationCategory.SoundOptions.Custom) { EditorGUILayout.PropertyField(soundName); } // Action buttons. DrawNotificationActionButtonsArray(actionButtons); } EditorGUI.indentLevel--; EditorGUILayout.EndVertical(); return(notificationFoldoutStates[key]); }
void NotificationModuleGUI() { EditorGUILayout.BeginVertical(EM_GUIStyleManager.GetCustomStyle("Module Box")); EditorGUI.BeginChangeCheck(); isNotificationModuleEnable.boolValue = EM_EditorGUI.ModuleToggle(isNotificationModuleEnable.boolValue, NotificationModuleLabel); if (EditorGUI.EndChangeCheck()) { // Update the main prefab according to the toggle state. GameObject prefab = EM_EditorUtil.GetMainPrefab(); if (!isNotificationModuleEnable.boolValue) { EM_PluginManager.DisableNotificationModule(prefab); } else { EM_PluginManager.EnableNotificationModule(prefab); } } // Now draw the GUI. if (!isNotificationModuleEnable.boolValue) { EditorGUILayout.Space(); EditorGUILayout.HelpBox(NotificationModuleIntro, MessageType.Info); } else { // Initialization setup EditorGUILayout.Space(); EditorGUILayout.LabelField("AUTO-INIT CONFIG", EditorStyles.boldLabel); NotificationProperties.autoInit.property.boolValue = EditorGUILayout.Toggle(NotificationProperties.autoInit.content, NotificationProperties.autoInit.property.boolValue); // Auto init delay EditorGUI.BeginDisabledGroup(!NotificationProperties.autoInit.property.boolValue); NotificationProperties.autoInitDelay.property.floatValue = EditorGUILayout.FloatField(NotificationProperties.autoInitDelay.content, NotificationProperties.autoInitDelay.property.floatValue); EditorGUI.EndDisabledGroup(); // Init tip if (!NotificationProperties.autoInit.property.boolValue) { EditorGUILayout.Space(); EditorGUILayout.HelpBox(NotificationManualInitInstruction, MessageType.Info); } //-------------------------------------------------------------- // Uncomment to expose the iOSAuthOptions setting. //-------------------------------------------------------------- /* * // iOS authorization options * EditorGUILayout.PropertyField(NotificationProperties.iosAuthOptions.property, NotificationProperties.iosAuthOptions.content); */ // Remote notification setup EditorGUILayout.Space(); EditorGUILayout.LabelField("REMOTE NOTIFICATION SETUP", EditorStyles.boldLabel); // Push Notification Service EditorGUILayout.PropertyField(NotificationProperties.pushNotificationService.property, NotificationProperties.pushNotificationService.content); // If using OneSignal... if (NotificationProperties.pushNotificationService.property.enumValueIndex == (int)PushNotificationProvider.OneSignal) { #if !EM_ONESIGNAL EditorGUILayout.Space(); EditorGUILayout.HelpBox(OneSignalImportInstruction, MessageType.Error); EditorGUILayout.Space(); if (GUILayout.Button("Download OneSignal Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EM_ExternalPluginManager.DownloadOneSignalPlugin(); } #else EditorGUILayout.Space(); EditorGUILayout.HelpBox(OneSignalAvailMsg, MessageType.Info); EditorGUILayout.Space(); if (GUILayout.Button("Download OneSignal Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EM_ExternalPluginManager.DownloadOneSignalPlugin(); } // OneSignal setup EditorGUILayout.Space(); NotificationProperties.oneSignalAppId.property.stringValue = EditorGUILayout.TextField(NotificationProperties.oneSignalAppId.content, NotificationProperties.oneSignalAppId.property.stringValue); #endif } // Android Resources Setup EditorGUILayout.Space(); EditorGUILayout.LabelField("ANDROID NOTIFICATION RESOURCES", EditorStyles.boldLabel); EditorGUILayout.HelpBox(NotificationAndroidResourcesIntro, MessageType.None); EditorGUILayout.Space(); if (GUILayout.Button("Open Android Notification Icon Generator", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { Application.OpenURL(NotificationAndroidIconGeneratorUrl); } if (GUILayout.Button("Import Res Folder", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EditorApplication.delayCall += ImportAndroidNotificationResFolder; } // Category groups EditorGUILayout.Space(); EditorGUILayout.LabelField("CATEGORY GROUPS", EditorStyles.boldLabel); DrawNotificationCategoryGroupsArray(NotificationProperties.categoryGroups, ref notificationIsCategoryGroupsFoldout); // Update the list of category group IDs. notificationCatGroupIDs = BuildListOfNotificationCategoryGroupIDs(); // Categories EditorGUILayout.Space(); EditorGUILayout.LabelField("CATEGORIES", EditorStyles.boldLabel); EditorGUILayout.HelpBox(NotificationCategoryIntro, MessageType.Info); // Draw the default category EditorGUILayout.LabelField("Default Category", EditorStyles.boldLabel); EditorGUILayout.HelpBox(NotificationDefaultCategoryIntro, MessageType.None); DrawNotificationCategory(NotificationProperties.defaultCategory.property); if (string.IsNullOrEmpty(EM_Settings.Notifications.DefaultCategory.name) || string.IsNullOrEmpty(EM_Settings.Notifications.DefaultCategory.id)) { EditorGUILayout.HelpBox("Default category must have non-empty name and ID.", MessageType.Warning); } else { foreach (var category in EM_Settings.Notifications.UserCategories) { if (!string.IsNullOrEmpty(category.id) && category.id.Equals(EM_Settings.Notifications.DefaultCategory.id)) { EditorGUILayout.HelpBox("Default category cannot share the same ID " + category.id + " with another user category.", MessageType.Warning); break; } } } // Draw user categories EditorGUILayout.LabelField("User Categories", EditorStyles.boldLabel); DrawNotificationCategoriesArray(NotificationProperties.userCategories, ref notificationIsUserCategoriesFoldout); // Constant generation. EditorGUILayout.Space(); EditorGUILayout.LabelField("CONSTANTS GENERATION", EditorStyles.boldLabel); EditorGUILayout.HelpBox(NotificationConstantGenerationIntro, MessageType.None); EditorGUILayout.Space(); if (GUILayout.Button("Generate Constants Class", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { GenerateNotificationConstants(); } } EditorGUILayout.EndVertical(); }
public static void HeaderLabel(string text) { EditorGUILayout.LabelField(text, EM_GUIStyleManager.GetCustomStyle("Header Label"), GUILayout.Height(26)); }
// Draw leaderboard or achievement item. void DrawGameServiceItem(string label, SerializedProperty property, string[] gpgsIds, ref bool isDeleteButton, ref bool isMoveUpButton, ref bool isMoveDownButton, bool allowMoveUp = true, bool allowMoveDown = true) { SerializedProperty name = property.FindPropertyRelative(GameServiceItem_NameProperty); SerializedProperty iosId = property.FindPropertyRelative(GameServiceItem_IOSIdProperty); SerializedProperty androidId = property.FindPropertyRelative(GameServiceItem_AndroidIdProperty); EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginVertical(EM_GUIStyleManager.GetCustomStyle("Item Box")); EditorGUILayout.LabelField(string.IsNullOrEmpty(name.stringValue) ? "New " + label : name.stringValue, EditorStyles.boldLabel); name.stringValue = EditorGUILayout.TextField("Name", name.stringValue); iosId.stringValue = EditorGUILayout.TextField("iOS Id", iosId.stringValue); // For Android Id, display a popup of Android leaderboards & achievements for the user to select // then assign its associated id to the property. EditorGUI.BeginChangeCheck(); int currentIndex = Mathf.Max(System.Array.IndexOf(gpgsIds, GetNameFromId(gpgsIdDict, androidId.stringValue)), 0); int newIndex = EditorGUILayout.Popup("Android Id", currentIndex, gpgsIds); if (EditorGUI.EndChangeCheck()) { // Position 0 is [None]. if (newIndex == 0) { androidId.stringValue = string.Empty; } else { // Record the new android Id. string newName = gpgsIds[newIndex]; androidId.stringValue = gpgsIdDict[newName]; } } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(EM_GUIStyleManager.GetCustomStyle("Tool Box"), GUILayout.Width(EM_GUIStyleManager.toolboxWidth), GUILayout.Height(EM_GUIStyleManager.toolboxHeight)); // Move up button. EditorGUI.BeginDisabledGroup(!allowMoveUp); if (GUILayout.Button(EM_Constants.UpSymbol, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true))) { isMoveUpButton = true; } EditorGUI.EndDisabledGroup(); // Delete button. if (GUILayout.Button(EM_Constants.DeleteSymbol, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true))) { // DeleteArrayElementAtIndex seems working fine even while iterating // through the array, but it's still a better idea to move it outside the loop. isDeleteButton = true; } // Move down button. EditorGUI.BeginDisabledGroup(!allowMoveDown); if (GUILayout.Button(EM_Constants.DownSymbol, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true))) { isMoveDownButton = true; } EditorGUI.EndDisabledGroup(); EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); }
private void DrawNavigationHeader() { if (CanGoBack) { if (GUILayout.Button(new GUIContent("Back To Root Element", EM_GUIStyleManager.HomeIcon), EM_GUIStyleManager.GetCustomStyle("Module Back Button Text"))) { EditingElement = ManifestElement; } } GUIStyle titleStyle = new GUIStyle(EditorStyles.centeredGreyMiniLabel) { fontSize = miniButtonSize }; string navigationTitle = EditingElement.Style.ToAndroidManifestFormat().ToUpperInvariant(); EditorGUILayout.LabelField(navigationTitle, titleStyle, GUILayout.MinHeight(40)); }
void NotificationModuleGUI() { EditorGUILayout.BeginVertical(EM_GUIStyleManager.GetCustomStyle("Module Box")); EditorGUI.BeginChangeCheck(); isNotificationModuleEnable.boolValue = EM_EditorGUI.ModuleToggle(isNotificationModuleEnable.boolValue, NotificationModuleLabel); if (EditorGUI.EndChangeCheck()) { // Update the main prefab according to the toggle state. GameObject prefab = EM_EditorUtil.GetMainPrefab(); if (!isNotificationModuleEnable.boolValue) { EM_Manager.DisableNotificationModule(prefab); } else { EM_Manager.EnableNotificationModule(prefab); } } // Now draw the GUI. if (!isNotificationModuleEnable.boolValue) { EditorGUILayout.Space(); EditorGUILayout.HelpBox(NotificationModuleIntro, MessageType.Info); } else { #if !EM_ONESIGNAL EditorGUILayout.Space(); EditorGUILayout.HelpBox(OneSignalImportInstruction, MessageType.Error); EditorGUILayout.Space(); if (GUILayout.Button("Download OneSignal Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EM_ExternalPluginManager.DownloadOneSignalPlugin(); } #else EditorGUILayout.Space(); EditorGUILayout.HelpBox(OneSignalAvailMsg, MessageType.Info); EditorGUILayout.Space(); if (GUILayout.Button("Download OneSignal Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EM_ExternalPluginManager.DownloadOneSignalPlugin(); } // OneSignal setup EditorGUILayout.Space(); EditorGUILayout.LabelField("ONESIGNAL SETUP", EditorStyles.boldLabel); NotificationProperties.oneSignalAppId.property.stringValue = EditorGUILayout.TextField(NotificationProperties.oneSignalAppId.content, NotificationProperties.oneSignalAppId.property.stringValue); // Auto-init setup EditorGUILayout.Space(); EditorGUILayout.LabelField("AUTO-INIT CONFIG", EditorStyles.boldLabel); NotificationProperties.autoInit.property.boolValue = EditorGUILayout.Toggle(NotificationProperties.autoInit.content, NotificationProperties.autoInit.property.boolValue); // Auto init delay EditorGUI.BeginDisabledGroup(!NotificationProperties.autoInit.property.boolValue); NotificationProperties.autoInitDelay.property.floatValue = EditorGUILayout.FloatField(NotificationProperties.autoInitDelay.content, NotificationProperties.autoInitDelay.property.floatValue); EditorGUI.EndDisabledGroup(); // Init tip if (!NotificationProperties.autoInit.property.boolValue) { EditorGUILayout.Space(); EditorGUILayout.HelpBox(NotificationManualInitInstruction, MessageType.Info); } #endif } EditorGUILayout.EndVertical(); }
private void DrawUppercaseSection(string key, string sectionName, Action drawer, Action disableModule, Action enableModule, SerializedProperty triggerProperty, Texture2D sectionIcon = null, bool defautFoldout = true) { if (!uppercaseSectionsFoldoutStates.ContainsKey(key)) { uppercaseSectionsFoldoutStates.Add(key, defautFoldout); } bool foldout = uppercaseSectionsFoldoutStates[key]; EditorGUILayout.BeginVertical(EM_GUIStyleManager.GetCustomStyle("Uppercase Section Box"), GUILayout.MinHeight(foldout ? 30 : 0)); EditorGUILayout.BeginHorizontal(foldout ? EM_GUIStyleManager.UppercaseSectionHeaderExpand : EM_GUIStyleManager.UppercaseSectionHeaderCollapse); // Header icon. EditorGUILayout.LabelField(new GUIContent(sectionIcon ?? EM_GUIStyleManager.UppercaseSectionHeaderIcon), EM_GUIStyleManager.GetCustomStyle("Uppercase Section Header Icon"), GUILayout.Width(DefaultSectionHeaderIconWidth), GUILayout.Height(DefaultSectionHeaderIconHeight)); // Header label (and button). if (GUILayout.Button(sectionName, EM_GUIStyleManager.GetCustomStyle("Uppercase Section Header Label"))) { uppercaseSectionsFoldoutStates[key] = !uppercaseSectionsFoldoutStates[key]; } // The expand/collapse icon. var buttonRect = GUILayoutUtility.GetLastRect(); var iconRect = new Rect(buttonRect.x + buttonRect.width - ChevronIconWidth - ChevronIconRightMargin, buttonRect.y, ChevronIconWidth, buttonRect.height); GUI.Label(iconRect, GetChevronIcon(foldout), EM_GUIStyleManager.GetCustomStyle("Uppercase Section Header Chevron")); /// Draw toggle. Rect toggleRect = Rect.zero; EditorGUI.BeginChangeCheck(); if (triggerProperty != null) { triggerProperty.boolValue = EM_EditorGUI.ModuleToggle(triggerProperty.boolValue, name); if (EditorGUI.EndChangeCheck()) { if (triggerProperty.boolValue) { enableModule(); } else { disableModule(); } } toggleRect = GUILayoutUtility.GetLastRect(); } EditorGUILayout.EndHorizontal(); // Draw the section content. if (foldout) { GUILayout.Space(5); } if (foldout && drawer != null) { drawer(); } EditorGUILayout.EndVertical(); }
private GUIStyle GetSectionStyle(Section section) { return(section != activeSection?EM_GUIStyleManager.GetCustomStyle("Tab Label") : EM_GUIStyleManager.GetCustomStyle("Tab Label Selected")); }
void GameServiceModuleGUI() { EditorGUILayout.BeginVertical(EM_GUIStyleManager.GetCustomStyle("Module Box")); EditorGUI.BeginChangeCheck(); isGameServiceModuleEnable.boolValue = EM_EditorGUI.ModuleToggle(isGameServiceModuleEnable.boolValue, GameServiceModuleLabel); // Update the main prefab according to the toggle state. if (EditorGUI.EndChangeCheck()) { GameObject prefab = EM_EditorUtil.GetMainPrefab(); if (!isGameServiceModuleEnable.boolValue) { EM_Manager.DisableGameServiceModule(prefab); } else { EM_Manager.EnableGameServiceModule(prefab); } } // Now draw the GUI. if (!isGameServiceModuleEnable.boolValue) { EditorGUILayout.Space(); EditorGUILayout.HelpBox(GameServiceModuleIntro, MessageType.Info); } else { #if UNITY_ANDROID && !EM_GPGS EditorGUILayout.Space(); EditorGUILayout.HelpBox(AndroidGPGSImportInstruction, MessageType.Error); EditorGUILayout.Space(); if (GUILayout.Button("Download Google Play Games Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EM_ExternalPluginManager.DownloadGooglePlayGamesPlugin(); } #elif UNITY_ANDROID && EM_GPGS EditorGUILayout.Space(); EditorGUILayout.HelpBox(AndroidGPGSAvailMsg, MessageType.Info); EditorGUILayout.Space(); if (GUILayout.Button("Download Google Play Games Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EM_ExternalPluginManager.DownloadGooglePlayGamesPlugin(); } // Android Google Play Games setup EditorGUILayout.Space(); EditorGUILayout.LabelField("[ANDROID] GOOGLE PLAY GAMES SETUP", EditorStyles.boldLabel); // GPGPS debug log GameServiceProperties.gpgsDebugLog.property.boolValue = EditorGUILayout.Toggle(GameServiceProperties.gpgsDebugLog.content, GameServiceProperties.gpgsDebugLog.property.boolValue); // Text area to input the Android resource. EditorGUILayout.Space(); EditorGUILayout.HelpBox(AndroidGPGPSSetupInstruction, MessageType.None); EditorGUILayout.LabelField(GameServiceProperties.androidXmlResources.content, EditorStyles.boldLabel); // Draw text area inside a scroll view. androidResourcesTextAreaScroll = GUILayout.BeginScrollView(androidResourcesTextAreaScroll, false, false, GUILayout.Height(EditorGUIUtility.singleLineHeight * 10)); GameServiceProperties.androidXmlResources.property.stringValue = EditorGUILayout.TextArea( GameServiceProperties.androidXmlResources.property.stringValue, GUILayout.Height(EditorGUIUtility.singleLineHeight * 100), GUILayout.ExpandHeight(true)); EditorGUILayout.EndScrollView(); EditorGUILayout.Space(); // Replicate the "Setup" button within the Android GPGS setup window. if (GUILayout.Button("Setup Google Play Games", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { string webClientId = null; // Web ClientId, not required for Games Services. string folder = EM_Constants.GeneratedFolder; // Folder to contain the generated id constant class. string className = EM_Constants.AndroidGPGSConstantClassName; // Name of the generated id constant class. string resourceXmlData = GameServiceProperties.androidXmlResources.property.stringValue; // The xml resources inputted. string nearbySvcId = null; // Nearby Connection Id, not supported by us. bool requiresGooglePlus = false; // Not required Google+ API. try { if (GPGSUtil.LooksLikeValidPackageName(className)) { SetupAndroidGPGS(webClientId, folder, className, resourceXmlData, nearbySvcId, requiresGooglePlus); } } catch (System.Exception e) { GPGSUtil.Alert( GPGSStrings.Error, "Invalid classname: " + e.Message); } } #endif #if !UNITY_ANDROID || (UNITY_ANDROID && EM_GPGS) // Auto-init config EditorGUILayout.Space(); EditorGUILayout.LabelField("AUTO-INIT CONFIG", EditorStyles.boldLabel); GameServiceProperties.autoInit.property.boolValue = EditorGUILayout.Toggle(GameServiceProperties.autoInit.content, GameServiceProperties.autoInit.property.boolValue); EditorGUI.BeginDisabledGroup(!GameServiceProperties.autoInit.property.boolValue); GameServiceProperties.autoInitDelay.property.floatValue = EditorGUILayout.FloatField(GameServiceProperties.autoInitDelay.content, GameServiceProperties.autoInitDelay.property.floatValue); EditorGUI.EndDisabledGroup(); GameServiceProperties.androidMaxLoginRequest.property.intValue = EditorGUILayout.IntField(GameServiceProperties.androidMaxLoginRequest.content, GameServiceProperties.androidMaxLoginRequest.property.intValue); if (!GameServiceProperties.autoInit.property.boolValue) { EditorGUILayout.Space(); EditorGUILayout.HelpBox(GameServiceManualInitInstruction, MessageType.Info); } // Leaderboard setup. EditorGUILayout.Space(); EditorGUILayout.LabelField("LEADERBOARD SETUP", EditorStyles.boldLabel); DrawGameServiceItemArray("Leaderboard", GameServiceProperties.leaderboards, ref isLeadeboardsFoldout); // Achievement setup. EditorGUILayout.Space(); EditorGUILayout.LabelField("ACHIEVEMENT SETUP", EditorStyles.boldLabel); DrawGameServiceItemArray("Achievement", GameServiceProperties.achievements, ref isAchievementsFoldout); // Constant generation. EditorGUILayout.Space(); EditorGUILayout.LabelField("CONSTANTS CLASS GENERATION", EditorStyles.boldLabel); EditorGUILayout.HelpBox(GameServiceConstantGenerationIntro, MessageType.None); EditorGUILayout.Space(); if (GUILayout.Button("Generate Constants Class", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { GenerateGameServiceConstants(); } #endif } EditorGUILayout.EndVertical(); }