Esempio n. 1
0
        void Prepare()
        {
            Initialize();

            // Spawn list items
            foreach (string id in _list.GetGameIDs())
            {
                GameListItem item = _itemPool.Spawn(new GameListItem.Param(id));

                // Keep track of it
                _items.Add(item);

                // Route selection event
                item.OnSelected
                .Subscribe(i => _selection.OnNext(i))
                .AddTo(_open);
            }

            // Route cancellation event
            _cancelButton
            .OnClickAsObservable()
            .Subscribe(_ => _cancellation.OnNext())
            .AddTo(_open);

            // Refresh list when list changed
            _list.OnChanged
            .Subscribe(_ => Prepare())
            .AddTo(_open);
        }
Esempio n. 2
0
 bool CheckValidId(string id)
 {
     return(!string.IsNullOrEmpty(id) &&
            !_gameList.GetGameIDs().Contains(id) &&
            !Regex.IsMatch(id, @"[^A-Za-z0-9]"));
 }