//private Dictionary<int, ScoreNodeView> _scoreDictionary;

        public GameScreenViewModel()
        {
            PlayerArea = new PlayerAreaViewModel();
            //ScoreDictionary = new Dictionary<int, ScoreNodeView>();
            ChatView   = new ChatViewModel();
            ScorePanel = new StackPanel();
            AppState appState = AppState.GetAppState();

            //Adding players
            List <User> userList = appState.UserList;

            foreach (User u in userList)
            {
                PlayerAvatarView pav = new PlayerAvatarView(u.Name, u.ID.ToString());
                pav.PointerPressed += onAvatarClicked;
                PlayerArea.CircularPanel.Children.Add(pav);
            }

            //Adding score nodes
            for (int index = 1; index <= 5; index++)
            {
                ScoreNodeView snv = new ScoreNodeView();
                ScorePanel.Children.Add(snv);
                //ScoreDictionary.Add(index, snv);
            }
        }
示例#2
0
        public GameScreenViewModel()
        {
            _as             = AppState.GetAppState();
            GameState       = new GameState();
            PlayerArea      = new PlayerAreaViewModel();
            ScoreDictionary = new Dictionary <int, ScoreNodeView>();
            ChatView        = new ChatViewModel();
            ScorePanel      = new StackPanel();
            AvatarsList     = new List <PlayerAvatarView>();
            NoChoice        = "Gray";
            YesChoice       = "Orange";

            EnableOKBtn      = true;
            EnableVotingBtns = false;

            SelectablePlayers = 0;
            SelectedUserIDs   = new List <string>();

            ///Things that maybe should be moved
            TeamPickedUsersIDs = new List <string>();

            //Adding score nodes
            for (int index = 0; index < 5; index++)
            {
                ScoreNodeView snv = new ScoreNodeView();
                ScorePanel.Children.Add(snv);
                ScoreDictionary.Add(index, snv);
            }

            var okEnabled = this.WhenAnyValue(
                x => x.EnableOKBtn,
                x => x == true);

            var votingEnabled = this.WhenAnyValue(
                x => x.EnableVotingBtns,
                x => x == true);

            OnOkClicked  = ReactiveCommand.Create(OnOkClickedMethod, okEnabled);
            OnYesClicked = ReactiveCommand.Create(OnYesClickedMethod, votingEnabled);
            OnNoClicked  = ReactiveCommand.Create(OnNoClickedMethod, votingEnabled);
        }