Example #1
0
    public void OnClickMenu()
    {
        if (_DialougeController == null)
        {
            return;
        }
        _logicController.SwitchToGameMenuState();
        _DialougeController.gameObject.SetActive(true);
        var config = new ConfirmDialougeWidgetController.Config
        {
            Text      = Consts.RETURN_TO_MENU_TEXT,
            OnConfirm = () =>
            {
                _DialougeController.gameObject.SetActive(true);
                if (!_logicController.DidPlayerWin())
                {
                    GameDataManager.SaveCommands(ServiceManager.Get <CommandManager>().GetCommands(), ServiceManager.Get <CubesManager>().GetCurrentCubeSize());
                }
                GameEventsManager.BroadcastMessage(GameEventConstants.ON_RETURN_TO_MENU);
            },
            OnClose = () =>
            {
                _logicController.SwitchToPlayState();
            }
        };

        _DialougeController.Init(config);
    }
Example #2
0
    public void ShowWinMessage()
    {
        _DialougeController.gameObject.SetActive(true);
        var config = new ConfirmDialougeWidgetController.Config
        {
            Text      = string.Format(Consts.PLAYER_WON_TEXT, _TimerWidget.GetTime()),
            OnConfirm = () =>
            {
                _DialougeController.gameObject.SetActive(true);
                var cubeSize = ServiceManager.Get <CubesManager>().GetCurrentCubeSize();
                if (GameDataManager.CheckIfSaveDataExists(cubeSize))
                {
                    GameDataManager.DeleteCurrentSave(cubeSize);
                }
                GameEventsManager.BroadcastMessage(GameEventConstants.ON_RETURN_TO_MENU);
            },
            OnClose = () =>
            {
            }
        };

        _DialougeController.Init(config);
    }