Skip to content

Commit

Permalink
プレイヤーデータ表示機能を追加
Browse files Browse the repository at this point in the history
若干のリファクタリング
  • Loading branch information
MT224244 committed Apr 5, 2020
1 parent 90c19e7 commit 95d4d17
Show file tree
Hide file tree
Showing 29 changed files with 876 additions and 484 deletions.
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,24 @@
# TUSB ProgressViewer
# TUSB ProgressViewer

The Unusual SkyBlockという配布ワールドの攻略進捗等を確認できるツールです

![](https://user-images.githubusercontent.com/25514849/78503623-cadb5300-77a2-11ea-9552-c48ea654ef3a.png)

## 動作確認済みTUSBバージョン

- v12.0.9
- v12.0.8

## 機能

- どの島を攻略したかの可視化
- エンドの未破壊スポナーの可視化
- プレイヤーの各職業レベルの確認

## 使い方

右上のTUSBアイコンが付いたボタンからTUSBのワールドフォルダを選択すると、ワールドが読み込まれ情報が表示されます

## ライセンス

[MIT](LICENSE)
1 change: 1 addition & 0 deletions TUSB_ProgressViewer/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<ResourceDictionary Source="Styles/ScrollBarStyle.xaml"/>
<ResourceDictionary Source="Styles/WindowStyle.xaml"/>
<ResourceDictionary Source="Styles/IslandListStyle.xaml"/>
<ResourceDictionary Source="Styles/DataViewerStyles.xaml"/>
<ResourceDictionary Source="Styles/TabControlStyle.xaml"/>
<ResourceDictionary Source="Styles/LoadingViewStyle.xaml"/>
<ResourceDictionary Source="Styles/ErrorDialogStyle.xaml"/>
Expand Down
60 changes: 60 additions & 0 deletions TUSB_ProgressViewer/Controls/DataViewer.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<UserControl
x:Class="TUSB_ProgressViewer.Controls.DataViewer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:model="clr-namespace:TUSB_ProgressViewer.Models"
xmlns:vm="clr-namespace:TUSB_ProgressViewer.ViewModels">
<UserControl.DataContext>
<vm:DataViewerViewModel/>
</UserControl.DataContext>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<ListBox
ItemsSource="{Binding Source={x:Static model:ScoreData.Players}}"
SelectedItem="{Binding SelectedPlayer.Value}"
Style="{StaticResource PlayersListStyle}">
<ListBox.ItemTemplate>
<DataTemplate>
<Border>
<TextBlock Text="{Binding Name}"/>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<UniformGrid Grid.Column="1" Columns="1">
<UniformGrid Rows="1">
<Image Source="../Resources/iron_sword.png" Width="64"/>
<TextBlock Text="Knight" Style="{StaticResource JobText}"/>
<TextBlock Text="{Binding SelectedPlayer.Value.KnightLevel, StringFormat=Lv.{0}}" Style="{StaticResource JobText}"/>
</UniformGrid>
<UniformGrid Rows="1">
<Image Source="../Resources/snowball.png" Width="64"/>
<TextBlock Text="Ninja" Style="{StaticResource JobText}"/>
<TextBlock Text="{Binding SelectedPlayer.Value.NinjaLevel, StringFormat=Lv.{0}}" Style="{StaticResource JobText}"/>
</UniformGrid>
<UniformGrid Rows="1">
<Image Source="../Resources/bow.png" Width="64"/>
<TextBlock Text="Archer" Style="{StaticResource JobText}"/>
<TextBlock Text="{Binding SelectedPlayer.Value.ArcherLevel, StringFormat=Lv.{0}}" Style="{StaticResource JobText}"/>
</UniformGrid>
<UniformGrid Rows="1">
<Image Source="../Resources/carrot_on_a_stick.png" Width="64"/>
<TextBlock Text="White Mage" Style="{StaticResource JobText}"/>
<TextBlock Text="{Binding SelectedPlayer.Value.WhiteMageLevel, StringFormat=Lv.{0}}" Style="{StaticResource JobText}"/>
</UniformGrid>
<UniformGrid Rows="1">
<Image Source="../Resources/book.png" Width="64"/>
<TextBlock Text="Black Mage" Style="{StaticResource JobText}"/>
<TextBlock Text="{Binding SelectedPlayer.Value.BlackMageLevel, StringFormat=Lv.{0}}" Style="{StaticResource JobText}"/>
</UniformGrid>
<UniformGrid Rows="1">
<Image Source="../Resources/wolf_spawn_egg.png" Width="64"/>
<TextBlock Text="Summoner" Style="{StaticResource JobText}"/>
<TextBlock Text="{Binding SelectedPlayer.Value.SummonerLevel, StringFormat=Lv.{0}}" Style="{StaticResource JobText}"/>
</UniformGrid>
</UniformGrid>
</Grid>
</UserControl>
28 changes: 28 additions & 0 deletions TUSB_ProgressViewer/Controls/DataViewer.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace TUSB_ProgressViewer.Controls
{
/// <summary>
/// DataViewer.xaml の相互作用ロジック
/// </summary>
public partial class DataViewer : UserControl
{
public DataViewer()
{
InitializeComponent();
}
}
}
10 changes: 2 additions & 8 deletions TUSB_ProgressViewer/Controls/EndSpawnerProgress.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,8 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:behavior="clr-namespace:TUSB_ProgressViewer.Behaviors"
xmlns:vm="clr-namespace:TUSB_ProgressViewer.ViewModels"
mc:Ignorable="d">
<UserControl.DataContext>
<vm:EndSpawnerProgressViewModel/>
</UserControl.DataContext>
xmlns:model="clr-namespace:TUSB_ProgressViewer.Models">
<Grid>
<ScrollViewer ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility="Auto">
<i:Interaction.Behaviors>
Expand All @@ -29,7 +23,7 @@
Height="{Binding ActualHeight, ElementName=map}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
ItemsSource="{Binding Spawners}">
ItemsSource="{Binding Source={x:Static model:SpawnersData.Spawners}}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Grid/>
Expand Down
14 changes: 3 additions & 11 deletions TUSB_ProgressViewer/Controls/IslandCompleteProgress.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,7 @@
x:Class="TUSB_ProgressViewer.Controls.IslandCompleteProgress"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:TUSB_ProgressViewer.Controls"
xmlns:controls="clr-namespace:TUSB_ProgressViewer.Controls"
xmlns:vm="clr-namespace:TUSB_ProgressViewer.ViewModels"
mc:Ignorable="d">
<UserControl.DataContext>
<vm:IslandCompleteProgressViewModel/>
</UserControl.DataContext>
xmlns:model="clr-namespace:TUSB_ProgressViewer.Models">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
Expand All @@ -23,7 +15,7 @@
Height="{Binding ActualHeight, ElementName=map}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
ItemsSource="{Binding Islands}">
ItemsSource="{Binding Source={x:Static model:IslandsData.Islands}}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Grid/>
Expand All @@ -32,7 +24,7 @@
</ItemsControl>
</Grid>
<Grid Grid.Column="1" Background="#393939">
<ListBox x:Name="list" ItemsSource="{Binding Islands}" Style="{StaticResource IslandListStyle}">
<ListBox x:Name="list" ItemsSource="{Binding Source={x:Static model:IslandsData.Islands}}" Style="{StaticResource IslandListStyle}">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
Expand Down
24 changes: 0 additions & 24 deletions TUSB_ProgressViewer/Controls/IslandPointer.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,29 +58,5 @@
</Style>
</Path.Style>
</Path>
<!--<Path Stroke="Black" StrokeThickness="3" Fill="Lime">
<Path.Data>
<EllipseGeometry
Center="{Binding Center, ElementName=islandPointer}"
RadiusX="0.01"
RadiusY="0.01">
<EllipseGeometry.Transform>
<ScaleTransform ScaleX="{Binding ActualWidth, ElementName=islandPointer}" ScaleY="{Binding ActualHeight, ElementName=islandPointer}"/>
</EllipseGeometry.Transform>
</EllipseGeometry>
</Path.Data>
<Path.Style>
<Style TargetType="Path">
<Style.Triggers>
<DataTrigger Binding="{Binding IsSelected, ElementName=islandPointer}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
<DataTrigger Binding="{Binding IsSelected, ElementName=islandPointer}" Value="False">
<Setter Property="Visibility" Value="Hidden"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Path.Style>
</Path>-->
</Grid>
</UserControl>
11 changes: 11 additions & 0 deletions TUSB_ProgressViewer/Models/Coordinate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,19 @@ namespace TUSB_ProgressViewer.Models
/// </summary>
public class Coordinate
{
/// <summary>
/// X座標
/// </summary>
public int X { get; }

/// <summary>
/// Y座標
/// </summary>
public int Y { get; }

/// <summary>
/// Z座標
/// </summary>
public int Z { get; }

public Coordinate(int x, int y, int z)
Expand Down
11 changes: 5 additions & 6 deletions TUSB_ProgressViewer/Models/Island.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using OrangeNBT.World.Anvil;
using Prism.Mvvm;
using Reactive.Bindings;
using System;
using System.Collections.Generic;
using System.Linq;
Expand All @@ -14,6 +15,9 @@ namespace TUSB_ProgressViewer.Models
/// </summary>
public class Island: BindableBase
{
/// <summary>
/// 島タイプ
/// </summary>
public IslandType IslandType { get; }

/// <summary>
Expand All @@ -24,12 +28,7 @@ public class Island: BindableBase
/// <summary>
/// 選択フラグ
/// </summary>
public bool IsSelected
{
get => _isSelected;
set => SetProperty(ref _isSelected, value);
}
private bool _isSelected;
public bool IsSelected { get; set; }

public Island(IslandType type, AnvilWorld world)
{
Expand Down
119 changes: 119 additions & 0 deletions TUSB_ProgressViewer/Models/IslandsData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
using Reactive.Bindings;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using TUSB_ProgressViewer.Controls;
using TUSB_ProgressViewer.Util;

namespace TUSB_ProgressViewer.Models
{
public static class IslandsData
{
/// <summary>
/// 島リスト
/// </summary>
public static ReactiveCollection<IslandPointer> Islands { get; } = new ReactiveCollection<IslandPointer>();

/// <summary>
/// 島攻略数カウント
/// </summary>
public static ReactiveProperty<int> CompletionCount { get; } = new ReactiveProperty<int>();

/// <summary>
/// 島攻略率
/// </summary>
public static ReactiveProperty<double> CompletionRate { get; } = new ReactiveProperty<double>();

/// <summary>
/// 島の数
/// </summary>
private const int islandCount = 50;

/// <summary>
/// 島読み込み
/// </summary>
/// <param name="count"></param>
public static void Load(ref int count)
{
try
{
Islands.ClearOnScheduler();
foreach (IslandType type in Enum.GetValues(typeof(IslandType)))
{
var island = new Island(type, World.WorldData);

// 実際の座標と画像のピクセル数から画像上の島(エンドポータルフレーム)の位置を計算
// 画像のサイズが変わると壊れます()
var X = (island.IslandType.GetCoordinate().X + 221) / 512.0;
var Z = (island.IslandType.GetCoordinate().Z + 237) / 512.0;

// 別ディメンションは特殊な位置なので個別指定
switch (island.IslandType)
{
case IslandType.TheUnderworld:
X = 47 / 256.0;
Z = 234 / 256.0;
break;
case IslandType.TheNether:
X = 128 / 256.0;
Z = 234 / 256.0;
break;
case IslandType.GulliversLand:
X = 183 / 256.0;
Z = 234 / 256.0;
break;
case IslandType.Cloudia:
X = 43 / 256.0;
Z = 246 / 256.0;
break;
case IslandType.TableMountain:
X = 82 / 256.0;
Z = 246 / 256.0;
break;
case IslandType.TocultColde:
X = 157 / 256.0;
Z = 246 / 256.0;
break;
case IslandType.TheEnd:
X = 218 / 256.0;
Z = 246 / 256.0;
break;
}

Application.Current.Dispatcher.Invoke(() =>
{
Islands.Add(new IslandPointer()
{
IslandName = island.IslandType.GetName(),
Center = new Point(X, Z),
IsComplete = island.IsComplete
});

CompletionCount.Value = Islands.Where(x => x.IsComplete).Count();
CompletionRate.Value = (CompletionCount.Value / (double)islandCount) * 100;
});

World.LoadingProgress.Value = (++count / 297.0) * 100;
}
}
catch
{
Reset();
throw;
}
}

/// <summary>
/// データをリセット
/// </summary>
public static void Reset()
{
Islands.ClearOnScheduler();
CompletionCount.Value = 0;
CompletionRate.Value = 0;
}
}
}
Loading

0 comments on commit 95d4d17

Please sign in to comment.