Browse Source

C# Spinner component running attached to node

Josh Engebretson 10 years ago
parent
commit
dbb2492951

+ 5 - 10
Build/AtomicNET/AtomicNETEngine/AtomicNET.cs

@@ -27,8 +27,9 @@ public static class Atomic
     PhysicsModule.Initialize ();
     PhysicsModule.Initialize ();
     EnvironmentModule.Initialize ();
     EnvironmentModule.Initialize ();
     UIModule.Initialize ();
     UIModule.Initialize ();
+    AtomicNETModule.Initialize();
     AtomicPlayer.PlayerModule.Initialize ();
     AtomicPlayer.PlayerModule.Initialize ();
-    initSubsystems();
+    //initSubsystems();
   }
   }
 
 
   static Dictionary<Type, RefCounted> subSystems = new Dictionary<Type, RefCounted>();
   static Dictionary<Type, RefCounted> subSystems = new Dictionary<Type, RefCounted>();
@@ -72,7 +73,7 @@ public partial class RefCounted
     nativeInstance = native;
     nativeInstance = native;
   }
   }
 
 
-  public IntPtr nativeInstance;
+  public IntPtr nativeInstance = IntPtr.Zero;
 
 
   [DllImport (Constants.LIBNAME, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
   [DllImport (Constants.LIBNAME, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
   public static extern IntPtr csb_Atomic_RefCounted_GetClassID (IntPtr self);
   public static extern IntPtr csb_Atomic_RefCounted_GetClassID (IntPtr self);
@@ -142,11 +143,7 @@ static class NativeCore
     GC.Collect();
     GC.Collect();
     ReleaseExpiredNativeReferences();
     ReleaseExpiredNativeReferences();
 
 
-    if (test == IntPtr.Zero || !nativeLookup.ContainsKey(test))
-    {
-      test = Atomic.GetSubsystem<Renderer>().GetDefaultZone().nativeInstance;
-      //Console.WriteLine("Allocated: " + test);
-    }
+    ComponentCore.Update(timeStep);
 
 
   }
   }
 
 
@@ -224,13 +221,11 @@ static class NativeCore
 
 
 public class InspectorAttribute : Attribute
 public class InspectorAttribute : Attribute
 {
 {
-  public InspectorAttribute(string DefaultValue = "", string Value1 = "", string Value2 = "")
+  public InspectorAttribute(string DefaultValue = "")
   {
   {
   }
   }
 
 
   public string DefaultValue;
   public string DefaultValue;
-  public string Value1;
-  public string Value2;
 }
 }
 
 
 
 

+ 54 - 0
Build/AtomicNET/AtomicNETEngine/ComponentCore.cs

@@ -0,0 +1,54 @@
+using System;
+using System.Reflection;
+using System.Collections.Generic;
+using System.Runtime.Loader;
+using System.Runtime.InteropServices;
+
+namespace AtomicEngine
+{
+
+
+public partial class CSComponent : ScriptComponent
+{
+
+  public virtual void Update(float timeStep)
+  {
+
+  }
+
+}
+
+public static class ComponentCore
+{
+
+  // holds a reference
+  static Dictionary<IntPtr, CSComponent> liveComponents = new Dictionary<IntPtr, CSComponent>();
+
+  public static void Update (float timeStep)
+  {
+      foreach (var c in liveComponents.Values)
+      {
+            c.Update(timeStep);
+      }
+  }
+
+  public static IntPtr CSComponentCreate(string assemblyName, string classTypeName)
+  {
+
+    Assembly assembly = AssemblyLoadContext.Default.LoadFromAssemblyName(new AssemblyName(assemblyName));
+
+    Type type = assembly.GetType("AtomicNETTest."  + classTypeName);
+
+    // TODO: check type is derived from CSComponent
+
+    var component = (CSComponent) Activator.CreateInstance(type);
+
+    liveComponents[component.nativeInstance] = component;
+
+    return component.nativeInstance;
+
+  }
+
+}
+
+}

+ 1 - 0
Build/AtomicNET/build.sh

@@ -7,6 +7,7 @@ mcs /out:/Users/josh/Desktop/OSX.x64.Debug/AtomicNETBootstrap.dll /nostdlib /noc
 mcs /out:/Users/josh/Desktop/AtomicNETEngine.dll /nostdlib /noconfig /t:library /w:0 /lib:/Users/josh/Desktop/OSX.x64.Debug \
 mcs /out:/Users/josh/Desktop/AtomicNETEngine.dll /nostdlib /noconfig /t:library /w:0 /lib:/Users/josh/Desktop/OSX.x64.Debug \
 /r:System.Console.dll /r:System.Runtime.dll /r:System.IO.dll /r:System.IO.FileSystem.dll /r:mscorlib.dll \
 /r:System.Console.dll /r:System.Runtime.dll /r:System.IO.dll /r:System.IO.FileSystem.dll /r:mscorlib.dll \
 /Users/josh/Dev/atomic/AtomicGameEngine/Build/Source/Generated/MACOSX/CSharp/Packages/Atomic/Managed/*.cs \
 /Users/josh/Dev/atomic/AtomicGameEngine/Build/Source/Generated/MACOSX/CSharp/Packages/Atomic/Managed/*.cs \
+/Users/josh/Dev/atomic/AtomicGameEngine/Build/Source/Generated/MACOSX/CSharp/Packages/AtomicNET/Managed/*.cs \
 /Users/josh/Dev/atomic/AtomicGameEngine/Build/Source/Generated/MACOSX/CSharp/Packages/AtomicPlayer/Managed/*.cs \
 /Users/josh/Dev/atomic/AtomicGameEngine/Build/Source/Generated/MACOSX/CSharp/Packages/AtomicPlayer/Managed/*.cs \
 /Users/josh/Dev/atomic/AtomicGameEngine/Build/AtomicNET/AtomicNETEngine/*.cs
 /Users/josh/Dev/atomic/AtomicGameEngine/Build/AtomicNET/AtomicNETEngine/*.cs
 
 

+ 8 - 1
Build/AtomicNETTest/MyClass.cs

@@ -13,6 +13,13 @@ namespace AtomicNETTest
 
 
     public class MyComponent : CSComponent
     public class MyComponent : CSComponent
     {
     {
+
+        public override void Update(float timeStep)
+        {
+            Node.Yaw(timeStep * 75);
+            //Console.WriteLine("TICK! : {0}", nativeInstance);
+        }
+
         [Inspector]
         [Inspector]
         public bool MyBoolValue = true;
         public bool MyBoolValue = true;
 
 
@@ -25,7 +32,7 @@ namespace AtomicNETTest
         [Inspector]
         [Inspector]
         public Quaternion MyQuaternionValue = new Quaternion(1, 0, 0, 0);
         public Quaternion MyQuaternionValue = new Quaternion(1, 0, 0, 0);
 
 
-        [Inspector(Value1 = "This is a", Value2 = "test")]
+        [Inspector()]
         public float MyFloatValue = 42.0f;
         public float MyFloatValue = 42.0f;
 
 
         [Inspector]
         [Inspector]

+ 15 - 0
CMake/Modules/AtomicNET.cmake

@@ -1,5 +1,6 @@
 set (CSATOMICNATIVEDIR "${CMAKE_SOURCE_DIR}/Build/Source/Generated/${JAVASCRIPT_BINDINGS_PLATFORM}/CSharp/Packages/Atomic/Native")
 set (CSATOMICNATIVEDIR "${CMAKE_SOURCE_DIR}/Build/Source/Generated/${JAVASCRIPT_BINDINGS_PLATFORM}/CSharp/Packages/Atomic/Native")
 set (CSATOMICPLAYERNATIVEDIR "${CMAKE_SOURCE_DIR}/Build/Source/Generated/${JAVASCRIPT_BINDINGS_PLATFORM}/CSharp/Packages/AtomicPlayer/Native")
 set (CSATOMICPLAYERNATIVEDIR "${CMAKE_SOURCE_DIR}/Build/Source/Generated/${JAVASCRIPT_BINDINGS_PLATFORM}/CSharp/Packages/AtomicPlayer/Native")
+set (CSATOMICNETNATIVEDIR "${CMAKE_SOURCE_DIR}/Build/Source/Generated/${JAVASCRIPT_BINDINGS_PLATFORM}/CSharp/Packages/AtomicNET/Native")
 
 
 # Create the JSBind files ahead of time, so they are picked up with glob
 # Create the JSBind files ahead of time, so they are picked up with glob
 set (CSFILES CSModuleAtomic2D.cpp;CSModuleAtomic3D.cpp;CSModuleAudio.cpp;CSModuleContainer.cpp;CSModuleCore.cpp;
 set (CSFILES CSModuleAtomic2D.cpp;CSModuleAtomic3D.cpp;CSModuleAudio.cpp;CSModuleContainer.cpp;CSModuleCore.cpp;
@@ -10,6 +11,8 @@ set (CSFILES CSModuleAtomic2D.cpp;CSModuleAtomic3D.cpp;CSModuleAudio.cpp;CSModul
 
 
 set (CSATOMICPLAYERFILES CSModulePlayer.cpp;CSPackageAtomicPlayer.cpp;CSPackageAtomicPlayer.h)
 set (CSATOMICPLAYERFILES CSModulePlayer.cpp;CSPackageAtomicPlayer.cpp;CSPackageAtomicPlayer.h)
 
 
+set (CSATOMICNETFILES CSModuleAtomicNET.cpp;CSPackageAtomicNET.cpp;CSPackageAtomicNET.h)
+
 foreach(CSFILE ${CSFILES})
 foreach(CSFILE ${CSFILES})
 
 
   set (CSFILEPATH "${CSATOMICNATIVEDIR}/${CSFILE}")
   set (CSFILEPATH "${CSATOMICNATIVEDIR}/${CSFILE}")
@@ -30,5 +33,17 @@ foreach(CSFILE ${CSATOMICPLAYERFILES})
 
 
 endforeach()
 endforeach()
 
 
+foreach(CSFILE ${CSATOMICNETFILES})
+
+  set (CSFILEPATH "${CSATOMICNETNATIVEDIR}/${CSFILE}")
+
+  if (NOT EXISTS ${CSFILEPATH})
+    file(WRITE "${CSFILEPATH}" "// will be created by AtomicTool")
+  endif()
+
+endforeach()
+
+
 file (GLOB CSHARP_BINDINGS_SOURCE ${CSATOMICNATIVEDIR}/*.cpp ${CSATOMICNATIVEDIR}/*.h)
 file (GLOB CSHARP_BINDINGS_SOURCE ${CSATOMICNATIVEDIR}/*.cpp ${CSATOMICNATIVEDIR}/*.h)
 file (GLOB CSHARPATOMICPLAYER_BINDINGS_SOURCE ${CSATOMICPLAYERNATIVEDIR}/*.cpp ${CSATOMICPLAYERNATIVEDIR}/*.h)
 file (GLOB CSHARPATOMICPLAYER_BINDINGS_SOURCE ${CSATOMICPLAYERNATIVEDIR}/*.cpp ${CSATOMICPLAYERNATIVEDIR}/*.h)
+file (GLOB CSHARPATOMICNET_BINDINGS_SOURCE ${CSATOMICNETNATIVEDIR}/*.cpp ${CSATOMICNETNATIVEDIR}/*.h)

+ 3 - 1
Source/AtomicEditor/Application/AEEditorCommon.cpp

@@ -71,14 +71,16 @@ void AEEditorCommon::Setup()
 
 
     // Instantiate and register the AtomicNET subsystem
     // Instantiate and register the AtomicNET subsystem
     SharedPtr<NETCore> netCore (new NETCore(context_));
     SharedPtr<NETCore> netCore (new NETCore(context_));
+    context_->RegisterSubsystem(netCore);
     String netCoreErrorMsg;
     String netCoreErrorMsg;
     if (!netCore->Initialize("/Users/josh/Desktop/OSX.x64.Debug/", netCoreErrorMsg))
     if (!netCore->Initialize("/Users/josh/Desktop/OSX.x64.Debug/", netCoreErrorMsg))
     {
     {
         LOGERRORF("NetCore: Unable to initialize! %s", netCoreErrorMsg.CString());
         LOGERRORF("NetCore: Unable to initialize! %s", netCoreErrorMsg.CString());
+        context_->RemoveSubsystem(NETCore::GetTypeStatic());
     }
     }
     else
     else
     {
     {
-        context_->RegisterSubsystem(netCore);
+
     }
     }
 #endif
 #endif
 
 

+ 1 - 1
Source/AtomicEditor/CMakeLists.txt

@@ -24,7 +24,7 @@ file (GLOB JAVASCRIPT_BINDINGS_SOURCE ${CMAKE_SOURCE_DIR}/Build/Source/Generated
 
 
 set (SOURCE_FILES ${SOURCE_FILES} ${JAVASCRIPT_BINDINGS_SOURCE})
 set (SOURCE_FILES ${SOURCE_FILES} ${JAVASCRIPT_BINDINGS_SOURCE})
 
 
-set (SOURCE_FILES ${SOURCE_FILES} ${CSHARP_BINDINGS_SOURCE} ${CSHARPATOMICPLAYER_BINDINGS_SOURCE})
+set (SOURCE_FILES ${SOURCE_FILES} ${CSHARP_BINDINGS_SOURCE} ${CSHARPATOMICPLAYER_BINDINGS_SOURCE}  ${CSHARPATOMICNET_BINDINGS_SOURCE})
 
 
 if (APPLE)
 if (APPLE)
 
 

+ 25 - 6
Source/AtomicNET/NETCore/CSComponent.cpp

@@ -66,6 +66,7 @@ public:
         // At runtime, a XML CSComponent may refer to a managed component
         // At runtime, a XML CSComponent may refer to a managed component
 
 
         String managedClass;
         String managedClass;
+        String assemblyRef;
 
 
         if (source != XMLElement::EMPTY)
         if (source != XMLElement::EMPTY)
         {
         {
@@ -73,22 +74,40 @@ public:
 
 
             while (attrElem)
             while (attrElem)
             {
             {
-                if (attrElem.GetAttribute("name") == "ManagedClass")
+                if (attrElem.GetAttribute("name") == "Assembly")
+                {
+                    assemblyRef = attrElem.GetAttribute("value");
+                }
+                else if (attrElem.GetAttribute("name") == "Class")
                 {
                 {
                     managedClass = attrElem.GetAttribute("value");
                     managedClass = attrElem.GetAttribute("value");
-                    break;
                 }
                 }
 
 
+                if (assemblyRef.Length() && managedClass.Length())
+                    break;
+
                 attrElem = attrElem.GetNext("attribute");
                 attrElem = attrElem.GetNext("attribute");
             }
             }
-        }
+        }               
 
 
         SharedPtr<Object> ptr;
         SharedPtr<Object> ptr;
 
 
-        if (managedClass.Length())
+        if (assemblyRef.Length())
         {
         {
-            // change to callback
-            //ptr = CSComponentCreate(managedClass);
+            Vector<String> split = assemblyRef.Split(';');
+
+            if (split.Size() == 2)
+            {
+                ResourceCache* cache = context_->GetSubsystem<ResourceCache>();
+                NETAssemblyFile* componentFile = cache->GetResource<NETAssemblyFile>(split[1]);
+                if (componentFile)
+                    ptr = componentFile->CreateCSComponent(managedClass);
+                else
+                {
+                    LOGERRORF("Unable to load component file %s", split[1].CString());
+                }
+            }
+
         }
         }
 
 
         if (ptr.Null())
         if (ptr.Null())

+ 15 - 0
Source/AtomicNET/NETCore/NETAssemblyFile.cpp

@@ -23,10 +23,12 @@
 #include <Atomic/Core/Context.h>
 #include <Atomic/Core/Context.h>
 #include <Atomic/IO/Deserializer.h>
 #include <Atomic/IO/Deserializer.h>
 #include <Atomic/IO/Log.h>
 #include <Atomic/IO/Log.h>
+#include <Atomic/IO/FileSystem.h>
 #include <Atomic/Core/Profiler.h>
 #include <Atomic/Core/Profiler.h>
 #include <Atomic/Resource/ResourceCache.h>
 #include <Atomic/Resource/ResourceCache.h>
 #include <Atomic/IO/Serializer.h>
 #include <Atomic/IO/Serializer.h>
 
 
+#include "NETManaged.h"
 #include "NETAssemblyFile.h"
 #include "NETAssemblyFile.h"
 
 
 namespace Atomic
 namespace Atomic
@@ -59,6 +61,19 @@ void NETAssemblyFile::InitTypeMap()
 
 
 }
 }
 
 
+CSComponent* NETAssemblyFile::CreateCSComponent(const String& classname)
+{
+    const String& name = GetName();
+
+    // TODO: cache this
+    String pathName, fileName, ext;
+    SplitPath(name, pathName, fileName, ext);
+
+    NETManaged* managed = GetSubsystem<NETManaged>();
+
+    return managed->CSComponentCreate(fileName, classname);
+}
+
 bool NETAssemblyFile::ParseComponentClassJSON(const JSONValue& json)
 bool NETAssemblyFile::ParseComponentClassJSON(const JSONValue& json)
 {
 {
     if (!typeMap_.Size())
     if (!typeMap_.Size())

+ 4 - 0
Source/AtomicNET/NETCore/NETAssemblyFile.h

@@ -32,6 +32,8 @@
 namespace Atomic
 namespace Atomic
 {
 {
 
 
+class CSComponent;
+
 // At runtime we need to load the assembly, in the editor we use metadata
 // At runtime we need to load the assembly, in the editor we use metadata
 /// NET Assembly resource.
 /// NET Assembly resource.
 class ATOMIC_API NETAssemblyFile : public ScriptComponentFile
 class ATOMIC_API NETAssemblyFile : public ScriptComponentFile
@@ -48,6 +50,8 @@ public:
 
 
     bool ParseAssemblyJSON(const JSONValue& json);
     bool ParseAssemblyJSON(const JSONValue& json);
 
 
+    CSComponent* CreateCSComponent(const String& classname);
+
     /// Load resource from stream. May be called from a worker thread. Return true if successful.
     /// Load resource from stream. May be called from a worker thread. Return true if successful.
     virtual bool BeginLoad(Deserializer& source);
     virtual bool BeginLoad(Deserializer& source);
     /// Save resource
     /// Save resource

+ 17 - 14
Source/AtomicNET/NETCore/NETCore.cpp

@@ -82,18 +82,6 @@ NETCore::NETCore(Context* context) :
     assert(!instance_);
     assert(!instance_);
     instance_ = this;
     instance_ = this;
     csContext_ = context;
     csContext_ = context;
-
-    SharedPtr<NETManaged> managed(new NETManaged(context_));
-    context_->RegisterSubsystem(managed);
-
-    SharedPtr<CSEventDispatcher> dispatcher(new CSEventDispatcher(context_));
-    context_->RegisterSubsystem(dispatcher);
-    context_->AddGlobalEventListener(dispatcher);
-
-    if (!context_->GetEditorContext())
-    {
-        SubscribeToEvent(E_UPDATE, HANDLER(NETCore, HandleUpdate));
-    }
 }
 }
 
 
 NETCore::~NETCore()
 NETCore::~NETCore()
@@ -366,8 +354,6 @@ bool NETCore::Initialize(const String &coreCLRFilesAbsPath, String& errorMsg)
         startup();
         startup();
     }
     }
 
 
-    /*
-
     st = sCreateDelegate(hostHandle_,
     st = sCreateDelegate(hostHandle_,
                     domainId_,
                     domainId_,
                     "AtomicNETEngine",
                     "AtomicNETEngine",
@@ -380,6 +366,9 @@ bool NETCore::Initialize(const String &coreCLRFilesAbsPath, String& errorMsg)
         startup();
         startup();
     }
     }
 
 
+    /*
+
+
     RefCountedDeletedFunction rcdFunction;
     RefCountedDeletedFunction rcdFunction;
 
 
     st = sCreateDelegate(hostHandle_,
     st = sCreateDelegate(hostHandle_,
@@ -438,6 +427,20 @@ bool NETCore::Initialize(const String &coreCLRFilesAbsPath, String& errorMsg)
             (unsigned int*)&exitCode);
             (unsigned int*)&exitCode);
     */
     */
 
 
+    SharedPtr<NETManaged> managed(new NETManaged(context_));
+    context_->RegisterSubsystem(managed);
+
+    SharedPtr<CSEventDispatcher> dispatcher(new CSEventDispatcher(context_));
+    context_->RegisterSubsystem(dispatcher);
+    context_->AddGlobalEventListener(dispatcher);
+
+    if (!context_->GetEditorContext())
+    {
+        SubscribeToEvent(E_UPDATE, HANDLER(NETCore, HandleUpdate));
+    }
+
+    managed->Initialize();
+
     return true;
     return true;
 
 
 }
 }

