MadRootNode Init(string rootObjectName, int layer) { var go = new GameObject(); go.name = rootObjectName; var root = go.AddComponent <MadRootNode>(); bool hasOtherCamera = GameObject.FindObjectOfType(typeof(Camera)) != null; var camera = MadTransform.CreateChild <MadNode>(go.transform, "Camera 2D"); var cam = camera.gameObject.AddComponent <Camera>(); cam.backgroundColor = Color.gray; cam.orthographic = true; cam.orthographicSize = 1; cam.nearClipPlane = -2; cam.farClipPlane = 2; cam.transform.localScale = new Vector3(1, 1, 0.01f); if (hasOtherCamera) { cam.clearFlags = CameraClearFlags.Depth; } var panel = camera.CreateChild <MadPanel>("Panel"); // setup layers cam.cullingMask = 1 << layer; panel.gameObject.layer = layer; AfterCreate(root); return(root); }
MadSprite BuildSlide(MadSprite template, string anchorName, bool left) { MadAnchor slideAnchor = MadTransform.FindChildWithName <MadAnchor>(transform, anchorName); if (slideAnchor != null) { DestroyImmediate(slideAnchor.gameObject); } slideAnchor = CreateChild <MadAnchor>(anchorName); if (hideManagedObjects) { slideAnchor.gameObject.hideFlags = HideFlags.HideInHierarchy; } slideAnchor.position = left ? MadAnchor.Position.Left : MadAnchor.Position.Right; slideAnchor.Update(); // explict update call because position has changed var offset = MadTransform.CreateChild(slideAnchor.transform, "Offset"); offset.transform.localPosition = new Vector3(left ? template.texture.width / 2 : -template.texture.width / 2, 0, 0); var slide = MadTransform.CreateChild <MadSprite>(offset.transform, "slide", template); slide.transform.localScale = Vector3.one; slide.transform.localPosition = Vector3.zero; slide.guiDepth = 1000; return(slide); }
void RebuildConstruct() { int count = draggable.dragStopCount; bulletSprites = new MadSprite[count]; Vector3 startPosition = -(bulletDistance * (count - 1)) / 2; for (int i = 0; i < count; ++i) { var sprite = MadTransform.CreateChild <MadSprite>(transform, "generated_bullet_" + (i + 1)); sprite.transform.localPosition = startPosition + ((Vector3)bulletDistance * i); sprite.texture = BulletTexture(i); sprite.guiDepth = guiDepth; bulletSprites[i] = sprite; if (hideManagedObjects) { sprite.gameObject.hideFlags = HideFlags.HideInHierarchy; } else { //sprite.gameObject.hideFlags = HideFlags.DontSave; } } }
public static MadRootNode Init(string rootObjectName, int layer, bool hideInvisibleSprites = false, bool depthBasedRenderMode = false) { CheckEmptyScene(); var go = new GameObject(); go.name = rootObjectName; var root = go.AddComponent <MadRootNode>(); Camera[] otherCameras = GameObject.FindObjectsOfType(typeof(Camera)) as Camera[]; bool hasOtherCamera = otherCameras.Length > 0; float maxDepth = 0; for (int i = 0; i < otherCameras.Length; ++i) { if (otherCameras[i].depth > maxDepth) { maxDepth = otherCameras[i].depth; } } var camera = MadTransform.CreateChild <MadNode>(go.transform, "Camera 2D"); var cam = camera.gameObject.AddComponent <Camera>(); cam.backgroundColor = Color.gray; cam.orthographic = true; cam.orthographicSize = 1; cam.nearClipPlane = CameraNearClip; cam.farClipPlane = CameraFarClip; //cam.transform.localScale = new Vector3(1, 1, 0.01f); cam.depth = maxDepth + 1; if (hasOtherCamera) { cam.clearFlags = CameraClearFlags.Depth; } else { cam.tag = "MainCamera"; cam.clearFlags = CameraClearFlags.SolidColor; cam.gameObject.AddComponent <AudioListener>(); } var panel = MadTransform.CreateChild <MadPanel>(go.transform, "Panel"); panel.hideInvisibleSprites = hideInvisibleSprites; if (depthBasedRenderMode) { panel.renderMode = MadPanel.RenderMode.DepthBased; } // setup layers cam.cullingMask = 1 << layer; panel.gameObject.layer = layer; return(root); }
private void CreateEmpty() { var empty = MadTransform.CreateChild <Transform>(sprite.transform, "new_empty"); empty.transform.localPosition = Vector3.zero; empty.transform.localScale = Vector3.one; Selection.activeGameObject = empty.gameObject; }
public static MadLevelFreeLayout CreateUnderPanel(MadPanel panel) { MadUndo.LegacyRegisterSceneUndo("Creating Free Layout"); var child = MadTransform.CreateChild <MadLevelFreeLayout>(panel.transform, "Free Layout"); Selection.activeObject = child; return(child); }
public static MadLevelGridLayout CreateUnderPanel(MadPanel panel) { MadUndo.LegacyRegisterSceneUndo("Creating Grid Layout"); var child = MadTransform.CreateChild <MadLevelGridLayout>(panel.transform, "Grid Layout"); child.setupMethod = MadLevelGridLayout.SetupMethod.Generate; Selection.activeObject = child; return(child); }
void Create() { var background = MadTransform.CreateChild <MadLevelBackground>(panel.transform, objectName); Selection.activeGameObject = background.gameObject; if (draggable != null) { background.draggable = draggable; } }
void Create() { var background = MadTransform.CreateChild <MadLevelBackground>(panel.transform, objectName); background.transform.localPosition = new Vector3(0, 0, 1000); Selection.activeGameObject = background.gameObject; if (draggable != null) { background.draggable = draggable; } }
private void CreateSprite() { var s = MadTransform.CreateChild <MadSprite>(sprite.transform, "new_sprite"); s.transform.localPosition = Vector3.zero; s.transform.localScale = Vector3.one; s.ResizeToTexture(); s.guiDepth = NextDepth(); Selection.activeGameObject = s.gameObject; }
private void CreateTextProperty() { var property = MadTransform.CreateChild <MadLevelPropertyText>(sprite.transform, "new_text_property"); var text = property.gameObject.AddComponent <MadText>(); property.transform.localPosition = Vector3.zero; property.transform.localScale = Vector3.one; text.text = "Default Text"; text.guiDepth = NextDepth(); Selection.activeGameObject = text.gameObject; }
private void CreateSpriteProperty() { var property = MadTransform.CreateChild <MadLevelProperty>(sprite.transform, "new_sprite_property"); var s = property.gameObject.AddComponent <MadSprite>(); property.transform.localPosition = Vector3.zero; property.transform.localScale = Vector3.one; s.ResizeToTexture(); s.guiDepth = NextDepth(); Selection.activeGameObject = s.gameObject; }
private MadText CreateText() { var text = MadTransform.CreateChild <MadText>(sprite.transform, "new_text"); Selection.activeGameObject = text.gameObject; text.transform.localPosition = Vector3.zero; text.transform.localScale = Vector3.one; text.text = "Default Text"; text.guiDepth = NextDepth(); return(text); }
void InitTemplates(MadRootNode root, out MadLevelIcon icon, out MadSprite slideLeftSprite, out MadSprite slideRightSprite) { var panel = MadTransform.FindChild <MadPanel>(root.transform); var templates = MadTransform.CreateChild(panel.transform, "Templates"); GameObject iconPrefab = (GameObject)AssetDatabase.LoadAssetAtPath(IconPrefab, typeof(GameObject)); GameObject slideLeftPrefab = (GameObject)AssetDatabase.LoadAssetAtPath(SlideLeftPrefab, typeof(GameObject)); GameObject slideRightPrefab = (GameObject)AssetDatabase.LoadAssetAtPath(SlideRightPrefab, typeof(GameObject)); if (MadGameObject.AnyNull(iconPrefab, slideLeftPrefab, slideRightPrefab)) { Debug.LogWarning("I cannot find all needed prefabs to create example templates. Have you moved Mad Level " + "Manager directory to other than default place?"); } if (iconPrefab != null) { var obj = MadTransform.CreateChild(templates.transform, "icon", iconPrefab); icon = obj.GetComponent <MadLevelIcon>(); } else { icon = null; } if (slideLeftPrefab != null) { var slide = MadTransform.CreateChild(templates.transform, "slide left", slideLeftPrefab); slideLeftSprite = slide.GetComponent <MadSprite>(); } else { slideLeftSprite = null; } if (slideRightPrefab != null) { var slide = MadTransform.CreateChild(templates.transform, "slide right", slideRightPrefab); slideRightSprite = slide.GetComponent <MadSprite>(); } else { slideRightSprite = null; } MadGameObject.SetActive(templates, false); }
public static MadLevelGridBullets Create(MadPanel panel) { var anchor = MadTransform.CreateChild<MadAnchor>(panel.transform, "Bullets Anchor"); anchor.mode = MadAnchor.Mode.ScreenAnchor; anchor.position = MadAnchor.Position.Bottom; var bullets = MadTransform.CreateChild<MadLevelGridBullets>(anchor.transform, "Bullets"); bullets.transform.localPosition = new Vector3(0, 50, 0); var draggable = MadTransform.FindChild<MadDragStopDraggable>(panel.transform, int.MaxValue); bullets.draggable = draggable; bullets.bulletTextureOff = (Texture2D) AssetDatabase.LoadAssetAtPath(BulletOff, typeof(Texture2D)); bullets.bulletTextureOn = (Texture2D) AssetDatabase.LoadAssetAtPath(BulletOn, typeof(Texture2D)); return bullets; }
protected MadLevelIcon CreateIcon(Transform parent, string name, MadLevelIcon template) { GameObject go = null; #if UNITY_EDITOR go = PrefabUtility.InstantiatePrefab(template.gameObject) as GameObject; #endif if (go != null) { go.name = name; go.transform.parent = parent; } else { go = MadTransform.CreateChild(parent, name, template.gameObject); } return(go.GetComponent <MadLevelIcon>()); }
void InitTemplates(MadRootNode root, out MadLevelIcon icon, out MadSprite slideLeftSprite, out MadSprite slideRightSprite) { var panel = MadTransform.FindChild <MadPanel>(root.transform); var templates = MadTransform.CreateChild(panel.transform, "Templates"); GameObject iconPrefab = MadAssets.TryLoadGameObject(IconPrefabGUID); GameObject slideLeftPrefab = MadAssets.TryLoadGameObject(SlideLeftPrefabGUID); GameObject slideRightPrefab = MadAssets.TryLoadGameObject(SlideRightPrefabGUID); if (MadGameObject.AnyNull(iconPrefab, slideLeftPrefab, slideRightPrefab)) { Debug.LogWarning("I cannot find all needed prefabs to create example templates. Have you removed Mad Level " + "Manager example prefabs?"); } if (iconPrefab != null) { var obj = PrefabUtility.InstantiatePrefab(iconPrefab) as GameObject; obj.transform.parent = templates.transform; obj.name = "icon"; obj.transform.localScale = Vector3.one; obj.transform.localPosition = new Vector2(-400, 150); icon = obj.GetComponent <MadLevelIcon>(); } else { icon = null; } if (slideLeftPrefab != null) { var slide = PrefabUtility.InstantiatePrefab(slideLeftPrefab) as GameObject; slide.transform.parent = templates.transform; slide.name = "slide left"; slide.transform.localScale = Vector3.one; slide.transform.localPosition = new Vector2(-400, 0); slideLeftSprite = slide.GetComponent <MadSprite>(); } else { slideLeftSprite = null; } if (slideRightPrefab != null) { var slide = PrefabUtility.InstantiatePrefab(slideRightPrefab) as GameObject; slide.transform.parent = templates.transform; slide.name = "slide right"; slide.transform.localScale = Vector3.one; slide.transform.localPosition = new Vector2(-400, -150); slideRightSprite = slide.GetComponent <MadSprite>(); } else { slideRightSprite = null; } MadGameObject.SetActive(templates, false); }
public override void OnInspectorGUI() { serializedObject.UpdateIfDirtyOrScript(); MadGUI.PropertyField(draggable, "Draggable", MadGUI.ObjectIsSet); MadGUI.PropertyField(startDepth, "Start Depth", "Depth value of first layer added. " + "Every next layer will receive +1 to it's depth value."); MadGUI.PropertyField(ignoreXMovement, "Ignore X Movement"); MadGUI.PropertyField(ignoreYMovement, "Ignore Y Movement"); serializedObject.ApplyModifiedProperties(); var arrayList = new MadGUI.ArrayList <MadLevelBackgroundLayer>(script.layers, (layer) => { if (layer == null) { return; } var so = new SerializedObject(layer); so.UpdateIfDirtyOrScript(); var texture = so.FindProperty("texture"); EditorGUILayout.BeginHorizontal(); MadGUI.PropertyField(texture, ""); MadGUI.ConditionallyEnabled(CanMoveUp(layer), () => { if (GUILayout.Button("Up")) { MoveUp(layer); } }); MadGUI.ConditionallyEnabled(CanMoveDown(layer), () => { if (GUILayout.Button("Down")) { MoveDown(layer); } }); GUI.color = Color.yellow; if (GUILayout.Button("Select")) { Selection.activeGameObject = layer.gameObject; } GUI.color = Color.white; EditorGUILayout.EndHorizontal(); if (so.ApplyModifiedProperties()) { layer.SetDirty(); } }); arrayList.createFunctionGeneric = () => { var layer = MadTransform.CreateChild <MadLevelBackgroundLayer>(script.transform, "layer (empty)"); layer.GetComponent <MadSprite>().hideFlags = HideFlags.HideInInspector; return(layer); }; arrayList.onRemove = (layer) => layer.Cleanup(); arrayList.beforeAdd = () => { MadUndo.RecordObject(script, "Add Background Layer"); MadUndo.LegacyRegisterSceneUndo("Add Background Layer"); }; arrayList.beforeRemove = (arg) => { MadUndo.RecordObject(script, "Remove Background Layer"); MadUndo.LegacyRegisterSceneUndo("Remove Background Layer"); }; if (arrayList.Draw()) { EditorUtility.SetDirty(script); } EditorGUI.BeginChangeCheck(); if (EditorGUI.EndChangeCheck()) { // changed } }
static void CreateAnchor() { var anchor = MadTransform.CreateChild <MadAnchor>(ActiveParentOrPanel(), "Anchor"); Selection.activeGameObject = anchor.gameObject; }
static void CreateText() { var text = MadTransform.CreateChild <MadText>(ActiveParentOrPanel(), "text"); Selection.activeGameObject = text.gameObject; }
static void CreateSprite() { var sprite = MadTransform.CreateChild <MadSprite>(ActiveParentOrPanel(), "sprite"); Selection.activeGameObject = sprite.gameObject; }
static void CreateKeyboardControl() { var inputControl = MadTransform.CreateChild <MadLevelInputControl>(null, "Input Control"); Selection.activeGameObject = inputControl.gameObject; }
// builds level icons that are absent now private void Build(bool forceDelete) { // create or get a draggable draggable = MadTransform.GetOrCreateChild <MadDragStopDraggable>(transform, "Draggable"); draggable.dragStopCallback = OnDragStopCallback; float startX = -pixelsWidth / 2; float startY = pixelsHeight / 2; float dx = pixelsWidth / (gridWidth + 1); float dy = -pixelsHeight / (gridHeight + 1); MadLevelIcon previousIcon = null; int levelCount = currentConfiguration.LevelCount(MadLevel.Type.Level, configurationGroup); int levelIndex = 0; int pageIndex = 0; while (levelIndex < levelCount) { Transform page = MadTransform.FindChild <Transform>(draggable.transform, (t) => t.name == "Page " + (pageIndex + 1)); bool createPageInstance = page == null; if (createPageInstance) { page = MadTransform.CreateChild <Transform>(draggable.transform, "Page " + (pageIndex + 1)); page.hideFlags = generate && hideManagedObjects ? HideFlags.HideInHierarchy : 0; } Transform pageAnchor = MadTransform.FindChild <Transform>(draggable.transform, (t) => t.name == "Anchor " + (pageIndex + 1)); if (pageAnchor == null) { pageAnchor = MadTransform.CreateChild <Transform>(draggable.transform, "Anchor " + (pageIndex + 1)); pageAnchor.gameObject.AddComponent <MadFollow>(); } var followPage = pageAnchor.GetComponent <MadFollow>(); followPage.followTransform = page; if (createPageInstance || generate) { switch (pagingMethod) { case PagingMethod.HorizontalSimple: page.localPosition = ComputePageOffsetHoriz(pageIndex); break; case PagingMethod.VerticalSimple: page.localPosition = ComputePageOffsetVert(pageIndex); break; case PagingMethod.HorizontalZoom: page.localPosition = ComputePageOffsetHoriz(pageIndex); break; case PagingMethod.VerticalZoom: page.localPosition = ComputePageOffsetVert(pageIndex); break; default: throw new ArgumentOutOfRangeException(); } } int levelPageIndex = 0; bool stop = false; for (int y = 1; y <= gridHeight && levelIndex < levelCount; ++y) { if (stop) { break; } for (int x = 1; x <= gridWidth && levelIndex < levelCount; ++x, levelIndex++, levelPageIndex++) { if (limitLevelsPerPage && generate && levelPageIndex == levelsPerPage) { stop = true; break; } // update info: in previous versions page was nested directly under draggable // now they should be placed inside "Page X" transforms MadLevelIcon levelIcon = null; if (!forceDelete) { // look directly under Draggable levelIcon = MadTransform.FindChild <MadLevelIcon>( draggable.transform, (ic) => ic.levelIndex == levelIndex, 0); if (levelIcon != null) { // move to page levelIcon.transform.parent = page; } else { // find under the page levelIcon = MadTransform.FindChild <MadLevelIcon>( page.transform, (ic) => ic.levelIndex == levelIndex, 0); } } var level = currentConfiguration.GetLevel(MadLevel.Type.Level, configurationGroup, levelIndex); bool createNewInstance = levelIcon == null; if (createNewInstance) { levelIcon = CreateIcon( page.transform, level.name, iconTemplate); } else { levelIcon.name = level.name; } levelIcon.gameObject.hideFlags = generate && hideManagedObjects ? HideFlags.HideInHierarchy : 0; levelIcon.levelGroup = configurationGroup; levelIcon.levelIndex = levelIndex; levelIcon.configuration = currentConfiguration; levelIcon.hasLevelConfiguration = true; if (!MadGameObject.IsActive(levelIcon.gameObject)) { MadGameObject.SetActive(levelIcon.gameObject, true); } else { // re-enable icon to reload its properties MadGameObject.SetActive(levelIcon.gameObject, false); MadGameObject.SetActive(levelIcon.gameObject, true); } if (generate || createNewInstance) { levelIcon.pivotPoint = MadSprite.PivotPoint.Center; if (!generate) { levelIcon.transform.localPosition = new Vector3(startX + dx * x + iconOffset.x, startY + dy * y + iconOffset.y, 0); } else { levelIcon.transform.localPosition = IconGeneratedPosition(levelIndex, levelCount, x - 1, y - 1); } levelIcon.transform.localScale = new Vector3(iconScale.x, iconScale.y, 1); if (levelIcon.levelNumber != null) { levelIcon.levelNumber.text = GetEnumerationValue(levelIndex); } } if (previousIcon != null) { if (createNewInstance) { previousIcon.unlockOnComplete.Add(levelIcon); } } if (!Application.isPlaying || !MadLevelProfile.IsLockedSet(level.name)) { levelIcon.locked = levelIcon.level.lockedByDefault; } previousIcon = levelIcon; } } pageIndex++; } BuildSlideIcons(); BuildDragging(); // enable/disable selection based on hide settings var sprites = GetComponentsInChildren <MadSprite>(); foreach (var sprite in sprites) { sprite.editorSelectable = !generate; } #if UNITY_EDITOR EditorApplication.delayCall += () => EditorUtility.SetDirty(this); #endif }
// builds level icons that are absent now void Build() { // create or get a draggable draggable = MadTransform.GetOrCreateChild <MadDragStopDraggable>(transform, "Draggable"); draggable.dragStopCallback = (index) => { pageCurrentIndex = index; }; float startX = -pixelsWidth / 2; float startY = pixelsHeight / 2; float dx = pixelsWidth / (gridWidth + 1); float dy = -pixelsHeight / (gridHeight + 1); int levelNumber = 1; MadLevelIcon previousIcon = null; int levelCount = configuration.LevelCount(MadLevel.Type.Level); int levelIndex = 0; int pageIndex = 0; while (levelIndex < levelCount) { Transform page = MadTransform.FindChild <Transform>(draggable.transform, (t) => t.name == "Page " + (pageIndex + 1)); bool createPageInstance = page == null; if (createPageInstance) { page = MadTransform.CreateChild <Transform>(draggable.transform, "Page " + (pageIndex + 1)); } if (createPageInstance || generate) { page.localPosition = new Vector3(pagesXOffset * pageIndex, 0, 0); } for (int y = 1; y <= gridHeight && levelIndex < levelCount; ++y) { for (int x = 1; x <= gridWidth && levelIndex < levelCount; ++x, levelIndex++) { // update info: in previous versions page was nested directly under draggable // now they should be placed inside "Page X" transforms MadLevelIcon levelIcon; // look directly under Draggable levelIcon = MadTransform.FindChild <MadLevelIcon>( draggable.transform, (ic) => ic.levelIndex == levelIndex, 0); if (levelIcon != null) { // move to page levelIcon.transform.parent = page; } else { // find under the page levelIcon = MadTransform.FindChild <MadLevelIcon>( page.transform, (ic) => ic.levelIndex == levelIndex, 0); } bool createNewInstance = levelIcon == null; var level = configuration.GetLevel(MadLevel.Type.Level, levelIndex); if (createNewInstance) { levelIcon = MadTransform.CreateChild( page.transform, level.name, iconTemplate); } else { levelIcon.name = level.name; } levelIcon.gameObject.hideFlags = generate ? HideFlags.HideInHierarchy : 0; if (!MadGameObject.IsActive(levelIcon.gameObject)) { MadGameObject.SetActive(levelIcon.gameObject, true); } levelIcon.levelIndex = levelIndex; levelIcon.configuration = configuration; levelIcon.hasLevelConfiguration = true; if (generate || createNewInstance) { levelIcon.pivotPoint = MadSprite.PivotPoint.Center; levelIcon.transform.localPosition = new Vector3(startX + dx * x + iconOffset.x, startY + dy * y + iconOffset.y, 0); levelIcon.transform.localScale = new Vector3(iconScale.x, iconScale.y, 1); if (levelIcon.levelNumber != null) { levelIcon.levelNumber.text = levelNumber.ToString(); } } if (previousIcon != null) { if (createNewInstance) { previousIcon.unlockOnComplete.Add(levelIcon); } } else { if (generate) { levelIcon.locked = false; } } previousIcon = levelIcon; levelNumber++; } } pageIndex++; } BuildSlideIcons(); BuildDragging(draggable, (int)Mathf.Ceil((float)levelCount / (gridWidth * gridHeight))); // enable/disable selection based on hide settings var sprites = GetComponentsInChildren <MadSprite>(); foreach (var sprite in sprites) { sprite.editorSelectable = !generate; } }
void Build() { int levelCount = configuration.LevelCount(MadLevel.Type.Level); Vector2 currentOffset = Vector2.zero; MadLevelIcon previousIcon = null; // find out min and max depth int min, max; iconTemplate.MinMaxDepthRecursively(out min, out max); int depthDiff = (max - min) + 1; const string name = "level {0:D3}"; for (int levelIndex = 0; levelIndex < levelCount; ++levelIndex) { MadLevelIcon levelIcon = MadTransform.FindChild <MadLevelIcon>( draggable.transform, (ic) => ic.levelIndex == levelIndex, 0); bool newInstance = levelIcon == null; // create new icon instance if it's not exists if (newInstance) { levelIcon = MadTransform.CreateChild( draggable.transform, string.Format(name, levelIndex + 1), iconTemplate); // adjust gui depth for each icon levelIcon.guiDepth += levelIndex * depthDiff; var sprites = MadTransform.FindChildren <MadSprite>(levelIcon.transform); foreach (var sprite in sprites) { sprite.guiDepth += levelIndex * depthDiff; } // position & scale levelIcon.pivotPoint = MadSprite.PivotPoint.Center; levelIcon.transform.localPosition = currentOffset; currentOffset += offset; levelIcon.transform.localScale = Vector3.one; } // make it active if deactivated if (!MadGameObject.IsActive(levelIcon.gameObject)) { MadGameObject.SetActive(levelIcon.gameObject, true); } // setup level properties levelIcon.levelIndex = levelIndex; levelIcon.configuration = configuration; levelIcon.hasLevelConfiguration = true; // set level number if exists if (levelIcon.levelNumber != null) { levelIcon.levelNumber.text = (levelIndex + 1).ToString(); } // level unlock if set if (previousIcon != null) { if (newInstance) { previousIcon.unlockOnComplete.Add(levelIcon); } } else { levelIcon.locked = false; } previousIcon = levelIcon; } BuildBackgroundTexture(); }