关卡迭代

master
chendian 1 year ago
parent 6b07b14e86
commit 80d1d19ced

@ -2,31 +2,30 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://c0jks8qogcdhp" uid="uid://c3t84ybige5dj"
path.s3tc="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.s3tc.ctex" path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
metadata={ metadata={
"imported_formats": ["s3tc_bptc"], "vram_texture": false
"vram_texture": true
} }
[deps] [deps]
source_file="res://icon.svg" source_file="res://icon.svg"
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.s3tc.ctex"] dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
[params] [params]
compress/mode=2 compress/mode=0
compress/high_quality=false compress/high_quality=false
compress/lossy_quality=0.7 compress/lossy_quality=0.7
compress/hdr_compression=1 compress/hdr_compression=0
compress/normal_map=0 compress/normal_map=2
compress/channel_pack=0 compress/channel_pack=0
mipmaps/generate=true mipmaps/generate=false
mipmaps/limit=-1 mipmaps/limit=-1
roughness/mode=0 roughness/mode=0
roughness/src_normal="" roughness/src_normal=""
process/fix_alpha_border=true process/fix_alpha_border=false
process/premult_alpha=false process/premult_alpha=false
process/normal_map_invert_y=false process/normal_map_invert_y=false
process/hdr_as_srgb=false process/hdr_as_srgb=false

@ -7,7 +7,7 @@ render_priority = 0
shader = ExtResource("1_0sxqg") shader = ExtResource("1_0sxqg")
shader_parameter/is_link = false shader_parameter/is_link = false
shader_parameter/is_focus_from = false shader_parameter/is_focus_from = false
shader_parameter/is_focus_to = true shader_parameter/is_focus_to = false
shader_parameter/focus_min_from = Vector3(0, 0, 0) shader_parameter/focus_min_from = Vector3(0, 0, 0)
shader_parameter/focus_max_from = Vector3(0, 0, 0) shader_parameter/focus_max_from = Vector3(0, 0, 0)
shader_parameter/focus_min_to = Vector3(13.44, 0.640001, 0.640001) shader_parameter/focus_min_to = Vector3(13.44, 0.640001, 0.640001)

@ -0,0 +1,18 @@
[remap]
importer="MagicaVoxel.With.Extensions.To.Mesh"
type="Mesh"
uid="uid://bheu5amf85waf"
path="res://.godot/imported/g_f_graybox_wire.vox-7b8ae7a4348c3a65a9259a0bf80ff803.mesh"
[deps]
source_file="res://resource/mesh_level/g_f_graybox_wire.vox"
dest_files=["res://.godot/imported/g_f_graybox_wire.vox-7b8ae7a4348c3a65a9259a0bf80ff803.mesh"]
[params]
Scale=0.02
GreedyMeshGenerator=true
SnapToGround=false
FirstKeyframeOnly=true

@ -0,0 +1,18 @@
[remap]
importer="MagicaVoxel.With.Extensions.To.Mesh"
type="Mesh"
uid="uid://c88vfyahxox66"
path="res://.godot/imported/g_f_graybox_wire2.vox-6530e85929e5ab5495a1708ea2899ce9.mesh"
[deps]
source_file="res://resource/mesh_level/g_f_graybox_wire2.vox"
dest_files=["res://.godot/imported/g_f_graybox_wire2.vox-6530e85929e5ab5495a1708ea2899ce9.mesh"]
[params]
Scale=0.02
GreedyMeshGenerator=true
SnapToGround=false
FirstKeyframeOnly=true

@ -0,0 +1,18 @@
[remap]
importer="MagicaVoxel.With.Extensions.To.Mesh"
type="Mesh"
uid="uid://dxhh2vp556x8l"
path="res://.godot/imported/s1_wood_stair1.vox-c9f7895b52dccdd4e8b572755eeb158a.mesh"
[deps]
source_file="res://resource/mesh_level/s1_wood_stair1.vox"
dest_files=["res://.godot/imported/s1_wood_stair1.vox-c9f7895b52dccdd4e8b572755eeb158a.mesh"]
[params]
Scale=0.02
GreedyMeshGenerator=true
SnapToGround=false
FirstKeyframeOnly=true

@ -0,0 +1,18 @@
[remap]
importer="MagicaVoxel.With.Extensions.To.Mesh"
type="Mesh"
uid="uid://dq6frsgana8ca"
path="res://.godot/imported/s2_wood_stair2.vox-b38c4c7847c8055a3b3b4c35e55ef1fb.mesh"
[deps]
source_file="res://resource/mesh_level/s2_wood_stair2.vox"
dest_files=["res://.godot/imported/s2_wood_stair2.vox-b38c4c7847c8055a3b3b4c35e55ef1fb.mesh"]
[params]
Scale=0.02
GreedyMeshGenerator=true
SnapToGround=false
FirstKeyframeOnly=true

