🚚 Rename project

This commit is contained in:
LittleSheep 2024-08-07 23:01:57 +08:00
parent eb29e137a6
commit 6fa2c8411f
16 changed files with 192 additions and 136 deletions

View File

@ -0,0 +1,157 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="c7bd02c7-bbb4-431f-81ca-d2f8b7b09b37" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/.idea/.idea.AceField/.idea/.gitignore" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/.idea.AceField/.idea/encodings.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/.idea.AceField/.idea/indexLayout.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/.idea.AceField/.idea/vcs.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/.idea.CodingLand/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/.idea.CodingLand/.idea/.gitignore" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/.idea.CodingLand/.idea/encodings.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/.idea.CodingLand/.idea/indexLayout.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/.idea.CodingLand/.idea/vcs.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/CodingLand.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/AceField.csproj" afterDir="false" />
<change beforePath="$PROJECT_DIR$/CodingLand.sln" beforeDir="false" afterPath="$PROJECT_DIR$/AceField.sln" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Scenes/Root.tscn" beforeDir="false" afterPath="$PROJECT_DIR$/Scenes/Root.tscn" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Scenes/Tiles/Brick.tscn" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/Scripts/Launcher.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Scripts/Launcher.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Scripts/Logic/PlayerInput.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Scripts/Logic/PlayerInput.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Scripts/Logic/World.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Scripts/Logic/World.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Scripts/Player.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Scripts/Player.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Scripts/TilesManager.cs" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/Scripts/UI/StartScreen.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Scripts/UI/StartScreen.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/project.godot" beforeDir="false" afterPath="$PROJECT_DIR$/project.godot" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="HighlightingSettingsPerFile">
<setting file="file://$PROJECT_DIR$/.godot/mono/temp/bin/Debug/CodingLand.deps.json" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Scripts/Player.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/ILViewer/9fd3b083f28f40c0827cc635e2e56ca7459200/b8/eeb3ea01/02000039.il" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/ILViewer/9fd3b083f28f40c0827cc635e2e56ca7459200/b8/eeb3ea01/02000039High.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/ILViewer/9fd3b083f28f40c0827cc635e2e56ca7459200/b8/eeb3ea01/02000039Low.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/4ca0d39736624a928a80d33b13fb992e74510/33/5bc638b5/String.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/9fd3b083f28f40c0827cc635e2e56ca7459200/04/fc0d5108/Node.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/9fd3b083f28f40c0827cc635e2e56ca7459200/1a/09997922/RpcAttribute.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/9fd3b083f28f40c0827cc635e2e56ca7459200/2d/aa985d46/Mathf.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/9fd3b083f28f40c0827cc635e2e56ca7459200/60/341003fb/Vector2.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/9fd3b083f28f40c0827cc635e2e56ca7459200/b8/f49a7aff/MultiplayerApi.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/9fd3b083f28f40c0827cc635e2e56ca7459200/dd/26a79861/Transform2D.cs" root0="SKIP_HIGHLIGHTING" />
</component>
<component name="MetaFilesCheckinStateConfiguration" checkMetaFiles="true" />
<component name="ProjectColorInfo">{
&quot;customColor&quot;: &quot;&quot;,
&quot;associatedIndex&quot;: 0
}</component>
<component name="ProjectId" id="2kBRuHPpI0f31kkZmrVLbkvA9GB" />
<component name="ProjectLevelVcsManager">
<ConfirmationsSetting value="2" id="Add" />
</component>
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;.NET Executable.Player.executor&quot;: &quot;Run&quot;,
&quot;ASKED_ADD_EXTERNAL_FILES&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;git-widget-placeholder&quot;: &quot;master&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;editor.preferences.fonts.default&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
},
&quot;keyToStringList&quot;: {
&quot;rider.external.source.directories&quot;: [
&quot;/Users/littlesheep/Library/Application Support/JetBrains/Rider2024.1/resharper-host/DecompilerCache&quot;,
&quot;/Users/littlesheep/Library/Application Support/JetBrains/Rider2024.1/resharper-host/SourcesCache&quot;,
&quot;/Users/littlesheep/Library/Application Support/Symbols/src&quot;
]
}
}</component>
<component name="RunManager" selected=".NET Executable.Player">
<configuration name="Editor" type="RunExe" factoryName=".NET Executable">
<option name="EXE_PATH" value="/Applications/Godot Mono.app/Contents/MacOS/Godot" />
<option name="PROGRAM_PARAMETERS" value="--path &quot;./&quot; --editor" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
<option name="RUNTIME_ARGUMENTS" value="" />
<option name="RUNTIME_TYPE" value="coreclr" />
<method v="2">
<option name="Build Solution" enabled="true" />
</method>
</configuration>
<configuration name="Player" type="RunExe" factoryName=".NET Executable">
<option name="EXE_PATH" value="/Applications/Godot Mono.app/Contents/MacOS/Godot" />
<option name="PROGRAM_PARAMETERS" value="--path &quot;./&quot;" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
<option name="RUNTIME_ARGUMENTS" value="" />
<option name="RUNTIME_TYPE" value="coreclr" />
<method v="2">
<option name="Build Solution" enabled="true" />
</method>
</configuration>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="c7bd02c7-bbb4-431f-81ca-d2f8b7b09b37" name="Changes" comment="" />
<created>1722755204262</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1722755204262</updated>
<workItem from="1722755205564" duration="209000" />
<workItem from="1722755456311" duration="1821000" />
<workItem from="1722781577007" duration="2030000" />
<workItem from="1722842940315" duration="3257000" />
<workItem from="1722846222698" duration="9239000" />
<workItem from="1722855558149" duration="11578000" />
<workItem from="1723040712804" duration="74000" />
<workItem from="1723040934916" duration="1749000" />
</task>
<task id="LOCAL-00001" summary=":sparkles: Usable multiplayer">
<option name="closed" value="true" />
<created>1722856110213</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1722856110213</updated>
</task>
<option name="localTasksCounter" value="2" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="UnityCheckinConfiguration" checkUnsavedScenes="true" />
<component name="UnityProjectConfiguration" hasMinimizedUI="false" />
<component name="VcsManagerConfiguration">
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
<MESSAGE value=":sparkles: Usable multiplayer" />
<option name="LAST_COMMIT_MESSAGE" value=":sparkles: Usable multiplayer" />
</component>
<component name="XSLT-Support.FileAssociations.UIState">
<expand />
<select />
</component>
</project>

