/// <summary> /// 获取建筑数据 /// </summary> /// <param name="Type">建筑类型</param> /// <param name="Level">建筑等级</param> /// <param name="Quality">建筑品质</param> /// <param name="Star">建筑星级</param> /// <returns>建筑数据,null 获取失败</returns> private static BuildInfo GetBuildInfo(int Type, int Level, int Quality, int Star) { //获取基础建筑信息 s_building_typeInfo BaseInfo = GetBuildType(Type); if (BaseInfo == null) { NGUIUtil.DebugLog("获取不到该类型的建筑数据:" + Type); return(null); } BuildInfo Info = new BuildInfo(); Info.BuildType = Type; Info.Level = Level; Info.Quality = Quality; Info.StarLevel = Star; FillBaseBuildInfo(BaseInfo, ref Info); //获取建筑掉落资源 s_buildresourceInfo sreinfo = GetBuildSource(Type, Level); if (sreinfo != null) { FillSourceDrop(sreinfo, ref Info); } //计算升级,升星,升阶 数据。 CalcBuildInfo(BaseInfo, ref Info); //返回结果 return(Info); }
/// <summary> /// 获取建筑数据 /// </summary> /// <param name="Type">建筑类型</param> /// <param name="Level">建筑等级</param> /// <param name="Quality">建筑品质</param> /// <param name="Star">建筑星级</param> /// <returns>建筑数据,null 获取失败</returns> public static void UpdateBuildInfo(ref BuildInfo Info) { if (Info == null) { return; } //获取基础建筑信息 s_building_typeInfo BaseInfo = GetBuildType(Info.BuildType); if (BaseInfo == null) { NGUIUtil.DebugLog("获取不到该类型的建筑数据:" + Info.BuildType); return; } FillBaseBuildInfo(BaseInfo, ref Info); //获取建筑掉落资源 s_buildresourceInfo sreinfo = GetBuildSource(Info.BuildType, Info.Level); if (sreinfo != null) { FillSourceDrop(sreinfo, ref Info); } //计算升级,升星,升阶 数据。 CalcBuildInfo(BaseInfo, ref Info); }
/// <summary> /// 填充基础建筑掉落资源 /// </summary> private static void FillSourceDrop(s_buildresourceInfo sreinfo, ref BuildInfo Info) { if (sreinfo == null || Info == null) { return; } Info.m_wood = sreinfo.wood; Info.m_stone = sreinfo.stone; Info.m_steel = sreinfo.steel; }