Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small refactoring changes in Stride.GameStudio #1741

Merged
merged 5 commits into from Oct 11, 2023

Conversation

Jklawreszuk
Copy link
Collaborator

PR Details

This PR refactors Stride.GameStudio and replaces Xenko images with Stride images in CrashReport form.

Types of changes

  • refactoring / Bug fix

Checklist

  • My change requires a change to the documentation.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@Jklawreszuk Jklawreszuk force-pushed the game-studio branch 3 times, most recently from e04c785 to aae3303 Compare August 28, 2023 19:26
@Eideren
Copy link
Collaborator

Eideren commented Sep 17, 2023

Hey @Jklawreszuk is this PR alright, I'm seeing a big contradiction here

image

image

// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.
namespace Stride.GameStudio.Helpers
{
internal static class ApplicationInitializer
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, what's your reasoning here wrt extracting those functions out of program.cs ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My intention was to indicate that these methods are needed to initialize the app, so I created a separate class with Init() method creating facade behind all of this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, but you've just moved the entirety of the logic within Program to a different class. In other words, you renamed Program into ApplicationInitializer and made a new file called Program just for the Main() to call into it.

It'll be harder to follow the git history for that file, and doesn't seem like it provides a lot in exchange ?

I welcome new methods and such to clarify what's actually going on here, but moving everything to another file is hard to justify for me. If other contributors think this is a good idea, feel free to chime in.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Eideren Yeah, I guess you're rigth about that. I've reverted this change 👍

Comment on lines 1 to 32
using System;
using System.Globalization;
using Stride.Core.Assets.Editor;
using Stride.Core.Translation;
using Stride.Core.Translation.Providers;
using EditorSettings = Stride.Core.Assets.Editor.Settings.EditorSettings;
// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.
namespace Stride.GameStudio.Helpers
{
internal static class LanguageInitializer
{
public static void SetLanguage()
{
TranslationManager.Instance.RegisterProvider(new GettextTranslationProvider());
TranslationManager.Instance.CurrentLanguage = EditorSettings.Language.GetValue() switch
{
SupportedLanguage.MachineDefault => CultureInfo.InstalledUICulture,
SupportedLanguage.English => new CultureInfo("en-US"),
SupportedLanguage.French => new CultureInfo("fr-FR"),
SupportedLanguage.Japanese => new CultureInfo("ja-JP"),
SupportedLanguage.Russian => new CultureInfo("ru-RU"),
SupportedLanguage.German => new CultureInfo("de-DE"),
SupportedLanguage.Spanish => new CultureInfo("es-ES"),
SupportedLanguage.ChineseSimplified => new CultureInfo("zh-Hans"),
SupportedLanguage.Italian => new CultureInfo("it-IT"),
SupportedLanguage.Korean => new CultureInfo("ko-KR"),
_ => throw new ArgumentException("Invalid langauge option"),
};
}
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A whole file for just one function seems a bit much. I think multiple calls to this function may create side effects, I think it would fit better as a function local to the callsite, that way we don't have any implication that it does.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I've moved method to Program.cs again

@sandsalamand
Copy link

What's the status on this PR?

@Jklawreszuk
Copy link
Collaborator Author

Sorry, Honestly I am almost forgot about it, but I think now is ready :)

AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
EditorPath.EditorTitle = StrideGameStudio.EditorName;
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
EditorPath.EditorTitle = StrideGameStudio.EditorName;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that StrideGameStudio is in Stride.GameStudio.Helpers you have to include that namespace, same goes for StrideEditorPlugin and co. Right now the gamestudio can't build.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess should work now ✌️

@Eideren Eideren merged commit a1d4d1a into stride3d:master Oct 11, 2023
12 of 14 checks passed
@Eideren
Copy link
Collaborator

Eideren commented Oct 11, 2023

Thanks !

@Jklawreszuk Jklawreszuk deleted the game-studio branch October 11, 2023 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants