Exemplo n.º 1
0
    protected void OnSaveButtonPressed()
    {
        DialogBuilder builder = m_dialogBuilderFactory.Create();

        // if save is successful
        if (m_state.OnSave(m_inputNameField.text))
        {
            builder.SetTitle("Save successful!")
            .SetMessage("Would you like to keep editing this track or start a new one?\n" +
                        "Or you can race it immediately!")
            .SetIcon(DialogBuilder.Icon.STAR)
            .AddButton("Keep Editing", m_state.OnCancel)
            .AddButton("New Track", m_state.OnNewTrack)
            .AddButton("Race!", m_state.OnDone);
        }
        else
        {
            builder.SetTitle("Save unsuccessful!")
            .SetMessage("Please check the storage of your device or contact the developer.")
            .SetIcon(DialogBuilder.Icon.WARNING)
            .AddButton("Back")
            .AddButton("Try Again", () => m_state.OnSave(m_inputNameField.text));
        }

        builder.Build();
    }
Exemplo n.º 2
0
 public void OnRaceButtonPressed()
 {
     m_dialogBuilderFactory.Create()
     .SetTitle("Ready to race?")
     .SetMessage("Are you ready to start the race?")
     .SetIcon(DialogBuilder.Icon.QUESTION)
     .AddButton("Cancel")
     .AddButton("Yes", m_state.OnRace)
     .Build();
 }
Exemplo n.º 3
0
 private void OnEditCopyButtonPressed()
 {
     m_dialogBuilderFactory.Create()
     .SetTitle("Create a copy and edit?")
     .SetIcon(DialogBuilder.Icon.QUESTION)
     .SetMessage("Would you like to create a copy of this track and edit it?")
     .AddButton("Yes", () => m_state.EditCopy())
     .AddButton("No")
     .Build();
 }
Exemplo n.º 4
0
    public void LoadAndEdit(string fileName)
    {
        if (!Active)
        {
            return;
        }
        Load(fileName);

        // check if the right button was pressed
        m_dialogBuilderFactory.Create()
        .SetTitle("Edit the track?")
        .SetMessage("Would you like to edit the loaded track?")
        .SetIcon(DialogBuilder.Icon.QUESTION)
        .AddButton("Cancel")
        .AddButton("Yes", () => m_stateMachine.TransitionToState(StateName.BUILD_EDITOR_STATE))
        .Build();
    }
Exemplo n.º 5
0
 protected void OnDiscard()
 {
     m_dialogBuilderFactory.Create()
     .SetTitle("Discard changes?")
     .SetMessage("Would you like to discard the changes done to the tracks´ settings?")
     .SetIcon(DialogBuilder.Icon.QUESTION)
     .AddButton("YES", Deactivate)
     .AddButton("NO")
     .Build();
 }
Exemplo n.º 6
0
 public void OnClearButtonPressed()
 {
     m_dialogBuilderFactory.Create()
     .SetTitle("Delete all points?")
     .SetIcon(DialogBuilder.Icon.WARNING)
     .SetMessage("Are you sure you would like to delete all the points? This is a destructive operation.")
     .AddButton("Delete", () => m_state.Clear())
     .AddButton("Cancel")
     .Build();
 }
Exemplo n.º 7
0
    public void OnDone()
    {
        if (!Active)
        {
            return;
        }

        if (m_pointRecorder.PointCount < 2)
        {
            m_dialogBuilderFactory.Create()
            .SetTitle("Keep drawing!")
            .SetIcon(DialogBuilder.Icon.ALERT)
            .SetMessage("It seems you did not draw enough to generate a track!")
            .Build();
            return;
        }

        // Dump the Points and give them to the track builder
        Vector3 [] points, featurePoints;
        m_pointRecorder.DumpPoints(out points);

        // Identify the feature points
        FeaturePointUtility.IdentifyFeaturePoints(ref points, out featurePoints);

        // Check number of feature points
        if (featurePoints.Length < 2)
        {
            m_dialogBuilderFactory.Create()
            .SetTitle("Keep drawing!")
            .SetIcon(DialogBuilder.Icon.ALERT)
            .SetMessage("It seems you did not draw enough to generate a track!")
            .Build();
            return;
        }

        m_buildSM.CurrentTrackData.m_featurePoints = featurePoints;

        points        = null;
        featurePoints = null;

        m_stateMachine.TransitionToState(StateName.BUILD_EDITOR_STATE);
    }
    public override void EnterState()
    {
        base.EnterState();
        Debug.Log("BuildObserveState entered!");
        m_subscriptions = new CompositeDisposable();

        // clear existing feature points
        m_featurePointsManager.ClearFeaturePoints();

        IObservable <TrackData> observable;

        if (m_observeDialogUI.DoReceiveLiveUpdates)
        {
            observable = m_useCase.ObserveTrack(m_observeDialogUI.KeyToDownload);
        }
        else
        {
            observable = m_useCase.GetTrack(m_observeDialogUI.KeyToDownload);
        }

        // update session and rebuild track when an update from the server was received
        m_subscriptions.Add(observable
                            .SubscribeOn(Scheduler.ThreadPool)
                            .ObserveOnMainThread()
                            .Subscribe(
                                UpdateTrack,
                                e => { m_dialogBuilderFactory.Create().MakeGenericExceptionDialog(e); },
                                () => { }));

        // rebuild track if the track move tool was used
        m_subscriptions.Add(m_signalBus.GetStream <FeaturePointChanged>()
                            .SubscribeOn(Scheduler.ThreadPool)
                            .ObserveOnMainThread()
                            .Subscribe(
                                _ => RebuildTrack(),
                                e => { m_dialogBuilderFactory.Create().MakeGenericExceptionDialog(e); },
                                () => { }));
    }
Exemplo n.º 9
0
    public void CreateDialog()
    {
        DialogBuilder builder = m_builderFactory.Create();

        builder.SetTitle(Title)
        .SetMessage(Message)
        .SetIcon(Icon);

        for (int i = 0; i < Buttons.Length; ++i)
        {
            builder.AddButton(Buttons [i].ButtonText, DummyCallback);
        }

        builder.Build();
    }
Exemplo n.º 10
0
    public void OnBack()
    {
        if (!Active)
        {
            return;
        }

        m_dialogBuilderFactory.Create()
        .SetTitle("Exit the race?")
        .SetMessage("Are you sure you would like to exit the race mode?")
        .SetIcon(DialogBuilder.Icon.QUESTION)
        .AddButton("Yes", () => {
            m_signalBus.Fire <DestroyVehicleSignal> ();
            m_buildSM.ReturnToPreviousStateFlag = true;
            m_stateMachine.TransitionToState(StateName.BUILD_SM);
        })
        .AddButton("Keep Racing!")
        .Build();
    }