예제 #1
0
    // FIXME 技能. 预计SkillVO这里做一个池子. 消除GC
    //static PlayerSkillVO s_SkillVOTemplate;
    static public PlayerSkillVO CreateSkillVO(int skillID)
    {
        CfgSkillSystemProxy cfgSkillProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgSkillSystemProxy) as CfgSkillSystemProxy;

        SkillSystemGrow skillGrow = cfgSkillProxy.GetSkillGrow(skillID);

        if (skillGrow.ByteBuffer == null)
        {
            Debug.LogErrorFormat("找不到SkillGrow. SkillID: {0}", skillID);
            return(null);
        }

        SkillSystemPath skillPath = cfgSkillProxy.GetSkillPath(skillGrow.PathID);

        if (skillPath.ByteBuffer == null)
        {
            Debug.LogErrorFormat("找不到SkillPath. PathID: {0}", skillGrow.PathID);
            return(null);
        }

        List <SkillSystemFx> skillFxList = cfgSkillProxy.GetSkillFxList(skillGrow.PathID);

        for (int iEffect = 0; iEffect < skillFxList.Count; iEffect++)
        {
            if (skillFxList[iEffect].ByteBuffer == null)
            {
                Debug.LogErrorFormat("找不到skillFxList. PathID: {0}", skillGrow.PathID);
                return(null);
            }
        }

        List <SkillSystemEffect> skillEffectList = cfgSkillProxy.GetSkillEffectList(skillID);

        for (int iEffect = 0; iEffect < skillFxList.Count; iEffect++)
        {
            if (skillEffectList[iEffect].ByteBuffer == null)
            {
                Debug.LogErrorFormat("找不到skillEffectList. skillID: {0}", skillID);
                return(null);
            }
        }

        return(new PlayerSkillVO(skillID));
    }
예제 #2
0
    private PlayerSkillVO(int id)
    {
        m_CfgSkillProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgSkillSystemProxy) as CfgSkillSystemProxy;

        m_TemplateID = id;
        skillGrow    = m_CfgSkillProxy.GetSkillGrow(m_TemplateID);
        if (skillGrow.ByteBuffer != null)
        {
            m_SkillPath        = m_CfgSkillProxy.GetSkillPath(skillGrow.PathID);
            m_SkillFxList      = m_CfgSkillProxy.GetSkillFxList(skillGrow.PathID);
            m_SkillEffectList  = m_CfgSkillProxy.GetSkillEffectList(m_TemplateID);
            m_CDEndTime        = Time.time;
            m_TriggerCDEndTime = Time.time;

            m_IsValid = true;
        }
        else
        {
            m_IsValid = false;
            Debug.LogErrorFormat("技能不存在, 请查Skill_system_grow表. ID: {0}", id);
        }
    }
예제 #3
0
    /// <summary>
    /// 预加载玩家飞船的所有技能的资源
    /// </summary>
    private void PreloadSkill()
    {
        // 读取当前Entity的飞船的所有技能
        List <int> shipSkillIDList = new List <int>();

        // TODO 技能. 现在技能使用物品的方式存储. 自己的技能由服务器通知. 服务器不会告知其他玩家的技能
        if (m_Property.IsMain())
        {
            PlayerSkillVO[] skills = m_SkillProxy.GetSkills();
            for (int iSkill = 0; iSkill < skills.Length; iSkill++)
            {
                shipSkillIDList.Add(skills[iSkill].GetID());
            }
        }
        else if (m_Property.GetNPCTemplateVO().ByteBuffer != null)
        {
        }

        // 预加载技能所需资源
        for (int iSkill = 0; iSkill < shipSkillIDList.Count; ++iSkill)
        {
            SkillSystemGrow skillGrow = m_CfgSkillProxy.GetSkillGrow(shipSkillIDList[iSkill]);
            if (skillGrow.ByteBuffer == null)
            {
                continue;
            }

            SkillSystemPath skillPath = m_CfgSkillProxy.GetSkillPath(skillGrow.PathID);
            if (skillPath.ByteBuffer == null)
            {
                continue;
            }

            for (int iFx = 0; iFx < skillPath.FxIdLength; iFx++)
            {
                SkillSystemFx skillFx = m_CfgSkillProxy.GetSkillFx(skillPath.GetFxIdArray()[iFx]);
                // 加载技能特效资源
                if (!string.IsNullOrEmpty(skillFx.CastFxBegin) && !"None".Equals(skillFx.CastFxBegin))
                {
                    LoadAssetAsync(skillFx.CastFxBegin);
                }
                if (!string.IsNullOrEmpty(skillFx.CastFxLoop) && !"None".Equals(skillFx.CastFxLoop))
                {
                    LoadAssetAsync(skillFx.CastFxLoop);
                }
                if (!string.IsNullOrEmpty(skillFx.CastFxEnd) && !"None".Equals(skillFx.CastFxEnd))
                {
                    LoadAssetAsync(skillFx.CastFxEnd);
                }
                if (!string.IsNullOrEmpty(skillFx.LauncherFx) && !"None".Equals(skillFx.LauncherFx))
                {
                    LoadAssetAsync(skillFx.LauncherFx);
                }
                if (!string.IsNullOrEmpty(skillFx.AssetName) && !"None".Equals(skillFx.AssetName))
                {
                    LoadAssetAsync(skillFx.AssetName);
                }
                if (!string.IsNullOrEmpty(skillFx.HitFx) && !"None".Equals(skillFx.HitFx))
                {
                    LoadAssetAsync(skillFx.HitFx);
                }

                // UNDONE 技能, 音效
                // 加载音频资源
                //AudioProxy audioProxy = DataManager.GetProxy<AudioProxy>();
                //if (skillFx.BeforeAudio > 0)
                //{
                //	AudioVO audioVO = audioProxy.GetAudioByKey(skillFx.BeforeAudio);
                //	if (audioVO.ByteBuffer != null && !"None".Equals(audioVO.AssetBundle) && !"None".Equals(audioVO.AssetName))
                //		AssetManager.LoadAsset<GameObject>(audioVO.AssetName, PreloadCallback);
                //}
                //if (skillFx.LauncherAudio > 0)
                //{
                //	AudioVO audioVO = audioProxy.GetAudioByKey(skillFx.LauncherAudio);
                //	if (audioVO.ByteBuffer != null && !"None".Equals(audioVO.AssetBundle) && !"None".Equals(audioVO.AssetName))
                //		AssetManager.LoadAsset<GameObject>(audioVO.AssetName, PreloadCallback);
                //}
                //if (skillFx.HitAudio > 0)
                //{
                //	AudioVO audioVO = audioProxy.GetAudioByKey(skillFx.HitAudio);
                //	if (audioVO.ByteBuffer != null && !"None".Equals(audioVO.AssetBundle) && !"None".Equals(audioVO.AssetName))
                //		AssetManager.LoadAsset<GameObject>(audioVO.AssetName, PreloadCallback);
                //}
                //if (skillFx.SkillAudio > 0)
                //{
                //	AudioVO audioVO = audioProxy.GetAudioByKey(skillFx.SkillAudio);
                //	if (audioVO.ByteBuffer != null && !"None".Equals(audioVO.AssetBundle) && !"None".Equals(audioVO.AssetName))
                //		AssetManager.LoadAsset<GameObject>(audioVO.AssetName, PreloadCallback);
                //}
            }
        }
    }