/// <summary> /// 创建一个排行榜 /// </summary> /// <param name="name">排行榜名字</param> /// <param name="value">排行榜的内容</param> /// <typeparam name="T">排行榜的类型</typeparam> public void CreateRank <T>(string rankname) { if (typeof(T) != typeof(int) && typeof(T) != typeof(float)) { Debug.LogWarning("排行榜只支持Int 和 float 两种数据类型!"); return; } if (RootData.Exist(rankname)) { Debug.LogWarning("当前排行榜已经存在!"); return; } L_RankData rankData = RootData.CreatChildData(rankname, typeof(T).ToString()); }
/// <summary> /// 加载排行榜(覆盖当前排行榜) /// </summary> /// <param name="rankname">Rankname.</param> /// <typeparam name="T">The 1st type parameter.</typeparam> public void LoadRank(string rankname) { // 覆盖 L_RankData rankData = RootData.FindChild(rankname); if (rankData == null) { rankData = RootData.CreatChildData(rankname, "none"); } else { rankData.ClearChildren(); } XmlTool.LoadDataWihtPath <L_RankData>(ref rankData, FilePath + rankname); }