public void updateMenu() { GameSound.gameSound.PlaySFX("button"); ////disable all butons and load category GameObject menu = GameObject.Find("menu"); AvatarMenuController menuController = menu.GetComponent(typeof(AvatarMenuController)) as AvatarMenuController; menuController.disableAllButtons(gameObject.name); //enable this button ToogleButton button = gameObject.GetComponent <ToogleButton>(); button.EnableMenuButton(); }
public void LoadUserDefaultAvatar() { UserData.userData.Load(); if (UserData.userData.playerData.playerBody != "") { Debug.Log("Load User Default Avatar"); bodyItem = UserData.userData.playerData.playerBody; eyeItem = UserData.userData.playerData.playerEye; hairItem = UserData.userData.playerData.playerHair; mouthItem = UserData.userData.playerData.playerMouth; accItem = UserData.userData.playerData.playerAcc; shirtItem = UserData.userData.playerData.playerShirt; pantsItem = UserData.userData.playerData.playerPants; showItem = UserData.userData.playerData.playerShoe; bodySprite = Resources.Load(avatarResourcesPath + AvatarCategoryStrings.BODY + "/" + AvatarCategoryStrings.BODY + bodyItem, typeof(Sprite)) as Sprite; eyeSprite = Resources.Load(avatarResourcesPath + AvatarCategoryStrings.EYE + "/" + AvatarCategoryStrings.EYE + eyeItem, typeof(Sprite)) as Sprite; hairSprite = Resources.Load(avatarResourcesPath + AvatarCategoryStrings.HAIR + "/" + AvatarCategoryStrings.HAIR + hairItem, typeof(Sprite)) as Sprite; mouthSprite = Resources.Load(avatarResourcesPath + AvatarCategoryStrings.MOUTH + "/" + AvatarCategoryStrings.MOUTH + mouthItem, typeof(Sprite)) as Sprite; accSprite = Resources.Load(avatarResourcesPath + AvatarCategoryStrings.ACC + "/" + AvatarCategoryStrings.ACC + accItem, typeof(Sprite)) as Sprite; shirtSprite = Resources.Load(avatarResourcesPath + AvatarCategoryStrings.SHIRT + "/" + AvatarCategoryStrings.SHIRT + shirtItem, typeof(Sprite)) as Sprite; pantsSprite = Resources.Load(avatarResourcesPath + AvatarCategoryStrings.PANTS + "/" + AvatarCategoryStrings.PANTS + pantsItem, typeof(Sprite)) as Sprite; shoeSprite = Resources.Load(avatarResourcesPath + AvatarCategoryStrings.SHOE + "/" + AvatarCategoryStrings.SHOE + showItem, typeof(Sprite)) as Sprite; Apply(); } AvatarMenuController menuController = GameObject.FindObjectOfType <AvatarMenuController> (); if (menuController) { menuController.Setup(); } }