Skip to content

Commit

Permalink
- Added DataBinding sample to Unreal
Browse files Browse the repository at this point in the history
- Updated Scoreboard sample in Unreal to show the same list of players as in Blend
  • Loading branch information
s-fernandez-v committed Nov 2, 2020
1 parent 2888b16 commit 919fb02
Show file tree
Hide file tree
Showing 65 changed files with 841 additions and 2,868 deletions.
58 changes: 37 additions & 21 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,27 +57,6 @@ Content/Extending/Release
Content/Application/Debug
Content/Application/Release

Content/DataBinding/Unity/obj
Content/DataBinding/Unity/Library
Content/DataBinding/Unity/*.sln
Content/DataBinding/Unity/*.csproj
Content/DataBinding/C++/Debug
Content/DataBinding/C++/Release

Content/Commands/Unity/obj
Content/Commands/Unity/Library
Content/Commands/Unity/*.sln
Content/Commands/Unity/*.csproj
Content/Commands/C++/Debug
Content/Commands/C++/Release

Content/Touch/Unity/obj
Content/Touch/Unity/Library
Content/Touch/Unity/*.sln
Content/Touch/Unity/*.csproj
Content/Touch/C++/Debug
Content/Touch/C++/Release

Samples/ActionBar/Unity/Unity.*
Samples/ActionBar/Unity/Library
Samples/ActionBar/Unity/Temp
Expand Down Expand Up @@ -121,6 +100,32 @@ Samples/Buttons/Unity/Blend/Buttons/bin/
Samples/Buttons/Unity/Blend/Buttons/obj/
Samples/Buttons/Unity/Assets/NoesisGUI/Settings*

Samples/Commands/Unity/Unity.*
Samples/Commands/Unity/Library/
Samples/Commands/Unity/Temp/
Samples/Commands/Unity/Assets/NoesisGUI/Theme*
Samples/Commands/Unity/UnityPackageManager/
Samples/Commands/Unity/ProjectSettings/*
!Samples/Commands/Unity/ProjectSettings/InputManager.asset
Samples/Commands/Unity/packages/
Samples/Commands/Unity/Blend/Commands/bin/
Samples/Commands/Unity/Blend/Commands/obj/
Samples/Commands/Unity/Assets/NoesisGUI/Settings*
Samples/Commands/Unity/Assets/Resources/NoesisSettings*

Samples/DataBinding/Unity/Unity.*
Samples/DataBinding/Unity/Library/
Samples/DataBinding/Unity/Temp/
Samples/DataBinding/Unity/Assets/NoesisGUI/Theme*
Samples/DataBinding/Unity/UnityPackageManager/
Samples/DataBinding/Unity/ProjectSettings/*
!Samples/DataBinding/Unity/ProjectSettings/InputManager.asset
Samples/DataBinding/Unity/packages/
Samples/DataBinding/Unity/Blend/DataBinding/bin/
Samples/DataBinding/Unity/Blend/DataBinding/obj/
Samples/DataBinding/Unity/Assets/NoesisGUI/Settings*
Samples/DataBinding/Unity/Assets/Resources/NoesisSettings*

Samples/Gallery/Unity/Unity.*
Samples/Gallery/Unity/Unity.*
Samples/Gallery/Unity/Library/
Expand Down Expand Up @@ -246,3 +251,14 @@ Samples/SciFi/Unity/Blend/SciFi/obj/
Samples/SciFi/Unity/Blend/NorthGame/bin/
Samples/SciFi/Unity/Blend/NorthGame/obj/
Samples/SciFi/Unity/Assets/NoesisGUI/Settings*

Samples/Touch/Unity/Unity.*
Samples/Touch/Unity/Library/
Samples/Touch/Unity/Temp/
Samples/Touch/Unity/UnityPackageManager/
Samples/Touch/Unity/ProjectSettings/*
!Samples/Touch/Unity/ProjectSettings/InputManager.asset
Samples/Touch/Unity/packages/
Samples/Touch/Unity/Blend/Touch/bin/
Samples/Touch/Unity/Blend/Touch/obj/
Samples/Touch/Unity/Assets/NoesisGUI/Settings*
6 changes: 6 additions & 0 deletions Samples/DataBinding/UE4/Assets/DataBinding/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
</startup>
</configuration>
10 changes: 10 additions & 0 deletions Samples/DataBinding/UE4/Assets/DataBinding/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Application x:Class="DataBinding.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:DataBinding"
StartupUri="MainWindow.xaml">

<Application.Resources>
</Application.Resources>

</Application>
18 changes: 18 additions & 0 deletions Samples/DataBinding/UE4/Assets/DataBinding/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System.Windows;

namespace DataBinding
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
public App()
{
Activated += (s, e) =>
{
MainWindow.DataContext = new SolarSystem();
};
}
}
}
108 changes: 108 additions & 0 deletions Samples/DataBinding/UE4/Assets/DataBinding/DataBinding-blend.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{3FAAEED8-A33B-4F4D-9CB9-00C911A4EFBA}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DataBinding</RootNamespace>
<AssemblyName>DataBinding</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<Compile Include="ViewModel.cs" />
<Compile Include="OrbitConverter.cs" />
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<Link>Properties/AssemblyInfo.cs</Link>
<SubType>Code</SubType>
</Compile>
<AppDesigner Include="Properties\" />
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Resource Include="Roboto-Regular.ttf" />
<Resource Include="Roboto-Bold.ttf" />
<Resource Include="Images\earglobe.jpg" />
<Resource Include="Images\jupglobe.jpg" />
<Resource Include="Images\marglobe.jpg" />
<Resource Include="Images\merglobe.jpg" />
<Resource Include="Images\moons_2.jpg" />
<Resource Include="Images\nepglobe.jpg" />
<Resource Include="Images\plutoch_2.jpg" />
<Resource Include="Images\sun.jpg" />
<Resource Include="Images\uraglobe.jpg" />
<Resource Include="Images\venglobe.jpg" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Noesis.GUI.Extensions">
<Version>3.0.*</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
31 changes: 31 additions & 0 deletions Samples/DataBinding/UE4/Assets/DataBinding/DataBinding-blend.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.271
MinimumVisualStudioVersion = 15.0.28307.271
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataBinding-blend", "DataBinding-blend.csproj", "{8429DBC8-7B07-466F-B814-C5F158CF0A61}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8429DBC8-7B07-466F-B814-C5F158CF0A61}.Debug|x64.ActiveCfg = Debug|Any CPU
{8429DBC8-7B07-466F-B814-C5F158CF0A61}.Debug|x64.Build.0 = Debug|Any CPU
{8429DBC8-7B07-466F-B814-C5F158CF0A61}.Debug|x86.ActiveCfg = Debug|Any CPU
{8429DBC8-7B07-466F-B814-C5F158CF0A61}.Debug|x86.Build.0 = Debug|Any CPU
{8429DBC8-7B07-466F-B814-C5F158CF0A61}.Release|x64.ActiveCfg = Release|Any CPU
{8429DBC8-7B07-466F-B814-C5F158CF0A61}.Release|x64.Build.0 = Release|Any CPU
{8429DBC8-7B07-466F-B814-C5F158CF0A61}.Release|x86.ActiveCfg = Release|Any CPU
{8429DBC8-7B07-466F-B814-C5F158CF0A61}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4C214463-77AF-4603-A821-9D2A128B070A}
EndGlobalSection
EndGlobal
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
96 changes: 96 additions & 0 deletions Samples/DataBinding/UE4/Assets/DataBinding/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<UserControl x:Class="DataBinding.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
xmlns:local="clr-namespace:DataBinding"
Background="Black"
FontFamily="./#Roboto"
d:DataContext="{d:DesignInstance {x:Type local:SolarSystem}, IsDesignTimeCreatable=True}">

<UserControl.Resources>
<local:OrbitConverter x:Key="orbitConverter" />

<Style TargetType="{x:Type ListBox}">
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBox}">
<Canvas IsItemsHost="True" Width="590" Height="590" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="Canvas.Left" Value="{Binding Orbit, ConverterParameter=0.707, Converter={StaticResource orbitConverter}}"/>
<Setter Property="Canvas.Bottom" Value="{Binding Orbit, ConverterParameter=0.707, Converter={StaticResource orbitConverter}}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Grid>
<Ellipse Fill="SkyBlue" Margin="4"/>
<Ellipse x:Name="selectedPlanet" Margin="-10" StrokeThickness="2" IsHitTestVisible="False" />
<ContentPresenter
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="true">
<Setter Property="Stroke" TargetName="selectedPlanet" Value="Yellow"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Panel.ZIndex" Value="100"/>
</Trigger>
</Style.Triggers>
</Style>

<Style TargetType="{x:Type ToolTip}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToolTip}">
<ContentPresenter/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<DataTemplate x:Key="SolarSystemObjectTemplate">
<Canvas Width="20" Height="20">
<Ellipse
Canvas.Left="{Binding Orbit, ConverterParameter=-1.707, Converter={StaticResource orbitConverter}}"
Canvas.Top="{Binding Orbit, ConverterParameter=-0.293, Converter={StaticResource orbitConverter}}"
Width="{Binding Orbit, ConverterParameter=2, Converter={StaticResource orbitConverter}}"
Height="{Binding Orbit, ConverterParameter=2, Converter={StaticResource orbitConverter}}"
Stroke="White"
StrokeThickness="1"/>
<Image Source="{Binding Image}" Width="20" Height="20"
ToolTipService.InitialShowDelay="0"
ToolTipService.ShowDuration="8000">
<Image.ToolTip>
<StackPanel Width="300" Background="#FF365264">
<TextBlock Text="{Binding Name}" FontSize="18" FontWeight="Bold" Foreground="#FF365264" Background="LightSkyBlue" Padding="0,2" TextAlignment="Center"/>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Orbit, StringFormat=Orbit: \{0:F2\} AU}" FontSize="14" Foreground="White" Margin="8"/>
<TextBlock Text="{Binding Diameter, StringFormat=Diameter: \{0:F2\} Km}" FontSize="14" Foreground="White" Margin="8"/>
</StackPanel>
<TextBlock Text="{Binding Details}" FontSize="14" Foreground="Silver" TextWrapping="Wrap" Margin="8,0,8,8"/>
</StackPanel>
</Image.ToolTip>
</Image>
</Canvas>
</DataTemplate>

</UserControl.Resources>

<Viewbox>
<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
<ListBox ItemsSource="{Binding SolarSystemObjects}" ItemTemplate="{StaticResource SolarSystemObjectTemplate}" Focusable="False"/>
</Grid>
</Viewbox>
</UserControl>
15 changes: 15 additions & 0 deletions Samples/DataBinding/UE4/Assets/DataBinding/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.Windows.Controls;

namespace DataBinding
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : UserControl
{
public MainWindow()
{
InitializeComponent();
}
}
}
26 changes: 26 additions & 0 deletions Samples/DataBinding/UE4/Assets/DataBinding/OrbitConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using System.Globalization;
using System.Windows.Data;

namespace DataBinding
{
public class OrbitConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is float && parameter is string)
{
float orbit = (float)value;
float factor = float.Parse((string)parameter, CultureInfo.InvariantCulture);
return (float)(Math.Pow(orbit / 40, 0.4) * 770.0 * factor);
}

return default(float);
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
Loading

0 comments on commit 919fb02

Please sign in to comment.