KLingo Project Documentation 1.0.0
Unreal Engine 5.6 C++ Project Documentation
로딩중...
검색중...
일치하는것 없음
ULingoGameInstance.h
이 파일의 문서화 페이지로 가기
1// Fill out your copyright notice in the Description page of Project Settings.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "Engine/GameInstance.h"
7#include "ALingoPlayerState.h"
8#include "Interfaces/OnlineSessionInterface.h"
9#include "ULingoGameInstance.generated.h"
10
11UENUM(BlueprintType)
12enum class EPlayerRole : uint8
13{
14 // Use the default value specified by the native class or config value.
16 // Always update overlap state on initialization.
18 // Only update if root component has Movable mobility.
20 // Never update overlap state on initialization.
22};
28// 세션 검색 완료시 호출되는 함수 등록하는 Delegate
29DECLARE_DELEGATE_TwoParams(FFindComplete, int32, FString);
30
31UCLASS()
32class ONEPIECE_API ULingoGameInstance : public UGameInstance
33{
34 GENERATED_BODY()
35
36public:
38
39 // GameInstance 초기화 시 호출 (맵 전환 시에도 유지됨)
40 virtual void Init() override;
41
42 // GameInstance 종료 시 호출 (델리게이트 정리)
43 virtual void Shutdown() override;
44//
45// protected:
46// // Player의 UniqueNetId를 Key로, 선택한 Role을 Value로 저장
47// // ServerTravel 시 PlayerController 인스턴스가 바뀌어도 NetId는 유지됨
48// UPROPERTY()
49// TMap<FString, EPlayerRole> PlayerRoleMap;
50//
51// public:
52// /**
53// * Lobby에서 플레이어가 Role을 선택했을 때 호출
54// * @param PlayerController 역할을 선택한 플레이어 컨트롤러
55// * @param Role 선택한 역할 (Firefighter 또는 Citizen)
56// */
57// UFUNCTION(BlueprintCallable, Category = "Player")
58// void SetPlayerRole(APlayerController* PlayerController, EPlayerRole Role);
59//
60// /**
61// * HouseMap에서 Pawn 생성 시 PlayerController의 Role을 조회
62// * @param PlayerController 역할을 조회할 플레이어 컨트롤러
63// * @return 저장된 역할. 없으면 EPlayerRole::None 반환
64// */
65// UFUNCTION(BlueprintCallable, Category = "Player")
66// EPlayerRole GetPlayerRole(APlayerController* PlayerController) const;
67//
68// /**
69// * 디버깅용: 현재 저장된 모든 Role 출력
70// */
71// UFUNCTION(BlueprintCallable, Category = "Player")
72// void DebugPrintPlayerRoles() const;
73
74public:
75 /*===================================
76 * 세션 생성 & 조회
77 ===================================*/
78 // 세션의 모든 처리를 진행 하는 객체
79 IOnlineSessionPtr sessionInterface;
80
81 // 세션 생성 관련
82 // 현재 세션 이름
84 // 세션 생성 함수
85 UFUNCTION(BlueprintCallable)
86 void CreateMySession(FString displayName);
87 // 세션 생성 완료 함수
88 void OnCreateSessionComplete(FName sessionName, bool bWasSuccessful);
89
90 // 세션 조회 관련
91 // 세션 조회할 때 사용하는 객체
92 TSharedPtr<FOnlineSessionSearch> sessionSearch;
93 // 세션 조회 완료시 세션 갯수 만큼 호출하는 Delegate
94 FFindComplete onFindComplete;
95 // 세션 조회 함수
96 UFUNCTION(BlueprintCallable)
97 void FindOtherSession();
98 // 세션 조회 완료 함수
99 void OnFindSessionComplete(bool bWasSuccessful);
100
101 // 세션 참여 관련
102 // 세션 참여 함수
103 UFUNCTION(BlueprintCallable)
104 void JoinOtherSession(int32 sessionIdx);
105 // 세션 참여 완료 함수
106 void OnJoinSessionComplete(FName sessionName, EOnJoinSessionCompleteResult::Type result);
107
108 // 문자열을 UTF-8 --> base64 로 Encode 하는 함수
109 FString StringBase64Encode(FString str);
110 // 문자열을 base64 --> UTF-8 로 Decode 하는 함수
111 FString StringBase64Decode(FString str);
112
113 // 어떤 캐릭터 선택했는지
114 UPROPERTY(Transient)
115 TMap<FString, int32> selectCharacter;
116
117 void SetSelectCharacter(FString userName, int32 characterIdx);
118 int32 GetSelectCharacter(FString userName);
119};
DECLARE_DELEGATE_TwoParams(FFindComplete, int32, FString)
Custom GameInstance for managing persistent player data across map transitions Stores player role sel...
IOnlineSessionPtr sessionInterface
FFindComplete onFindComplete
TSharedPtr< FOnlineSessionSearch > sessionSearch