Skip to content

Commit 95d4d17

Browse files
committed
プレイヤーデータ表示機能を追加
若干のリファクタリング
1 parent 90c19e7 commit 95d4d17

29 files changed

Lines changed: 876 additions & 484 deletions

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,24 @@
1-
# TUSB ProgressViewer
1+
# TUSB ProgressViewer
2+
3+
The Unusual SkyBlockという配布ワールドの攻略進捗等を確認できるツールです
4+
5+
![](https://user-images.githubusercontent.com/25514849/78503623-cadb5300-77a2-11ea-9552-c48ea654ef3a.png)
6+
7+
## 動作確認済みTUSBバージョン
8+
9+
- v12.0.9
10+
- v12.0.8
11+
12+
## 機能
13+
14+
- どの島を攻略したかの可視化
15+
- エンドの未破壊スポナーの可視化
16+
- プレイヤーの各職業レベルの確認
17+
18+
## 使い方
19+
20+
右上のTUSBアイコンが付いたボタンからTUSBのワールドフォルダを選択すると、ワールドが読み込まれ情報が表示されます
21+
22+
## ライセンス
23+
24+
[MIT](LICENSE)

TUSB_ProgressViewer/App.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<ResourceDictionary Source="Styles/ScrollBarStyle.xaml"/>
1212
<ResourceDictionary Source="Styles/WindowStyle.xaml"/>
1313
<ResourceDictionary Source="Styles/IslandListStyle.xaml"/>
14+
<ResourceDictionary Source="Styles/DataViewerStyles.xaml"/>
1415
<ResourceDictionary Source="Styles/TabControlStyle.xaml"/>
1516
<ResourceDictionary Source="Styles/LoadingViewStyle.xaml"/>
1617
<ResourceDictionary Source="Styles/ErrorDialogStyle.xaml"/>
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<UserControl
2+
x:Class="TUSB_ProgressViewer.Controls.DataViewer"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:model="clr-namespace:TUSB_ProgressViewer.Models"
6+
xmlns:vm="clr-namespace:TUSB_ProgressViewer.ViewModels">
7+
<UserControl.DataContext>
8+
<vm:DataViewerViewModel/>
9+
</UserControl.DataContext>
10+
<Grid>
11+
<Grid.ColumnDefinitions>
12+
<ColumnDefinition Width="300"/>
13+
<ColumnDefinition/>
14+
</Grid.ColumnDefinitions>
15+
<ListBox
16+
ItemsSource="{Binding Source={x:Static model:ScoreData.Players}}"
17+
SelectedItem="{Binding SelectedPlayer.Value}"
18+
Style="{StaticResource PlayersListStyle}">
19+
<ListBox.ItemTemplate>
20+
<DataTemplate>
21+
<Border>
22+
<TextBlock Text="{Binding Name}"/>
23+
</Border>
24+
</DataTemplate>
25+
</ListBox.ItemTemplate>
26+
</ListBox>
27+
<UniformGrid Grid.Column="1" Columns="1">
28+
<UniformGrid Rows="1">
29+
<Image Source="../Resources/iron_sword.png" Width="64"/>
30+
<TextBlock Text="Knight" Style="{StaticResource JobText}"/>
31+
<TextBlock Text="{Binding SelectedPlayer.Value.KnightLevel, StringFormat=Lv.{0}}" Style="{StaticResource JobText}"/>
32+
</UniformGrid>
33+
<UniformGrid Rows="1">
34+
<Image Source="../Resources/snowball.png" Width="64"/>
35+
<TextBlock Text="Ninja" Style="{StaticResource JobText}"/>
36+
<TextBlock Text="{Binding SelectedPlayer.Value.NinjaLevel, StringFormat=Lv.{0}}" Style="{StaticResource JobText}"/>
37+
</UniformGrid>
38+
<UniformGrid Rows="1">
39+
<Image Source="../Resources/bow.png" Width="64"/>
40+
<TextBlock Text="Archer" Style="{StaticResource JobText}"/>
41+
<TextBlock Text="{Binding SelectedPlayer.Value.ArcherLevel, StringFormat=Lv.{0}}" Style="{StaticResource JobText}"/>
42+
</UniformGrid>
43+
<UniformGrid Rows="1">
44+
<Image Source="../Resources/carrot_on_a_stick.png" Width="64"/>
45+
<TextBlock Text="White Mage" Style="{StaticResource JobText}"/>
46+
<TextBlock Text="{Binding SelectedPlayer.Value.WhiteMageLevel, StringFormat=Lv.{0}}" Style="{StaticResource JobText}"/>
47+
</UniformGrid>
48+
<UniformGrid Rows="1">
49+
<Image Source="../Resources/book.png" Width="64"/>
50+
<TextBlock Text="Black Mage" Style="{StaticResource JobText}"/>
51+
<TextBlock Text="{Binding SelectedPlayer.Value.BlackMageLevel, StringFormat=Lv.{0}}" Style="{StaticResource JobText}"/>
52+
</UniformGrid>
53+
<UniformGrid Rows="1">
54+
<Image Source="../Resources/wolf_spawn_egg.png" Width="64"/>
55+
<TextBlock Text="Summoner" Style="{StaticResource JobText}"/>
56+
<TextBlock Text="{Binding SelectedPlayer.Value.SummonerLevel, StringFormat=Lv.{0}}" Style="{StaticResource JobText}"/>
57+
</UniformGrid>
58+
</UniformGrid>
59+
</Grid>
60+
</UserControl>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using System.Windows;
7+
using System.Windows.Controls;
8+
using System.Windows.Data;
9+
using System.Windows.Documents;
10+
using System.Windows.Input;
11+
using System.Windows.Media;
12+
using System.Windows.Media.Imaging;
13+
using System.Windows.Navigation;
14+
using System.Windows.Shapes;
15+
16+
namespace TUSB_ProgressViewer.Controls
17+
{
18+
/// <summary>
19+
/// DataViewer.xaml の相互作用ロジック
20+
/// </summary>
21+
public partial class DataViewer : UserControl
22+
{
23+
public DataViewer()
24+
{
25+
InitializeComponent();
26+
}
27+
}
28+
}

TUSB_ProgressViewer/Controls/EndSpawnerProgress.xaml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,8 @@
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
55
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
6-
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
7-
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
86
xmlns:behavior="clr-namespace:TUSB_ProgressViewer.Behaviors"
9-
xmlns:vm="clr-namespace:TUSB_ProgressViewer.ViewModels"
10-
mc:Ignorable="d">
11-
<UserControl.DataContext>
12-
<vm:EndSpawnerProgressViewModel/>
13-
</UserControl.DataContext>
7+
xmlns:model="clr-namespace:TUSB_ProgressViewer.Models">
148
<Grid>
159
<ScrollViewer ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility="Auto">
1610
<i:Interaction.Behaviors>
@@ -29,7 +23,7 @@
2923
Height="{Binding ActualHeight, ElementName=map}"
3024
HorizontalAlignment="Center"
3125
VerticalAlignment="Center"
32-
ItemsSource="{Binding Spawners}">
26+
ItemsSource="{Binding Source={x:Static model:SpawnersData.Spawners}}">
3327
<ItemsControl.ItemsPanel>
3428
<ItemsPanelTemplate>
3529
<Grid/>

TUSB_ProgressViewer/Controls/IslandCompleteProgress.xaml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,7 @@
22
x:Class="TUSB_ProgressViewer.Controls.IslandCompleteProgress"
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5-
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6-
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7-
xmlns:local="clr-namespace:TUSB_ProgressViewer.Controls"
8-
xmlns:controls="clr-namespace:TUSB_ProgressViewer.Controls"
9-
xmlns:vm="clr-namespace:TUSB_ProgressViewer.ViewModels"
10-
mc:Ignorable="d">
11-
<UserControl.DataContext>
12-
<vm:IslandCompleteProgressViewModel/>
13-
</UserControl.DataContext>
5+
xmlns:model="clr-namespace:TUSB_ProgressViewer.Models">
146
<Grid>
157
<Grid.ColumnDefinitions>
168
<ColumnDefinition/>
@@ -23,7 +15,7 @@
2315
Height="{Binding ActualHeight, ElementName=map}"
2416
HorizontalAlignment="Center"
2517
VerticalAlignment="Center"
26-
ItemsSource="{Binding Islands}">
18+
ItemsSource="{Binding Source={x:Static model:IslandsData.Islands}}">
2719
<ItemsControl.ItemsPanel>
2820
<ItemsPanelTemplate>
2921
<Grid/>
@@ -32,7 +24,7 @@
3224
</ItemsControl>
3325
</Grid>
3426
<Grid Grid.Column="1" Background="#393939">
35-
<ListBox x:Name="list" ItemsSource="{Binding Islands}" Style="{StaticResource IslandListStyle}">
27+
<ListBox x:Name="list" ItemsSource="{Binding Source={x:Static model:IslandsData.Islands}}" Style="{StaticResource IslandListStyle}">
3628
<ListBox.ItemTemplate>
3729
<DataTemplate>
3830
<Grid>

TUSB_ProgressViewer/Controls/IslandPointer.xaml

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -58,29 +58,5 @@
5858
</Style>
5959
</Path.Style>
6060
</Path>
61-
<!--<Path Stroke="Black" StrokeThickness="3" Fill="Lime">
62-
<Path.Data>
63-
<EllipseGeometry
64-
Center="{Binding Center, ElementName=islandPointer}"
65-
RadiusX="0.01"
66-
RadiusY="0.01">
67-
<EllipseGeometry.Transform>
68-
<ScaleTransform ScaleX="{Binding ActualWidth, ElementName=islandPointer}" ScaleY="{Binding ActualHeight, ElementName=islandPointer}"/>
69-
</EllipseGeometry.Transform>
70-
</EllipseGeometry>
71-
</Path.Data>
72-
<Path.Style>
73-
<Style TargetType="Path">
74-
<Style.Triggers>
75-
<DataTrigger Binding="{Binding IsSelected, ElementName=islandPointer}" Value="True">
76-
<Setter Property="Visibility" Value="Visible"/>
77-
</DataTrigger>
78-
<DataTrigger Binding="{Binding IsSelected, ElementName=islandPointer}" Value="False">
79-
<Setter Property="Visibility" Value="Hidden"/>
80-
</DataTrigger>
81-
</Style.Triggers>
82-
</Style>
83-
</Path.Style>
84-
</Path>-->
8561
</Grid>
8662
</UserControl>

TUSB_ProgressViewer/Models/Coordinate.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,19 @@ namespace TUSB_ProgressViewer.Models
1111
/// </summary>
1212
public class Coordinate
1313
{
14+
/// <summary>
15+
/// X座標
16+
/// </summary>
1417
public int X { get; }
18+
19+
/// <summary>
20+
/// Y座標
21+
/// </summary>
1522
public int Y { get; }
23+
24+
/// <summary>
25+
/// Z座標
26+
/// </summary>
1627
public int Z { get; }
1728

1829
public Coordinate(int x, int y, int z)

TUSB_ProgressViewer/Models/Island.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using OrangeNBT.World.Anvil;
22
using Prism.Mvvm;
3+
using Reactive.Bindings;
34
using System;
45
using System.Collections.Generic;
56
using System.Linq;
@@ -14,6 +15,9 @@ namespace TUSB_ProgressViewer.Models
1415
/// </summary>
1516
public class Island: BindableBase
1617
{
18+
/// <summary>
19+
/// 島タイプ
20+
/// </summary>
1721
public IslandType IslandType { get; }
1822

1923
/// <summary>
@@ -24,12 +28,7 @@ public class Island: BindableBase
2428
/// <summary>
2529
/// 選択フラグ
2630
/// </summary>
27-
public bool IsSelected
28-
{
29-
get => _isSelected;
30-
set => SetProperty(ref _isSelected, value);
31-
}
32-
private bool _isSelected;
31+
public bool IsSelected { get; set; }
3332

3433
public Island(IslandType type, AnvilWorld world)
3534
{
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
using Reactive.Bindings;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
using System.Windows;
8+
using TUSB_ProgressViewer.Controls;
9+
using TUSB_ProgressViewer.Util;
10+
11+
namespace TUSB_ProgressViewer.Models
12+
{
13+
public static class IslandsData
14+
{
15+
/// <summary>
16+
/// 島リスト
17+
/// </summary>
18+
public static ReactiveCollection<IslandPointer> Islands { get; } = new ReactiveCollection<IslandPointer>();
19+
20+
/// <summary>
21+
/// 島攻略数カウント
22+
/// </summary>
23+
public static ReactiveProperty<int> CompletionCount { get; } = new ReactiveProperty<int>();
24+
25+
/// <summary>
26+
/// 島攻略率
27+
/// </summary>
28+
public static ReactiveProperty<double> CompletionRate { get; } = new ReactiveProperty<double>();
29+
30+
/// <summary>
31+
/// 島の数
32+
/// </summary>
33+
private const int islandCount = 50;
34+
35+
/// <summary>
36+
/// 島読み込み
37+
/// </summary>
38+
/// <param name="count"></param>
39+
public static void Load(ref int count)
40+
{
41+
try
42+
{
43+
Islands.ClearOnScheduler();
44+
foreach (IslandType type in Enum.GetValues(typeof(IslandType)))
45+
{
46+
var island = new Island(type, World.WorldData);
47+
48+
// 実際の座標と画像のピクセル数から画像上の島(エンドポータルフレーム)の位置を計算
49+
// 画像のサイズが変わると壊れます()
50+
var X = (island.IslandType.GetCoordinate().X + 221) / 512.0;
51+
var Z = (island.IslandType.GetCoordinate().Z + 237) / 512.0;
52+
53+
// 別ディメンションは特殊な位置なので個別指定
54+
switch (island.IslandType)
55+
{
56+
case IslandType.TheUnderworld:
57+
X = 47 / 256.0;
58+
Z = 234 / 256.0;
59+
break;
60+
case IslandType.TheNether:
61+
X = 128 / 256.0;
62+
Z = 234 / 256.0;
63+
break;
64+
case IslandType.GulliversLand:
65+
X = 183 / 256.0;
66+
Z = 234 / 256.0;
67+
break;
68+
case IslandType.Cloudia:
69+
X = 43 / 256.0;
70+
Z = 246 / 256.0;
71+
break;
72+
case IslandType.TableMountain:
73+
X = 82 / 256.0;
74+
Z = 246 / 256.0;
75+
break;
76+
case IslandType.TocultColde:
77+
X = 157 / 256.0;
78+
Z = 246 / 256.0;
79+
break;
80+
case IslandType.TheEnd:
81+
X = 218 / 256.0;
82+
Z = 246 / 256.0;
83+
break;
84+
}
85+
86+
Application.Current.Dispatcher.Invoke(() =>
87+
{
88+
Islands.Add(new IslandPointer()
89+
{
90+
IslandName = island.IslandType.GetName(),
91+
Center = new Point(X, Z),
92+
IsComplete = island.IsComplete
93+
});
94+
95+
CompletionCount.Value = Islands.Where(x => x.IsComplete).Count();
96+
CompletionRate.Value = (CompletionCount.Value / (double)islandCount) * 100;
97+
});
98+
99+
World.LoadingProgress.Value = (++count / 297.0) * 100;
100+
}
101+
}
102+
catch
103+
{
104+
Reset();
105+
throw;
106+
}
107+
}
108+
109+
/// <summary>
110+
/// データをリセット
111+
/// </summary>
112+
public static void Reset()
113+
{
114+
Islands.ClearOnScheduler();
115+
CompletionCount.Value = 0;
116+
CompletionRate.Value = 0;
117+
}
118+
}
119+
}

0 commit comments

Comments
 (0)