게임 아이디어와 기능

다음에 추가할 기능

플레이어 우편함

개별 알림과 프로젝트 공지를 보호된 보상 및 통합 소셜 폴링으로 제공합니다.

SDK: develop 브랜치플레이어 세션 필요
Godot
플레이어 우편함 일러스트
확인할 수 있는 결과

게임이 개별 메시지와 공지를 표시하고 읽음 처리하며 각 보호 보상을 최대 한 번 수령합니다.

동영상 준비 중

이 단계의 동영상은 아직 없습니다. 안내와 MCP 요청은 바로 사용할 수 있습니다.

플레이어 우편함

같은 프로젝트 준비

  1. 게임 설정과 같은 프로젝트를 대시보드에서 선택하세요.

    플레이어 우편함 →
  2. 첫 요청에는 추가 정의가 필요하지 않습니다. 일치하는 게임 데이터가 없으면 빈 결과도 정상입니다.

    프로젝트에 일반 텍스트 공지를 게시하기 전에 테스트 플레이어를 등록하세요. 같은 플레이어로 수신함을 읽으세요.

    게시 시점까지 등록되었고 현재 활성 상태인 프로젝트 플레이어가 대상입니다. 이전에 비활성이던 플레이어도 다시 활성화되면 대상이 될 수 있습니다. 이후 등록자는 제외됩니다.

이 기능 구현하기

가이드는 미리 볼 수 있습니다. 실행하려면 활성 프로젝트 키가 필요합니다. 프로젝트 준비

SDK 설치와 프로젝트 설정 가져오기가 완료되고 플레이어가 로그인해야 합니다.

이 SDK 예제는 develop을 사용합니다. 필요한 API가 설치된 SDK에 있는지 확인하세요.

빠른 시작으로 원하는 플레이어를 연결하세요. 명시적인 버튼이나 씬 동작에서 run_reviewed_action()을 호출하세요. 파일을 여는 것만으로는 요청을 보내지 않습니다.

GDScript
res://scripts/inbox.gd
horizOn 호출
1extends Node
2​
3# Existing configured SDK and authenticated player session required.
4# Invoke run_reviewed_action explicitly after reviewing this example.
5func run_reviewed_action() -> void:
6 if not Horizon.auth.isSignedIn():
7 return
8 var user_id: String = Horizon.auth.getCurrentUser().userId
9 var loaded: Dictionary = await Horizon.inbox.getInbox(user_id, "")
10 if not loaded.success:
11 push_error(loaded.errorCode)
12 return
13 for entry in loaded.data.entries:
14 print(entry.textKey)
15 # The SDK materializes unchanged responses from its project/player cache.
16 # Respect loaded.data.pollAfterSeconds and stop refreshing with the game lifecycle.
17​
18 var claim_state := {"busy": false}
19 var claim_selected = func(entry_id: String) -> void:
20 if claim_state.busy:
21 return
22 var project_id := "YOUR_PROJECT_ID"
23 var path := "user://inbox_claim_" + project_id + "_" + user_id + ".txt"
24 if FileAccess.file_exists(path):
25 var previous := FileAccess.open(path, FileAccess.READ)
26 if previous == null:
27 return
28 var pending := previous.get_as_text()
29 previous.close()
30 if pending != entry_id:
31 return # Resolve the original claim first.
32 else:
33 var current: Dictionary = Horizon.inbox.getCurrentInbox()
34 if current.get("userId", "") != user_id:
35 return
36 var selected: Dictionary = {}
37 for entry in current.get("entries", []):
38 if entry.id == entry_id:
39 selected = entry
40 break
41 if selected.is_empty() or selected.claimed:
42 return
43 var attachment = selected.get("attachment")
44 if not attachment is Dictionary or attachment.get("values", []).is_empty():
45 return
46 # An existing identical pending ID bypasses this new-selection guard for safe replay.
47 var file := FileAccess.open(path, FileAccess.WRITE)
48 if file == null:
49 return
50 file.store_string(entry_id)
51 file.flush()
52 var saved_ok := file.get_error() == OK
53 file.close()
54 if not saved_ok:
55 return
56 claim_state.busy = true
57 var claimed: Dictionary = await Horizon.inbox.claim(user_id, entry_id)
58 claim_state.busy = false
59 if not claimed.success:
60 push_error(claimed.errorCode)
61 return
62 # Display claimed.data.inbox and replace values with claimed.data.playerValues.
63 # Never add the reward delta locally.
64 var current := FileAccess.open(path, FileAccess.READ)
65 if current != null:
66 var still_pending := current.get_as_text() == entry_id
67 current.close()
68 if still_pending:
69 DirAccess.remove_absolute(ProjectSettings.globalize_path(path))
70 # Bind claim_selected to an explicit player action; do not claim automatically.
71 # Retry the same saved entry_id after an uncertain response.
72 # Other deliberate actions: await Horizon.inbox.markRead(user_id, entry_id)
73 # await Horizon.inbox.remove(user_id, entry_id) # Protects unclaimed rewards.
전체 SDK 예제 열기 ↗

새 기능을 테스트하세요.

게임이 개별 메시지와 공지를 표시하고 읽음 처리하며 각 보호 보상을 최대 한 번 수령합니다.

게임 설정과 같은 프로젝트를 대시보드에서 선택하세요.

엔드포인트
  • GET/inbox
  • POST/inbox/read
  • POST/inbox/claim
  • POST/inbox/remove
API 레퍼런스의 모든 엔드포인트
리더보드 일러스트
다음 단계에 대한 추천

모든 라운드에 최고 점수를 더하세요.

라운드가 끝나면 점수를 저장하고 선두를 보여주세요. 기존 연결과 플레이어 세션을 계속 사용하세요.