Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    ScriptSystem Class

    Namespace: Stride.Engine.Processors
    Assembly: Stride.Engine.dll

    The script system handles scripts scheduling in a game.

    System.Object → DisposeBase → ComponentBase → GameSystemBase → ScriptSystem
    Derived from ScriptSystem:

    public sealed class ScriptSystem : GameSystemBase, IDisposable, ICollectorHolder, IGameSystemBase, IComponent, IReferencable, IUpdateable, IDrawable, IContentable
    Name Description
    Constructors
    ScriptSystem(IServiceRegistry)

    Initializes a new instance of the GameSystemBase class.

    Properties
    Scheduler

    Gets the scheduler.

    Methods
    Add(ScriptComponent)

    Add the provided script to the script system.

    AddTask(Func<Task>, Int64)

    Adds the specified micro thread function.

    Destroy()
    LiveReload(ScriptComponent, ScriptComponent)

    Called by a live scripting debugger to notify the ScriptSystem about reloaded scripts.

    NextFrame()

    Allows to wait for next frame.

    Remove(ScriptComponent)

    Remove the provided script from the script system.

    Update(GameTime)
    WhenAll(MicroThread[])

    Waits all micro thread finished their task completion.

    | Improve this Doc View Source

    Constructors


    ScriptSystem(IServiceRegistry)

    Initializes a new instance of the GameSystemBase class.

    public ScriptSystem(IServiceRegistry registry)
    Parameters
    Type Name Description
    IServiceRegistry registry

    The registry.

    Remarks

    The GameSystem is expecting the following services to be registered: IGame and ContentManager.

    | Improve this Doc View Source

    Properties


    Scheduler

    Gets the scheduler.

    public Scheduler Scheduler { get; }
    Property Value
    Type Description
    Scheduler

    The scheduler.

    | Improve this Doc View Source

    Methods


    Add(ScriptComponent)

    Add the provided script to the script system.

    public void Add(ScriptComponent script)
    Parameters
    Type Name Description
    ScriptComponent script

    The script to add


    AddTask(Func<Task>, Int64)

    Adds the specified micro thread function.

    public MicroThread AddTask(Func<Task> microThreadFunction, long priority = 0L)
    Parameters
    Type Name Description
    System.Func<System.Threading.Tasks.Task> microThreadFunction

    The micro thread function.

    System.Int64 priority
    Returns
    Type Description
    MicroThread

    MicroThread.


    Destroy()

    protected override void Destroy()
    Overrides
    ComponentBase.Destroy()

    LiveReload(ScriptComponent, ScriptComponent)

    Called by a live scripting debugger to notify the ScriptSystem about reloaded scripts.

    public void LiveReload(ScriptComponent oldScript, ScriptComponent newScript)
    Parameters
    Type Name Description
    ScriptComponent oldScript

    The old script

    ScriptComponent newScript

    The new script


    NextFrame()

    Allows to wait for next frame.

    public ChannelMicroThreadAwaiter<int> NextFrame()
    Returns
    Type Description
    ChannelMicroThreadAwaiter<System.Int32>

    ChannelMicroThreadAwaiter<System.Int32>.


    Remove(ScriptComponent)

    Remove the provided script from the script system.

    public void Remove(ScriptComponent script)
    Parameters
    Type Name Description
    ScriptComponent script

    The script to remove


    Update(GameTime)

    public override void Update(GameTime gameTime)
    Parameters
    Type Name Description
    GameTime gameTime
    Overrides
    GameSystemBase.Update(GameTime)

    WhenAll(MicroThread[])

    Waits all micro thread finished their task completion.

    public async Task WhenAll(params MicroThread[] microThreads)
    Parameters
    Type Name Description
    MicroThread[] microThreads

    The micro threads.

    Returns
    Type Description
    System.Threading.Tasks.Task

    Task.


    Inherited Members

    GameSystemBase.Game
    GameSystemBase.Services
    GameSystemBase.Content
    GameSystemBase.GraphicsDevice
    GameSystemBase.DrawOrderChanged
    GameSystemBase.VisibleChanged
    GameSystemBase.BeginDraw()
    GameSystemBase.Draw(GameTime)
    GameSystemBase.EndDraw()
    GameSystemBase.Visible
    GameSystemBase.DrawOrder
    GameSystemBase.Initialize()
    GameSystemBase.InitGraphicsDeviceService()
    GameSystemBase.EnabledChanged
    GameSystemBase.UpdateOrderChanged
    GameSystemBase.Enabled
    GameSystemBase.UpdateOrder
    GameSystemBase.OnDrawOrderChanged(Object, EventArgs)
    GameSystemBase.OnUpdateOrderChanged(Object, EventArgs)
    GameSystemBase.IContentable.LoadContent()
    GameSystemBase.IContentable.UnloadContent()
    GameSystemBase.LoadContent()
    GameSystemBase.UnloadContent()
    ComponentBase.Tags
    ComponentBase.Name
    ComponentBase.ICollectorHolder.Collector
    ComponentBase.OnNameChanged()
    ComponentBase.ToString()
    DisposeBase.Dispose()
    DisposeBase.IsDisposed
    DisposeBase.IReferencable.ReferenceCount
    DisposeBase.IReferencable.AddReference()
    DisposeBase.IReferencable.Release()
    DisposeBase.OnAddReference()
    DisposeBase.OnReleaseReference()

    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation