コード例 #1
0
ファイル: Player.cs プロジェクト: dunck2020/TBQuest.S6
        public void InventoryUpdate()
        {
            Weapons.Clear();
            Artifacts.Clear();
            Spells.Clear();
            Treasure.Clear();


            foreach (var gameItem in _inventory)
            {
                if (gameItem is Weapon)
                {
                    Weapons.Add(gameItem);                     //1000
                }
                if (gameItem is Artifact)
                {
                    Artifacts.Add(gameItem);                       //2000
                }
                if (gameItem is Spell)
                {
                    Spells.Add(gameItem);                    //3000
                }
                if (gameItem is Treasure)
                {
                    Treasure.Add(gameItem);                       //4000
                }
            }
        }
コード例 #2
0
        public void PresetParty5()
        {
            // Offense
            Party.Clear();
            Artifacts.Clear();

            Party.Add(SlayerRecruit.Warrior());
            Party.Add(SlayerRecruit.Archer());
            Party.Add(SlayerRecruit.Archer());

            Party.Add(SlayerRecruit.Wizard());
            Party.Add(SlayerRecruit.Wizard());
            Party.Add(SlayerRecruit.Wizard());

            Artifacts.Add(SlayerArtifact.MagicArrows());
            Artifacts.Add(SlayerArtifact.MagicStaff());
        }
コード例 #3
0
        public void PresetParty8()
        {
            // Symmetry
            Party.Clear();
            Artifacts.Clear();

            Party.Add(SlayerRecruit.MenAtArms());
            Party.Add(SlayerRecruit.MenAtArms());

            Party.Add(SlayerRecruit.Warrior());
            Party.Add(SlayerRecruit.Warrior());

            Party.Add(SlayerRecruit.Archer());
            Party.Add(SlayerRecruit.Archer());

            Party.Add(SlayerRecruit.Wizard());
            Party.Add(SlayerRecruit.Wizard());
        }
コード例 #4
0
        public void PresetParty7()
        {
            // Magicly Enhanced
            Party.Clear();
            Artifacts.Clear();

            Party.Add(SlayerRecruit.MenAtArms());
            Party.Add(SlayerRecruit.MenAtArms());

            Party.Add(SlayerRecruit.Warrior());
            Party.Add(SlayerRecruit.Warrior());

            Party.Add(SlayerRecruit.Wizard());

            Artifacts.Add(SlayerArtifact.MagicArmour());
            Artifacts.Add(SlayerArtifact.MagicSword());
            Artifacts.Add(SlayerArtifact.MagicStaff());
            Artifacts.Add(SlayerArtifact.MagicScrolls());
        }
コード例 #5
0
        public void PresetParty3()
        {
            // Magic Avengers
            Party.Clear();
            Artifacts.Clear();

            Party.Add(SlayerRecruit.MenAtArms());
            Party.Add(SlayerRecruit.MenAtArms());

            Party.Add(SlayerRecruit.Warrior());

            Party.Add(SlayerRecruit.Wizard());
            Party.Add(SlayerRecruit.Wizard());
            Party.Add(SlayerRecruit.Wizard());

            Artifacts.Add(SlayerArtifact.MagicArmour());
            Artifacts.Add(SlayerArtifact.MagicScrolls());
            Artifacts.Add(SlayerArtifact.MagicStaff());
        }
コード例 #6
0
        public void PresetParty9()
        {
            // Ranged Attacks
            Party.Clear();
            Artifacts.Clear();

            Party.Add(SlayerRecruit.MenAtArms());
            Party.Add(SlayerRecruit.MenAtArms());

            Party.Add(SlayerRecruit.Warrior());

            Party.Add(SlayerRecruit.Archer());
            Party.Add(SlayerRecruit.Archer());
            Party.Add(SlayerRecruit.Archer());

            Party.Add(SlayerRecruit.Wizard());
            Party.Add(SlayerRecruit.Wizard());

            Artifacts.Add(SlayerArtifact.MagicArrows());
        }
