Parcourir la source

1.完成自动配置读取功能
2.完善reload功能

tanghai il y a 12 ans
Parent
commit
c7b5884c78
48 fichiers modifiés avec 504 ajouts et 227 suppressions
  1. 1 1
      CSharp/App/Editor/Bootstrapper.cs
  2. 4 4
      CSharp/App/Editor/Editor.csproj
  3. 1 1
      CSharp/App/Modules/Tree/BehaviorTreeLayout.cs
  4. 1 1
      CSharp/App/Modules/Tree/BehaviorTreeModule.cs
  5. 2 2
      CSharp/App/Modules/Tree/BehaviorTreeView.xaml
  6. 1 1
      CSharp/App/Modules/Tree/BehaviorTreeView.xaml.cs
  7. 1 1
      CSharp/App/Modules/Tree/BehaviorTreeViewModel.cs
  8. 0 0
      CSharp/App/Modules/Tree/CSharpOptions.cs
  9. 0 0
      CSharp/App/Modules/Tree/DescriptorProtoFile.cs
  10. 0 0
      CSharp/App/Modules/Tree/Packages.config
  11. 2 2
      CSharp/App/Modules/Tree/Tree.csproj
  12. 1 1
      CSharp/App/Modules/Tree/TreeNode.cs
  13. 1 1
      CSharp/App/Modules/Tree/TreeNodeViewModel.cs
  14. 45 30
      CSharp/CSharp.sln
  15. 8 8
      CSharp/CSharp.sln.DotSettings
  16. 3 0
      CSharp/Config/GlobalConfig/1.json
  17. 5 1
      CSharp/Game/BehaviorTree/BehaviorTree.csproj
  18. 1 1
      CSharp/Game/BehaviorTree/BlackBoard.cs
  19. 5 1
      CSharp/Game/BehaviorTreeTest/BehaviorTreeTest.csproj
  20. 1 1
      CSharp/Game/Component/Buff.cs
  21. 1 1
      CSharp/Game/Component/BuffManager.cs
  22. 83 0
      CSharp/Game/Component/Component.csproj
  23. 15 0
      CSharp/Game/Component/ConfigAttribute.cs
  24. 58 0
      CSharp/Game/Component/ConfigManager.cs
  25. 1 1
      CSharp/Game/Component/HandlerAttribute.cs
  26. 2 1
      CSharp/Game/Component/IConfigInitialize.cs
  27. 2 2
      CSharp/Game/Component/IHandler.cs
  28. 8 0
      CSharp/Game/Component/ILogicEntry.cs
  29. 1 1
      CSharp/Game/Component/IType.cs
  30. 1 1
      CSharp/Game/Component/MessageEnv.cs
  31. 16 1
      CSharp/Game/Component/Object.cs
  32. 4 0
      CSharp/Game/Component/packages.config
  33. 0 14
      CSharp/Game/Handler/ChatHandler.cs
  34. 18 0
      CSharp/Game/Logic/Handler/ChatHandler.cs
  35. 24 0
      CSharp/Game/Logic/Handler/ReloadHandler.cs
  36. 16 5
      CSharp/Game/Logic/Logic.csproj
  37. 11 10
      CSharp/Game/Logic/LogicEntry.cs
  38. 0 56
      CSharp/Game/World/AllConfigManager.cs
  39. 96 0
      CSharp/Game/World/Config.cs
  40. 13 0
      CSharp/Game/World/Config/GlobalConfig.cs
  41. 0 42
      CSharp/Game/World/ConfigManager.cs
  42. 0 8
      CSharp/Game/World/IDispatcher.cs
  43. 36 11
      CSharp/Game/World/World.cs
  44. 6 11
      CSharp/Game/World/World.csproj
  45. 1 1
      CSharp/Game/WorldTest/BuffManagerTest.cs
  46. 1 1
      CSharp/Game/WorldTest/ObjectTest.cs
  47. 3 3
      CSharp/Game/WorldTest/WorldTest.cs
  48. 4 0
      CSharp/Game/WorldTest/WorldTest.csproj

+ 1 - 1
CSharp/App/Editor/Bootstrapper.cs

@@ -3,7 +3,7 @@ using System.Windows;
 using Infrastructure;
 using Microsoft.Practices.Prism.MefExtensions;
 using Microsoft.Practices.Prism.Regions;
-using Modules.BehaviorTree;
+using Modules.Tree;
 using Modules.Robot;
 using Modules.Login;
 using Modules.WCFClient;

+ 4 - 4
CSharp/App/Editor/Editor.csproj

@@ -117,10 +117,6 @@
       <Project>{48a2e149-0dac-41b4-bb54-dfbccd6d42b3}</Project>
       <Name>Infrastructure</Name>
     </ProjectReference>
-    <ProjectReference Include="..\Modules\BehaviorTree\BehaviorTree.csproj">
-      <Project>{6cd185d1-08e0-4729-a999-2d5b57ba8193}</Project>
-      <Name>BehaviorTree</Name>
-    </ProjectReference>
     <ProjectReference Include="..\Modules\Login\Login.csproj">
       <Project>{5aa48f9a-455d-4cd8-a605-a3ac38283e60}</Project>
       <Name>Login</Name>
@@ -129,6 +125,10 @@
       <Project>{5d6ecbcd-be14-4dcb-baec-57089748b164}</Project>
       <Name>Robot</Name>
     </ProjectReference>
+    <ProjectReference Include="..\Modules\Tree\Tree.csproj">
+      <Project>{6cd185d1-08e0-4729-a999-2d5b57ba8193}</Project>
+      <Name>Tree</Name>
+    </ProjectReference>
     <ProjectReference Include="..\Modules\WCFClient\WCFClient.csproj">
       <Project>{B07D70E7-F902-4F67-A486-B7AF27D6B813}</Project>
       <Name>WCFClient</Name>

+ 1 - 1
CSharp/App/Modules/BehaviorTree/BehaviorTreeLayout.cs → CSharp/App/Modules/Tree/BehaviorTreeLayout.cs

@@ -1,6 +1,6 @@
 using Log;
 
