Beispiel #1
0
        public async Task <ResultDto> Add(SkillInput item)
        {
            var result = new ResultDto {
                Message = ""
            };

            try
            {
                var ware = _mapper.Map <SkillEntity>(item);


                await _skillDomainService.Add(ware);

                await _operatorLogDomainService.AddSuccess(new OperatorLogEntity
                {
                    Type    = OperatorLogType.添加武功,
                    Content = JsonConvert.SerializeObject(item)
                });

                await Commit();

                result.IsSuccess = true;
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
                await _operatorLogDomainService.AddError(new OperatorLogEntity
                {
                    Type    = OperatorLogType.添加武功,
                    Content = $"Data={JsonConvert.SerializeObject(item)},ErrorMessage={result.Message}"
                });
                await Commit();
            }
            return(result);
        }
Beispiel #2
0
    private static List <SkillInput> ParseKey(string strParam)
    {
        List <SkillInput> lstSkillInput = new List <SkillInput>();

        if (strParam.Length == 0)
        {
            return(lstSkillInput);
        }

        string[] keys = strParam.Split('/');
        foreach (string param in keys)
        {
            SkillInput newSkillInput = new SkillInput();
            //combo
            if (param.Contains("+"))
            {
                string[] dirAndKey = param.Split('+');
                _GetJoystickInput(dirAndKey[0], newSkillInput);
                newSkillInput.cmd = _GetKeyType(dirAndKey[1]);
            }
            else
            {
                if (_IsCommand(param))
                {
                    newSkillInput.cmd = _GetKeyType(param);
                }
                else
                {
                    _GetJoystickInput(param, newSkillInput);
                }
            }
            lstSkillInput.Add(newSkillInput);
        }
        return(lstSkillInput);
    }
Beispiel #3
0
    private SkillComposite BuildSkill(SkillInput input)
    {
        SkillComposite composite = new SkillComposite(new DoubleWordProcess("foo"));

        Func <SkillProcess, DisplayWordProcess> onDoubleWord_DisplayWord = (parentProcess) => {
            DoubleWordProcess comp = (DoubleWordProcess)parentProcess;
            return(new DisplayWordProcess(comp.OutputWord));
        };

        Func <SkillProcess, DoubleWordProcess> onDoubleWord_DoubleWord = (parentProcess) => {
            DoubleWordProcess comp = (DoubleWordProcess)parentProcess;
            return(new DoubleWordProcess(comp.OutputWord));
        };

        composite
        .In(parentProcess => new SplitStringProcess("abc#def.ghi.jkl#mno", '.'))
        .InSeveral(parentProcess => {
            SplitStringProcess parent = (SplitStringProcess)parentProcess;
            return(parent.words.Select(word => new SplitStringProcess(word, '#')));
        })
        .DoSeveral(parentProcess => {
            SplitStringProcess parent = (SplitStringProcess)parentProcess;
            return(parent.words.Select(word => new DisplayWordProcess(word)));
        })
        .Out()
        .Out()
        ;

        return(composite);
    }
Beispiel #4
0
    /**选择切入技能*/
    public static SkillInstance ChooseCutInSkill(List <SkillInstance> basicSkills, bool left)
    {
        foreach (SkillInstance skillInst in basicSkills)
        {
            foreach (SkillAction action in skillInst.skill.actions)
            {
                for (int i = 0; i < action.inputs.Count; ++i)
                {
                    SkillInput input   = action.inputs[i];
                    bool       matched = false;
                    switch (input.moveDir)
                    {
                    case EDirection.eLeft:
                        matched = left;
                        break;

                    case EDirection.eRight:
                        matched = !left;
                        break;
                    }
                    if (matched)
                    {
                        skillInst.curAction     = action;
                        skillInst.matchedKeyIdx = i;
                        return(skillInst);
                    }
                }
            }
        }
        return(null);
    }
Beispiel #5
0
 static bool Equals(SkillInput a, SkillInput b)
 {
     if (object.Equals(a, null) || object.Equals(b, null))
     {
         return(object.Equals(a, b));
     }
     return(a.moveDir == b.moveDir && b.inputType == b.inputType && a.cmd == b.cmd);
 }
