/// <summary> /// 判断功能是否开放 /// </summary> /// <param name="module"></param> /// <param name="funtionId"></param> /// <returns>默认开放</returns> public static bool IsOpen(ModulePB module, FunctionIDPB funtionId) { int levelBottom = 0; int storyBottom = 0; List <FunctionEntryPB> list = _openDict[module]; foreach (var entryPb in list) { if (funtionId == entryPb.FunctionId) { levelBottom = entryPb.LevelBottom; storyBottom = entryPb.PlotBottom; break; } } if (levelBottom != 0) { int level = GlobalData.PlayerModel.PlayerVo.Level; return(level >= GetOpenUserLevel(module, funtionId)); } else if (storyBottom != 0) { LevelVo vo; if (GlobalData.LevelModel.LevelDict.TryGetValue(storyBottom, out vo)) { return(vo.IsPass); } } return(true); }
/// <summary> /// 获取功能开放描述 /// </summary> /// <param name="module"></param> /// <param name="funtionId"></param> /// <returns></returns> public static string GetOpenConditionDesc(ModulePB module, FunctionIDPB funtionId) { string desc = ""; List <FunctionEntryPB> list = _openDict[module]; foreach (var entryPb in list) { if (funtionId == entryPb.FunctionId) { if (entryPb.LevelBottom == 0 && entryPb.PlotBottom != 0) //关卡解锁 { desc = I18NManager.Get("Guide_PlotBottomDesc", entryPb.PlotBottom / 100, entryPb.PlotBottom % 100); } else if (entryPb.LevelBottom != 0 && entryPb.PlotBottom == 0) //等级解锁 { desc = I18NManager.Get("Guide_LevelBottomDesc", entryPb.LevelBottom); } else if (entryPb.LevelBottom != 0 && entryPb.PlotBottom != 0) //关卡和等级解锁 { desc = I18NManager.Get("Guide_LevelBottomAndPlotBottomDesc", entryPb.LevelBottom, entryPb.PlotBottom / 100, entryPb.PlotBottom % 100); } break; } } return(desc); }
public static int GetOpenUserLevel(ModulePB module, FunctionIDPB funtionId) { List <FunctionEntryPB> list = _openDict[module]; foreach (var entryPb in list) { if (funtionId == entryPb.FunctionId) { return(entryPb.LevelBottom); } } return(-1); }
public static string GetOpenMainStory(ModulePB module, FunctionIDPB funtionId) { List <FunctionEntryPB> list = _openDict[module]; int levelId = -1; foreach (var entryPb in list) { if (funtionId == entryPb.FunctionId) { levelId = entryPb.PlotBottom; break; } } LevelVo vo; if (GlobalData.LevelModel.LevelDict.TryGetValue(levelId, out vo)) { return(vo.LevelMark); } return(null); }