mirror of
https://codeberg.org/Ikatono/TierMaker.git
synced 2025-10-28 20:45:35 -05:00
functional card/row edit and drag
This commit is contained in:
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Godot;
|
||||
using Godot.NativeInterop;
|
||||
|
||||
public static class ExtensionHelper
|
||||
{
|
||||
@@ -65,10 +66,11 @@ public static class ExtensionHelper
|
||||
i++;
|
||||
}
|
||||
}
|
||||
public static string GetUnusedCardId(this SceneTree tree)
|
||||
public static string GetUnusedCardId(this SceneTree tree, params string[] otherIds)
|
||||
{
|
||||
//use hashset because there are (probably) more cards than rows
|
||||
var ids = tree.GetNodesInGroup("CardGroup").OfType<card>().Select(c => c.CardId).ToHashSet();
|
||||
var ids = tree.GetNodesInGroup("CardGroup").OfType<card>().Select(c => c.CardId)
|
||||
.Concat(otherIds).ToHashSet();
|
||||
int i = 1;
|
||||
while (true)
|
||||
{
|
||||
@@ -91,4 +93,17 @@ public static class ExtensionHelper
|
||||
=> new(Math.Max(vect.X, other.X), Math.Max(vect.Y, other.Y));
|
||||
public static Vector2I Union(this Vector2I vect, Vector2 other)
|
||||
=> new((int)Math.Max(vect.X, other.X), (int)Math.Max(vect.Y, other.Y));
|
||||
public static System.Drawing.Color ToSystemColor(this Godot.Color color)
|
||||
=> System.Drawing.Color.FromArgb(
|
||||
(int)(color.R * 255),
|
||||
(int)(color.G * 255),
|
||||
(int)(color.B * 255)
|
||||
);
|
||||
public static Godot.Color ToGodotColor(this System.Drawing.Color color)
|
||||
=> new Godot.Color(
|
||||
color.R / 255.0f,
|
||||
color.G / 255.0f,
|
||||
color.B / 255.0f,
|
||||
1
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user