コード例 #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.GameView);

            CurrentQuestionView = FindViewById(Resource.Id.gv_CurrentQuestion);
            SelectedAnswerView  = FindViewById(Resource.Id.gv_SelectedCard);

            PlayerListHeader = FindViewById <TextView>(Resource.Id.gv_PlayerCount);
            if (UIAssets.AppFont != null)
            {
                PlayerListHeader.SetTypeface(UIAssets.AppFont, TypefaceStyle.Normal);
            }

            PlayerList         = FindViewById <ListView>(Resource.Id.gv_playerList);
            PlayerArrayAdapter = new PlayerArrayAdapter(this, CardsAgainstHumility.Players);
            PlayerList.Adapter = PlayerArrayAdapter;

            _drawer = FindViewById <DrawerLayout>(Resource.Id.gv_drawer);
            _drawer.DrawerOpened += (sender, args) =>
            {
                isDrawerOpen = true;
                _drawer.Invalidate();
            };

            FindViewById <TextView>(Resource.Id.gv_GameName).Text = CardsAgainstHumility.GameName;
            if (UIAssets.AppFont != null)
            {
                FindViewById <TextView>(Resource.Id.gv_GameName).SetTypeface(UIAssets.AppFont, TypefaceStyle.Normal);
            }

            FindViewById(Resource.Id.gv_playerListBtn).Click += (sender, args) =>
            {
                _drawer.OpenDrawer((int)GravityFlags.Start);
            };

            UpdateCurrentQuestion();
            UpdateStatusText();
            UpdateReadyButton();
            UpdatePlayerList();
            UpdateConfirmButton();
            UpdatePlayerHand();
            UpdateSelectedCardView();
            UpdateRoundWinner();

            CardsAgainstHumility.Game_SocketConnected      += OnSocketConnected;
            CardsAgainstHumility.Game_SocketConnectError   += OnSocketConnectError;
            CardsAgainstHumility.Game_SocketConnectTimeout += OnSocketConnectTimeout;
            CardsAgainstHumility.Game_Update += OnUpdateGame;
            CardsAgainstHumility.Game_Error  += OnGameError;
        }