more wires to archery range, connecting buttons

This commit is contained in:
2026-01-11 14:47:39 +02:00
parent a23f40787e
commit 991f7d73b9
5 changed files with 52 additions and 8 deletions

View File

@@ -20,11 +20,14 @@ public class ArcheryRangeModelGenerationController : MonoBehaviour
public Transform wire;
public Material wireActiveMaterial;
private bool modelGenerationInProgress;
// Start is called before the first frame update
void Start()
{
imageGenerationButton.OnButtonPressed += InvokeImageGeneration;
modelGenerationButton.OnButtonPressed += InvokeModelGeneration;
modelGenerationInProgress = false;
}
// Update is called once per frame
@@ -47,11 +50,16 @@ public class ArcheryRangeModelGenerationController : MonoBehaviour
Sprite sprite = CreateSprite(GeneratedTexture);
imageDisplay.sprite = sprite;
imageGenerationButton.MoveButtonUp();
imageGenerationButton.Deactivate();
if (!modelGenerationInProgress)
{
modelGenerationButton.Deactivate();
}
}
private async void InvokeModelGeneration()
{
modelGenerationInProgress = true;
string encodedTexture = Convert.ToBase64String(GeneratedTexture.EncodeToJPG());
byte[] encodedModel = await TrellisClient.Instance.GenerateModel(encodedTexture);
@@ -63,7 +71,8 @@ public class ArcheryRangeModelGenerationController : MonoBehaviour
GeneratedModel = spawnedObject;
OnModelReady();
modelGenerationButton.MoveButtonUp();
modelGenerationButton.Deactivate();
modelGenerationInProgress = false;
}
private Texture2D CreateTexture(byte[] imageBytes)