Ejemplo n.º 1
0
        /// <summary>
        /// 通过[技能ID]二分快速查表
        /// </summary>
        /// <param name="skillId">技能ID</param>
        /// <returns></returns>
        public static PreloadSkillResDataBase Query(this List <PreloadSkillResDataBase> sorted, uint skillId)
        {
            var key = new PreloadSkillResDataBase()
            {
                skillId = skillId
            };
            var comparer = new Comparer1();
            var index    = sorted.BinarySearch(key, comparer);

            return(index >= 0 ? sorted[index] : default(PreloadSkillResDataBase));
        }
Ejemplo n.º 2
0
        public void OnTimer(uint uTimerID)
        {
            if (uTimerID == m_uPreLoadTimeID)
            {
                if (m_preloadList.Count > 0)
                {
                    PreloadResDataBase pdb = m_preloadList[0];
                    if (pdb != null)
                    {
                        if (pdb.type == 1)//特效资源
                        {
                            Engine.RareEngine.Instance().PreloadEffectObj(pdb.path.ToLower(), (int)pdb.num);
                        }

                        if (pdb.type == 2) //obj资源
                        {
                            Engine.RareEngine.Instance().PreloadRenderObj(pdb.path.ToLower(), (int)pdb.num);
                        }
                    }
                    m_preloadList.RemoveAt(0);
                }

                if (m_preloadSkillList.Count > 0)
                {
                    PreloadSkillResDataBase db = m_preloadSkillList[0];
                    if (db != null)
                    {
                        string[] pathArr = db.pathArr.Split(';');
                        for (int j = 0; j < pathArr.Length; j++)
                        {
                            Engine.RareEngine.Instance().PreloadEffectObj(pathArr[j].ToLower(), 1);
                        }
                    }
                    m_preloadSkillList.RemoveAt(0);
                }

                if (m_preloadSkillList.Count == 0 && m_preloadList.Count == 0)
                {
                    Engine.Utility.TimerAxis.Instance().KillTimer(m_uPreLoadTimeID, this);
                }
            }
        }