Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ UpdateFavoritesCache()

bool Terraria.GameContent.UI.States.UIWorldSelect.UpdateFavoritesCache ( )
inlineprivate

Definition at line 181 of file UIWorldSelect.cs.

182 {
183 List<WorldFileData> list = new List<WorldFileData>(Main.WorldList);
185 {
186 if (x.IsFavorite && !y.IsFavorite)
187 {
188 return -1;
189 }
190 if (!x.IsFavorite && y.IsFavorite)
191 {
192 return 1;
193 }
194 if (x.Name == null)
195 {
196 return 1;
197 }
198 return (x.Name.CompareTo(y.Name) != 0) ? x.Name.CompareTo(y.Name) : x.GetFileName().CompareTo(y.GetFileName());
199 });
200 bool flag = false;
201 if (!flag && list.Count != favoritesCache.Count)
202 {
203 flag = true;
204 }
205 if (!flag)
206 {
207 for (int i = 0; i < favoritesCache.Count; i++)
208 {
210 if (!(list[i].Name == tuple.Item1) || list[i].IsFavorite != tuple.Item2)
211 {
212 flag = true;
213 break;
214 }
215 }
216 }
217 if (flag)
218 {
220 foreach (WorldFileData item in list)
221 {
222 favoritesCache.Add(Tuple.Create(item.Name, item.IsFavorite));
223 }
225 }
226 return flag;
227 }
List< Tuple< string, bool > > favoritesCache
virtual int CompareTo(object obj)
Definition UIElement.cs:604

References System.Collections.Generic.List< T >.Add(), System.Collections.Generic.List< T >.Clear(), System.Collections.Generic.List< T >.Count, Terraria.GameContent.UI.States.UIWorldSelect.favoritesCache, Terraria.IO.FileData.GetFileName(), Terraria.IO.FileData.IsFavorite, System.item, System.list, System.Name, Terraria.IO.FileData.Name, Terraria.GameContent.UI.States.UIWorldSelect.UpdateWorldsList(), and Terraria.Main.WorldList.

Referenced by Terraria.GameContent.UI.States.UIWorldSelect.Draw().