public void SetSceneData(SelectableScene sd) { if (Button == null) { return; } sceneData = sd; Text t = Button.GetComponentInChildren <Text>(); if (t != null) { t.text = sceneData.Name; } //Button.onClick.AddListener(OnButtonClicked); #if UNITY_5_2 string sceneName = Application.loadedLevelName; #else string sceneName = SceneManager.GetActiveScene().name; #endif bool current = System.IO.Path.GetFileNameWithoutExtension(sceneName) == System.IO.Path.GetFileNameWithoutExtension(sceneData.ID); Icon.sprite = sceneData.Icon; Button.colors = new ColorBlock() { normalColor = current? sd.ActiveColor : sd.NormalColor, highlightedColor = sd.HighlighedColor, pressedColor = sd.PressedColor, disabledColor = sd.ActiveColor, colorMultiplier = 1.0f, fadeDuration = 0.1f }; }
public void SetSceneData(SelectableScene sd) { sceneData = sd; Text t = Button.GetComponentInChildren<Text>(); if (t != null) { t.text = sceneData.Name; } //Button.onClick.AddListener(OnButtonClicked); #if UNITY_5_2 string sceneName = Application.loadedLevelName; #else string sceneName = SceneManager.GetActiveScene().name; #endif bool current = System.IO.Path.GetFileNameWithoutExtension(sceneName) == System.IO.Path.GetFileNameWithoutExtension(sceneData.ID); Icon.sprite = sceneData.Icon; Button.colors = new ColorBlock() { normalColor = current? sd.ActiveColor : sd.NormalColor, highlightedColor = sd.HighlighedColor, pressedColor = sd.PressedColor, disabledColor = sd.ActiveColor, colorMultiplier = 1.0f, fadeDuration = 0.1f }; }
public void LoadLevel(SelectableScene scene) { if (UseAsyncLoading) { StartCoroutine(SceneLoadCoroutine(System.IO.Path.GetFileNameWithoutExtension(scene.ID))); } else { #if UNITY_5_2 Application.LoadLevel(System.IO.Path.GetFileNameWithoutExtension(scene.ID)); #else SceneManager.LoadScene(System.IO.Path.GetFileNameWithoutExtension(scene.ID)); #endif } }