[Unity] FindTypeResource C++ Runtime Error
Posted: 29 Jul 2014, 00:15
Hey All, I keep getting a C++ Runtime Error every time I call FindTypeResource<Storyboard>("FadeOut") or FindTypeResource<Storyboard>("FadeIn") in the below example. Any thoughts on what I am doing wrong? I'm honestly out of ideas.
UIEscapeScreen.cs
UIEscapeScreen.xaml
UIEscapeScreen.cs
Code: Select all
using Noesis;
using System;
namespace FiveGui
{
[Noesis.Extended]
[Noesis.UserControlSource("Assets/GUI/GUIControls/UIEscapeScreen.xaml")]
public class UIEscapeScreen : Noesis.UserControl
{
private Grid _screenPnl;
public void OnPostInit()
{
_screenPnl = FindName<Grid>("_ScreenRoot");
}
public void ToggleEscapeScreen()
{
if (_screenPnl.GetVisibility() == Visibility.Visible)
{
Storyboard board = FindTypeResource<Storyboard>("FadeOut");
board.Begin(this);
}
else
{
Storyboard board = FindTypeResource<Storyboard>("FadeIn");
board.Begin(this);
}
}
}
}Code: Select all
<UserControl
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"
xmlns:noesis="clr-namespace:NoesisGUIExtensions" xmlns:five="clr-namespace:FiveGui"
mc:Ignorable="d" x:Class="FiveGui.UIEscapeScreen" x:Name="_UIEscapeScreenControl" d:DesignWidth="1920" d:DesignHeight="1080">
<Grid x:Name="_ScreenRoot" Background="#00000000" Height="1080" Visibility="Collapsed">
<Grid.Resources>
<ResourceDictionary>
<Storyboard x:Key="FadeIn">
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="_ScreenRoot" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="0:0:0.0" Value="{x:Static Visibility.Visible}"/>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="_ScreenRoot" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0.5"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="_ContentAreaTrans" Storyboard.TargetProperty="X">
<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="-300"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="FadeOut">
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="_ScreenRoot" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="0:0:0.0" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="0:0:0.4" Value="{x:Static Visibility.Collapsed}"/>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="_ContentAreaTrans" Storyboard.TargetProperty="X">
<EasingDoubleKeyFrame KeyTime="0:0:0.0" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="-300"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="_ScreenRoot" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0.5"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</ResourceDictionary>
</Grid.Resources>
<StackPanel x:Name="_ContentArea" HorizontalAlignment="Left" Width="300" Margin="0,0,0,0" Background="#7F4B3737" RenderTransformOrigin="0.5,0.5">
<StackPanel.RenderTransform>
<TranslateTransform x:Name="_ContentAreaTrans" X="-300"/>
</StackPanel.RenderTransform>
<Button x:Name="_ResumeGame" Content="Resume Game" FontSize="18.667" Margin="20,80,20,10" />
<Button x:Name="_SaveGame" Content="Save Game" FontSize="18.667" Margin="20,10" />
<Button x:Name="_LoadGame" Content="Load Game" FontSize="18.667" Margin="20,10" />
<Button x:Name="_Options" Content="Options" FontSize="18.667" Margin="20,40,20,10" />
<Button x:Name="_LeaveGame" Content="Leave Game" FontSize="18.667" Margin="20,40,20,10" />
<Button x:Name="_ExitGame" Content="Exit Game" FontSize="18.667" Margin="20,10" />
</StackPanel>
</Grid>
</UserControl>