public void Init(SLevelContext _levelContext) { uint levelIncomeRuleID = IncomeControl.GetLevelIncomeRuleID(_levelContext, this); this.InitIncomeRule(levelIncomeRuleID); this.bSoulGrow = Singleton <BattleLogic> .GetInstance().m_LevelContext.IsSoulGrow(); this.bPvpMode = _levelContext.IsMobaMode(); Singleton <GameEventSys> .instance.RmvEventHandler <GameDeadEventParam>(GameEventDef.Event_ActorDead, new RefAction <GameDeadEventParam>(this.OnActorDead)); Singleton <GameEventSys> .instance.AddEventHandler <GameDeadEventParam>(GameEventDef.Event_ActorDead, new RefAction <GameDeadEventParam>(this.OnActorDead)); this.m_actorIncomes.Clear(); if (this.m_originalGoldCoinInBattle > 0) { List <PoolObjHandle <ActorRoot> > heroActors = Singleton <GameObjMgr> .GetInstance().HeroActors; for (int i = 0; i < heroActors.get_Count(); i++) { if (heroActors.get_Item(i)) { heroActors.get_Item(i).handle.ValueComponent.ChangeGoldCoinInBattle((int)this.m_originalGoldCoinInBattle, true, false, default(Vector3), false, default(PoolObjHandle <ActorRoot>)); } } } }
private void AllocIncome(ref PoolObjHandle <ActorRoot> target, ref PoolObjHandle <ActorRoot> attacker, ResDT_IncomeAttackRule allocIncomeRule, enIncomeType incomeType, int[] soulExpIncomeChangeRate, int computerChangeRate) { uint actorKilledIncome = this.GetActorKilledIncome(ref target, incomeType); this.m_actorIncomes.Clear(); for (int i = 0; i < allocIncomeRule.astIncomeMemberArr.Length; i++) { this.m_allocIncomeRelatedHeros.Clear(); RES_INCOME_MEMBER_CHOOSE_TYPE wMemberChooseType = (RES_INCOME_MEMBER_CHOOSE_TYPE)allocIncomeRule.astIncomeMemberArr[i].wMemberChooseType; this.GetAllocIncomeRelatedHeros(ref this.m_allocIncomeRelatedHeros, ref target, ref attacker, wMemberChooseType, allocIncomeRule, i); this.AllocIncomeToHeros(ref this.m_actorIncomes, this.m_allocIncomeRelatedHeros, ref target, ref attacker, incomeType, actorKilledIncome, allocIncomeRule, i, soulExpIncomeChangeRate, computerChangeRate); this.m_allocIncomeRelatedHeros.Clear(); } if (incomeType == enIncomeType.GoldCoinInBattle && target && target.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) { this.AllocGoldRewardToCamp(ref this.m_actorIncomes, ref attacker, ref target); } for (int j = 0; j < this.m_actorIncomes.get_Count(); j++) { if (this.m_actorIncomes.get_Item(j).m_actorRoot != null && this.m_actorIncomes.get_Item(j).m_actorRoot.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) { uint num = this.m_actorIncomes.get_Item(j).m_incomeValue; if (incomeType == enIncomeType.Soul && IncomeControl.m_isExpCompensate) { num = IncomeControl.GetCompensateExp(this.m_actorIncomes.get_Item(j).m_actorRoot, this.m_actorIncomes.get_Item(j).m_incomeValue); } if (incomeType == enIncomeType.Soul) { if (target && target.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Monster) { num = num * (uint)(10000 + Singleton <BattleLogic> .GetInstance().organControl.GetSoldierDropExpAddByOrgan(target.handle.TheActorMeta.ActorCamp)) / 10000u; } this.m_actorIncomes.get_Item(j).m_actorRoot.ValueComponent.AddSoulExp((int)num, false, AddSoulType.Income); } else if (incomeType == enIncomeType.GoldCoinInBattle) { if (target && target.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Monster) { num = num * (uint)(10000 + Singleton <BattleLogic> .GetInstance().organControl.GetSoldierDropCoinAddByOrgan(target.handle.TheActorMeta.ActorCamp)) / 10000u; } bool isLastHit = object.ReferenceEquals(attacker.handle, this.m_actorIncomes.get_Item(j).m_actorRoot); this.m_actorIncomes.get_Item(j).m_actorRoot.ValueComponent.ChangeGoldCoinInBattle((int)num, true, true, target.handle.myTransform.position, isLastHit, target); } if (incomeType == enIncomeType.Soul && this.m_actorIncomes.get_Item(j).m_actorRoot.IsHostCamp() && num > 0u) { Singleton <CBattleSystem> .GetInstance().CreateBattleFloatDigit((int)num, DIGIT_TYPE.ReceiveSpirit, this.m_actorIncomes.get_Item(j).m_actorRoot.gameObject.transform.position); } } } this.m_actorIncomes.Clear(); }
public static uint GetLevelIncomeRuleID(SLevelContext _levelContext, IncomeControl inControl) { IncomeControl.m_isExpCompensate = false; inControl.m_originalGoldCoinInBattle = 0; IncomeControl.m_compensateRateList.Clear(); uint soulID = _levelContext.m_soulID; if (_levelContext.IsMobaMode()) { inControl.InitExpCompensateInfo(_levelContext.m_isOpenExpCompensate, ref _levelContext.m_expCompensateInfo); inControl.m_originalGoldCoinInBattle = _levelContext.m_originalGoldCoinInBattle; } return(soulID); }
public void UpdateActorProperty(ref ResBattleDynamicProperty _property) { List <PoolObjHandle <ActorRoot> > heroActors = Singleton <GameObjMgr> .GetInstance().HeroActors; for (int i = 0; i < heroActors.get_Count(); i++) { PoolObjHandle <ActorRoot> ptr = heroActors.get_Item(i); if (_property.iSoulExp != 0 && ptr) { ptr.handle.ValueComponent.AddSoulExp((int)IncomeControl.GetCompensateExp(ptr.handle, (uint)_property.iSoulExp), false, AddSoulType.Dynamic); ptr.handle.ValueComponent.ChangeGoldCoinInBattle((int)_property.bGoldCoinInBattleAutoIncreaseValue, true, false, default(Vector3), false, default(PoolObjHandle <ActorRoot>)); } } }