当前位置: 首页>>代码示例>>C#>>正文


C# ISFSObject.GetSFSObject方法代码示例

本文整理汇总了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;
    }
开发者ID:Chongcharen,项目名称:MadnessFotball,代码行数:25,代码来源:NetworkTransform.cs

示例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);
    }
开发者ID:Antaresgames,项目名称:AegisBorn,代码行数:18,代码来源:CharacterListHandler.cs

示例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);
        }
    }
开发者ID:claw2013hku,项目名称:UnityTestProject,代码行数:19,代码来源:ActorStatusRecp.cs

示例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);
        }
    }
开发者ID:kimreik,项目名称:Snow,代码行数:18,代码来源:NetworkManager.cs

示例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);
 }
开发者ID:Hargalaten,项目名称:meGAMEss,代码行数:14,代码来源:NetworkManager.cs

示例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();
 }
开发者ID:Hargalaten,项目名称:meGAMEss,代码行数:10,代码来源:NetworkManager.cs

示例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));
            }
        }
    }
开发者ID:Hargalaten,项目名称:meGAMEss,代码行数:26,代码来源:NetworkManager.cs

示例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;
    }
开发者ID:ice0001,项目名称:Cubes-in-Space,代码行数:39,代码来源:LaunchPacket.cs

示例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);
        }
    }
开发者ID:CristianCosta,项目名称:Kinect,代码行数:31,代码来源:NetworkManager.cs

示例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);
        }
    }
开发者ID:Chongcharen,项目名称:MadnessFotball,代码行数:23,代码来源:NetworkManager.cs

示例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);
        }
    }
开发者ID:claw2013hku,项目名称:UnityTestProject,代码行数:16,代码来源:SFSNetworkManager.cs

示例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);
    }
开发者ID:justdude,项目名称:Network-Hunter,代码行数:18,代码来源:NetworkManager.cs

示例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);
    }
开发者ID:justdude,项目名称:Network-Hunter,代码行数:10,代码来源:NetworkManager.cs


注:本文中的ISFSObject.GetSFSObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。