コード例 #1
0
        private void SetSkillTargetLabel(Hotfix_LT.Data.eSkillSelectTargetType targetType)
        {
            switch (targetType)
            {
            case Hotfix_LT.Data.eSkillSelectTargetType.ENEMY_ALL:
                SkillTargetLabel.text    = EB.Localizer.GetString("ID_codefont_in_UISkillDescContorller_2525");
                SkillTargetLabelBG.color = EnemyColor;
                break;

            case Hotfix_LT.Data.eSkillSelectTargetType.ENEMY_TEMPLATE:
                SkillTargetLabel.text    = EB.Localizer.GetString("ID_codefont_in_UISkillDescContorller_2711");
                SkillTargetLabelBG.color = EnemyColor;
                break;

            case Hotfix_LT.Data.eSkillSelectTargetType.ENEMY_RANDOM:
                SkillTargetLabel.text    = EB.Localizer.GetString("ID_codefont_in_UISkillDescContorller_2895");
                SkillTargetLabelBG.color = EnemyColor;
                break;

            case Hotfix_LT.Data.eSkillSelectTargetType.SELF:
                SkillTargetLabel.text    = EB.Localizer.GetString("ID_codefont_in_UISkillDescContorller_3071");
                SkillTargetLabelBG.color = FriendColor;
                break;

            case Hotfix_LT.Data.eSkillSelectTargetType.FRIEND_ALL:
                SkillTargetLabel.text    = EB.Localizer.GetString("ID_codefont_in_UISkillDescContorller_3252");
                SkillTargetLabelBG.color = FriendColor;
                break;

            case Hotfix_LT.Data.eSkillSelectTargetType.FRIEND_RANDOM:
                SkillTargetLabel.text    = EB.Localizer.GetString("ID_codefont_in_UISkillDescContorller_3438");
                SkillTargetLabelBG.color = FriendColor;
                break;

            case Hotfix_LT.Data.eSkillSelectTargetType.FRIEND_TEMPLATE:
                SkillTargetLabel.text    = EB.Localizer.GetString("ID_codefont_in_UISkillDescContorller_3626");
                SkillTargetLabelBG.color = FriendColor;
                break;

            case Hotfix_LT.Data.eSkillSelectTargetType.All_NOT_SELF:
                SkillTargetLabel.text    = EB.Localizer.GetString("ID_codefont_in_UISkillDescContorller_3811");
                SkillTargetLabelBG.color = EnemyColor;
                break;
            }
        }
コード例 #2
0
        /// <summary>
        /// 设置技能可选择的目标信息
        /// </summary>
        /// <param name="skill_id"></param>
        /// <param name="type"></param>
        private void SetTargetingInfo(int skill_id, int type)
        {
            //int target_team = -1;
            //int max_targets = 1;
            _selectSkillID   = skill_id;
            _selectSkillType = type;
            List <int> target_indexes = new List <int>();

            Hotfix_LT.Data.SkillTemplate          skill_tpl        = Hotfix_LT.Data.SkillTemplateManager.Instance.GetTemplate(skill_id);
            Hotfix_LT.Data.eSkillSelectTargetType selectTargetType = skill_tpl.SelectTargetType;
            if (selectTargetType == Hotfix_LT.Data.eSkillSelectTargetType.ENEMY_TEMPLATE ||
                selectTargetType == Hotfix_LT.Data.eSkillSelectTargetType.ENEMY_ALL ||
                selectTargetType == Hotfix_LT.Data.eSkillSelectTargetType.ENEMY_RANDOM)
            {
                _targetTeam = 1 - CombatLogic.Instance.LocalPlayerTeamIndex;
                LTCombatEventReceiver.Instance.ForEach(combatant =>
                {
                    if (combatant.Index == null)
                    {
                        return;
                    }
                    if (combatant.Index.TeamIndex == _targetTeam && (!combatant.IsDead() || skill_tpl.CanSelectDeath) && combatant.CanSelect())
                    {
                        combatant.SetRestrainFlag(CharacterData.Attr);
                        target_indexes.Add(combatant.Index.IndexOnTeam);
                    }
                    else
                    {
                        combatant.HideRestrainFlag();
                    }
                });
            }
            else if (selectTargetType == Hotfix_LT.Data.eSkillSelectTargetType.FRIEND_TEMPLATE ||
                     selectTargetType == Hotfix_LT.Data.eSkillSelectTargetType.FRIEND_ALL ||
                     selectTargetType == Hotfix_LT.Data.eSkillSelectTargetType.FRIEND_RANDOM)
            {
                _targetTeam = CombatLogic.Instance.LocalPlayerTeamIndex;
                LTCombatEventReceiver.Instance.ForEach(combatant =>
                {
                    if (combatant.Index.TeamIndex == _targetTeam && (!combatant.IsDead() || skill_tpl.CanSelectDeath) && combatant.CanSelect())
                    {
                        combatant.SetGainFlag();
                        target_indexes.Add(combatant.Index.IndexOnTeam);
                    }
                    else
                    {
                        combatant.HideRestrainFlag();
                    }
                });
            }
            else if (selectTargetType == Hotfix_LT.Data.eSkillSelectTargetType.SELF)
            {
                _targetTeam = CombatLogic.Instance.LocalPlayerTeamIndex;
                LTCombatEventReceiver.Instance.ForEach(combatant =>
                {
                    if (combatant.Index.TeamIndex == _targetTeam && combatant.Index.IndexOnTeam == CharacterData.IndexOnTeam && (!combatant.IsDead() || skill_tpl.CanSelectDeath) && combatant.CanSelect())
                    {
                        combatant.SetGainFlag();
                        target_indexes.Add(combatant.Index.IndexOnTeam);
                    }
                    else
                    {
                        combatant.HideRestrainFlag();
                    }
                });
            }
            else if (selectTargetType == Hotfix_LT.Data.eSkillSelectTargetType.All_NOT_SELF)
            {
                _targetTeam = CombatLogic.Instance.LocalPlayerTeamIndex;
                LTCombatEventReceiver.Instance.ForEach(combatant =>
                {
                    if (combatant.Data.IngameId != CharacterData.IngameId && (!combatant.IsDead() || skill_tpl.CanSelectDeath) && combatant.CanSelect())
                    {
                        if (combatant.Index.TeamIndex == _targetTeam)
                        {
                            combatant.SetGainFlag();
                        }
                        else
                        {
                            combatant.SetRestrainFlag(CharacterData.Attr);
                        }
                        target_indexes.Add(combatant.Index.IndexOnTeam);
                    }
                    else
                    {
                        combatant.HideRestrainFlag();
                    }
                });
            }
            else
            {
                EB.Debug.LogError("skillSelectType error for skillid={0}", skill_id);
            }
            CombatTargetSelectController.Instance.SetTargetingInfo(CharacterData.Index, _targetTeam, 1, target_indexes);
        }