small changes

This commit is contained in:
Nilton Constantino 2026-06-19 13:59:07 +01:00
parent 27b751fd40
commit 074b213270
No known key found for this signature in database
7 changed files with 58 additions and 21 deletions

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: be54b69524c434f888d7c380a558ccee
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,20 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8cbbff7dfcc24d2b9030f41f9f2ef718, type: 3}
m_Name: WorldLayout
m_EditorClassIdentifier: Assembly-CSharp-Editor::Editor.GON.WorldEditor.WorldLayoutSO
id: 5d22dc1f93b74fd1aeeacd2abe5fcb9c
worldTileSize: 24
worldLayerHeight: 24
stages: []
endpoints: []
connections: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8ec2b6c87674e4b27863ffb69c081b90
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,10 +1,11 @@
using System; using System;
using System.IO; using System.Collections.Generic;
using Intrepid.Gameplay.Journey; using Intrepid.Gameplay.Journey;
using UnityEditor; using UnityEditor;
using UnityEditor.UIElements; using UnityEditor.UIElements;
using UnityEngine; using UnityEngine;
using UnityEngine.UIElements; using UnityEngine.UIElements;
using Random = UnityEngine.Random;
namespace Editor.GON.WorldEditor namespace Editor.GON.WorldEditor
{ {
@ -298,7 +299,7 @@ namespace Editor.GON.WorldEditor
id = layout.CreateId("stage"), id = layout.CreateId("stage"),
displayName = "Stage " + (layout.stages.Count + 1), displayName = "Stage " + (layout.stages.Count + 1),
worldLayer = state.activeLayer, worldLayer = state.activeLayer,
color = UnityEngine.Random.ColorHSV(0f, 1f, 0.35f, 0.75f, 0.55f, 0.85f, 0.75f, 0.9f) color = Random.ColorHSV(0f, 1f, 0.35f, 0.75f, 0.55f, 0.85f, 0.75f, 0.9f)
}; };
stage.AddTile(new JWorldTile(0, 0)); stage.AddTile(new JWorldTile(0, 0));
layout.stages.Add(stage); layout.stages.Add(stage);
@ -333,7 +334,7 @@ namespace Editor.GON.WorldEditor
} }
} }
private void ShowValidationMessages(System.Collections.Generic.List<WorldValidationMessage> messages) private void ShowValidationMessages(List<WorldValidationMessage> messages)
{ {
validationView?.Clear(); validationView?.Clear();
if (validationView is null) if (validationView is null)

View File

@ -12,7 +12,7 @@ namespace Editor.GON.WorldEditor
private readonly WorldEditorWindow owner; private readonly WorldEditorWindow owner;
private readonly WorldEditorState state; private readonly WorldEditorState state;
private WorldLayoutSO layout; private WorldLayoutSO worldLayout;
private Vector2 pan = new(60f, 60f); private Vector2 pan = new(60f, 60f);
private float cellPixels = 36f; private float cellPixels = 36f;
private bool isPanning; private bool isPanning;
@ -38,8 +38,8 @@ namespace Editor.GON.WorldEditor
public void SetLayout(WorldLayoutSO newLayout) public void SetLayout(WorldLayoutSO newLayout)
{ {
layout = newLayout; worldLayout = newLayout;
layout?.EnsureDefaults(); worldLayout?.EnsureDefaults();
MarkDirtyRepaint(); MarkDirtyRepaint();
} }
@ -61,7 +61,7 @@ namespace Editor.GON.WorldEditor
return; return;
} }
if (evt.button != 0 || layout is null) if (evt.button != 0 || worldLayout is null)
{ {
return; return;
} }
@ -117,7 +117,7 @@ namespace Editor.GON.WorldEditor
private void ApplyTool(JWorldTile tile, Vector2 mouse) private void ApplyTool(JWorldTile tile, Vector2 mouse)
{ {
var stageAtTile = layout.FindStageAt(state.activeLayer, tile); var stageAtTile = worldLayout.FindStageAt(state.activeLayer, tile);
if (state.activeTool == WorldEditorTool.Select) if (state.activeTool == WorldEditorTool.Select)
{ {
state.selectedStageId = stageAtTile?.id; state.selectedStageId = stageAtTile?.id;
@ -125,7 +125,7 @@ namespace Editor.GON.WorldEditor
return; return;
} }
var selectedStage = layout.FindStage(state.selectedStageId); var selectedStage = worldLayout.FindStage(state.selectedStageId);
if (selectedStage is null) if (selectedStage is null)
{ {
return; return;
@ -139,7 +139,7 @@ namespace Editor.GON.WorldEditor
switch (state.activeTool) switch (state.activeTool)
{ {
case WorldEditorTool.PaintStage: case WorldEditorTool.PaintStage:
if (!layout.IsTileOccupiedByOther(selectedStage.id, state.activeLayer, tile)) if (!worldLayout.IsTileOccupiedByOther(selectedStage.id, state.activeLayer, tile))
{ {
owner.MutateLayout("Paint world tile", delegate { selectedStage.AddTile(tile); }); owner.MutateLayout("Paint world tile", delegate { selectedStage.AddTile(tile); });
} }
@ -166,22 +166,22 @@ namespace Editor.GON.WorldEditor
return; return;
} }
if ((kind == JEndpointKind.Anchor && layout.FindEndpointAt(stage.id, tile, JEndpointKind.Lift) != null) || if ((kind == JEndpointKind.Anchor && worldLayout.FindEndpointAt(stage.id, tile, JEndpointKind.Lift) != null) ||
(kind == JEndpointKind.Lift && layout.FindEndpointAt(stage.id, tile, JEndpointKind.Anchor) != null)) (kind == JEndpointKind.Lift && worldLayout.FindEndpointAt(stage.id, tile, JEndpointKind.Anchor) != null))
{ {
return; return;
} }
if (layout.FindEndpointAt(stage.id, tile, kind) != null) if (worldLayout.FindEndpointAt(stage.id, tile, kind) != null)
{ {
return; return;
} }
owner.MutateLayout("Add journey endpoint", delegate owner.MutateLayout("Add journey endpoint", delegate
{ {
layout.endpoints.Add(new WorldEndpointAuthoring worldLayout.endpoints.Add(new WorldEndpointAuthoring
{ {
id = layout.CreateId("endpoint"), id = worldLayout.CreateId("endpoint"),
stageId = stage.id, stageId = stage.id,
worldTile = tile, worldTile = tile,
kind = kind, kind = kind,
@ -224,13 +224,13 @@ namespace Editor.GON.WorldEditor
private void DrawStages(Painter2D p) private void DrawStages(Painter2D p)
{ {
if (layout is null) if (worldLayout is null)
{ {
return; return;
} }
layout.EnsureDefaults(); worldLayout.EnsureDefaults();
foreach (var stage in layout.stages) foreach (var stage in worldLayout.stages)
{ {
if (stage == null || stage.worldLayer != state.activeLayer) if (stage == null || stage.worldLayer != state.activeLayer)
{ {
@ -248,14 +248,14 @@ namespace Editor.GON.WorldEditor
private void DrawEndpoints(Painter2D p) private void DrawEndpoints(Painter2D p)
{ {
if (layout is null) if (worldLayout is null)
{ {
return; return;
} }
foreach (var endpoint in layout.endpoints) foreach (var endpoint in worldLayout.endpoints)
{ {
var stage = layout.FindStage(endpoint.stageId); var stage = worldLayout.FindStage(endpoint.stageId);
if (stage is null || stage.worldLayer != state.activeLayer) if (stage is null || stage.worldLayer != state.activeLayer)
{ {
continue; continue;