示例#1
0
    public void FireEvent(string id, PMEventArgs args)
    {
        if (events.ContainsKey(id))
        {
            if (events [id] != null)
            {
                events [id] (id, args);
            }
        }
        if (allEvents != null)
        {
            allEvents(id, args);
        }


        if (eventsLite.ContainsKey(id))
        {
            if (eventsLite [id] != null)
            {
                eventsLite [id] ();
            }
        }
        if (allEventsLite != null)
        {
            allEventsLite();
        }
    }
示例#2
0
 void OnEvent(string id, PMEventArgs args)
 {
     if (PrintEvents)
     {
         print("All events listener: " + id);
     }
 }
示例#3
0
    public void onCarBrake(string id, PMEventArgs args)
    {
        var velocity = args.Floating;
        var power    = Mathf.Clamp(velocity / MaximumShakeVelocity, 0, 1);

        UnityEngine.Debug.Log(power);
        cameraShake.Shake(power);
    }
示例#4
0
    private void OnBurn(string id, PMEventArgs args)
    {
        var burnInfo                = (BurnInfo)args.Custom;
        var otherGameObject         = burnInfo.OtherGameObject;
        var wheelMaterial           = burnInfo.WheelMaterial;
        var otherObjectWithMaterial = otherGameObject.GetComponent <ObjectWithMaterial>();

        if (otherObjectWithMaterial != null)
        {
            var        effect     = WheelFloorEffectTable.GetEffect(wheelMaterial, otherObjectWithMaterial.PiekaMaterial);
            EffectData effectData = new EffectData("burnInfo", burnInfo);
            effectData.Position = burnInfo.Point;
            effect.Play(effectData);
        }
    }
示例#5
0
 private void onBrake(string id, PMEventArgs args)
 {
     brake = args.Floating;
 }
示例#6
0
 private void onAcceleration(string id, PMEventArgs args)
 {
     acceleration = args.Floating;
 }
        private static void PM(ib0tClient client, String ags, ulong time)
        {
            String tmp    = ags;
            int    finder = tmp.IndexOf(":");

            String[] lens = tmp.Substring(0, finder).Split(new String[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            tmp = tmp.Substring(finder + 1);
            int n_len = int.Parse(lens[0]);
            int t_len = int.Parse(lens[1]);

            String name = tmp.Substring(0, n_len);
            String text = tmp.Substring(n_len, t_len);

            if (text.Length > 300)
            {
                text = text.Substring(0, 300);
            }

            PMEventArgs args = new PMEventArgs {
                Cancel = false, Text = text
            };

            if (name == Settings.Get <String>("bot"))
            {
                if (text.StartsWith("#login") || text.StartsWith("#register"))
                {
                    Command(client, text.Substring(1));
                    return;
                }
                else
                {
                    if (text.StartsWith("#") || text.StartsWith("/"))
                    {
                        Command(client, text.Substring(1));
                    }

                    if (!client.Quarantined)
                    {
                        Events.BotPrivateSent(client, args.Text);
                    }
                }
            }
            else
            {
                if (!client.Captcha)
                {
                    return;
                }

                IClient target = UserPool.AUsers.Find(x => x.Name == name && x.LoggedIn);

                if (target == null)
                {
                    target = UserPool.WUsers.Find(x => x.Name == name && x.LoggedIn);
                }

                if (target == null && ServerCore.Linker.Busy && ServerCore.Linker.LoginPhase == LinkLeaf.LinkLogin.Ready)
                {
                    target = ServerCore.Linker.FindUser(x => x.Name == name);

                    if (target != null)
                    {
                        ServerCore.Linker.SendPacket(LinkLeaf.LeafOutbound.LeafPrivateText(ServerCore.Linker, client.Name, target, text));
                        return;
                    }
                }

                if (target == null)
                {
                    client.QueuePacket(WebOutbound.OfflineTo(client, name));
                }
                else if (target.IgnoreList.Contains(client.Name) || client.Muzzled)
                {
                    client.QueuePacket(WebOutbound.IgnoringTo(client, name));
                }
                else
                {
                    if (target.Cloaked)
                    {
                        client.QueuePacket(WebOutbound.OfflineTo(client, name));
                        return;
                    }

                    Events.PrivateSending(client, target, args);

                    if (!args.Cancel && !String.IsNullOrEmpty(args.Text) && client.SocketConnected)
                    {
                        target.IUser.PM(client.Name, args.Text);
                        Events.PrivateSent(client, target, args.Text);
                    }
                }
            }
        }
示例#8
0
 public static void FireEvent(string id, PMEventArgs args)
 {
     eventSystem.FireEvent(id, args);
 }
示例#9
0
 protected void FireEvent(string id, PMEventArgs args)
 {
     SEventSystem.FireEvent(id, args);
 }