少年修仙传客户端代码仓库
client_Zxw
2019-03-07 a22f5d610d4031699321d5ba4054582cb7211522
Merge remote-tracking branch 'origin/master' into Auction
4个文件已添加
5个文件已修改
341 ■■■■■ 已修改文件
Core/NetworkPackage/DTCFile/ServerPack/H03_MainCharacter/DTC0310_tagRoleSkillChange.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/Actor/AI/AI_Npc_200.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/Actor/AI/AI_Npc_200.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/Actor/AI/HeroAI_Base.cs 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/Actor/HeroBehaviour.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/Actor/Skill/SkillHelper.cs 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/GameActor/GA_Hero.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/GameActor/HeroRoundGird.cs 246 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/GameActor/HeroRoundGird.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/DTCFile/ServerPack/H03_MainCharacter/DTC0310_tagRoleSkillChange.cs
@@ -69,5 +69,7 @@
            InstanceResourcesLoader.PreloadSkillEffect(vNetData.NewSkillID);
        }
        SkillHelper.Instance.BindSkill(vNetData.NewSkillID);
    }
}
Fight/Actor/AI/AI_Npc_200.cs
New file
@@ -0,0 +1,13 @@
using UnityEngine;
public class AI_Npc_200 : SampleAI
{
    public AI_Npc_200(GA_NpcClientFightNorm owner, Vector3 bornPosition) : base(owner, bornPosition)
    {
    }
    protected override void OnUpdate()
    {
    }
}
Fight/Actor/AI/AI_Npc_200.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 2114dca02aee99b46af602a6576d0fbe
timeCreated: 1551842944
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
Fight/Actor/AI/HeroAI_Base.cs
@@ -1,5 +1,4 @@

