public void Set(bl_PlayerSelectorInfo info, bl_PlayerSelector script) { Info = info; PlayerPreview.sprite = info.Preview; PlayerNameText.text = string.Format("<b>NAME:</b> {0}", info.Name.ToUpper()); Selector = script; if (info.Prefab != null) { bl_PlayerHealthManager pdm = info.Prefab.GetComponent <bl_PlayerHealthManager>(); bl_FirstPersonController fpc = info.Prefab.GetComponent <bl_FirstPersonController>(); HealthText.fillAmount = pdm.health / 125; SpeedText.fillAmount = fpc.WalkSpeed / 5; RegenerationText.fillAmount = pdm.RegenerationSpeed / 5; NoiseText.fillAmount = 0.9f; } #if SHOP && ULSP if (info.Price > 0 && bl_DataBase.Instance != null) { int pID = bl_PlayerSelectorData.Instance.GetPlayerID(info.Name); bool unlock = bl_DataBase.Instance.LocalUser.ShopData.isItemPurchase(ShopItemType.PlayerSkin, pID); LockedUI.SetActive(!unlock); } else { LockedUI.SetActive(false); } #else LockedUI.SetActive(false); #endif }
public void Preview(bl_ShopItemData info, bool isOwned) { foreach (Image i in PreviewIcons) { i.gameObject.SetActive(false); } InfoPanel.SetActive(true); infoPreviewData = info; PreviewNameText.text = info.Name.ToUpper(); PreviewPriceText.text = string.Format("PRICE {0}{1}", bl_ShopData.Instance.PricePrefix, info.Price); if (info.Type == ShopItemType.Weapon) { PreviewIcons[0].gameObject.SetActive(true); PreviewIcons[0].sprite = info.GunInfo.GunIcon; PreviewBars[0].transform.parent.parent.GetComponentInChildren <Text>().text = "DAMAGE:"; PreviewBars[0].fillAmount = (float)info.GunInfo.Damage / 100f; PreviewBars[1].transform.parent.parent.GetComponentInChildren <Text>().text = "FIRE RATE:"; PreviewBars[1].fillAmount = info.GunInfo.FireRate / 1f; PreviewBars[2].transform.parent.parent.GetComponentInChildren <Text>().text = "ACCURACY:"; PreviewBars[2].fillAmount = (float)info.GunInfo.Accuracy / 5f; PreviewBars[3].transform.parent.parent.GetComponentInChildren <Text>().text = "WEIGHT:"; PreviewBars[3].fillAmount = (float)info.GunInfo.Weight / 4f; } else if (info.Type == ShopItemType.PlayerSkin) { #if PSELECTOR PreviewIcons[1].gameObject.SetActive(true); PreviewIcons[1].sprite = info.PlayerSkinInfo.Preview; bl_PlayerHealthManager pdm = info.PlayerSkinInfo.Prefab.GetComponent <bl_PlayerHealthManager>(); bl_FirstPersonController fpc = info.PlayerSkinInfo.Prefab.GetComponent <bl_FirstPersonController>(); PreviewBars[0].transform.parent.parent.GetComponentInChildren <Text>().text = "HEALTH:"; PreviewBars[0].fillAmount = pdm.health / 125; PreviewBars[1].transform.parent.parent.GetComponentInChildren <Text>().text = "SPEED:"; PreviewBars[1].fillAmount = fpc.WalkSpeed / 5; PreviewBars[2].transform.parent.parent.GetComponentInChildren <Text>().text = "REGENERATION:"; PreviewBars[2].fillAmount = pdm.RegenerationSpeed / 5; PreviewBars[3].transform.parent.parent.GetComponentInChildren <Text>().text = "NOISE:"; PreviewBars[3].fillAmount = 0.9f; #endif } else if (info.Type == ShopItemType.WeaponCamo) { #if CUSTOMIZER PreviewIcons[2].gameObject.SetActive(true); PreviewIcons[2].sprite = info.camoInfo.spritePreview(); InfoPanel.SetActive(false); #endif } BuyPreviewButton.SetActive(!isOwned); }