Beispiel #1
0
 public void RefreshUI()
 {
     if (ItemSlotPrefab != null && HeroSystem.GetUnableHeros().Count != ScrollViewContent.transform.childCount)
     {
         foreach (Transform child in ScrollViewContent.transform)
         {
             Destroy(child.gameObject);
         }
         foreach (var slot in HeroSystem.GetUnableHeros())
         {
             GameObject slotPrefab = Instantiate(ItemSlotPrefab, ScrollViewContent.transform);
             foreach (var i in slotPrefab.GetComponentsInChildren <Text>())
             {
                 if (i.name.Equals("ItemName"))
                 {
                     slotNameText = i;
                 }
                 else if (i.name.Equals("ItemValue"))
                 {
                     slotValueText = i;
                 }
             }
             if (slotNameText != null)
             {
                 slotNameText.text = HeroSystem.GetHeroName(slot.id);
             }
             if (slotValueText != null)
             {
                 slotValueText.text = Common.GetThousandCommaText(slot.value);
             }
             slotItemImage  = slotPrefab.transform.GetChild(0).GetChild(0).GetComponent <Image>();
             slotMoneyImage = slotPrefab.transform.GetChild(2).GetChild(0).GetComponent <Image>();
             if (slotItemImage != null)
             {
                 slotItemImage.sprite = Resources.Load <Sprite>(slot.image);
             }
             if (slotMoneyImage != null)
             {
                 slotMoneyImage.sprite = Resources.Load <Sprite>("Items/blackCrystal");
             }
             slotPrefab.GetComponent <Button>().onClick.RemoveAllListeners();
             slotPrefab.GetComponent <Button>().onClick.AddListener(delegate
             {
                 OnItemSlotClick(slotPrefab.transform, slot);
             });
         }
     }
     infoImage.enabled            = false;
     infoItemDescriptionText.text = "";
     infoItemNameText.text        = "";
     infoItemValueText.text       = "";
     ItemInfoView.SetActive(false);
     BuyButton.GetComponent <Button>().enabled = false;
     detailButton.onClick.RemoveAllListeners();
     detailButton.onClick.AddListener(delegate
     {
         OnHeroDetailClick();
     });
 }
Beispiel #2
0
    public void ShowHero(GameObject hero, HeroData heroData)
    {
        if (hero != null)
        {
            targetHeroData = heroData;
            showHeroObj    = Instantiate(hero, HeroShowPoint.transform);
            showHeroObj.transform.localScale    = new Vector3(200, 200, 200);
            showHeroObj.transform.localPosition = Vector3.zero;

            if (showHeroObj.GetComponent <Hero>() != null)
            {
                Destroy(showHeroObj.GetComponent <Hero>());
            }
            if (showHeroObj.GetComponent <Rigidbody2D>() != null)
            {
                Destroy(showHeroObj.GetComponent <Rigidbody2D>());
            }
            foreach (var sp in showHeroObj.GetComponentsInChildren <SpriteRenderer>())
            {
                sp.sortingLayerName = "ShowObject";
                sp.gameObject.layer = 16;
            }
            showHeroObj.gameObject.SetActive(true);

            if (heroNameText != null)
            {
                heroNameText.text = HeroSystem.GetHeroName(heroData.id);
            }
            if (heroDescriptionText != null)
            {
                heroDescriptionText.text = HeroSystem.GetHeroDescription(heroData.id);
            }
            if (heroLevelText != null)
            {
                heroLevelText.text = string.Format("LV {0}", heroData.level);
            }
            if (heroExpText != null)
            {
                int   exp        = targetHeroData.exp;
                int   needExp    = Common.GetHeroNeedExp(targetHeroData.level);
                float expPercent = ((float)exp / (float)needExp);
                heroExpText.text    = string.Format("{0}/{1}({2}%)", exp, needExp, (expPercent * 100).ToString("N0"));
                heroExpSlider.value = expPercent;
            }

            if (CharactersManager.instance.GetLobbyHeros(targetHeroData.id))
            {
                heroSetLobbyButton.GetComponentInChildren <Text>().text = LocalizationManager.GetText("heroInfoExceptLobbyButton");
            }
            else
            {
                heroSetLobbyButton.GetComponentInChildren <Text>().text = LocalizationManager.GetText("heroInfoToLobbyButton");
            }

            RefreshHeroStatusEquipmentPanel();
        }
    }
