//武器升级 public bool LevelUp(string weaponName) { int oriLevel = GetWeaponLevel(weaponName); ItemItem itemItem = Global.gApp.gGameData.GetItemDataByName(weaponName); if (itemItem.showtype == ItemTypeConstVal.BASE_MAIN_WEAPON) { Guns_dataItem nextLevelCfg = Global.gApp.gGameData.GunDataConfig.Get(oriLevel + 1); nextLevelCfg = Global.gApp.gGameData.GunDataConfig.Get(oriLevel + 1); if (nextLevelCfg == null) { return(false); } } else { GunsSub_dataItem nextLevelCfg = Global.gApp.gGameData.GunSubDataConfig.Get(oriLevel + 1); nextLevelCfg = Global.gApp.gGameData.GunSubDataConfig.Get(oriLevel + 1); if (nextLevelCfg == null) { return(false); } } SetWeaponLevel(weaponName, ++oriLevel); return(true); }
public override void Init(BasePet pet, PetAtkState controller) { base.Init(pet, controller); m_AtkTimes = AtkTimes; ItemItem weaponItem = Global.gApp.gGameData.GetItemDataByName(GameConstVal.WDeadthWalker); GunsPass_dataItem weaponLevelData = Global.gApp.CurScene.GetGunPassDataItem(); double atk = weaponLevelData.DeathWalker[(int)MWeapon.Atk]; int curLv = Global.gApp.gSystemMgr.GetWeaponMgr().GetWeaponLevel(GameConstVal.WDeadthWalker); GunsSub_dataItem levelItem = Global.gApp.gGameData.GunSubDataConfig.Get(curLv); double[] weaponParams = ReflectionUtil.GetValueByProperty <GunsSub_dataItem, double[]>("base_params_" + weaponItem.qualevel, levelItem); float campAtkInc = Global.gApp.CurScene.GetMainPlayerComp().GetBuffMgr().CampPetIncAtk; m_Damage = atk * AtkParam * weaponParams[0] * (1 + campAtkInc); m_DtTime = weaponItem.dtime + m_AnimTime; m_LockTools = new PetLockDisTools(transform, pet); m_LockTools.MaxRadio = 1; m_LockTools.MinRadio = 1; m_LockTools.BreakDis = BreakDis; m_LockTools.SetBreakCall(BreakCall); }
protected override void InitDamage() { ItemItem weaponItem = Global.gApp.gGameData.GetItemDataByName(GameConstVal.WWeaponIcegrenade); m_DtTime = weaponItem.dtime; GunsPass_dataItem weaponLevelData = Global.gApp.CurScene.GetGunPassDataItem(); double atk = weaponLevelData.weapon_icegrenade[(int)MWeapon.Atk]; int curLv = Global.gApp.gSystemMgr.GetWeaponMgr().GetWeaponLevel(GameConstVal.WWeaponIcegrenade); GunsSub_dataItem levelItem = Global.gApp.gGameData.GunSubDataConfig.Get(curLv); double[] weaponParams = ReflectionUtil.GetValueByProperty <GunsSub_dataItem, double[]>("base_params_" + weaponItem.qualevel, levelItem); m_Damage = atk * weaponParams[0] * GetCampDamageInc(); m_WeaponItem = weaponItem; }
protected override void InitDamage() { ItemItem weaponItem = Global.gApp.gGameData.GetItemDataByName(GameConstVal.WBeetle); m_DtTime = weaponItem.dtime; GunsPass_dataItem weaponLevelData = Global.gApp.CurScene.GetGunPassDataItem(); double atk = weaponLevelData.Beetle[(int)MWeapon.Atk]; int curLv = Global.gApp.gSystemMgr.GetWeaponMgr().GetWeaponLevel(GameConstVal.WBeetle); GunsSub_dataItem levelItem = Global.gApp.gGameData.GunSubDataConfig.Get(curLv); double[] weaponParams = ReflectionUtil.GetValueByProperty <GunsSub_dataItem, double[]>("base_params_" + weaponItem.qualevel, levelItem); float campAtkInc = Global.gApp.CurScene.GetMainPlayerComp().GetBuffMgr().CampPetIncAtk; m_Damage = atk * weaponParams[0] * (1 + campAtkInc); }
public int CanLevelUpSub(string weaponName) { ItemItem itemConfig = Global.gApp.gGameData.GetItemDataByName(weaponName); int gunLevel = GetWeaponLevel(itemConfig.name); int roleLevel = Global.gApp.gSystemMgr.GetBaseAttrMgr().GetLevel(); int state = GetWeaponOpenState(weaponName); if (state == WeaponStateConstVal.NONE) { if (itemConfig.opencondition[0] == FilterTypeConstVal.CUR_ITEM_NUM) { return(1008); } else { return(3091); } } GunsSub_dataItem nextLevelCfg = Global.gApp.gGameData.GunSubDataConfig.Get(gunLevel + 1); if (nextLevelCfg == null) { return(3046); } double[] weaponParams = ReflectionUtil.GetValueByProperty <GunsSub_dataItem, double[]>("base_params_" + itemConfig.qualevel, nextLevelCfg); if (weaponParams == null || weaponParams.Length == 0) { return(3046); } //20191014 陈冬要求去掉角色等级对武器升级的限制 //if (gunLevel >= roleLevel) //{ // return 3082; //} return(0); }
public void UIFresh() { if (m_ItemConfig == null) { return; } int lv = Global.gApp.gSystemMgr.GetWeaponMgr().GetWeaponLevel(m_ItemConfig.name); int state = Global.gApp.gSystemMgr.GetWeaponMgr().GetWeaponOpenState(m_ItemConfig.name); int filterType = Convert.ToInt32(m_ItemConfig.opencondition[0]); GunsSub_dataItem lvCfg = Global.gApp.gGameData.GunSubDataConfig.Get(lv); //SubLvtxt //passProgress //BtnUnlock //BtnUpgrade //Unlocktxt //Moneyiconbtn //Moneycostbtn //m_Lock //SubWeaponIcon bottom.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(string.Format(CommonResourceConstVal.SUB_BOTTOM, m_ItemConfig.qualevel)); if (Effect.rectTransform.childCount == 0) { EffectItem effectItem = Global.gApp.gGameData.EffectData.Get(EffectConstVal.SUB_EFFECT); GameObject effect = UiTools.GetEffect(string.Format(effectItem.path, m_ItemConfig.qualevel), Effect.rectTransform); } PetWeaponBg.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(string.Format(CommonResourceConstVal.SUB_BG, m_ItemConfig.qualevel)); if (filterType != FilterTypeConstVal.CUR_ITEM_NUM) { //if (state == WeaponStateConstVal.NONE && FilterFactory.GetInstance().Filter(m_ItemConfig.opencondition)) //{ // state = WeaponStateConstVal.NEW; // Global.gApp.gSystemMgr.GetWeaponMgr().SetWeaponOpenState(m_ItemConfig.name, state); //} //应该显示解锁 bool unLock = state == WeaponStateConstVal.NEW || state == WeaponStateConstVal.EXIST; PetLvtxt.gameObject.SetActive(unLock); progress_bg.gameObject.SetActive(false); BtnUnlock.gameObject.SetActive(false); BtnUpgrade.gameObject.SetActive(unLock); Unlocktxt.gameObject.SetActive(!unLock); Moneyiconbtn.gameObject.SetActive(unLock); Moneycostbtn.gameObject.SetActive(unLock); m_Lock.gameObject.SetActive(!unLock); PetWeaponIcon.gameObject.SetActive(true); PetWeaponIcon.image.color = unLock ? ColorUtil.GetColor(ColorUtil.m_DeaultColor) : ColorUtil.GetColor(ColorUtil.m_WhiteColor); AtkMsg.gameObject.SetActive(unLock); } else { //应该显示解锁 bool unLock = state == WeaponStateConstVal.NEW || state == WeaponStateConstVal.EXIST; PetLvtxt.gameObject.SetActive(unLock); progress_bg.gameObject.SetActive(false); BtnUnlock.gameObject.SetActive(!unLock); BtnUpgrade.gameObject.SetActive(unLock); Unlocktxt.gameObject.SetActive(false); Moneyiconbtn.gameObject.SetActive(true); Moneycostbtn.gameObject.SetActive(true); m_Lock.gameObject.SetActive(!unLock); PetWeaponIcon.gameObject.SetActive(true); PetWeaponIcon.image.color = unLock ? ColorUtil.GetColor(ColorUtil.m_DeaultColor) : ColorUtil.GetColor(ColorUtil.m_WhiteColor); AtkMsg.gameObject.SetActive(unLock); } Unlocktxt.text.text = FilterFactory.GetInstance().GetMiddleUnfinishTips(m_ItemConfig.opencondition); PetLvtxt.text.text = "LV:" + lv; if (lvCfg != null) { if (filterType == FilterTypeConstVal.CUR_ITEM_NUM && state == WeaponStateConstVal.NONE) { int itemId = Convert.ToInt32(m_ItemConfig.opencondition[1]); double unlockItemNum = Convert.ToDouble(m_ItemConfig.opencondition[2]); m_ReduceItemDTO = new ItemDTO(itemId, unlockItemNum, BehaviorTypeConstVal.OPT_WEAPON_UNLOCK); double itemCount = GameItemFactory.GetInstance().GetItem(itemId); passProgress.image.fillAmount = (float)(itemCount / unlockItemNum); Moneyiconbtn.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(string.Format(CommonResourceConstVal.RESOURCE_PATH, itemId)); Moneycostbtn.text.text = UiTools.FormateMoney(unlockItemNum); Moneycostbtn.text.color = ColorUtil.GetTextColor(itemCount < unlockItemNum, null); } else { double[] costValue = ReflectionUtil.GetValueByProperty <GunsSub_dataItem, double[]>("base_cost_" + m_ItemConfig.qualevel, lvCfg); int itemId = Convert.ToInt32(costValue[0]); double unlockItemNum = Convert.ToDouble(costValue[1]); m_ReduceItemDTO = new ItemDTO(itemId, unlockItemNum, BehaviorTypeConstVal.OPT_WEAPON_LEVEL_UP); double itemCount = GameItemFactory.GetInstance().GetItem(itemId); passProgress.image.fillAmount = (float)(itemCount / unlockItemNum); Moneyiconbtn.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(string.Format(CommonResourceConstVal.RESOURCE_PATH, itemId)); Moneycostbtn.text.text = UiTools.FormateMoney(unlockItemNum); Moneycostbtn.text.color = ColorUtil.GetTextColor(itemCount < unlockItemNum, null); } double[] prm = ReflectionUtil.GetValueByProperty <GunsSub_dataItem, double[]>("base_params_" + m_ItemConfig.qualevel, lvCfg); Atk.text.text = string.Format("{0}%", (prm[0] * 100).ToString()); if (Global.gApp.gGameData.GunSubDataConfig.Get(lv + 1) == null) { MaxLevel(lv); } } else { MaxLevel(lv); } PetUp.gameObject.SetActive(Global.gApp.gSystemMgr.GetWeaponMgr().CanUpdateWeapon(m_ItemConfig)); NewPet.gameObject.SetActive(state == WeaponStateConstVal.NEW); NewIMG_pet.gameObject.SetActive(state == WeaponStateConstVal.NEW); }
private void OnUpdateLevel() { int gunLevel = Global.gApp.gSystemMgr.GetWeaponMgr().GetWeaponLevel(m_ItemConfig.name); int roleLevel = Global.gApp.gSystemMgr.GetBaseAttrMgr().GetLevel(); int state = Global.gApp.gSystemMgr.GetWeaponMgr().GetWeaponOpenState(m_ItemConfig.name); int filterType = Convert.ToInt32(m_ItemConfig.opencondition[0]); bool unlockNow = false; if (filterType == FilterTypeConstVal.CUR_ITEM_NUM) { if (state == WeaponStateConstVal.NONE && FilterFactory.GetInstance().Filter(m_ItemConfig.opencondition)) { unlockNow = true; state = WeaponStateConstVal.NEW; Global.gApp.gSystemMgr.GetWeaponMgr().SetWeaponOpenState(m_ItemConfig.name, state); } } int errorCode = Global.gApp.gSystemMgr.GetWeaponMgr().CanLevelUpSub(m_WeaponName); if (errorCode > 0) { if (errorCode == 1008) { ItemItem reduceCfg = Global.gApp.gGameData.ItemData.Get(m_ReduceItemDTO.itemId); Global.gApp.gMsgDispatcher.Broadcast <int, string>(MsgIds.ShowGameTipsByIDAndParam, errorCode, Global.gApp.gGameData.GetTipsInCurLanguage(reduceCfg.sourceLanguage)); } else { Global.gApp.gMsgDispatcher.Broadcast <int>(MsgIds.ShowGameTipsByID, errorCode); } return; } GunsSub_dataItem levelItem = Global.gApp.gGameData.GunSubDataConfig.Get(gunLevel); GunsSub_dataItem nextLevelItem = Global.gApp.gGameData.GunSubDataConfig.Get(gunLevel + 1); double[] nextValue = ReflectionUtil.GetValueByProperty <GunsSub_dataItem, double[]>("base_cost_" + m_ItemConfig.qualevel, nextLevelItem); if (nextValue == null || nextValue.Length == 0) { Global.gApp.gMsgDispatcher.Broadcast <int>(MsgIds.ShowGameTipsByID, 1004); return; } //是否成功扣钱 bool reduceResult = false; m_ReduceItemDTO.paramStr1 = m_WeaponName; m_ReduceItemDTO.paramStr2 = gunLevel.ToString(); GameItemFactory.GetInstance().ReduceItem(m_ReduceItemDTO); reduceResult = m_ReduceItemDTO.result; if (!reduceResult) { ItemItem reduceItemCfg = Global.gApp.gGameData.ItemData.Get(m_ReduceItemDTO.itemId); Global.gApp.gMsgDispatcher.Broadcast <int, string>(MsgIds.ShowGameTipsByIDAndParam, 1008, Global.gApp.gGameData.GetTipsInCurLanguage(reduceItemCfg.sourceLanguage)); return; } bool levelUpResult = false; if (unlockNow) { levelUpResult = true; //InfoCLogUtil.instance.SendClickLog(ClickEnum.WEAPON_PET_UNLOCK); } else { levelUpResult = Global.gApp.gSystemMgr.GetWeaponMgr().LevelUp(m_WeaponName); //InfoCLogUtil.instance.SendClickLog(ClickEnum.WEAPON_PET_UPDATE); } if (levelUpResult) { EffectItem effectItem = Global.gApp.gGameData.EffectData.Get(EffectConstVal.WEAPON_LEVEL_IP); GameObject effect = UiTools.GetEffect(effectItem.path, transform); effect.transform.GetChild(0).localPosition = new Vector3(0f, 0f, 0f); GameObject.Destroy(effect, 3f); } else { ItemDTO addItemDTO = new ItemDTO(m_ReduceItemDTO.itemId, m_ReduceItemDTO.num, BehaviorTypeConstVal.OPT_WEAPON_LEVEL_UP); addItemDTO.paramStr1 = m_WeaponName; addItemDTO.paramStr2 = "MakeUp4Fail"; GameItemFactory.GetInstance().AddItem(addItemDTO); } //OnEquip(); Global.gApp.gMsgDispatcher.Broadcast(MsgIds.UIFresh); }