コード例 #7
0
        public void PresetParty2()
        {
            // Swords & Arrows
            Party.Clear();
            Artifacts.Clear();

            Party.Add(SlayerRecruit.MenAtArms());
            Party.Add(SlayerRecruit.MenAtArms());

            Party.Add(SlayerRecruit.MenAtArms());
            Party.Add(SlayerRecruit.MenAtArms());

            Party.Add(SlayerRecruit.Warrior());
            Party.Add(SlayerRecruit.Warrior());
            Party.Add(SlayerRecruit.Archer());
            Party.Add(SlayerRecruit.Archer());

            Artifacts.Add(SlayerArtifact.MagicArrows());
            Artifacts.Add(SlayerArtifact.MagicSword());
        }
コード例 #8
0
        public void PresetParty10()
        {
            // Balanced 2
            Party.Clear();
            Artifacts.Clear();

            Party.Add(SlayerRecruit.MenAtArms());
            Party.Add(SlayerRecruit.MenAtArms());

            Party.Add(SlayerRecruit.MenAtArms());
            Party.Add(SlayerRecruit.MenAtArms());

            Party.Add(SlayerRecruit.Warrior());
            Party.Add(SlayerRecruit.Warrior());
            Party.Add(SlayerRecruit.Warrior());

            Party.Add(SlayerRecruit.Archer());

            Party.Add(SlayerRecruit.Wizard());
            Party.Add(SlayerRecruit.Wizard());
        }
コード例 #9
0
        public void PresetParty6()
        {
            // Rejuvinators
            Party.Clear();
            Artifacts.Clear();

            Party.Add(SlayerRecruit.MenAtArms());
            Party.Add(SlayerRecruit.MenAtArms());
            Party.Add(SlayerRecruit.MenAtArms());
            Party.Add(SlayerRecruit.MenAtArms());
            Party.Add(SlayerRecruit.MenAtArms());
            Party.Add(SlayerRecruit.MenAtArms());

            Party.Add(SlayerRecruit.Warrior());
            Party.Add(SlayerRecruit.Warrior());

            Party.Add(SlayerRecruit.Archer());
            Party.Add(SlayerRecruit.Wizard());

            Artifacts.Add(SlayerArtifact.MagicPotion());
        }
コード例 #10
0
        public void PresetParty4()
        {
            // Balanced
            Party.Clear();
            Artifacts.Clear();

            Party.Add(SlayerRecruit.MenAtArms());
            Party.Add(SlayerRecruit.MenAtArms());

            Party.Add(SlayerRecruit.MenAtArms());
            Party.Add(SlayerRecruit.MenAtArms());

            Party.Add(SlayerRecruit.Warrior());
            Party.Add(SlayerRecruit.Archer());

            Party.Add(SlayerRecruit.Wizard());
            Party.Add(SlayerRecruit.Wizard());

            Artifacts.Add(SlayerArtifact.MagicPotion());
            Artifacts.Add(SlayerArtifact.MagicStaff());
        }
コード例 #11
0
        public void PresetParty1()
        {
            // Pure Brawn
            Party.Clear();
            Artifacts.Clear();

            Party.Add(SlayerRecruit.MenAtArms());
            Party.Add(SlayerRecruit.MenAtArms());

            Party.Add(SlayerRecruit.MenAtArms());
            Party.Add(SlayerRecruit.MenAtArms());

            Party.Add(SlayerRecruit.MenAtArms());
            Party.Add(SlayerRecruit.MenAtArms());

            Party.Add(SlayerRecruit.Warrior());
            Party.Add(SlayerRecruit.Warrior());
            Party.Add(SlayerRecruit.Archer());
            Party.Add(SlayerRecruit.Archer());
            Party.Add(SlayerRecruit.Wizard());
        }
コード例 #12
0
        public void PresetParty11()
        {
            // Nothing Special
            Party.Clear();
            Artifacts.Clear();

            Party.Add(SlayerRecruit.MenAtArms());
            Party.Add(SlayerRecruit.MenAtArms());

            Party.Add(SlayerRecruit.MenAtArms());
            Party.Add(SlayerRecruit.MenAtArms());

            Party.Add(SlayerRecruit.Warrior());

            Party.Add(SlayerRecruit.Archer());

            Party.Add(SlayerRecruit.Wizard());
            Party.Add(SlayerRecruit.Wizard());

            Artifacts.Add(SlayerArtifact.MagicStaff());
            Artifacts.Add(SlayerArtifact.MagicScrolls());
        }
