Skip to content

Commit

Permalink
Update ASCreditsLogic.cs.
Browse files Browse the repository at this point in the history
  • Loading branch information
MustaphaTR committed Dec 9, 2024
1 parent e8313d7 commit 1ae226f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
6 changes: 2 additions & 4 deletions AUTHORS.AS
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Attacque Supérior is a third-party logic
extension based on OpenRA.
Attacque Supérior is a third-party logic extension based on OpenRA.

The plugin is maintained by
* Gyula Zimmermann (Graion Dilach)
Expand Down Expand Up @@ -104,7 +103,6 @@ The plugin is maintained by
* Apollo
> additional blending modes

The project owes thanks for OpenRA for it's modularity
which allows this project to exist in the first place.
The project owes thanks for OpenRA for it's modularity which allows this project to exist in the first place.
Also thanks for you, the user for using this project.
25 changes: 11 additions & 14 deletions OpenRA.Mods.AS/Widgets/Logic/ASCreditsLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
#endregion

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using OpenRA.Mods.Common.Widgets;
using OpenRA.Widgets;

Expand All @@ -29,9 +27,9 @@ public class ASCreditsLogic : ChromeLogic
readonly ScrollPanelWidget scrollPanel;
readonly LabelWidget template;

readonly IEnumerable<string> modLines;
readonly IEnumerable<string> engineLines;
readonly IEnumerable<string> asEngineLines;
readonly string modLines;
readonly string engineLines;
readonly string asEngineLines;
ASCreditsState tabState;

[ObjectCreator.UseCtor]
Expand Down Expand Up @@ -88,26 +86,25 @@ void ShowCredits(ASCreditsState credits)
tabState = credits;

scrollPanel.RemoveChildren();
var font = Game.Renderer.Fonts[template.Font];

IEnumerable<string> lines;
string lines;
if (credits == ASCreditsState.Engine)
lines = engineLines;
else if (credits == ASCreditsState.AS)
lines = asEngineLines;
else
lines = modLines;

foreach (var line in lines)
{
var label = template.Clone() as LabelWidget;
label.GetText = () => line;
scrollPanel.AddChild(label);
}
var label = (LabelWidget)template.Clone();
label.GetText = () => lines;
label.IncreaseHeightToFitCurrentText();
scrollPanel.AddChild(label);
}

static IEnumerable<string> ParseLines(Stream file)
static string ParseLines(Stream file)
{
return file.ReadAllLines().Select(l => l.Replace("\t", " ").Replace("*", "\u2022").Replace(">", "\u2023")).ToList();
return file.ReadAllText().Replace(Environment.NewLine, "\n").Replace("\t", " ").Replace("*", "\u2022");
}
}
}

0 comments on commit 1ae226f

Please sign in to comment.