123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- using System;
- using UnityEngine;
- using Sfs2X.Entities;
- using Sfs2X.Requests;
- using Random = UnityEngine.Random;
- [Serializable]
- public class Loggor : BaseLoggor
- {
- public Loggor()
- {
- onLogin += baseEvent =>
- {
- GardenSmartFox.User = (User) baseEvent.Params[SFSLabel.DefaultUser];
- };
- }
- public override void Login()
- {
- //Debug.Log("Send login request");
- string userName = GetRandomUsername();
- GardenSmartFox.SmartFox.Send(new LoginRequest(userName, ""));
- }
- public override void Logout()
- {
- //Debug.Log("Send logout request");
- GardenSmartFox.SmartFox.Send(new LogoutRequest());
- //Debug.Log("Send disconnect request");
- GardenSmartFox.SmartFox.Disconnect();
- }
- public static string GetRandomUsername()
- {
- return Random.Range(0f, 1000f).ToString();
- }
- }
|