Exemplo n.º 1
0
 public static void AddStateOnce(PedHandle ped, State state)
 {
     if (!StateMachines.HasState(ped, state.GetType()))
     {
         StateMachines.Add(ped, new State.Machine(state));
     }
 }
        private void NewStateMachine()
        {
            try
            {
                var textEditService = new TextEditService();

                string initialName = StateMachines
                                     .Select(sm => sm.Name)
                                     .CreateUniqueName("State Machine {0}");

                textEditService.EditText(initialName, "State Machine Name", "Create State Machine", name =>
                {
                    var model = new StateMachine()
                    {
                        Name    = name,
                        Actions = new StateMachineOutputAction[] { },
                        Inputs  = new StateMachineInput[] { }
                    };

                    var viewService = ApplicationContainer.Container.Resolve <IViewService>();

                    var viewModel = new StateMachineReferenceViewModel(model, viewService, DirtyService, _messageBoxService);

                    StateMachines.Add(viewModel);

                    _dirtyService.MarkDirty();
                });
            }
            catch (Exception ex)
            {
                _messageBoxService.Show(ex);
            }
        }
Exemplo n.º 3
0
 public static void AddState(PedHandle ped, params State[] states) => StateMachines.Add(ped, new State.Machine(states));