- add turns and vm control
- remove vlc since it doesnt work and takes up like 200mb - enforce light mode temporarily since dark mode breaks everything
This commit is contained in:
parent
349af128ab
commit
08e5821df4
10 changed files with 84 additions and 26 deletions
|
@ -7,8 +7,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CollabVMClient", "CollabVMC
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CollabVMClient.Desktop", "CollabVMClient.Desktop\CollabVMClient.Desktop.csproj", "{8A36CCA1-A1F9-47B4-BA88-4768B6BDC5B9}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CollabVMClient.Desktop", "CollabVMClient.Desktop\CollabVMClient.Desktop.csproj", "{8A36CCA1-A1F9-47B4-BA88-4768B6BDC5B9}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibVLCSharp.Avalonia", "LibVLCSharp.Avalonia\LibVLCSharp.Avalonia.csproj", "{E85E9F2A-5F72-40D1-88BC-21511717BD3E}"
|
|
||||||
EndProject
|
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
@ -23,10 +21,6 @@ Global
|
||||||
{8A36CCA1-A1F9-47B4-BA88-4768B6BDC5B9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{8A36CCA1-A1F9-47B4-BA88-4768B6BDC5B9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{8A36CCA1-A1F9-47B4-BA88-4768B6BDC5B9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{8A36CCA1-A1F9-47B4-BA88-4768B6BDC5B9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{8A36CCA1-A1F9-47B4-BA88-4768B6BDC5B9}.Release|Any CPU.Build.0 = Release|Any CPU
|
{8A36CCA1-A1F9-47B4-BA88-4768B6BDC5B9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{E85E9F2A-5F72-40D1-88BC-21511717BD3E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{E85E9F2A-5F72-40D1-88BC-21511717BD3E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{E85E9F2A-5F72-40D1-88BC-21511717BD3E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{E85E9F2A-5F72-40D1-88BC-21511717BD3E}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<Application xmlns="https://github.com/avaloniaui"
|
<Application xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
x:Class="CollabVMClient.App"
|
x:Class="CollabVMClient.App"
|
||||||
RequestedThemeVariant="Default">
|
RequestedThemeVariant="Light">
|
||||||
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
|
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
|
||||||
|
|
||||||
<Application.Styles>
|
<Application.Styles>
|
||||||
|
|
|
@ -20,21 +20,12 @@
|
||||||
|
|
||||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.4" />
|
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.4" />
|
||||||
<PackageReference Include="LibVLCSharp" Version="3.7.0" />
|
|
||||||
<PackageReference Include="MessageBox.Avalonia" Version="3.1.4" />
|
<PackageReference Include="MessageBox.Avalonia" Version="3.1.4" />
|
||||||
<PackageReference Include="Projektanker.Icons.Avalonia" Version="8.2.0" />
|
<PackageReference Include="Projektanker.Icons.Avalonia" Version="8.2.0" />
|
||||||
<PackageReference Include="Projektanker.Icons.Avalonia.MaterialDesign" Version="8.2.0" />
|
<PackageReference Include="Projektanker.Icons.Avalonia.MaterialDesign" Version="8.2.0" />
|
||||||
<PackageReference Include="SixLabors.ImageSharp" Version="3.0.1" />
|
<PackageReference Include="SixLabors.ImageSharp" Version="3.0.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Condition=" '$(RuntimeIdentifier)' == 'win-x64' Or '$(RuntimeIdentifier)' == 'win-x86' ">
|
|
||||||
<PackageReference Include="VideoLAN.LibVLC.Windows" Version="3.0.18" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\LibVLCSharp.Avalonia\LibVLCSharp.Avalonia.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Update="CollabVMResources.Designer.cs">
|
<Compile Update="CollabVMResources.Designer.cs">
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
using CollabVMClient.ViewModels;
|
using CollabVMClient.ViewModels;
|
||||||
using CollabVMClient.Views;
|
using CollabVMClient.Views;
|
||||||
using CollabVMSharp;
|
using CollabVMSharp;
|
||||||
using LibVLCSharp.Shared;
|
|
||||||
using MsBox.Avalonia;
|
using MsBox.Avalonia;
|
||||||
using SixLabors.ImageSharp;
|
using SixLabors.ImageSharp;
|
||||||
using SixLabors.ImageSharp.Advanced;
|
using SixLabors.ImageSharp.Advanced;
|
||||||
|
@ -42,7 +41,7 @@ namespace CollabVMClient
|
||||||
cvm.UserLeft += Cvm_UserLeft;
|
cvm.UserLeft += Cvm_UserLeft;
|
||||||
cvm.UserRenamed += Cvm_UserRenamed;
|
cvm.UserRenamed += Cvm_UserRenamed;
|
||||||
cvm.TurnUpdate += Cvm_TurnUpdate;
|
cvm.TurnUpdate += Cvm_TurnUpdate;
|
||||||
screen_vm = new CollabVMScreenViewModel(node);
|
screen_vm = new CollabVMScreenViewModel(cvm, node);
|
||||||
screen = new CollabVMScreenView();
|
screen = new CollabVMScreenView();
|
||||||
screen.DataContext = screen_vm;
|
screen.DataContext = screen_vm;
|
||||||
chat = new CollabVMChatView();
|
chat = new CollabVMChatView();
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using LibVLCSharp.Shared;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
|
|
@ -13,18 +13,29 @@ using SixLabors.ImageSharp.Processing;
|
||||||
using Avalonia.Media;
|
using Avalonia.Media;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using CollabVMSharp;
|
||||||
|
|
||||||
namespace CollabVMClient.ViewModels
|
namespace CollabVMClient.ViewModels
|
||||||
{
|
{
|
||||||
internal partial class CollabVMScreenViewModel : ViewModelBase
|
internal partial class CollabVMScreenViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
|
private CollabVMSharp.CollabVMClient cvm;
|
||||||
public WriteableBitmap Framebuffer { get; set; }
|
public WriteableBitmap Framebuffer { get; set; }
|
||||||
[ObservableProperty] private string id;
|
[ObservableProperty] private string id;
|
||||||
[ObservableProperty] private int width;
|
[ObservableProperty] private int width;
|
||||||
[ObservableProperty] private int height;
|
[ObservableProperty] private int height;
|
||||||
|
[ObservableProperty] private int windowHeight;
|
||||||
|
[ObservableProperty] private string toggleTurnBtnText = "Take Turn";
|
||||||
|
|
||||||
public string Title => $"CollabVM - Screen ({id})";
|
public string Title => $"CollabVM - Screen ({id})";
|
||||||
public CollabVMScreenViewModel(string id)
|
public CollabVMScreenViewModel(CollabVMSharp.CollabVMClient cvm, string id)
|
||||||
{
|
{
|
||||||
|
this.cvm = cvm;
|
||||||
|
cvm.TurnUpdate += (_, _) =>
|
||||||
|
{
|
||||||
|
if (cvm.TurnStatus == TurnStatus.None) ToggleTurnBtnText = "Take Turn";
|
||||||
|
else ToggleTurnBtnText = "End Turn";
|
||||||
|
};
|
||||||
this.Id = id;
|
this.Id = id;
|
||||||
Framebuffer = new WriteableBitmap(new Avalonia.PixelSize(1, 1), new Avalonia.Vector(1, 1));
|
Framebuffer = new WriteableBitmap(new Avalonia.PixelSize(1, 1), new Avalonia.Vector(1, 1));
|
||||||
}
|
}
|
||||||
|
@ -32,6 +43,7 @@ namespace CollabVMClient.ViewModels
|
||||||
{
|
{
|
||||||
this.Width = width;
|
this.Width = width;
|
||||||
this.Height = height;
|
this.Height = height;
|
||||||
|
this.WindowHeight = height + 34;
|
||||||
Framebuffer = new WriteableBitmap(new Avalonia.PixelSize(width, height), new Avalonia.Vector(96.0f, 96.0f), PixelFormat.Rgba8888);
|
Framebuffer = new WriteableBitmap(new Avalonia.PixelSize(width, height), new Avalonia.Vector(96.0f, 96.0f), PixelFormat.Rgba8888);
|
||||||
}
|
}
|
||||||
public void LoadRect(byte[] rect, int width, int height, int x, int y)
|
public void LoadRect(byte[] rect, int width, int height, int x, int y)
|
||||||
|
@ -47,5 +59,16 @@ namespace CollabVMClient.ViewModels
|
||||||
l.Dispose();
|
l.Dispose();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ToggleTurn()
|
||||||
|
{
|
||||||
|
cvm.Turn(cvm.TurnStatus == TurnStatus.None);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void MoveMouse(int x, int y) => cvm.MoveMouse(x, y);
|
||||||
|
|
||||||
|
public void MouseBtn(MouseButton btn, bool down) => cvm.MouseBtn(btn, down);
|
||||||
|
|
||||||
|
public bool CanToggleTurn() => true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:av="clr-namespace:TheArtOfDev.HtmlRenderer.Avalonia;assembly=Avalonia.HtmlRenderer"
|
xmlns:av="clr-namespace:TheArtOfDev.HtmlRenderer.Avalonia;assembly=Avalonia.HtmlRenderer"
|
||||||
xmlns:i="https://github.com/projektanker/icons.avalonia"
|
xmlns:i="https://github.com/projektanker/icons.avalonia"
|
||||||
xmlns:vlc="clr-namespace:LibVLCSharp.Avalonia;assembly=LibVLCSharp.Avalonia"
|
|
||||||
mc:Ignorable="d" d:DesignWidth="400" d:DesignHeight="800"
|
mc:Ignorable="d" d:DesignWidth="400" d:DesignHeight="800"
|
||||||
x:Class="CollabVMClient.Views.CollabVMChatView"
|
x:Class="CollabVMClient.Views.CollabVMChatView"
|
||||||
Title="{Binding Title}"
|
Title="{Binding Title}"
|
||||||
|
@ -26,7 +26,6 @@
|
||||||
<i:Icon Value="mdi-send" FontSize="25" Foreground="LightGray"/>
|
<i:Icon Value="mdi-send" FontSize="25" Foreground="LightGray"/>
|
||||||
</Button>
|
</Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<vlc:VideoView MediaPlayer="{Binding Player}" IsVisible="False"/>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
</Window>
|
</Window>
|
||||||
|
|
|
@ -5,6 +5,16 @@
|
||||||
mc:Ignorable="d" d:DesignWidth="1024" d:DesignHeight="768"
|
mc:Ignorable="d" d:DesignWidth="1024" d:DesignHeight="768"
|
||||||
x:Class="CollabVMClient.Views.CollabVMScreenView"
|
x:Class="CollabVMClient.Views.CollabVMScreenView"
|
||||||
Title="{Binding Title}"
|
Title="{Binding Title}"
|
||||||
Width="{Binding Width}" Height="{Binding Height}" CanResize="False">
|
Width="{Binding Width}" Height="{Binding WindowHeight}" CanResize="False">
|
||||||
|
<StackPanel Orientation="Vertical">
|
||||||
|
<DockPanel>
|
||||||
|
<Menu DockPanel.Dock="Top" Height="34">
|
||||||
|
<MenuItem Header="_CollabVM">
|
||||||
|
<MenuItem Header="{Binding ToggleTurnBtnText}" Command="{Binding ToggleTurn}"/>
|
||||||
|
<MenuItem Header="Exit" Name="exit"/>
|
||||||
|
</MenuItem>
|
||||||
|
</Menu>
|
||||||
|
</DockPanel>
|
||||||
<Image Name="screen" Source="{Binding Framebuffer}" Width="{Binding Width}" Height="{Binding Height}"/>
|
<Image Name="screen" Source="{Binding Framebuffer}" Width="{Binding Width}" Height="{Binding Height}"/>
|
||||||
|
</StackPanel>
|
||||||
</Window>
|
</Window>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using CollabVMClient.ViewModels;
|
using CollabVMClient.ViewModels;
|
||||||
|
using CollabVMSharp;
|
||||||
|
|
||||||
namespace CollabVMClient.Views
|
namespace CollabVMClient.Views
|
||||||
{
|
{
|
||||||
|
@ -8,6 +9,46 @@ namespace CollabVMClient.Views
|
||||||
public CollabVMScreenView()
|
public CollabVMScreenView()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
this.exit.Click += Exit_Click;
|
||||||
|
screen.PointerMoved += Screen_PointerMoved;
|
||||||
|
screen.PointerPressed += Screen_PointerPressed;
|
||||||
|
screen.PointerReleased += Screen_PointerReleased;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Screen_PointerReleased(object? sender, Avalonia.Input.PointerReleasedEventArgs e)
|
||||||
|
{
|
||||||
|
MouseButton btn = e.InitialPressMouseButton switch
|
||||||
|
{
|
||||||
|
Avalonia.Input.MouseButton.Left => MouseButton.Left,
|
||||||
|
Avalonia.Input.MouseButton.Right => MouseButton.Right,
|
||||||
|
Avalonia.Input.MouseButton.Middle => MouseButton.Middle,
|
||||||
|
_ => (MouseButton)(-1)
|
||||||
|
};
|
||||||
|
if (btn == (MouseButton)(-1)) return;
|
||||||
|
var dc = DataContext as CollabVMScreenViewModel;
|
||||||
|
dc.MouseBtn(btn, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Screen_PointerPressed(object? sender, Avalonia.Input.PointerPressedEventArgs e)
|
||||||
|
{
|
||||||
|
var dc = DataContext as CollabVMScreenViewModel;
|
||||||
|
// We can't see specifically which button was pressed, so just send every currently pressed button
|
||||||
|
var point = e.GetCurrentPoint(screen);
|
||||||
|
if (point.Properties.IsLeftButtonPressed) dc.MouseBtn(MouseButton.Left, true);
|
||||||
|
if (point.Properties.IsMiddleButtonPressed) dc.MouseBtn(MouseButton.Middle, true);
|
||||||
|
if (point.Properties.IsRightButtonPressed) dc.MouseBtn(MouseButton.Right, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Screen_PointerMoved(object? sender, Avalonia.Input.PointerEventArgs e)
|
||||||
|
{
|
||||||
|
var dc = DataContext as CollabVMScreenViewModel;
|
||||||
|
var point = e.GetCurrentPoint(screen);
|
||||||
|
dc.MoveMouse((int)point.Position.X, (int)point.Position.Y);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Exit_Click(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RefreshScreen()
|
public void RefreshScreen()
|
||||||
|
|
|
@ -3,12 +3,14 @@
|
||||||
xmlns:vm="using:CollabVMClient.ViewModels"
|
xmlns:vm="using:CollabVMClient.ViewModels"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:av="clr-namespace:TheArtOfDev.HtmlRenderer.Avalonia;assembly=Avalonia.HtmlRenderer"
|
||||||
xmlns:views="clr-namespace:CollabVMClient.Views"
|
xmlns:views="clr-namespace:CollabVMClient.Views"
|
||||||
mc:Ignorable="d" d:DesignWidth="400" d:DesignHeight="800"
|
mc:Ignorable="d" d:DesignWidth="400" d:DesignHeight="800"
|
||||||
x:Class="CollabVMClient.Views.MainWindow"
|
x:Class="CollabVMClient.Views.MainWindow"
|
||||||
Icon="/Assets/avalonia-logo.ico"
|
Icon="/Assets/avalonia-logo.ico"
|
||||||
Title="CollabVM - Server List"
|
Title="CollabVM - Server List"
|
||||||
Width="400" Height="800" CanResize="False">
|
Width="400" Height="800" CanResize="False"
|
||||||
|
Foreground="Black" Background="White">
|
||||||
<Window.Styles>
|
<Window.Styles>
|
||||||
|
|
||||||
</Window.Styles>
|
</Window.Styles>
|
||||||
|
|
Loading…
Reference in a new issue