Beispiel #3
0
 void RefreshUI()
 {
     if (heroSlotPrefab != null)
     {
         foreach (Transform child in ScrollViewContent.transform)
         {
             if (!child.name.Equals("none"))
             {
                 Destroy(child.gameObject);
             }
         }
         foreach (var heroSlot in HeroSystem.GetUserHeros())
         {
             if (heroSlot.type == 0)
             {
                 GameObject slotPrefab = Instantiate(heroSlotPrefab, ScrollViewContent.transform);
                 foreach (var i in slotPrefab.GetComponentsInChildren <Text>())
                 {
                     if (i.name.Equals("heroName"))
                     {
                         slotNameText = i;
                     }
                 }
                 if (slotNameText != null)
                 {
                     slotNameText.text = HeroSystem.GetHeroName(heroSlot.id);
                 }
                 slotHeroImage = slotPrefab.transform.GetChild(0).GetChild(0).GetComponent <Image>();
                 if (slotHeroImage != null)
                 {
                     slotHeroImage.sprite = Resources.Load <Sprite>(heroSlot.image);
                 }
                 slotPrefab.GetComponent <Button>().onClick.RemoveAllListeners();
                 slotPrefab.GetComponent <Button>().onClick.AddListener(delegate
                 {
                     OnItemSlotClick(heroSlot);
                 });
                 if (!CharactersManager.instance.IsExistedStageHero(heroSlot.id))
                 {
                     slotPrefab.GetComponent <Button>().enabled = true;
                     slotPrefab.transform.GetChild(2).gameObject.SetActive(false);
                 }
                 else
                 {
                     slotPrefab.GetComponent <Button>().enabled = false;
                     slotPrefab.transform.GetChild(2).gameObject.SetActive(true);
                 }
             }
         }
     }
     useEnergyText.text = CharactersManager.instance.GetStageHeroCount().ToString();
     SetImageAndTextSelectHeroPanel();
     RefreshPlayerSkillUI();
     selectHeroLockCover.SetActive(true);
 }
    public void OpenUI(HeroData data)
    {
        heroData    = data;
        showHeroObj = Instantiate(PrefabsDatabaseManager.instance.GetHeroPrefab(heroData.id), ShowPoint.transform);
        showHeroObj.transform.localScale    = new Vector3(200, 200, 200);
        showHeroObj.transform.localPosition = Vector3.zero;

        if (showHeroObj.GetComponent <Hero>() != null)
        {
            Destroy(showHeroObj.GetComponent <Hero>());
        }
        if (showHeroObj.GetComponent <Rigidbody2D>() != null)
        {
            Destroy(showHeroObj.GetComponent <Rigidbody2D>());
        }
        foreach (var sp in showHeroObj.GetComponentsInChildren <SpriteRenderer>())
        {
            sp.sortingLayerName = "ShowObject";
            sp.gameObject.layer = 16;
        }
        showHeroObj.gameObject.SetActive(true);

        nameText.text        = HeroSystem.GetHeroName(data.id);
        descriptionText.text = HeroSystem.GetHeroDescription(data.id);

        //Status 정보
        if (statusInfoPanel != null)
        {
            statusInfoPanel.transform.GetChild(0).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusAttack(ref heroData).ToString();
            statusInfoPanel.transform.GetChild(1).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusDefence(ref heroData).ToString();
            statusInfoPanel.transform.GetChild(2).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusMaxHp(ref heroData).ToString();
            statusInfoPanel.transform.GetChild(3).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusCriticalPercent(ref heroData).ToString();
            statusInfoPanel.transform.GetChild(4).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusAttackSpeed(ref heroData).ToString();
            statusInfoPanel.transform.GetChild(5).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusMoveSpeed(ref heroData).ToString();
            statusInfoPanel.transform.GetChild(6).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusKnockbackResist(ref heroData).ToString("N1");
            statusInfoPanel.transform.GetChild(7).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusSkillEnergy(ref heroData).ToString();
        }

        // 스킬정보
        Skill heroSkill = SkillSystem.GetSkill(heroData.skill);

        if (skillInfoPanel != null && heroSkill != null)
        {
            var skillImage = skillInfoPanel.transform.GetChild(0).GetChild(0).GetComponent <Image>();
            skillImage.sprite = SkillSystem.GetSkillImage(heroSkill.id);
            skillInfoPanel.transform.GetComponentInChildren <Text>().text = string.Format("<size='27'>{0} : {1}  {2}</size>\r\n\r\n<color='grey'>{3}</color>", LocalizationManager.GetText("SkillLevel"), 1, SkillSystem.GetSkillName(heroSkill.id), SkillSystem.GetSkillDescription(heroSkill.id));
        }
    }
