/// <summary> /// 开启动物 /// </summary> private void OnSetAnimalLevelData(Message obj) { var msg = obj as SetBuyAnimalObjectData; /* 扣钱 扣钱成功后修改商品数量 发送扣钱的通知和商品修改的通知 */ var animalMSS15 = GlobalDataManager.GetInstance().playerData.playerZoo.animalMSS15; Config.animalupCell animalupCell = Config.animalupConfig.getInstace().getCell(msg.goodsID); if (animalMSS15.GetAnimalProp(msg.goodsID).lv >= Config.globalConfig.getInstace().AnimalLvUpLimit) { return; } var expendDelta = LittleZooModule.GetAnimalUpLevelPriceFormula(msg.goodsID); if (!WarpAddCoin(-expendDelta)) { return; } //增加动物数据 Config.buildupCell cellBuildUp = Config.buildupConfig.getInstace().getCell(msg.littleZooID); animalMSS15.AnimalLvUp(msg.goodsID, 1); LittleZooModule.playerAnimalGoToResourceID.TryGetValue(msg.goodsID, out int playerAnimalGoToResourceID); MessageInt.Send((int)GameMessageDefine.AnimalPlayLevelUpEffect, playerAnimalGoToResourceID); GetAddNewAnimalData.Send((int)GameMessageDefine.GetAnimalLevel, msg.goodsID, msg.littleZooID); MessageManager.GetInstance().Send((int)GameMessageDefine.AnimalBuffAlterSucceed); }
/// <summary> /// 动物栏等级段加成 /// </summary> /// <returns></returns> public static System.Numerics.BigInteger GetLevelAddition(Config.buildupCell buildupCell, int level) { var lvshage = buildupCell.lvshage; int idx = PlayerDataModule.FindLevelRangIndex01(lvshage, level); var idx01 = System.Numerics.BigInteger.Parse("1"); for (int i = 0; i <= idx; i++) { idx01 = idx01 * buildupCell.lvshagecoefficient[i]; } //LogWarp.LogErrorFormat(" 测试:动物栏 Lv={0},下标={1} 等级段加成={2}", level, idx, idx01); return(idx01); }
private void InitCompent() { rotationCamera.gameObject.SetActive(true); mainCamera.gameObject.SetActive(false); BuildUpEffect.SetActive(true); BuildUpEffect.transform.SetParent(zooBuildShow, false); Config.buildupCell buildUpCell = Config.buildupConfig.getInstace().getCell(m_data.ToString()); string nameStr = GetL10NString(buildUpCell.buildname); string iconPath = buildUpCell.icon; string str = GetL10NString("Ui_Text_48"); //titleText.text = nameStr; //explainText.text = str; //titleText1.text = nameStr; //explainText1.text = str; //Icon.sprite = ResourceManager.LoadSpriteFromPrefab(iconPath); }
/// <summary> /// 给动物分页分别添加控件 /// </summary> private void RegistAnimalCompent() { buildUpCell = Config.buildupConfig.getInstace().getCell(m_data.ToString()); int childCount = animalGroup.transform.childCount; float height = animalGroup.GetComponent <RectTransform>().sizeDelta.y; animalGroup.GetComponent <RectTransform>().sizeDelta = new UnityEngine.Vector2(20f + 238f * childCount, height); /*按钮*/ animal_1 = RegistCompent <Transform>("UIPage/UiBg2/UIBuild_Animalup/ScorllView/AnimalGroup/Animal_1"); Button animal_1_button = RegistBtnAndClick("UIPage/UiBg2/UIBuild_Animalup/ScorllView/AnimalGroup/Animal_1/BuyButton", BuyPlayerAnimal01); animal_2 = RegistCompent <Transform>("UIPage/UiBg2/UIBuild_Animalup/ScorllView/AnimalGroup/Animal_2"); Button animal_2_button = RegistBtnAndClick("UIPage/UiBg2/UIBuild_Animalup/ScorllView/AnimalGroup/Animal_2/BuyButton", BuyPlayerAnimal02); animal_3 = RegistCompent <Transform>("UIPage/UiBg2/UIBuild_Animalup/ScorllView/AnimalGroup/Animal_3"); Button animal_3_button = RegistBtnAndClick("UIPage/UiBg2/UIBuild_Animalup/ScorllView/AnimalGroup/Animal_3/BuyButton", BuyPlayerAnimal03); animal_4 = RegistCompent <Transform>("UIPage/UiBg2/UIBuild_Animalup/ScorllView/AnimalGroup/Animal_4"); Button animal_4_button = RegistBtnAndClick("UIPage/UiBg2/UIBuild_Animalup/ScorllView/AnimalGroup/Animal_4/BuyButton", BuyPlayerAnimal04); animal_5 = RegistCompent <Transform>("UIPage/UiBg2/UIBuild_Animalup/ScorllView/AnimalGroup/Animal_5"); Button animal_5_button = RegistBtnAndClick("UIPage/UiBg2/UIBuild_Animalup/ScorllView/AnimalGroup/Animal_5/BuyButton", BuyPlayerAnimal05); /*往动物购买按钮中添加长按*/ animal_1_button.gameObject.AddComponent <RepeatButton>(); animal_1_button.GetComponent <RepeatButton>().onPress.AddListener(OnLongPressBuyAnimal01); //按下。 animal_1_button.GetComponent <RepeatButton>().onRelease.AddListener(OnReleaseBuyAnimal); //抬起,调用一次 animal_2_button.gameObject.AddComponent <RepeatButton>(); animal_2_button.GetComponent <RepeatButton>().onPress.AddListener(OnLongPressBuyAnimal02); //按下。 animal_2_button.GetComponent <RepeatButton>().onRelease.AddListener(OnReleaseBuyAnimal); //抬起,调用一次 animal_3_button.gameObject.AddComponent <RepeatButton>(); animal_3_button.GetComponent <RepeatButton>().onPress.AddListener(OnLongPressBuyAnimal03); //按下。 animal_3_button.GetComponent <RepeatButton>().onRelease.AddListener(OnReleaseBuyAnimal); //抬起,调用一次 animal_4_button.gameObject.AddComponent <RepeatButton>(); animal_4_button.GetComponent <RepeatButton>().onPress.AddListener(OnLongPressBuyAnimal04); //按下。 animal_4_button.GetComponent <RepeatButton>().onRelease.AddListener(OnReleaseBuyAnimal); //抬起,调用一次 animal_5_button.gameObject.AddComponent <RepeatButton>(); animal_5_button.GetComponent <RepeatButton>().onPress.AddListener(OnLongPressBuyAnimal05); //按下。 animal_5_button.GetComponent <RepeatButton>().onRelease.AddListener(OnReleaseBuyAnimal); //抬起,调用一次 animalCellList = new List <Transform>(); animalCellList.Add(animal_1); animalCellList.Add(animal_2); animalCellList.Add(animal_3); animalCellList.Add(animal_4); animalCellList.Add(animal_5); }
/// <summary> /// 获取对应场景的本地动物栏数据 /// </summary> /// <returns></returns> private Config.buildupCell GetBuildupCell(int littleZooID) { Config.buildupCell buildupCell = null; var allData = Config.buildupConfig.getInstace().AllData; foreach (var item in allData) { if (item.Value.scene == playerData.playerZoo.currSceneID && item.Key == littleZooID.ToString()) { buildupCell = item.Value; return(buildupCell); } } string e = string.Format("没有{0}对应的动物栏数据表", playerData.playerZoo.currSceneID); throw new System.Exception(e); return(buildupCell); }