public static void CheckTarget(OnlineMaps api, OnlineMapsTarget target, ref bool dirty) { if (api == null) { return; } if (api.target == target) { return; } EditorGUILayout.BeginVertical(GUI.skin.box); string targetName = Enum.GetName(typeof(OnlineMapsTarget), target); targetName = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(targetName); EditorGUILayout.HelpBox("Problem detected:\nWrong target.\nFor this control target must be " + targetName + "!", MessageType.Error); if (GUILayout.Button("Fix Target")) { api.target = target; dirty = true; } EditorGUILayout.EndVertical(); }
public static void CheckTarget(OnlineMaps api, OnlineMapsTarget target) { if (api == null) return; if (api.target == target) return; EditorGUILayout.BeginVertical(GUI.skin.box); string targetName = Enum.GetName(typeof(OnlineMapsTarget), target); targetName = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(targetName); EditorGUILayout.HelpBox("Problem detected:\nWrong target.\nFor this control target must be " + targetName + "!", MessageType.Error); if (GUILayout.Button("Fix Target")) api.target = target; EditorGUILayout.EndVertical(); }
private void DrawTargetGUI(ref bool dirty) { EditorGUI.BeginDisabledGroup(isPlay); OnlineMapsTarget mapTarget = api.target; api.target = (OnlineMapsTarget)EditorGUILayout.EnumPopup(new GUIContent("Target:", "Where will be drawn map"), api.target); if (mapTarget != api.target) { dirty = true; } if (api.target == OnlineMapsTarget.texture) { Texture2D texture = api.texture; api.texture = (Texture2D)EditorGUILayout.ObjectField("Texture: ", api.texture, typeof(Texture2D), true); if (texture != api.texture) { if (api.texture != null && (!Mathf.IsPowerOfTwo(api.texture.width) || !Mathf.IsPowerOfTwo(api.texture.height))) { EditorUtility.DisplayDialog("Error", "Texture width and height must be power of two!!!", "OK"); api.texture = texture; } else { CheckAPITextureImporter(api.texture); } dirty = true; } } else if (api.target == OnlineMapsTarget.tileset) { DrawTilesetPropsGUI(ref dirty); } EditorGUI.EndDisabledGroup(); }
/// <summary> /// Constructor /// </summary> /// <param name="resultType">Result type</param> public OnlineMapsWizardControlHelperAttribute(OnlineMapsTarget resultType) { this.resultType = resultType; }