Coder Social home page Coder Social logo

net-event-manager's Introduction

Hi there ๐Ÿ‘‹, I'm Enderlook!

I'm a Unity programmer at Whiteboard Games and a teacher at Escuela Da Vinci University.

๐Ÿงฎ Programming Stats

๐Ÿ’ป Tech Likes
๐Ÿ† My Interests ๐Ÿš€ Languages โšก๏ธ Skills
๐Ÿฅ‡ Love Rust C# Unity Blazor
๐Ÿฅˆ Like Typescript Python Git Godot
๐Ÿฅ‰ Know Javascript HTML Chrome Extensions Solana
๐ŸŒฑ Want To Learn Vue Electron NodeJS MySQL
๐Ÿค” Others VBA Unreal
๐Ÿ–ฅ๏ธ Stack Exchange profile for Ender Look on Stack Exchange, a network of free, community-driven Q&A sites

Any questionโ”
Raise an issue!

net-event-manager's People

Contributors

enderlook avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

lodcrazycoder

net-event-manager's Issues

subscribing to "Any" Event or a base type / interface

Hi,

this looks like a good improvement on the class I'm already using thanks but I've got a couple of questions that I'm not sure how to resolve when using the Subscribe<T> / Raise<T> pattern...

1. how to subscribe to any event eg using something like

eventManager.Subscribe<IEvent>(SomeHandler);
...
private void SomeHandler(IEvent e) {}

where all events inherit from IEvent eg public struct CustomEvent : IEvent

so calling eventManager.Raise(new CustomEvent {}) would somehow need to get picked up by the "global" IEvent handler


2. how to pass an IEvent reference to a specific <T> handler.

eg Odin Inspector lets you select a class from a drop down when you do

[SerializeReference] IEvent @event;
...
eventManager.Raise(@event);

image

so whilst @event.GetType() may be CustomEvent : IEvent it will still be Raised as an IEvent when calling
eventManager.Raise(@event)

That means it won't be picked up by eventManager.Subscribe<CustomEvent>(...)

would be great if the library could somehow handle these scenarios.

(I have some messy solutions for the EventManager class I'm currently working which basically involves adding an extra method like
EventManager.AddInterfaceEventListener(e.GetType(), InterfaceHandler) then adding it to separate dictionary to the main one, but I it doesn't seem like a great implementation)

thanks
J

(sorry I forgot to mention I'm using Unity! hence the Odin Inspector screenshot above)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.