Beispiel #6
0
    public AddSkillEffectProcess(SkillInput skillInput, Func <SkillInput, SkillComposite> buildSkillCbk, string skillLabel, int effectDuration)
    {
        Func <SkillInput, SkillComposite> autoEndedBuildSkillCbk = (input) => {
            return(buildSkillCbk(input).Do((parentProcess) => new EndPassProcess()));
        };
        Skill skill = new Skill(autoEndedBuildSkillCbk, skillLabel);

        this.Init(skillInput, skill, effectDuration);
    }
Beispiel #7
0
 static void _GetJoystickInput(string param, SkillInput skillInput)
 {
     string[] typeAndDir = param.Split('&');
     skillInput.inputType = _GetInputDirType(typeAndDir[0]);
     skillInput.moveDir   = _GetMoveDir(typeAndDir[1]);
     if (typeAndDir.Length > 2)
     {
         skillInput.moveAngleRange = _GetMoveAngleRange(typeAndDir[2]);
     }
 }
Beispiel #8
0
    public void Init(SkillInput input)
    {
        SkillComposite composite = this.buildSkillCbk(input);

        this.composites = new List <SkillComposite>()
        {
            composite
        };
        this.states = new List <bool>()
        {
            false
        };
    }
Beispiel #9
0
    private void MoveToNextSkill()
    {
        if (this.skills.Count == 0)
        {
            this.currentSkill = null;
            return;
        }

        KeyValuePair <SkillInput, Skill> skill = this.skills.Dequeue();

        this.currentSkill = skill.Value;
        this.currentInput = skill.Key;
        this.currentSkill.Init(this.currentInput);
    }
    override public void OnEnter(PlayerState lastState)
    {
        base.OnEnter(lastState);

        m_player.m_bMovedWithBall = true;

        m_bDefenderOp = false;
        m_bChecked    = false;

        PlayerAnimAttribute.AnimAttr crossoverAttr = m_player.m_animAttributes.GetAnimAttrById(Command.CrossOver, m_curAction);
        if (crossoverAttr == null)
        {
            Debug.LogError("Current action: " + m_curAction + " in crossover id: " + m_curExecSkill.skill.id);
        }
        IM.Number frameRate = m_player.animMgr.GetFrameRate(m_curAction);
        m_player.m_blockable.Init(crossoverAttr, frameRate);

        SkillInput input = m_curExecSkill.curAction.inputs[0];

        if (input.moveDir == EDirection.eLeft ||
            (input.moveDir == EDirection.eForward && input.moveAngleRange.x >= IM.Math.HALF_CIRCLE && input.moveAngleRange.y >= IM.Math.HALF_CIRCLE))
        {
            m_crossDir = CrossDir.Left;
        }
        else if (input.moveDir == EDirection.eRight ||
                 (input.moveDir == EDirection.eForward && input.moveAngleRange.x <= IM.Math.HALF_CIRCLE && input.moveAngleRange.y <= IM.Math.HALF_CIRCLE))
        {
            m_crossDir = CrossDir.Right;
        }
        else
        {
            m_crossDir = CrossDir.None;
        }

        m_player.forward = GameUtils.HorizonalNormalized(m_basket.m_vShootTarget, m_player.position);

        uint uSkillValue = 0;

        m_player.m_skillSystem.HegdingToValue("cross_speed", ref uSkillValue);
        //float crossSpeed = (m_player.m_finalAttrs["cross_speed"] + uSkillValue) * 0.0036f + 1f;(添加精度更高Number,还末测试)
        IM.PrecNumber crossSpeed = new IM.PrecNumber((int)(m_player.m_finalAttrs["cross_speed"] + uSkillValue)) * new IM.PrecNumber(0, 003600) + IM.PrecNumber.one;

        m_player.animMgr.Play(m_curAction, (IM.Number)crossSpeed, true).rootMotion.Reset();

        targetPos = GetEndPos();

        ++m_player.mStatistics.data.cross_times;
    }
