Example #1
0
        private void OnCloseSettings()
        {
            PlayerContainer.Visibility = Visibility.Visible;
            SettingsControl.Visibility = Visibility.Collapsed;

            LifeControl.SetLife(viewModel.LifeTotal);
            UpdateCustomType();
            UpdateCommanderDmg();
        }
Example #2
0
        public void Reset(Gametypes type = Gametypes.MultiPlayer)
        {
            if (type == Gametypes.Current)
            {
                type = _lastType;
            }

            _lastType = type;

            viewModel.LifeTotal  = _manager.GetLifeValue(type);
            viewModel.Energy     = 0;
            viewModel.Experience = 0;
            viewModel.Poison     = 0;
            viewModel.CmdEnemy1  = 0;
            viewModel.CmdEnemy2  = 0;
            viewModel.CmdEnemy3  = 0;

            if (type == Gametypes.Commander)
            {
                LifeControl.SetValue(Grid.RowSpanProperty, 1);
            }
            else
            {
                LifeControl.SetValue(Grid.RowSpanProperty, 2);
            }


            cmdLife1.LifeChanged -= CmdLife_LifeChanged;
            cmdLife2.LifeChanged -= CmdLife_LifeChanged;
            cmdLife3.LifeChanged -= CmdLife_LifeChanged;

            var cmd = 1;

            foreach (var id in _manager.ActivePlayers())
            {
                if (id == viewModel.ID)
                {
                    continue;
                }
                if (id == PlayerID.Unknown)
                {
                    continue;
                }

                CommanderButtonMapping[id] = cmd;

                switch (cmd)
                {
                case 1:
                    borderLife1.Visibility = cmdLife1.Visibility = Visibility.Visible;
                    break;

                case 2:
                    borderLife2.Visibility = cmdLife2.Visibility = Visibility.Visible;
                    break;

                case 3:
                    borderLife3.Visibility = cmdLife3.Visibility = Visibility.Visible;
                    break;

                default:
                    break;
                }
                cmd++;
            }

            cmdLife1.LifeChanged += CmdLife_LifeChanged;
            cmdLife2.LifeChanged += CmdLife_LifeChanged;
            cmdLife3.LifeChanged += CmdLife_LifeChanged;


            BorderCmd.Visibility = type == Gametypes.Commander ? Visibility.Visible : Visibility.Collapsed;

            LifeControl.SetLife(viewModel.LifeTotal);
            UpdateCustomType();
            UpdateCommanderDmg();
        }