public override void Execute(IImpactScorerData data)
        {
            var value  = (long)_logic.Calculate(data.Value);
            var values = _scorers.GetScrorerMap(data.Id, data.StageId);

            if (values == null)
            {
                return;
            }
            long delta = 0;

            switch (data.Operator)
            {
            case OperationType.Add:
                delta            = value;
                values[data.Id] += value;
                break;

            case OperationType.Set:
                delta           = value - values[data.Id];
                values[data.Id] = value;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            if (delta > 0)
            {
                var staticData = _scorers._scorers.Static.MoneyTypes.Values.FirstOrDefault(x => x.ScorerId == data.Id);
                if (staticData != null && staticData.AchievScorerId != 0)
                {
                    values = _scorers.GetScrorerMap(staticData.AchievScorerId, 0);
                    if (values != null)
                    {
                        values[staticData.AchievScorerId] += delta;
                    }
                }
            }

            if (_scorers.HasLog(data.Id))
            {
                var logStage = data.StageId;
                if (logStage == 0)
                {
                    if (_explorer.State.IsRun)
                    {
                        logStage = _explorer.CurrentStage;
                    }
                }
                LogicLog.ChangeScorer(data.Id, data.Operator, value, logStage);
            }
        }
Ejemplo n.º 2
0
        public void SetScorerValue(int scorerId, int value)
        {
            var values = _scorerLogic.GetScrorerMap(scorerId, _explorer.CurrentStage);

            values[scorerId] = value;
        }