MBInitialScreenBase

出自 骑砍中文百科
前往: 導覽搜尋

訪問源文檔
訪問目錄

你可以通過繼承 MBInitialScreenBase 創建一個自定義主界面,並且在你的類里應用 GameStateScreen 屬性。
以下是一個你的類繼承後應該有的框架:

[GameStateScreen(typeof(InitialState))]
public class MyInitialScreen : MBInitialScreenBase
{
    private GauntletLayer _gauntletLayer;
    private InitialMenuVM _dataSource;

    public MBInitialScreen(InitialState initialState) : base(initialState) { }

    protected override void OnInitialize()
    {
        base.OnInitialize();
        this._dataSource = new InitialMenuVM();
        this._gauntletLayer = new GauntletLayer(1, "GauntletLayer");
        this._gauntletLayer.LoadMovie("InitialScreen", this._dataSource);
        this._gauntletLayer.InputRestrictions.SetInputRestrictions(true, InputUsageMask.Mouse);
        base.AddLayer(this._gauntletLayer);
        GameNotificationManager.Current?.LoadMovie(false);
        ChatLog.Current?.LoadMovie(false);
        InformationManager.ClearAllMessages();
    }
}

替換 InitialScreen 字符串為你的 Movies XML文件名。