56 lines
1000 B
C#
56 lines
1000 B
C#
|
|
|
||
|
|
using Godot;
|
||
|
|
using Rokojori;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using System.Linq;
|
||
|
|
|
||
|
|
namespace Rokojori;
|
||
|
|
|
||
|
|
[Tool]
|
||
|
|
[GlobalClass]
|
||
|
|
public partial class SelectSettingsPage:Action
|
||
|
|
{
|
||
|
|
[Export]
|
||
|
|
public UIAppSettings uiAppSettings;
|
||
|
|
|
||
|
|
[Export]
|
||
|
|
public AppSettingsCategory category;
|
||
|
|
|
||
|
|
[Export]
|
||
|
|
public Node uiStylable;
|
||
|
|
|
||
|
|
protected override void _OnTrigger()
|
||
|
|
{
|
||
|
|
uiAppSettings.header.pageSelectors.ForEach(
|
||
|
|
( ps )=>
|
||
|
|
{
|
||
|
|
var stylable = ps.uiStylable as UIStylePropertyContainerNode;
|
||
|
|
stylable.RemoveUISelectorFlag( UISelectorFlag.Active );
|
||
|
|
}
|
||
|
|
);
|
||
|
|
|
||
|
|
var ownStylable = uiStylable as UIStylePropertyContainerNode;
|
||
|
|
ownStylable.AddUISelectorFlag( UISelectorFlag.Active );
|
||
|
|
|
||
|
|
uiAppSettings.pages.ForEach(
|
||
|
|
( p )=>
|
||
|
|
{
|
||
|
|
var isActive = p.category == category;
|
||
|
|
p.SetVisibility( isActive );
|
||
|
|
|
||
|
|
|
||
|
|
if ( ! isActive )
|
||
|
|
{
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
p.onActive?.Trigger();
|
||
|
|
p._OnActivated();
|
||
|
|
|
||
|
|
}
|
||
|
|
);
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|