View File

@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012 # Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodingLand", "CodingLand.csproj", "{34C1D1E1-B85A-4557-8214-332509D2F647}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AceField", "AceField.csproj", "{34C1D1E1-B85A-4557-8214-332509D2F647}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@ -1,10 +1,9 @@
[gd_scene load_steps=6 format=3 uid="uid://bjhmjrldq4lkt"] [gd_scene load_steps=5 format=3 uid="uid://bjhmjrldq4lkt"]
[ext_resource type="PackedScene" uid="uid://b3gx0bl43lku3" path="res://Scenes/Player.tscn" id="1_vby0g"] [ext_resource type="PackedScene" uid="uid://b3gx0bl43lku3" path="res://Scenes/Player.tscn" id="1_vby0g"]
[ext_resource type="PackedScene" uid="uid://bvll23f5ibd4v" path="res://Scenes/UI/StartScreen.tscn" id="2_7o53i"] [ext_resource type="PackedScene" uid="uid://bvll23f5ibd4v" path="res://Scenes/UI/StartScreen.tscn" id="2_7o53i"]
[ext_resource type="Script" path="res://Scripts/Launcher.cs" id="2_u5cms"] [ext_resource type="Script" path="res://Scripts/Launcher.cs" id="2_u5cms"]
[ext_resource type="Script" path="res://Scripts/Logic/World.cs" id="3_xwguj"] [ext_resource type="Script" path="res://Scripts/Logic/World.cs" id="3_xwguj"]
[ext_resource type="Script" path="res://Scripts/TilesManager.cs" id="5_5wdx5"]
[node name="Node" type="Node"] [node name="Node" type="Node"]
@ -19,13 +18,6 @@ World = NodePath("../World")
script = ExtResource("3_xwguj") script = ExtResource("3_xwguj")
PlayerScene = ExtResource("1_vby0g") PlayerScene = ExtResource("1_vby0g")
[node name="TilesSpawner" type="MultiplayerSpawner" parent="World"]
_spawnable_scenes = PackedStringArray("res://Scenes/Tiles/Brick.tscn")
spawn_path = NodePath("../Tiles")
[node name="Tiles" type="Node2D" parent="World"]
script = ExtResource("5_5wdx5")
[node name="PlayerSpawner" type="MultiplayerSpawner" parent="."] [node name="PlayerSpawner" type="MultiplayerSpawner" parent="."]
_spawnable_scenes = PackedStringArray("res://Scenes/Player.tscn") _spawnable_scenes = PackedStringArray("res://Scenes/Player.tscn")
spawn_path = NodePath("../World") spawn_path = NodePath("../World")

