Beispiel #1
0
        protected override void OnButtonClick()
        {
            if (string.IsNullOrEmpty(startScriptName))
            {
                Debug.LogError("Can't start new game: please specify start script name in the settings.");
                return;
            }

            titleMenu.Hide();
            StartNewGameAsync();
        }
        protected override void Awake()
        {
            base.Awake();

            startScriptName = Engine.GetService <IScriptManager>().StartGameScriptName;
            titleMenu       = GetComponentInParent <TitleMenu>();
            player          = Engine.GetService <IScriptPlayer>();
            stateManager    = Engine.GetService <IStateManager>();
            Debug.Assert(titleMenu && player != null);

            titleMenu.Hide();
            StartNewGameAsync();
        }
Beispiel #3
0
        protected override async void OnButtonClick()
        {
            if (string.IsNullOrEmpty(startScriptName))
            {
                Debug.LogError("Can't start new game: specify start script name in the settings.");
                return;
            }

            if (!string.IsNullOrEmpty(titleScriptName) &&
                await scriptManager.LoadScriptAsync(titleScriptName) is Script titleScript &&
                titleScript.LabelExists(titleLabel))
            {
                await scriptPlayer.PreloadAndPlayAsync(titleScriptName, label : titleLabel);

                await UniTask.WaitWhile(() => scriptPlayer.Playing);
            }

            titleMenu.Hide();
            StartNewGameAsync();
        }