-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor TileManager.TileServer property to have a Godot-accessible m…
…irror Since godotengine/godot#67167 is complete but wasn't the only issue - I get the impression naked C# interfaces will never be GDscript-accessible, only GodotObject subclasses will be accessible in GDscript
- Loading branch information
Showing
3 changed files
with
43 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright 2024 Treer (https://github.com/Treer) | ||
// License: MIT, see LICENSE.txt for rights granted | ||
|
||
using Godot; | ||
using MapGen.Tiles; | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace MapViewer | ||
{ | ||
|
||
/// <summary> | ||
/// Wraps a GodotObject around an ITileServer to allow Godot to access the methods and properties exposed by the interface | ||
/// </summary> | ||
public partial class GITileServer : GodotObject, ITileServer // implements ITileServer so the compiler will ensure it exposes everything in the interface and is correct | ||
{ | ||
public ITileServer WrappedITileServer { get; set; } | ||
|
||
public int TileLength => WrappedITileServer.TileLength; | ||
public int TileResolution => WrappedITileServer.TileResolution; | ||
public float Scale => WrappedITileServer.Scale; | ||
public Type TileType => WrappedITileServer.TileType; | ||
public string DiagnosticFilenameSuffix => WrappedITileServer.DiagnosticFilenameSuffix; | ||
public ITileRender2D Render2D => WrappedITileServer.Render2D; | ||
public Task<ITile> GetTile(Vector2 worldCoord) => WrappedITileServer.GetTile(worldCoord); | ||
public Vector2I TileContainingWorldCoord(Vector2 worldCoord) => WrappedITileServer.TileContainingWorldCoord(worldCoord); | ||
|
||
public GITileServer(ITileServer tileServer) { WrappedITileServer = tileServer; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters