protected bool EditSelectItemField(string fieldDisplayName, FsmString field)
        {
            if (iapConsts.Length == 1)
            {
                EditorGUILayout.HelpBox("No product found. Please open EasyMobile settings to create some products and " +
                                        "generate the IAPConstants class to select from the product list.", MessageType.Error);
            }

            EditorGUI.BeginChangeCheck();

            int currentIndex = 0;

            if (field != null)
            {
                currentIndex = Mathf.Max(System.Array.IndexOf(iapConsts, EM_EditorUtil.GetKeyForValue(iapConstsDict, field.Value)), 0);
            }
            else
            {
                field = string.Empty;
            }

            int newIndex = EditorGUILayout.Popup(fieldDisplayName, currentIndex, iapConsts);

            if (EditorGUI.EndChangeCheck())
            {
                // Position 0 is [None].
                if (newIndex == 0)
                {
                    field.Value = string.Empty;
                }
                else
                {
                    field.Value = iapConstsDict[iapConsts[newIndex]];
                }
            }

            return(GUI.changed);
        }
Exemplo n.º 2
0
        protected bool EditSelectItemField(string fieldDisplayName, FsmString field)
        {
            if (gsConsts.Length == 1)
            {
                EditorGUILayout.HelpBox("No leaderboard/achievement found. Please open EasyMobile settings to create them and " +
                                        "generate the GameServiceConstants class to use this action.", MessageType.Error);
            }

            EditorGUI.BeginChangeCheck();

            int currentIndex = 0;

            if (field != null)
            {
                currentIndex = Mathf.Max(System.Array.IndexOf(gsConsts, EM_EditorUtil.GetKeyForValue(gsConstsDict, field.Value)), 0);
            }
            else
            {
                field = string.Empty;
            }

            int newIndex = EditorGUILayout.Popup(fieldDisplayName, currentIndex, gsConsts);

            if (EditorGUI.EndChangeCheck())
            {
                // Position 0 is [None].
                if (newIndex == 0)
                {
                    field.Value = string.Empty;
                }
                else
                {
                    field.Value = gsConstsDict[gsConsts[newIndex]];
                }
            }

            return(GUI.changed);
        }