-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: Stride Gamebuilder as an alternative for .NET IOC startup #2806
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
base: master
Are you sure you want to change the base?
Changes from all commits
75f1515
2372862
2f7f213
5e82aa1
7136214
aa3c9fe
257c458
e83810a
18397c5
2588b5f
f1f7b49
938a50c
c2de7f4
3b26a45
384dd48
ceaec04
8723abe
7590a43
6f02a8b
9f7bd52
848bd10
731610d
8c7eaea
415cd6f
08dc3ce
a51d8cf
1bcc2e5
c5d1c3d
1f8eba6
a315d2b
0ed0012
4718339
5d34b28
c252f6e
850659d
1432594
4e241b3
bdc76e1
0742e53
7bbfcea
4bbce68
8d64efd
4491da9
57a6118
57c0166
fa605db
a4da3df
9ea93a6
e6ac1c5
1628b23
4673500
f5b7d3c
52e78bf
cc1234a
a08ccec
f2ab0be
cf1ede1
1fc428e
b98d386
c9b912f
701d708
02c81e3
0fcec85
cfe5845
16e1996
e2a2774
9d39888
2cd09f2
4640016
f0756be
b30a7a0
da993ad
85c4fce
9315c0a
91869d4
33ab4ff
d8b3a70
6e04b89
a7c6325
9f356ff
fc3be41
4025681
51bb759
8c33853
c0e37e9
7509aa6
b09b949
2db7d4c
8088212
eec7b3a
4f1befe
53d2433
5c70930
bf03434
36a6c2a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -5,5 +5,5 @@ namespace Stride.Core.IO; | |||||
|
|
||||||
| public interface IDatabaseFileProviderService | ||||||
| { | ||||||
| DatabaseFileProvider FileProvider { get; } | ||||||
| } | ||||||
| DatabaseFileProvider FileProvider { get; set; } | ||||||
|
||||||
| DatabaseFileProvider FileProvider { get; set; } | |
| DatabaseFileProvider FileProvider { get; } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -25,6 +25,19 @@ public interface IContentManager | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// <returns>A stream to the raw asset.</returns> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Stream OpenAsStream(string url, StreamFlags streamFlags = StreamFlags.None); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// Saves an asset at a specific URL. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// <param name="url">The URL.</param> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// <param name="asset">The asset.</param> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// <param name="storageType">The custom storage type to use. Use null as default.</param> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// <exception cref="System.ArgumentNullException"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// url | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// asset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// </exception> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+29
to
+38
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// Saves an asset at a specific URL. | |
| /// </summary> | |
| /// <param name="url">The URL.</param> | |
| /// <param name="asset">The asset.</param> | |
| /// <param name="storageType">The custom storage type to use. Use null as default.</param> | |
| /// <exception cref="System.ArgumentNullException"> | |
| /// url | |
| /// or | |
| /// asset | |
| /// </exception> | |
| /// Saves an asset at a specific URL using the content manager's serializer. | |
| /// </summary> | |
| /// <param name="url"> | |
| /// The URL where the asset should be stored. Implementations typically interpret this as a virtual | |
| /// or logical path that is resolved to an underlying storage location. If an asset already exists | |
| /// at this URL, it is expected to be overwritten. | |
| /// </param> | |
| /// <param name="asset"> | |
| /// The asset instance to save. The object is serialized according to the content manager's | |
| /// configuration and the specified <paramref name="storageType"/> (if any). | |
| /// </param> | |
| /// <param name="storageType"> | |
| /// The custom storage type to use for serialization, or <c>null</c> to use the default storage type. | |
| /// Implementations may use this value to select a specific serializer, file format, or backing store. | |
| /// </param> | |
| /// <remarks> | |
| /// <para> | |
| /// This method performs a synchronous save operation and may involve disk or other I/O. Callers | |
| /// should avoid invoking it on performance-critical threads (such as the main game loop) if the | |
| /// underlying implementation performs blocking I/O. | |
| /// </para> | |
| /// <para> | |
| /// Unless otherwise documented by a specific implementation, the <see cref="IContentManager"/> | |
| /// interface does not guarantee thread-safety. If the same <see cref="IContentManager"/> instance | |
| /// is accessed from multiple threads, callers are responsible for providing appropriate | |
| /// synchronization when calling <see cref="Save(string, object, Type?)"/> concurrently with other | |
| /// operations. | |
| /// </para> | |
| /// </remarks> | |
| /// <exception cref="System.ArgumentNullException"> | |
| /// Thrown if <paramref name="url"/> or <paramref name="asset"/> is <c>null</c>. | |
| /// </exception> | |
| /// <exception cref="System.Exception"> | |
| /// Implementations may throw exceptions derived from <see cref="System.Exception"/> if saving fails, | |
| /// for example due to serialization errors, invalid URLs, insufficient permissions, or I/O errors. | |
| /// </exception> |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,29 +1,30 @@ | ||||||||||||||
| // Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp) | ||||||||||||||
| // 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. | ||||||||||||||
|
|
||||||||||||||
| using System; | ||||||||||||||
| using System.Collections.Generic; | ||||||||||||||
| using System.Linq; | ||||||||||||||
| using System.Reflection; | ||||||||||||||
| using Stride.Core; | ||||||||||||||
| using Stride.Core.Reflection; | ||||||||||||||
| using Stride.Core.Serialization; | ||||||||||||||
| using Stride.Core.Yaml; | ||||||||||||||
| using Stride.Core.Yaml.Events; | ||||||||||||||
| using Stride.Core.Yaml.Serialization; | ||||||||||||||
| using Stride.Debugger.Target; | ||||||||||||||
| using Stride.Engine; | ||||||||||||||
| using Stride.Games; | ||||||||||||||
|
|
||||||||||||||
| namespace Stride.Debugger | ||||||||||||||
| { | ||||||||||||||
| public static class LiveAssemblyReloader | ||||||||||||||
| { | ||||||||||||||
| public static void Reload(Game game, AssemblyContainer assemblyContainer, List<Assembly> assembliesToUnregister, List<Assembly> assembliesToRegister) | ||||||||||||||
| public static void Reload(GameBase game, AssemblyContainer assemblyContainer, List<Assembly> assembliesToUnregister, List<Assembly> assembliesToRegister) | ||||||||||||||
| { | ||||||||||||||
| List<Entity> entities = new List<Entity>(); | ||||||||||||||
|
|
||||||||||||||
| var sceneSystem = game.Services.GetSafeServiceAs<SceneSystem>(); | ||||||||||||||
|
|
||||||||||||||
| if (game != null) | ||||||||||||||
|
Comment on lines
+24
to
26
|
||||||||||||||
| var sceneSystem = game.Services.GetSafeServiceAs<SceneSystem>(); | |
| if (game != null) | |
| var sceneSystem = game?.Services.GetSafeServiceAs<SceneSystem>(); | |
| if (sceneSystem != null) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| // 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. | ||
|
|
||
| using Stride.Core.IO; | ||
| using Stride.Core.Serialization.Contents; | ||
| using Stride.Engine.Design; | ||
| using Stride.Games; | ||
| using Stride.Rendering; | ||
|
|
||
| namespace Stride.Engine.Builder; | ||
|
|
||
| public static class GameBaseExtensions | ||
| { | ||
| public static GameBase UseInitialSceneFromSettings(this GameBase game) | ||
| { | ||
| var content = game.Services.GetService<IContentManager>(); | ||
| var settings = content.Load<GameSettings>("GameSettings"); | ||
| var sceneSystem = game.Services.GetService<SceneSystem>(); | ||
| sceneSystem.InitialSceneUrl = settings.DefaultSceneUrl; | ||
| return game; | ||
| } | ||
|
|
||
| public static GameBase UseInitialGraphicsCompositorFromSettings(this GameBase game) | ||
| { | ||
| var content = game.Services.GetService<IContentManager>(); | ||
| var settings = content.Load<GameSettings>("GameSettings"); | ||
| var sceneSystem = game.Services.GetService<SceneSystem>(); | ||
| sceneSystem.InitialGraphicsCompositorUrl = settings.DefaultGraphicsCompositorUrl; | ||
|
|
||
| return game; | ||
| } | ||
|
|
||
| public static GameBase UseDefaultEffectCompiler(this GameBase game) | ||
| { | ||
| var fileProviderService = game.Services.GetService<IDatabaseFileProviderService>().FileProvider; | ||
| game.Services.GetService<EffectSystem>() | ||
| .CreateDefaultEffectCompiler(fileProviderService); | ||
|
|
||
| return game; | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.