/// <summary>
 /// 判断动物购买是否可以升级(钱够/等级不超过最大值)   等级判断没做
 /// </summary>
 /// <returns></returns>
 private bool SetBuyAnimalGradeBool(int animalID)
 {
     if (LittleZooModule.GetAnimalUpLevelPriceFormula(animalID) <= playerData.playerZoo.diamond)
     {
         return(true);
     }
     return(false);
 }
Example #2
0
 /// <summary>
 /// 动物升级消息
 /// </summary>
 private void SendSetAnimalLevelMessageManager(int animalID)
 {
     if (animalMSS15.GetAnimalProp(animalID).lv >= animalLvUpLimit)
     {
         return;
     }
     SetBuyAnimalObjectData.Send((int)GameMessageDefine.SetAnimalLevel,
                                 1, animalID, 1, 0, LittleZooModule.GetAnimalUpLevelPriceFormula(animalID), nameID);
 }
Example #3
0
    private void InitCompentCultivate()
    {
        if (m_data == null)
        {
            return;
        }
        bool isShowAnimalCultivate = GlobalDataManager.GetInstance().playerData.playerZoo.isShowAnimalCultivate;

        tipsText.text = GetL10NString("Ui_Text_61");
        int childCount = animalGroup.transform.childCount;

        animalCellList.Add(animal_1);
        for (int i = 0; i < childCount; i++)
        {
            int animalID = buildUpCell.animalid[i];
            animalCellID[i] = animalID;
            Text nameText = animalCellList[i].transform.Find("NameText").GetComponent <Text>();
            nameText.text = GetL10NString(Config.animalupConfig.getInstace().getCell(animalID).nametranslate);

            Image  iconImage = animalCellList[i].transform.Find("Icon").GetComponent <Image>();
            string iconPath  = Config.animalupConfig.getInstace().getCell(animalID).icon;
            iconImage.sprite = ResourceManager.LoadSpriteFromPrefab(iconPath);
            //动物等级
            int  zooLevel = 0;
            Text NameText = animalCellList[i].transform.Find("LvBg/LvNum").GetComponent <Text>();
            if (animalMSS15.GetAnimalProp(animalID) != null)
            {
                zooLevel = animalMSS15.GetAnimalProp(animalID).lv;
            }
            NameText.text = zooLevel.ToString();

            //提示文本
            Text AnimalNumber = animalCellList[i].transform.Find("AnimalNumber").GetComponent <Text>();
            AnimalNumber.text = LittleZooModule.GetAnimalsBuff(animalID).ToString() + "%";
            //购买、解锁按钮
            Button buyButton = animalCellList[i].transform.Find("BuyButton").GetComponent <Button>();

            ////小锁标识
            Image lockIcon = animalCellList[i].transform.Find("LockIcon").GetComponent <Image>();
            ////购买价格
            if (buyButton == null)
            {
                string e = string.Format("紧急   注意:   buyButton  为null");
                throw new System.Exception(e);
            }
            Text buyText  = buyButton.transform.Find("NumText").GetComponent <Text>();
            Text tipsText = animalTransformData[animalID].transform.Find("TipsText").GetComponent <Text>();
            tipsText.gameObject.SetActive(true);

            //解锁提示文本
            Text  openText  = buyButton.transform.Find("OpenText").GetComponent <Text>();
            Image goldImage = buyButton.transform.Find("Gold").GetComponent <Image>();

            if (animalMSS15.GetAnimalProp(animalID) == null)
            {
                AnimalNumber.gameObject.SetActive(true);
                //Ui_Text_62
                tipsText.text = string.Format(GetL10NString("Ui_Text_62"), buildUpCell.lvanimal[i], titleText.text);
                buyButton.gameObject.SetActive(false);
                lockIcon.gameObject.SetActive(true);

                int openScene = Config.animalupConfig.getInstace().getCell(animalID).openscene;
                if (openScene == playerData.playerZoo.currSceneID)
                {
                    string str = GetL10NString("Ui_Text_62");
                    tipsText.text = string.Format(str, buildUpCell.lvanimal[i], titleText.text);
                }
                else
                {
                    string str       = GetL10NString("Ui_Text_125");
                    var    sceneCell = Config.sceneConfig.getInstace().getCell(openScene);
                    string str1      = string.Format(GetL10NString(sceneCell.scenename), sceneCell.sceneorder);
                    tipsText.text = string.Format(str, str1);
                }
            }
            else if (animalMSS15.GetAnimalProp(animalID).lv > 0)
            {
                AnimalNumber.gameObject.SetActive(true);
                lockIcon.gameObject.SetActive(false);
                openText.gameObject.SetActive(false);
                buyText.text = LittleZooModule.GetAnimalUpLevelPriceFormula(animalID).ToString();
                tipsText.gameObject.SetActive(false);
                buyButton.gameObject.SetActive(true);
                buyText.gameObject.SetActive(true);
                goldImage.gameObject.SetActive(true);

                if (LittleZooModule.GetAnimalUpLevelPriceFormula(animalID) <= playerData.playerZoo.diamond && zooLevel < animalLvUpLimit)
                {
                    SwitchButtonUnClickable(buyButton, true);
                }
                else if (LittleZooModule.GetAnimalUpLevelPriceFormula(animalID) > playerData.playerZoo.diamond)
                {
                    //buyText.color = Color.white;
                    SwitchButtonUnClickable(buyButton, false);
                }
                if (zooLevel >= animalLvUpLimit)
                {
                    openText.text = GetL10NString("Ui_Text_46");
                    openText.gameObject.SetActive(true);
                    buyText.gameObject.SetActive(false);
                    goldImage.gameObject.SetActive(false);
                    AnimalNumber.gameObject.SetActive(true);
                    buyButton.transform.Find("ButtonTipsText").GetComponent <Text>().gameObject.SetActive(false);
                    SwitchButtonUnClickable(buyButton, false);
                }
                else
                {
                    buyButton.transform.Find("ButtonTipsText").GetComponent <Text>().gameObject.SetActive(true);
                }
                //if (playerAnimal.getPlayerAnimalCell(animalID).animalLevel>0)
                //{
                //    tipsText.text = GetL10NString("Ui_Text_114");
                //}
                //关于动物培养的显隐
                if (isShowAnimalCultivate)
                {
                    buyButton.gameObject.SetActive(true);
                }
                else
                {
                    buyButton.gameObject.SetActive(false);
                }
            }
        }
    }