API Reference of GS2-MegaField SDK for Game Engine
Model
EzAreaModel
Area divides space, and different areas can be treated as different spaces even if they have the same coordinates.
| Type | Require | Default | Limitation | Description |
---|
name | string | ✓ | | ~ 128 chars | Area Model Name |
metadata | string | | | ~ 2048 chars | metadata |
layerModels | List<EzLayerModel> | | | | List of layer models |
EzLayerModel
Layers allow for multiple logical hierarchies within a single space.
For example, it solves the problem of an Enemy being invisible in a space with a large number of characters.
Characters are placed on Layer 1. If Enemies are placed on Layer 2, there is no need to worry about them becoming invisible, since each layer can specify the quantity to be acquired within a specified distance.
| Type | Require | Default | Limitation | Description |
---|
name | string | ✓ | | ~ 128 chars | Layer Model Name |
metadata | string | | | ~ 2048 chars | metadata |
EzMyPosition
My Location
| Type | Require | Default | Limitation | Description |
---|
position | EzPosition | ✓ | | | Position |
vector | EzVector | ✓ | | | Vector |
r | float | ✓ | 1 | ~ 10000 | Radius |
EzPosition
Position
| Type | Require | Default | Limitation | Description |
---|
x | float | ✓ | | ~ 1048574 | X position |
y | float | ✓ | | ~ 1048574 | Y position |
z | float | ✓ | | ~ 1048574 | Z position |
EzScope
Surroundings to be acquired
| Type | Require | Default | Limitation | Description |
---|
r | float | ✓ | | 1 ~ 16777214 | Radius |
limit | int | ✓ | | 1 ~ 100 | Maximum number of result |
EzSpatial
| Type | Require | Default | Limitation | Description |
---|
userId | string | ✓ | | ~ 128 chars | User Id |
areaModelName | string | ✓ | | ~ 128 chars | Area name |
layerModelName | string | ✓ | | ~ 128 chars | Layer name |
position | EzPosition | ✓ | | | Position |
vector | EzVector | ✓ | | | Vector |
EzVector
Position
| Type | Require | Default | Limitation | Description |
---|
x | float | ✓ | | ~ 1048574 | X position |
y | float | ✓ | | ~ 1048574 | Y position |
z | float | ✓ | | ~ 1048574 | Z position |
Methods
describeAreaModels
Get list of Area Model
Request
| Type | Require | Default | Limitation | Description |
---|
namespaceName | string | ✓ | | ~ 32 chars | Namespace name |
Result
Implementation Example
var domain = gs2.MegaField.Namespace(
namespaceName: "namespace-0001"
);
var items = await domain.AreaModelsAsync(
).ToListAsync();
var domain = gs2.MegaField.Namespace(
namespaceName: "namespace-0001"
);
var it = domain.AreaModels(
);
List<EzAreaModel> items = new List<EzAreaModel>();
while (it.HasNext())
{
yield return it.Next();
if (it.Error != null)
{
onError.Invoke(it.Error, null);
break;
}
if (it.Current != null)
{
items.Add(it.Current);
}
else
{
break;
}
}
const auto Domain = Gs2->MegaField->Namespace(
"namespace-0001" // namespaceName
);
const auto It = Domain->AreaModels(
);
for (auto Item : *It)
{
}
getAreaModel
Get Area Model
Request
| Type | Require | Default | Limitation | Description |
---|
namespaceName | string | ✓ | | ~ 32 chars | Namespace name |
areaModelName | string | ✓ | | ~ 128 chars | Area Model Name |
Result
Implementation Example
var domain = gs2.MegaField.Namespace(
namespaceName: "namespace-0001"
).AreaModel(
areaModelName: "area-0001"
);
var item = await domain.ModelAsync();
var domain = gs2.MegaField.Namespace(
namespaceName: "namespace-0001"
).AreaModel(
areaModelName: "area-0001"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->MegaField->Namespace(
"namespace-0001" // namespaceName
)->AreaModel(
"area-0001" // areaModelName
);
const auto Future = Domain.Model();
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
describeLayerModels
Get list of Layer Model
Request
| Type | Require | Default | Limitation | Description |
---|
namespaceName | string | ✓ | | ~ 32 chars | Namespace name |
areaModelName | string | ✓ | | ~ 128 chars | Area Model Name |
Result
Implementation Example
var domain = gs2.MegaField.Namespace(
namespaceName: "namespace-0001"
).AreaModel(
areaModelName: "area-0001"
);
var items = await domain.LayerModelsAsync(
).ToListAsync();
var domain = gs2.MegaField.Namespace(
namespaceName: "namespace-0001"
).AreaModel(
areaModelName: "area-0001"
);
var it = domain.LayerModels(
);
List<EzLayerModel> items = new List<EzLayerModel>();
while (it.HasNext())
{
yield return it.Next();
if (it.Error != null)
{
onError.Invoke(it.Error, null);
break;
}
if (it.Current != null)
{
items.Add(it.Current);
}
else
{
break;
}
}
const auto Domain = Gs2->MegaField->Namespace(
"namespace-0001" // namespaceName
)->AreaModel(
"area-0001" // areaModelName
);
const auto It = Domain->LayerModels(
);
for (auto Item : *It)
{
}
getLayerModel
Get Layer Model
Request
| Type | Require | Default | Limitation | Description |
---|
namespaceName | string | ✓ | | ~ 32 chars | Namespace name |
areaModelName | string | ✓ | | ~ 128 chars | Area Model Name |
layerModelName | string | ✓ | | ~ 128 chars | Layer Model Name |
Result
Implementation Example
var domain = gs2.MegaField.Namespace(
namespaceName: "namespace-0001"
).AreaModel(
areaModelName: "area-0001"
).LayerModel(
layerModelName: "layer-0001"
);
var item = await domain.ModelAsync();
var domain = gs2.MegaField.Namespace(
namespaceName: "namespace-0001"
).AreaModel(
areaModelName: "area-0001"
).LayerModel(
layerModelName: "layer-0001"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->MegaField->Namespace(
"namespace-0001" // namespaceName
)->AreaModel(
"area-0001" // areaModelName
)->LayerModel(
"layer-0001" // layerModelName
);
const auto Future = Domain.Model();
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
update
Send position
Request
| Type | Require | Default | Limitation | Description |
---|
namespaceName | string | ✓ | | ~ 32 chars | Namespace name |
areaModelName | string | ✓ | | ~ 128 chars | Area name |
layerModelName | string | ✓ | | ~ 128 chars | Layer name |
position | EzMyPosition | ✓ | | | My Location |
scopes | List<EzScope> | | | | List of Scope of acquisition by other players |
accessToken | string | ✓ | | ~ 128 chars | User Id |
Result
Implementation Example
var domain = gs2.MegaField.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Spatial(
areaModelName: "area-0001",
layerModelName: "layer-0001"
);
var result = await domain.UpdateAsync(
position: ,
scopes: null
);
var item = await result.ModelAsync();
var domain = gs2.MegaField.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Spatial(
areaModelName: "area-0001",
layerModelName: "layer-0001"
);
var future = domain.Update(
position: ,
scopes: null
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
var future2 = future.Result.Model();
yield return future2;
if (future2.Error != null)
{
onError.Invoke(future2.Error, null);
yield break;
}
var result = future2.Result;
const auto Domain = Gs2->MegaField->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Spatial(
"area-0001", // areaModelName
"layer-0001" // layerModelName
);
const auto Future = Domain->Update(
,
nullptr // scopes
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (!TestFalse(WHAT, Future2->GetTask().IsError())) return false;
const auto Result = Future2->GetTask().Result();