Beispiel #11
0
    public SkillEffect(SkillInput skillInput, Skill skill, int effectDuration)
    {
        this.skillQueueResolver = DependencyLocator.GetSkillQueueResolver();
        this.timelineController = DependencyLocator.getTimelineController();

        this.uniqId = (this.timelineController.CurrentPassAgent.UniqId.groupId, ++SkillEffect.selfIdCount);

        int atb = (int)Mathf.Floor(100 - this.timelineController.CurrentPassPriorityScore * this.Speed) % 100;

        atb      = (atb + 100) % 100;
        this.Atb = atb;

        this.skillInput     = skillInput;
        this.skill          = skill;
        this.effectDuration = effectDuration;
    }
Beispiel #12
0
        public async Task <ResultDto> Update(int id, SkillInput item)
        {
            var result = new ResultDto {
                Message = ""
            };

            try
            {
                var ware = await _skillDomainService.Get(id);

                if (ware == null)
                {
                    result.Message = $"物品 {id} 不存在!";
                    return(result);
                }
                var content = ware.ComparisonTo(item);
                _mapper.Map(item, ware);



                await _skillDomainService.Update(ware);

                await _operatorLogDomainService.AddSuccess(new OperatorLogEntity
                {
                    Type    = OperatorLogType.修改武功,
                    Content = $"Id = {id},Data = {content}"
                });

                await Commit();

                result.IsSuccess = true;
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
                await _operatorLogDomainService.AddError(new OperatorLogEntity
                {
                    Type    = OperatorLogType.修改武功,
                    Content = $"Data={JsonConvert.SerializeObject(item)},ErrorMessage={result.Message}"
                });
                await Commit();
            }
            return(result);
        }
Beispiel #13
0
    /**选择突破技能(分向上突破,向左突破,向右突破)*/
    public static SkillInstance ChooseCrossSkill(List <SkillInstance> basicSkills, bool horiCross, bool left)
    {
        foreach (SkillInstance skillInst in basicSkills)
        {
            foreach (SkillAction action in skillInst.skill.actions)
            {
                for (int i = 0; i < action.inputs.Count; ++i)
                {
                    SkillInput input   = action.inputs[i];
                    bool       matched = false;
                    switch (input.moveDir)
                    {
                    case EDirection.eLeft:
                        matched = horiCross && left;
                        break;

                    case EDirection.eRight:
                        matched = horiCross && !left;
                        break;

                    case EDirection.eForward:
                        if (!horiCross)
                        {
                            matched = (left && input.moveAngleRange.x >= 180 && input.moveAngleRange.y >= 180) ||
                                      (!left && input.moveAngleRange.x < 180 && input.moveAngleRange.y < 180);
                        }
                        break;
                    }
                    if (matched)
                    {
                        skillInst.curAction     = action;
                        skillInst.matchedKeyIdx = i;
                        return(skillInst);
                    }
                }
            }
        }
        return(null);
    }
Beispiel #14
0
    private void ResolveSkill(Vector3 pos)
    {
        if (this.actor.Skills.Selected == null)
        {
            return;
        }

        TileFacade targetTile = this.tilemapManager.GetTileFromWorldPos(pos);

        if (targetTile == null)
        {
            return;
        }

        ActorFacade caster      = this.actor;
        ActorFacade targetActor = (ActorFacade)targetTile.Agent;
        SkillInput  input       = new SkillInput(caster, targetTile, targetActor);

        this.skillQueueResolver.AddSkill(input, this.actor.Skills.Selected);

        this.CancelSkill();
    }
 public OnTakeDamageReactionProcess(ActorFacade watchedActor, SkillInput skillInput, string skillLabel, Func <SkillInput, SkillComposite> buildSkillCbk) : base(watchedActor, skillInput, skillLabel, buildSkillCbk)
 {
 }
Beispiel #16
0
    private SkillComposite BuildSkill(SkillInput input)
    {
        SkillComposite composite = new SkillComposite(new AddSkillEffectProcess(input, this.CreateLoggingEffect, "LoggingEffect", 3));

        return(composite);
    }
Beispiel #17
0
    private SkillComposite CreateLoggingEffect(SkillInput skillInput)
    {
        SkillComposite composite = new SkillComposite(new DisplayWordProcess("logging effect" + skillInput.Caster.Name));

        return(composite);
    }
    private SkillComposite BuildSkill(SkillInput input)
    {
        SkillComposite composite = new SkillComposite(new MoveProcess(input.Caster, input.TargetTile, new ManhattanTopology(), new WalkableFilter()));

        return(composite);
    }
