Re: Gamepad Support?
Because I need to get that element from the script code using FindName:
That way, the focus starts in the centered button.
Code: Select all
var start = root.FindName<Button>("start");
start.Focus()
Re: Gamepad Support?
I am liking XAML the more I learn it.
Now I am trying to have the menu slide in by playing an animation on the grid when DPadUp is pressed, however it doesn't seem to be working correctly. Also, is it possible to play the animation in reverse when for example menuOnScreen = true?

Now I am trying to have the menu slide in by playing an animation on the grid when DPadUp is pressed, however it doesn't seem to be working correctly. Also, is it possible to play the animation in reverse when for example menuOnScreen = true?
Code: Select all
using System;
using UnityEngine;
using InControl;
using Noesis;
namespace BasicExample
{
public class Controller : MonoBehaviour
{
NoesisGUIPanel noesisGUI_;
private Storyboard _ani;
private Grid _root;
void Start()
{
noesisGUI_ = GetComponent<NoesisGUIPanel>();
var root = noesisGUI_.GetRoot<Grid>();
_ani = root.FindStringResource<Storyboard> ("animation");
var start = root.FindName<Button>("start");
start.Focus();
}
private void Handle(OneAxisInputControl input, Noesis.Key key)
{
if (input.WasPressed)
{
noesisGUI_.KeyDown(key);
}
if (input.WasReleased)
{
noesisGUI_.KeyUp(key);
}
}
private void Handle(InputControl input, Noesis.Key key)
{
if (input.WasPressed)
{
noesisGUI_.KeyDown(key);
}
if (input.WasReleased)
{
noesisGUI_.KeyUp(key);
}
}
void Update()
{
// Use last device which provided input.
var inputDevice = InputManager.ActiveDevice;
//Menu Navigation
Handle(inputDevice.DPadLeft, Key.Left);
Handle(inputDevice.DPadRight, Key.Right);
//Menu Toggle
if (inputDevice.DPadUp.WasPressed)
{
_ani.Begin(_root);
}
//Button
Handle(inputDevice.DPadDown, Key.Space);
}
}
}
Re: Gamepad Support?
Hi!I am liking XAML the more I learn it.![]()
Now I am trying to have the menu slide in by playing an animation on the grid when DPadUp is pressed, however it doesn't seem to be working correctly. Also, is it possible to play the animation in reverse when for example menuOnScreen = true?
What is the problem with the animation? Does it behave properly on Blend? The way you are activating it seems to be correct.
You can activate AutoReverse in the animations but I think that is not what you want. I think you will have to create two animations, one forward and another backward.
Re: Gamepad Support?
Its giving these errors when I try to play:
http://media-cache-ak0.pinimg.com/origi ... 0267a6.jpg
http://media-cache-ec0.pinimg.com/origi ... 2378d1.jpg
http://media-cache-ak0.pinimg.com/origi ... 0267a6.jpg
http://media-cache-ec0.pinimg.com/origi ... 2378d1.jpg
Re: Gamepad Support?
Have you verified that _root and _ani are not null?
Please, paste us here the entire XAML you are using.
Please, paste us here the entire XAML you are using.
Re: Gamepad Support?
Code: Select all
<Grid
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">
<Grid.Resources>
<Storyboard x:Key="animation">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="grid">
<EasingDoubleKeyFrame KeyTime="0" Value="-85.5"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</Grid.Resources>
<Grid x:Name="grid" HorizontalAlignment="Center" VerticalAlignment="Top" KeyboardNavigation.DirectionalNavigation="Cycle" RenderTransformOrigin="0.5,0.5">
<Grid.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</Grid.RenderTransform>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Button Content="Button" Padding="20" FontSize="20" Grid.Row="1" Grid.Column="0" />
<Button Content="Button" x:Name="start" Padding="20" FontSize="20" Grid.Row="1" Grid.Column="1" />
<Button Content="Button" Padding="20" FontSize="20" Grid.Row="1" Grid.Column="2" />
</Grid>
</Grid>
Re: Gamepad Support?
The problem is at this line of your code:
it should be:
Although I would expect an error in the C# (null object or something like that) instead of a crash error in C land. I will investigate it.
Code: Select all
var root = noesisGUI_.GetRoot<Grid>();
Code: Select all
_root = noesisGUI_.GetRoot<Grid>();
Re: Gamepad Support?
It is now giving these errors:
http://media-cache-ak0.pinimg.com/origi ... 1ccfe5.jpg
http://media-cache-ec0.pinimg.com/origi ... 3a5a4f.jpg
http://media-cache-ak0.pinimg.com/origi ... 1ccfe5.jpg
http://media-cache-ec0.pinimg.com/origi ... 3a5a4f.jpg
Re: Gamepad Support?
It is the same error. Are you sure you updated the script? It is working fine here:
Code: Select all
using System;
using UnityEngine;
using InControl;
using Noesis;
namespace BasicExample
{
public class Controller : MonoBehaviour
{
NoesisGUIPanel noesisGUI_;
private Storyboard _ani;
private Grid _root;
void Start()
{
noesisGUI_ = GetComponent<NoesisGUIPanel>();
_root = noesisGUI_.GetRoot<Grid>();
_ani = _root.FindStringResource<Storyboard>("animation");
var start = _root.FindName<Button>("start");
start.Focus();
}
private void Handle(OneAxisInputControl input, Noesis.Key key)
{
if (input.WasPressed)
{
noesisGUI_.KeyDown(key);
}
if (input.WasReleased)
{
noesisGUI_.KeyUp(key);
}
}
private void Handle(InputControl input, Noesis.Key key)
{
if (input.WasPressed)
{
noesisGUI_.KeyDown(key);
}
if (input.WasReleased)
{
noesisGUI_.KeyUp(key);
}
}
void Update()
{
// Use last device which provided input.
var inputDevice = InputManager.ActiveDevice;
//Menu Navigation
Handle(inputDevice.DPadLeft, Key.Left);
Handle(inputDevice.DPadRight, Key.Right);
//Menu Toggle
if (inputDevice.DPadUp.WasPressed)
{
_ani.Begin(_root);
}
//Button
Handle(inputDevice.DPadDown, Key.Space);
}
}
}
Who is online
Users browsing this forum: Ahrefs [Bot] and 26 guests