HowToUsePlugin.md
Table of Contents
Installation Instructions
1. Import Unity Package
Import the DiarkisUnityPlugin.unitypackage
into your target project.
2. Configure Connection Information
Select Assets/Diarkis/Prefabs/DiarkisNetworkManager
and display the DiarkisNetworkManager
script in the Inspector.
Next, click on the item labeled Transport
to display its contents, and configure the connection information to Diarkis as follows:
3. Place the Prefab in the Scene
Place the configured DiarkisNetworkManager
prefab into the scene.
Ensure that AutoStartConnect
is checked (it is on by default), and click the play button at the top of the editor.
This will automatically initiate the connection to the Diarkis server.
How to Use the Plugin
Setting Up the DiarkisNetworkManager Prefab
DiarkisNetworkManager
is a crucial class responsible for the connection to Diarkis and must be placed in the scene.
The main settings are as follows:
Requesting Network Connection & Disconnection
To connect (or disconnect) to the Diarkis network, call the functions through DiarkisNetworkManager
.
Receiving Network Connection & Disconnection Responses
Responses from the server can be received as events.
First, add a component that triggers events to the scene.
Add an appropriate GameObject
to the scene and attach the DiarkisCoreEventCallback
component to it.
This component allows you to register functions, which will be triggered in response to event occurrences.
Create a class to register functions as follows:
Attach this script to an appropriate GameObject
, and register the functions you want to be called upon event occurrence to DiarkisCoreEventCallback
.
In this way, you can receive responses from the server.
Utilizing Various Modules
Diarkis includes the following modules:
To send data, call the corresponding functions of each module.
To receive data, place the corresponding event components in the scene and register functions to them.
As an example, let's create a new room using the Room
module.
Sending Requests from the Room Module
The following code uses the Room
module to create a new room.
Receiving Responses from the Room Module
First, attach the DiarkisRoomEventCallback
to an appropriate GameObject
placed in the scene.
Then, create a class to receive events as follows:
Finally, place this script in the scene and register the function to DiarkisRoomEventCallback
's OnRoomCreate
.
This allows you to receive the results when Room.Create
is called.
While the Room
module has been taken as an example here, the usage of other modules is similar.
Feature Reference
Core Features
Property List (Core)
Method List (Core)
Event List (Core)
Room Features
Property List (Room)
Method List (Room)
Event List (Room)
Group Features
Property List (Group)
Method List (Group)
Event List (Group)
Field Features
Property List (Field)
Method List (Field)
Event List (Field)
MatchMaker Features
Property List (MatchMaker)
Method List (MatchMaker)
Event List (MatchMaker)
最終更新