Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ElementsCore
- {
- public abstract class BaseModule<T>
- {
- protected bool mod_is_init;
- protected bool mod_is_closed;
- protected ModuleManager<T> mod_manager;
- public BaseModule()
- {
- mod_manager = null;
- mod_is_init = false;
- mod_is_closed = false;
- }
- public void SetManager(ModuleManager<T> manager)
- {
- mod_manager = manager;
- }
- protected abstract void m_init();
- protected abstract bool m_key_down(KeyCommand command);
- protected abstract void m_close();
- public void Init()
- {
- if (mod_is_init) Close();
- mod_is_init = true;
- mod_is_closed = false;
- m_init();
- }
- public bool KeyDown(KeyCommand command)
- {
- if (!mod_is_init || mod_is_closed)
- {
- return false;
- }
- else
- {
- return m_key_down(command);
- }
- }
- public void Close()
- {
- if (mod_is_init)
- {
- m_close();
- mod_is_closed = true;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement