本文整理汇总了C#中ISFSObject.GetSFSObject方法的典型用法代码示例。如果您正苦于以下问题:C# ISFSObject.GetSFSObject方法的具体用法?C# ISFSObject.GetSFSObject怎么用?C# ISFSObject.GetSFSObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISFSObject
的用法示例。
在下文中一共展示了ISFSObject.GetSFSObject方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FromSFSObject
public static NetworkTransform FromSFSObject(ISFSObject data)
{
NetworkTransform trans = new NetworkTransform();
ISFSObject transformData = data.GetSFSObject("transform");
float x = Convert.ToSingle(transformData.GetDouble("x"));
float y = Convert.ToSingle(transformData.GetDouble("y"));
float z = Convert.ToSingle(transformData.GetDouble("z"));
float rx = Convert.ToSingle(transformData.GetDouble("rx"));
float ry = Convert.ToSingle(transformData.GetDouble("ry"));
float rz = Convert.ToSingle(transformData.GetDouble("rz"));
trans.position = new Vector3(x, y, z);
trans.angleRotation = new Vector3(rx, ry, rz);
if (transformData.ContainsKey("t")) {
trans.TimeStamp = Convert.ToDouble(transformData.GetLong("t"));
}
else {
trans.TimeStamp = 0;
}
return trans;
}
示例2: OnHandleMessage
public override void OnHandleMessage(ISFSObject data)
{
maxCharacters = data.GetInt("maxCharacters");
ISFSObject characters = data.GetSFSObject("characters");
Character character;
foreach (string key in characters.GetKeys())
{
character = new Character();
Debug.Log("Adding character: " + key);
if (character.FromSFSObject(characters.GetSFSObject(key)))
{
characterList.Add(character);
}
}
Debug.Log("Max: " + maxCharacters);
Debug.Log("Characters: " + characterList.Count);
}
示例3: ReceiveStatus
public void ReceiveStatus(ISFSObject sObj)
{
if(!sObj.ContainsKey(NetSyncObjCharacter.statusDS)){
Debug.LogError("no status init");
return;
}
ISFSObject statusObj = sObj.GetSFSObject(NetSyncObjCharacter.statusDS);
if(statusObj.ContainsKey("currentHP")){
component.HP = statusObj.GetFloat("currentHP");
Debug.Log ("Receiving HP Change : " + component.HP);
}
if(statusObj.ContainsKey("team")){
component.Team = statusObj.GetInt("team");
Debug.Log ("Team Change: " + component.Team);
}
}
示例4: HandleInstantiatePlayer
// Instantiating player (our local FPS model, or remote 3rd person model)
private void HandleInstantiatePlayer(ISFSObject dt)
{
ISFSObject playerData = dt.GetSFSObject("player");
int userId = playerData.GetInt("id");
int score = playerData.GetInt("score");
NetworkTransform ntransform = NetworkTransform.FromSFSObject(playerData);
User user = smartFox.UserManager.GetUserById(userId);
string name = user.Name;
if (userId == smartFox.MySelf.Id) {
PlayerManager.Instance.SpawnPlayer(ntransform, name, score);
}
else {
PlayerManager.Instance.SpawnEnemy(userId, ntransform, name, score);
}
}
示例5: UpdateWorldSetup
private void UpdateWorldSetup(ISFSObject data)
{
String[] keys = data.GetKeys();
foreach(String currentKey in keys)
{
ISFSObject currentObject = data.GetSFSObject(currentKey);
GameObject currentGw = GameObject.Find(currentObject.GetUtfString("STATE"));
Gateway gw = currentGw.GetComponent<Gateway>();
gw.Update(currentObject);
gw.GetComponent<SpriteRenderer>().color = playerColors[gw.getOwner()];
}
ExtensionRequest objectiveRequest = new ExtensionRequest("getObjectives", new SFSObject(), smartFox.LastJoinedRoom);
smartFox.Send(objectiveRequest);
}
示例6: UpdateObjective
private void UpdateObjective(ISFSObject data)
{
foreach(string currentKey in data.GetKeys())
{
ISFSObject currentObject = data.GetSFSObject(currentKey);
GameObject currentObj = GameObject.Find(currentKey);
currentObj.GetComponent<UILabel>().text = currentObject.GetInt("SPOTCONQUERED").ToString();
}
askPolicePosition();
}
示例7: InstantiateWorld
private void InstantiateWorld(ISFSObject data)
{
String[] keys = data.GetKeys();
foreach(String currentKey in keys)
{
ISFSObject currentObject = data.GetSFSObject(currentKey);
GameObject currentGw = Instantiate(GatewayPrefab) as GameObject;
currentGw.transform.name = currentObject.GetUtfString("STATE");
Gateway gw = currentGw.GetComponent<Gateway>();
gameObject.GetComponent<Manager>().stopParticle(gw);
GameObject region=GameObject.Find(currentObject.GetUtfString("REGION"));
gw.transform.parent=region.transform;
gw.GetComponent<SpriteRenderer>().sprite = gameObject.GetComponent<ResourcesManager>().getGwImage(currentObject.GetUtfString("TYPE"));
gw.Setup(currentObject);
gw.GetComponent<SpriteRenderer>().color = playerColors[gw.getOwner()];
if(gw.getOwner() == smartFox.MySelf.Name)
{
gameObject.GetComponent<Manager>().startParticle(gw);
StartCoroutine( gameObject.GetComponent<Manager>().stopParticle(gw, 6.0f));
}
}
}
示例8: FromSFSObject
// Creating NetworkTransform from SFS object
public static LaunchPacket FromSFSObject(ISFSObject data)
{
LaunchPacket launchMessage = new LaunchPacket();
ISFSObject launchData = data.GetSFSObject("launchMessage");
launchMessage.type = launchData.GetUtfString("messageType");
//cube hit id
launchMessage.cubeID = launchData.GetInt("cubeID");
//side hit id
launchMessage.sideID = launchData.GetInt("sideID");
//get launch pos
float sx = launchData.GetFloat("sx");
float sy = launchData.GetFloat("sy");
float sz = launchData.GetFloat("sz");
//set lauch pos in object
launchMessage.launchPosition = new Vector3(sx, sy, sz);
//get launch destination
float ex = launchData.GetFloat("ex");
float ey = launchData.GetFloat("ey");
float ez = launchData.GetFloat("ez");
//set lauch pos in object
launchMessage.launchDestination = new Vector3(ex, ey, ez);
//get & set senders local game time
launchMessage.localGameTime = launchData.GetDouble("localGameTime");
//get & set senders local game time
launchMessage.gameTimeETA = launchData.GetDouble("gameTimeETA");
return launchMessage;
}
示例9: HandleInstantiatePlayer
// Instantiating player (our local FPS model, or remote 3rd person model)
private void HandleInstantiatePlayer(ISFSObject dt)
{
ISFSObject playerData = dt.GetSFSObject("player");
int userId = playerData.GetInt("id");
int score = playerData.GetInt("score");
string avatar = playerData.GetUtfString("avatar");
Debug.Log("DaToS: UID " + userId + "; Avatar " + avatar);
// string textura = playerData.GetUtfString("textura");
//Debug.Log("avatar en handle ="+avatar);
/* prueba*/
if (avatar.Equals("masculino"))
avatar = "Jane-20";
// Debug.Log("textura en handle ="+textura);
NetworkTransform ntransform = NetworkTransform.FromSFSObject(playerData);
User user = smartFox.UserManager.GetUserById(userId);
userName = user.Name;
Debug.Log("Nombreeeeeeeeeeeeeee:"+userName);
if (userId == smartFox.MySelf.Id) {
// Debug.Log("my id = " + userId);
PlayerManager.Instance.SpawnPlayer(ntransform, userName, score, avatar);
}
else {
string animacion = dt.GetUtfString("anim");
PlayerManager.Instance.SpawnEnemy(userId, ntransform, userName, score, avatar,animacion);
}
}
示例10: HandleInstantiatePlayer
// Instantiating player (our local FPS model, or remote 3rd person model)
private void HandleInstantiatePlayer(ISFSObject dt)
{
Debug.Log ("dt : " + dt);
ISFSObject playerData = dt.GetSFSObject("player");
int userId = playerData.GetInt("id");
//int score = playerData.GetInt("score");
Debug.Log ("userID " + userId);
//Debug.Log ("score " + score);
NetworkTransform ntransform = NetworkTransform.FromSFSObject(playerData);
User user = sfs.UserManager.GetUserById(userId);
string name = user.Name;
Debug.Log (name);
if (userId == sfs.MySelf.Id) {
PlayerManager.GetInstance.SpawnPlayer(ntransform, name, 0);
}
else {
PlayerManager.GetInstance.SpawnRemotePlayer(userId, ntransform, name, 0);
}
}
示例11: HandleTriggerEnter
private void HandleTriggerEnter(ISFSObject dt)
{
ISFSObject sObj = dt.GetSFSObject("collide_info");
int colliderId = sObj.GetInt("colliderId");
int targetId = sObj.GetInt ("targetId");
NetSyncObj recipient = PlayerSpawner.Instance.GetRecipient(colliderId);
NetSyncObj obj = PlayerSpawner.Instance.GetRecipient(targetId);
if(recipient != null && obj != null){
recipient.HandleCollide(obj);
}
else{
Debug.LogError("network trigger enter error, collider: " + recipient + ", target: " + obj);
}
}
示例12: HandleRemoveItem
// Removing item (hwen it was picked up by someone)
private void HandleRemoveItem(ISFSObject dt)
{
int playerId = dt.GetInt("playerId");
ISFSObject item = dt.GetSFSObject("item");
int id = item.GetInt("id");
string type = item.GetUtfString("type");
if (playerId == smartFox.MySelf.Id) {
if (type == "HealthPack") {
SoundManager.Instance.PlayPickupHealthPack(PlayerManager.Instance.GetPlayerObject().audio);
}
else if (type == "Ammo") {
SoundManager.Instance.PlayPickupAmmo(PlayerManager.Instance.GetPlayerObject().audio);
}
}
PlayerManager.Instance.RemoveItem(id);
}
示例13: HandleItem
// New item spawned message. Instantiating the item object.
private void HandleItem(ISFSObject dt)
{
ISFSObject item = dt.GetSFSObject("item");
int id = item.GetInt("id");
string itemType = item.GetUtfString("type");
NetworkTransform ntransform = NetworkTransform.FromSFSObject(item);
PlayerManager.Instance.SpawnItem(id, ntransform, itemType);
}