From 335ca7e368e022e4a9de896a9943ac055020174b Mon Sep 17 00:00:00 2001 From: Marc Hernandez Date: Sun, 24 Nov 2013 22:04:55 -0800 Subject: [PATCH] Module stuff --- SharpLib.csproj | 1 + mod/Modules.cs | 87 +++++++++++++++++++++++++++++++++++++++++++++++++ res/Resource.cs | 7 ++++ 3 files changed, 95 insertions(+) create mode 100644 mod/Modules.cs diff --git a/SharpLib.csproj b/SharpLib.csproj index fe8b79e..3d768cc 100644 --- a/SharpLib.csproj +++ b/SharpLib.csproj @@ -66,6 +66,7 @@ + diff --git a/mod/Modules.cs b/mod/Modules.cs new file mode 100644 index 0000000..4b455fd --- /dev/null +++ b/mod/Modules.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +//using System.Threading.Tasks; +using System.Diagnostics; +using System.Reflection; + +namespace mod +{ + +[Serializable] +public class Config : lib.Config +{ + public String name = "Generic"; +} + +public class View +{ +} + +public class Base +{ + public Config Cfg { get { return m_cfg; } } + + public Base( Config cfg ) + { + m_cfg = cfg; + } + + private Config m_cfg; +} + + +[Serializable] +public class FluidConfig : Config +{ + public String type = "none"; +} + + +public class FluidBase : Base +{ + public new FluidConfig Cfg { get { return (FluidConfig)base.Cfg; } } + + public FluidBase( FluidConfig cfg ) + : base( cfg ) + { + } +} + + + + + + + + + + + + + + + + +[Serializable] +public class SystemConfig : Config +{ + public String type = "none"; +} + + +public class System +{ + public SystemConfig Cfg { get { return m_cfg; } } + + public System( SystemConfig cfg ) + { + m_cfg = cfg; + } + + private SystemConfig m_cfg; +} + + +} diff --git a/res/Resource.cs b/res/Resource.cs index e3b9e1d..4aba1ca 100644 --- a/res/Resource.cs +++ b/res/Resource.cs @@ -102,6 +102,7 @@ public class Mgr Resource.mgr.m_loaders[ typeof( T ) ] = loader; } + //Register all subclasses of a particular type static public void registerSub( Load loaderOfType ) { @@ -156,6 +157,12 @@ public class Mgr return new Ref( filename ); } + private Mgr() + { + + } + + private Dictionary m_loaders = new Dictionary(); //private Dictionary m_loadersOfType = new Dictionary(); }