using System.Collections.Generic;
using System.Collections.Generic;
using Snxxz.UI;
using UnityEngine;
@@ -107,7 +106,7 @@
        int _chkSkillID = -1;
        for (int i = 0; i < skillList.Length; ++i)
        {
            _chkSkillID = skillList[i];
            _chkSkillID = SkillHelper.Instance.GetSkillID(skillList[i]);
            if (CanCast(_chkSkillID))
            {
@@ -121,10 +120,22 @@
    protected bool CanCastActiveUse(int skillID)
    {
        GA_Hero _hero = PlayerDatas.Instance.hero;
        var _skill = _hero.SkillMgr.Get(skillID);
        // 获取英雄真实拥有的技能
        Dictionary<int, PlayerSkillData> _heroSkills = PlayerDatas.Instance.skill.GetAllSkill();
        if (!_heroSkills.ContainsKey(skillID))
        bool _has = false;
        foreach (var _skillData in _heroSkills.Values)
        {
            if (_skillData.skillCfg.SkillTypeID == _skill.skillInfo.config.SkillTypeID)
            {
                _has = true;
                break;
            }
        }
        if (!_has)
        {
            return false;
        }
@@ -133,8 +144,6 @@
        {
            return false;
        }
        var _skill = _hero.SkillMgr.Get(skillID);
        // 判断是否是被封禁的技能
        if (!StatusMgr.Instance.CanAttack(_hero.ServerInstID, _skill.skillInfo.config.SkillOfSeries))
@@ -185,9 +194,9 @@
        if (_target != null && lockNpcID != -1)
        {
            var _npcFight = _target as GActorNpcFight;
            if(_npcFight != null)
            if (_npcFight != null)
            {
                if(_npcFight.NpcConfig.NPCID != lockNpcID)
                if (_npcFight.NpcConfig.NPCID != lockNpcID)
                {
                    _target = GAMgr.Instance.FindAtkTarget(searchCenter, range, 360, lockNpcID);
                }
Fight/Actor/HeroBehaviour.cs
@@ -714,7 +714,7 @@
                {
                    // 创建发包协议
                    _b405 = new CB405_tagCMSuperAtk();
                    _b405.SkillID = (ushort)skill.id;
                    _b405.SkillID = (ushort)SkillHelper.Instance.GetSkillID(skill.skillInfo.config.SkillTypeID);
                    _b405.PosX = (ushort)(m_Hero.Pos.x * 2 + GA_Hero.MapOffset.x);
                    _b405.PosY = (ushort)(m_Hero.Pos.z * 2 + GA_Hero.MapOffset.z);
                    _b405.TagPosX = (ushort)(skill.targetPosition.x * 2 + GA_Hero.MapOffset.x);
Fight/Actor/Skill/SkillHelper.cs
@@ -8,10 +8,10 @@
/// </summary>
[XLua.LuaCallCSharp]
public class SkillHelper : Singleton<SkillHelper>
{
    private Dictionary<int, SkillInfo> m_SkillInfoDict;
    private Dictionary<int, List<SkillInfo>> m_SkillToSpSkill;
    private Dictionary<int, int> m_SkillTypeIDToSkillID;
    public void Init()
    {
@@ -25,10 +25,35 @@
            m_SkillToSpSkill = new Dictionary<int, List<SkillInfo>>();
        }
        if (m_SkillTypeIDToSkillID == null)
        {
            m_SkillTypeIDToSkillID = new Dictionary<int, int>();
        }
        Snxxz.UI.TreasureSkillModel _model = Snxxz.UI.ModelCenter.Instance.GetModel<Snxxz.UI.TreasureSkillModel>();
        _model.potentialLevelRefresh += OnSpSkillChange;
    }
    public void BindSkill(int skillID)
    {
        SkillConfig _skill = SkillConfig.Get(skillID);
        if (_skill == null)
        {
            return;
        }
        m_SkillTypeIDToSkillID[_skill.SkillTypeID] = _skill.SkillID;
    }
    public int GetSkillID(int typeID)
    {
        if (m_SkillTypeIDToSkillID.ContainsKey(typeID))
        {
            return m_SkillTypeIDToSkillID[typeID];
        }
        return typeID;
    }
    public void OnSpSkillChange(int skillTypeID, int level)
    {
        //Debug.LogFormat("# sp技能[{0}]发生了改变: {1} #", skillTypeID, level);
Fight/GameActor/GA_Hero.cs
@@ -1025,7 +1025,7 @@
            E_SkillCastType _castType = (E_SkillCastType)(_skill.skillInfo.config.Tag % 10);
            if (_castType == E_SkillCastType.NeedTarget)
            {
                if (!AttackHandler.CanAttack(_targetType, this, SelectTarget as GActorNpcFight))
                if (!AttackHandler.CanAttack(_targetType, this, SelectTarget as GActorFight))
                {
                    SysNotifyMgr.Instance.ShowTip("SkillSelectedTarget");
                    return;
Fight/GameActor/HeroRoundGird.cs
New file
@@ -0,0 +1,246 @@
using UnityEngine;
using System.Collections.Generic;
public class HeroRoundGird
{
    public class GirdNode
    {
        public int index;
        public int column;
        public int row;
    }
    private List<GirdNode> m_1 = new List<GirdNode>();
    private List<GirdNode> m_2 = new List<GirdNode>();
    private List<GirdNode> m_3 = new List<GirdNode>();
    private List<GirdNode> m_4 = new List<GirdNode>();
    private Dictionary<int, GirdNode> m_NodeDict = new Dictionary<int, GirdNode>();
    private Dictionary<int, bool> m_NodeEmpty = new Dictionary<int, bool>();
    private float m_Width = 0.5f;
    private float m_Height = 0.5f;
    private int m_Row;
    private int m_Column;
    private float m_OffsetX;
    private float m_OffsetY;
    private float m_Sin45 = .7071f;
    private int m_Half;
    public void Init(int row, int column)
    {
        m_Row = row;
        m_Column = column;
        m_Half = m_Row / 2;
        int _count = m_Half * m_Half;
        for (int i = m_Half; i < m_Row; ++i)
        {
            for (int j = m_Half; j < m_Column; ++j)
            {
                var _node = new GirdNode
                {
                    index = i * m_Column + j,
                    column = j,
                    row = i
                };
                m_1.Add(_node);
                m_NodeDict[_node.index] = _node;
                m_NodeEmpty[_node.index] = true;
            };
        }
        m_1.Sort(_Sort);
        for (int i = m_Half; i < m_Row; ++i)
        {
            for (int j = 0; j < m_Half; ++j)
            {
                var _node = new GirdNode
                {
                    index = i * m_Column + j,
                    column = j,
                    row = i
                };
                m_2.Add(_node);
                m_NodeDict[_node.index] = _node;
                m_NodeEmpty[_node.index] = true;
            }
        }
        m_2.Sort(_Sort);
        for (int i = 0; i < m_Half; ++i)
        {
            for (int j = 0; j < m_Half; ++j)
            {
                var _node = new GirdNode
                {
                    index = i * m_Column + j,
                    column = j,
                    row = i
                };
                m_2.Add(_node);
                m_NodeDict[_node.index] = _node;
                m_NodeEmpty[_node.index] = true;
            }
        }
        m_3.Sort(_Sort);
        for (int i = 0; i < m_Half; ++i)
        {
            for (int j = m_Half; j < m_Column; ++j)
            {
                var _node = new GirdNode
                {
                    index = i * m_Column + j,
                    column = j,
                    row = i
                };
                m_2.Add(_node);
                m_NodeDict[_node.index] = _node;
                m_NodeEmpty[_node.index] = true;
            }
        }
        m_4.Sort(_Sort);
        m_OffsetX = -column * m_Width * .5f;
        m_OffsetY = -row * m_Height * .5f;
    }
    private int _Sort(GirdNode a, GirdNode b)
    {
        var _r = a.row - m_Half;
        var _c = a.column - m_Half;
        var _d1 = _c * _c + _r + _r;
        _r = b.row - m_Half;
        _c = b.column - m_Half;
        var _d2 = _c * _c + _r + _r;
        return _d2 > _d1 ? -1 : 1;
    }
    public GirdNode Request(Vector3 pos, float limitDis)
    {
        var _hero = PlayerDatas.Instance.hero;
        if (_hero == null)
        {
            return null;
        }
        // 获取行列
        float _x = pos.x + m_OffsetX;
        float _y = pos.z + m_OffsetY;
        int _column = (int)(_x / m_Width);
        int _row = (int)(_y / m_Height);
        int _index = _row * _column;
        Debug.LogFormat("监测点: {0}, 所处行: {1}, 列: {2}, 当前对应索引 {3}", pos, _row, _column, _index);
        // 距离满足的情况下, 则计算索引
        float _currentDistance = MathUtility.DistanceSqrtXZ(pos, _hero.Pos);
        if (_currentDistance < limitDis * limitDis)
        {
            if (_index >= 0 && _index < m_NodeDict.Count)
            {
                if (m_NodeEmpty[_index])
                {
                    return m_NodeDict[_index];
                }
                else
                {
                    Debug.LogFormat("<color=yellow>监测点: {0}, 索引 {1} 已经被占用...</color>", pos, _index);
                }
            }
            else
            {
                Debug.LogFormat("<color=yellow>监测点: {0}, 索引 {1} 非法...</color>", pos, _index);
            }
        }
        else
        {
            Debug.LogFormat("<color=yellow>监测点: {0}, 距离超出限定距离...</color>", pos, _index);
        }
        byte _quadrant = 0;
        if (pos.x >= _hero.Pos.x && pos.z >= _hero.Pos.z)
        {
            _quadrant = 0;
        }
        else if (pos.x <= _hero.Pos.x && pos.z >= _hero.Pos.z)
        {
            _quadrant = 1;
        }
        else if (pos.x <= _hero.Pos.x && pos.z <= _hero.Pos.z)
        {
            _quadrant = 2;
        }
        else
        {
            _quadrant = 3;
        }
        Debug.LogFormat("监测点: {0}, 相对于玩家处于第 {2} 象限.", pos, (_quadrant + 1));
        float _sideLength = limitDis * m_Sin45;
        switch (_quadrant)
        {
            case 0:
                //   □ │ ■
                //  ───┼───
                //   □ │ □
                for (int i = 0; i < m_1.Count; ++i)
                {
                    if (m_NodeEmpty[m_1[i].index])
                    {
                        m_NodeEmpty[m_1[i].index] = false;
                        return m_1[i];
                    }
                }
                break;
            case 1:
                //   ■ │ □
                //  ───┼───
                //   □ │ □
                for (int i = 0; i < m_2.Count; ++i)
                {
                    if (m_NodeEmpty[m_2[i].index])
                    {
                        m_NodeEmpty[m_2[i].index] = false;
                        return m_2[i];
                    }
                }
                break;
            case 2:
                //   □ │ □
                //  ───┼───
                //   ■ │ □
                for (int i = 0; i < m_3.Count; ++i)
                {
                    if (m_NodeEmpty[m_3[i].index])
                    {
                        m_NodeEmpty[m_3[i].index] = false;
                        return m_3[i];
                    }
                }
                break;
            case 3:
                //   □ │ □
                //  ───┼───
                //   □ │ ■
                for (int i = 0; i < m_4.Count; ++i)
                {
                    if (m_NodeEmpty[m_4[i].index])
                    {
                        m_NodeEmpty[m_4[i].index] = false;
                        return m_4[i];
                    }
                }
                break;
        }
        return null;
    }
    public void Release(int id)
    {
    }
}
Fight/GameActor/HeroRoundGird.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: d5b7cc734faa41a4b9319fc8ad226cdd
timeCreated: 1551852723
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant: