添加了教育平台
This commit is contained in:
33
BITKit/Scripts/Channel/MultiplexGroup.cs
Normal file
33
BITKit/Scripts/Channel/MultiplexGroup.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BITKit;
|
||||
|
||||
namespace BITKit;
|
||||
public partial class MultiplexGroup : Node
|
||||
{
|
||||
[Export] private Godot.Collections.Dictionary<string, Node> dictionary;
|
||||
[Export] public string CurrentElement { get; protected set; }
|
||||
public override void _Ready()
|
||||
{
|
||||
if (dictionary.Count > 0)
|
||||
{
|
||||
SetCurrentElement(dictionary.Keys.First());
|
||||
}
|
||||
}
|
||||
public void SetCurrentElement(string currentElement)
|
||||
{
|
||||
foreach (var x in dictionary)
|
||||
{
|
||||
if (x.Value is IActivable activable)
|
||||
{
|
||||
activable.Enabled = x.Key == currentElement;
|
||||
}
|
||||
else
|
||||
{
|
||||
x.Value?.SetProcess(x.Key == currentElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user