コード例 #13
0
        public void PresetParty12()
        {
            // Sword Force!
            Party.Clear();
            Artifacts.Clear();

            Party.Add(SlayerRecruit.MenAtArms());
            Party.Add(SlayerRecruit.MenAtArms());

            Party.Add(SlayerRecruit.MenAtArms());
            Party.Add(SlayerRecruit.MenAtArms());

            Party.Add(SlayerRecruit.MenAtArms());
            Party.Add(SlayerRecruit.MenAtArms());

            Party.Add(SlayerRecruit.Warrior());

            Party.Add(SlayerRecruit.Wizard());

            Artifacts.Add(SlayerArtifact.MagicArmour());
            Artifacts.Add(SlayerArtifact.MagicSword());
            Artifacts.Add(SlayerArtifact.MagicPotion());
        }
コード例 #14
0
        public void RandomParty()
        {
            Party.Clear();
            Artifacts.Clear();

            for (var i = 0; i < 8; i++)
            {
                switch (Dice.Roll(1, 6))
                {
                case 1:
                    Party.Add(SlayerRecruit.Wizard());
                    break;

                case 2:
                    Party.Add(SlayerRecruit.Warrior());
                    break;

                case 3:
                    Party.Add(SlayerRecruit.Archer());
                    break;

                case 4:
                    Party.Add(SlayerRecruit.MenAtArms());
                    Party.Add(SlayerRecruit.MenAtArms());
                    break;

                case 5:
                    Artifacts.Add(SlayerArtifact.RandomArtifact());
                    break;

                case 6:
                    if (!Party.Any(_ => _.Type == ERecruitType.MenAtArms))
                    {
                        Party.Add(SlayerRecruit.MenAtArms());
                        Party.Add(SlayerRecruit.MenAtArms());
                    }
                    else if (!Party.Any(_ => _.Type == ERecruitType.Warrior))
                    {
                        Party.Add(SlayerRecruit.Warrior());
                    }
                    else
                    {
                        switch (Dice.Roll(1, 3))
                        {
                        case 1:
                            Party.Add(SlayerRecruit.Wizard());
                            break;

                        case 2:
                            Party.Add(SlayerRecruit.Archer());
                            break;

                        default:
                            Artifacts.Add(SlayerArtifact.RandomArtifact());
                            break;
                        }
                    }
                    break;
                }
            }
        }
        public GetAppInstallFilesBlobDialogViewModel()
        {
            // Show/Hide Blob
            ShowHideBlobSectionCommand.Subscribe(_ =>
            {
                ShowHideBlobSectionButtonLabel.Value = ShowBlobSectionVisibility.Value == Visibility.Collapsed
                    ? ExpandButtonLabel
                    : CollapseButtonLabel;
                ShowBlobSectionVisibility.Value = ShowBlobSectionVisibility.Value == Visibility.Collapsed
                    ? Visibility.Visible
                    : Visibility.Collapsed;
            })
            .AddTo(disposable);

            // Storage Credential Input
            StorageConnectionInput = new ReactiveProperty <string>(blobConnectionUseCase.Read <string>("blob_connection_string"));
            StorageConnectionInput.Subscribe(x => blobConnectionUseCase.Save("blob_connection_string", x)).AddTo(disposable);
            StorageContainerInput = new ReactiveProperty <string>(blobConnectionUseCase.Read <string>("container"));
            StorageContainerInput.Subscribe(x => blobConnectionUseCase.Save("container", x)).AddTo(disposable);

            // Copy Button
            CopyButtonContent  = new ReactiveProperty <string>("Copy SasUrl");
            CopyButtonEnabled  = ArtifactUrl.Select(x => !string.IsNullOrWhiteSpace(x)).ToReactiveProperty();
            OnClickCopyCommand = CopyButtonEnabled.ToReactiveCommand();
            OnClickCopyCommand
            .Do(_ => blobSasUrlUseCase.CopySasUrl(ArtifactUrl.Value, StorageConnectionInput.Value, StorageContainerInput.Value, SelectedArtifact.Value.Name))
            .SelectMany(x => TemporaryDisableCopyButtonAsObservable(TimeSpan.FromMilliseconds(500), "Copy SasUrl"))
            .Subscribe()
            .AddTo(disposable);

            // Download Button
            blobArtifactUsecase.DownloadStatus.Subscribe(x => DownloadStatus.Value = x).AddTo(disposable);
            OnClickDownloadCommand = CopyButtonEnabled.ToAsyncReactiveCommand();
            OnClickDownloadCommand
            .Subscribe(async _ => await blobArtifactUsecase.DownloadHoloLensPackagesAsync(StorageConnectionInput.Value, StorageContainerInput.Value, SelectedArtifact.Value.Name, SelectedArtifact.Value.Size, SelectedArtifact.Value.FileName))
            .AddTo(disposable);

            // OpenFolder Button
            OnClickOpenDownloadFolderCommand.Subscribe(_ => blobArtifactUsecase.OpenFolderAsync()).AddTo(disposable);
            OnClickOpenDownloadBlobFolderCommand.Subscribe(_ => blobArtifactUsecase.OpenDownloadFolderAsync()).AddTo(disposable);

            // Initialize by obtain artifact informations
            blobArtifactUsecase.Artifacts
            .Where(x => x != null)
            .Do(x =>
            {
                Projects.Add(x);
                BlobResult.Value = $"Found {Projects.Count} projects.";
            })
            .Subscribe()
            .AddTo(disposable);
            blobArtifactUsecase.RequestFailedMessage
            .Do(x => BlobResult.Value = x)
            .Subscribe()
            .AddTo(disposable);

            // Blob Download
            ComboBoxEnabled         = Projects.CollectionChangedAsObservable().Any().ToReactiveProperty();
            IsEnableCheckBlobButton = StorageConnectionInput
                                      .CombineLatest(StorageContainerInput, (r, l) => !string.IsNullOrWhiteSpace(r) && !string.IsNullOrWhiteSpace(l))
                                      .ToReadOnlyReactiveProperty();
            OnClickCheckBlobCommand = IsEnableCheckBlobButton.ToAsyncReactiveCommand();
            OnClickCheckBlobCommand.Subscribe(async _ =>
            {
                var task             = blobArtifactUsecase.RequestHoloLensPackagesAsync(StorageConnectionInput.Value, StorageContainerInput.Value);
                IsBlobChecking.Value = true;
                Projects.Clear();
                Branches?.Clear();
                Artifacts?.Clear();
                BlobResult.Value = "Trying obtain project infomations.";
                await task;
                IsBlobChecking.Value = false;
            })
            .AddTo(disposable);
            OnClickCancelBlobCommand = IsBlobChecking.Select(x => x).ToReactiveCommand();
            OnClickCancelBlobCommand
            .Do(_ => Projects.Clear())
            .Subscribe(_ => blobArtifactUsecase.CancelRequest())
            .AddTo(disposable);

            // Update Collection with Clear existing collection when selected.
            Branches = SelectedProject.Where(x => x != null)
                       .Do(_ => Branches?.Clear())
                       .Do(_ => Artifacts?.Clear())
                       .SelectMany(x => blobArtifactUsecase.GetArtifactCache(x.Project))
                       .ToReactiveCollection();
            Artifacts = SelectedBranch.Where(x => x != null)
                        .Do(x => Artifacts?.Clear())
                        .SelectMany(x => blobArtifactUsecase.GetArtifactCache(SelectedProject.Value?.Project, x.Branch))
                        .ToReactiveCollection();
            SelectedArtifact
            .Where(x => x != null)
            .Do(x =>
            {
                ArtifactName.Value    = x.Name;
                ArtifactCaption.Value = $"(Size: {x.Size}, MD5: {x.MD5}, LeaseState: {x.LeaseState})";
                ArtifactUrl.Value     = x.Uri.AbsoluteUri;
            })
            .ToReactiveProperty();
        }