本文整理汇总了C#中SFSObject.GetObj方法的典型用法代码示例。如果您正苦于以下问题:C# SFSObject.GetObj方法的具体用法?C# SFSObject.GetObj怎么用?C# SFSObject.GetObj使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SFSObject
的用法示例。
在下文中一共展示了SFSObject.GetObj方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReceiveActionList
public void ReceiveActionList(SFSObject list)
{
SFSObject hierarchy = list.GetObj("h");
SetServerActionHierarchy(hierarchy);
clientActionHierarchy = (ActionList)serverActionHierarchy.Clone();
SFSObject library = list.GetObj("l");
SetServerActionLibrary(library);
hasReceivedActionList = true;
}
示例2: SendHeadingsToGameObjects
private void SendHeadingsToGameObjects(SFSObject data)
{
//Debug.Log("Client gonna extract data object");
SFSObject physicalEntities = data.GetObj("p");
if(physicalEntities.Size() == 0) Debug.Log("erreur PE.SIZE = "+physicalEntities.Size() );
for (int i = 0; i < physicalEntities.Size(); i++)
{
//Debug.Log("Client gonna extract a Physical Entity");
SFSObject pdata = physicalEntities.GetObj(Convert.ToString(i));
//if (pdata != null)
//Debug.Log("Cient could extract a Physical Entity! gonna extract his uid");
int userId = (int) pdata.GetNumber("uid");
GameObject entity = null;
if(userId >= 0)
{
//Debug.Log("Client extracted a player heading for player id="+userId);
//Find player object with such Id
entity = GameObject.Find("remotePlayer_"+userId);
if(!entity)
{
//create the player as he entered our interest area
SendMessage("UserEnterInterestArea", userId);
entity = GameObject.Find("remotePlayer_"+userId);
}
}
else
{
//Debug.Log("Client extracted an NPC heading for NPC name=" + pdata.GetString("n"));
//Find npc object with such name
entity = GameObject.Find("npc_"+pdata.GetString("n"));
if(!entity)
{
//create the npc as he entered our interest area
SendMessage("NPCEnterInterestArea", pdata.GetString("n"));
entity = GameObject.Find("npc_"+pdata.GetString("n"));
}
}
//send the entity his transform
entity.SendMessage("ReceiveHeading", pdata);
}
}
示例3: SetServerActionHierarchy
private void SetServerActionHierarchy(SFSObject hierarchy)
{
serverActionHierarchy = new ActionList();
for (int a = 0; a < hierarchy.Size(); a++)
{
SFSObject actionObject = hierarchy.GetObj(Convert.ToString(a));
Action action = new Action();
action.name = actionObject.GetString("n");
int numParam = actionObject.Size();
for (int i = 0; i < numParam - 1; i++)
{
SFSObject param = actionObject.GetObj(Convert.ToString(i));
string paramName = param.GetString("n");
string paramType = param.GetString("t");
switch (paramType)
{
case "b" ://boolean
bool boolValue = param.GetBool("v");
action.AddBoolParam(paramName, boolValue);
break;
case "maq"://maximum quantity (integer > 0 or "MAX")
//
break;
case "miq"://minimum quantity (integer > 0 or "MIN")
//
break;
case "n"://integer with min and max values
//
break;
case "mi"://minored integer : integer with min value or "INF"
string value = param.GetString("v");
int minValue = (int) param.GetNumber("m");
action.AddMinoredIntegerParam(paramName, value, minValue);
break;
case "ii"://inventory item
//
break;
case "it"://item type
//
break;
case "am"://actionMark (an absolute position or the position of a physical entity marked by the player or his faction)
bool playerIsMarkOwner = param.GetBool("o");
int actionMarkID = (int)param.GetNumber("n");
action.AddActionMark(paramName, playerIsMarkOwner, actionMarkID);
break;
case "c"://character (player or npc)
//
break;
case "s"://string message
//
break;
}
}
serverActionHierarchy.Add(action);
}
}
示例4: SendAnimationMessagesToGameObjects
private void SendAnimationMessagesToGameObjects(SFSObject data)
{
SFSObject physicalEntities = data.GetObj("p");
for (int i = 0; i < physicalEntities.Size(); i++)
{
//Debug.Log("Client gonna extract a Physical Entity");
SFSObject pdata = physicalEntities.GetObj(Convert.ToString(i));
//if (pdata != null)
//Debug.Log("Cient could extract a Physical Entity! gonna extract his uid");
int userId = (int) pdata.GetNumber("uid");
GameObject entity = null;
if(userId >= 0)
{
//Debug.Log("Client extracted a player with id="+userId);
//Find player object with such Id
entity = GameObject.Find("remotePlayer_"+userId);
if(!entity)
{
//create the player as he entered our interest area
SendMessage("UserEnterInterestArea", userId);
entity = GameObject.Find("remotePlayer_"+userId);
}
}
else
{
//Debug.Log("Client extracted an NPC named " + pdata.GetString("n"));
//Find npc object with such name
entity = GameObject.Find("npc_"+pdata.GetString("n"));
if(!entity)
{
//create the npc as he entered our interest area
SendMessage("NPCEnterInterestArea", pdata.GetString("n"));
entity = GameObject.Find("npc_"+pdata.GetString("n"));
}
}
//send the entity his animation message
entity.SendMessage("PlayAnimation", pdata.GetString("mes"));
}
}