Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Knossos.NET/Models/Nebula.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using Knossos.NET.Classes;
using System.Threading;
using System.Security.Cryptography;
using Knossos.NET.Views;

namespace Knossos.NET.Models
{
Expand Down Expand Up @@ -1315,6 +1316,11 @@ public static async Task<bool> IsModEditable(string id)
{ new StringContent(modid), "mid" }
};

if (!userIsLoggedIn){

return null;
}

var reply = await ApiCall("mod/team/fetch", data, true);
if (reply.HasValue)
{
Expand All @@ -1338,7 +1344,7 @@ public static async Task<bool> IsModEditable(string id)
}
else
{
Log.Add(Log.LogSeverity.Error, "Nebula.GetTeamMembers", "Unable to check if mod team members.");
Log.Add(Log.LogSeverity.Error, "Nebula.GetTeamMembers", "Unable to check if this mod has team members.");
}
}
catch (Exception ex)
Expand Down
33 changes: 21 additions & 12 deletions Knossos.NET/ViewModels/Templates/DevModMembersMgrViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ internal void Delete()
internal bool buttonsEnabled = true;
[ObservableProperty]
internal bool loading = true;
[ObservableProperty]
internal bool showLoginError = false;

public DevModMembersMgrViewModel()
{
Expand All @@ -101,21 +103,28 @@ public async void UpdateUI()
{
if (editor != null && !MemberItems.Any())
{
var members = await Nebula.GetTeamMembers(editor.ActiveVersion.id).ConfigureAwait(false);
Dispatcher.UIThread.Invoke(() =>
{
if (members != null)
if (Nebula.userIsLoggedIn) {
ButtonsEnabled = true;
ShowLoginError = false;
var members = await Nebula.GetTeamMembers(editor.ActiveVersion.id).ConfigureAwait(false);
Dispatcher.UIThread.Invoke(() =>
{
foreach (var member in members)
if (members != null)
{
MemberItems.Add(new MemberItem(member, this));
foreach (var member in members)
{
MemberItems.Add(new MemberItem(member, this));
}
}
}
else
{
_ = MessageBox.Show(MainWindow.instance!, "An error has ocurred while retrieving the mod member list. The log may provide more information.", "Error", MessageBox.MessageBoxButtons.OK);
}
});
else
{
_ = MessageBox.Show(MainWindow.instance!, "An error has ocurred while retrieving the mod member list. The log may provide more information.", "Error", MessageBox.MessageBoxButtons.OK);
}
});
} else {
ButtonsEnabled = false;
ShowLoginError = true;
}
}
Dispatcher.UIThread.Invoke(() =>
{
Expand Down
11 changes: 6 additions & 5 deletions Knossos.NET/Views/DeveloperModsView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<ScrollViewer HorizontalScrollBarVisibility="Visible">
<TabControl Margin="10" SelectedIndex="{Binding TabIndex}">
<TabItem Header="Mods">
<SplitView MinWidth="1000" Margin="0,0,0,5" IsPaneOpen="True" DisplayMode="Inline" OpenPaneLength="350">
<SplitView MinWidth="1000" Margin="0,0,0,5" IsPaneOpen="True" DisplayMode="CompactInline" CompactPaneLength="100" OpenPaneLength="300">
<SplitView.Pane>
<Grid RowDefinitions="Auto,*,Auto,Auto,Auto">

Expand All @@ -35,14 +35,15 @@
</ListBox.ItemTemplate>
</ListBox>

<Button Command="{Binding InstallLatestStable}" Grid.Row="3" Margin="0,10,0,10" HorizontalAlignment="Center" IsEnabled="{Binding !StableInstalled}" IsVisible="{Binding !StableInstalled}" >Get Latest Stable Build</Button>
<Button Command="{Binding InstallLatestNightly}" Grid.Row="4" Margin="0,0,0,10" HorizontalAlignment="Center" IsEnabled="{Binding !NightlyInstalled}" IsVisible="{Binding !NightlyInstalled}" >Get Latest Nightly Build</Button>
<Button Command="{Binding InstallLatestStable}" Grid.Row="3" Margin="0,20,0,10" HorizontalAlignment="Center" IsEnabled="{Binding !StableInstalled}" IsVisible="{Binding !StableInstalled}" >Get Latest Stable Build</Button>
<Button Command="{Binding InstallLatestNightly}" Grid.Row="4" Margin="0,10,0,10" HorizontalAlignment="Center" IsEnabled="{Binding !NightlyInstalled}" IsVisible="{Binding !NightlyInstalled}" >Get Latest Nightly Build</Button>

</Grid>
</SplitView.Pane>

<v:DevModEditorView Content="{Binding ModEditor}"/>

<SplitView.Content>
<v:DevModEditorView Content="{Binding ModEditor}"/>
</SplitView.Content>
</SplitView>
</TabItem>

Expand Down
67 changes: 33 additions & 34 deletions Knossos.NET/Views/Templates/DevModDetailsView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
<ScrollViewer>
<StackPanel Margin="10,5,0,0">
<!--Convenience Save button-->
<Button Command="{Binding Save}" Classes="Accept" HorizontalAlignment="Center" Margin="5">Save Changes</Button>
<Button Command="{Binding Save}" Classes="Accept" HorizontalAlignment="Center" Width="160" Margin="5">Save Changes</Button>

<!--NAME-->
<WrapPanel HorizontalAlignment="Left">
<Label Width="150" Margin="5" FontWeight="Bold" HorizontalContentAlignment="Right" FontSize="18">Name</Label>
<TextBox MinWidth="280" Text="{Binding ModName}" Margin="5"></TextBox>
<TextBox MinWidth="480" Text="{Binding ModName}" Margin="5"></TextBox>
</WrapPanel>
<!--ID-->
<WrapPanel HorizontalAlignment="Left">
Expand All @@ -41,57 +41,57 @@
<WrapPanel HorizontalAlignment="Left">
<Label Width="150" HorizontalContentAlignment="Right" Margin="5" FontWeight="Bold" FontSize="18">Description</Label>
<StackPanel MinWidth="280" MaxWidth="600">
<TextBox TextWrapping="Wrap" Height="200" Text="{Binding ModDescription}" Margin="5"></TextBox>
<Button Command="{Binding OpenDescriptionEditor}" Classes="Quaternary" Margin="5">Open Editor</Button>
<TextBox TextWrapping="Wrap" Width="480" Height="200" Text="{Binding ModDescription}" Margin="5"></TextBox>
</StackPanel>
</WrapPanel>
<Button HorizontalAlignment="Center" Command="{Binding OpenDescriptionEditor}" Classes="Quaternary" Margin="5,5,5,20">Open Editor</Button>
<!--FORUM-->
<WrapPanel HorizontalAlignment="Left">
<WrapPanel HorizontalAlignment="Left" Margin="0,0,0,20">
<Label Width="150" HorizontalContentAlignment="Right" Margin="5" FontWeight="Bold" FontSize="18">Release Thread</Label>
<TextBox MinWidth="280" Text="{Binding ModForumLink}" Margin="5"></TextBox>
<TextBox Width="480" Text="{Binding ModForumLink}" Margin="5"></TextBox>
</WrapPanel>
<!--Videos-->
<WrapPanel HorizontalAlignment="Left">
<Label Width="150" HorizontalContentAlignment="Right" Margin="5" FontWeight="Bold" FontSize="18">Youtube Videos</Label>
<StackPanel MinWidth="280">
<TextBox Height="125" Text="{Binding ModVideos}" Margin="5"></TextBox>
<Label Margin="5" Foreground="Yellow" FontSize="12">One link per line</Label>
<WrapPanel HorizontalAlignment="Left" Margin="0,0,0,20">
<StackPanel>
<Label Width="150" HorizontalContentAlignment="Right" Margin="5" FontWeight="Bold" FontSize="18">Youtube Videos</Label>
<TextBlock HorizontalAlignment="Right" Margin="20,10,0,5" Foreground="Gray" FontSize="12" TextWrapping="Wrap">One video link per line</TextBlock>
</StackPanel>
<StackPanel>
<TextBox Height="400" Width="480" Text="{Binding ModVideos}" Margin="5"></TextBox>
</StackPanel>
</WrapPanel>
<!--Tile Image-->
<WrapPanel HorizontalAlignment="Left" Margin="20,0,0,0">
<Label HorizontalContentAlignment="Right" FontWeight="Bold" FontSize="18">Title Image</Label>
<StackPanel MinWidth="225">
<Border Width="152" Height="227" BorderBrush="Gray" CornerRadius="2" BorderThickness="1">
<Image Width="150" Height="225" Source="{Binding TileImage}"></Image>
</Border>
<Label Margin="5,5,0,0" HorizontalAlignment="Center" Foreground="Yellow" FontSize="12">This image should be 150×225 pixels large, 300KB max.</Label>
<WrapPanel HorizontalAlignment="Left">
<StackPanel>
<Label Width="150" HorizontalContentAlignment="Right" Margin="5" FontWeight="Bold" FontSize="18">Title Image</Label>
<TextBlock Margin="30,10,0,0" Width="150" HorizontalAlignment="Right" Foreground="Gray" FontSize="12" TextWrapping="Wrap">This image should be 150×225 pixels large, 300KB max.</TextBlock>
</StackPanel>
<Border Width="152" Height="227" HorizontalAlignment="Center" BorderBrush="Gray" CornerRadius="2" BorderThickness="1" Margin="140,0,0,0">
<Image Width="150" Height="225" HorizontalAlignment="Center" Source="{Binding TileImage}"></Image>
</Border>
</WrapPanel>
<WrapPanel Margin="160,0,0,0">
<Button Command="{Binding ChangeTileImage}" Width="100" Classes="Quaternary" Margin="5">Browse</Button>
<Button Command="{Binding RemoveTileImage}" Width="100" Classes="Cancel" Margin="5">Remove</Button>
</WrapPanel>
<Button HorizontalAlignment="Center" Command="{Binding ChangeTileImage}" Width="100" Classes="Quaternary" Margin="5">Browse</Button>
<Button HorizontalAlignment="Center" Command="{Binding RemoveTileImage}" Width="100" Classes="Cancel" Margin="5,5,5,20">Remove</Button>
<!--Banner Image-->
<WrapPanel HorizontalAlignment="Left">
<Label Width="150" HorizontalContentAlignment="Right" Margin="5" FontWeight="Bold" FontSize="18">Banner Image</Label>
<StackPanel Width="150">
<Label HorizontalContentAlignment="Right" Margin="5" FontWeight="Bold" FontSize="18">Banner Image</Label>
<TextBlock HorizontalAlignment="Center" Margin="30,10,0,0" Foreground="Gray" FontSize="12" TextWrapping="Wrap">This image should be 1070x300 pixels large. 10MB max, 1MB or less recommended. APNG is supported.</TextBlock>
</StackPanel>
<StackPanel HorizontalAlignment="Left" MinWidth="300">
<Border Margin="45,5,5,5" BorderBrush="Gray" CornerRadius="2" BorderThickness="1">
<Border Margin="5,5,5,5" BorderBrush="Gray" CornerRadius="2" BorderThickness="1">
<Image Width="535" Height="150" Source="{Binding BannerImage}"></Image>
</Border>
<Label HorizontalAlignment="Center" Margin="0,5,0,0" Foreground="Yellow" FontSize="12">This image should be 1070x300 pixels large. 10MB max, 1MB or less recommended. APNG is supported.</Label>
<WrapPanel HorizontalAlignment="Center">
<Button Command="{Binding ChangeBannerImage}" Width="100" Classes="Quaternary" Margin="5">Browse</Button>
<Button Command="{Binding RemoveBannerImage}" Width="100" Classes="Cancel" Margin="5">Remove</Button>
</WrapPanel>
</StackPanel>
</WrapPanel>
<Button HorizontalAlignment="Center" Command="{Binding ChangeBannerImage}" Width="100" Classes="Quaternary" Margin="5">Browse</Button>
<Button HorizontalAlignment="Center" Command="{Binding RemoveBannerImage}" Width="100" Classes="Cancel" Margin="5,5,5,20">Remove</Button>
<!--Screenshots-->
<WrapPanel Margin="0,15,0,0" HorizontalAlignment="Left">
<Label Width="150" VerticalAlignment="Center" Margin="5" FontWeight="Bold" FontSize="18">Screenshots</Label>
<Button Command="{Binding NewScreenShot}" Classes="Option" Margin="10">Add</Button>
<Label HorizontalAlignment="Left" Margin="5,0,0,0" FontSize="12">These images will be displayed at 640x360 (16:9). 10MB max, 1MB or less recommended. APNG is supported.</Label>
</WrapPanel>
<Label HorizontalAlignment="Left" Margin="5,0,0,0" Foreground="Yellow" FontSize="12">This images will be displayed at 640x360 (16:9). 10MB max, 1MB or less recommended. APNG is supported.</Label>
<Button HorizontalAlignment="Center" Command="{Binding NewScreenShot}" Classes="Option" Width="100" Margin="10">Add</Button>
<StackPanel>
<ListBox ItemsSource="{Binding Screenshots}" Margin="5,0,0,0">
<ListBox.ItemTemplate>
Expand All @@ -102,14 +102,13 @@
<Button Command="{Binding ScDel}" Classes="Cancel">
<Image Height="14" Width="14" Source="/Assets/general/x.png"></Image>
</Button>
<Image Margin="5,0,0,0" Width="320" Height="180" Source="{Binding Bitmap}"></Image>
<Image Margin="5,0,0,0" Width="640" Height="360" Source="{Binding Bitmap}"></Image>
</WrapPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
<Button Command="{Binding Save}" Classes="Accept" HorizontalAlignment="Center" Margin="5">Save Changes</Button>
<Button Width="150" Command="{Binding Save}" Classes="Accept" HorizontalAlignment="Center" Margin="5">Save Changes</Button>
</StackPanel>
</ScrollViewer>

</UserControl>
6 changes: 3 additions & 3 deletions Knossos.NET/Views/Templates/DevModEditorView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
</Design.DataContext>

<Grid ColumnDefinitions="Auto,*">
<ScrollViewer Width="190" Grid.Column="0">
<ScrollViewer Width="190" Margin="10,0,0,0" Grid.Column="0">
<StackPanel Width="190" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<TextBlock HorizontalAlignment="Center" Text="{Binding Name}" FontSize="14" FontWeight="Bold" TextWrapping="Wrap" Margin="0"></TextBlock>
<Image HorizontalAlignment="Center" Margin="10" Source="{Binding ModImage}" Width="150" Height="225"></Image>
<TextBlock HorizontalAlignment="Center" Text="{Binding Name}" TextAlignment="Center" FontSize="14" FontWeight="Bold" TextWrapping="Wrap" Margin="0"></TextBlock>
<Image HorizontalAlignment="Center" Margin="10,10,5,10" Source="{Binding ModImage}" Width="150" Height="225"></Image>
<TextBlock HorizontalAlignment="Center" Text="Active Version" FontWeight="Bold" FontSize="14" TextWrapping="Wrap" Margin="0"></TextBlock>
<TextBlock HorizontalAlignment="Center" Text="{Binding Version}" FontSize="14" TextWrapping="Wrap" Margin="0"></TextBlock>
<!--MODS-->
Expand Down
3 changes: 3 additions & 0 deletions Knossos.NET/Views/Templates/DevModMembersMgrView.cs.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<TextBlock Margin="20" Width="400" TextWrapping="Wrap" IsEnabled="{Binding ShowLoginError}" FontSize="20" Foreground="Red">
You must be logged in to Nebula to manage your mod development team.
</TextBlock>
</StackPanel>
</ScrollViewer>

Expand Down
26 changes: 13 additions & 13 deletions Knossos.NET/Views/Templates/DevModVersionsView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<Grid RowDefinitions="*,Auto,Auto,Auto">
<Grid ZIndex="1" Grid.Row="0" RowDefinitions="Auto,*, Auto, Auto" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<WrapPanel IsEnabled="{Binding ButtonsEnabled}" Grid.Row="0" Margin="10" HorizontalAlignment="Center">
<Button Classes="Primary" Content="New Version" x:Name="CreateVersion">
<Button Classes="Primary" Content="Create New Version" Margin="10,0,0,0" Width="200" x:Name="CreateVersion">
<Button.Flyout>
<Flyout>
<StackPanel>
Expand All @@ -29,11 +29,11 @@
</Flyout>
</Button.Flyout>
</Button>
<Button Command="{Binding LoadVersionsFromNebula}" Classes="Settings" Margin="20,0,0,0">Install or Modify</Button>
<Button Command="{Binding DeleteAll}" Classes="Cancel" Margin="20,0,0,0">Delete Mod</Button>
<Button Command="{Binding CreateDevEnv}" IsVisible="{Binding !ModHasDevEnvVersion}" Classes="Primary" Margin="20,0,0,0" Width="200">Create Developer Version</Button>
</WrapPanel>
<WrapPanel HorizontalAlignment="Center" Grid.Row="0" Margin="10,45,10,10">
<Button Command="{Binding CreateDevEnv}" IsVisible="{Binding !ModHasDevEnvVersion}" Classes="Quaternary" Margin="0,0,190,0">Create DevEnv Version</Button>
<WrapPanel HorizontalAlignment="Center" Grid.Row="0" Margin="10,50,10,10">
<Button Command="{Binding LoadVersionsFromNebula}" Classes="Quaternary" Margin="10,0,0,0" Width="200" ToolTip.Tip="Install a new version of a developed mod from Nebula. Local installation of development mods should not be modified. Package addition and removal for testing can be handled in the packages tab.">Install Locally</Button>
<Button Command="{Binding DeleteAll}" Classes="Cancel" Margin="20,0,0,0" Width="200">Delete All Local Versions</Button>
</WrapPanel>
<ListBox Background="{StaticResource BackgroundColorSecondary}" IsEnabled="{Binding ButtonsEnabled}" Margin="10,0,10,10" Grid.Row="1" ItemsSource="{Binding Mods}" SelectedIndex="{Binding SelectedIndex}" HorizontalAlignment="Stretch" MinHeight="180">
<ListBox.ItemTemplate>
Expand All @@ -48,15 +48,15 @@
</ListBox.ItemTemplate>
</ListBox>
</Grid>
<Label Grid.Row="1" Margin="0,0,0,0" HorizontalAlignment="Center">Actions for Active Version</Label>
<WrapPanel Grid.Row="2" Margin="0,4,0,0" HorizontalAlignment="Center" IsEnabled="{Binding ButtonsEnabled}">
<Button Width="146" Margin="0,0,20,0" IsVisible="{Binding !IsDevEnvVersion}" Command="{Binding UploadMod}" Classes="Settings">Upload to Nebula</Button>
<Button Width="146" IsVisible="{Binding !IsDevEnvVersion}" Command="{Binding UploadModAdvanced}" Classes="Secondary">Advanced Upload</Button>
<Button IsVisible="{Binding !IsDevEnvVersion}" Command="{Binding ChangeVisibility}" Content="{Binding VisibilityButtonText}" Classes="Settings" Margin="24,0,0,0"/>
<Label Grid.Row="1" Margin="0,0,0,0" HorizontalAlignment="Center">Actions to Apply to Active Version</Label>
<WrapPanel Grid.Row="2" Margin="0,5,0,0" HorizontalAlignment="Center" IsEnabled="{Binding ButtonsEnabled}">
<Button Width="150" Margin="0,0,0,0" IsVisible="{Binding !IsDevEnvVersion}" Command="{Binding UploadMod}" Classes="Primary">Upload to Nebula</Button>
<Button Width="150" Margin="20,0,0,0" IsVisible="{Binding !IsDevEnvVersion}" Command="{Binding UploadModAdvanced}" Classes="Secondary">Advanced Upload</Button>
<Button IsVisible="{Binding !IsDevEnvVersion}" Command="{Binding ChangeVisibility}" Content="{Binding VisibilityButtonText}" Classes="Primary" Width="150" Margin="20,0,0,0"/>
</WrapPanel>
<WrapPanel Grid.Row="3" Margin="0,8,0,0" HorizontalAlignment="Center" IsEnabled="{Binding ButtonsEnabled}">
<Button IsVisible="{Binding !IsDevEnvVersion}" Command="{Binding DeleteNebula}" Classes="Cancel" Margin="0,0,5,0">Delete from Nebula</Button>
<Button Command="{Binding DeleteLocally}" Classes="Cancel" Margin="18,0,0,0">Delete Locally</Button>
<WrapPanel Grid.Row="3" Margin="0,10,0,0" HorizontalAlignment="Center" IsEnabled="{Binding ButtonsEnabled}">
<Button IsVisible="{Binding !IsDevEnvVersion}" Command="{Binding DeleteNebula}" Classes="Cancel" Width="150" Margin="0,0,0,0">Delete from Nebula</Button>
<Button Command="{Binding DeleteLocally}" Classes="Cancel" Margin="20,0,0,0" Width="150">Delete Locally</Button>
</WrapPanel>
</Grid>

Expand Down