public void PushPreWarm(Pre_Load_Light_Info lightinfo) { foreach (int effectID in lightinfo.effectIDList) { //目前只需要人物的光效缓存不需要去重,有多少个缓存多少.而其他的只需缓存一个即可 if (lightinfo.nLightType == ASpeedGame.Data.Scheme.LightType.ActorSkin) { if (NeedToCachingEffectTable.ContainsKey(effectID)) { NeedToCachingEffectTable[effectID]++; } else { NeedToCachingEffectTable.Add(effectID, 1); } } else { if (!NeedToCachingEffectTable.ContainsKey(effectID)) { NeedToCachingEffectTable.Add(effectID, 1); } } } }
/// <summary> /// 预加载光效 /// </summary> /// <param name="nMapID"></param> /// <param name="nType"></param> /// <param name="objs"></param> public static void LoadPreLights(int nMapID, ASpeedGame.Data.Scheme.LightType nType, System.Collections.Generic.IEnumerable <int> objs, CachePriority mask) { if (objs == null) { return; } List <Pre_Load_Light_Info> ls = new List <Pre_Load_Light_Info>(); foreach (int id in objs) { // 加载必须要加载的光效 ASpeedGame.Data.Scheme.ObjectLightNode light = ASpeedGame.Data.Scheme.SchemePreLoadLight.Instance.get(nMapID, nType, id); if (light == null) { continue; } Pre_Load_Light_Info info = new Pre_Load_Light_Info(); info.nLightType = nType; //光效类型 info.nMask |= (int)mask; //标志位 info.effectIDList = light.Collection; ls.Add(info); } if (ls.Count > 0) { LightingEffectFactory.Instance.RecvPreLoadLinghtEffectInfo(ls); } }
/// <summary> /// 预加载某一类光效 /// </summary> /// <param name="nMapID"></param> /// <param name="nType"></param> public static void LoadTypePreLight(int nMapID, ASpeedGame.Data.Scheme.LightType nType, CachePriority mask) { // 加载必须要加载的光效 ASpeedGame.Data.Scheme.TypeLightNode typeLight = ASpeedGame.Data.Scheme.SchemePreLoadLight.Instance.get(nMapID, nType); if (typeLight == null || typeLight.Collection == null || typeLight.Collection.Count == 0) { return; } List <Pre_Load_Light_Info> ls = new List <Pre_Load_Light_Info>(); foreach (var item in typeLight.Collection) { ASpeedGame.Data.Scheme.ObjectLightNode node = item.Value; Pre_Load_Light_Info info = new Pre_Load_Light_Info(); info.nLightType = nType; //光效类型 info.nMask |= (int)mask; //标志位 info.effectIDList = node.Collection; ls.Add(info); } LightingEffectFactory.Instance.RecvPreLoadLinghtEffectInfo(ls); }
private void PushPreWarmEffect(Pre_Load_Light_Info lightinfo) { foreach (int effectID in lightinfo.effectIDList) { if (lightinfo.nLightType == ASpeedGame.Data.Scheme.LightType.ActorSkin) { if (!allCacheID.Contains(effectID)) { allCacheID.Add(effectID); } } } if (bPreWarmLoadingSceneQueueEnabled) { //目前只需要人物的光效缓存不需要去重,有多少个缓存多少.而其他的只需缓存一个即可 if (lightinfo.nLightType == ASpeedGame.Data.Scheme.LightType.ActorSkin) { //是自己的光效,在第一优先级 if ((lightinfo.nMask & (int)CachePriority.PRIORITY_VERY_HIGH) != 0) { FirstPart.PushPreWarm(lightinfo); } else if ((lightinfo.nMask & (int)CachePriority.PRIORITY_HIGH) != 0)//友方第二优先级 { SecondPart.PushPreWarm(lightinfo); } else if ((lightinfo.nMask & (int)CachePriority.PRIORITY_MEDIUM) != 0)//敌人第三优先级 { ThridPart.PushPreWarm(lightinfo); } else //其他的全部在第四优先级 { FourPart.PushPreWarm(lightinfo); } } else { //不是人物的,全部丢到优先级4队列 FourPart.PushPreWarm(lightinfo); } } else { NormalPart.PushPreWarm(lightinfo); } }
/// <summary> /// 预加载光效 /// </summary> /// <param name="nMapID"></param> /// <param name="nType"></param> /// <param name="nObjID"></param> public static void LoadPreLight(int nMapID, ASpeedGame.Data.Scheme.LightType nType, int nObjID, CachePriority mask) { // 加载必须要加载的光效 ASpeedGame.Data.Scheme.ObjectLightNode light = ASpeedGame.Data.Scheme.SchemePreLoadLight.Instance.get(nMapID, nType, nObjID); if (light == null) { return; } Pre_Load_Light_Info info = new Pre_Load_Light_Info(); info.nLightType = nType; //光效类型 info.nMask |= (int)mask; //标志位 info.effectIDList = light.Collection; List <Pre_Load_Light_Info> ls = new List <Pre_Load_Light_Info>(); ls.Add(info); LightingEffectFactory.Instance.RecvPreLoadLinghtEffectInfo(ls); }