public override void OnEnable() { //Prepare a string array of the names of existing leaderboards (and achievements). gsConstsDict = EM_EditorUtil.GetGameServiceConstants(); gsConsts = new string[gsConstsDict.Count + 1]; gsConsts[0] = EM_Constants.NoneSymbol; gsConstsDict.Keys.CopyTo(gsConsts, 1); }
public override void OnEnable() { _action = (InAppPurchasing_GetProductData)target; //Prepare a string array of the names of existing products. iapConstsDict = EM_EditorUtil.GetIAPConstants(); iapConsts = new string[iapConstsDict.Count + 1]; iapConsts[0] = EM_Constants.NoneSymbol; iapConstsDict.Keys.CopyTo(iapConsts, 1); }
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); }
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); }