+ 15 - 3
Source/AtomicNET/NETCore/NETManaged.cpp

@@ -5,9 +5,11 @@
 #include <Atomic/IO/Log.h>
 #include <Atomic/IO/Log.h>
 #include <Atomic/Core/StringUtils.h>
 #include <Atomic/Core/StringUtils.h>
 
 
+#include "NETCore.h"
+#include "NETManaged.h"
+
 #include "CSEventHelper.h"
 #include "CSEventHelper.h"
 #include "CSComponent.h"
 #include "CSComponent.h"
-#include "NETManaged.h"
 
 
 namespace Atomic
 namespace Atomic
 {
 {
@@ -20,6 +22,7 @@ NETManaged::NETManaged(Context* context) :
     CSBeginSendEvent_(0),
     CSBeginSendEvent_(0),
     NETUpdate_(0)
     NETUpdate_(0)
 {
 {
+
 }
 }
 
 
 NETManaged::~NETManaged()
 NETManaged::~NETManaged()
@@ -27,6 +30,15 @@ NETManaged::~NETManaged()
 
 
 }
 }
 
 
+bool NETManaged::Initialize()
+{
+    NETCore* core = GetSubsystem<NETCore>();
+    core->CreateDelegate("AtomicNETEngine", "AtomicEngine.ComponentCore", "CSComponentCreate", (void**) &CSComponentCreate_);
+    core->CreateDelegate("AtomicNETEngine", "AtomicEngine.NativeCore", "NETUpdate", (void**) &NETUpdate_);
+
+    return true;
+}
+
 void NETManaged::SetNETUpdate(NETUpdateFunctionPtr ptr)
 void NETManaged::SetNETUpdate(NETUpdateFunctionPtr ptr)
 {
 {
     NETUpdate_ = ptr;
     NETUpdate_ = ptr;
@@ -40,12 +52,12 @@ void NETManaged::NETUpdate(float timeStep)
     NETUpdate_(timeStep);
     NETUpdate_(timeStep);
 }
 }
 
 