Beispiel #19
0
    private SkillComposite BuildSkill(SkillInput input)
    {
        SkillComposite composite = new SkillComposite(new EndPassProcess());

        return(composite);
    }
Beispiel #20
0
    bool _MatchAction(Command curCommand, SkillInstance skillInstance, bool bIgnoreDir)
    {
        List <SkillAction> matchedActions = new List <SkillAction>();

        SkillAttr skill = skillInstance.skill;
        int       cnt   = skill.actions.Count;

        for (int idx = 0; idx != cnt; idx++)
        {
            SkillAction action = skill.actions[idx];
            SkillInput  input  = action.inputs[0];
            if (input.cmd != curCommand)
            {
                continue;
            }
            EDirection dir = m_player.m_inputDispatcher.GetMoveDirection(input.inputType);
            if (input.moveDir != dir || (bIgnoreDir && input.moveDir != EDirection.eNone))
            {
                continue;
            }
            matchedActions.Add(action);
        }

        if (matchedActions.Count == 0)
        {
            return(false);
        }

        int         iSelActionIdx = IM.Random.Range(0, matchedActions.Count);
        SkillAction finalAction   = matchedActions[iSelActionIdx];

        PlayerState       curState   = m_player.m_StateMachine.m_curState;
        PlayerState_Skill skillState = curState as PlayerState_Skill;

        if (finalAction.interrupts.Count > 0)
        {
            foreach (SkillInterrupt interrupt in finalAction.interrupts)
            {
                if (!curState.m_lstActionId.Contains(interrupt.id))
                {
                    continue;
                }
                Debug.Log("Interrupt action: " + skillInstance.skill.action_type + " , action id: " + finalAction.id);
                //matched
                skillInstance.curAction     = finalAction;
                skillInstance.matchedKeyIdx = iSelActionIdx;
                return(true);
            }
            return(false);
        }
        else if (skillState == null)
        {
            skillInstance.curAction     = finalAction;
            skillInstance.matchedKeyIdx = iSelActionIdx;
            return(true);
        }
        else if (skillState != null && skillState.m_bPersistent)
        {
            skillInstance.curAction     = finalAction;
            skillInstance.matchedKeyIdx = iSelActionIdx;
            return(true);
        }

        return(false);
    }
Beispiel #21
0
    private SkillComposite BuildSkill(SkillInput input)
    {
        SkillComposite composite = new SkillComposite(new OnTakeDamageReactionProcess(input.TargetActor, null, new LoggingSkill()));

        return(composite);
    }
Beispiel #22
0
 public AddSkillEffectProcess(SkillInput skillInput, Skill skill, int effectDuration)
 {
     this.Init(skillInput, skill, effectDuration);
 }
Beispiel #23
0
 private void Init(SkillInput skillInput, Skill skill, int effectDuration)
 {
     this.skillInput     = skillInput;
     this.skill          = skill;
     this.effectDuration = effectDuration;
 }
Beispiel #24
0
 private void Init(TWatchedElement watchedElement, SkillInput skillInput, Skill skill)
 {
     this.watchedElement = watchedElement;
     this.skill          = skill;
     this.skillInput     = skillInput;
 }
    private SkillComposite BuildSkill(SkillInput input)
    {
        SkillComposite composite = new SkillComposite(new AddTurnBreakProcess(input.TargetActor));

        return(composite);
    }
Beispiel #26
0
 public SkillReactionProcess(TWatchedElement watchedElement, SkillInput skillInput, Skill skill)
 {
     this.Init(watchedElement, skillInput, skill);
 }
 public OnTakeDamageReactionProcess(ActorFacade watchedActor, SkillInput skillInput, Skill skill) : base(watchedActor, skillInput, skill)
 {
 }
Beispiel #28
0
    public SkillReactionProcess(TWatchedElement watchedElement, SkillInput skillInput, string skillLabel, Func <SkillInput, SkillComposite> buildSkillCbk)
    {
        Skill skill = new Skill(buildSkillCbk, skillLabel);

        this.Init(watchedElement, skillInput, skill);
    }
Beispiel #29
0
 public void AddSkill(SkillInput input, Skill skill)
 {
     this.skills.Enqueue(new KeyValuePair <SkillInput, Skill>(input, skill));
 }