2024-12-01 17:07:41 +00:00
|
|
|
using Godot;
|
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
|
|
|
namespace Rokojori
|
|
|
|
{
|
|
|
|
|
|
|
|
[Tool]
|
2025-08-31 06:05:39 +00:00
|
|
|
[GlobalClass,Icon("res://addons/rokojori_action_library/Icons/WorldMap.svg")]
|
2024-12-01 17:07:41 +00:00
|
|
|
public partial class WorldMap:Node
|
|
|
|
{
|
|
|
|
[Export]
|
|
|
|
public WorldMapDefinition worldMapDefinition;
|
|
|
|
|
|
|
|
[Export]
|
2025-08-31 06:05:39 +00:00
|
|
|
public WorldStreamer[] streamers = [];
|
|
|
|
|
|
|
|
List<WorldMapLayer> _layers = [];
|
2024-12-01 17:07:41 +00:00
|
|
|
|
2025-08-31 06:05:39 +00:00
|
|
|
[ExportToolButton( "Initialize Layers" )]
|
|
|
|
public Callable initializeLayersButton => Callable.From( ()=> { InitializeLayers(); } );
|
2024-12-01 17:07:41 +00:00
|
|
|
|
2025-08-31 06:05:39 +00:00
|
|
|
public void InitializeLayers()
|
2024-12-01 17:07:41 +00:00
|
|
|
{
|
2025-08-31 06:05:39 +00:00
|
|
|
foreach ( var ld in worldMapDefinition.layers )
|
|
|
|
{
|
|
|
|
var layer = this.CreateChild<WorldMapLayer>( ld.layerName );
|
|
|
|
layer.layerType = ld;
|
|
|
|
}
|
2024-12-01 17:07:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public override void _Process( double delta )
|
|
|
|
{
|
2025-08-31 06:05:39 +00:00
|
|
|
UpdateLayers();
|
2024-12-01 17:07:41 +00:00
|
|
|
}
|
|
|
|
|
2025-08-31 06:05:39 +00:00
|
|
|
public void UpdateLayers()
|
2024-12-01 17:07:41 +00:00
|
|
|
{
|
2025-08-31 06:05:39 +00:00
|
|
|
_layers.ForEach( l => l.Update( this ) );
|
2024-12-01 17:07:41 +00:00
|
|
|
}
|
|
|
|
|
2025-08-31 06:05:39 +00:00
|
|
|
|
2024-12-01 17:07:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|