Esempio n. 1
0
        public TUser Spawn(string name)
        {
            var user = Factory.SpawnUser();

            _Add(_Build(name, user));
            _View.WriteLine(string.Format("{0} user created.", name));

            return(user);
        }
Esempio n. 2
0
 public void AddFactoty(string name, IUserFactoty <TUser> user_factory)
 {
     _Providers.Add(
         new Provider
     {
         Name    = name,
         Factory = user_factory
     });
     _View.WriteLine(string.Format("Added {0} factory.", name));
 }
Esempio n. 3
0
            private void _UnspawnController(string name)
            {
                var controllers = (from controller in _Controlls where controller.Name == name select controller).ToArray();

                foreach (var c in controllers)
                {
                    _SelectedControlls.Remove(c);
                    _Loops.Remove(c);
                    _Controlls.Remove(c);
                    _Viewer.WriteLine("控制者[" + name + "] 移除.");
                }
            }
Esempio n. 4
0
            Value <IUserRequester> ISystemSelector.Use(string system)
            {
                var p = (from provider in _SystemProviders where provider.Command == system select provider).FirstOrDefault();

                if (p != null)
                {
                    return(new Value <IUserRequester>(SelectedEvent(p)));
                }

                _Viewer.WriteLine("錯誤的系統名稱.");
                return(null);
            }
Esempio n. 5
0
        private IUserRequester _OnSelectedSystem(ControllerProvider controller_provider)
        {
            _Viewer.WriteLine("啟動系統");
            var ssr = new StageSystemReady(_Viewer, controller_provider, Command);

            _StageMachine.Push(ssr);

            return(ssr);
        }
Esempio n. 6
0
        public void Send(string message)
        {
            var buffer = _ToBytes(message);

            _Peer.Send(buffer, 0, buffer.Length).DoneEvent += (send_count) =>
            {
                _Viewer.WriteLine(string.Format("send bytes {0} ", send_count));
            };
        }
Esempio n. 7
0
 private void _Readed(int count)
 {
     for (int i = 0; i < count; i++)
     {
         if (_Buffer[i] != _Data++)
         {
             throw new SystemException("number receive error!");
         }
     }
     _Viewer.WriteLine(string.Format("receive count {0}", count));
 }
Esempio n. 8
0
        private void _Readed(int read_count)
        {
            var message = System.Text.Encoding.Default.GetString(_Buffer, 0, read_count);

            _Viewer.WriteLine(String.Format("transmitter{0} : {1}", _Id, message));


            for (int i = 0; i < _Buffer.Length; i++)
            {
                _Buffer[i] = 0;
            }

            _Peer.Receive(_Buffer, 0, _Buffer.Length, _Readed);
        }
Esempio n. 9
0
 private void _GetPositionResult(Value <PlayerPosition[]> obj)
 {
     obj.OnValue += player_positions =>
     {
         foreach (var data in player_positions)
         {
             _View.WriteLine($"Player Id{data.Id}, Position is {data.GridIndex}");
         }
     };
 }