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


C# SFSObject.Put方法代码示例

本文整理汇总了C#中SFSObject.Put方法的典型用法代码示例。如果您正苦于以下问题:C# SFSObject.Put方法的具体用法?C# SFSObject.Put怎么用?C# SFSObject.Put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SFSObject的用法示例。


在下文中一共展示了SFSObject.Put方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SendAnimationMessage

 void SendAnimationMessage(string message)
 {
     SmartFoxClient client = NetworkController.GetClient();
     SFSObject data = new SFSObject();
     data.Put("_cmd", "a");  //We put _cmd = "a" here to know that this object contains animation message
     data.Put("mes", message);
     client.SendObject(data);
 }
开发者ID:Nivek12,项目名称:Hegira,代码行数:8,代码来源:AnimationSynchronizer.cs

示例2: SendDamage

 void SendDamage(int damage)
 {
     SmartFoxClient client = NetworkController.GetClient();
     SFSObject data = new SFSObject();
     data.Put("_cmd", "d");  //We put _cmd = "d" to identify the message as a damage message
     data.Put("amount", damage); //how much damage was dealt
     client.SendObject(data);
 }
开发者ID:Nivek12,项目名称:Hegira,代码行数:8,代码来源:RemotePlayerController.cs

示例3: ForceRemotePlayerToSendTransform

 void ForceRemotePlayerToSendTransform(User user)
 {
     SmartFoxClient client = NetworkController.GetClient();
     SFSObject data = new SFSObject();
     data.Put("_cmd", "f");  //We put _cmd = "f" here to know that this object contains "force send transform" demand
     data.Put("to_uid", user.GetId()); // Who this message is for
     client.SendObject(data);
 }
开发者ID:Nivek12,项目名称:Hegira,代码行数:8,代码来源:PlayerSpawnController.cs

示例4: DoSend

    // Send transform to all other users
    public void DoSend()
    {
        SmartFoxClient client = NetworkController.GetClient();

            SFSObject data = new SFSObject();
            data.Put("_cmd", "t");  //We put _cmd = "t" here to know that this object contains transform sync data.
            data.Put("x", this.position.x);
            data.Put("y", this.position.y);
            data.Put("z", this.position.z);

            data.Put("rx", this.rotation.x);
            data.Put("ry", this.rotation.y);
            data.Put("rz", this.rotation.z);
            data.Put("w", this.rotation.w);

            // We send data using SendObject method here. To optimize this you can use SendXtMessage method with custum formatted method
            // Also an extension on the server side could decide which users really need to receive the transform
            client.SendObject(data);
    }
开发者ID:Nivek12,项目名称:Hegira,代码行数:20,代码来源:NetworkTransform.cs

示例5: OnDamage

    public void OnDamage(int damage)
    {
        //Only hurt the player if the damage dealt is greater than their defense
        if(damage > mDefense) {
            mHealth = mHealth - (damage-mDefense);
        }

        healthLabel = "HEALTH: " + mHealth;

        //If the player is dead then destroy the object and notify other players
        if(mHealth <= 0) {

            SmartFoxClient client = NetworkController.GetClient();
            SFSObject data = new SFSObject();
            data.Put("_cmd", "k");  //We put _cmd = "k" for a killed message
            client.SendObject(data);

            Destroy(this.gameObject);
        }
    }
开发者ID:Nivek12,项目名称:Hegira,代码行数:20,代码来源:PlayerController.cs

示例6: test

    private void test()
    {
        //test
        SFSObject monparam = new SFSObject();
        monparam.Put("n", "monparam");
        monparam.Put("t", "b");
        monparam.PutBool("v", false);
        SFSObject monparam2 = new SFSObject();
        monparam2.Put("n", "monparam2");
        monparam2.Put("t", "b");
        monparam2.PutBool("v", true);
        SFSObject monparam3 = new SFSObject();
        monparam3.Put("n", "monparam3");
        monparam3.Put("t", "mi");
        monparam3.Put("v", "5");
        monparam3.PutNumber("m", 1);
        SFSObject monaction = new SFSObject();
        monaction.Put("n", "monaction");
        monaction.Put("0", monparam);
        monaction.Put("1", monparam2);
        monaction.Put("2", monparam3);

        SFSObject monparam4 = new SFSObject();
        monparam4.Put("n", "monparam4");
        monparam4.Put("t", "b");
        monparam4.PutBool("v", false);
        SFSObject monparam5 = new SFSObject();
        monparam5.Put("n", "monparam5");
        monparam5.Put("t", "mi");
        monparam5.Put("v", "16");
        monparam5.PutNumber("m", -6);
        SFSObject monaction2 = new SFSObject();
        monaction2.Put("n", "monaction2");
        monaction2.Put("0", monparam4);
        monaction2.Put("1", monparam5);

        SFSObject monparam6 = new SFSObject();
        monparam6.Put("n", "monparam6");
        monparam6.Put("t", "b");
        monparam6.PutBool("v", true);
        SFSObject monparam7 = new SFSObject();
        monparam7.Put("n", "monparam7");
        monparam7.Put("t", "mi");
        monparam7.Put("v", "55");
        monparam7.PutNumber("m", -7);
        SFSObject monparam8 = new SFSObject();
        monparam8.Put("n", "monparam8");
        monparam8.Put("t", "b");
        monparam8.PutBool("v", false);
        SFSObject monparam9 = new SFSObject();
        monparam9.Put("n", "monparam9");
        monparam9.Put("t", "mi");
        monparam9.Put("v", "300");
        monparam9.PutNumber("m", 0);
        SFSObject monaction3 = new SFSObject();
        monaction3.Put("n", "monaction3");
        monaction3.Put("0", monparam6);
        monaction3.Put("1", monparam7);
        monaction3.Put("2", monparam8);
        monaction3.Put("3", monparam9);

        SFSObject monactionhierarchy = new SFSObject();
        monactionhierarchy.Put("0", monaction);
        monactionhierarchy.Put("2", monaction2);
        monactionhierarchy.Put("1", monaction3);

        SFSObject monactionlibrary = new SFSObject();
        SFSObject maliste = new SFSObject();
        maliste.Put("h", monactionhierarchy);
        maliste.Put("l", monactionlibrary);

        ReceiveActionList(maliste);
    }
开发者ID:ylyking,项目名称:lynea,代码行数:73,代码来源:NPCActionManager.cs


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