Ejemplo n.º 1
0
    public override void Exec(IResultControl control)
    {
        BuffTable buffTable = GameTable.BuffTableAsset;
        BuffInfo  buffData  = buffTable.Lookup(m_buffID);

        if (null == buffData)
        {
            return;
        }
        //Buff buff = new Buff(m_buffID);
    }
Ejemplo n.º 2
0
    static public byte[] Save()
    {
        m_hadResourceList.Clear();

        BinaryHelper helper = new BinaryHelper();

        TextAsset     asset         = GameData.LoadConfig <TextAsset>("HeroInfoTable");
        HeroInfoTable heroInfoTable = new HeroInfoTable();

        heroInfoTable.Load(asset.bytes);

        Debug.Log("扫描资源信息条为:" + (heroInfoTable.m_list.Count + m_npcInfoTable.m_list.Count));
        // 信息数量
        helper.Write(heroInfoTable.m_list.Count + m_npcInfoTable.m_list.Count);

        // HERO
        foreach (KeyValuePair <int, HeroInfo> item in heroInfoTable.m_list)
        {
            m_resourceList.Clear();

            ModelInfo modelInfo = m_modelInfoTable.Lookup(item.Value.ModelId);
            if (null == modelInfo)
            {
                helper.Write(0);
                continue;
            }

            GameObject preObj = GameData.LoadPrefab <GameObject>(modelInfo.ModelFile);

            if (null == preObj)
            {
                helper.Write(0);
                continue;
            }
            Animation AniList = preObj.GetComponent <Animation>();

            if (string.IsNullOrEmpty(modelInfo.ModelFile))
            {
                helper.Write(0);
                continue;
            }

            if (m_hadResourceList.Contains(modelInfo.ModelFile))
            {
                helper.Write(0);
                continue;
            }

            // 模型预设名称
            m_resourceList.Add(modelInfo.ModelFile, (int)Type.enPrefab);
            m_hadResourceList.Add(modelInfo.ModelFile);
            Debug.Log("modelInfo.ModelFile:" + modelInfo.ModelFile);

            foreach (AnimationState state in AniList)
            {
                AnimationClip clip = AniList.GetClip(state.name);
                if (null == clip)
                {
                    continue;
                }

                // 动画列表
                AnimationEvent[] events = AnimationUtility.GetAnimationEvents(clip);

                foreach (AnimationEvent data in events)
                {
                    if (data.functionName == "ChangeResultID" || data.functionName == "ChangeInstantResultID")
                    {
                        LoadEffect(data.intParameter);
                    }
                    else if (data.functionName == "RemoteAttack")
                    {
                        LoadRemoteObj(data.intParameter);
                    }
                }
            }

            Debug.Log("m_resourceList.Count:" + m_resourceList.Count);

            helper.Write(m_resourceList.Count);

            foreach (KeyValuePair <string, int> resourceListItem in m_resourceList)
            {
                helper.Write(resourceListItem.Value);
                helper.Write(resourceListItem.Key);
                //Debug.Log("resourceListItem:" + resourceListItem);
            }
        }

        // NPC
        foreach (KeyValuePair <int, NPCInfo> item in m_npcInfoTable.m_list)
        {
            m_resourceList.Clear();

            ModelInfo modelInfo = m_modelInfoTable.Lookup(item.Value.ModelId);
            if (null == modelInfo)
            {
                helper.Write(0);
                continue;
            }

            GameObject preObj = GameData.LoadPrefab <GameObject>(modelInfo.ModelFile);

            if (null == preObj)
            {
                helper.Write(0);
                continue;
            }
            Animation AniList = preObj.GetComponent <Animation>();

            if (string.IsNullOrEmpty(modelInfo.ModelFile))
            {
                helper.Write(0);
                continue;
            }

            if (m_hadResourceList.Contains(modelInfo.ModelFile))
            {
                helper.Write(0);
                continue;
            }

            // 模型预设名称
            m_resourceList.Add(modelInfo.ModelFile, (int)Type.enPrefab);
            m_hadResourceList.Add(modelInfo.ModelFile);
            Debug.Log("NPC modelInfo.ModelFile:" + modelInfo.ModelFile);

            foreach (float buffId in item.Value.GiftBuffIDList)
            {
                BuffInfo buffInfo = m_buffTable.Lookup((int)buffId);

                if (null == buffInfo)
                {
                    continue;
                }

                BuffEffectInfo buffEffectInfo = m_buffEffectTable.Lookup(buffInfo.BuffEffectID);
                if (null == buffEffectInfo)
                {
                    continue;
                }

                if (string.IsNullOrEmpty(buffEffectInfo.EffectName))
                {
                    continue;
                }

                if (!m_hadResourceList.Contains(buffEffectInfo.EffectName))
                {
                    m_resourceList.Add(buffEffectInfo.EffectName, (int)Type.enEffect);
                    m_hadResourceList.Add(buffEffectInfo.EffectName);
                    Debug.Log("NPC m_resourceList 添加  " + buffEffectInfo.EffectName);
                }
            }

            foreach (AnimationState state in AniList)
            {
                AnimationClip clip = AniList.GetClip(state.name);
                if (null == clip)
                {
                    continue;
                }

                // 动画列表
                AnimationEvent[] events = AnimationUtility.GetAnimationEvents(clip);

                foreach (AnimationEvent data in events)
                {
                    if (data.functionName == "ChangeResultID" || data.functionName == "ChangeInstantResultID")
                    {
                        LoadEffect(data.intParameter);
                    }
                    else if (data.functionName == "RemoteAttack")
                    {
                        LoadRemoteObj(data.intParameter);
                    }
                }
            }

            Debug.Log(" NPC m_resourceList.Count:" + m_resourceList.Count);

            helper.Write(m_resourceList.Count);

            foreach (KeyValuePair <string, int> resourceListItem in m_resourceList)
            {
                helper.Write(resourceListItem.Value);
                helper.Write(resourceListItem.Key);
                //Debug.Log("resourceListItem:" + resourceListItem);
            }
        }


        return(helper.GetBytes());
    }