private ObjectField ( |
||
label | ||
obj | Object | |
objType | ||
Résultat | Object |
bool ShowTreePrototype(TreePrototype treePrototype, int id) { bool removeThis = false; EGL.BeginVertical(GuiUtils.Skin.box); { GUILayout.Label(id.ToString() + ". " + (treePrototype.prefab != null ? treePrototype.prefab.name : "")); EGL.BeginHorizontal(); { treePrototype.prefab = EGL.ObjectField(treePrototype.prefab, typeof(GameObject), false) as GameObject; EGL.BeginVertical(); { treePrototype.bendFactor = EGL.FloatField("Bend Factor", treePrototype.bendFactor); } EGL.EndVertical(); if (GUILayout.Button("Remove", GUILayout.Width(64f), GUILayout.Height(64f))) { removeThis = true; } } EGL.EndHorizontal(); } EGL.EndVertical(); return(removeThis); }
void OnGUI() { EGL.LabelField("Use Settings"); settings = (ImportSettings)EGL.ObjectField(settings, typeof(ImportSettings), false); EGL.Space(); if (settings && CenteredButton("OK")) { foreach (var path in paths) { var instance = ScriptableObject.CreateInstance <ImportSettingsReference>(); instance.settings = settings; Directory.CreateDirectory(Path.GetDirectoryName(path)); AssetDatabase.CreateAsset(instance, path); } finishedAction(settings); this.Close(); } if (CenteredButton("Cancel")) { this.Close(); } }
private void OnGUI() { EGL.LabelField("Use Settings"); settings = EGL.ObjectField(settings, typeof(ImportSettings), false) as ImportSettings; EGL.Space(); if (settings && CenteredButton("OK")) { var reference = new MetaSpriteImportData { metaSpriteSettingsGuid = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(settings)) }; foreach (var path in assetPaths) { var import = AssetImporter.GetAtPath(path); import.userData = JsonUtility.ToJson(reference); import.SaveAndReimport(); } finishedAction(settings); this.Close(); } if (CenteredButton("Cancel")) { this.Close(); } }
void updateShopItems() { for (int i = 0; i <= (vars.characters.Count - 1); i++) { GL.Label("Character " + (i + 1) + " options:", EditorStyles.boldLabel); BV(); GL.Label("Sprite1 for Open Eye / Sprite2 for Close Eye ", EditorStyles.boldLabel); BH(); vars.characters[i].gameCharacterSprite1 = EGL.ObjectField("Game Character sprite1", vars.characters[i].gameCharacterSprite1, typeof(Sprite), false) as Sprite; vars.characters[i].gameCharacterSprite2 = EGL.ObjectField("Game Character sprite2", vars.characters[i].gameCharacterSprite2, typeof(Sprite), false) as Sprite; EH(); BH(); vars.characters[i].shopCharacterSprite = EGL.ObjectField("Shop Character sprite", vars.characters[i].shopCharacterSprite, typeof(Sprite), false) as Sprite; EH(); BH(); vars.characters[i].characterName = EGL.TextField("Character name", vars.characters[i].characterName); if (i != 0) { vars.characters[i].characterPrice = EGL.IntField("Character price", vars.characters[i].characterPrice); } EH(); EV(); separator(); } }
/* TODO: Show the below struct editors using standard inspector drawing tools */ bool ShowSplatPrototype(SplatPrototype splatPrototype, int id) { bool removeThis = false; EGL.BeginVertical(GuiUtils.Skin.box); { GUILayout.Label(id.ToString() + ". " + (splatPrototype.texture != null ? splatPrototype.texture.name : "")); EGL.BeginHorizontal(); { splatPrototype.texture = EGL.ObjectField(splatPrototype.texture, typeof(Texture2D), false, GUILayout.Width(64f), GUILayout.Height(64f)) as Texture2D; EGL.BeginVertical(); { splatPrototype.tileOffset = EGL.Vector2Field("Tile Offset", splatPrototype.tileOffset); splatPrototype.tileSize = EGL.Vector2Field("Tile Size", splatPrototype.tileSize); } EGL.EndVertical(); if (GUILayout.Button("Remove", GUILayout.Width(64f), GUILayout.Height(64f))) { removeThis = true; } } EGL.EndHorizontal(); } EGL.EndVertical(); return(removeThis); }
private void TextureGUI() { data.curve = UGL.CurveField(data.curve); int?toRemove = null; for (int i = 0; i < data.textureNames.Count; i++) { UGL.BeginHorizontal(); data.textureNames[i] = UGL.DelayedTextField(data.textureNames[i], GUILayout.MaxWidth(Screen.width)); GUILayout.FlexibleSpace(); Texture2D oldVal = i < data.textures.Count ? data.textures[i]: null; Texture2D newVal = (Texture2D)UGL.ObjectField("", oldVal, typeof(Texture2D), true, GUILayout.Width(100)); UGL.BeginVertical(); if (GUILayout.Button("Set As Curve", GUILayout.Width(100))) { Texture2D text = new Texture2D(100, 1); for (int j = 0; j < text.width; j++) { float sample = data.curve.Evaluate((float)j / text.width); text.SetPixel(j, 0, new Color(sample, sample, sample)); } text.Apply(); if (text != oldVal) { string path = AssetDatabase.GetAssetPath(data); AssetDatabase.AddObjectToAsset(text, path); newVal = text; } } GUI.color = Color.red; if (GUILayout.Button("-", GUILayout.Width(100))) { toRemove = i; } UGL.EndVertical(); GUI.color = Color.white; if (oldVal != newVal) { if (!data.textures.Contains(oldVal)) { data.textures.Add(newVal); } else { data.textures[data.textures.IndexOf(oldVal)] = newVal; } } UGL.EndHorizontal(); } if (toRemove != null) { data.textureNames.RemoveAt((int)toRemove); } }
public override void OnInspectorGUI() { GUI.enabled = false; EGL.ObjectField("Controller", ((TransitionProfile)target).controller, typeof(AnimatorController), false); GUI.enabled = true; if (GUILayout.Button("Edit", GUILayout.MaxWidth(150))) { var instance = EditorWindow.GetWindow <TransitionProfileEditor>(); instance.titleContent = new GUIContent("Transition Prof."); instance.BeginEdit((TransitionProfile)target); } }
bool ShowDetailPrototype(DetailPrototype prototype, int id) { bool removeThis = false; EGL.BeginVertical(GuiUtils.Skin.box); { EGL.BeginHorizontal(); { EGL.BeginVertical(); { prototype.usePrototypeMesh = EGL.Toggle("Use Mesh", prototype.usePrototypeMesh); prototype.prototype = EGL.ObjectField(prototype.prototype, typeof(GameObject), false) as GameObject; prototype.prototypeTexture = EGL.ObjectField(prototype.prototypeTexture, typeof(Texture2D), false, GUILayout.Width(64f), GUILayout.Height(64f)) as Texture2D; } EGL.EndVertical(); EGL.BeginVertical(); { prototype.bendFactor = EGL.FloatField("Bend Factor", prototype.bendFactor); prototype.dryColor = EGL.ColorField("Dry Color", prototype.dryColor); prototype.healthyColor = EGL.ColorField("Healthy Color", prototype.healthyColor); prototype.maxHeight = EGL.FloatField("Max Height", prototype.maxHeight); prototype.minHeight = EGL.FloatField("Min Height", prototype.minHeight); prototype.maxWidth = EGL.FloatField("Max Width", prototype.maxWidth); prototype.minWidth = EGL.FloatField("Min Width", prototype.minWidth); prototype.noiseSpread = EGL.FloatField("Noise Spread", prototype.noiseSpread); prototype.renderMode = (DetailRenderMode)EGL.EnumPopup("Noise Spread", prototype.renderMode); } EGL.EndVertical(); if (GUILayout.Button("Remove", GUILayout.Width(64f), GUILayout.Height(64f))) { removeThis = true; } } EGL.EndHorizontal(); } EGL.EndVertical(); return(removeThis); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); EGL.Space(); AsteroidField field = (AsteroidField)target; field.AsteroidGameObject = (GameObject)EGL.ObjectField(new GUIContent("Asteroid Game Object", "The game object that represents the spawned asteroids"), field.AsteroidGameObject, typeof(GameObject), false); field.InnerRadius = EGL.FloatField(new GUIContent("Inner Radius", "The inner radius of the field"), field.InnerRadius); field.OuterRadius = EGL.Slider("Outer Radius", field.OuterRadius, field.InnerRadius, 10000 + field.InnerRadius); EGL.Space(); scaleUsesRange = EGL.Toggle(new GUIContent("Scale uses range?", "Whether the asteroids spawned should pick a scale from a specified range."), scaleUsesRange); if (scaleUsesRange) { field.AsteroidLowerScale = EGL.Slider("Lower range", field.AsteroidLowerScale, 0, 20); field.AsteroidUpperScale = EGL.Slider("Upper range", field.AsteroidUpperScale, field.AsteroidLowerScale, field.AsteroidLowerScale + 20); } else { field.AsteroidScale = EGL.Slider("Scale", field.AsteroidScale, 0, 20); } using (new EditorGUI.DisabledScope(field.AsteroidGameObject == null)) { if (GUILayout.Button("Generate Field")) { field.GenerateField(scaleUsesRange); } } if (GUILayout.Button("Clear Field")) { field.ClearField(); } }
private void OnGUI() { UG.BeginVertical(); chosenMeshGenerationType = (MeshGenerationType)UG.EnumPopup("网格生成类型", chosenMeshGenerationType); defaultMaterial = UG.ObjectField("默认材质", defaultMaterial, typeof(Material), false) as Material; switch (chosenMeshGenerationType) { case MeshGenerationType.Plane: OnPlaneGenerationGUI(); break; case MeshGenerationType.Box: OnBoxGenerationGUI(); break; case MeshGenerationType.Slope: OnSlopeGenerationGUI(); break; case MeshGenerationType.VolumetricFluid: OnVolumetricFluidGenerationGUI(); break; default: UG.HelpBox("需要选择一种网格生成类别进行编辑!", MessageType.Warning); break; } UG.EndVertical(); }
private void ShowGameObjectInformation() { field.useArrayOfAsteroids = EGL.Toggle("Use Array", field.useArrayOfAsteroids); if (field.useArrayOfAsteroids) { SerializedObject serialObject = new SerializedObject(target); SerializedProperty serialProperty = serialObject.FindProperty("asteroids"); EGL.PropertyField(serialProperty, new GUIContent("Asteroids"), true); serialObject.ApplyModifiedProperties(); } else { var newAsteroidGameObject = (GameObject)EGL.ObjectField(new GUIContent("Asteroid Game Object", "The game object that represents the spawned asteroids"), field.asteroid, typeof(GameObject), false); if (GUI.changed) { field.asteroid = newAsteroidGameObject; } } }
public override void OnInspectorGUI() { serializedObject.Update(); // GUI.enabled hack because we don't want some controls to be disabled if the EditorSettings.asset is locked // since some of the controls are not dependent on the Editor Settings asset. Unfortunately, this assumes // that the editor will only be disabled because of version control locking which may change in the future. var editorEnabled = GUI.enabled; ShowUnityRemoteGUI(editorEnabled); bool collabEnabled = Collab.instance.IsCollabEnabledForCurrentProject(); GUILayout.Space(10); int index = (int)EditorSettings.serializationMode; using (new EditorGUI.DisabledScope(!collabEnabled)) { GUI.enabled = !collabEnabled; GUILayout.Label(Content.assetSerialization, EditorStyles.boldLabel); GUI.enabled = editorEnabled && !collabEnabled; CreatePopupMenu("Mode", serializationPopupList, index, SetAssetSerializationMode); } if (collabEnabled) { EditorGUILayout.HelpBox("Asset Serialization is forced to Text when using Collaboration feature.", MessageType.Warning); } if (EditorSettings.serializationMode != SerializationMode.ForceBinary) { EditorSettings.serializeInlineMappingsOnOneLine = EditorGUILayout.Toggle(Content.textSerializeMappingsOnOneLine, EditorSettings.serializeInlineMappingsOnOneLine); } GUILayout.Space(10); GUI.enabled = true; GUILayout.Label(Content.defaultBehaviorMode, EditorStyles.boldLabel); GUI.enabled = editorEnabled; index = Mathf.Clamp((int)EditorSettings.defaultBehaviorMode, 0, behaviorPopupList.Length - 1); CreatePopupMenu(Content.mode.text, behaviorPopupList, index, SetDefaultBehaviorMode); { var wasEnabled = GUI.enabled; GUI.enabled = true; DoCacheServerSettings(); GUI.enabled = wasEnabled; } GUILayout.Space(10); GUI.enabled = true; GUILayout.Label("Prefab Editing Environments", EditorStyles.boldLabel); GUI.enabled = editorEnabled; { EditorGUI.BeginChangeCheck(); SceneAsset scene = EditorSettings.prefabRegularEnvironment; scene = (SceneAsset)EditorGUILayout.ObjectField("Regular Environment", scene, typeof(SceneAsset), false); if (EditorGUI.EndChangeCheck()) { EditorSettings.prefabRegularEnvironment = scene; } } { EditorGUI.BeginChangeCheck(); SceneAsset scene = EditorSettings.prefabUIEnvironment; scene = (SceneAsset)EditorGUILayout.ObjectField("UI Environment", scene, typeof(SceneAsset), false); if (EditorGUI.EndChangeCheck()) { EditorSettings.prefabUIEnvironment = scene; } } GUILayout.Space(10); GUI.enabled = true; GUILayout.Label(Content.graphics, EditorStyles.boldLabel); GUI.enabled = editorEnabled; EditorGUI.BeginChangeCheck(); bool showRes = LightmapVisualization.showResolution; showRes = EditorGUILayout.Toggle(Content.showLightmapResolutionOverlay, showRes); if (EditorGUI.EndChangeCheck()) { LightmapVisualization.showResolution = showRes; } EditorGUI.BeginChangeCheck(); bool useLegacyProbeSampleCountValue = EditorSettings.useLegacyProbeSampleCount; useLegacyProbeSampleCountValue = EditorGUILayout.Toggle(Content.useLegacyProbeSampleCount, useLegacyProbeSampleCountValue); if (EditorGUI.EndChangeCheck()) { EditorApplication.RequestRepaintAllViews(); EditorSettings.useLegacyProbeSampleCount = useLegacyProbeSampleCountValue; } EditorGUI.BeginChangeCheck(); bool disableCookiesInLightmapperValue = EditorSettings.disableCookiesInLightmapper; disableCookiesInLightmapperValue = EditorGUILayout.Toggle(Content.disableCookiesInLightmapper, disableCookiesInLightmapperValue); if (EditorGUI.EndChangeCheck()) { EditorApplication.RequestRepaintAllViews(); EditorSettings.disableCookiesInLightmapper = disableCookiesInLightmapperValue; } GUILayout.Space(10); GUI.enabled = true; GUILayout.Label(Content.spritePacker, EditorStyles.boldLabel); GUI.enabled = editorEnabled; // Legacy Packer has been deprecated. index = Mathf.Clamp((int)(EditorSettings.spritePackerMode) - spritePackDeprecatedEnums, 0, spritePackerPopupList.Length - 1); CreatePopupMenu(Content.mode.text, spritePackerPopupList, index, SetSpritePackerMode); if (EditorSettings.spritePackerMode == SpritePackerMode.SpriteAtlasV2) { var message = "Sprite Atlas V2 (Experimental) supports CacheServer with Importer workflow. Please take a backup of your project before switching to V2."; EditorGUILayout.HelpBox(message, MessageType.Info, true); } DoProjectGenerationSettings(); DoEtcTextureCompressionSettings(); DoLineEndingsSettings(); DoStreamingSettings(); DoShaderCompilationSettings(); DoEnterPlayModeSettings(); serializedObject.ApplyModifiedProperties(); }
void ShowSingleImport() { ImporterConfiguration config = LandmassEditorUtilities.Instance.ImportCfg; EGL.BeginVertical(); { EGL.BeginVertical(GuiUtils.Skin.box); { GUILayout.Label("Target Terrain"); _singleTargetTerrain = EGL.ObjectField(_singleTargetTerrain, typeof(Terrain), true, GUILayout.Width(240f)) as Terrain; } EGL.EndVertical(); EGL.Separator(); EGL.BeginVertical(GuiUtils.Skin.box); { /* ----- Heightmap ----- */ GUILayout.Label("Heightmap"); GUILayout.BeginHorizontal(); { EGL.LabelField("Path", _singleHeightmapPath); if (GUILayout.Button("Browse", GUILayout.Width(60f))) { _singleHeightmapPath = EditorUtility.OpenFilePanel("Browse to Heightmap file", _singleHeightmapPath, "r16"); } } GUILayout.EndHorizontal(); GUI.enabled = _singleHeightmapPath != ""; { if (GUILayout.Button("Apply")) { LandmasImporter.ParseHeightmapFileToTerrain( _singleHeightmapPath, _singleTargetTerrain.terrainData, config.HeightFormat, config.HeightmapFlipX, config.HeightmapFlipY ); } } GUI.enabled = true; } EGL.EndVertical(); EGL.Separator(); EGL.BeginVertical(GuiUtils.Skin.box); { /* ----- Splatmaps ------ */ GUILayout.Label("Splatmap"); _singleSplatmap = EGL.ObjectField(_singleSplatmap, typeof(Texture2D), false, GUILayout.Width(100f), GUILayout.Height(100f)) as Texture2D; EGL.Separator(); GUI.enabled = _singleSplatmap != null && _singleTargetTerrain != null; { if (GUILayout.Button("Apply")) { var splatmap = new float[_singleSplatmap.width, _singleSplatmap.height, 4]; LandmasImporter.TextureToSplatMap( _singleSplatmap, ref splatmap, false, true); LandmasImporter.Instance.NormalizeSplatmap(ref splatmap, config.NormalizationMode); LandmasImporter.Instance.ParseSplatmapToTerrain(splatmap, _singleTargetTerrain.terrainData); } } GUI.enabled = true; } EGL.EndVertical(); EGL.Separator(); EGL.BeginVertical(GuiUtils.Skin.box); { /* ------ Treemaps ----- */ GUILayout.Label("Treemap"); _singleTreemap = EGL.ObjectField(_singleTreemap, typeof(Texture2D), false, GUILayout.Width(100f), GUILayout.Height(100f)) as Texture2D; GUI.enabled = _singleTreemap != null; { if (GUILayout.Button("Apply")) { LandmasImporter.ParseTreemapTexturesToTerrain(_singleTreemap, _singleTargetTerrain.terrainData); } } GUI.enabled = true; EGL.Separator(); if (GUILayout.Button("Flush Terrain")) { Terrain terrain = Selection.activeGameObject.GetComponent <Terrain>(); if (terrain) { Debug.Log("Flushing Terrain"); terrain.Flush(); } } } EGL.EndVertical(); } EGL.EndVertical(); }
/// <summary> /// Field drawing utility used when a field of an object needs to be drawn /// </summary> private static object DrawPropertyObject(object property, Type type, int indent = 0) { var _val = property; // UnityEngine.Object if (typeof(U.Object).IsAssignableFrom(type)) { U.Object _elementAsObject = null; _val.TryCast <U.Object>(out _elementAsObject); #if UNITY_EDITOR _elementAsObject = EGl.ObjectField(_elementAsObject, type, true); #else Gl.Label(_elementAsObject.ToString()); #endif _elementAsObject.TryCast <object>(out _val); return(_val); } // Initialize new if null (and newable). // Doing this after the Unity Object check will assure no GameObjects are spawned in the current scene if (_val == null) { var _constructorInfo = type.GetConstructor(Type.EmptyTypes); if (_constructorInfo != null) { _val = _constructorInfo.Invoke(null); } else { _val = default(object); } } // Implements the iDrawableProperty if (_val is iDrawableProperty) { iDrawableProperty _asDrawable = (iDrawableProperty)_val; _asDrawable.DrawAsProperty(); return(_val); } // Bool if (_val is bool) { bool _elementAsBool = default(bool); if (_val.TryCast <bool>(out _elementAsBool)) { _elementAsBool = Gl.Toggle(_elementAsBool, ""); } _elementAsBool.TryCast <object>(out _val); return(_val); } // Int if (_val is int) { int _elementAsInt = default(int); if (_val.TryCast <int>(out _elementAsInt)) { #if UNITY_EDITOR _elementAsInt = EGl.IntField(_elementAsInt); #else int.TryParse(Gl.TextField(_elementAsInt.ToString()), out _elementAsInt); #endif } _elementAsInt.TryCast <object>(out _val); return(_val); } // Float if (_val is float) { float _elementAsFloat = default(float); if (_val.TryCast <float>(out _elementAsFloat)) { #if UNITY_EDITOR _elementAsFloat = EGl.FloatField(_elementAsFloat); #else float.TryParse(Gl.TextField(_elementAsFloat.ToString()), out _elementAsFloat); #endif } _elementAsFloat.TryCast <object>(out _val); return(_val); } // String if (_val is string || typeof(string).IsAssignableFrom(type)) { string _elementAsString = string.Empty; if (_val != null) { if (_val.TryCast <string>(out _elementAsString)) { _elementAsString = Gl.TextField(_elementAsString); } } else { Gl.Label("EMPTY STRING"); } _elementAsString.TryCast <object>(out _val); return(_val); } // Try drawing using reflection, // expecting that it is a newable type that is already initialized in the code above if (_val != null) { var _valType = _val.GetType(); if (indent == 0) { Gl.Label(_valType.Name); } var _fieldInfo = _valType.GetFields(BindingFlags.Public | BindingFlags.Instance); if (indent < PROPERTY_DEPTH_LIMIT) { indent++; OpenIndent(indent); foreach (var _field in _fieldInfo) { Gl.BeginHorizontal(); Gl.Label(StringUtil.WordSplit(_field.Name, true), Gl.ExpandWidth(false)); Gl.BeginVertical(); var _fieldValue = _field.GetValue(_val); _field.SetValue(_val, DrawPropertyObject(_fieldValue, _field.FieldType, indent)); Gl.EndVertical(); Gl.EndHorizontal(); } CloseIndent(); } else { Gl.Label(string.Format("[!] MAX DRAWING DEPTH ({0}) REACHED", PROPERTY_DEPTH_LIMIT)); } return(_val); } Gl.Label("[ERROR] Unknown Type"); return(null); }
void OnGUI() { // Settings bgColor = (Texture2D)Resources.Load("editorBgColor"); GUI.DrawTexture(new Rect(0, 0, maxSize.x, maxSize.y), bgColor, ScaleMode.StretchToFill); GUI.skin = editorSkin; GL.Label(GDbanner); scrollPosition = GL.BeginScrollView(scrollPosition); #region UI Options blockHeader("UI Options", "All UI options.", 0); if (toggles[0]) { buttons[0] = "Close"; BVS("GroupBox"); //0 // Content Start GL.Label("UI Images", "centerBoldLabel"); GL.Space(10); BV(); //1 BH(); vars.buttonGui = (Sprite)EGL.ObjectField("Button GUI", vars.buttonGui, typeof(Sprite), false); vars.leaderboardIcon = (Sprite)EGL.ObjectField("Leaderboard Icon", vars.leaderboardIcon, typeof(Sprite), false); EH(); BH(); vars.rateIcon = (Sprite)EGL.ObjectField("Rate Icon", vars.rateIcon, typeof(Sprite), false); vars.facebookIcon = (Sprite)EGL.ObjectField("Facebook Icon", vars.facebookIcon, typeof(Sprite), false); EH(); BH(); vars.soundOnIcon = (Sprite)EGL.ObjectField("Sound On Icon", vars.soundOnIcon, typeof(Sprite), false); vars.soundOffIcon = (Sprite)EGL.ObjectField("Sound Off Icon", vars.soundOffIcon, typeof(Sprite), false); EH(); BH(); vars.playButton = (Sprite)EGL.ObjectField("Play Button", vars.playButton, typeof(Sprite), false); vars.bronzeMedal = (Sprite)EGL.ObjectField("Bronze", vars.bronzeMedal, typeof(Sprite), false); EH(); BH(); vars.silverMedal = (Sprite)EGL.ObjectField("Silver", vars.silverMedal, typeof(Sprite), false); vars.GoldMedal = (Sprite)EGL.ObjectField("Gold", vars.GoldMedal, typeof(Sprite), false); EH(); EV(); //1 separator(); GL.Label("UI Texts", "centerBoldLabel"); GL.Space(10); BVS("GroupBox"); //2 GL.Label("Main Menu"); vars.shareBtnText = EGL.TextField("ShareText", vars.shareBtnText); vars.shareTextColor = EGL.ColorField("ShareTextColor", vars.shareTextColor); vars.bestTextColor = EGL.ColorField("BestTextColor", vars.bestTextColor); vars.scoreTextColor = EGL.ColorField("ScoreTextColor", vars.scoreTextColor); vars.inGameScoreTextColor = EGL.ColorField("InGameScoreTextColor", vars.inGameScoreTextColor); vars.gameTitleText = EGL.TextField("GameTitleText", vars.gameTitleText); vars.gameTitleColor = EGL.ColorField("GameTitleColor", vars.gameTitleColor); EV(); //2 separator(); GL.Label("UI Fonts", "centerBoldLabel"); GL.Space(10); vars.gameFont = EGL.ObjectField("Game Font", vars.gameFont, typeof(Font), false) as Font; // Content End EditorUtility.SetDirty(vars); EV(); //0 } else { buttons[0] = "Open"; } EV(); #endregion #region Sound Options blockHeader("Sound Options", "Sound & Music options.", 1); if (toggles[1]) { buttons[1] = "Close"; BVS("GroupBox"); // Content Start vars.buttonSound = EGL.ObjectField("Button Sound", vars.buttonSound, typeof(AudioClip), false) as AudioClip; vars.jumpSound = EGL.ObjectField("Jump Sound", vars.jumpSound, typeof(AudioClip), false) as AudioClip; vars.gameOverSound = EGL.ObjectField("GameOver Sound", vars.gameOverSound, typeof(AudioClip), false) as AudioClip; vars.hiScore = EGL.ObjectField("HiScore Sound", vars.hiScore, typeof(AudioClip), false) as AudioClip; // Content End EditorUtility.SetDirty(vars); EV(); } else { buttons[1] = "Open"; } EV(); // End Block #endregion #region Other Options // Start Block blockHeader("Other Options", "AdMob, Google Play Services and etc. options.", 2); if (toggles[2]) { buttons[2] = "Close"; GL.BeginVertical("GroupBox"); //Admob GL.Label("AdMob Options", EditorStyles.boldLabel); //Banner vars.adMobBannerID = EGL.TextField("AdMob Banner ID", vars.adMobBannerID); GL.BeginHorizontal(); GL.Label("Banner Position"); vars.bannerAdPoisiton = GL.SelectionGrid(vars.bannerAdPoisiton, bannerPositionTexts, 3, "Radio"); GL.EndHorizontal(); separator(); //Interstitial vars.adMobInterstitialID = EGL.TextField("AdMob Interstitial ID", vars.adMobInterstitialID); GL.BeginHorizontal(); GL.Label("Show Interstitial After Death Times"); vars.showInterstitialAfter = EGL.IntSlider(vars.showInterstitialAfter, 1, 25); GL.EndHorizontal(); separator(); //Google Play Service GL.Label("Google Play Or Game Center", EditorStyles.boldLabel); vars.leaderBoardID = EGL.TextField("Leaderboard ID", vars.leaderBoardID); separator(); GL.Label("Other Options", EditorStyles.boldLabel); //Rate Url GL.BeginHorizontal(); GL.Label("Rate Button Url", GL.Width(100f)); vars.rateButtonUrl = EGL.TextArea(vars.rateButtonUrl, GL.Height(50f)); GL.EndHorizontal(); GL.Space(15f); //Facebook Url GL.BeginHorizontal(); GL.Label("FB Page Url", GL.Width(100f)); vars.facebookBtnUrl = EGL.TextArea(vars.facebookBtnUrl, GL.Height(50f)); GL.EndHorizontal(); GL.Space(15f); separator(); EditorUtility.SetDirty(vars); GL.EndVertical(); } else { buttons[2] = "Open"; } GL.EndVertical(); // End Block #endregion GL.EndScrollView(); EditorUtility.SetDirty(vars); try { liveUpdate(); } catch (Exception e) { } }
public override void OnInspectorGUI() { if (this.m_ServerOnlyProperty == null) { this.m_Initialized = false; } this.Init(); this.serializedObject.Update(); if (this.m_ServerOnlyProperty.boolValue) { EditorGUILayout.PropertyField(this.m_ServerOnlyProperty, this.m_ServerOnlyLabel, new GUILayoutOption[0]); EditorGUILayout.LabelField("Local Player Authority cannot be set for server-only objects"); } else if (this.m_LocalPlayerAuthorityProperty.boolValue) { EditorGUILayout.LabelField("Server Only cannot be set for Local Player Authority objects"); EditorGUILayout.PropertyField(this.m_LocalPlayerAuthorityProperty, this.m_LocalPlayerAuthorityLabel, new GUILayoutOption[0]); } else { EditorGUILayout.PropertyField(this.m_ServerOnlyProperty, this.m_ServerOnlyLabel, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_LocalPlayerAuthorityProperty, this.m_LocalPlayerAuthorityLabel, new GUILayoutOption[0]); } this.serializedObject.ApplyModifiedProperties(); if (!Application.isPlaying) { return; } EditorGUILayout.Separator(); if (this.m_NetworkIdentity.observers != null && this.m_NetworkIdentity.observers.Count > 0) { this.m_ShowObservers = EditorGUILayout.Foldout(this.m_ShowObservers, "Observers"); if (this.m_ShowObservers) { ++EditorGUI.indentLevel; foreach (NetworkConnection observer in this.m_NetworkIdentity.observers) { GameObject gameObject = (GameObject)null; using (List <PlayerController> .Enumerator enumerator = observer.playerControllers.GetEnumerator()) { while (enumerator.MoveNext()) { PlayerController current = enumerator.Current; if (current != null) { gameObject = current.gameObject; break; } } } if ((bool)((Object)gameObject)) { EditorGUILayout.ObjectField("Connection " + (object)observer.connectionId, (Object)gameObject, typeof(GameObject), false, new GUILayoutOption[0]); } else { EditorGUILayout.TextField("Connection " + (object)observer.connectionId); } } --EditorGUI.indentLevel; } } if (PrefabUtility.GetPrefabType((Object)this.m_NetworkIdentity.gameObject) == PrefabType.Prefab || !this.m_NetworkIdentity.gameObject.activeSelf || (!this.m_NetworkIdentity.netId.IsEmpty() || !NetworkServer.active)) { return; } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(this.m_SpawnLabel); if (GUILayout.Toggle(false, "Spawn", EditorStyles.miniButtonLeft, new GUILayoutOption[0])) { NetworkServer.Spawn(this.m_NetworkIdentity.gameObject); EditorUtility.SetDirty(this.target); } EditorGUILayout.EndHorizontal(); }
public override void OnInspectorGUI() { bool targetChanged = false; if (target != state) { addStatePortionName = ""; targetChanged = true; } state = (State)target; if (targetChanged) { var layer = state.profile.controller.layers[state.profile.controllerLayer]; var animState = Utils.FindState(layer.stateMachine, state.stateName); clip = animState.motion as AnimationClip; var sb = new System.Text.StringBuilder(); var events = AnimationUtility.GetAnimationEvents(clip); sb.AppendFormat("Events ({0}) ", events.Length).AppendLine(); if (events.Length > 0) { foreach (var ev in events) { sb.Append(string.Format("{0,4}", (int)FrameUtil.Time2Frame(ev.time))).Append("F "); sb.Append(ev.functionName); sb.AppendLine(); } } sb.AppendLine(); var bindings = AnimationUtility.GetCurveBindings(clip); sb.AppendFormat("Bindings ({0})", bindings.Length).AppendLine(); foreach (var binding in bindings) { sb.Append(" ").Append(binding.path).Append(binding.path == "" ? "" : "/") .Append("<").Append(binding.type.Name).Append(">.") .Append(binding.propertyName).AppendLine(); } summary = sb.ToString(); } EditorGUI.BeginChangeCheck(); EGL.LabelField("Name", state.stateName); EGL.LabelField("Frames", state.frames.ToString()); bool lastGUIEnabled = GUI.enabled; GUI.enabled = false; EGL.ObjectField("Clip", clip, typeof(AnimationClip), allowSceneObjects: false); GUI.enabled = lastGUIEnabled; if (summary.Length > 0) { EGL.HelpBox(summary, MessageType.None); } state.tags = InspectTags(state.tags); EGL.Space(); using (new EGL.VerticalScope(EditorStyles.helpBox)) { ++EditorGUI.indentLevel; InspectBehaviourList(state.behaviours); --EditorGUI.indentLevel; EGL.Space(); } EGL.LabelField("Portions"); var portions = state.portions; for (int i = 0; i < portions.Count; ++i) { var portion = portions[i]; bool active = activePortions.Contains(portion); active = EGL.Foldout(active, portion.name); if (active) { activePortions.Add(portion); } else { activePortions.Remove(portion); } if (active) { ++EditorGUI.indentLevel; EGL.BeginHorizontal(); portion.name = EGL.TextField("Name", portion.name); // GL.FlexibleSpace(); if (GL.Button("-", GUILayout.Width(30))) { portions.RemoveAt(i); --i; } EGL.EndHorizontal(); portion.range = EditorGUIUtil.FrameRangeSlider("Range", portion.range, state.frames); portion.includeEnd = EGL.Toggle("Include nt>=1", portion.includeEnd); portion.tags = InspectTags(portion.tags); using (new EGL.VerticalScope(EditorStyles.helpBox)) { InspectBehaviourList(portion.behaviours); } --EditorGUI.indentLevel; } } EGL.Space(); EGL.Space(); EGL.BeginHorizontal(); addStatePortionName = EGL.TextField(addStatePortionName); if (GUI.enabled && GL.Button("Add Portion", GL.Width(90))) { var portion = new StatePortion { name = addStatePortionName }; portions.Add(portion); addStatePortionName = ""; } EGL.EndHorizontal(); if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(state); } }
void OnGUI() { if (!profile) { return; } if (Selection.activeObject != profile && Selection.activeObject is TransitionProfile) { BeginEdit(Selection.activeObject as TransitionProfile); } globalPanel = (GlobalPanelType)GL.Toolbar((int)globalPanel, new string[] { "States", "Params", "Tags", "Transitions" }, EditorStyles.toolbarButton); switch (globalPanel) { case GlobalPanelType.States: { profile.controller = (AnimatorController)EGL.ObjectField("Controller", profile.controller, typeof(AnimatorController), allowSceneObjects: false); if (profile.controller) { EGL.BeginHorizontal(); EGL.PrefixLabel("Layer"); profile.controllerLayer = EGL.IntField(profile.controllerLayer); // GL.FlexibleSpace(); if (GL.Button("Sync", EditorStyles.miniButtonRight, GL.Width(40)) && profile.controller) { SyncControllerStates(); statePanelView.Reload(); } EGL.EndHorizontal(); } EGL.Space(); if (statePanelView == null) { statePanelView = new StatesTreeView(statePanelState, profile); statePanelView.searchString = ""; searchFieldState.downOrUpArrowKeyPressed += statePanelView.SetFocusAndEnsureSelectedItem; } statePanelView.searchString = ToolbarSearchField(statePanelView.searchString, searchFieldState); statePanelView.OnGUI(GUILayoutUtility.GetRect(0, 10000, 0, 10000)); } break; case GlobalPanelType.Parameters: { if (paramPanelView == null) { paramPanelView = new ParamsTreeView(paramPanelState, profile); paramPanelView.searchString = ""; } paramPanelView.searchString = ToolbarSearchField(paramPanelView.searchString, searchFieldParam); paramPanelView.OnGUI(GUILayoutUtility.GetRect(0, 10000, 0, 10000)); } break; case GlobalPanelType.Tags: { if (tagsPanelView == null) { tagsPanelView = new TagsTreeView(tagsPanelState, profile); } tagsPanelView.searchString = ToolbarSearchField(tagsPanelView.searchString, searchFieldTag); tagsPanelView.OnGUI(GUILayoutUtility.GetRect(0, 10000, 0, 10000)); var selection = tagsPanelView.GetSelection(); if (selection.Any()) { string selectedTag = profile.tags[selection.First()]; var relatedStates = profile.states.Where(state => state.HasTagAnyFrame(Animator.StringToHash(selectedTag))).Select(it => it.stateName); string statesStr = string.Join(",", relatedStates.ToArray()); GL.Label(statesStr, EditorStyles.textArea); } } break; default: { // Transitions if (transitionPanelView == null) { transitionPanelView = new TransitionTreeView(transitionPanelState, profile); } EditorGUI.BeginChangeCheck(); transitionPanelView.fromStateFilter = searchFieldFromState.OnGUI("From State", transitionPanelView.fromStateFilter); transitionPanelView.targetStateFilter = searchFieldTargetState.OnGUI("Target State", transitionPanelView.targetStateFilter); if (EditorGUI.EndChangeCheck()) { transitionPanelView.Reload(); } EGL.Space(); transitionPanelView.OnGUI(GUILayoutUtility.GetRect(0, 10000, 0, 10000)); Repaint(); } break; } }
public override void OnInspectorGUI() { if (m_ServerOnlyProperty == null) { m_Initialized = false; } Init(); serializedObject.Update(); if (m_ServerOnlyProperty.boolValue) { EditorGUILayout.PropertyField(m_ServerOnlyProperty, m_ServerOnlyLabel); EditorGUILayout.LabelField("Local Player Authority cannot be set for server-only objects"); } else if (m_LocalPlayerAuthorityProperty.boolValue) { EditorGUILayout.LabelField("Server Only cannot be set for Local Player Authority objects"); EditorGUILayout.PropertyField(m_LocalPlayerAuthorityProperty, m_LocalPlayerAuthorityLabel); } else { EditorGUILayout.PropertyField(m_ServerOnlyProperty, m_ServerOnlyLabel); EditorGUILayout.PropertyField(m_LocalPlayerAuthorityProperty, m_LocalPlayerAuthorityLabel); } serializedObject.ApplyModifiedProperties(); if (!Application.isPlaying) { return; } // Runtime actions below here EditorGUILayout.Separator(); if (m_NetworkIdentity.observers != null && m_NetworkIdentity.observers.Count > 0) { m_ShowObservers = EditorGUILayout.Foldout(m_ShowObservers, "Observers"); if (m_ShowObservers) { EditorGUI.indentLevel += 1; foreach (var o in m_NetworkIdentity.observers) { GameObject obj = null; foreach (var p in o.playerControllers) { if (p != null) { obj = p.gameObject; break; } } if (obj) { EditorGUILayout.ObjectField("Connection " + o.connectionId, obj, typeof(GameObject), false); } else { EditorGUILayout.TextField("Connection " + o.connectionId); } } EditorGUI.indentLevel -= 1; } } if (PrefabUtility.IsPartOfPrefabAsset(m_NetworkIdentity.gameObject)) { return; } if (m_NetworkIdentity.gameObject.activeSelf && m_NetworkIdentity.netId.IsEmpty() && NetworkServer.active) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(m_SpawnLabel); if (GUILayout.Toggle(false, "Spawn", EditorStyles.miniButtonLeft)) { NetworkServer.Spawn(m_NetworkIdentity.gameObject); EditorUtility.SetDirty(target); // preview window STILL doens't update immediately.. } EditorGUILayout.EndHorizontal(); } }
public override void OnSelectionInspectorGUI() { BoundsInt selection = GridSelection.position; Tilemap tilemap = GridSelection.target.GetComponent <Tilemap>(); int cellCount = selection.size.x * selection.size.y * selection.size.z; if (tilemap != null && cellCount > 0) { base.OnSelectionInspectorGUI(); GUILayout.Space(10f); if (m_SelectionTiles == null || m_SelectionTiles.Length != cellCount) { m_SelectionTiles = new TileBase[cellCount]; m_SelectionColors = new Color[cellCount]; m_SelectionMatrices = new Matrix4x4[cellCount]; m_SelectionFlagsArray = new TileFlags[cellCount]; m_SelectionSprites = new Sprite[cellCount]; m_SelectionColliderTypes = new Tile.ColliderType[cellCount]; } int index = 0; foreach (var p in selection.allPositionsWithin) { m_SelectionTiles[index] = tilemap.GetTile(p); m_SelectionColors[index] = tilemap.GetColor(p); m_SelectionMatrices[index] = tilemap.GetTransformMatrix(p); m_SelectionFlagsArray[index] = tilemap.GetTileFlags(p); m_SelectionSprites[index] = tilemap.GetSprite(p); m_SelectionColliderTypes[index] = tilemap.GetColliderType(p); index++; } EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = m_SelectionTiles.Any(tile => tile != m_SelectionTiles.First()); var position = new Vector3Int(selection.xMin, selection.yMin, selection.zMin); TileBase newTile = EditorGUILayout.ObjectField(Styles.tileLabel, tilemap.GetTile(position), typeof(TileBase), false) as TileBase; if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(tilemap, "Edit Tilemap"); foreach (var p in selection.allPositionsWithin) { tilemap.SetTile(p, newTile); } } using (new EditorGUI.DisabledScope(true)) { EditorGUI.showMixedValue = m_SelectionSprites.Any(sprite => sprite != m_SelectionSprites.First()); EditorGUILayout.ObjectField(Styles.spriteLabel, m_SelectionSprites[0], typeof(Sprite), false, GUILayout.Height(EditorGUI.kSingleLineHeight)); } bool colorFlagsAllEqual = m_SelectionFlagsArray.All(flags => (flags & TileFlags.LockColor) == (m_SelectionFlagsArray.First() & TileFlags.LockColor)); using (new EditorGUI.DisabledScope(!colorFlagsAllEqual || (m_SelectionFlagsArray[0] & TileFlags.LockColor) != 0)) { EditorGUI.showMixedValue = m_SelectionColors.Any(color => color != m_SelectionColors.First()); EditorGUI.BeginChangeCheck(); Color newColor = EditorGUILayout.ColorField(Styles.colorLabel, m_SelectionColors[0]); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(tilemap, "Edit Tilemap"); foreach (var p in selection.allPositionsWithin) { tilemap.SetColor(p, newColor); } } } using (new EditorGUI.DisabledScope(true)) { EditorGUI.showMixedValue = m_SelectionColliderTypes.Any(colliderType => colliderType != m_SelectionColliderTypes.First()); EditorGUILayout.EnumPopup(Styles.colliderTypeLabel, m_SelectionColliderTypes[0]); } bool transformFlagsAllEqual = m_SelectionFlagsArray.All(flags => (flags & TileFlags.LockTransform) == (m_SelectionFlagsArray.First() & TileFlags.LockTransform)); using (new EditorGUI.DisabledScope(!transformFlagsAllEqual || (m_SelectionFlagsArray[0] & TileFlags.LockTransform) != 0)) { EditorGUI.showMixedValue = m_SelectionMatrices.Any(matrix => matrix != m_SelectionMatrices.First()); EditorGUI.BeginChangeCheck(); Matrix4x4 newTransformMatrix = TileEditor.TransformMatrixOnGUI(m_SelectionMatrices[0]); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(tilemap, "Edit Tilemap"); foreach (var p in selection.allPositionsWithin) { tilemap.SetTransformMatrix(p, newTransformMatrix); } } } using (new EditorGUI.DisabledScope(true)) { EditorGUI.showMixedValue = !colorFlagsAllEqual; EditorGUILayout.Toggle(Styles.lockColorLabel, (m_SelectionFlagsArray[0] & TileFlags.LockColor) != 0); EditorGUI.showMixedValue = !transformFlagsAllEqual; EditorGUILayout.Toggle(Styles.lockTransformLabel, (m_SelectionFlagsArray[0] & TileFlags.LockTransform) != 0); } EditorGUI.showMixedValue = false; } }
void showTerrainGUI() { // General Terrain Settings showTerrainUI = EGL.Foldout(showTerrainUI, terrainLabel, true); if (showTerrainUI) { GL.BeginHorizontal(); GL.BeginVertical(); GL.Label(new GUIContent("Terrain Size", "The width in units of the generated Terrain Object.")); GL.Label(new GUIContent("Terrain Height Range", "The min and max height in units of the generated Terrain Object.")); GL.Label("Water?"); GL.EndVertical(); GL.BeginVertical(); CG.terrainSize = EGL.IntSlider(CG.terrainSize, 512, 2048); GL.BeginHorizontal(); GL.TextField(CG.minHeight.ToString("F1")); EGL.MinMaxSlider(ref CG.minHeight, ref CG.maxHeight, CG.terrainSize * -CG.highwayMaxSlope, CG.terrainSize * CG.highwayMaxSlope); GL.TextField(CG.maxHeight.ToString("F1")); GL.EndHorizontal(); EG.BeginDisabledGroup(CG.minHeight > 0); rWaterToggle.target = EGL.Toggle(rWaterToggle.target); EG.EndDisabledGroup(); GL.EndVertical(); GL.EndHorizontal(); GL.BeginVertical(); GL.Label("Height Map Generation", EditorStyles.centeredGreyMiniLabel); GL.BeginHorizontal("box"); GL.BeginVertical(); GL.Label("Octaves"); GL.Label("Persistance"); GL.Label("Zoom"); GL.Label("Seed"); GL.EndVertical(); GL.BeginVertical(); CG.terrainOctaves = EGL.IntSlider(CG.terrainOctaves, 1, 6); CG.terrainPersistance = EGL.Slider(CG.terrainPersistance, 0, 0.7f); CG.terrainZoom = EGL.Slider(CG.terrainZoom, 0.01f, 0.04f); GL.BeginHorizontal(); EG.BeginDisabledGroup(rTerrainSeed.target == false); CG.terrainSeed = EGL.IntSlider(CG.terrainSeed, 0, int.MaxValue); EG.EndDisabledGroup(); rTerrainSeed.target = EGL.Toggle(rTerrainSeed.target); GL.EndHorizontal(); GL.Space(20); GL.BeginHorizontal(); GL.Label("Or import your custom height map: "); CG.terrainMap = (Texture2D)EGL.ObjectField(CG.terrainMap, typeof(Texture2D), false); GL.EndHorizontal(); GL.EndVertical(); GL.EndHorizontal(); GL.EndVertical(); GL.BeginHorizontal(); if (GL.Button("Generate New Terrain")) { if (rTerrainSeed.target == false && CG.terrainMap == null) { CG.terrainSeed = Random.Range(0, int.MaxValue); } CG.rWater = rWaterToggle.target; generator.generateTerrain(); isTerrain = true; } EG.BeginDisabledGroup(!isTerrain); if (GL.Button("Save and Proceed")) { terrainGenerated = true; terrainLabel = "1. Terrain Generation - COMPLETED ✔"; if (CityGeneratorUI.DebugMode) { Debug.Log("Terrain Generated"); } showTerrainUI = false; showPopUI = true; } EG.EndDisabledGroup(); GL.EndHorizontal(); } }
void OnGUI() { // Settings bgColor = (Texture2D)Resources.Load("editorBgColor"); GUI.DrawTexture(new Rect(0, 0, maxSize.x, maxSize.y), bgColor, ScaleMode.StretchToFill); GUI.skin = editorSkin; GL.Label(GDbanner); scrollPosition = GL.BeginScrollView(scrollPosition); #region Shop Options // Start Block blockHeader("Shop Options", "Shop items options.", 0); if (toggles [0]) { buttons [0] = "Close"; BVS("GroupBox"); // Content Start shopItemCountController(); updateShopItems(); // Content End EditorUtility.SetDirty(vars); EV(); } else { buttons[0] = "Open"; } EV(); // End Block #endregion #region UI Options // Start Block blockHeader("UI Options", "All UI options.", 1); if (toggles[1]) { buttons[1] = "Close"; BVS("GroupBox"); // Content Start GL.Label("UI Images", "centerBoldLabel"); GL.Space(10); BV(); BH(); vars.shopCloseImage = EGL.ObjectField("ShopClose Image", vars.shopCloseImage, typeof(Sprite), false) as Sprite; vars.playButton = EGL.ObjectField("Play Button", vars.playButton, typeof(Sprite), false) as Sprite; EH(); BH(); vars.leaderboardButton = EGL.ObjectField("Leaderboard Button", vars.leaderboardButton, typeof(Sprite), false) as Sprite; vars.shopButton = EGL.ObjectField("Shop Open Button", vars.shopButton, typeof(Sprite), false) as Sprite; EH(); BH(); vars.homeButton = EGL.ObjectField("Home Button", vars.homeButton, typeof(Sprite), false) as Sprite; vars.rateButton = EGL.ObjectField("Rate Button", vars.rateButton, typeof(Sprite), false) as Sprite; EH(); BH(); vars.soundOnButton = EGL.ObjectField("Sound On Button", vars.soundOnButton, typeof(Sprite), false) as Sprite; vars.soundOffButton = EGL.ObjectField("Sound Off Button", vars.soundOffButton, typeof(Sprite), false) as Sprite; EH(); BH(); vars.retryBtnImg = EGL.ObjectField("Retry Button", vars.retryBtnImg, typeof(Sprite), false) as Sprite; vars.adsBtnImg = EGL.ObjectField("Ads Btn", vars.adsBtnImg, typeof(Sprite), false) as Sprite; EH(); BH(); vars.titleImage = EGL.ObjectField("Title Image", vars.titleImage, typeof(Sprite), false) as Sprite; vars.noAdsImage = EGL.ObjectField("NoAds Image", vars.noAdsImage, typeof(Sprite), false) as Sprite; EH(); BH(); vars.gameOverImg = EGL.ObjectField("GameOver Title Img", vars.gameOverImg, typeof(Sprite), false) as Sprite; vars.shareImage = EGL.ObjectField("Share Image", vars.shareImage, typeof(Sprite), false) as Sprite; EH(); BH(); vars.giftBtnImg = EGL.ObjectField("Gift Btn", vars.giftBtnImg, typeof(Sprite), false) as Sprite; vars.starImg = EGL.ObjectField("Star Image", vars.starImg, typeof(Sprite), false) as Sprite; EH(); BH(); vars.cloudImg = EGL.ObjectField("Cloud Image", vars.cloudImg, typeof(Texture), false) as Texture; vars.backgroundImg = EGL.ObjectField("Background Image", vars.backgroundImg, typeof(Texture), false) as Texture; EH(); EV(); separator(); GL.Label("UI Texts", "centerBoldLabel"); GL.Space(10); BVS("GroupBox"); GL.Label("Game Over Score Text :"); vars.gameOverScoreTextColor = EGL.ColorField("Color", vars.gameOverScoreTextColor); GL.Label("Game Over Best Score Text :"); vars.gameOverBestScoreTextColor = EGL.ColorField("Color", vars.gameOverBestScoreTextColor); EV(); GL.Space(10); BVS("GroupBox"); GL.Label("GameMenu Star Text :"); vars.gameMenuStarTextColor = EGL.ColorField("Color", vars.gameMenuStarTextColor); GL.Label("ShopMenu Star Text :"); vars.shopMenuStarTextColor = EGL.ColorField("Color", vars.shopMenuStarTextColor); EV(); GL.Space(5); BVS("GroupBox"); GL.Label("In Game Score Text :"); vars.inGameScoreTextColor = EGL.ColorField("Color", vars.inGameScoreTextColor); GL.Label("Gift Reward Text :"); vars.giftRewardTextColor = EGL.ColorField("Color", vars.giftRewardTextColor); EV(); separator(); GL.Label("UI Fonts", "centerBoldLabel"); GL.Space(10); vars.mainFont = EGL.ObjectField("Main Font", vars.mainFont, typeof(Font), false) as Font; vars.secondFont = EGL.ObjectField("Second Font", vars.secondFont, typeof(Font), false) as Font; // Content End EditorUtility.SetDirty(vars); EV(); } else { buttons[1] = "Open"; } EV(); // End Block #endregion #region Sound Options // Start Block blockHeader("Sound Options", "Sound & Music options.", 2); if (toggles [2]) { buttons [2] = "Close"; BVS("GroupBox"); // Content Start vars.buttonSound = EGL.ObjectField("Button Sound", vars.buttonSound, typeof(AudioClip), false) as AudioClip; vars.starSound = EGL.ObjectField("Star Sound", vars.starSound, typeof(AudioClip), false) as AudioClip; vars.backgroundMusic = EGL.ObjectField("Background Music", vars.backgroundMusic, typeof(AudioClip), false) as AudioClip; vars.jumpSound = EGL.ObjectField("Jump Sound", vars.jumpSound, typeof(AudioClip), false) as AudioClip; vars.deathSound = EGL.ObjectField("Death Sound", vars.deathSound, typeof(AudioClip), false) as AudioClip; // Content End EditorUtility.SetDirty(vars); EV(); } else { buttons[2] = "Open"; } EV(); // End Block #endregion #region Other Options // Start Block blockHeader("Other Options", "AdMob, Google Play Services and etc. options.", 4); if (toggles [4]) { buttons[4] = "Close"; GL.BeginVertical("GroupBox"); //Admob if (GUILayout.Button("Download Admob SDK")) { Application.OpenURL("https://github.com/googleads/googleads-mobile-unity/releases"); } GL.Label("AdMob Options", EditorStyles.boldLabel); GL.BeginHorizontal(); GL.Label("Show Interstitial After Death Times"); vars.showInterstitialAfter = EGL.IntSlider(vars.showInterstitialAfter, 1, 25); GL.EndHorizontal(); vars.admobActive = EGL.Toggle("Use Admob Ads", vars.admobActive, "Toggle"); if (vars.admobActive) { AssetDefineManager.AddCompileDefine("AdmobDef", new BuildTargetGroup[] { BuildTargetGroup.Android, BuildTargetGroup.iOS }); //Admob App ID vars.admobAppID = EGL.TextField("AdMob App ID", vars.admobAppID); separator(); //Banner vars.adMobBannerID = EGL.TextField("AdMob Banner ID", vars.adMobBannerID); GL.BeginHorizontal(); GL.Label("Banner Position"); vars.bannerAdPoisiton = GL.SelectionGrid(vars.bannerAdPoisiton, bannerPositionTexts, 3, "Radio"); GL.EndHorizontal(); separator(); //Interstitial vars.adMobInterstitialID = EGL.TextField("AdMob Interstitial ID", vars.adMobInterstitialID); } else if (!vars.admobActive) { AssetDefineManager.RemoveCompileDefine("AdmobDef", new BuildTargetGroup[] { BuildTargetGroup.Android, BuildTargetGroup.iOS }); } separator(); //Google Play Service if (GUILayout.Button("Download Google Play SDK")) { Application.OpenURL("https://github.com/playgameservices/play-games-plugin-for-unity"); } GL.Label("Google Play Or Game Center", EditorStyles.boldLabel); vars.googlePlayActive = EGL.Toggle("Use Leaderboard", vars.googlePlayActive, "Toggle"); if (vars.googlePlayActive) { #if UNITY_ANDROID AssetDefineManager.AddCompileDefine("GooglePlayDef", new BuildTargetGroup[] { BuildTargetGroup.Android }); #endif vars.leaderBoardID = EGL.TextField("Leaderboard ID", vars.leaderBoardID); } else if (!vars.googlePlayActive) { #if UNITY_ANDROID AssetDefineManager.RemoveCompileDefine("GooglePlayDef", new BuildTargetGroup[] { BuildTargetGroup.Android }); #endif } separator(); //Unity IAP GL.Label("Unity IAP", EditorStyles.boldLabel); GL.Label("Activate UnityIAP from Services Window", EditorStyles.label); vars.unityIAP = EGL.Toggle("Use UnityIAP", vars.unityIAP, "Toggle"); if (vars.unityIAP) { AssetDefineManager.AddCompileDefine("UnityIAP", new BuildTargetGroup[] { BuildTargetGroup.Android }); } else if (!vars.unityIAP) { AssetDefineManager.RemoveCompileDefine("UnityIAP", new BuildTargetGroup[] { BuildTargetGroup.Android }); } separator(); GL.Label("Other Options", EditorStyles.boldLabel); //facebook page GL.BeginHorizontal(); GL.Label("Facebook Page", GL.Width(100f)); vars.facebookPage = EGL.TextArea(vars.facebookPage, GL.Height(25f)); GL.EndHorizontal(); GL.Space(15f); //Rate Url GL.BeginHorizontal(); GL.Label("Rate Button Url", GL.Width(100f)); vars.rateButtonUrl = EGL.TextArea(vars.rateButtonUrl, GL.Height(25f)); GL.EndHorizontal(); GL.Space(15f); separator(); // EditorUtility.SetDirty(vars); GL.EndVertical(); } else { buttons[4] = "Open"; } GL.EndVertical(); // End Block #endregion GL.EndScrollView(); EditorUtility.SetDirty(vars); try{ liveUpdate(); }catch (Exception e) {} }
private void ShowSpawnZoneInfo() { // field.innerRadius = EGL.FloatField(new GUIContent("Inner Radius", "The inner radius of the field"), field.innerRadius); // field.outerRadius = EGL.Slider("Outer Radius", field.outerRadius, field.innerRadius, 10000 + field.innerRadius); field.spawnZone = (BoxCollider)EGL.ObjectField("BoxCollider", field.spawnZone, typeof(BoxCollider), true); }
public void OnGUI() { EditorGUIUtility.labelWidth = 75; if (atomMapHolder == null) { atomMapHolder = GameObject.Find("Atom Map List").transform; if (atomMapHolder == null) { GUI.Label(new Rect((position.width - 100) / 2, (position.height - 20) / 2, 100, 20), "NO ATOM MAP LIST"); return; } } if (ionMapHolder == null) { ionMapHolder = GameObject.Find("Ion Map List").transform; if (ionMapHolder == null) { GUI.Label(new Rect((position.width - 100) / 2, (position.height - 20) / 2, 100, 20), "NO ION MAP LIST"); return; } } if (atomMap == null || ionMap == null) { SetTargetMap(0); } GL.BeginHorizontal(); type = (IonType)EGL.EnumPopup("Ion Type:", type); behaviour = (IonBehaviour)EGL.EnumPopup("Behaviour:", behaviour); GL.EndHorizontal(); radiusIndex = EGL.IntSlider("Radius:", radiusIndex, 0, 500); GL.Label("Subdivision:"); subdivIndex = GL.Toolbar(subdivIndex, subdivLabels); subdivOffset = EGL.IntField("Subdiv Offset:", subdivOffset); if (behaviour == IonBehaviour.Orbit) { orbitFreq = EGL.FloatField("Orbit Speed:", orbitFreq); resetTrigger = (Atom)EGL.ObjectField("Reset Trig:", resetTrigger, typeof(Atom)); } bool prevEditingState = isEditing; GL.BeginHorizontal(); //GL.Label(""); isEditing = GL.Toggle(isEditing, "Enable/Disable Editing"); if (isEditing != prevEditingState) { ToggleEditing(isEditing); } int prevTarget = targetMapIndex; targetMapIndex = (int)Mathf.Clamp(EGL.IntField("Target Map", targetMapIndex), 0, atomMapHolder.childCount - 1); if (prevTarget != targetMapIndex) { SetTargetMap(targetMapIndex); } GL.EndHorizontal(); radius = radiusIndex * baseRadiusUnit; subdiv = subdivOptions[subdivIndex]; }
void showPopulationMapGUI() { EG.BeginDisabledGroup(!(terrainGenerated)); showPopUI = EGL.Foldout(showPopUI, populationLabel, true); if (showPopUI) { GL.BeginVertical(); GL.BeginHorizontal("box"); GL.BeginVertical(); GL.Label("Octaves"); GL.Label("Persistance"); GL.Label("Zoom"); GL.Label("Seed"); GL.EndVertical(); GL.BeginVertical(); CG.popOctaves = EGL.IntSlider(CG.popOctaves, 1, 6); CG.popPersistance = EGL.Slider(CG.popPersistance, 0, 0.5f); CG.popZoom = EGL.Slider(CG.popZoom, 0, 0.05f); GL.BeginHorizontal(); EG.BeginDisabledGroup(rPopSeed.target == false); CG.popSeed = EGL.IntSlider(CG.popSeed, 0, int.MaxValue); EG.EndDisabledGroup(); rPopSeed.target = EGL.Toggle(rPopSeed.target); GL.EndHorizontal(); GL.Space(20); GL.BeginHorizontal(); GL.Label("Or import your custom pop map: "); CG.popMapInput = (Texture2D)EGL.ObjectField(CG.popMapInput, typeof(Texture2D), false); GL.EndHorizontal(); GL.EndVertical(); GL.EndHorizontal(); GL.EndVertical(); GL.BeginHorizontal(); if (GL.Button("Generate Population Map")) { if (rPopSeed.target == false && CG.popMapInput == null) { CG.popSeed = Random.Range(0, int.MaxValue); } generator.generatePopulationMap(); isPopMap = true; CG.showPop = true; } EG.BeginDisabledGroup(!isPopMap); GL.BeginHorizontal(); GL.FlexibleSpace(); CG.showPop = EGL.ToggleLeft("Preview Pop Map", CG.showPop); GL.EndHorizontal(); GL.EndHorizontal(); if (GL.Button("Save and Proceed")) { populationGenerated = true; populationLabel = "2. Population Map Generation - COMPLETED ✔"; showPopUI = false; CG.showPop = false; showGrowthUI = true; } EG.EndDisabledGroup(); } EG.EndDisabledGroup(); }
public override void OnInspectorGUI() { bool flag = base.targets.Length > 1; Animator animator = base.target as Animator; base.serializedObject.UpdateIfDirtyOrScript(); this.UpdateShowOptions(); EditorGUI.BeginChangeCheck(); RuntimeAnimatorController runtimeAnimatorController = EditorGUILayout.ObjectField("Controller", animator.runtimeAnimatorController, typeof(RuntimeAnimatorController), false, new GUILayoutOption[0]) as RuntimeAnimatorController; if (EditorGUI.EndChangeCheck()) { UnityEngine.Object[] targets = base.targets; for (int i = 0; i < targets.Length; i++) { Animator animator2 = (Animator)targets[i]; Undo.RecordObject(animator2, "Changed AnimatorController"); animator2.runtimeAnimatorController = runtimeAnimatorController; } AnimationWindowUtility.ControllerChanged(); } EditorGUILayout.PropertyField(this.m_Avatar, new GUILayoutOption[0]); if (animator.supportsOnAnimatorMove && !flag) { EditorGUILayout.LabelField("Apply Root Motion", "Handled by Script", new GUILayoutOption[0]); } else { EditorGUILayout.PropertyField(this.m_ApplyRootMotion, AnimatorInspector.styles.applyRootMotion, new GUILayoutOption[0]); if (Event.current.type == EventType.Layout) { this.m_IsRootPositionOrRotationControlledByCurves = animator.isRootPositionOrRotationControlledByCurves; } if (!this.m_ApplyRootMotion.boolValue && this.m_IsRootPositionOrRotationControlledByCurves) { EditorGUILayout.HelpBox("Root position or rotation are controlled by curves", MessageType.Info, true); } } EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(this.m_UpdateMode, AnimatorInspector.styles.updateMode, new GUILayoutOption[0]); bool flag2 = EditorGUI.EndChangeCheck(); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(this.m_CullingMode, AnimatorInspector.styles.cullingMode, new GUILayoutOption[0]); bool flag3 = EditorGUI.EndChangeCheck(); if (!flag) { EditorGUILayout.HelpBox(animator.GetStats(), MessageType.Info, true); } if (EditorGUILayout.BeginFadeGroup(this.m_ShowWarningMessage.faded)) { EditorGUILayout.HelpBox(this.WarningMessage, MessageType.Warning, true); } EditorGUILayout.EndFadeGroup(); base.serializedObject.ApplyModifiedProperties(); UnityEngine.Object[] targets2 = base.targets; for (int j = 0; j < targets2.Length; j++) { Animator animator3 = (Animator)targets2[j]; if (flag3) { animator3.OnCullingModeChanged(); } if (flag2) { animator3.OnUpdateModeChanged(); } } }
void showGrowthMapGUI() { EG.BeginDisabledGroup(!(terrainGenerated)); showGrowthUI = EGL.Foldout(showGrowthUI, growthLabel, true); if (showGrowthUI) { GL.BeginVertical(); GL.BeginHorizontal(); GL.BeginVertical(); if (GL.Button("Basic Rule")) { CG.growthBasic = 1; CG.growthNewYork = 0; CG.growthParis = 0; } if (GL.Button("New York Rule")) { CG.growthNewYork = 1; CG.growthBasic = 0; CG.growthParis = 0; } if (GL.Button("Paris Rule")) { CG.growthParis = 1; CG.growthBasic = 0; CG.growthNewYork = 0; } GL.EndVertical(); GL.BeginVertical(); GL.Space(1); CG.growthBasic = EGL.Slider(1 - CG.growthNewYork - CG.growthParis, 0, 1); GL.Space(1); CG.growthNewYork = EGL.Slider(1 - CG.growthBasic - CG.growthParis, 0, 1); GL.Space(1); CG.growthParis = EGL.Slider(1 - CG.growthBasic - CG.growthNewYork, 0, 1); GL.EndVertical(); GL.EndHorizontal(); GL.Space(1); if (GL.Button("Default")) { CG.growthParis = 1f / 3f; CG.growthBasic = 1f / 3f; CG.growthNewYork = 1f / 3f; } GL.BeginHorizontal("box"); GL.BeginVertical(); GL.Label("Octaves"); GL.Label("Persistance"); GL.Label("Zoom"); GL.Label("Seed"); GL.EndVertical(); GL.BeginVertical(); CG.growthOctaves = EGL.IntSlider(CG.growthOctaves, 1, 6); CG.growthPersistance = EGL.Slider(CG.growthPersistance, 0, 0.7f); CG.growthZoom = EGL.Slider(CG.growthZoom, 0, 0.05f); GL.BeginHorizontal(); EG.BeginDisabledGroup(rGrowthSeed.target == false); CG.growthSeed = EGL.IntSlider(CG.growthSeed, 0, int.MaxValue); EG.EndDisabledGroup(); rGrowthSeed.target = EGL.Toggle(rGrowthSeed.target); GL.EndHorizontal(); GL.Space(20); GL.BeginHorizontal(); GL.Label("Or import your growth-rule map: "); CG.growthMapInput = (Texture2D)EGL.ObjectField(CG.growthMapInput, typeof(Texture2D), false); GL.EndHorizontal(); GL.EndVertical(); GL.EndHorizontal(); GL.EndVertical(); GL.BeginHorizontal(); if (GL.Button("Generate Growth Map")) { if (rGrowthSeed.target == false && CG.growthMapInput == null) { CG.growthSeed = Random.Range(0, int.MaxValue); } generator.generateGrowthRule(); isGrowthMap = true; CG.showGrowth = true; } EG.BeginDisabledGroup(!isGrowthMap); GL.BeginHorizontal(); GL.FlexibleSpace(); CG.showGrowth = EGL.ToggleLeft("Preview Growth Map", CG.showGrowth); GL.FlexibleSpace(); GL.EndHorizontal(); GL.EndHorizontal(); if (GL.Button("Save and Proceed")) { growthMapGenerated = true; growthLabel = "3. Growth Map Generation - COMPLETED ✔"; showGrowthUI = false; CG.showGrowth = false; showRoadMapUI = true; } EG.EndDisabledGroup(); } EG.EndDisabledGroup(); }
public static T ObjectField <T>(string label, T cur, bool allowSceneObjects = false, params GUILayoutOption[] opts) where T : Object { return((T)EGL.ObjectField(label, cur, typeof(T), allowSceneObjects, opts)); }