forked from stride3d/stride
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:ZyndaDeng/stride into master
- Loading branch information
Showing
3 changed files
with
307 additions
and
247 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
sources/engine/Stride.ClearScript/Components/BaseClearScript.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Stride.Audio; | ||
using Stride.Core; | ||
using Stride.Core.Serialization.Contents; | ||
using Stride.Engine; | ||
using Stride.Engine.Processors; | ||
using Stride.Games; | ||
using Stride.Graphics; | ||
using Stride.Input; | ||
using Stride.Profiling; | ||
using Stride.Rendering; | ||
using Stride.Rendering.Sprites; | ||
using Stride.Streaming; | ||
|
||
namespace Stride.ClearScript.Components | ||
{ | ||
public class BaseClearScript : SyncScript | ||
{ | ||
private dynamic scriptObj; | ||
|
||
[DataMemberIgnore] | ||
public IClearScriptSystem ScriptSystem { get; private set; } | ||
public override void Start() | ||
{ | ||
base.Start(); | ||
|
||
ScriptSystem = Services.GetSafeServiceAs<IClearScriptSystem>(); | ||
scriptObj = ScriptSystem.Evaluate("new TestScript()"); | ||
dynamic args = new | ||
{ | ||
Services = Services, | ||
graphicsDeviceService = Services.GetSafeServiceAs<IGraphicsDeviceService>(), | ||
Game = Services.GetSafeServiceAs<IGame>(), | ||
Content = (ContentManager)Services.GetSafeServiceAs<IContentManager>(), | ||
Input = Services.GetSafeServiceAs<InputManager>(), | ||
Script = Services.GetSafeServiceAs<ScriptSystem>(), | ||
SceneSystem = Services.GetSafeServiceAs<SceneSystem>(), | ||
EffectSystem = Services.GetSafeServiceAs<EffectSystem>(), | ||
Audio = Services.GetSafeServiceAs<AudioSystem>(), | ||
SpriteAnimation = Services.GetSafeServiceAs<SpriteAnimationSystem>(), | ||
GameProfiler = Services.GetSafeServiceAs<GameProfilingSystem>(), | ||
DebugText = Services.GetSafeServiceAs<DebugTextSystem>(), | ||
Streaming = Services.GetSafeServiceAs<StreamingManager>(), | ||
}; | ||
scriptObj.Entity = Entity; | ||
scriptObj.Initialize(args); | ||
scriptObj.Start(); | ||
} | ||
public override void Update() | ||
{ | ||
scriptObj?.Update(); | ||
} | ||
|
||
|
||
} | ||
} |
Oops, something went wrong.