Пример #1
0
        public static void StartListening()
        {
            client.Headers.Add("content-type", "application/json");//set your header here, you can add multiple headers
            sendEvent("lyokoconnect", "{\"user\":\"davcrox\"}");
            if (_listening)
            {
                return;
            }                                                      //dont do anything if we're already listening
            LyokoAPI.Events.LyokoLogger.Log("Test", "Subscribe");
            TowerActivationEvent.Subscribe(OnTowerActivation);     //Give the method name without '()'.
            XanaDefeatEvent.Subscribe(DoAThing);                   //the name of the method doesn't matter as long as the return value and parameters are the same

            TowerDeactivationEvent.Subscribe(onTowerdeactivation); //single statement lambda with one parameter

            XanaAwakenEvent.Subscribe(onXanaAwaken);               //single statement lambda with no parameters
            TowerHijackEvent.Subscribe(onHijack);

            /*TowerHijackEvent.Subscribe((tower, oldactivator, newactivator) => //multi statement lambda with 3 parameters
             * {
             *  //SoundPlayer.PlaySound(Sounds.Thief);
             *  Console.WriteLine("subscribe HIJACK");
             *  OnTowerActivation(tower); //you can re-use methods if you want, they're still methods.
             * });*/
            _listening = true;
        }
Пример #2
0
 public static void Initialize()
 {
     XanaAwakenEvent.Subscribe(onXanaAwaken);
     XanaDefeatEvent.Subscribe(onXanaDefeat);
     TowerActivationEvent.Subscribe(onTowerActivation);
     TowerDeactivationEvent.Subscribe(onTowerDeactivation);
     TowerHijackEvent.Subscribe(onTowerHijacked);
 }
 public static void StartSuperscanner()
 {
     TowerActivationEvent.Subscribe(OnTowerActive);
     TowerDeactivationEvent.Subscribe(OnTowerDeactive);
     TowerHijackEvent.Subscribe(OnTowerHijack);
     XanaAwakenEvent.Subscribe(OnXANAWake);
     XanaDefeatEvent.Subscribe(onXANASleep);
 }
Пример #4
0
        public void StartListening()
        {
            if (_listening)
            {
                return;
            }

            TowerActivationEvent.Subscribe(OnTowerActivation);
            TowerDeactivationEvent.Subscribe(OnTowerDeactivation);

            _listening = true;
        }
Пример #5
0
        public Listener(ICollection <Command> commands, int port)
        {
            Commands = new List <Command>(commands);

            /*ServicePointManager.ServerCertificateValidationCallback +=
             *  (sender, certificate, chain, sslPolicyErrors) => true;*/
            connection = new HubConnectionBuilder().WithUrl($"http://localhost:{port}/MiniLyokoHub").Build();

            StartConnection();
            connection.Closed += async(error) =>
            {
                await Task.Delay(new Random().Next(0, 5) * 1000);

                await connection.StartAsync();
            };

            TowerActivationEvent.Subscribe(OnTowerActivation);
            TowerDeactivationEvent.Subscribe(OnTowerDeactivation);
            TowerHijackEvent.Subscribe(OnTowerHijack);
            CommandOutputEvent.Subscribe(OnCommandOutput);
            LyokoLogger.Subscribe(OnLogger);
            CommandInputEvent.Subscribe(OnCommand);
        }
Пример #6
0
 private APISuperScan()
 {
     TowerActivationEvent.Subscribe(OnTowerActivation);
     TowerDeactivationEvent.Subscribe(OnTowerDeactivation);
     TowerHijackEvent.Subscribe(OnTowerHijack);
 }