Пример #1
0
        private void OnConnectedToServerPacket(PacketBase p)
        {
            var packet = (ConnectedToServerPacket)p;

            foreach (string resourcePack in packet.RequiredResourcePacks)
            {
                if (!File.Exists(_pathService.ResourcePackDirectory + resourcePack + ".rpk"))
                {
                    _networkService.DisconnectFromServer($"Missing required resource packs. (File: {resourcePack})");
                    return;
                }
            }

            var vm = _vmFactory.Create <CharacterSelectionUIViewModel>();

            vm.IsCharacterDeletionEnabled = packet.AllowCharacterDeletion;
            vm.ServerName     = packet.ServerName;
            vm.Announcement   = packet.Announcement;
            vm.Category       = packet.Category;
            vm.PVP            = packet.PVP;
            vm.CurrentPlayers = packet.CurrentPlayers;
            vm.MaxPlayers     = packet.MaxPlayers;

            foreach (var pc in packet.PCs)
            {
                vm.PCs.Add(pc);
            }

            vm.BuildServerInformationDetails();

            _uiService.ChangeUIRoot <CharacterSelectionView>(vm);
        }
Пример #2
0
        private void Disconnect(object obj)
        {
            _networkService.DisconnectFromServer();
            var vm = _vmFactory.Create <MainMenuUIViewModel>();

            _uiService.ChangeUIRoot <MainMenuView>(vm);
        }
Пример #3
0
        public void Initialize()
        {
            //MainMenuUIViewModel vm = _uiViewModelFactory.Create<MainMenuUIViewModel>();
            //_uiService.ChangeUIRoot<MainMenuView>(vm);

            LoginUIViewModel vm = _uiViewModelFactory.Create <LoginUIViewModel>();

            _uiService.ChangeUIRoot <LoginView>(vm);
        }
Пример #4
0
        public CharacterSelectionUIViewModel(IUIService uiService,
                                             IUIViewModelFactory vmFactory,
                                             IClientNetworkService networkService)
        {
            _uiService      = uiService;
            _vmFactory      = vmFactory;
            _networkService = networkService;

            PCs = new ObservableCollection <PCTransferObject>();

            CreateCharacterCommand        = new RelayCommand(CreateCharacter);
            DeleteCharacterCommand        = new RelayCommand(DeleteCharacter);
            DisconnectCommand             = new RelayCommand(Disconnect);
            JoinServerCommand             = new RelayCommand(JoinServer);
            ConfirmDeleteCharacterCommand = new RelayCommand(ConfirmDeleteCharacter);
            DeleteFailureCommand          = new RelayCommand(DeleteFailure);

            _characterCreationVM = _vmFactory.Create <CharacterCreationUIViewModel>();
            _characterCreationVM.CharacterSelectionVM = this;

            _networkService.BindPacketAction <CharacterDeletedPacket>(OnCharacterDeletedPacket);
        }
Пример #5
0
        private void Back(object obj)
        {
            MainMenuUIViewModel vm = _vmFactory.Create <MainMenuUIViewModel>();

            _uiService.ChangeUIRoot <MainMenuView>(vm);
        }
Пример #6
0
        public void Initialize()
        {
            GameUIViewModel vm = _vmFactory.Create <GameUIViewModel>();

            _uiService.ChangeUIRoot <GameView>(vm);
        }