Пример #1
0
        private void AllocIncome(PoolObjHandle <ActorRoot> target, PoolObjHandle <ActorRoot> attacker, ResDT_IncomeAttackRule allocIncomeRule, enIncomeType incomeType, int[] soulExpIncomeChangeRate, int computerChangeRate)
        {
            uint actorKilledIncome = this.GetActorKilledIncome(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, target, attacker, wMemberChooseType, allocIncomeRule, i);
                this.AllocIncomeToHeros(ref this.m_actorIncomes, this.m_allocIncomeRelatedHeros, target, attacker, incomeType, actorKilledIncome, allocIncomeRule, i, soulExpIncomeChangeRate, computerChangeRate);
                this.m_allocIncomeRelatedHeros.Clear();
            }
            for (int j = 0; j < this.m_actorIncomes.Count; j++)
            {
                stActorIncome income = this.m_actorIncomes[j];
                if (income.m_actorRoot != null)
                {
                    stActorIncome income2 = this.m_actorIncomes[j];
                    if (income2.m_actorRoot.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero)
                    {
                        stActorIncome income3     = this.m_actorIncomes[j];
                        uint          incomeValue = income3.m_incomeValue;
                        if ((incomeType == enIncomeType.Soul) && this.m_isExpCompensate)
                        {
                            stActorIncome income4 = this.m_actorIncomes[j];
                            stActorIncome income5 = this.m_actorIncomes[j];
                            incomeValue = this.GetCompensateExp(income4.m_actorRoot, income5.m_incomeValue);
                        }
                        if (incomeType == enIncomeType.Soul)
                        {
                            stActorIncome income6 = this.m_actorIncomes[j];
                            income6.m_actorRoot.ValueComponent.AddSoulExp((int)incomeValue, false, AddSoulType.Income);
                        }
                        else if (incomeType == enIncomeType.GoldCoinInBattle)
                        {
                            stActorIncome income7   = this.m_actorIncomes[j];
                            bool          isLastHit = object.ReferenceEquals(attacker.handle, income7.m_actorRoot);
                            stActorIncome income8   = this.m_actorIncomes[j];
                            income8.m_actorRoot.ValueComponent.ChangeGoldCoinInBattle((int)incomeValue, true, true, target.handle.gameObject.transform.position, isLastHit);
                        }
                        if (incomeType == enIncomeType.Soul)
                        {
                            stActorIncome income9 = this.m_actorIncomes[j];
                            if (income9.m_actorRoot.IsHostCamp() && (incomeValue > 0))
                            {
                                stActorIncome income10 = this.m_actorIncomes[j];
                                Singleton <CBattleSystem> .GetInstance().CreateBattleFloatDigit((int)incomeValue, DIGIT_TYPE.ReceiveSpirit, income10.m_actorRoot.gameObject.transform.position);
                            }
                        }
                    }
                }
            }
            this.m_actorIncomes.Clear();
        }
        private void PutActorToIncomeList(ref List <stActorIncome> actorIncomes, ActorRoot actorRoot, enIncomeType incomeType, uint incomeValue)
        {
            stActorIncome stActorIncome = default(stActorIncome);

            for (int i = 0; i < actorIncomes.get_Count(); i++)
            {
                if (actorIncomes.get_Item(i).m_actorRoot == actorRoot)
                {
                    stActorIncome.m_actorRoot   = actorRoot;
                    stActorIncome.m_incomeType  = incomeType;
                    stActorIncome.m_incomeValue = actorIncomes.get_Item(i).m_incomeValue + incomeValue;
                    actorIncomes.set_Item(i, stActorIncome);
                    return;
                }
            }
            stActorIncome.m_actorRoot   = actorRoot;
            stActorIncome.m_incomeType  = incomeType;
            stActorIncome.m_incomeValue = incomeValue;
            actorIncomes.Add(stActorIncome);
        }