internal void initUDP()
 {
     lock (smartFoxLock)
     {
         smartFox.InitUDP();
     }
 }
Exemplo n.º 2
0
 private void OnLogin(BaseEvent evt)
 {
     Debug.Log("Login in progress");
     // Initialize UDP communication
     // Host and port have been configured in the ConfigData object passed to the SmartFox.Connect method
     sfs.InitUDP();
 }
    private void OnLogin(BaseEvent evt)
    {
        // Initialize UDP communication
        // Host and port have been configured in the ConfigData object passed to the SmartFox.Connect method
        //sfs.InitUDP();

        try
        {
            bool success = true;
            if (evt.Params.Contains("success") && !(bool)evt.Params["success"])
            {
                string loginErrorMessage = (string)evt.Params["errorMessage"];
                Debug.Log("Login error: " + loginErrorMessage);
            }
            else
            {
                Debug.Log("Logged in successfully");

                // Startup up UDP
                sfs.InitUDP(Host, UdpPort);

                // Load Waiting Room
                SceneManager.LoadScene(3);
            }
        }
        catch (Exception ex)
        {
            Debug.Log("Exception handling login request: " + ex.Message + " " + ex.StackTrace);
        }
    }
Exemplo n.º 4
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));
                }
            });
        }
Exemplo n.º 5
0
    //-----------------------------------------------------------------------OnLogin
    private void OnLogin(BaseEvent evt)
    {
        Debug.Log("Logged In: " + evt.Params["user"]);

        if (sfs.RoomManager.ContainsRoom("city"))
        {
            {
                Debug.Log("inside true availble room");

                sfs.Send(new JoinRoomRequest("city"));
                Debug.Log("after inside true availble room");
                sfs.InitUDP();
            }
        }
        else
        {
            Debug.Log("inside false availble room");
        }
    }
Exemplo n.º 6
0
 private void OnLogin(BaseEvent evt)
 {
     reset();
     sfs.AddEventListener(SFSEvent.UDP_INIT, OnUDPInit);
     sfs.InitUDP(Host, UdpPort);
 }