Ejemplo n.º 1
0
        void OnLogin(BaseEvent eventParam)
        {
            Task.Run(() =>
            {
                if (false)
                {
                    Console.WriteLine("OnLogin : "******"\t" + kvp.Key + " : " + kvp.Value);
                    }
                }
                if (!SFClient.UdpInited)
                {
                    SFClient.AddEventListener(SFSEvent.UDP_INIT, new EventListenerDelegate(OnUdpInit));
                    SFClient.InitUDP();
                    return;
                }
                if (eventParam.Params["zone"].ToString() == "1BattleZone")
                {
                    //System.Threading.Thread.Sleep(8000);
                    //Login();
                    //System.Threading.Thread.Sleep(1000);
                    SFClient.Send(new ExtensionRequest("joinRoom", new SFSObject()));
                }

                if (!InBattle)
                {
                    var isfsobject = new SFSObject();
                    isfsobject.PutShort("sid", 0);
                    isfsobject.PutBool("sst", true);
                    var isfsarray = new SFSArray();
                    isfsarray.AddFloat(X);
                    isfsarray.AddFloat(0.0f);
                    isfsarray.AddFloat(Y);
                    isfsobject.PutSFSArray("pos", isfsarray);
                    SFClient.Send(new ExtensionRequest("joinRoom", isfsobject));

                    isfsobject = new SFSObject();
                    isfsobject.PutShort("sid", 1);
                    SFClient.Send(new ExtensionRequest("joinRoom", isfsobject));

                    isfsobject = new SFSObject();
                    isfsobject.PutShort("sid", 8);
                    SFClient.Send(new ExtensionRequest("joinRoom", isfsobject));


                    InBattle   = true;
                    isfsobject = new SFSObject();
                    isfsobject.PutShort("sid", 1);
                    isfsobject.PutShort("spid", 0);
                    SFClient.Send(new ExtensionRequest("spawnMonster", isfsobject));
                }
            });
        }
Ejemplo n.º 2
0
    public void SendPos(Transform player)
    {
        SFSArray positionArray = new SFSArray();

        positionArray.AddFloat(player.position.x);
        positionArray.AddFloat(player.position.z);

        List <UserVariable> userVariables = new List <UserVariable>();

        userVariables.Add(new SFSUserVariable("pos", positionArray, 6));

        SmartFoxConnection.SFS.Send(new SetUserVariablesRequest(userVariables));
    }
Ejemplo n.º 3
0
    public void SendAnimWalk(string xName, float xFloat, string yName, float yFloat)
    {
        SFSArray AnimArray = new SFSArray();

        AnimArray.AddText(xName);
        AnimArray.AddFloat(xFloat);
        AnimArray.AddText(yName);
        AnimArray.AddFloat(yFloat);

        List <UserVariable> userVariables = new List <UserVariable>();

        userVariables.Add(new SFSUserVariable("animWalk", AnimArray, 6));

        SmartFoxConnection.SFS.Send(new SetUserVariablesRequest(userVariables));
    }