UOperatingSystemGameSubsystem
#include <OperatingSystemSimulator/Public/Subsystems/OperatingSystemGameSubsystem.h>class UOperatingSystemGameSubsystemDefined in OperatingSystemGameSubsystem.h:18
Inherits:
UGameInstanceSubsystem
Inheritance diagram
Section titled “Inheritance diagram”---
config:
class:
hideEmptyMembersBox: true
---
classDiagram
class UOperatingSystemGameSubsystem["UOperatingSystemGameSubsystem"]
class UGameInstanceSubsystem["UGameInstanceSubsystem"]
UGameInstanceSubsystem <|-- UOperatingSystemGameSubsystem
Collaboration diagram
Section titled “Collaboration diagram”---
config:
class:
hideEmptyMembersBox: true
---
classDiagram
class UOperatingSystemGameSubsystem["UOperatingSystemGameSubsystem"]
class FOperatingSystemUser["FOperatingSystemUser"]
UOperatingSystemGameSubsystem *-- FOperatingSystemUser
Class detail
Section titled “Class detail”---
config:
class:
hideEmptyMembersBox: true
---
classDiagram
class UOperatingSystemGameSubsystem {
+Initialize(FSubsystemCollectionBase &Collection) overr
+Deinitialize() override
+RequestFundsFromBank(const FOperatingSystemUser &TargetUser, con
+AddUserWhoRequestedFund(const FOperatingSystemUser &TargetUser) FTimerHandle &
+RemoveUserWhoRequestedFund(const FOperatingSystemUser &TargetUser)
+Get(const UObject *WorldContextObject) UOperatingSystemGameSubsystem() *
+UsersRequestedForFund : TMap< FOperatingSystemUser(), FTimerHand
}
This class represents the game subsystem for the operating system. It provides functionality for requesting funds from a bank.
Public Methods
Section titled “Public Methods”| Return | Name | Description |
|---|---|---|
void | Initialize virtual override | |
void | Deinitialize virtual override | |
void | RequestFundsFromBank | Requests funds from a bank for a specific user. The method checks if there is already a pending request for the user, if the user is a valid registered user, and if the fund details are valid. If any of these conditions are not met, an error is returned. Otherwise, a timer is set for the specified time to approve the fund request. Upon approval, the funds will be transferred to the user’s account. If the request is not approved, an error will be logged. Finally, the user who requested the funds and the corresponding JSON file will be removed. |
FTimerHandle & | AddUserWhoRequestedFund inline | Adds a user who requested funds to the list. This method adds a user who requested funds to the list of users who requested funds from the bank. |
void | RemoveUserWhoRequestedFund inline | Removes a user who requested funds from the list of users who requested funds from the bank. The method removes the specified TargetUser from the UsersRequestedForFund array and then compacts and shrinks the array to remove any empty slots. |
Initialize
Section titled “Initialize”virtual override
virtual void Initialize(FSubsystemCollectionBase & Collection) overrideDefined in OperatingSystemGameSubsystem.h:35
References
Section titled “References”Deinitialize
Section titled “Deinitialize”virtual override
virtual void Deinitialize() overrideDefined in OperatingSystemGameSubsystem.h:36
References
Section titled “References”RequestFundsFromBank
Section titled “RequestFundsFromBank”void RequestFundsFromBank(const FOperatingSystemUser & TargetUser, const FOperatingSystemRequestFund & FundDetails, FGenericError & OutError)Defined in OperatingSystemGameSubsystem.h:48 Requests funds from a bank for a specific user. The method checks if there is already a pending request for the user, if the user is a valid registered user, and if the fund details are valid. If any of these conditions are not met, an error is returned. Otherwise, a timer is set for the specified time to approve the fund request. Upon approval, the funds will be transferred to the user’s account. If the request is not approved, an error will be logged. Finally, the user who requested the funds and the corresponding JSON file will be removed.
Parameters
Section titled “Parameters”-
TargetUserThe user for whom funds are being requested. -
FundDetailsThe details of the fund request, including the account number, amount, and time to approve. -
OutErrorAn output parameter to hold any error that may occur during the fund request process.
References
Section titled “References”AddUserWhoRequestedFundCanApproveDeleteFileErrorExceptionDescriptionGetTimeGetUserUniqueIdIsRegisteredValidIsValidIsValidMAKE_ERROROS_LOG_ERRORRemoveUserWhoRequestedFundResetTimeToApproveToStringUsernameUsersRequestedForFundWriteStructToJson
AddUserWhoRequestedFund
Section titled “AddUserWhoRequestedFund”inline
inline FTimerHandle & AddUserWhoRequestedFund(const FOperatingSystemUser & TargetUser)Defined in OperatingSystemGameSubsystem.h:57 Adds a user who requested funds to the list. This method adds a user who requested funds to the list of users who requested funds from the bank.
Parameters
Section titled “Parameters”TargetUserThe user who requested funds.
Returns
Section titled “Returns”A reference to the timer handle associated with the user’s fund request.
Referenced by
Section titled “Referenced by”RemoveUserWhoRequestedFund
Section titled “RemoveUserWhoRequestedFund”inline
inline void RemoveUserWhoRequestedFund(const FOperatingSystemUser & TargetUser)Defined in OperatingSystemGameSubsystem.h:68 Removes a user who requested funds from the list of users who requested funds from the bank. The method removes the specified TargetUser from the UsersRequestedForFund array and then compacts and shrinks the array to remove any empty slots.
Parameters
Section titled “Parameters”TargetUserThe user to remove from the list.
Referenced by
Section titled “Referenced by”Public Static Methods
Section titled “Public Static Methods”| Return | Name | Description |
|---|---|---|
UOperatingSystemGameSubsystem * | Get static | Returns the UOperatingSystemGameSubsystem instance associated with the specified UObject. |
static
static UOperatingSystemGameSubsystem * Get(const UObject * WorldContextObject)Defined in OperatingSystemGameSubsystem.h:33 Returns the UOperatingSystemGameSubsystem instance associated with the specified UObject.
Parameters
Section titled “Parameters”WorldContextObjectThe UObject used to determine the UGameInstance and retrieve the UOperatingSystemGameSubsystem instance.
Returns
Section titled “Returns”The UOperatingSystemGameSubsystem instance associated with the specified UObject.
Referenced by
Section titled “Referenced by”Private Attributes
Section titled “Private Attributes”| Return | Name | Description |
|---|---|---|
TMap< FOperatingSystemUser, FTimerHandle > | UsersRequestedForFund |
UsersRequestedForFund
Section titled “UsersRequestedForFund”TMap< FOperatingSystemUser, FTimerHandle > UsersRequestedForFundDefined in OperatingSystemGameSubsystem.h:23