コード例 #1
0
        static bool RaisePlayerJoiningWorldEvent([NotNull] Player player, [NotNull] World newWorld, WorldChangeReason reason,
                                                 string textLine1, string textLine2)
        {
            if (player == null)
            {
                throw new ArgumentNullException("player");
            }
            if (newWorld == null)
            {
                throw new ArgumentNullException("newWorld");
            }
            var h = JoiningWorld;

            if (h == null)
            {
                return(false);
            }
            var e = new PlayerJoiningWorldEventArgs(player, player.World, newWorld, reason, textLine1, textLine2);

            h(null, e);
            return(e.Cancel);
        }
コード例 #2
0
        static bool RaisePlayerJoiningWorldEvent([NotNull] Player player, [NotNull] World newWorld, WorldChangeContext context,
                                                 string textLine1, string textLine2)
        {
            if (player == null)
            {
                throw new ArgumentNullException("player");
            }
            if (newWorld == null)
            {
                throw new ArgumentNullException("newWorld");
            }
            var handler = JoiningWorld;

            if (handler == null)
            {
                return(true);
            }
            var e = new PlayerJoiningWorldEventArgs(player, player.World, newWorld, context, textLine1, textLine2);

            handler(null, e);
            return(!e.Cancel);
        }