├── .gitattributes
├── .github
├── actions
│ └── godot-install
│ │ └── action.yml
├── version
│ └── GitVersion.yml
└── workflows
│ └── build_test_deploy.yml
├── .gitignore
├── .runsettings
├── .runsettings-ci
├── Example
├── GlobalReferences.cs
├── GlobalReferences.cs.uid
├── Player.cs
├── Player.cs.uid
├── Player.tscn
├── Startup.tscn
├── UI.cs
└── UI.cs.uid
├── Facepunch
├── Facepunch.Steamworks.Posix.dll
└── Facepunch.Steamworks.Win64.dll
├── LICENSE.txt
├── Properties
└── launchSettings.json
├── README.md
├── Steam
├── SteamConnection.cs
├── SteamConnection.cs.uid
├── SteamConnectionManager.cs
├── SteamConnectionManager.cs.uid
├── SteamExtensions.cs
├── SteamExtensions.cs.uid
├── SteamManager.cs
├── SteamManager.cs.uid
├── SteamMultiplayerPeer.cs
├── SteamMultiplayerPeer.cs.uid
├── SteamNetworkingMessage.cs
├── SteamNetworkingMessage.cs.uid
├── SteamPacketPeer.cs
├── SteamPacketPeer.cs.uid
├── SteamSocketManager.cs
└── SteamSocketManager.cs.uid
├── SteamMultiplayerPeer.csproj
├── SteamMultiplayerPeer.sln
├── Tests
├── SteamManagerTests.cs
├── SteamManagerTests.cs.uid
├── Usings.cs
└── Usings.cs.uid
├── icon.svg
├── icon.svg.import
├── project.godot
├── steam_api.dll
└── steam_api64.dll
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Normalize EOL for all files that Git considers text files.
2 | * text=auto eol=lf
3 |
--------------------------------------------------------------------------------
/.github/actions/godot-install/action.yml:
--------------------------------------------------------------------------------
1 | ## Taken from : https://github.com/MikeSchulze/gdUnit4Mono/blob/master/.github/actions/godot-install/action.yml
2 |
3 | name: install-godot-binary
4 | description: "Installs the Godot Runtime"
5 |
6 | inputs:
7 | godot-version:
8 | description: "The Godot engine version"
9 | required: true
10 | godot-status-version:
11 | description: "The Godot engine status version"
12 | required: true
13 | godot-mono:
14 | required: false
15 | default: "false"
16 | godot-bin-name:
17 | required: true
18 | godot-cache-path:
19 | required: true
20 |
21 | runs:
22 | using: composite
23 | steps:
24 | - name: "Set Cache Name"
25 | shell: bash
26 | run: |
27 | if ${{inputs.godot-mono == 'true'}}; then
28 | echo "CACHE_NAME=${{ runner.OS }}-Godot_v${{ inputs.godot-version }}-${{ inputs.godot-status-version }}_mono" >> "$GITHUB_ENV"
29 | else
30 | echo "CACHE_NAME=${{ runner.OS }}-Godot_v${{ inputs.godot-version }}-${{ inputs.godot-status-version }}" >> "$GITHUB_ENV"
31 | fi
32 |
33 | - name: "Build Cache"
34 | uses: actions/cache@v4
35 | id: godot-cache-binary
36 | with:
37 | path: ${{ inputs.godot-cache-path }}
38 | key: ${{ env.CACHE_NAME }}
39 | restore-keys: ${{ env.CACHE_NAME }}
40 |
41 | - name: "Download and Install Godot ${{ inputs.godot-version }}"
42 | if: steps.godot-cache-binary.outputs.cache-hit != 'true'
43 | continue-on-error: false
44 | shell: bash
45 | run: |
46 | mkdir -p ${{ inputs.godot-cache-path }}
47 | chmod 770 ${{ inputs.godot-cache-path }}
48 | DIR="$HOME/.config/godot"
49 | if [ ! -d "$DIR" ]; then
50 | mkdir -p "$DIR"
51 | chmod 770 "$DIR"
52 | fi
53 |
54 | DOWNLOAD_URL=https://github.com/godotengine/godot-builds/releases/download/${{ inputs.godot-version }}-${{ inputs.godot-status-version }}
55 | GODOT_BIN=Godot_v${{ inputs.godot-version }}-${{ inputs.godot-status-version }}_${{ inputs.godot-bin-name }}
56 | if ${{inputs.godot-mono == 'true'}}; then
57 | GODOT_BIN=Godot_v${{ inputs.godot-version }}-${{ inputs.godot-status-version }}_mono_${{ inputs.godot-bin-name }}
58 | fi
59 |
60 | GODOT_PACKAGE=$GODOT_BIN.zip
61 | wget $DOWNLOAD_URL/$GODOT_PACKAGE -P ${{ inputs.godot-cache-path }}
62 | unzip ${{ inputs.godot-cache-path }}/$GODOT_PACKAGE -d ${{ inputs.godot-cache-path }}
63 | rm -rf ${{ inputs.godot-cache-path }}/$GODOT_PACKAGE
64 |
65 | if ${{runner.OS == 'Linux'}}; then
66 | echo "Run linux part"
67 |
68 | if ${{inputs.godot-mono == 'true'}}; then
69 | mv ${{ inputs.godot-cache-path }}/$GODOT_BIN/* ${{ inputs.godot-cache-path }}
70 | rmdir ${{ inputs.godot-cache-path }}/$GODOT_BIN/
71 | fi
72 |
73 | mv ${{ inputs.godot-cache-path }}/Godot_v* ${{ inputs.godot-cache-path }}/godot
74 | chmod u+x ${{ inputs.godot-cache-path }}/godot
75 | echo "${{ inputs.godot-cache-path }}/godot"
76 | else
77 | echo "Run windows part"
78 | pwd
79 | mv ${{ inputs.godot-cache-path }}/$GODOT_BIN ${{ inputs.godot-cache-path }}/godot.exe
80 | chmod u+x ${{ inputs.godot-cache-path }}/godot.exe
81 | ${{ inputs.godot-cache-path }}/godot.exe --version
82 | echo "${{ inputs.godot-cache-path }}/godot.exe"
83 | fi
--------------------------------------------------------------------------------
/.github/version/GitVersion.yml:
--------------------------------------------------------------------------------
1 | assembly-versioning-scheme: MajorMinorPatch
2 | mode: Mainline
3 | continuous-delivery-fallback-tag: ''
4 | major-version-bump-message: '\+semver:\s?(breaking|major)'
5 | minor-version-bump-message: '\+semver:\s?(feature|minor)'
6 | patch-version-bump-message: '\+semver:\s?(fix|patch)'
7 | branches: {}
8 | ignore:
9 | sha: []
10 | commit-date-format: R
11 | merge-message-formats: {}
--------------------------------------------------------------------------------
/.github/workflows/build_test_deploy.yml:
--------------------------------------------------------------------------------
1 | name: .NET Build and Godot Test
2 |
3 | on:
4 | push:
5 | branches: [ "master" ]
6 |
7 | jobs:
8 | build-and-test:
9 | name: "Build and Test"
10 | runs-on: ubuntu-latest
11 | steps:
12 | - uses: actions/checkout@v4
13 | with:
14 | lfs: true
15 | fetch-depth: 0
16 |
17 | - name: Install GitVersion
18 | uses: gittools/actions/gitversion/setup@v0.9.7
19 | with:
20 | versionSpec: '5.x'
21 |
22 | - name: Determine Version
23 | id: gitversion # id to later be referenced
24 | uses: gittools/actions/gitversion/execute@v0
25 | with:
26 | useConfigFile: true
27 | configFilePath: .github/version/GitVersion.yml
28 |
29 | - name: "Install Godot Mono '4.2.1'"
30 | uses: ./.github/actions/godot-install
31 | with:
32 | godot-version: '4.2.1'
33 | godot-mono: true
34 | godot-status-version: 'stable'
35 | godot-bin-name: 'linux_x86_64'
36 | godot-cache-path: '~/godot-linux'
37 |
38 | - uses: actions/setup-dotnet@v4
39 | with:
40 | dotnet-version: 8.0.x
41 |
42 | - name: "Build and Restore"
43 | if: ${{ !cancelled() }}
44 | run: |
45 | dotnet restore SteamMultiplayerPeer.csproj
46 | dotnet build --no-restore SteamMultiplayerPeer.csproj
47 |
48 | #this is 1000% going to fail. I need the container to have steam running on it with an authenticated account. Super duper fun stuff here, not sure how I am going to handle this. TODO
49 | - name: "Run Unit Tests"
50 | if: ${{ !cancelled() }}
51 | timeout-minutes: 5
52 | env:
53 | GODOT_BIN: "/home/runner/godot-linux/godot"
54 | run: |
55 | $GODOT_BIN --headless --build-solutions --quit-after 20
56 | xvfb-run --auto-servernum dotnet test GodotVoipNet.csproj --no-build --settings .runsettings-ci
57 |
58 |
59 | # eventually come back to.
60 |
61 | # - name: Package nuget
62 | # run: dotnet pack SteamMultiplayerPeer.csproj --configuration Release -o:package /p:PackageVersion=${{ steps.gitversion.outputs.AssemblySemVer }}
63 |
64 | # - name: Push Package to NuGet.org
65 | # run: dotnet nuget push ./package/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
66 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Mono auto generated files
17 | mono_crash.*
18 |
19 | # Build results
20 | [Dd]ebug/
21 | [Dd]ebugPublic/
22 | [Rr]elease/
23 | [Rr]eleases/
24 | x64/
25 | x86/
26 | [Ww][Ii][Nn]32/
27 | [Aa][Rr][Mm]/
28 | [Aa][Rr][Mm]64/
29 | bld/
30 | [Bb]in/
31 | [Oo]bj/
32 | [Ll]og/
33 | [Ll]ogs/
34 |
35 | # Visual Studio 2015/2017 cache/options directory
36 | .vs/
37 | # Uncomment if you have tasks that create the project's static files in wwwroot
38 | #wwwroot/
39 |
40 | # Visual Studio 2017 auto generated files
41 | Generated\ Files/
42 |
43 | # MSTest test Results
44 | [Tt]est[Rr]esult*/
45 | [Bb]uild[Ll]og.*
46 |
47 | # NUnit
48 | *.VisualState.xml
49 | TestResult.xml
50 | nunit-*.xml
51 |
52 | # Build Results of an ATL Project
53 | [Dd]ebugPS/
54 | [Rr]eleasePS/
55 | dlldata.c
56 |
57 | # Benchmark Results
58 | BenchmarkDotNet.Artifacts/
59 |
60 | # .NET Core
61 | project.lock.json
62 | project.fragment.lock.json
63 | artifacts/
64 |
65 | # ASP.NET Scaffolding
66 | ScaffoldingReadMe.txt
67 |
68 | # StyleCop
69 | StyleCopReport.xml
70 |
71 | # Files built by Visual Studio
72 | *_i.c
73 | *_p.c
74 | *_h.h
75 | *.ilk
76 | *.meta
77 | *.obj
78 | *.iobj
79 | *.pch
80 | *.pdb
81 | *.ipdb
82 | *.pgc
83 | *.pgd
84 | *.rsp
85 | *.sbr
86 | *.tlb
87 | *.tli
88 | *.tlh
89 | *.tmp
90 | *.tmp_proj
91 | *_wpftmp.csproj
92 | *.log
93 | *.tlog
94 | *.vspscc
95 | *.vssscc
96 | .builds
97 | *.pidb
98 | *.svclog
99 | *.scc
100 |
101 | # Chutzpah Test files
102 | _Chutzpah*
103 |
104 | # Visual C++ cache files
105 | ipch/
106 | *.aps
107 | *.ncb
108 | *.opendb
109 | *.opensdf
110 | *.sdf
111 | *.cachefile
112 | *.VC.db
113 | *.VC.VC.opendb
114 |
115 | # Visual Studio profiler
116 | *.psess
117 | *.vsp
118 | *.vspx
119 | *.sap
120 |
121 | # Visual Studio Trace Files
122 | *.e2e
123 |
124 | # TFS 2012 Local Workspace
125 | $tf/
126 |
127 | # Guidance Automation Toolkit
128 | *.gpState
129 |
130 | # ReSharper is a .NET coding add-in
131 | _ReSharper*/
132 | *.[Rr]e[Ss]harper
133 | *.DotSettings.user
134 |
135 | # TeamCity is a build add-in
136 | _TeamCity*
137 |
138 | # DotCover is a Code Coverage Tool
139 | *.dotCover
140 |
141 | # AxoCover is a Code Coverage Tool
142 | .axoCover/*
143 | !.axoCover/settings.json
144 |
145 | # Coverlet is a free, cross platform Code Coverage Tool
146 | coverage*.json
147 | coverage*.xml
148 | coverage*.info
149 |
150 | # Visual Studio code coverage results
151 | *.coverage
152 | *.coveragexml
153 |
154 | # NCrunch
155 | _NCrunch_*
156 | .*crunch*.local.xml
157 | nCrunchTemp_*
158 |
159 | # MightyMoose
160 | *.mm.*
161 | AutoTest.Net/
162 |
163 | # Web workbench (sass)
164 | .sass-cache/
165 |
166 | # Installshield output folder
167 | [Ee]xpress/
168 |
169 | # DocProject is a documentation generator add-in
170 | DocProject/buildhelp/
171 | DocProject/Help/*.HxT
172 | DocProject/Help/*.HxC
173 | DocProject/Help/*.hhc
174 | DocProject/Help/*.hhk
175 | DocProject/Help/*.hhp
176 | DocProject/Help/Html2
177 | DocProject/Help/html
178 |
179 | # Click-Once directory
180 | publish/
181 |
182 | # Publish Web Output
183 | *.[Pp]ublish.xml
184 | *.azurePubxml
185 | # Note: Comment the next line if you want to checkin your web deploy settings,
186 | # but database connection strings (with potential passwords) will be unencrypted
187 | *.pubxml
188 | *.publishproj
189 |
190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
191 | # checkin your Azure Web App publish settings, but sensitive information contained
192 | # in these scripts will be unencrypted
193 | PublishScripts/
194 |
195 | # NuGet Packages
196 | *.nupkg
197 | # NuGet Symbol Packages
198 | *.snupkg
199 | # The packages folder can be ignored because of Package Restore
200 | **/[Pp]ackages/*
201 | # except build/, which is used as an MSBuild target.
202 | !**/[Pp]ackages/build/
203 | # Uncomment if necessary however generally it will be regenerated when needed
204 | #!**/[Pp]ackages/repositories.config
205 | # NuGet v3's project.json files produces more ignorable files
206 | *.nuget.props
207 | *.nuget.targets
208 |
209 | # Microsoft Azure Build Output
210 | csx/
211 | *.build.csdef
212 |
213 | # Microsoft Azure Emulator
214 | ecf/
215 | rcf/
216 |
217 | # Windows Store app package directories and files
218 | AppPackages/
219 | BundleArtifacts/
220 | Package.StoreAssociation.xml
221 | _pkginfo.txt
222 | *.appx
223 | *.appxbundle
224 | *.appxupload
225 |
226 | # Visual Studio cache files
227 | # files ending in .cache can be ignored
228 | *.[Cc]ache
229 | # but keep track of directories ending in .cache
230 | !?*.[Cc]ache/
231 |
232 | # Others
233 | ClientBin/
234 | ~$*
235 | *~
236 | *.dbmdl
237 | *.dbproj.schemaview
238 | *.jfm
239 | *.pfx
240 | *.publishsettings
241 | orleans.codegen.cs
242 |
243 | # Including strong name files can present a security risk
244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
245 | #*.snk
246 |
247 | # Since there are multiple workflows, uncomment next line to ignore bower_components
248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
249 | #bower_components/
250 |
251 | # RIA/Silverlight projects
252 | Generated_Code/
253 |
254 | # Backup & report files from converting an old project file
255 | # to a newer Visual Studio version. Backup files are not needed,
256 | # because we have git ;-)
257 | _UpgradeReport_Files/
258 | Backup*/
259 | UpgradeLog*.XML
260 | UpgradeLog*.htm
261 | ServiceFabricBackup/
262 | *.rptproj.bak
263 |
264 | # SQL Server files
265 | *.mdf
266 | *.ldf
267 | *.ndf
268 |
269 | # Business Intelligence projects
270 | *.rdl.data
271 | *.bim.layout
272 | *.bim_*.settings
273 | *.rptproj.rsuser
274 | *- [Bb]ackup.rdl
275 | *- [Bb]ackup ([0-9]).rdl
276 | *- [Bb]ackup ([0-9][0-9]).rdl
277 |
278 | # Microsoft Fakes
279 | FakesAssemblies/
280 |
281 | # GhostDoc plugin setting file
282 | *.GhostDoc.xml
283 |
284 | # Node.js Tools for Visual Studio
285 | .ntvs_analysis.dat
286 | node_modules/
287 |
288 | # Visual Studio 6 build log
289 | *.plg
290 |
291 | # Visual Studio 6 workspace options file
292 | *.opt
293 |
294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
295 | *.vbw
296 |
297 | # Visual Studio 6 auto-generated project file (contains which files were open etc.)
298 | *.vbp
299 |
300 | # Visual Studio 6 workspace and project file (working project files containing files to include in project)
301 | *.dsw
302 | *.dsp
303 |
304 | # Visual Studio 6 technical files
305 | *.ncb
306 | *.aps
307 |
308 | # Visual Studio LightSwitch build output
309 | **/*.HTMLClient/GeneratedArtifacts
310 | **/*.DesktopClient/GeneratedArtifacts
311 | **/*.DesktopClient/ModelManifest.xml
312 | **/*.Server/GeneratedArtifacts
313 | **/*.Server/ModelManifest.xml
314 | _Pvt_Extensions
315 |
316 | # Paket dependency manager
317 | .paket/paket.exe
318 | paket-files/
319 |
320 | # FAKE - F# Make
321 | .fake/
322 |
323 | # CodeRush personal settings
324 | .cr/personal
325 |
326 | # Python Tools for Visual Studio (PTVS)
327 | __pycache__/
328 | *.pyc
329 |
330 | # Cake - Uncomment if you are using it
331 | # tools/**
332 | # !tools/packages.config
333 |
334 | # Tabs Studio
335 | *.tss
336 |
337 | # Telerik's JustMock configuration file
338 | *.jmconfig
339 |
340 | # BizTalk build output
341 | *.btp.cs
342 | *.btm.cs
343 | *.odx.cs
344 | *.xsd.cs
345 |
346 | # OpenCover UI analysis results
347 | OpenCover/
348 |
349 | # Azure Stream Analytics local run output
350 | ASALocalRun/
351 |
352 | # MSBuild Binary and Structured Log
353 | *.binlog
354 |
355 | # NVidia Nsight GPU debugger configuration file
356 | *.nvuser
357 |
358 | # MFractors (Xamarin productivity tool) working folder
359 | .mfractor/
360 |
361 | # Local History for Visual Studio
362 | .localhistory/
363 |
364 | # Visual Studio History (VSHistory) files
365 | .vshistory/
366 |
367 | # BeatPulse healthcheck temp database
368 | healthchecksdb
369 |
370 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
371 | MigrationBackup/
372 |
373 | # Ionide (cross platform F# VS Code tools) working folder
374 | .ionide/
375 |
376 | # Fody - auto-generated XML schema
377 | FodyWeavers.xsd
378 |
379 | # VS Code files for those working on multiple tools
380 | .vscode/*
381 | !.vscode/settings.json
382 | !.vscode/tasks.json
383 | !.vscode/launch.json
384 | !.vscode/extensions.json
385 | *.code-workspace
386 |
387 | # Local History for Visual Studio Code
388 | .history/
389 |
390 | # Windows Installer files from build outputs
391 | *.cab
392 | *.msi
393 | *.msix
394 | *.msm
395 | *.msp
396 |
397 | # JetBrains Rider
398 | *.sln.iml
399 | /.godot
400 | /settings.json
401 |
402 | # Gd Unit 4
403 | .godot
404 |
405 | gdunit4_testadapter/
406 |
407 | *.old
--------------------------------------------------------------------------------
/.runsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 1
5 | ./TestResults
6 | net8.0
7 | 180000
8 | true
9 |
10 | C:\Program Files (x86)\Godot\Godot_v4.2.1-stable_mono_win64\Godot_v4.2.1-stable_mono_win64.exe
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | detailed
19 |
20 |
21 |
22 |
23 | test-result.html
24 |
25 |
26 |
27 |
28 | test-result.trx
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | FullyQualifiedName
37 |
38 |
--------------------------------------------------------------------------------
/.runsettings-ci:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 1
5 | ./TestResults
6 | net8.0
7 | 180000
8 | true
9 |
10 |
11 |
12 |
13 |
14 |
15 | detailed
16 |
17 |
18 |
19 |
20 | test-result.html
21 |
22 |
23 |
24 |
25 | test-result.trx
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | --audio-driver Dummy --display-driver x11 --rendering-driver opengl3 --screen 0 --verbose
44 | FullyQualifiedName
45 |
46 |
--------------------------------------------------------------------------------
/Example/GlobalReferences.cs:
--------------------------------------------------------------------------------
1 | using Godot;
2 | using Steam;
3 |
4 | namespace SteamMultiplayerPeer.Example;
5 | internal static class GlobalReferences // is this bad practice? idk its an example project
6 | {
7 | public static SteamManager SteamManager(this Node node) => node.GetTree().Root.GetNode("Startup/SteamManager");
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/Example/GlobalReferences.cs.uid:
--------------------------------------------------------------------------------
1 | uid://c0khhu8ofy4ct
2 |
--------------------------------------------------------------------------------
/Example/Player.cs:
--------------------------------------------------------------------------------
1 | using Godot;
2 | using System;
3 |
4 | internal partial class Player : Node3D
5 | {
6 |
7 | public override void _EnterTree()
8 | {
9 | SetMultiplayerAuthority((int)long.Parse(Name));
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Example/Player.cs.uid:
--------------------------------------------------------------------------------
1 | uid://o64rv5mh52y2
2 |
--------------------------------------------------------------------------------
/Example/Player.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=2 format=3 uid="uid://d2isx4pc6x0ww"]
2 |
3 | [ext_resource type="Script" uid="uid://o64rv5mh52y2" path="res://Example/Player.cs" id="1_h8r3t"]
4 |
5 | [node name="Player" type="Node3D"]
6 | script = ExtResource("1_h8r3t")
7 |
--------------------------------------------------------------------------------
/Example/Startup.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=3 format=3 uid="uid://b27h0j08ndoxw"]
2 |
3 | [ext_resource type="Script" uid="uid://b0smp6qoaxdgl" path="res://Steam/SteamManager.cs" id="1_ngv6v"]
4 | [ext_resource type="Script" uid="uid://db1gw7slpkqjn" path="res://Example/UI.cs" id="2_tenw6"]
5 |
6 | [node name="Startup" type="Node3D"]
7 |
8 | [node name="SteamManager" type="Node" parent="."]
9 | script = ExtResource("1_ngv6v")
10 |
11 | [node name="UI" type="Control" parent="."]
12 | layout_mode = 3
13 | anchors_preset = 15
14 | anchor_right = 1.0
15 | anchor_bottom = 1.0
16 | grow_horizontal = 2
17 | grow_vertical = 2
18 | script = ExtResource("2_tenw6")
19 |
20 | [node name="VBoxContainer" type="VBoxContainer" parent="UI"]
21 | layout_mode = 1
22 | anchors_preset = 5
23 | anchor_left = 0.5
24 | anchor_right = 0.5
25 | offset_left = -20.0
26 | offset_right = 20.0
27 | offset_bottom = 40.0
28 | grow_horizontal = 2
29 |
30 | [node name="HostGame" type="Button" parent="UI/VBoxContainer"]
31 | layout_mode = 2
32 | text = "Host"
33 |
34 | [node name="TextEdit" type="TextEdit" parent="UI/VBoxContainer"]
35 | custom_minimum_size = Vector2(150, 40)
36 | layout_mode = 2
37 | placeholder_text = "Lobby Id"
38 |
39 | [node name="LeaveGame" type="Button" parent="UI/VBoxContainer"]
40 | layout_mode = 2
41 | text = "Leave"
42 |
43 | [node name="JoinGame" type="Button" parent="UI/VBoxContainer"]
44 | layout_mode = 2
45 | text = "Join"
46 |
47 | [node name="QuitGame" type="Button" parent="UI/VBoxContainer"]
48 | layout_mode = 2
49 | text = "Quit
50 | "
51 |
52 | [node name="LobbyVbox" type="VBoxContainer" parent="UI"]
53 | layout_mode = 0
54 | offset_right = 40.0
55 | offset_bottom = 40.0
56 |
57 | [node name="Label" type="Label" parent="UI/LobbyVbox"]
58 | layout_mode = 2
59 | text = "Lobby Information:"
60 |
61 | [node name="HBoxContainer" type="HBoxContainer" parent="UI/LobbyVbox"]
62 | layout_mode = 2
63 |
64 | [node name="Label" type="Label" parent="UI/LobbyVbox/HBoxContainer"]
65 | layout_mode = 2
66 | text = "Lobby Id: "
67 |
68 | [node name="LobbyIdLabel" type="TextEdit" parent="UI/LobbyVbox/HBoxContainer"]
69 | custom_minimum_size = Vector2(200, 50)
70 | layout_mode = 2
71 |
72 | [node name="CurrentMemberLabel" type="Label" parent="UI/LobbyVbox"]
73 | layout_mode = 2
74 | text = "CurrentMembers:"
75 |
76 | [node name="MemberVbox" type="VBoxContainer" parent="UI/LobbyVbox"]
77 | layout_mode = 2
78 |
79 | [node name="PlayerHolder" type="Node3D" parent="."]
80 |
81 | [node name="MultiplayerSpawner" type="MultiplayerSpawner" parent="."]
82 | _spawnable_scenes = PackedStringArray("uid://d2isx4pc6x0ww")
83 | spawn_path = NodePath("../PlayerHolder")
84 |
--------------------------------------------------------------------------------
/Example/UI.cs:
--------------------------------------------------------------------------------
1 | using Godot;
2 | using Godot.Collections;
3 | using SteamMultiplayerPeer.Example;
4 | using Steamworks.Data;
5 | using System.Collections.Generic;
6 | using System.Linq;
7 | using System.Threading.Tasks;
8 | internal partial class UI : Control
9 | {
10 | private Button _hostButton = null!;
11 | private Button _joinButton = null!;
12 | private Button _leaveGameButton = null!;
13 | private Button _quitButton = null!;
14 | private TextEdit _lobbyIdLabel = null!;
15 | private TextEdit _textEdit = null!;
16 | private VBoxContainer _memberVbox = null!;
17 | private Node3D _playerSpawnerNode = null!;
18 | private PackedScene _playerScene = ResourceLoader.Load("res://Example/Player.tscn");
19 | private bool _inLobby = false;
20 | public override void _Ready()
21 | {
22 | _hostButton = GetNode