@ -1,18 +0,0 @@
[remap]
importer="MagicaVoxel.With.Extensions.To.Mesh"
type="Mesh"
uid="uid://dxhh2vp556x8l"
path="res://.godot/imported/s_wood_stair1.vox-c16bd50a3fff44e4223fdd44c557ab69.mesh"
[deps]
source_file="res://resource/mesh_level/s_wood_stair1.vox"
dest_files=["res://.godot/imported/s_wood_stair1.vox-c16bd50a3fff44e4223fdd44c557ab69.mesh"]
[params]
Scale=0.02
GreedyMeshGenerator=true
SnapToGround=false
FirstKeyframeOnly=true

@ -1,18 +0,0 @@
[remap]
importer="MagicaVoxel.With.Extensions.To.Mesh"
type="Mesh"
uid="uid://d142jxbfdotwh"
path="res://.godot/imported/s_wood_stair2.vox-ddef4cfc7f4c99bf73872795b14308b4.mesh"
[deps]
source_file="res://resource/mesh_level/s_wood_stair2.vox"
dest_files=["res://.godot/imported/s_wood_stair2.vox-ddef4cfc7f4c99bf73872795b14308b4.mesh"]
[params]
Scale=0.02
GreedyMeshGenerator=true
SnapToGround=false
FirstKeyframeOnly=true

@ -1,18 +0,0 @@
[remap]
importer="MagicaVoxel.With.Extensions.To.Mesh"
type="Mesh"
uid="uid://dq6frsgana8ca"
path="res://.godot/imported/s_wood_stair3.vox-fd03836211eb8c070ca30bda6b94b067.mesh"
[deps]
source_file="res://resource/mesh_level/s_wood_stair3.vox"
dest_files=["res://.godot/imported/s_wood_stair3.vox-fd03836211eb8c070ca30bda6b94b067.mesh"]
[params]
Scale=0.02
GreedyMeshGenerator=true
SnapToGround=false
FirstKeyframeOnly=true

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -74,7 +74,7 @@ func refresh_animation_lib():
ResourceSaver.save(animation_library, animation_library_path) ResourceSaver.save(animation_library, animation_library_path)
func refresh_mesh_library(path_list: Array, with_clear: bool = false): func refresh_mesh_library(path_list: Array, from_editor_tool: bool = false):
print("refresh_mesh_library") print("refresh_mesh_library")
var default_shape_normal_full: Array[Variant] = [load("res://resource/mesh_library/default_shape_normal_full.tres") as Shape3D, Transform3D.IDENTITY] var default_shape_normal_full: Array[Variant] = [load("res://resource/mesh_library/default_shape_normal_full.tres") as Shape3D, Transform3D.IDENTITY]
var default_shape_normal_half: Array[Variant] = [load("res://resource/mesh_library/default_shape_normal_half.tres") as Shape3D, Transform3D.IDENTITY] var default_shape_normal_half: Array[Variant] = [load("res://resource/mesh_library/default_shape_normal_half.tres") as Shape3D, Transform3D.IDENTITY]
@ -91,6 +91,7 @@ func refresh_mesh_library(path_list: Array, with_clear: bool = false):
var mesh_library_level_id_list: Array[int] = [] var mesh_library_level_id_list: Array[int] = []
var mesh_library_ground_id_list: Array[int] = [] var mesh_library_ground_id_list: Array[int] = []
var reimport_files: Array[String] = []
for file_name_full in path_list: for file_name_full in path_list:
var mesh_name = file_name_full.get_file().split('-')[0].trim_suffix('.vox') var mesh_name = file_name_full.get_file().split('-')[0].trim_suffix('.vox')
print(mesh_name) print(mesh_name)
@ -107,15 +108,14 @@ func refresh_mesh_library(path_list: Array, with_clear: bool = false):
mesh_library_id_list.append(mesh_id) mesh_library_id_list.append(mesh_id)
mesh_library.set_item_name(mesh_id, mesh_name) mesh_library.set_item_name(mesh_id, mesh_name)
mesh_library.set_item_mesh(mesh_id, mesh) mesh_library.set_item_mesh(mesh_id, mesh)
var is_material_changed: bool = false var material: Material = mesh.surface_get_material(0) as Material
for i in mesh.get_surface_count():
var material: Material = mesh.surface_get_material(i) as Material
var material_set: Material = material_block_link if mesh_name.ends_with("_link") else material_block_normal var material_set: Material = material_block_link if mesh_name.ends_with("_link") else material_block_normal
if material.get_path() != material_set.get_path(): if (not material) or (material.get_path() != material_set.get_path()):
mesh.surface_set_material(i, material_block_link if mesh_name.ends_with("_link") else material_block_normal) if from_editor_tool:
is_material_changed = true reimport_files.append(file_name_full)
if is_material_changed: else:
ResourceSaver.save(mesh) mesh.surface_set_material(0, material_block_link if mesh_name.ends_with("_link") else material_block_normal)
ResourceSaver.save(mesh, file_name_full)
var name_prefix = mesh_name.split("_")[0] if mesh_name.contains("_") else mesh_name var name_prefix = mesh_name.split("_")[0] if mesh_name.contains("_") else mesh_name
var item_shapes: Array var item_shapes: Array
@ -127,12 +127,15 @@ func refresh_mesh_library(path_list: Array, with_clear: bool = false):
_: item_shapes = [mesh.create_convex_shape(), Transform3D.IDENTITY] _: item_shapes = [mesh.create_convex_shape(), Transform3D.IDENTITY]
if item_shapes: if item_shapes:
mesh_library.set_item_shapes(mesh_id, item_shapes) mesh_library.set_item_shapes(mesh_id, item_shapes)
_save_mesh_library(mesh_library_level, mesh_library_level_id_list, with_clear) _save_mesh_library(mesh_library_level, mesh_library_level_id_list, from_editor_tool)
_save_mesh_library(mesh_library_ground, mesh_library_ground_id_list, with_clear) _save_mesh_library(mesh_library_ground, mesh_library_ground_id_list, from_editor_tool)
if from_editor_tool and reimport_files:
EditorInterface.get_resource_filesystem().reimport_files(reimport_files)
func _save_mesh_library(mesh_library: MeshLibrary, id_list: Array, with_clear: bool):
if with_clear: func _save_mesh_library(mesh_library: MeshLibrary, id_list: Array, from_editor_tool: bool):
if from_editor_tool:
var ids: PackedInt32Array = mesh_library.get_item_list() var ids: PackedInt32Array = mesh_library.get_item_list()
for id in ids: for id in ids:
if not id in id_list: if not id in id_list:

