Skip to content

Commit

Permalink
Update 2.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Awbugl committed Jan 26, 2023
1 parent d439ac6 commit 7b88c65
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 17 deletions.
12 changes: 9 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
- v2.5.1
+ 修复了`v2.5.0`版本导致的性能问题

+ Fix the performance problem caused by `v2.5.0` version


<details>
<summary>点击展开日志 | Click to view all </summary>

- v2.5.0 升格凝想 | Elevational Contemplations
+ 添加 `行星协调中心` :可为星球添加数种增益效果
+ 添加 `DSPMoreRecipes` mod 兼容补丁
Expand All @@ -12,9 +21,6 @@
+ Fix the problem that the item is missing in the custom mecha UI


<details>
<summary>点击展开日志 | Click to view all </summary>

- v2.4.10
+ 修复了火力发电站燃料需求不正确的问题

Expand Down
15 changes: 10 additions & 5 deletions src/Patches/Logic/PlanetBase/InternalFunctions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;

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

private static void ReInitAll() => _planetBases = new ConcurrentDictionary<int, int[]>();

private static bool ContainsFocus(int planetId, int focusid)
{
if (!_planetBases.ContainsKey(planetId)) return false;
return Array.Exists(_planetBases[planetId], i => i == focusid);
if (_planetBases.TryGetValue(planetId, out var planetBase))
// ReSharper disable once LoopCanBeConvertedToQuery
foreach (var t in planetBase)
{
if (t == focusid) return true;
}

return false;
}
}
}
19 changes: 11 additions & 8 deletions src/Patches/UI/UIPlanetBase/UIPlanetBaseWindow.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using CommonAPI.Systems;
using CommonAPI.Systems;
using HarmonyLib;
using ProjectGenesis.Utils;
using UnityEngine;
Expand Down Expand Up @@ -115,7 +114,7 @@ private void OnIconBtnClick(int id)
private void OnIconBtnRightClick(int id)
{
_currentFocusIds[id] = 0;
SetPlanetFocus(CurPlanetId, id,0);
SetPlanetFocus(CurPlanetId, id, 0);
_iconImgs[id].sprite = _tagNotSelectedSprite;
_iconTexts[id].text = "";
}
Expand All @@ -126,14 +125,18 @@ private void OnPickReturn(ItemProto proto, int id)

var currentFocusId = proto.ID;

if (Array.Exists(_currentFocusIds, i => i == currentFocusId))
// ReSharper disable once LoopCanBeConvertedToQuery
foreach (var t in _currentFocusIds)
{
UIRealtimeTip.Popup("不能重复选择".TranslateFromJson());
return;
if (t == currentFocusId)
{
UIRealtimeTip.Popup("不能重复选择".TranslateFromJson());
return;
}
}

_currentFocusIds[id] = currentFocusId;
SetPlanetFocus(CurPlanetId, id,currentFocusId);
SetPlanetFocus(CurPlanetId, id, currentFocusId);
_iconTexts[id].text = FilterIds[currentFocusId].TranslateFromJson();
var sprite = proto.iconSprite;
if (sprite != null) _iconImgs[id].sprite = sprite;
Expand Down
2 changes: 1 addition & 1 deletion src/ProjectGenesis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class ProjectGenesis : BaseUnityPlugin, IModCanSave, IMultiplayerModWithS
{
public const string MODGUID = "org.LoShin.GenesisBook";
public const string MODNAME = "GenesisBook";
public const string VERSION = "2.5.0";
public const string VERSION = "2.5.1";

public string Version => VERSION;

Expand Down

0 comments on commit 7b88c65

Please sign in to comment.