-namespace Modules.BehaviorTree
+namespace Modules.Tree
 {
 	public static class BehaviorTreeLayout
 	{

+ 1 - 1
CSharp/App/Modules/BehaviorTree/BehaviorTreeModule.cs → CSharp/App/Modules/Tree/BehaviorTreeModule.cs

@@ -1,7 +1,7 @@
 using Microsoft.Practices.Prism.MefExtensions.Modularity;
 using Microsoft.Practices.Prism.Modularity;
 
-namespace Modules.BehaviorTree
+namespace Modules.Tree
 {
 	[ModuleExport(moduleType: typeof (BehaviorTreeModule))]
 	public class BehaviorTreeModule: IModule

+ 2 - 2
CSharp/App/Modules/BehaviorTree/BehaviorTreeView.xaml → CSharp/App/Modules/Tree/BehaviorTreeView.xaml

@@ -2,8 +2,8 @@
 		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 		xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 		xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
-		xmlns:BehaviorTree="clr-namespace:Modules.BehaviorTree" 
-		x:Class="Modules.BehaviorTree.BehaviorTreeView"
+		xmlns:BehaviorTree="clr-namespace:Modules.Tree" 
+		x:Class="Modules.Tree.BehaviorTreeView"
 		mc:Ignorable="d" 
 		d:DesignHeight="600" 
 		d:DesignWidth="800" 

+ 1 - 1
CSharp/App/Modules/BehaviorTree/BehaviorTreeView.xaml.cs → CSharp/App/Modules/Tree/BehaviorTreeView.xaml.cs

@@ -4,7 +4,7 @@ using System.Windows;
 using System.Windows.Input;
 using Infrastructure;
 
-namespace Modules.BehaviorTree
+namespace Modules.Tree
 {
 	/// <summary>
 	/// BehaviorTreeView.xaml 的交互逻辑

+ 1 - 1
CSharp/App/Modules/BehaviorTree/BehaviorTreeViewModel.cs → CSharp/App/Modules/Tree/BehaviorTreeViewModel.cs

@@ -1,7 +1,7 @@
 using System.Collections.ObjectModel;
 using System.ComponentModel.Composition;
 
-namespace Modules.BehaviorTree
+namespace Modules.Tree
 {
 	[Export(contractType: typeof (BehaviorTreeViewModel)),
 		PartCreationPolicy(creationPolicy: CreationPolicy.NonShared)]

+ 0 - 0
CSharp/App/Modules/BehaviorTree/CSharpOptions.cs → CSharp/App/Modules/Tree/CSharpOptions.cs


+ 0 - 0
CSharp/App/Modules/BehaviorTree/DescriptorProtoFile.cs → CSharp/App/Modules/Tree/DescriptorProtoFile.cs


+ 0 - 0
CSharp/App/Modules/BehaviorTree/Packages.config → CSharp/App/Modules/Tree/Packages.config


+ 2 - 2
CSharp/App/Modules/BehaviorTree/BehaviorTree.csproj → CSharp/App/Modules/Tree/Tree.csproj

@@ -8,8 +8,8 @@
     <ProjectGuid>{6CD185D1-08E0-4729-A999-2D5B57BA8193}</ProjectGuid>
     <OutputType>Library</OutputType>
     <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>BehaviorTree</RootNamespace>
-    <AssemblyName>BehaviorTree</AssemblyName>
+    <RootNamespace>Modules.Tree</RootNamespace>
+    <AssemblyName>Tree</AssemblyName>
     <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <Utf8Output>true</Utf8Output>

+ 1 - 1
CSharp/App/Modules/BehaviorTree/TreeNode.cs → CSharp/App/Modules/Tree/TreeNode.cs

@@ -1,4 +1,4 @@
-namespace Modules.BehaviorTree
+namespace Modules.Tree
 {
 	public class TreeNode
 	{

+ 1 - 1
CSharp/App/Modules/BehaviorTree/TreeNodeViewModel.cs → CSharp/App/Modules/Tree/TreeNodeViewModel.cs

@@ -1,7 +1,7 @@
 using System.Collections.ObjectModel;
 using Microsoft.Practices.Prism.ViewModel;
 
-namespace Modules.BehaviorTree
+namespace Modules.Tree
 {
 	public class TreeNodeViewModel: NotificationObject
 	{

+ 45 - 30
CSharp/CSharp.sln

@@ -16,8 +16,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Platform", "Platform", "{AD
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "App", "App", "{6E9D97F0-4243-452E-B832-1A855B8118EB}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BehaviorTree", "App\Modules\BehaviorTree\BehaviorTree.csproj", "{6CD185D1-08E0-4729-A999-2D5B57BA8193}"
-EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Editor", "App\Editor\Editor.csproj", "{C46F3337-0F48-4A72-84AD-8FDD1F159BB0}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Robot", "App\Modules\Robot\Robot.csproj", "{5D6ECBCD-BE14-4DCB-BAEC-57089748B164}"
@@ -56,12 +54,16 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BehaviorTree", "Game\Behavi
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BehaviorTreeTest", "Game\BehaviorTreeTest\BehaviorTreeTest.csproj", "{DD6F4735-E8E2-4F10-AE2B-434AB3A40236}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Handler", "Game\Handler\Handler.csproj", "{CB5BCF0A-4741-477A-94C6-49ECA782555F}"
-EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "World", "Game\World\World.csproj", "{CBEDBE33-A883-4BFA-AE0A-8B3573F09BD0}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorldTest", "Game\WorldTest\WorldTest.csproj", "{F2BEB8B2-0D9B-4CD9-A4BD-AE8E00903A67}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Logic", "Game\Logic\Logic.csproj", "{CB5BCF0A-4741-477A-94C6-49ECA782555F}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Component", "Game\Component\Component.csproj", "{0FA529D1-D0A9-4A8E-90F5-117CE80F2EDE}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tree", "App\Modules\Tree\Tree.csproj", "{6CD185D1-08E0-4729-A999-2D5B57BA8193}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -74,18 +76,6 @@ Global
 		Release|x86 = Release|x86
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{6CD185D1-08E0-4729-A999-2D5B57BA8193}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{6CD185D1-08E0-4729-A999-2D5B57BA8193}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{6CD185D1-08E0-4729-A999-2D5B57BA8193}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
-		{6CD185D1-08E0-4729-A999-2D5B57BA8193}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
-		{6CD185D1-08E0-4729-A999-2D5B57BA8193}.Debug|Win32.ActiveCfg = Debug|Any CPU
-		{6CD185D1-08E0-4729-A999-2D5B57BA8193}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{6CD185D1-08E0-4729-A999-2D5B57BA8193}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{6CD185D1-08E0-4729-A999-2D5B57BA8193}.Release|Any CPU.Build.0 = Release|Any CPU
-		{6CD185D1-08E0-4729-A999-2D5B57BA8193}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
-		{6CD185D1-08E0-4729-A999-2D5B57BA8193}.Release|Mixed Platforms.Build.0 = Release|Any CPU
-		{6CD185D1-08E0-4729-A999-2D5B57BA8193}.Release|Win32.ActiveCfg = Release|Any CPU
-		{6CD185D1-08E0-4729-A999-2D5B57BA8193}.Release|x86.ActiveCfg = Release|Any CPU
 		{C46F3337-0F48-4A72-84AD-8FDD1F159BB0}.Debug|Any CPU.ActiveCfg = Debug|x86
 		{C46F3337-0F48-4A72-84AD-8FDD1F159BB0}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
 		{C46F3337-0F48-4A72-84AD-8FDD1F159BB0}.Debug|Mixed Platforms.Build.0 = Debug|x86
@@ -294,18 +284,6 @@ Global
 		{DD6F4735-E8E2-4F10-AE2B-434AB3A40236}.Release|Mixed Platforms.Build.0 = Release|Any CPU
 		{DD6F4735-E8E2-4F10-AE2B-434AB3A40236}.Release|Win32.ActiveCfg = Release|Any CPU
 		{DD6F4735-E8E2-4F10-AE2B-434AB3A40236}.Release|x86.ActiveCfg = Release|Any CPU
-		{CB5BCF0A-4741-477A-94C6-49ECA782555F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{CB5BCF0A-4741-477A-94C6-49ECA782555F}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{CB5BCF0A-4741-477A-94C6-49ECA782555F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
-		{CB5BCF0A-4741-477A-94C6-49ECA782555F}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
-		{CB5BCF0A-4741-477A-94C6-49ECA782555F}.Debug|Win32.ActiveCfg = Debug|Any CPU
-		{CB5BCF0A-4741-477A-94C6-49ECA782555F}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{CB5BCF0A-4741-477A-94C6-49ECA782555F}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{CB5BCF0A-4741-477A-94C6-49ECA782555F}.Release|Any CPU.Build.0 = Release|Any CPU
-		{CB5BCF0A-4741-477A-94C6-49ECA782555F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
-		{CB5BCF0A-4741-477A-94C6-49ECA782555F}.Release|Mixed Platforms.Build.0 = Release|Any CPU
-		{CB5BCF0A-4741-477A-94C6-49ECA782555F}.Release|Win32.ActiveCfg = Release|Any CPU
-		{CB5BCF0A-4741-477A-94C6-49ECA782555F}.Release|x86.ActiveCfg = Release|Any CPU
 		{CBEDBE33-A883-4BFA-AE0A-8B3573F09BD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{CBEDBE33-A883-4BFA-AE0A-8B3573F09BD0}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{CBEDBE33-A883-4BFA-AE0A-8B3573F09BD0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
@@ -330,6 +308,42 @@ Global
 		{F2BEB8B2-0D9B-4CD9-A4BD-AE8E00903A67}.Release|Mixed Platforms.Build.0 = Release|Any CPU
 		{F2BEB8B2-0D9B-4CD9-A4BD-AE8E00903A67}.Release|Win32.ActiveCfg = Release|Any CPU
 		{F2BEB8B2-0D9B-4CD9-A4BD-AE8E00903A67}.Release|x86.ActiveCfg = Release|Any CPU
+		{CB5BCF0A-4741-477A-94C6-49ECA782555F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{CB5BCF0A-4741-477A-94C6-49ECA782555F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{CB5BCF0A-4741-477A-94C6-49ECA782555F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+		{CB5BCF0A-4741-477A-94C6-49ECA782555F}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+		{CB5BCF0A-4741-477A-94C6-49ECA782555F}.Debug|Win32.ActiveCfg = Debug|Any CPU
+		{CB5BCF0A-4741-477A-94C6-49ECA782555F}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{CB5BCF0A-4741-477A-94C6-49ECA782555F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{CB5BCF0A-4741-477A-94C6-49ECA782555F}.Release|Any CPU.Build.0 = Release|Any CPU
+		{CB5BCF0A-4741-477A-94C6-49ECA782555F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+		{CB5BCF0A-4741-477A-94C6-49ECA782555F}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+		{CB5BCF0A-4741-477A-94C6-49ECA782555F}.Release|Win32.ActiveCfg = Release|Any CPU
+		{CB5BCF0A-4741-477A-94C6-49ECA782555F}.Release|x86.ActiveCfg = Release|Any CPU
+		{0FA529D1-D0A9-4A8E-90F5-117CE80F2EDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{0FA529D1-D0A9-4A8E-90F5-117CE80F2EDE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{0FA529D1-D0A9-4A8E-90F5-117CE80F2EDE}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+		{0FA529D1-D0A9-4A8E-90F5-117CE80F2EDE}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+		{0FA529D1-D0A9-4A8E-90F5-117CE80F2EDE}.Debug|Win32.ActiveCfg = Debug|Any CPU
+		{0FA529D1-D0A9-4A8E-90F5-117CE80F2EDE}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{0FA529D1-D0A9-4A8E-90F5-117CE80F2EDE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{0FA529D1-D0A9-4A8E-90F5-117CE80F2EDE}.Release|Any CPU.Build.0 = Release|Any CPU
+		{0FA529D1-D0A9-4A8E-90F5-117CE80F2EDE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+		{0FA529D1-D0A9-4A8E-90F5-117CE80F2EDE}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+		{0FA529D1-D0A9-4A8E-90F5-117CE80F2EDE}.Release|Win32.ActiveCfg = Release|Any CPU
+		{0FA529D1-D0A9-4A8E-90F5-117CE80F2EDE}.Release|x86.ActiveCfg = Release|Any CPU
+		{6CD185D1-08E0-4729-A999-2D5B57BA8193}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{6CD185D1-08E0-4729-A999-2D5B57BA8193}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{6CD185D1-08E0-4729-A999-2D5B57BA8193}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+		{6CD185D1-08E0-4729-A999-2D5B57BA8193}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+		{6CD185D1-08E0-4729-A999-2D5B57BA8193}.Debug|Win32.ActiveCfg = Debug|Any CPU
+		{6CD185D1-08E0-4729-A999-2D5B57BA8193}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{6CD185D1-08E0-4729-A999-2D5B57BA8193}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{6CD185D1-08E0-4729-A999-2D5B57BA8193}.Release|Any CPU.Build.0 = Release|Any CPU
+		{6CD185D1-08E0-4729-A999-2D5B57BA8193}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+		{6CD185D1-08E0-4729-A999-2D5B57BA8193}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+		{6CD185D1-08E0-4729-A999-2D5B57BA8193}.Release|Win32.ActiveCfg = Release|Any CPU
+		{6CD185D1-08E0-4729-A999-2D5B57BA8193}.Release|x86.ActiveCfg = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -347,15 +361,16 @@ Global
 		{C9992B7C-313E-4C9F-A954-640D01EDFB58} = {ADBF5F67-B480-4A93-9D50-C81856FC61A9}
 		{D0B4CFAC-A368-4742-9863-68776CFA9938} = {ADBF5F67-B480-4A93-9D50-C81856FC61A9}
 		{901A8E5C-C4C6-4C3C-8E18-068D75119F5D} = {ADBF5F67-B480-4A93-9D50-C81856FC61A9}
-		{6CD185D1-08E0-4729-A999-2D5B57BA8193} = {C4C64188-4FAE-4CC3-A9E6-D9D4AF7429B6}
 		{5D6ECBCD-BE14-4DCB-BAEC-57089748B164} = {C4C64188-4FAE-4CC3-A9E6-D9D4AF7429B6}
 		{5AA48F9A-455D-4CD8-A605-A3AC38283E60} = {C4C64188-4FAE-4CC3-A9E6-D9D4AF7429B6}
 		{B07D70E7-F902-4F67-A486-B7AF27D6B813} = {C4C64188-4FAE-4CC3-A9E6-D9D4AF7429B6}
+		{6CD185D1-08E0-4729-A999-2D5B57BA8193} = {C4C64188-4FAE-4CC3-A9E6-D9D4AF7429B6}
 		{87537C92-B2C7-4E46-A6FB-02B73215C100} = {FD5F443E-CBEE-443E-821D-C47C86E09534}
 		{C4E7A34A-095C-4983-AB63-FC2D20CD6824} = {D0CC1FF4-2747-4278-A51F-BE9AA959175B}
 		{DD6F4735-E8E2-4F10-AE2B-434AB3A40236} = {D0CC1FF4-2747-4278-A51F-BE9AA959175B}
-		{CB5BCF0A-4741-477A-94C6-49ECA782555F} = {D0CC1FF4-2747-4278-A51F-BE9AA959175B}
 		{CBEDBE33-A883-4BFA-AE0A-8B3573F09BD0} = {D0CC1FF4-2747-4278-A51F-BE9AA959175B}
 		{F2BEB8B2-0D9B-4CD9-A4BD-AE8E00903A67} = {D0CC1FF4-2747-4278-A51F-BE9AA959175B}
+		{CB5BCF0A-4741-477A-94C6-49ECA782555F} = {D0CC1FF4-2747-4278-A51F-BE9AA959175B}
+		{0FA529D1-D0A9-4A8E-90F5-117CE80F2EDE} = {D0CC1FF4-2747-4278-A51F-BE9AA959175B}
 	EndGlobalSection
 EndGlobal

+ 8 - 8
CSharp/CSharp.sln.DotSettings

@@ -19,11 +19,11 @@
 	<s:String x:Key="/Default/CodeStyle/CodeCleanup/RecentlyUsedProfile/@EntryValue">tanghai</s:String>
 	<s:String x:Key="/Default/CodeStyle/CodeCleanup/SilentCleanupProfile/@EntryValue">tanghai</s:String>
 	<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_FIRST_ARG_BY_PAREN/@EntryValue">True</s:Boolean>
-	<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_EXPRESSION/@EntryValue">False</s:Boolean>
-	<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_PARAMETER/@EntryValue">False</s:Boolean>
-	<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTLINE_TYPE_PARAMETER_CONSTRAINS/@EntryValue">False</s:Boolean>
-	<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ANONYMOUS_METHOD_DECLARATION_BRACES/@EntryValue">NEXT_LINE</s:String>
-	<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/CASE_BLOCK_BRACES/@EntryValue">NEXT_LINE</s:String>
+	
+	
+	
+	
+	
 	<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/CONTINUOUS_INDENT_MULTIPLIER/@EntryValue">2</s:Int64>
 	<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_ATTRIBUTE_STYLE/@EntryValue">JOIN</s:String>
 	<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_FIXED_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
@@ -32,9 +32,9 @@
 	<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_IFELSE_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
 	<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_USING_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
 	<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_WHILE_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
-	<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_NESTED_FIXED_STMT/@EntryValue">False</s:Boolean>
-	<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_NESTED_USINGS_STMT/@EntryValue">False</s:Boolean>
-	<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INITIALIZER_BRACES/@EntryValue">NEXT_LINE</s:String>
+	
+	
+	
 	<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_CODE/@EntryValue">1</s:Int64>
 	<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue">1</s:Int64>
 	<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_USER_LINEBREAKS/@EntryValue">False</s:Boolean>

+ 3 - 0
CSharp/Config/GlobalConfig/1.json

@@ -0,0 +1,3 @@
+{ 
+	"Type" : 1 
+}

+ 5 - 1
CSharp/Game/BehaviorTree/BehaviorTree.csproj

@@ -18,7 +18,7 @@
     <DebugSymbols>true</DebugSymbols>
     <DebugType>full</DebugType>
     <Optimize>false</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
+    <OutputPath>..\..\Bin\</OutputPath>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
@@ -63,6 +63,10 @@
     <None Include="Packages.config" />
   </ItemGroup>
   <ItemGroup>
+    <ProjectReference Include="..\Component\Component.csproj">
+      <Project>{0fa529d1-d0a9-4a8e-90f5-117ce80f2ede}</Project>
+      <Name>Component</Name>
+    </ProjectReference>
     <ProjectReference Include="..\World\World.csproj">
       <Project>{cbedbe33-a883-4bfa-ae0a-8b3573f09bd0}</Project>
       <Name>World</Name>

+ 1 - 1
CSharp/Game/BehaviorTree/BlackBoard.cs

@@ -1,4 +1,4 @@
-using World;
+using Component;
 
 namespace BehaviorTree
 {

+ 5 - 1
CSharp/Game/BehaviorTreeTest/BehaviorTreeTest.csproj

@@ -21,7 +21,7 @@
     <DebugSymbols>true</DebugSymbols>
     <DebugType>full</DebugType>
     <Optimize>false</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
+    <OutputPath>..\..\Bin\</OutputPath>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
@@ -63,6 +63,10 @@
       <Project>{c4e7a34a-095c-4983-ab63-fc2d20cd6824}</Project>
       <Name>BehaviorTree</Name>
     </ProjectReference>
+    <ProjectReference Include="..\Component\Component.csproj">
+      <Project>{0fa529d1-d0a9-4a8e-90f5-117ce80f2ede}</Project>
+      <Name>Component</Name>
+    </ProjectReference>
     <ProjectReference Include="..\World\World.csproj">
       <Project>{cbedbe33-a883-4bfa-ae0a-8b3573f09bd0}</Project>
       <Name>World</Name>

+ 1 - 1
CSharp/Game/World/Buff.cs → CSharp/Game/Component/Buff.cs

@@ -1,5 +1,5 @@
 
-namespace World
+namespace Component
 {
 	public class Buff: Object
 	{

+ 1 - 1
CSharp/Game/World/BuffManager.cs → CSharp/Game/Component/BuffManager.cs

@@ -3,7 +3,7 @@ using System.ComponentModel;
 using MongoDB.Bson;
 using MongoDB.Bson.Serialization.Attributes;
 
-namespace World
+namespace Component
 {
 	public class BuffManager: ISupportInitialize
 	{

+ 83 - 0
CSharp/Game/Component/Component.csproj

@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{0FA529D1-D0A9-4A8E-90F5-117CE80F2EDE}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>Component</RootNamespace>
+    <AssemblyName>Component</AssemblyName>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+    <RestorePackages>true</RestorePackages>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>..\..\Bin\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="MongoDB.Bson">
+      <HintPath>..\..\packages\mongocsharpdriver.1.8.3\lib\net35\MongoDB.Bson.dll</HintPath>
+    </Reference>
+    <Reference Include="MongoDB.Driver">
+      <HintPath>..\..\packages\mongocsharpdriver.1.8.3\lib\net35\MongoDB.Driver.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Buff.cs" />
+    <Compile Include="BuffManager.cs" />
+    <Compile Include="ConfigAttribute.cs" />
+    <Compile Include="ConfigManager.cs" />
+    <Compile Include="HandlerAttribute.cs" />
+    <Compile Include="IConfigInitialize.cs" />
+    <Compile Include="IHandler.cs" />
+    <Compile Include="ILogicEntry.cs" />
+    <Compile Include="IType.cs" />
+    <Compile Include="MessageEnv.cs" />
+    <Compile Include="Object.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="packages.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\Platform\Helper\Helper.csproj">
+      <Project>{24233cd5-a5df-484b-a482-b79cb7a0d9cb}</Project>
+      <Name>Helper</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <Folder Include="Properties\" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 15 - 0
CSharp/Game/Component/ConfigAttribute.cs

@@ -0,0 +1,15 @@
+using System;
+
+namespace Component
+{
+	[AttributeUsage(AttributeTargets.Class)]
+	public class ConfigAttribute: Attribute
+	{
+		public string RelativeDirectory { get; set; }
+
+		public ConfigAttribute(string relativeDirectory = @"..\Config")
+		{
+			this.RelativeDirectory = relativeDirectory;
+		}
+	}
+}

+ 58 - 0
CSharp/Game/Component/ConfigManager.cs

@@ -0,0 +1,58 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.IO;
+using Helper;
+
+namespace Component
+{
+	public abstract class ConfigManager<T> : ISupportInitialize, IConfigInitialize where T : IType
+	{
+		protected readonly Dictionary<int, T> dict = new Dictionary<int, T>();
+
+		public T this[int type]
+		{
+			get
+			{
+				return dict[type];
+			}
+		}
+
+		public string ConfigName
+		{
+			get
+			{
+				return typeof (T).Name;
+			}
+		}
+
+		public Dictionary<int, T> GetAll()
+		{
+			return this.dict;
+		}
+
+		public void Init(string configsDir)
+		{
+			string path = Path.Combine(configsDir, this.ConfigName);
+
+			if (!Directory.Exists(path))
+			{
+				throw new Exception(string.Format("not found config path: {0}", path));
+			}
+
+			foreach (var file in Directory.GetFiles(path))
+			{
+				var t = MongoHelper.FromJson<T>(File.ReadAllText(file));
+				this.dict.Add(t.Type, t);
+			}
+		}
+
+		public void BeginInit()
+		{
+		}
+
+		public void EndInit()
+		{
+		}
+	}
+}

+ 1 - 1
CSharp/Game/World/HandlerAttribute.cs → CSharp/Game/Component/HandlerAttribute.cs

@@ -1,6 +1,6 @@
 using System;
 
-namespace Handler
+namespace Logic
 {
 	[AttributeUsage(AttributeTargets.Class)]
 	public class HandlerAttribute : Attribute

+ 2 - 1
CSharp/Game/World/IConfigInitialize.cs → CSharp/Game/Component/IConfigInitialize.cs

@@ -1,8 +1,9 @@
 
-namespace World
+namespace Component
 {
 	public interface IConfigInitialize
 	{
+		string ConfigName { get; }
 		void Init(string dir);
 	}
 }

+ 2 - 2
CSharp/Game/World/IHandle.cs → CSharp/Game/Component/IHandler.cs

@@ -1,6 +1,6 @@
-namespace World
+namespace Component
 {
-	public interface IHandle
+	public interface IHandler
 	{
 		void Handle(MessageEnv messageEnv, byte[] content);
 	}

+ 8 - 0
CSharp/Game/Component/ILogicEntry.cs

@@ -0,0 +1,8 @@
+
+namespace Component
+{
+	public interface ILogicEntry
+	{
+		void Enter(MessageEnv messageEnv, short opcode, byte[] content);
+	}
+}

+ 1 - 1
CSharp/Game/World/IType.cs → CSharp/Game/Component/IType.cs

@@ -1,4 +1,4 @@
-namespace World
+namespace Component
 {
 	public interface IType
 	{

+ 1 - 1
CSharp/Game/World/MessageEnv.cs → CSharp/Game/Component/MessageEnv.cs

@@ -1,5 +1,5 @@
 
-namespace World
+namespace Component
 {
 	public class MessageEnv: Object
 	{

+ 16 - 1
CSharp/Game/World/Object.cs → CSharp/Game/Component/Object.cs

@@ -1,7 +1,7 @@
 using System.Collections.Generic;
 using MongoDB.Bson;
 
-namespace World
+namespace Component
 {
 	public class Object
 	{
@@ -36,6 +36,21 @@ namespace World
 			return (T)this.Dict[key];
 		}
 
+		public T Get<T>()
+		{
+			return this.Get<T>(typeof(T).Name);
+		}
+
+		public void Set(string key, object obj)
+		{
+			this.Dict[key] = obj;
+		}
+
+		public void Set<T>(T obj)
+		{
+			this.Dict[typeof(T).Name] = obj;
+		}
+
 		public bool Contain(string key)
 		{
 			return this.Dict.ContainsKey(key);

+ 4 - 0
CSharp/Game/Component/packages.config

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="mongocsharpdriver" version="1.8.3" targetFramework="net45" />
+</packages>

+ 0 - 14
CSharp/Game/Handler/ChatHandler.cs

@@ -1,14 +0,0 @@
-using Log;
-using World;
-
-namespace Handler
-{
-	[HandlerAttribute(1)]
-	class ChatHandler: IHandle
-	{
-		public void Handle(MessageEnv messageEnv, byte[] content)
-		{
-			Logger.Debug("111111111111111111111111");
-		}
-	}
-}

+ 18 - 0
CSharp/Game/Logic/Handler/ChatHandler.cs

@@ -0,0 +1,18 @@
+using Component.Config;
+using Helper;
+using Log;
+using Component;
+
+namespace Logic
+{
+	[HandlerAttribute(3)]
+	class ChatHandler: IHandler
+	{
+		public void Handle(MessageEnv messageEnv, byte[] content)
+		{
+			var world = messageEnv.Get<World.World>();
+			var globalConfig = world.Config.Get<GlobalConfig>(1);
+			Logger.Debug(MongoHelper.ToJson(globalConfig));
+		}
+	}
+}

+ 24 - 0
CSharp/Game/Logic/Handler/ReloadHandler.cs

@@ -0,0 +1,24 @@
+using Component;
+
+namespace Logic
+{
+	[HandlerAttribute(1)]
+	class ReloadHandlerHandler : IHandler
+	{
+		public void Handle(MessageEnv messageEnv, byte[] content)
+		{
+			var world = messageEnv.Get<World.World>();
+			world.ReloadLogic();
+		}
+	}
+
+	[HandlerAttribute(2)]
+	class ReloadConfigHandler: IHandler
+	{
+		public void Handle(MessageEnv messageEnv, byte[] content)
+		{
+			var world = messageEnv.Get<World.World>();
+			world.ReloadConfig();
+		}
+	}
+}

+ 16 - 5
CSharp/Game/Handler/Handler.csproj → CSharp/Game/Logic/Logic.csproj

@@ -7,8 +7,8 @@
     <ProjectGuid>{CB5BCF0A-4741-477A-94C6-49ECA782555F}</ProjectGuid>
     <OutputType>Library</OutputType>
     <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>Handler</RootNamespace>
-    <AssemblyName>Handler</AssemblyName>
+    <RootNamespace>Logic</RootNamespace>
+    <AssemblyName>Logic</AssemblyName>
     <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
   </PropertyGroup>
@@ -39,20 +39,31 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="ChatHandler.cs" />
-    <Compile Include="Dispatcher.cs" />
-    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Handler\ChatHandler.cs" />
+    <Compile Include="LogicEntry.cs" />
+    <Compile Include="Handler\ReloadHandler.cs" />
   </ItemGroup>
   <ItemGroup>
+    <ProjectReference Include="..\..\Platform\Helper\Helper.csproj">
+      <Project>{24233cd5-a5df-484b-a482-b79cb7a0d9cb}</Project>
+      <Name>Helper</Name>
+    </ProjectReference>
     <ProjectReference Include="..\..\Platform\Log\Log.csproj">
       <Project>{72e16572-fc1f-4a9e-bc96-035417239298}</Project>
       <Name>Log</Name>
     </ProjectReference>
+    <ProjectReference Include="..\Component\Component.csproj">
+      <Project>{0fa529d1-d0a9-4a8e-90f5-117ce80f2ede}</Project>
+      <Name>Component</Name>
+    </ProjectReference>
     <ProjectReference Include="..\World\World.csproj">
       <Project>{cbedbe33-a883-4bfa-ae0a-8b3573f09bd0}</Project>
       <Name>World</Name>
     </ProjectReference>
   </ItemGroup>
+  <ItemGroup>
+    <Folder Include="Properties\" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.

+ 11 - 10
CSharp/Game/Handler/Dispatcher.cs → CSharp/Game/Logic/LogicEntry.cs

@@ -1,16 +1,16 @@
 using System;
 using System.Collections.Generic;
-using World;
+using Component;
 
-namespace Handler
+namespace Logic
 {
-	public class Dispatcher : IDispatcher
+	public class LogicEntry : ILogicEntry
     {
-	    private readonly Dictionary<short, IHandle> handlers = new Dictionary<short, IHandle>();
+	    private readonly Dictionary<short, IHandler> handlers = new Dictionary<short, IHandler>();
 
-		public Dispatcher()
+		public LogicEntry()
 		{
-			Type[] types = typeof (Dispatcher).Assembly.GetTypes();
+			Type[] types = typeof (LogicEntry).Assembly.GetTypes();
 			foreach (var type in types)
 			{
 				object[] attrs = type.GetCustomAttributes(typeof(HandlerAttribute), false);
@@ -18,19 +18,20 @@ namespace Handler
 				{
 					continue;
 				}
-				var handler = (IHandle)Activator.CreateInstance(type);
+				var handler = (IHandler)Activator.CreateInstance(type);
 				short opcode = ((HandlerAttribute)attrs[0]).Opcode;
 				if (handlers.ContainsKey(opcode))
 				{
-					throw new Exception(string.Format("same opcode {0}", opcode));
+					throw new Exception(string.Format(
+						"same opcode, opcode: {0}, name: {1}", opcode, type.Name));
 				}
 				handlers[opcode] = handler;
 			}
 		}
 
-	    public void Dispatch(MessageEnv messageEnv, short opcode, byte[] content)
+	    public void Enter(MessageEnv messageEnv, short opcode, byte[] content)
 	    {
-		    IHandle handler = null;
+		    IHandler handler = null;
 			if (!handlers.TryGetValue(opcode, out handler))
 			{
 				throw new Exception(string.Format("not found handler opcode {0}", opcode));

+ 0 - 56
CSharp/Game/World/AllConfigManager.cs

@@ -1,56 +0,0 @@
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.IO;
-
-namespace World
-{
-	public class AllConfigManager
-	{
-		public readonly Dictionary<string, object> allConfig = new Dictionary<string, object>();
-
-		public AllConfigManager(string path)
-		{
-			foreach (var dir in Directory.GetDirectories(path))
-			{
-				// 配置目录名与类名一致
-				string baseName = new DirectoryInfo(dir).Name;
-				var assembly = typeof (AllConfigManager).Assembly;
-				object obj = assembly.CreateInstance(baseName);
-
-				var iSupportInitialize = obj as ISupportInitialize;
-				if (iSupportInitialize != null)
-				{
-					iSupportInitialize.BeginInit();
-				}
-
-				var iInit = obj as IConfigInitialize;
-				if (iInit != null)
-				{
-					iInit.Init(dir);
-				}
-
-				if (iSupportInitialize != null)
-				{
-					iSupportInitialize.EndInit();
-				}
-			}
-		}
- 
-		public T Get<T>(int type) where T : IType
-		{
-			var configManager = (ConfigManager<T>)allConfig[typeof (T).Name];
-			return configManager[type];
-		}
-
-		public Dictionary<int, T> GetAll<T>() where T : IType
-		{
-			var configManager = (ConfigManager<T>)allConfig[typeof (T).Name];
-			return configManager.GetAll();
-		}
-
-		public ConfigManager<T> GetConfigManager<T>() where T : IType
-		{
-			return (ConfigManager<T>)allConfig[typeof(T).Name];
-		}
-	}
-}

+ 96 - 0
CSharp/Game/World/Config.cs

@@ -0,0 +1,96 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.IO;
+using Component;
+
+namespace World
+{
+	public class Config
+	{
+		private static readonly Config instance = new Config();
+
+		public static Config Instance
+		{
+			get
+			{
+				return instance;
+			}
+		}
+
+		public Dictionary<string, object> allConfig;
+
+		private Config()
+		{
+			this.Load();
+		}
+
+		private void Load()
+		{
+			this.allConfig = new Dictionary<string, object>();
+			string currentDir = AppDomain.CurrentDomain.BaseDirectory;
+			Type[] types = typeof(Config).Assembly.GetTypes();
+			foreach (var type in types)
+			{
+				object[] attrs = type.GetCustomAttributes(typeof(ConfigAttribute), false);
+				if (attrs.Length == 0)
+				{
+					continue;
+				}
+
+				object obj = (Activator.CreateInstance(type));
+
+				var iInit = obj as IConfigInitialize;
+				if (iInit == null)
+				{
+					throw new Exception(string.Format("class {0} is not IConfigInitialize", type.Name));
+				}
+
+				var iSupportInitialize = obj as ISupportInitialize;
+				if (iSupportInitialize != null)
+				{
+					iSupportInitialize.BeginInit();
+				}
+
+				string configDir = Path.Combine(
+					currentDir, ((ConfigAttribute)attrs[0]).RelativeDirectory);
+
+				if (!Directory.Exists(configDir))
+				{
+					throw new Exception(string.Format("not found config dir: {0}", configDir));
+				}
+				iInit.Init(configDir);
+
+
+				if (iSupportInitialize != null)
+				{
+					iSupportInitialize.EndInit();
+				}
+
+				allConfig[iInit.ConfigName] = obj;
+			}
+		}
+
+		public void Reload()
+		{
+			this.Load();
+		}
+ 
+		public T Get<T>(int type) where T : IType
+		{
+			var configManager = (ConfigManager<T>)allConfig[typeof (T).Name];
+			return configManager[type];
+		}
+
+		public Dictionary<int, T> GetAll<T>() where T : IType
+		{
+			var configManager = (ConfigManager<T>)allConfig[typeof (T).Name];
+			return configManager.GetAll();
+		}
+
+		public ConfigManager<T> GetConfigManager<T>() where T : IType
+		{
+			return (ConfigManager<T>)allConfig[typeof(T).Name];
+		}
+	}
+}

+ 13 - 0
CSharp/Game/World/Config/GlobalConfig.cs

@@ -0,0 +1,13 @@
+
+namespace Component.Config
+{
+	public class GlobalConfig: IType
+	{
+		public int Type { get; set; }
+	}
+
+	[ConfigAttribute]
+	public class GlobalManager: ConfigManager<GlobalConfig>
+	{
+	}
+}

+ 0 - 42
CSharp/Game/World/ConfigManager.cs

@@ -1,42 +0,0 @@
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.IO;
-using Helper;
-
-namespace World
-{
-	public class ConfigManager<T> : ISupportInitialize, IConfigInitialize where T : IType
-	{
-		protected readonly Dictionary<int, T> dict = new Dictionary<int, T>();
-
-		public T this[int type]
-		{
-			get
-			{
-				return dict[type];
-			}
-		}
-
-		public Dictionary<int, T> GetAll()
-		{
-			return this.dict;
-		}
-
-		public void Init(string dir)
-		{
-			foreach (var file in Directory.GetFiles(dir))
-			{
-				var t = MongoHelper.FromJson<T>(File.ReadAllText(file));
-				this.dict.Add(t.Type, t);
-			}
-		}
-
-		public void BeginInit()
-		{
-		}
-
-		public void EndInit()
-		{
-		}
-	}
-}

+ 0 - 8
CSharp/Game/World/IDispatcher.cs

@@ -1,8 +0,0 @@
-
-namespace World
-{
-	public interface IDispatcher
-	{
-		void Dispatch(MessageEnv messageEnv, short opcode, byte[] content);
-	}
-}

+ 36 - 11
CSharp/Game/World/World.cs

@@ -1,6 +1,8 @@
 using System;
 using System.IO;
+using Component;
 using Helper;
+using Log;
 
 namespace World
 {
@@ -8,22 +10,25 @@ namespace World
 	{
 		private static readonly World instance = new World();
 
-		private IDispatcher dispatcher;
+		private ILogicEntry iLogicEntry;
+
+		private readonly Config config;
 
 		private World()
 		{
-			this.Load();
+			this.config = Config.Instance;
+			this.LoadLogic();
 		}
 
-		private void Load()
+		private void LoadLogic()
 		{
-			string dllPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Handler.dll");
+			string dllPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Logic.dll");
 			if (!File.Exists(dllPath))
 			{
-				throw new Exception("not found handler dll!");
+				throw new Exception(string.Format("not found logic dll, path: {0}", dllPath));
 			}
 			var assembly = LoaderHelper.Load(dllPath);
-			this.dispatcher = (IDispatcher)assembly.CreateInstance("Handler.Dispatcher");
+			this.iLogicEntry = (ILogicEntry)assembly.CreateInstance("Logic.LogicEntry");
 		}
 
 		public static World Instance
@@ -34,16 +39,36 @@ namespace World
 			}
 		}
 
-		public void Reload()
+		public void ReloadLogic()
+		{
+			this.LoadLogic();
+		}
+
+		public void ReloadConfig()
 		{
-			this.Load();
+			this.config.Reload();
 		}
 
 		public void Dispatcher(short opcode, byte[] content)
 		{
-			var messageEnv = new MessageEnv();
-			messageEnv["world"] = this;
-			this.dispatcher.Dispatch(messageEnv, opcode, content);
+			try
+			{
+				var messageEnv = new MessageEnv();
+				messageEnv.Set(this);
+				this.iLogicEntry.Enter(messageEnv, opcode, content);
+			}
+			catch (Exception e)
+			{
+				Logger.Trace("message handle error: {0}", e.Message);
+			}
+		}
+
+		public Config Config
+		{
+			get
+			{
+				return this.config;
+			}
 		}
 	}
 }

+ 6 - 11
CSharp/Game/World/World.csproj

@@ -50,17 +50,8 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="AllConfigManager.cs" />
-    <Compile Include="Buff.cs" />
-    <Compile Include="BuffManager.cs" />
-    <Compile Include="ConfigManager.cs" />
-    <Compile Include="HandlerAttribute.cs" />
-    <Compile Include="IConfigInitialize.cs" />
-    <Compile Include="IDispatcher.cs" />
-    <Compile Include="IHandle.cs" />
-    <Compile Include="IType.cs" />
-    <Compile Include="MessageEnv.cs" />
-    <Compile Include="Object.cs" />
+    <Compile Include="Config.cs" />
+    <Compile Include="Config\GlobalConfig.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="World.cs" />
   </ItemGroup>
@@ -73,6 +64,10 @@
       <Project>{72e16572-fc1f-4a9e-bc96-035417239298}</Project>
       <Name>Log</Name>
     </ProjectReference>
+    <ProjectReference Include="..\Component\Component.csproj">
+      <Project>{0fa529d1-d0a9-4a8e-90f5-117ce80f2ede}</Project>
+      <Name>Component</Name>
+    </ProjectReference>
   </ItemGroup>
   <ItemGroup>
     <None Include="Packages.config" />

+ 1 - 1
CSharp/Game/WorldTest/BuffManagerTest.cs

@@ -1,4 +1,4 @@
-using World;
+using Component;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 
 namespace WorldTest

+ 1 - 1
CSharp/Game/WorldTest/ObjectTest.cs

@@ -1,7 +1,7 @@
 using System;
 using Helper;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Object = World.Object;
+using Object = Component.Object;
 
 namespace ObjectTest
 {

+ 3 - 3
CSharp/Game/WorldTest/WorldTest.cs

@@ -11,13 +11,13 @@ namespace WorldTest
 		public void TestReload()
 		{
 			var world = World.World.Instance;
-			world.Dispatcher(1, "tanghai".ToByteArray());
+			world.Dispatcher(3, "tanghai".ToByteArray());
 			int count = 10;
 			while (--count != 0)
 			{
 				world.Dispatcher(1, "tanghai".ToByteArray());
-				Thread.Sleep(10000);
-				world.Reload();
+				Thread.Sleep(1);
+				world.ReloadLogic();
 			}
 		}
 	}

+ 4 - 0
CSharp/Game/WorldTest/WorldTest.csproj

@@ -74,6 +74,10 @@
       <Project>{72e16572-fc1f-4a9e-bc96-035417239298}</Project>
       <Name>Log</Name>
     </ProjectReference>
+    <ProjectReference Include="..\Component\Component.csproj">
+      <Project>{0fa529d1-d0a9-4a8e-90f5-117ce80f2ede}</Project>
+      <Name>Component</Name>
+    </ProjectReference>
     <ProjectReference Include="..\World\World.csproj">
       <Project>{cbedbe33-a883-4bfa-ae0a-8b3573f09bd0}</Project>
       <Name>World</Name>