优化ui,谱面替换,以及科研模糊
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -28,6 +28,14 @@ public class SongDataSerializable
|
||||
public List<IntIntEntry> idolRecordList = new List<IntIntEntry>();
|
||||
public List<IntIntEntry> chartScoreList = new List<IntIntEntry>();
|
||||
|
||||
[System.Serializable]
|
||||
public struct IntFloatEntry
|
||||
{
|
||||
public int key;
|
||||
public float value;
|
||||
}
|
||||
public List<IntFloatEntry> levelProgressList = new List<IntFloatEntry>();
|
||||
|
||||
public SongDataSerializable() { }
|
||||
|
||||
public SongDataSerializable(SongData source)
|
||||
@@ -48,6 +56,7 @@ public class SongDataSerializable
|
||||
this.personalRecordList = DictToList(source.personalRecordMap);
|
||||
this.idolRecordList = DictToList(source.idolRecordMap);
|
||||
this.chartScoreList = DictToList(source.chartScoreMap);
|
||||
this.levelProgressList = DictToListFloat(source.levelProgressMap);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -70,6 +79,7 @@ public class SongDataSerializable
|
||||
ListToDict(this.personalRecordList, target.personalRecordMap);
|
||||
ListToDict(this.idolRecordList, target.idolRecordMap);
|
||||
ListToDict(this.chartScoreList, target.chartScoreMap);
|
||||
ListToDictFloat(this.levelProgressList, target.levelProgressMap);
|
||||
}
|
||||
|
||||
private List<IntIntEntry> DictToList(Dictionary<int, int> dict)
|
||||
@@ -94,4 +104,27 @@ public class SongDataSerializable
|
||||
dict[entry.key] = entry.value;
|
||||
}
|
||||
}
|
||||
|
||||
private List<IntFloatEntry> DictToListFloat(Dictionary<int, float> dict)
|
||||
{
|
||||
List<IntFloatEntry> list = new List<IntFloatEntry>();
|
||||
if (dict != null)
|
||||
{
|
||||
foreach (var kvp in dict)
|
||||
{
|
||||
list.Add(new IntFloatEntry { key = kvp.Key, value = kvp.Value });
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private void ListToDictFloat(List<IntFloatEntry> list, Dictionary<int, float> dict)
|
||||
{
|
||||
if (list == null || dict == null) return;
|
||||
dict.Clear();
|
||||
foreach (var entry in list)
|
||||
{
|
||||
dict[entry.key] = entry.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user