-CSComponent* NETManaged::CSComponentCreate(const String& componentName)
+CSComponent* NETManaged::CSComponentCreate(const String& assemblyName, const String& componentName)
 {
 {
     if (!CSComponentCreate_)
     if (!CSComponentCreate_)
         return 0;
         return 0;
 
 
-    return CSComponentCreate_(componentName.CString());
+    return CSComponentCreate_(assemblyName.CString(), componentName.CString());
 
 
 }
 }
 
 

+ 6 - 2
Source/AtomicNET/NETCore/NETManaged.h

@@ -30,9 +30,11 @@
 namespace Atomic
 namespace Atomic
 {
 {
 
 
+class NETCore;
+
 typedef void (*NETUpdateFunctionPtr)(float timeStep);
 typedef void (*NETUpdateFunctionPtr)(float timeStep);
 
 
-typedef CSComponent* (*CSComponentCreateFunctionPtr)(const char* csComponentTypeName);
+typedef CSComponent* (*CSComponentCreateFunctionPtr)(const char* assemblyName, const char* csComponentTypeName);
 typedef void (*CSComponentCallMethodFunctionPtr)(unsigned id, CSComponentMethod method, float value);
 typedef void (*CSComponentCallMethodFunctionPtr)(unsigned id, CSComponentMethod method, float value);
 typedef void (*CSBeginSendEventFunctionPtr)(unsigned senderRefID, unsigned eventType, VariantMap* eventData);
 typedef void (*CSBeginSendEventFunctionPtr)(unsigned senderRefID, unsigned eventType, VariantMap* eventData);
 
 
@@ -46,6 +48,8 @@ public:
     /// Destruct.
     /// Destruct.
     virtual ~NETManaged();
     virtual ~NETManaged();
 
 
+    bool Initialize();
+
     void SetNETUpdate(NETUpdateFunctionPtr ptr);
     void SetNETUpdate(NETUpdateFunctionPtr ptr);
 
 
     void SetCSComponentCreate(CSComponentCreateFunctionPtr ptr);
     void SetCSComponentCreate(CSComponentCreateFunctionPtr ptr);
@@ -54,7 +58,7 @@ public:
 
 
     void NETUpdate(float timeStep);
     void NETUpdate(float timeStep);
 
 
-    CSComponent* CSComponentCreate(const String& componentName);
+    CSComponent* CSComponentCreate(const String& assemblyName, const String& componentName);
     void CSComponentCallMethod(unsigned id, CSComponentMethod methodID, float value = 0.0f);
     void CSComponentCallMethod(unsigned id, CSComponentMethod methodID, float value = 0.0f);
     void CSBeginSendEvent(unsigned senderRefID, unsigned eventType, VariantMap* eventData);
     void CSBeginSendEvent(unsigned senderRefID, unsigned eventType, VariantMap* eventData);
 
 

+ 1 - 1
Source/ToolCore/JSBind/CSharp/CSModuleWriter.cpp

@@ -392,7 +392,7 @@ void CSModuleWriter::GenerateManagedSource()
 {
 {
     String source = "// Autogenerated";
     String source = "// Autogenerated";
 
 
-    String moduleName = module_->GetPackage()->GetName();
+    String moduleName = module_->GetPackage()->GetNamespace();
 
 
     source += "\nusing System;\nusing System.Collections.Generic;\nusing System.Runtime.InteropServices;\n";
     source += "\nusing System;\nusing System.Collections.Generic;\nusing System.Runtime.InteropServices;\n";
 
 

+ 1 - 1
Source/ToolCore/JSBind/CSharp/CSPackageWriter.cpp

@@ -162,7 +162,7 @@ void CSPackageWriter::GenerateNativeSource()
         source += "using namespace Atomic;\n";
         source += "using namespace Atomic;\n";
 
 
     // begin namespace
     // begin namespace
-    source += ToString("using namespace %s;\n", packageName);
+    // source += ToString("using namespace %s;\n", packageName);
 
 
     source += ToString("namespace %s\n{\n", packageName);
     source += ToString("namespace %s\n{\n", packageName);