npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

unity3d.eventmanager

v1.1.1

Published

A type-safe event system for Unity3D based on the event listener pattern. More info http://saltydog.digital/usage-pattern-for-a-type-safe-unity-event-system/

Downloads

3

Readme

EventManager

A type-safe event system for Unity3D based on the event listener pattern. Original blog article http://saltydog.digital/usage-pattern-for-a-type-safe-unity-event-system/

The code in this repository is a minor variation with added examples and tests of the event system originally described here: http://www.willrmiller.com/?p=87

Features

EventManager is useful when you want to keep your codebase loosely coupled. Publishers and subscribers don't need to know anything about each other. EventManager is not a solution for exposing callbacks in the Unity Editor, Unity's own EventSystem may be more appropriate for that use case.

  • Loosely coupled
  • Type-safe
  • Avoids breaking changes when new event parameters are added

EventManager includes a graphical EventVisualizer that shows how your classes are connected during runtime EventVisualizer

Installation

Install the source or build a DLL.

Option 1: Source Installation

Copy the Assets/EventManager folder to your project's Assets folder.

Source and Unit Tests

NOTE: Unit tests are stored in an 'Editor' folder so they are not added to your build

mkdir tmp
cd tmp
git clone https://github.com/robertwahler/EventManager
cp -R EventManager/Assets/EventManager ~/your_unity_project/Assets/

Examples (optional)

cp -R EventManager/Assets/Examples ~/your_unity_project/Assets/EventManager/

Record Version SHA (optional)

git --git-dir=./EventManager/.git log --pretty=format:%h -1 > ~/your_unity_project/Assets/EventManager/VERSION

Option 2: DLL Installation

Create a DLL and copy it to your Assets folder. These instructions expect the standard Mono mcs compiler. If you need it on OS X, you can install it with HomeBrew brew install mono

mkdir build

mcs -recurse:'Assets/EventManager/Source/*.cs' \
    -lib:/Applications/Unity/Unity.app/Contents/Frameworks/ \
    -lib:/Applications/Unity/Unity.app/Contents/Frameworks/Managed/ \
    -r:UnityEngine \
    -r:UnityEditor \
    -target:library \
    -out:build/SDD.EventManager.dll

mkdir Assets/Lib

cp build/SDD.EventManager.dll ~/your_unity_project/Assets/Lib/

Option 3: Installation via NPM

To install via NPM the following is needed:

  • Install the Node.js package manager
  • In your Unity-project run npm install --save unity3d.eventmanager
  • Extend your .gitignore (or whatever else you're using)
    • Add node_modules
    • Add package-lock.json
    • Add Assets/packages/
    • Add Assets/packages.meta

You can also add a package.json to your Unity project that contains the following content:

{
  "dependencies": {
    "unity3d.eventmanager": "1.1.0"
  }
}

This way you can define what dependencies you need in a reproducible way.

Testing

The NUnit test framework is included in Unity 5.3 and higher. Tests require installation of the UnityTestTools asset for Unity 5.2 and lower.

Running tests from Unity IDE

There is no Unity hotkey for running tests. Instead, manually use this menu sequence:

Main Menu: Window, Editor Tests Runner
Editor Tests: Run All

Running tests from the command line

All command line test scripts require a Ruby Thor scripting environment with Ruby > 2.0. These commands are configured for execution on Mac OS X. Other environments will need to modify the Ruby source in the ./tasks folder.

gem install bundler
bundle install

Using Unity to run the tests (SLOW)

You need to shutdown the Unity IDE to run this command.

thor test:unit

Using NUnit-console (FAST)

The Unity IDE can be running.

thor test:nunit

Using Guard and the NUnit-console (CI)

This command will watch for file changes and automatically run the unit test suite. The Unity IDE can be running.

bundle exec guard

Syntax checking with Vim

Do you use Vim instead of MonoDevelop/Visual Studio? Install https://github.com/neomake/neomake and add this to your .vimrc

let g:neomake_cs_mcs_maker = {
  \ 'args': ['@.mcs'],
  \ 'errorformat': '%f(%l\,%c): %trror %m',
  \ }

Usage

See Assets/Examples

License

MIT, see ./LICENSE for details.