public static IntSlider ( |
||
label | Optional label in front of the slider. | |
value | int | The value the slider shows. This determines the position of the draggable thumb. |
leftValue | int | The value at the left end of the slider. |
rightValue | int | The value at the right end of the slider. |
리턴 | int |
public override void OnEditorGui() { if (gui.Button("InitLevel")) { foreach (var a in level.GetComponentsInChildren <AnimHelper>()) { a.Init(); } } prefabs = transform.Find("tools").Cast <Transform>().ToArray(); prefabst = prefabs.Select(a => a.name).ToArray(); gridSize = GUI.IntSlider("GridSize", gridSize, 1, 10); PlanePos = GUI.IntSlider("PlanePos", PlanePos, -10, 10); tool = (Tool)gui.SelectionGrid((int)tool, Enum.GetNames(typeof(Tool)), 2); if (tool != oldtool) { //Debug.Log("Chagne"); SelectedPrefab.gameObject.active = false; } oldtool = tool; //oldtooli = tooli; prefabsi = gui.SelectionGrid(prefabsi, prefabst, 2); base.OnEditorGui(); }
void ShowTerrainSettings() { LandmassEditorUtilities editorUtilities = LandmassEditorUtilities.Instance; ImporterConfiguration importCfg = editorUtilities.ImportCfg; TerrainConfiguration terrainStreamingConfiguration = importCfg.TerrainConfiguration; EGL.BeginVertical(); { EGL.BeginVertical(GuiUtils.Skin.box); { if (GUILayout.Button("Apply to selected TerrainData assets")) { QueueCall(editorUtilities.ApplyDimensionsToSelection); } } EGL.EndVertical(); EGL.Separator(); EGL.BeginVertical(GuiUtils.Skin.box); { GUILayout.Label("In-game terrain LOD settings."); terrainStreamingConfiguration.HeightmapPixelError = EGL.Slider("Pixel Error", terrainStreamingConfiguration.HeightmapPixelError, 1f, 200f); terrainStreamingConfiguration.BasemapDistance = EGL.FloatField("Basemap Dist.", terrainStreamingConfiguration.BasemapDistance); terrainStreamingConfiguration.CastShadows = EGL.Toggle("Cast Shadows", terrainStreamingConfiguration.CastShadows); EGL.Separator(); terrainStreamingConfiguration.DetailObjectDistance = EGL.Slider("Detail Distance", terrainStreamingConfiguration.DetailObjectDistance, 0f, 250f); terrainStreamingConfiguration.DetailObjectDensity = EGL.Slider("Detail Density", terrainStreamingConfiguration.DetailObjectDensity, 0f, 1f); terrainStreamingConfiguration.TreeDistance = EGL.Slider("Tree Distance", terrainStreamingConfiguration.TreeDistance, 0f, 2000f); terrainStreamingConfiguration.TreeBillboardDistance = EGL.Slider("Billboard Start", terrainStreamingConfiguration.TreeBillboardDistance, 50f, 2000f); terrainStreamingConfiguration.TreeCrossFadeLength = EGL.Slider("Fade Length", terrainStreamingConfiguration.TreeCrossFadeLength, 0f, 200f); terrainStreamingConfiguration.TreeMaximumFullLODCount = EGL.IntSlider("Max Mesh Trees", terrainStreamingConfiguration.TreeMaximumFullLODCount, 0, 500); EGL.Separator(); if (GUILayout.Button("Apply to selected Scene assets")) { QueueCall(editorUtilities.ApplyTerrainLODSettingsToSelection); } } EGL.EndVertical(); } EGL.EndVertical(); }
void showRoadMapGUI() { EG.BeginDisabledGroup(!(terrainGenerated && growthMapGenerated && populationGenerated)); showRoadMapUI = EGL.Foldout(showRoadMapUI, roadmapLabel, true); if (showRoadMapUI) { GL.Label("Streets", EditorStyles.centeredGreyMiniLabel); GL.BeginHorizontal(); GL.BeginVertical(); GL.Label("Width"); GL.Label("Min Length"); GL.Label("LookAhead"); GL.Label("Pop Threshold"); GL.Label("Max Slope"); GL.EndVertical(); GL.BeginVertical(); CG.streetWidth = EGL.IntSlider(CG.streetWidth, 5, 20); CG.streetMinLength = EGL.Slider(CG.streetMinLength, 5f, 100f); CG.streetLookAhead = EGL.IntSlider(CG.streetLookAhead, 1, (int)(CG.terrainSize / CG.streetMinLength)); CG.streetPopThreshold = EGL.Slider(CG.streetPopThreshold, 0f, 1f); CG.streetMaxSlope = EGL.Slider(CG.streetMaxSlope, 0f, 1f); GL.EndVertical(); GL.EndHorizontal(); GL.Space(5); GL.Label("Highways", EditorStyles.centeredGreyMiniLabel); GL.BeginHorizontal(); GL.BeginVertical(); GL.Label("Width"); GL.Label("Min Length"); GL.Label("LookAhead"); GL.Label("Pop Threshold"); GL.Label("Max Slope"); GL.EndVertical(); GL.BeginVertical(); CG.highwayWidth = EGL.IntSlider(CG.highwayWidth, 10, 25); CG.highwayMinLength = EGL.Slider(CG.highwayMinLength, 5f, 200f); CG.highwayLookAhead = EGL.IntSlider(CG.highwayLookAhead, 1, (int)(CG.terrainSize / CG.highwayMinLength)); CG.highwayPopThreshold = EGL.Slider(CG.highwayPopThreshold, 0f, 1f); CG.highwayMaxSlope = EGL.Slider(CG.highwayMaxSlope, 0f, 1f); GL.EndVertical(); GL.EndHorizontal(); GL.Space(10); showRoadMapAdvanced = EGL.Foldout(showRoadMapAdvanced, "Advanced Settings", true); if (showRoadMapAdvanced) { EGL.HelpBox("Adjusting these settings might break the Editor or severely influence performance.", MessageType.Warning); GL.Label("General Advanced Settings", EditorStyles.centeredGreyMiniLabel); GL.BeginHorizontal(); GL.BeginVertical(); GL.Label("Legalization Attempts"); GL.Label("Min Road Correction Angle"); GL.Label("Node Check Radius"); GL.Label("Road Connect Max Distance"); GL.Label("Ray Count"); GL.EndVertical(); GL.BeginVertical(); CG.legalizationAttempts = EGL.IntSlider(CG.legalizationAttempts, 1, 100); CG.minRoadAngle = EGL.IntSlider(CG.minRoadAngle, 0, 90); CG.nodeCheckRadius = EGL.Slider(CG.nodeCheckRadius, 0f, 100f); CG.roadConnectDistance = EGL.Slider(CG.roadConnectDistance, 0f, 100f); CG.rayCount = EGL.IntSlider(CG.rayCount, 1, 32); GL.EndVertical(); GL.EndHorizontal(); GL.Label("Advanced Settings for L-system Component", EditorStyles.centeredGreyMiniLabel); EGL.HelpBox("Low values correspond to higher priority.", MessageType.Info); GL.BeginHorizontal(); GL.BeginVertical(); GL.Label("Street - Priority"); GL.Label("Highway - Priority"); GL.EndVertical(); GL.BeginVertical(); CG.streetPriority = EGL.IntSlider(CG.streetPriority, 1, 5); CG.highwayPriority = EGL.IntSlider(CG.highwayPriority, 1, 5); GL.EndVertical(); GL.EndHorizontal(); GL.Label("Advanced Settings for Growth Rules", EditorStyles.centeredGreyMiniLabel); GL.BeginHorizontal(); GL.BeginVertical(); GL.Label("Street - Straight Angle"); GL.Label("Street - Branch Angle"); GL.Space(10); GL.Label("Highway - Branch Prob"); GL.Label("Highway - Straight Angle"); GL.Label("Highway - Branch Angle"); GL.EndVertical(); GL.BeginVertical(); CG.streetStraightAngle = EGL.Slider(CG.streetStraightAngle, 0f, 90f); CG.streetBranchAngle = EGL.Slider(CG.streetBranchAngle, 0f, 90f); GL.Space(10); CG.highwayBranchProb = EGL.Slider(CG.highwayBranchProb, 0f, 1f); CG.highwayStraightAngle = EGL.Slider(CG.highwayStraightAngle, 0f, 90f); CG.highwayBranchAngle = EGL.Slider(CG.highwayBranchAngle, 0f, 90f); GL.EndVertical(); GL.EndHorizontal(); } if (roadMapGenerated) { GL.BeginHorizontal("Box"); GL.FlexibleSpace(); CG.showPop = EGL.ToggleLeft("Preview Pop Map", CG.showPop); GL.FlexibleSpace(); CG.showGrowth = EGL.ToggleLeft("Preview Growth Map", CG.showGrowth); GL.FlexibleSpace(); GL.EndHorizontal(); if (DebugMode) { showPreviewGUI(); } } EGL.HelpBox("The 'Generate Road Map' button may take several tries to generate road map due to the random nature of the algorithm.", MessageType.Info); GL.BeginHorizontal(); if (GL.Button("Generate Road Map")) { GameObject roadMap = GameObject.Find("RoadMap"); GameObject nodes = GameObject.Find("Nodes"); if (roadMap != null) { roadMap.SetActive(true); } if (nodes != null) { nodes.SetActive(true); } generator.generateRoadMap(); roadMapGenerated = true; roadMeshGenerated = false; } EG.BeginDisabledGroup(!roadMapGenerated); if (GL.Button("Generate Road Meshes & Blocks")) { generator.generateRoadMeshes(); generator.generateBlocks(); roadMeshGenerated = true; } EG.EndDisabledGroup(); GL.EndHorizontal(); EG.BeginDisabledGroup(!roadMeshGenerated); if (GL.Button("Save and Proceed")) { showRoadMapUI = false; showRoadMapAdvanced = false; showBuildingUI = true; GameObject roadMap = GameObject.Find("RoadMap"); if (roadMap != null) { roadMap.SetActive(false); } GameObject nodes = GameObject.Find("Nodes"); if (nodes != null) { nodes.SetActive(false); } roadmapLabel = "4. Road Map Generation - COMPLETED ✔"; } EG.EndDisabledGroup(); } EG.EndDisabledGroup(); }
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(); }
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(); }
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 DrawGUI() { Material skyboxMaterial = m_SkyboxMaterial.objectReferenceValue as Material; m_bShowEnvironment = EditorGUILayout.FoldoutTitlebar(m_bShowEnvironment, Styles.env_top, true); if (m_bShowEnvironment) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(m_SkyboxMaterial, Styles.env_skybox_mat); if (skyboxMaterial && !EditorMaterialUtility.IsBackgroundMaterial(skyboxMaterial)) { EditorGUILayout.HelpBox(Styles.skyboxWarning.text, MessageType.Warning); } EditorGUILayout.PropertyField(m_Sun, Styles.env_skybox_sun); EditorGUILayout.Space(); EditorGUILayout.LabelField(Styles.env_amb_top); EditorGUI.indentLevel++; EditorGUILayout.IntPopup(m_AmbientSource, Styles.kFullAmbientSource, Styles.kFullAmbientSourceValues, Styles.env_amb_src); switch ((AmbientMode)m_AmbientSource.intValue) { case AmbientMode.Trilight: { EditorGUI.BeginChangeCheck(); Color newValueUp = EditorGUILayout.ColorField(Styles.ambientUp, m_AmbientSkyColor.colorValue, true, false, true); Color newValueMid = EditorGUILayout.ColorField(Styles.ambientMid, m_AmbientEquatorColor.colorValue, true, false, true); Color newValueDown = EditorGUILayout.ColorField(Styles.ambientDown, m_AmbientGroundColor.colorValue, true, false, true); if (EditorGUI.EndChangeCheck()) { m_AmbientSkyColor.colorValue = newValueUp; m_AmbientEquatorColor.colorValue = newValueMid; m_AmbientGroundColor.colorValue = newValueDown; } } break; case AmbientMode.Flat: { EditorGUI.BeginChangeCheck(); Color newValue = EditorGUILayout.ColorField(Styles.ambient, m_AmbientSkyColor.colorValue, true, false, true); if (EditorGUI.EndChangeCheck()) { m_AmbientSkyColor.colorValue = newValue; } } break; case AmbientMode.Skybox: if (skyboxMaterial == null) { EditorGUI.BeginChangeCheck(); Color newValue = EditorGUILayout.ColorField(Styles.ambient, m_AmbientSkyColor.colorValue, true, false, true); if (EditorGUI.EndChangeCheck()) { m_AmbientSkyColor.colorValue = newValue; } } else { // Ambient intensity - maximum is kEmissiveRGBMMax EditorGUILayout.Slider(m_AmbientIntensity, 0.0F, 8.0F, Styles.env_amb_int); } break; } // ambient GI - realtime / baked bool realtimeGISupported = SupportedRenderingFeatures.IsLightmapBakeTypeSupported(LightmapBakeType.Realtime); bool bakedGISupported = SupportedRenderingFeatures.IsLightmapBakeTypeSupported(LightmapBakeType.Baked); if ((m_EnabledBakedGI.boolValue || m_EnabledRealtimeGI.boolValue) && (bakedGISupported || realtimeGISupported)) { int[] modeVals = { 0, 1 }; if (m_EnabledBakedGI.boolValue && m_EnabledRealtimeGI.boolValue) { // if the user has selected the only state that is supported, then gray it out using (new EditorGUI.DisabledScope(((m_AmbientLightingMode.intValue == 0) && realtimeGISupported && !bakedGISupported) || ((m_AmbientLightingMode.intValue == 1) && bakedGISupported && !realtimeGISupported))) { EditorGUILayout.IntPopup(m_AmbientLightingMode, Styles.AmbientLightingModes, modeVals, Styles.AmbientLightingMode); } // if they have selected a state that isnt supported, show dialog, and still make the box editable if (((m_AmbientLightingMode.intValue == 0) && !realtimeGISupported) || ((m_AmbientLightingMode.intValue == 1) && !bakedGISupported)) { EditorGUILayout.HelpBox("The following mode is not supported and will fallback on " + (((m_AmbientLightingMode.intValue == 0) && !realtimeGISupported) ? "Baked" : "Realtime"), MessageType.Warning); } } // Show "Baked" if precomputed GI is disabled and "Realtime" if baked GI is disabled (but we don't wanna show the box if the whole mode is not supported.) else if ((m_EnabledBakedGI.boolValue && bakedGISupported) || (m_EnabledRealtimeGI.boolValue && realtimeGISupported)) { using (new EditorGUI.DisabledScope(true)) { EditorGUILayout.IntPopup(Styles.AmbientLightingMode, m_EnabledBakedGI.boolValue ? 1 : 0, Styles.AmbientLightingModes, modeVals); } } } EditorGUI.indentLevel--; EditorGUILayout.Space(); EditorGUILayout.LabelField(Styles.env_refl_top); EditorGUI.indentLevel++; EditorGUILayout.PropertyField(m_DefaultReflectionMode, Styles.env_refl_src); DefaultReflectionMode defReflectionMode = (DefaultReflectionMode)m_DefaultReflectionMode.intValue; switch (defReflectionMode) { case DefaultReflectionMode.FromSkybox: { int[] reflectionResolutionValuesArray = null; GUIContent[] reflectionResolutionTextArray = null; ReflectionProbeEditor.GetResolutionArray(ref reflectionResolutionValuesArray, ref reflectionResolutionTextArray); EditorGUILayout.IntPopup(m_DefaultReflectionResolution, reflectionResolutionTextArray, reflectionResolutionValuesArray, Styles.env_refl_res, GUILayout.MinWidth(40)); } break; case DefaultReflectionMode.Custom: EditorGUILayout.PropertyField(m_CustomReflection, Styles.customReflection); break; } EditorGUILayout.PropertyField(m_ReflectionCompression, Styles.env_refl_cmp); EditorGUILayout.Slider(m_ReflectionIntensity, 0.0F, 1.0F, Styles.env_refl_int); EditorGUILayout.IntSlider(m_ReflectionBounces, 1, 5, Styles.env_refl_bnc); EditorGUI.indentLevel--; EditorGUI.indentLevel--; EditorGUILayout.Space(); } }
static void CacheServerVersion1GUI(bool allowCacheServerChanges, string overrideAddress) { GUILayout.Label(Properties.assetPipelineVersion1, EditorStyles.boldLabel); GUILayout.Space(5); if (!allowCacheServerChanges) { EditorGUILayout.HelpBox("Cache Server preferences cannot be modified because a remote address was specified via command line argument. To modify Cache Server preferences, restart Unity without the " + kIpAddressKeyArgs + " command line argument.", MessageType.Info, true); } using (new EditorGUI.DisabledScope(!allowCacheServerChanges)) { var displayMode = !allowCacheServerChanges ? CacheServerMode.Remote : s_CacheServerMode; s_CacheServerMode = (CacheServerMode)EditorGUILayout.EnumPopup("Cache Server Mode", displayMode); } if (s_CacheServerMode == CacheServerMode.Remote) { using (new EditorGUI.DisabledScope(!allowCacheServerChanges)) { var displayAddress = overrideAddress != null ? overrideAddress : s_CacheServerIPAddress; s_CacheServerIPAddress = EditorGUILayout.TextField("IP Address", displayAddress); if (GUI.changed) { s_ConnectionState = ConnectionState.Unknown; } } GUILayout.Space(5); using (new EditorGUI.DisabledScope(AssetDatabase.IsV2Enabled())) { if (GUILayout.Button("Check Connection", GUILayout.Width(150))) { if (InternalEditorUtility.CanConnectToCacheServer()) { s_ConnectionState = ConnectionState.Success; } else { s_ConnectionState = ConnectionState.Failure; } } } GUILayout.Space(-25); var s = AssetDatabase.IsV1Enabled() ? s_ConnectionState : ConnectionState.Unknown; switch (s) { case ConnectionState.Success: EditorGUILayout.HelpBox("Connection successful.", MessageType.Info, false); break; case ConnectionState.Failure: EditorGUILayout.HelpBox("Connection failed.", MessageType.Warning, false); break; case ConnectionState.Unknown: GUILayout.Space(44); break; } } else if (s_CacheServerMode == CacheServerMode.Local) { const int kMinSizeInGigabytes = 1; const int kMaxSizeInGigabytes = 200; // Write size in GigaBytes. s_LocalCacheServerSize = EditorGUILayout.IntSlider(Properties.maxCacheSize, s_LocalCacheServerSize, kMinSizeInGigabytes, kMaxSizeInGigabytes); s_EnableCustomPath = EditorGUILayout.Toggle(Properties.customCacheLocation, s_EnableCustomPath); // browse for cache folder if not per project if (s_EnableCustomPath) { GUIStyle style = EditorStyles.miniButton; GUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(Properties.cacheFolderLocation, style); Rect r = GUILayoutUtility.GetRect(GUIContent.none, style); GUIContent guiText = string.IsNullOrEmpty(s_CachePath) ? Properties.browse : new GUIContent(s_CachePath); if (EditorGUI.DropdownButton(r, guiText, FocusType.Passive, style)) { string pathToOpen = s_CachePath; string path = EditorUtility.OpenFolderPanel(Properties.browseCacheLocation.text, pathToOpen, ""); if (!string.IsNullOrEmpty(path)) { if (LocalCacheServer.CheckValidCacheLocation(path)) { s_CachePath = path; WritePreferences(); } else { EditorUtility.DisplayDialog("Invalid Cache Location", string.Format("The directory {0} contains some files which don't look like Unity Cache server files. Please delete the directory contents or choose another directory.", path), "OK"); } EditorGUIUtility.ExitGUI(); } } GUILayout.EndHorizontal(); } else { s_CachePath = ""; } bool locationExists = LocalCacheServer.CheckCacheLocationExists(); if (locationExists == true) { GUIContent cacheSizeIs = EditorGUIUtility.TrTextContent("Cache size is unknown"); if (s_LocalCacheServerUsedSize != -1) { cacheSizeIs = EditorGUIUtility.TextContent("Cache size is " + EditorUtility.FormatBytes(s_LocalCacheServerUsedSize)); } GUILayout.BeginHorizontal(); GUIStyle style = EditorStyles.miniButton; EditorGUILayout.PrefixLabel(cacheSizeIs, style); Rect r = GUILayoutUtility.GetRect(GUIContent.none, style); if (EditorGUI.Button(r, Properties.enumerateCache, style)) { s_LocalCacheServerUsedSize = LocalCacheServer.CheckCacheLocationExists() ? FileUtil.GetDirectorySize(LocalCacheServer.GetCacheLocation()) : 0; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUIContent spacerContent = EditorGUIUtility.blankContent; EditorGUILayout.PrefixLabel(spacerContent, style); Rect r2 = GUILayoutUtility.GetRect(GUIContent.none, style); if (EditorGUI.Button(r2, Properties.cleanCache, style)) { LocalCacheServer.Clear(); s_LocalCacheServerUsedSize = 0; } GUILayout.EndHorizontal(); } else { EditorGUILayout.HelpBox("Local cache directory does not exist - please check that you can access the cache folder and are able to write to it", MessageType.Warning, false); //If the cache server was on an external HDD or on a temporarily unavailable network drive, set the size to unknown so that the user re-queries it when they've reconnected s_LocalCacheServerUsedSize = -1; } GUILayout.Label(Properties.cacheFolderLocation.text + ":"); GUILayout.Label(LocalCacheServer.GetCacheLocation(), Styles.cacheFolderLocation); } }
protected void ShowControls() { if (m_TransformSyncMode == null) { m_Initialized = false; } Init(); serializedObject.Update(); int sendRate = 0; if (m_NetworkSendIntervalProperty.floatValue != 0) { sendRate = (int)(1 / m_NetworkSendIntervalProperty.floatValue); } int newSendRate = EditorGUILayout.IntSlider(m_NetworkSendIntervalLabel, sendRate, 0, 30); if (newSendRate != sendRate) { if (newSendRate == 0) { m_NetworkSendIntervalProperty.floatValue = 0; } else { m_NetworkSendIntervalProperty.floatValue = 1.0f / newSendRate; } } EditorGUILayout.PropertyField(m_TransformSyncMode); if (m_TransformSyncMode.enumValueIndex == (int)NetworkTransform.TransformSyncMode.SyncRigidbody3D) { Rigidbody r3D = m_SyncTransform.GetComponent <Rigidbody>(); if (r3D == null) { Debug.LogError("Object has no Rigidbody component."); m_TransformSyncMode.enumValueIndex = (int)NetworkTransform.TransformSyncMode.SyncTransform; EditorUtility.SetDirty(m_SyncTransform); } } if (m_TransformSyncMode.enumValueIndex == (int)NetworkTransform.TransformSyncMode.SyncRigidbody2D) { Rigidbody2D r2D = m_SyncTransform.GetComponent <Rigidbody2D>(); if (r2D == null) { Debug.LogError("Object has no Rigidbody2D component."); m_TransformSyncMode.enumValueIndex = (int)NetworkTransform.TransformSyncMode.SyncTransform; EditorUtility.SetDirty(m_SyncTransform); } } if (m_TransformSyncMode.enumValueIndex == (int)NetworkTransform.TransformSyncMode.SyncCharacterController) { var cc = m_SyncTransform.GetComponent <CharacterController>(); if (cc == null) { Debug.LogError("Object has no CharacterController component."); m_TransformSyncMode.enumValueIndex = (int)NetworkTransform.TransformSyncMode.SyncTransform; EditorUtility.SetDirty(m_SyncTransform); } } EditorGUILayout.LabelField("Movement:"); EditorGUI.indentLevel += 1; EditorGUILayout.PropertyField(m_MovementTheshold, m_MovementThesholdLabel); if (m_VelocityThreshold.floatValue < 0) { m_VelocityThreshold.floatValue = 0; EditorUtility.SetDirty(m_SyncTransform); } if ((m_TransformSyncMode.enumValueIndex == (int)NetworkTransform.TransformSyncMode.SyncRigidbody3D) || (m_TransformSyncMode.enumValueIndex == (int)NetworkTransform.TransformSyncMode.SyncRigidbody2D)) { EditorGUILayout.PropertyField(m_VelocityThreshold, m_VelocityThresholdLabel); } if (m_MovementTheshold.floatValue < 0) { m_MovementTheshold.floatValue = 0; EditorUtility.SetDirty(m_SyncTransform); } EditorGUILayout.PropertyField(m_SnapThreshold, m_SnapThresholdLabel); EditorGUILayout.PropertyField(m_InterpolateMovement, m_InterpolateMovementLabel); EditorGUI.indentLevel -= 1; EditorGUILayout.LabelField("Rotation:"); EditorGUI.indentLevel += 1; int newRotation = EditorGUILayout.Popup( m_RotationAxisLabel, (int)m_SyncTransform.syncRotationAxis, axisOptions); if ((NetworkTransform.AxisSyncMode)newRotation != m_SyncTransform.syncRotationAxis) { m_SyncTransform.syncRotationAxis = (NetworkTransform.AxisSyncMode)newRotation; EditorUtility.SetDirty(m_SyncTransform); } EditorGUILayout.PropertyField(m_InterpolateRotation, m_InterpolateRotationLabel); EditorGUILayout.PropertyField(m_RotationSyncCompression, m_RotationSyncCompressionLabel); EditorGUILayout.PropertyField(m_SyncSpin, m_SyncSpinLabel); EditorGUI.indentLevel -= 1; serializedObject.ApplyModifiedProperties(); }
public static void OnGUI() { EventType type = Event.current.type; if (s_Constants == null) { s_Constants = new Constants(); } GUILayout.Space(10f); if (!InternalEditorUtility.HasTeamLicense()) { GUILayout.Label(EditorGUIUtility.TempContent("You need to have a Pro or Team license to use the cache server.", EditorGUIUtility.GetHelpIcon(MessageType.Warning)), EditorStyles.helpBox, new GUILayoutOption[0]); } using (new EditorGUI.DisabledScope(!InternalEditorUtility.HasTeamLicense())) { if (!s_PrefsLoaded) { ReadPreferences(); if ((s_CacheServerMode != CacheServerMode.Disabled) && (s_ConnectionState == ConnectionState.Unknown)) { if (InternalEditorUtility.CanConnectToCacheServer()) { s_ConnectionState = ConnectionState.Success; } else { s_ConnectionState = ConnectionState.Failure; } } s_PrefsLoaded = true; } EditorGUI.BeginChangeCheck(); if (Collab.instance.collabInfo.whitelisted && IsCollabCacheEnabled()) { s_CollabCacheEnabled = EditorGUILayout.Toggle("Use Collab Cache", s_CollabCacheEnabled, new GUILayoutOption[0]); using (new EditorGUI.DisabledScope(!s_CollabCacheEnabled)) { s_CollabCacheIPAddress = EditorGUILayout.TextField("Collab Cache IP Address", s_CollabCacheIPAddress, new GUILayoutOption[0]); } } s_CacheServerMode = (CacheServerMode)EditorGUILayout.EnumPopup("Cache Server Mode", s_CacheServerMode, new GUILayoutOption[0]); if (s_CacheServerMode != CacheServerMode.Remote) { goto Label_0238; } s_CacheServerIPAddress = EditorGUILayout.DelayedTextField("IP Address", s_CacheServerIPAddress, new GUILayoutOption[0]); if (GUI.changed) { s_ConnectionState = ConnectionState.Unknown; } GUILayout.Space(5f); GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width(150f) }; if (GUILayout.Button("Check Connection", options)) { if (InternalEditorUtility.CanConnectToCacheServer()) { s_ConnectionState = ConnectionState.Success; } else { s_ConnectionState = ConnectionState.Failure; } } GUILayout.Space(-25f); ConnectionState state = s_ConnectionState; if (state != ConnectionState.Success) { if (state == ConnectionState.Failure) { goto Label_0212; } if (state == ConnectionState.Unknown) { goto Label_0223; } } else { EditorGUILayout.HelpBox("Connection successful.", MessageType.Info, false); } goto Label_04B9; Label_0212: EditorGUILayout.HelpBox("Connection failed.", MessageType.Warning, false); goto Label_04B9; Label_0223: GUILayout.Space(44f); goto Label_04B9; Label_0238: if (s_CacheServerMode == CacheServerMode.Local) { s_LocalCacheServerSize = EditorGUILayout.IntSlider(Styles.maxCacheSize, s_LocalCacheServerSize, 1, 200, new GUILayoutOption[0]); s_EnableCustomPath = EditorGUILayout.Toggle(Styles.customCacheLocation, s_EnableCustomPath, new GUILayoutOption[0]); if (s_EnableCustomPath) { GUIStyle popup = EditorStyles.popup; GUILayout.BeginHorizontal(new GUILayoutOption[0]); EditorGUILayout.PrefixLabel(Styles.cacheFolderLocation, popup); Rect position = GUILayoutUtility.GetRect(GUIContent.none, popup); GUIContent content = !string.IsNullOrEmpty(s_CachePath) ? new GUIContent(s_CachePath) : Styles.browse; if (EditorGUI.ButtonMouseDown(position, content, FocusType.Passive, popup)) { string folder = s_CachePath; string str2 = EditorUtility.OpenFolderPanel(Styles.browseCacheLocation.text, folder, ""); if (!string.IsNullOrEmpty(str2)) { if (LocalCacheServer.CheckValidCacheLocation(str2)) { s_CachePath = str2; WritePreferences(); } else { EditorUtility.DisplayDialog("Invalid Cache Location", "The directory " + str2 + " contains some files which don't look like Unity Cache server files. Please delete the directory contents or choose another directory.", "OK"); } } } GUILayout.EndHorizontal(); } else { s_CachePath = ""; } if (LocalCacheServer.CheckCacheLocationExists()) { GUIContent label = EditorGUIUtility.TextContent("Cache size is unknown"); if (s_LocalCacheServerUsedSize != -1L) { label = EditorGUIUtility.TextContent("Cache size is " + EditorUtility.FormatBytes(s_LocalCacheServerUsedSize)); } GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUIStyle miniButton = EditorStyles.miniButton; EditorGUILayout.PrefixLabel(label, miniButton); if (EditorGUI.Button(GUILayoutUtility.GetRect(GUIContent.none, miniButton), Styles.enumerateCache, miniButton)) { s_LocalCacheServerUsedSize = !LocalCacheServer.CheckCacheLocationExists() ? 0L : FileUtil.GetDirectorySize(LocalCacheServer.GetCacheLocation()); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(new GUILayoutOption[0]); EditorGUILayout.PrefixLabel(EditorGUIUtility.blankContent, miniButton); if (EditorGUI.Button(GUILayoutUtility.GetRect(GUIContent.none, miniButton), Styles.cleanCache, miniButton)) { LocalCacheServer.Clear(); s_LocalCacheServerUsedSize = 0L; } GUILayout.EndHorizontal(); } else { EditorGUILayout.HelpBox("Local cache directory does not exist - please check that you can access the cache folder and are able to write to it", MessageType.Warning, false); s_LocalCacheServerUsedSize = -1L; } GUILayout.Label(Styles.cacheFolderLocation.text + ":", new GUILayoutOption[0]); GUILayout.Label(LocalCacheServer.GetCacheLocation(), s_Constants.cacheFolderLocation, new GUILayoutOption[0]); } Label_04B9: if (EditorGUI.EndChangeCheck()) { s_HasPendingChanges = true; } if (s_HasPendingChanges && (GUIUtility.hotControl == 0)) { s_HasPendingChanges = false; WritePreferences(); ReadPreferences(); } } }
public static void OnGUI() { EventType type = Event.current.type; if (CacheServerPreferences.s_Constants == null) { CacheServerPreferences.s_Constants = new CacheServerPreferences.Constants(); } if (!InternalEditorUtility.HasTeamLicense()) { GUILayout.Label(EditorGUIUtility.TempContent("You need to have a Pro or Team license to use the cache server.", EditorGUIUtility.GetHelpIcon(MessageType.Warning)), EditorStyles.helpBox, new GUILayoutOption[0]); } using (new EditorGUI.DisabledScope(!InternalEditorUtility.HasTeamLicense())) { if (!CacheServerPreferences.s_PrefsLoaded) { CacheServerPreferences.ReadPreferences(); if (CacheServerPreferences.s_CacheServerMode != CacheServerPreferences.CacheServerMode.Disabled && CacheServerPreferences.s_ConnectionState == CacheServerPreferences.ConnectionState.Unknown) { if (InternalEditorUtility.CanConnectToCacheServer()) { CacheServerPreferences.s_ConnectionState = CacheServerPreferences.ConnectionState.Success; } else { CacheServerPreferences.s_ConnectionState = CacheServerPreferences.ConnectionState.Failure; } } CacheServerPreferences.s_PrefsLoaded = true; } EditorGUI.BeginChangeCheck(); if (CacheServerPreferences.IsCollabCacheEnabled()) { CacheServerPreferences.s_CollabCacheEnabled = EditorGUILayout.Toggle("Use Collab Cache", CacheServerPreferences.s_CollabCacheEnabled, new GUILayoutOption[0]); using (new EditorGUI.DisabledScope(!CacheServerPreferences.s_CollabCacheEnabled)) { CacheServerPreferences.s_CollabCacheIPAddress = EditorGUILayout.TextField("Collab Cache IP Address", CacheServerPreferences.s_CollabCacheIPAddress, new GUILayoutOption[0]); } } CacheServerPreferences.s_CacheServerMode = (CacheServerPreferences.CacheServerMode)EditorGUILayout.EnumPopup("Cache Server Mode", CacheServerPreferences.s_CacheServerMode, new GUILayoutOption[0]); if (CacheServerPreferences.s_CacheServerMode == CacheServerPreferences.CacheServerMode.Remote) { CacheServerPreferences.s_CacheServerIPAddress = EditorGUILayout.DelayedTextField("IP Address", CacheServerPreferences.s_CacheServerIPAddress, new GUILayoutOption[0]); if (GUI.changed) { CacheServerPreferences.s_ConnectionState = CacheServerPreferences.ConnectionState.Unknown; } GUILayout.Space(5f); if (GUILayout.Button("Check Connection", new GUILayoutOption[] { GUILayout.Width(150f) })) { if (InternalEditorUtility.CanConnectToCacheServer()) { CacheServerPreferences.s_ConnectionState = CacheServerPreferences.ConnectionState.Success; } else { CacheServerPreferences.s_ConnectionState = CacheServerPreferences.ConnectionState.Failure; } } GUILayout.Space(-25f); CacheServerPreferences.ConnectionState connectionState = CacheServerPreferences.s_ConnectionState; if (connectionState != CacheServerPreferences.ConnectionState.Success) { if (connectionState != CacheServerPreferences.ConnectionState.Failure) { if (connectionState == CacheServerPreferences.ConnectionState.Unknown) { GUILayout.Space(44f); } } else { EditorGUILayout.HelpBox("Connection failed.", MessageType.Warning, false); } } else { EditorGUILayout.HelpBox("Connection successful.", MessageType.Info, false); } } else if (CacheServerPreferences.s_CacheServerMode == CacheServerPreferences.CacheServerMode.Local) { CacheServerPreferences.s_LocalCacheServerSize = EditorGUILayout.IntSlider(CacheServerPreferences.Styles.maxCacheSize, CacheServerPreferences.s_LocalCacheServerSize, 1, 200, new GUILayoutOption[0]); CacheServerPreferences.s_EnableCustomPath = EditorGUILayout.Toggle(CacheServerPreferences.Styles.customCacheLocation, CacheServerPreferences.s_EnableCustomPath, new GUILayoutOption[0]); if (CacheServerPreferences.s_EnableCustomPath) { GUIStyle miniButton = EditorStyles.miniButton; GUILayout.BeginHorizontal(new GUILayoutOption[0]); EditorGUILayout.PrefixLabel(CacheServerPreferences.Styles.cacheFolderLocation, miniButton); Rect rect = GUILayoutUtility.GetRect(GUIContent.none, miniButton); GUIContent content = (!string.IsNullOrEmpty(CacheServerPreferences.s_CachePath)) ? new GUIContent(CacheServerPreferences.s_CachePath) : CacheServerPreferences.Styles.browse; if (EditorGUI.DropdownButton(rect, content, FocusType.Passive, miniButton)) { string folder = CacheServerPreferences.s_CachePath; string text = EditorUtility.OpenFolderPanel(CacheServerPreferences.Styles.browseCacheLocation.text, folder, ""); if (!string.IsNullOrEmpty(text)) { if (LocalCacheServer.CheckValidCacheLocation(text)) { CacheServerPreferences.s_CachePath = text; CacheServerPreferences.WritePreferences(); } else { EditorUtility.DisplayDialog("Invalid Cache Location", "The directory " + text + " contains some files which don't look like Unity Cache server files. Please delete the directory contents or choose another directory.", "OK"); } } } GUILayout.EndHorizontal(); } else { CacheServerPreferences.s_CachePath = ""; } bool flag = LocalCacheServer.CheckCacheLocationExists(); if (flag) { GUIContent label = EditorGUIUtility.TextContent("Cache size is unknown"); if (CacheServerPreferences.s_LocalCacheServerUsedSize != -1L) { label = EditorGUIUtility.TextContent("Cache size is " + EditorUtility.FormatBytes(CacheServerPreferences.s_LocalCacheServerUsedSize)); } GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUIStyle miniButton2 = EditorStyles.miniButton; EditorGUILayout.PrefixLabel(label, miniButton2); Rect rect2 = GUILayoutUtility.GetRect(GUIContent.none, miniButton2); if (EditorGUI.Button(rect2, CacheServerPreferences.Styles.enumerateCache, miniButton2)) { CacheServerPreferences.s_LocalCacheServerUsedSize = ((!LocalCacheServer.CheckCacheLocationExists()) ? 0L : FileUtil.GetDirectorySize(LocalCacheServer.GetCacheLocation())); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUIContent blankContent = EditorGUIUtility.blankContent; EditorGUILayout.PrefixLabel(blankContent, miniButton2); Rect rect3 = GUILayoutUtility.GetRect(GUIContent.none, miniButton2); if (EditorGUI.Button(rect3, CacheServerPreferences.Styles.cleanCache, miniButton2)) { LocalCacheServer.Clear(); CacheServerPreferences.s_LocalCacheServerUsedSize = 0L; } GUILayout.EndHorizontal(); } else { EditorGUILayout.HelpBox("Local cache directory does not exist - please check that you can access the cache folder and are able to write to it", MessageType.Warning, false); CacheServerPreferences.s_LocalCacheServerUsedSize = -1L; } GUILayout.Label(CacheServerPreferences.Styles.cacheFolderLocation.text + ":", new GUILayoutOption[0]); GUILayout.Label(LocalCacheServer.GetCacheLocation(), CacheServerPreferences.s_Constants.cacheFolderLocation, new GUILayoutOption[0]); } if (EditorGUI.EndChangeCheck()) { CacheServerPreferences.s_HasPendingChanges = true; } if (CacheServerPreferences.s_HasPendingChanges && GUIUtility.hotControl == 0) { CacheServerPreferences.s_HasPendingChanges = false; CacheServerPreferences.WritePreferences(); CacheServerPreferences.ReadPreferences(); } } }
private void OnSampleSettingGUI(BuildTargetGroup platform, AudioImporterInspector.MultiValueStatus status, bool selectionContainsTrackerFile, ref AudioImporterInspector.SampleSettingProperties properties, bool disablePreloadAudioDataOption) { EditorGUI.showMixedValue = status.multiLoadType && !properties.loadTypeChanged; EditorGUI.BeginChangeCheck(); AudioClipLoadType audioClipLoadType = (AudioClipLoadType)EditorGUILayout.EnumPopup("Load Type", (Enum)properties.settings.loadType, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { properties.settings.loadType = audioClipLoadType; properties.loadTypeChanged = true; } EditorGUI.BeginDisabledGroup(disablePreloadAudioDataOption); if (disablePreloadAudioDataOption) { EditorGUILayout.Toggle("Preload Audio Data", false, new GUILayoutOption[0]); } else { EditorGUILayout.PropertyField(this.m_PreloadAudioData); } EditorGUI.EndDisabledGroup(); if (selectionContainsTrackerFile) { return; } AudioCompressionFormat[] formatsForPlatform = this.GetFormatsForPlatform(platform); EditorGUI.showMixedValue = status.multiCompressionFormat && !properties.compressionFormatChanged; EditorGUI.BeginChangeCheck(); AudioCompressionFormat compressionFormat = (AudioCompressionFormat)EditorGUILayout.IntPopup("Compression Format", (int)properties.settings.compressionFormat, Array.ConvertAll <AudioCompressionFormat, string>(formatsForPlatform, (Converter <AudioCompressionFormat, string>)(value => value.ToString())), Array.ConvertAll <AudioCompressionFormat, int>(formatsForPlatform, (Converter <AudioCompressionFormat, int>)(value => (int)value)), new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { properties.settings.compressionFormat = compressionFormat; properties.compressionFormatChanged = true; } if (this.CompressionFormatHasQuality(properties.settings.compressionFormat)) { EditorGUI.showMixedValue = status.multiQuality && !properties.qualityChanged; EditorGUI.BeginChangeCheck(); int num = EditorGUILayout.IntSlider("Quality", (int)Mathf.Clamp(properties.settings.quality * 100f, 1f, 100f), 1, 100, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { properties.settings.quality = 0.01f * (float)num; properties.qualityChanged = true; } } EditorGUI.showMixedValue = status.multiSampleRateSetting && !properties.sampleRateSettingChanged; EditorGUI.BeginChangeCheck(); AudioSampleRateSetting sampleRateSetting = (AudioSampleRateSetting)EditorGUILayout.EnumPopup("Sample Rate Setting", (Enum)properties.settings.sampleRateSetting, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { properties.settings.sampleRateSetting = sampleRateSetting; properties.sampleRateSettingChanged = true; } if (properties.settings.sampleRateSetting == AudioSampleRateSetting.OverrideSampleRate) { EditorGUI.showMixedValue = status.multiSampleRateOverride && !properties.sampleRateOverrideChanged; EditorGUI.BeginChangeCheck(); int num = EditorGUILayout.IntPopup("Sample Rate", (int)properties.settings.sampleRateOverride, AudioImporterInspector.Styles.kSampleRateStrings, AudioImporterInspector.Styles.kSampleRateValues, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { properties.settings.sampleRateOverride = (uint)num; properties.sampleRateOverrideChanged = true; } } EditorGUI.showMixedValue = false; }
protected void ShowControls() { if (this.m_TransformSyncMode == null) { this.m_Initialized = false; } this.Init(); this.serializedObject.Update(); int num1 = 0; if ((double)this.m_NetworkSendIntervalProperty.floatValue != 0.0) { num1 = (int)(1.0 / (double)this.m_NetworkSendIntervalProperty.floatValue); } int num2 = EditorGUILayout.IntSlider(this.m_NetworkSendIntervalLabel, num1, 0, 30, new GUILayoutOption[0]); if (num2 != num1) { this.m_NetworkSendIntervalProperty.floatValue = num2 != 0 ? 1f / (float)num2 : 0.0f; } EditorGUILayout.PropertyField(this.m_TransformSyncMode); if (this.m_TransformSyncMode.enumValueIndex == 3 && (Object)this.m_SyncTransform.GetComponent <Rigidbody>() == (Object)null) { Debug.LogError((object)"Object has no Rigidbody component."); this.m_TransformSyncMode.enumValueIndex = 1; EditorUtility.SetDirty((Object)this.m_SyncTransform); } if (this.m_TransformSyncMode.enumValueIndex == 2 && (Object)this.m_SyncTransform.GetComponent <Rigidbody2D>() == (Object)null) { Debug.LogError((object)"Object has no Rigidbody2D component."); this.m_TransformSyncMode.enumValueIndex = 1; EditorUtility.SetDirty((Object)this.m_SyncTransform); } if (this.m_TransformSyncMode.enumValueIndex == 4 && (Object)this.m_SyncTransform.GetComponent <CharacterController>() == (Object)null) { Debug.LogError((object)"Object has no CharacterController component."); this.m_TransformSyncMode.enumValueIndex = 1; EditorUtility.SetDirty((Object)this.m_SyncTransform); } EditorGUILayout.LabelField("Movement:"); ++EditorGUI.indentLevel; EditorGUILayout.PropertyField(this.m_MovementTheshold, this.m_MovementThesholdLabel, new GUILayoutOption[0]); if ((double)this.m_MovementTheshold.floatValue < 0.0) { this.m_MovementTheshold.floatValue = 0.0f; EditorUtility.SetDirty((Object)this.m_SyncTransform); } EditorGUILayout.PropertyField(this.m_SnapThreshold, this.m_SnapThresholdLabel, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_InterpolateMovement, this.m_InterpolateMovementLabel, new GUILayoutOption[0]); --EditorGUI.indentLevel; EditorGUILayout.LabelField("Rotation:"); ++EditorGUI.indentLevel; int num3 = EditorGUILayout.Popup("Rotation Axis", (int)this.m_SyncTransform.syncRotationAxis, NetworkTransformEditor.axisOptions, new GUILayoutOption[0]); if ((NetworkTransform.AxisSyncMode)num3 != this.m_SyncTransform.syncRotationAxis) { this.m_SyncTransform.syncRotationAxis = (NetworkTransform.AxisSyncMode)num3; EditorUtility.SetDirty((Object)this.m_SyncTransform); } EditorGUILayout.PropertyField(this.m_InterpolateRotation, this.m_InterpolateRotationLabel, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_RotationSyncCompression, this.m_RotationSyncCompressionLabel, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_SyncSpin, this.m_SyncSpinLabel, new GUILayoutOption[0]); --EditorGUI.indentLevel; this.serializedObject.ApplyModifiedProperties(); }
void showPreviewGUI() { GL.BeginVertical("Box"); GL.Label("Showing first: " + (int)PreviewRoads.NrRoads + " roads"); GL.BeginHorizontal(); { if (GL.Button("|<", GL.Height(30))) { m_PlaybackModifier = 0f; PreviewRoads.NrRoads = 0; SceneView.RepaintAll(); } if (GL.Button("<", GL.Height(30))) { m_PlaybackModifier = 0f; PreviewRoads.NrRoads -= 1; } if (m_PlaybackModifier == 0) { if (GL.Button("< Play", GL.Height(30))) { m_PlaybackModifier = -2f; } if (GL.Button("Play >", GL.Height(30))) { m_PlaybackModifier = 2f; } } else { if (GL.Button("||", GL.Height(30))) { m_PlaybackModifier = 0f; } } if (GL.Button(">", GL.Height(30))) { m_PlaybackModifier = 0f; PreviewRoads.NrRoads += 1; } if (GL.Button(">|", GL.Height(30))) { m_PlaybackModifier = 0f; PreviewRoads.NrRoads = CG.nrOfRoads; SceneView.RepaintAll(); } } GL.EndHorizontal(); if (m_PlaybackModifier == 0) { PreviewRoads.NrRoads = EGL.IntSlider((int)PreviewRoads.NrRoads, 0, CG.nrOfRoads); } else { EGL.IntSlider((int)PreviewRoads.NrRoads, 0, CG.nrOfRoads); } 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 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 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 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 Other Options // Start Block blockHeader("Other Options", "AdMob, Google Play Services and etc. options.", 0); 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); vars.admobActive = EGL.Toggle("Use Admob Ads", vars.admobActive, "Toggle"); if (vars.admobActive) { AssetDefineManager.AddCompileDefine("AdmobDef", new BuildTargetGroup[] { BuildTargetGroup.Android, BuildTargetGroup.iOS }); //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(); } 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(); EditorUtility.SetDirty(vars); GL.EndVertical(); GL.EndVertical(); // End Block #endregion GL.EndScrollView(); EditorUtility.SetDirty(vars); }
private void OnSampleSettingGUI(BuildTargetGroup platform, MultiValueStatus status, bool selectionContainsTrackerFile, ref SampleSettingProperties properties, bool disablePreloadAudioDataOption) { //Load Type EditorGUI.showMixedValue = status.multiLoadType && !properties.loadTypeChanged; EditorGUI.BeginChangeCheck(); AudioClipLoadType newLoadType = (AudioClipLoadType)EditorGUILayout.EnumPopup("Load Type", properties.settings.loadType); if (EditorGUI.EndChangeCheck()) { properties.settings.loadType = newLoadType; properties.loadTypeChanged = true; } using (new EditorGUI.DisabledScope(disablePreloadAudioDataOption)) { if (disablePreloadAudioDataOption) { EditorGUILayout.Toggle("Preload Audio Data", false); } else { EditorGUILayout.PropertyField(m_PreloadAudioData); } } if (!selectionContainsTrackerFile) { //Compression format AudioCompressionFormat[] allowedFormats = GetFormatsForPlatform(platform); EditorGUI.showMixedValue = status.multiCompressionFormat && !properties.compressionFormatChanged; EditorGUI.BeginChangeCheck(); AudioCompressionFormat newFormat = (AudioCompressionFormat)EditorGUILayout.IntPopup("Compression Format", (int)properties.settings.compressionFormat, Array.ConvertAll(allowedFormats, value => value.ToString()), Array.ConvertAll(allowedFormats, value => (int)value)); if (EditorGUI.EndChangeCheck()) { properties.settings.compressionFormat = newFormat; properties.compressionFormatChanged = true; } //Quality if (CompressionFormatHasQuality(properties.settings.compressionFormat)) { EditorGUI.showMixedValue = status.multiQuality && !properties.qualityChanged; EditorGUI.BeginChangeCheck(); int newQuality = EditorGUILayout.IntSlider("Quality", (int)Mathf.Clamp(properties.settings.quality * 100.0f, 1.0f, 100.0f), 1, 100); if (EditorGUI.EndChangeCheck()) { properties.settings.quality = 0.01f * newQuality; properties.qualityChanged = true; } } if (platform != BuildTargetGroup.WebGL) { //Sample rate settings EditorGUI.showMixedValue = status.multiSampleRateSetting && !properties.sampleRateSettingChanged; EditorGUI.BeginChangeCheck(); AudioSampleRateSetting newSetting = (AudioSampleRateSetting)EditorGUILayout.EnumPopup("Sample Rate Setting", properties.settings.sampleRateSetting); if (EditorGUI.EndChangeCheck()) { properties.settings.sampleRateSetting = newSetting; properties.sampleRateSettingChanged = true; } //Sample rate settings if (properties.settings.sampleRateSetting == AudioSampleRateSetting.OverrideSampleRate) { EditorGUI.showMixedValue = status.multiSampleRateOverride && !properties.sampleRateOverrideChanged; EditorGUI.BeginChangeCheck(); int newRate = EditorGUILayout.IntPopup("Sample Rate", (int)properties.settings.sampleRateOverride, Styles.kSampleRateStrings, Styles.kSampleRateValues); if (EditorGUI.EndChangeCheck()) { properties.settings.sampleRateOverride = (uint)newRate; properties.sampleRateOverrideChanged = true; } } } //TODO include the settings for things like HEVAG EditorGUI.showMixedValue = false; } }