Beispiel #5
0
    IEnumerator OpenHeroInfo(Hero hero)
    {
        SetHeroInfoUI();
        if (heroInfoUI.activeSelf)
        {
            heroInfoUI.GetComponent <AiryUIAnimatedElement>().HideElement();
        }
        yield return(new WaitForSeconds(0.2f));

        heroInfoUI.transform.position = hero.transform.position + new Vector3(0, 2);
        heroInfoUI.GetComponent <AiryUIAnimatedElement>().initialWorldPosition = hero.transform.position + new Vector3(0, 2);
        yield return(new WaitForSeconds(0.1f));

        SoundManager.instance.EffectSourcePlay(AudioClipManager.instance.ui_pop);
        heroUITarget    = hero.transform;
        heroUIname.text = HeroSystem.GetHeroName(hero.id);
        heroUIinfo.text = string.Format("레벨:{0}\r\n전투력:{1}", hero.status.level, Common.GetHeroPower(hero));
        heroInfoUI.GetComponent <AiryUIAnimatedElement>().ShowElement();
    }
 void RefreshUI()
 {
     if (heroSlotPrefab != null)
     {
         foreach (Transform child in ScrollViewContent.transform)
         {
             Destroy(child.gameObject);
         }
         foreach (var heroSlot in HeroSystem.GetUserHeros())
         {
             if (heroSlot.type == 0)
             {
                 GameObject slotPrefab = Instantiate(heroSlotPrefab, ScrollViewContent.transform);
                 foreach (var i in slotPrefab.GetComponentsInChildren <Text>())
                 {
                     if (i.name.Equals("heroName"))
                     {
                         slotNameText = i;
                     }
                 }
                 if (slotNameText != null)
                 {
                     slotNameText.text = HeroSystem.GetHeroName(heroSlot.id);
                 }
                 slotHeroImage = slotPrefab.transform.GetChild(0).GetChild(0).GetComponent <Image>();
                 if (slotHeroImage != null)
                 {
                     slotHeroImage.sprite = Resources.Load <Sprite>(heroSlot.image);
                 }
                 slotPrefab.GetComponent <Button>().onClick.RemoveAllListeners();
                 slotPrefab.GetComponent <Button>().onClick.AddListener(delegate
                 {
                     OnItemSlotClick(heroSlot);
                 });
             }
         }
     }
 }
Beispiel #7
0
    void BuyCharProcessing()
    {
        switch (paymentType)
        {
        case PaymentType.Coin:
            if (Common.PaymentCheck(ref User.coin, paymentAmount))
            {
                OnButtonEffectSound();
                HeroSystem.SetObtainHero(characterId);
                CallbackScriptRefresh();
                HeroData hd = HeroSystem.GetHero(characterId);
                GoogleSignManager.SaveData();
                UI_Manager.instance.ShowGetAlert(hd.image, string.Format("<color='yellow'>{0}</color> {1}", HeroSystem.GetHeroName(hd.id), LocalizationManager.GetText("alertGetMessage5")));
            }
            else
            {
                UI_Manager.instance.ShowAlert(UI_Manager.PopupAlertTYPE.coin, paymentAmount);
            }
            break;

        case PaymentType.BlackCrystal:
            if (Common.PaymentCheck(ref User.blackCrystal, paymentAmount))
            {
                OnButtonEffectSound();
                HeroSystem.SetObtainHero(characterId);
                CallbackScriptRefresh();
                HeroData hd = HeroSystem.GetHero(characterId);
                GoogleSignManager.SaveData();
                UI_Manager.instance.ShowGetAlert(hd.image, string.Format("<color='yellow'>{0}</color> {1}", HeroSystem.GetHeroName(hd.id), LocalizationManager.GetText("alertGetMessage5")));
            }
            else
            {
                UI_Manager.instance.ShowAlert(UI_Manager.PopupAlertTYPE.blackCrystal, paymentAmount);
            }
            break;

        case PaymentType.Cash:
            OnButtonEffectSound();
            OnButtonEffectSound();
            IAPManager.instance.OnBtnPurchaseClicked(buyItemId);
            CallbackScriptRefresh();
            Debugging.Log(characterId + " 현금거래 버튼 입니다. >> Cash : " + paymentAmount);
            break;
        }
    }
Beispiel #8
0
 public void SetImageAndTextSelectHeroPanel()
 {
     for (int i = 0; i < User.stageHeros.Length; i++)
     {
         HeroData data = HeroSystem.GetUserHero(User.stageHeros[i]);
         selectPanel          = PanelHeroSelection.transform.GetChild(i).GetChild(2).gameObject;
         selectedHeroNameText = PanelHeroSelection.transform.GetChild(i).GetChild(0).GetComponent <Text>();
         selectedHeroImage    = PanelHeroSelection.transform.GetChild(i).GetChild(1).GetChild(0).GetComponent <Image>();
         if (data != null)
         {
             selectPanel.gameObject.SetActive(false);
             selectedHeroNameText.text = string.Format("<size='{0}'>{1} {2}</size>  {3}", selectedHeroNameText.fontSize - 5, LocalizationManager.GetText("Level"), data.level, HeroSystem.GetHeroName(data.id));
             selectedHeroImage.enabled = true;
             selectedHeroImage.sprite  = Resources.Load <Sprite>(data.image);
         }
         else
         {
             selectedHeroImage.enabled = false;
             selectedHeroImage.sprite  = HeroSystem.GetHeroNoneImage();
             selectedHeroNameText.text = "";
             selectPanel.gameObject.SetActive(true);
         }
     }
     selectHeroLockCover.SetActive(true);
 }