@ -39,3 +39,8 @@ func get_born_pos() -> Vector3:
var born_pos_node: Node3D = %BornPos as Node3D var born_pos_node: Node3D = %BornPos as Node3D
born_pos = born_pos_node.get_global_position() born_pos = born_pos_node.get_global_position()
return born_pos return born_pos
func set_player_position(pos: Vector3) -> void:
grid_block_material.set_shader_parameter("target_position", pos)
grid_block_link_material.set_shader_parameter("target_position", pos)

@ -24,8 +24,6 @@ var screen_pos_scale: Vector2 = Vector2(sample_rate, sample_rate/scale_
var screen_pos_offset: Vector2 = Vector2(0, -stage_offset_y) var screen_pos_offset: Vector2 = Vector2(0, -stage_offset_y)
var global_effect_list: Array[Variant] = [] var global_effect_list: Array[Variant] = []
@onready var grid_block_material: Material = load("res://render/material/grid_block.tres") as Material
class GlobalEffect: class GlobalEffect:
var effect_type: Enum.EGlobalEffect var effect_type: Enum.EGlobalEffect
@ -107,7 +105,6 @@ func on_character_pos_changed(id: int, pos: Vector3):
target_character_pos.y = pos.z target_character_pos.y = pos.z
target_pos_y = pos.y target_pos_y = pos.y
refresh_target_pos() refresh_target_pos()
grid_block_material.set_shader_parameter("target_position", pos)
func on_character_destroy(id: int): target = 0 func on_character_destroy(id: int): target = 0

@ -59,6 +59,7 @@ func on_character_destroy(id: int): target = 0
func set_player_position(pos: Vector3) -> void: func set_player_position(pos: Vector3) -> void:
level.set_player_position(pos)
var new_id: Vector3i = get_level_id(pos) var new_id: Vector3i = get_level_id(pos)
var new_level_instance: LevelInstance = level_instance_dict.get(new_id) var new_level_instance: LevelInstance = level_instance_dict.get(new_id)
if not new_level_instance: if not new_level_instance:

Loading…
Cancel
Save