public void UpdateCurrentSelectedButton(UIShopButton selectedButton) { foreach (UIShopButton button in virusesButtons) { button.isSelected = button == selectedButton; } }
public void UpdateSelectImage(UIShopButton thisButton) { newSkinSeledtedSound.CheckIsAudioEnabledAndPlay(); foreach (UIShopButton button in virusesButtons) { if (button != thisButton) { button.selectIcon.enabled = false; } else { shopButtonIcon.sprite = button.snakeSprites[0]; if (button.isSecretSkin) { shopButtonIcon.sprite = button.secretVirusSkin[2]; } button.selectIcon.enabled = true; } button.LockRefresh(); } }
public void SetLastSelectedSkin() { foreach (UIShopButton button in virusesButtons) { if (button.skinNumber == PersistentData.VirusSkin.CurrentSelectedSkin.Get()) { UIShopButton currentButton = button; if (!button.isBought) { currentButton = virusesButtons[0]; } currentButton.selectIcon.enabled = true; shopButtonIcon.sprite = currentButton.snakeSprites[0]; if (currentButton.isSecretSkin) { shopButtonIcon.sprite = currentButton.secretVirusSkin[2]; } currentButton.SetSprites(); newSkinSeledtedSound.Stop(); preview.ShowSkinOnPreviewTable(currentButton); } else { button.selectIcon.enabled = false; } } }
public void UpdateSprites(UIShopButton button) { headSpriteRenderer.sprite = button.snakeSprites[0]; foreach (SpriteRenderer body in bodiesSprites) { body.sprite = button.snakeSprites[1]; } if (TemporaryData.IsSecretSkinSelected) { headSpriteRenderer.color = SecretSkin.Colors[0]; int i = 0; foreach (SpriteRenderer tail in bodiesSprites) { tail.color = SecretSkin.Colors[i++]; } } else { Color defaultColor = new Color(1, 1, 1); headSpriteRenderer.color = defaultColor; foreach (SpriteRenderer tail in bodiesSprites) { tail.color = defaultColor; } } }
public void ShowSkinOnPreviewTable(UIShopButton newSkin) { currentSelectedSkin = newSkin; head.sprite = newSkin.snakeSprites[0]; @lock.sprite = lockIcon; foreach (Image body in bodies) { body.sprite = newSkin.snakeSprites[1]; body.color = new Color(1, 1, 1, 1); } head.color = new Color(1, 1, 1, 1); if (!newSkin.isBought) { overlay.enabled = true; purchaseButton.SetActive(true); maxLevel.SetActive(false); if (newSkin.isSecretSkin) { //@lock.enabled = true; //cost.gameObject.SetActive(false); //@lock.sprite = qIcon; for (int i = 0; i < bodies.Length; i++) { bodies[i].color = SecretSkin.Colors[i]; } head.color = SecretSkin.Colors[0]; } //else if (newSkin.LvlSkin && !newSkin.prevSkinLvl.isBought) //{ // @lock.enabled = true; // cost.gameObject.SetActive(false); //} else { @lock.enabled = false; } cost.gameObject.SetActive(true); cost.text = newSkin.cost.ToString(); } else { if (newSkin.isSecretSkin) { for (int i = 0; i < bodies.Length; i++) { bodies[i].color = SecretSkin.Colors[i]; } head.color = SecretSkin.Colors[0]; } overlay.enabled = false; cost.gameObject.SetActive(false); @lock.enabled = false; purchaseButton.SetActive(false); maxLevel.SetActive(true); maxLevel.GetComponentInChildren <Text>().text = "Max LVL: " + UIFinalScorePanel.LevelNames[newSkin.skinMaxLevelInt] + " (" + newSkin.skinMaxLevelInt.ToString() + ")"; } }
public static void SetSnakeSkin(UIShopButton button) { PlayerHeadSprite = button.snakeSprites[0]; PlayerBodySprite = button.snakeSprites[1]; PersistentData.VirusSkin.CurrentSelectedSkin.Set(button.skinNumber); }