View File

@ -1,24 +0,0 @@
[gd_scene load_steps=4 format=3 uid="uid://nj0k4l4mgq6"]
[ext_resource type="Texture2D" uid="uid://c2qpm7mcrvq57" path="res://Sprites/Brick.png" id="1_fms8g"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_saayk"]
size = Vector2(51.2, 51.2)
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_fbc2m"]
properties/0/path = NodePath(".:position")
properties/0/spawn = true
properties/0/replication_mode = 1
[node name="Brick" type="StaticBody2D"]
[node name="Sprite2D" type="Sprite2D" parent="."]
position = Vector2(2.08165e-12, 2.08165e-12)
scale = Vector2(0.05, 0.05)
texture = ExtResource("1_fms8g")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_saayk")
[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
replication_config = SubResource("SceneReplicationConfig_fbc2m")

View File

@ -1,7 +1,7 @@
using CodingLand.Scripts.Logic; using AceField.Scripts.Logic;
using Godot; using Godot;
namespace CodingLand.Scripts; namespace AceField.Scripts;
public partial class Launcher : Node public partial class Launcher : Node
{ {

View File

@ -1,44 +1,36 @@
using Godot; using Godot;
namespace CodingLand.Scripts.Logic; namespace AceField.Scripts.Logic;
public partial class PlayerInput : MultiplayerSynchronizer public partial class PlayerInput : MultiplayerSynchronizer
{ {
[Export] public bool IsDashing; [Export] public bool IsDashing;
[Export] public Vector2 BuildingAt; [Export] public Vector2 MovementDirection;
[Export] public Vector2 MovementDirection; private bool IsCurrentPlayer => GetMultiplayerAuthority() == Multiplayer.GetUniqueId();
private bool IsCurrentPlayer => GetMultiplayerAuthority() == Multiplayer.GetUniqueId(); public override void _Ready()
{
if (IsCurrentPlayer) return;
SetProcess(false);
SetPhysicsProcess(false);
}
public override void _Ready() [Rpc(CallLocal = true)]
{ private void Dash()
if (IsCurrentPlayer) return; => IsDashing = true;
SetProcess(false);
SetPhysicsProcess(false);
}
[Rpc(CallLocal = true)] public override void _Process(double delta)
private void Dash() {
=> IsDashing = true; MovementDirection = Input.GetVector("move_left", "move_right", "move_up", "move_down");
[Rpc(CallLocal = true)] if (Input.IsActionJustPressed("move_dash"))
private void Build(Vector2 pos) Rpc(nameof(Dash));
=> BuildingAt = pos; }
public override void _Process(double delta) public override void _Input(InputEvent evt)
{ {
MovementDirection = Input.GetVector("move_left", "move_right", "move_up", "move_down"); if (!IsCurrentPlayer) return;
}
if (Input.IsActionJustPressed("move_dash"))
Rpc(nameof(Dash));
}
public override void _Input(InputEvent evt)
{
if (!IsCurrentPlayer) return;
if (evt is InputEventMouseButton { Pressed: true })
Rpc(nameof(Build), GetViewport().GetMousePosition());
}
} }

View File

@ -1,7 +1,6 @@
using Godot; using Godot;
using Vector2 = Godot.Vector2;
namespace CodingLand.Scripts.Logic; namespace AceField.Scripts.Logic;
public partial class World : Node2D public partial class World : Node2D
{ {
@ -47,7 +46,7 @@ public partial class World : Node2D
private void AddPlayer(int id) private void AddPlayer(int id)
{ {
var player = PlayerScene.Instantiate<Player>(); var player = PlayerScene.Instantiate<AceField.Scripts.Player>();
player.SetPlayerId(id); player.SetPlayerId(id);
var position = Vector2.FromAngle(GD.Randf() * 2 * Mathf.Pi); var position = Vector2.FromAngle(GD.Randf() * 2 * Mathf.Pi);
player.Position = new Vector2(position.X * 5f * GD.Randf(), position.Y * 5f * GD.Randf()); player.Position = new Vector2(position.X * 5f * GD.Randf(), position.Y * 5f * GD.Randf());

View File

@ -1,7 +1,7 @@
using CodingLand.Scripts.Logic; using AceField.Scripts.Logic;
using Godot; using Godot;
namespace CodingLand.Scripts; namespace AceField.Scripts;
public partial class Player : CharacterBody2D public partial class Player : CharacterBody2D
{ {
@ -37,27 +37,14 @@ public partial class Player : CharacterBody2D
PlayerInput.SetMultiplayerAuthority(id); PlayerInput.SetMultiplayerAuthority(id);
} }
private TilesManager _tilesMgr;
public override void _Ready() public override void _Ready()
{ {
if (PlayerId == Multiplayer.GetUniqueId()) if (PlayerId == Multiplayer.GetUniqueId())
PlayerCamera.Enabled = true; PlayerCamera.Enabled = true;
_tilesMgr = GetNode<TilesManager>("../Tiles");
} }
public override void _Process(double delta) public override void _Process(double delta)
{ {
var vec = GetGlobalMousePosition();
if (PlayerInput.BuildingAt == Vector2.Zero) return;
var distance = Position.DistanceTo(vec);
if (distance <= Reach * _tilesMgr.TileSize)
{
// Able to build
Rpc(nameof(AddTile), vec);
}
PlayerInput.BuildingAt = Vector2.Zero;
} }
public override void _PhysicsProcess(double delta) public override void _PhysicsProcess(double delta)
@ -88,16 +75,4 @@ public partial class Player : CharacterBody2D
Position += Velocity * (float)delta; Position += Velocity * (float)delta;
MoveAndSlide(); MoveAndSlide();
} }
[Rpc(mode: MultiplayerApi.RpcMode.AnyPeer, CallLocal = true)]
public void AddTile(Vector2 pos)
{
if (_tilesMgr.GetTileByPosition<Node2D>(pos) != null) return;
var tileVec = new Vector2(_tilesMgr.TileSize, _tilesMgr.TileSize);
var blueprint = GD.Load<PackedScene>("res://Scenes/Tiles/Brick.tscn");
var instance = blueprint.Instantiate<Node2D>();
instance.Position = pos.Snapped(tileVec);
_tilesMgr.AddChild(instance);
}
} }

View File

@ -1,35 +0,0 @@
using Godot;
namespace CodingLand.Scripts;
public partial class TilesManager : Node2D
{
[Export] public float TileSize = 51.2f;
[Rpc(CallLocal = true)]
public void AddTile(Vector2 pos)
{
if (GetTileByPosition<Node2D>(pos) == null)
{
var tileVec = new Vector2(TileSize, TileSize);
// TODO Replace the brick to player selection
var blueprint = GD.Load<PackedScene>("res://Scenes/Tiles/Brick.tscn");
var instance = blueprint.Instantiate<Node2D>();
instance.Position = pos.Snapped(tileVec);
AddChild(instance);
}
}
public T GetTileByPosition<T>(Vector2 position) where T : Node2D
{
foreach (var item in GetChildren())
{
if (item is T tile && tile.Position == position)
{
return tile;
}
}
return null;
}
}

View File

@ -1,6 +1,6 @@
using Godot; using Godot;
namespace CodingLand.Scripts.UI; namespace AceField.Scripts.UI;
public partial class StartScreen : Control public partial class StartScreen : Control
{ {

View File

@ -10,14 +10,14 @@ config_version=5
[application] [application]
config/name="CodingLand" config/name="AceField"
run/main_scene="res://Scenes/Root.tscn" run/main_scene="res://Scenes/Root.tscn"
config/features=PackedStringArray("4.2", "C#", "Mobile") config/features=PackedStringArray("4.2", "C#", "Mobile")
config/icon="res://icon.svg" config/icon="res://icon.svg"
[dotnet] [dotnet]
project/assembly_name="CodingLand" project/assembly_name="AceField"
[input] [input]