Skip to content

Commit 7b88c65

Browse files
author
Awbugl
committed
Update 2.5.1
1 parent d439ac6 commit 7b88c65

File tree

4 files changed

+31
-17
lines changed

4 files changed

+31
-17
lines changed

CHANGELOG.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
- v2.5.1
2+
+ 修复了`v2.5.0`版本导致的性能问题
3+
4+
+ Fix the performance problem caused by `v2.5.0` version
5+
6+
7+
<details>
8+
<summary>点击展开日志 | Click to view all </summary>
9+
110
- v2.5.0 升格凝想 | Elevational Contemplations
211
+ 添加 `行星协调中心` :可为星球添加数种增益效果
312
+ 添加 `DSPMoreRecipes` mod 兼容补丁
@@ -12,9 +21,6 @@
1221
+ Fix the problem that the item is missing in the custom mecha UI
1322

1423

15-
<details>
16-
<summary>点击展开日志 | Click to view all </summary>
17-
1824
- v2.4.10
1925
+ 修复了火力发电站燃料需求不正确的问题
2026

src/Patches/Logic/PlanetBase/InternalFunctions.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System;
2-
using System.Collections.Concurrent;
1+
using System.Collections.Concurrent;
32
using System.Collections.Generic;
43
using System.IO;
54

@@ -46,11 +45,17 @@ internal static void Import(BinaryReader r)
4645
internal static void IntoOtherSave() => ReInitAll();
4746

4847
private static void ReInitAll() => _planetBases = new ConcurrentDictionary<int, int[]>();
49-
48+
5049
private static bool ContainsFocus(int planetId, int focusid)
5150
{
52-
if (!_planetBases.ContainsKey(planetId)) return false;
53-
return Array.Exists(_planetBases[planetId], i => i == focusid);
51+
if (_planetBases.TryGetValue(planetId, out var planetBase))
52+
// ReSharper disable once LoopCanBeConvertedToQuery
53+
foreach (var t in planetBase)
54+
{
55+
if (t == focusid) return true;
56+
}
57+
58+
return false;
5459
}
5560
}
5661
}

src/Patches/UI/UIPlanetBase/UIPlanetBaseWindow.cs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System;
2-
using CommonAPI.Systems;
1+
using CommonAPI.Systems;
32
using HarmonyLib;
43
using ProjectGenesis.Utils;
54
using UnityEngine;
@@ -115,7 +114,7 @@ private void OnIconBtnClick(int id)
115114
private void OnIconBtnRightClick(int id)
116115
{
117116
_currentFocusIds[id] = 0;
118-
SetPlanetFocus(CurPlanetId, id,0);
117+
SetPlanetFocus(CurPlanetId, id, 0);
119118
_iconImgs[id].sprite = _tagNotSelectedSprite;
120119
_iconTexts[id].text = "";
121120
}
@@ -126,14 +125,18 @@ private void OnPickReturn(ItemProto proto, int id)
126125

127126
var currentFocusId = proto.ID;
128127

129-
if (Array.Exists(_currentFocusIds, i => i == currentFocusId))
128+
// ReSharper disable once LoopCanBeConvertedToQuery
129+
foreach (var t in _currentFocusIds)
130130
{
131-
UIRealtimeTip.Popup("不能重复选择".TranslateFromJson());
132-
return;
131+
if (t == currentFocusId)
132+
{
133+
UIRealtimeTip.Popup("不能重复选择".TranslateFromJson());
134+
return;
135+
}
133136
}
134-
137+
135138
_currentFocusIds[id] = currentFocusId;
136-
SetPlanetFocus(CurPlanetId, id,currentFocusId);
139+
SetPlanetFocus(CurPlanetId, id, currentFocusId);
137140
_iconTexts[id].text = FilterIds[currentFocusId].TranslateFromJson();
138141
var sprite = proto.iconSprite;
139142
if (sprite != null) _iconImgs[id].sprite = sprite;

src/ProjectGenesis.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class ProjectGenesis : BaseUnityPlugin, IModCanSave, IMultiplayerModWithS
4444
{
4545
public const string MODGUID = "org.LoShin.GenesisBook";
4646
public const string MODNAME = "GenesisBook";
47-
public const string VERSION = "2.5.0";
47+
public const string VERSION = "2.5.1";
4848

4949
public string Version => VERSION;
5050

0 commit comments

Comments
 (0)