Beispiel #1
0
 public ControlStatus(IBinder binder, Entity player, IMapFinder map)
 {
     _Binder      = binder;
     _Player      = player;
     _Map         = map;
     _Status      = new StatusMachine();
     _TimeCounter = new TimeCounter();
 }
Beispiel #2
0
        private Socket(Line line)
        {
            _Stream = new SegmentStream(new SocketMessage[0]);



            _Line    = line;
            _Machine = new StatusMachine <Timestamp>();
        }
Beispiel #3
0
        public User(IBinder binder, IAccountFinder account_finder, IGameRecorder game_record_handler, Zone zone)
        {
            this._Machine = new StatusMachine();

            this._Binder        = binder;
            this._AccountFinder = account_finder;
            this._GameRecorder  = game_record_handler;
            this._Zone          = zone;
            _Version            = "0.0.0.0";
        }
        public UnitTest1()
        {
            sm = new StatusMachine <long>();
            sm.InitStatus(1);
            sm.SetLoopSpeed(500);

            sm.AddStatus(1, () => { WriteLine("ent1"); }, () => { WriteLine("upadate1 next 2"); return(2); }, () => { WriteLine("exit1"); });
            sm.AddStatus(2, () => { WriteLine("ent2"); }, () => { WriteLine("upadate2 next 3"); return(3); }, () => { WriteLine("exit2"); });
            sm.AddStatus(3, () => { WriteLine("ent3"); }, () => { WriteLine("upadate3 next 4"); return(4); }, () => { WriteLine("exit3"); });
            sm.AddStatus(4, () => { WriteLine("ent4"); }, () => { WriteLine("upadate4 next 5"); return(5); }, () => { WriteLine("exit4"); });
            sm.AddStatus(5, () => { WriteLine("ent5"); }, () => 6, () => { WriteLine("exit5"); });
        }
        // Insertar elementos en la base de datos
        public StatusMachine Insert(StatusMachine statusMachine)
        {
            // Validar si ya existe
            if (_context.StatusMachine.Any(x => x.description == statusMachine.description))
            {
                throw new AppException("El rol \"" + statusMachine.description + "\" ya existe.");
            }

            // Guardar elemento
            _context.StatusMachine.Add(statusMachine);
            _context.SaveChanges();
            return(statusMachine);
        }
Beispiel #6
0
 public PeerListener(Line Line)
 {
     m_Line    = Line;
     m_Machine = new StatusMachine <Timestamp>();
 }
Beispiel #7
0
        public static bool run(string command, Dictionary <string, string> options)
        {
            ICommand cmd = CommandFactory.getCommand(command);

            if (cmd == null)
            {
                CommandOutput.commandErrorOutput("No such command!");
                return(false);
            }

            StatusMachine   stateMachine = new StatusMachine();
            ChangeCondition condition    = stateMachine.mapToCondition(cmd);
            ProcessState    currentState = stateMachine.MoveNext(condition);

            Boolean runResult, isResourceCreated;

            while (currentState != ProcessState.Terminated)
            {
                if (stateMachine.isRunningState(currentState) == false)
                {
                    //command is not going to run, must be wrong input
                    CommandOutput.commandErrorOutput(stateMachine.Messages[currentState]);
                }
                else
                {
                    //need to run the command
                    runResult = cmd.execute(options);
                    if (cmd.GetType() == typeof(SetupCommand))
                    {
                        isResourceCreated = Resource.isResourceCreated();
                        condition         = stateMachine.mapToCondition(cmd, runResult, isResourceCreated);
                    }
                    else
                    {
                        condition = stateMachine.mapToCondition(cmd, runResult, false);
                    }
                    currentState = stateMachine.MoveNext(condition);
                    if (currentState == ProcessState.Terminated)
                    {
                        break;
                    }
                }

                while (true)
                {
                    //Fetch a command
                    if (!CommandReader.readCommand())
                    {
                        return(false);
                    }
                    cmd = CommandFactory.getCommand(CommandReader.Command);
                    if (cmd != null)
                    {
                        break;
                    }
                    CommandOutput.commandErrorOutput("No such command!");
                }

                condition    = stateMachine.mapToCondition(cmd);
                currentState = stateMachine.MoveNext(condition);
            }
            return(true);
        }
Beispiel #8
0
 public void setStateMachine(StatusMachine other)
 {
     currentStateMachine = other;
 }
Beispiel #9
0
 // Use this for initialization
 void Start()
 {
     currentStateMachine = StatusMachine.ESPERANDO;
 }
Beispiel #10
0
 private void StartGame()
 {
     score = 0;
     currentStateMachine = StatusMachine.INGAME;
 }
	private void StartGame()
	{
		score = 0;
		currentStatusMachine = StatusMachine.JOGANDO;
	}
	void Start () 
	{
	
		currentStatusMachine = StatusMachine.ESPERANDO;

	}
Beispiel #13
0
 public User(IBinder binder, IStorage storage)
 {
     this._Storage = storage;
     this._Binder  = binder;
     this._Machine = new StatusMachine();
 }
 public StatusMachine Insert(StatusMachine body)
 {
     throw new NotImplementedException();
 }