tanghai 11 лет назад
Родитель
Сommit
a2e15bdbc8

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

@@ -12,7 +12,9 @@ namespace Editor
         protected override void ConfigureAggregateCatalog()
         {
             this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof (Bootstrapper).Assembly));
-            this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof (ViewExportAttribute).Assembly));
+            this.AggregateCatalog.Catalogs.Add(
+                                               new AssemblyCatalog(
+                                                       typeof (ViewExportAttribute).Assembly));
             this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof (TreeModule).Assembly));
         }
 

+ 5 - 5
CSharp/App/Modules/Tree/AllTreeView.xaml

@@ -17,12 +17,12 @@
 	</Menu>
 	<Grid>
 		<Grid.RowDefinitions>
-			<RowDefinition></RowDefinition>
-			<RowDefinition></RowDefinition>
+			<RowDefinition/>
+			<RowDefinition/>
 		</Grid.RowDefinitions>
 		<Grid.ColumnDefinitions>
 			<ColumnDefinition Width="230"/>
-			<ColumnDefinition Width="Auto"></ColumnDefinition>
+			<ColumnDefinition Width="Auto"/>
 			<ColumnDefinition />
 		</Grid.ColumnDefinitions>
 		<GroupBox Grid.Row="0" Grid.Column="0" Header="行为树列表:">
@@ -37,8 +37,8 @@
 					<DataTemplate DataType="Tree:TreeNodeViewModel">
 						<StackPanel MouseLeftButtonDown="ListBoxItem_OnMouseLeftButtonDown" MouseLeftButtonUp="ListBoxItem_OnMouseLeftButtonUp" 
 									Orientation="Horizontal" Margin="1,0">
-							<Label Content="{Binding TreeId}" VerticalAlignment="Stretch" Width="20" ></Label>
-							<Label Content="{Binding Comment}" VerticalAlignment="Stretch" Width="150"></Label>
+							<Label Content="{Binding TreeId}" VerticalAlignment="Stretch" Width="20"/>
+							<Label Content="{Binding Comment}" VerticalAlignment="Stretch" Width="150"/>
 						</StackPanel>
 					</DataTemplate>
 				</ListBox.ItemTemplate>

+ 2 - 2
CSharp/App/Modules/Tree/AllTreeView.xaml.cs

@@ -68,7 +68,7 @@ namespace Modules.Tree
 
         private void ListBoxItem_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
         {
-            var item = (FrameworkElement)sender;
+            var item = (FrameworkElement) sender;
             var treeNodeViewModel = item.DataContext as TreeNodeViewModel;
             if (this.treeView.ViewModel != null)
             {
@@ -82,7 +82,7 @@ namespace Modules.Tree
 
         private void ListBoxItem_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
         {
-            var item = (FrameworkElement)sender;
+            var item = (FrameworkElement) sender;
             var treeNodeViewModel = item.DataContext as TreeNodeViewModel;
 
             this.lbTreeRoots.SelectedItem = treeNodeViewModel;

+ 11 - 11
CSharp/App/Modules/Tree/AllTreeViewModel.cs

@@ -12,10 +12,12 @@ namespace Modules.Tree
     {
         public int MaxNodeId { get; set; }
         public int MaxTreeId { get; set; }
-        
-        private readonly Dictionary<int, TreeViewModel> treeViewModelsDict = new Dictionary<int, TreeViewModel>();
 
-        public ObservableCollection<TreeNodeViewModel> rootList = new ObservableCollection<TreeNodeViewModel>();
+        private readonly Dictionary<int, TreeViewModel> treeViewModelsDict =
+                new Dictionary<int, TreeViewModel>();
+
+        public ObservableCollection<TreeNodeViewModel> rootList =
+                new ObservableCollection<TreeNodeViewModel>();
 
         public ObservableCollection<TreeNodeViewModel> RootList
         {
@@ -28,7 +30,7 @@ namespace Modules.Tree
         public void Open(string file)
         {
             this.rootList.Clear();
-            treeViewModelsDict.Clear();
+            this.treeViewModelsDict.Clear();
 
             var treeDict = new Dictionary<int, List<TreeNodeData>>();
 
@@ -64,16 +66,15 @@ namespace Modules.Tree
                     AllTreeViewModel = this,
                     TreeId = pair.Key
                 };
-                treeViewModelsDict[pair.Key] = treeViewModel;
+                this.treeViewModelsDict[pair.Key] = treeViewModel;
                 this.RootList.Add(treeViewModel.Root);
             }
         }
 
         public void Save(string file)
         {
-
             AllTreeData allTreeData = new AllTreeData();
-            foreach (var value in treeViewModelsDict.Values)
+            foreach (var value in this.treeViewModelsDict.Values)
             {
                 List<TreeNodeData> list = value.GetDatas();
                 allTreeData.TreeNodeDatas.AddRange(list);
@@ -92,20 +93,19 @@ namespace Modules.Tree
 
         public void Add(TreeViewModel treeViewModel)
         {
-            treeViewModelsDict[treeViewModel.TreeId] = treeViewModel;
+            this.treeViewModelsDict[treeViewModel.TreeId] = treeViewModel;
             this.rootList.Add(treeViewModel.Root);
         }
 
         public void Remove(TreeNodeViewModel treeViewModel)
         {
-            treeViewModelsDict.Remove(treeViewModel.TreeId);
-            rootList.Remove(treeViewModel);
+            this.treeViewModelsDict.Remove(treeViewModel.TreeId);
+            this.rootList.Remove(treeViewModel);
         }
 
         public TreeViewModel Get(int treeId)
         {
             return this.treeViewModelsDict[treeId];
         }
-
     }
 }

+ 1 - 2
CSharp/App/Modules/Tree/OneTreeData.cs

@@ -1,5 +1,4 @@
-
-namespace Modules.Tree
+namespace Modules.Tree
 {
     public class OneTreeData
     {

+ 3 - 4
CSharp/App/Modules/Tree/TreeInfoViewModel.cs

@@ -1,10 +1,9 @@
-
-namespace Modules.Tree
+namespace Modules.Tree
 {
     public class TreeInfoViewModel
     {
-        private int id;
-        private string comment;
+        private readonly int id;
+        private readonly string comment;
 
         public TreeInfoViewModel(int id, string comment)
         {

+ 22 - 20
CSharp/App/Modules/Tree/TreeLayout.cs

@@ -26,7 +26,7 @@
             {
                 var child = this.treeViewModel.Get(treeNodeViewModel.Children[i]);
                 child.AncestorModify = treeNodeViewModel.Modify + treeNodeViewModel.AncestorModify;
-                var offspring = LeftMostOffspring(child, currentLevel + 1, searchLevel);
+                var offspring = this.LeftMostOffspring(child, currentLevel + 1, searchLevel);
                 if (offspring == null)
                 {
                     continue;
@@ -47,7 +47,7 @@
             {
                 var child = this.treeViewModel.Get(treeNodeViewModel.Children[i]);
                 child.AncestorModify = treeNodeViewModel.Modify + treeNodeViewModel.AncestorModify;
-                var offspring = RightMostOffspring(child, currentLevel + 1, searchLevel);
+                var offspring = this.RightMostOffspring(child, currentLevel + 1, searchLevel);
                 if (offspring == null)
                 {
                     continue;
@@ -72,8 +72,8 @@
                 {
                     offset = XGap + TreeNodeViewModel.Width - tGap;
                 }
-                tLeft = RightMostOffspring(left, 0, i + 1);
-                tRight = LeftMostOffspring(right, 0, i + 1);
+                tLeft = this.RightMostOffspring(left, 0, i + 1);
+                tRight = this.LeftMostOffspring(right, 0, i + 1);
             }
             right.Modify += offset;
             right.Prelim += offset;
@@ -87,7 +87,7 @@
                 {
                     var left = this.treeViewModel.Get(treeNodeViewModel.Children[i]);
                     var right = this.treeViewModel.Get(treeNodeViewModel.Children[j]);
-                    AjustSubTreeGap(left, right);
+                    this.AjustSubTreeGap(left, right);
                 }
             }
         }
@@ -97,7 +97,7 @@
             foreach (int childId in treeNodeViewModel.Children)
             {
                 TreeNodeViewModel child = this.treeViewModel.Get(childId);
-                CalculatePrelimAndModify(child);
+                this.CalculatePrelimAndModify(child);
             }
 
             double prelim = 0;
@@ -118,8 +118,9 @@
             else
             {
                 // 调整子树间的间距
-                AjustTreeGap(treeNodeViewModel);
-                double childrenCenter = (treeNodeViewModel.FirstChild.Prelim + treeNodeViewModel.LastChild.Prelim) / 2;
+                this.AjustTreeGap(treeNodeViewModel);
+                double childrenCenter = (treeNodeViewModel.FirstChild.Prelim +
+                                         treeNodeViewModel.LastChild.Prelim) / 2;
                 if (treeNodeViewModel.LeftSibling == null)
                 {
                     // 如果没有左邻居,不需要设置modify
@@ -144,7 +145,7 @@
             foreach (int childId in treeNodeViewModel.Children)
             {
                 TreeNodeViewModel child = this.treeViewModel.Get(childId);
-                CalculateRelativeXAndY(child, level + 1, treeNodeViewModel.Modify + totalModify);
+                this.CalculateRelativeXAndY(child, level + 1, treeNodeViewModel.Modify + totalModify);
             }
             if (treeNodeViewModel.IsLeaf)
             {
@@ -152,19 +153,20 @@
             }
             else
             {
-                treeNodeViewModel.X = (treeNodeViewModel.FirstChild.X + treeNodeViewModel.LastChild.X) / 2;
+                treeNodeViewModel.X = (treeNodeViewModel.FirstChild.X +
+                                       treeNodeViewModel.LastChild.X) / 2;
             }
             treeNodeViewModel.Y = level * (TreeNodeViewModel.Height + YGap);
         }
 
         private void FixXAndY(TreeNodeViewModel treeNode)
         {
-            treeNode.X += rootOffsetX;
-            treeNode.Y += rootOffsetY;
+            treeNode.X += this.rootOffsetX;
+            treeNode.Y += this.rootOffsetY;
             foreach (var childId in treeNode.Children)
             {
                 TreeNodeViewModel child = this.treeViewModel.Get(childId);
-                FixXAndY(child);
+                this.FixXAndY(child);
             }
         }
 
@@ -174,14 +176,14 @@
             {
                 return;
             }
-            rootOrigX = root.X;
-            rootOrigY = root.Y;
-            CalculatePrelimAndModify(root);
-            CalculateRelativeXAndY(root, 0, 0);
+            this.rootOrigX = root.X;
+            this.rootOrigY = root.Y;
+            this.CalculatePrelimAndModify(root);
+            this.CalculateRelativeXAndY(root, 0, 0);
 
-            rootOffsetX = rootOrigX - root.X;
-            rootOffsetY = rootOrigY - root.Y;
-            FixXAndY(root);
+            this.rootOffsetX = this.rootOrigX - root.X;
+            this.rootOffsetY = this.rootOrigY - root.Y;
+            this.FixXAndY(root);
         }
     }
 }

+ 1 - 2
CSharp/App/Modules/Tree/TreeView.xaml

@@ -63,8 +63,7 @@
 							PreviewMouseLeftButtonDown="ListBoxItem_PreviewMouseLeftButtonDown"
 							PreviewMouseLeftButtonUp="ListBoxItem_PreviewMouseLeftButtonUp">
 						<Rectangle Name="rectNode" Width="{Binding Width}" Height="{Binding Height}" Cursor="Hand" StrokeThickness="2"
-								RadiusX="10" RadiusY="10" Stroke="{StaticResource treeNodeBorderBrush}" Fill="{StaticResource treeNodeSelectorFillBrush}">
-						</Rectangle>
+								RadiusX="10" RadiusY="10" Stroke="{StaticResource treeNodeBorderBrush}" Fill="{StaticResource treeNodeSelectorFillBrush}"/>
 						<Label Content="+" Visibility="{Binding IsFold, Converter={StaticResource FolderVisiableConverter}}" Canvas.Left="60" Canvas.Top="10"/>
 						<StackPanel>
 							<Label Content="{Binding Type, Converter={StaticResource NodeTypeToStringConverter}}"/>

+ 7 - 7
CSharp/App/Modules/Tree/TreeView.xaml.cs

@@ -57,7 +57,7 @@ namespace Modules.Tree
                 return;
             }
 
-            var item = (FrameworkElement)sender;
+            var item = (FrameworkElement) sender;
             var treeNodeViewModel = item.DataContext as TreeNodeViewModel;
 
             if (!this.IsDragging)
@@ -74,7 +74,7 @@ namespace Modules.Tree
 
         private void ListBoxItem_MouseMove(object sender, MouseEventArgs e)
         {
-            var item = (FrameworkElement)sender;
+            var item = (FrameworkElement) sender;
             var treeNodeViewModel = item.DataContext as TreeNodeViewModel;
             if (treeNodeViewModel == null)
             {
@@ -119,7 +119,7 @@ namespace Modules.Tree
         private void ListBoxItem_PreviewMouseLeftButtonDown(object sender, MouseEventArgs e)
         {
             this.origMouseDownPoint = e.GetPosition(this);
-            var item = (FrameworkElement)sender;
+            var item = (FrameworkElement) sender;
             var treeNodeViewModel = item.DataContext as TreeNodeViewModel;
 
             this.listBox.SelectedItem = treeNodeViewModel;
@@ -138,7 +138,7 @@ namespace Modules.Tree
             {
                 return;
             }
-            var item = (FrameworkElement)sender;
+            var item = (FrameworkElement) sender;
             var moveToNode = item.DataContext as TreeNodeViewModel;
             Log.Debug("move to node: {0} {1}", this.moveFromNode.Id, moveToNode.Id);
             if (this.moveFromNode.Id == moveToNode.Id)
@@ -163,7 +163,7 @@ namespace Modules.Tree
             {
                 var addTreeNode = new TreeNodeViewModel(this.ViewModel, point.X, point.Y)
                 {
-                    Type = (int)NodeType.Selector
+                    Type = (int) NodeType.Selector
                 };
                 this.ViewModel.Add(addTreeNode, null);
             }
@@ -174,7 +174,7 @@ namespace Modules.Tree
                     var parentNode = this.listBox.SelectedItem as TreeNodeViewModel;
                     var addTreeNode = new TreeNodeViewModel(this.ViewModel, parentNode)
                     {
-                        Type = (int)NodeType.Selector,
+                        Type = (int) NodeType.Selector,
                     };
                     this.ViewModel.Add(addTreeNode, parentNode);
                 }
@@ -237,4 +237,4 @@ namespace Modules.Tree
             this.ViewModel.MoveRight(treeNodeViewModel);
         }
     }
-}
+}

+ 3 - 2
CSharp/App/Modules/Tree/TreeViewModel.cs

@@ -11,7 +11,8 @@ namespace Modules.Tree
         private readonly ObservableCollection<TreeNodeViewModel> treeNodes =
                 new ObservableCollection<TreeNodeViewModel>();
 
-        private readonly Dictionary<int, TreeNodeViewModel> treeNodeDict = new Dictionary<int, TreeNodeViewModel>(); 
+        private readonly Dictionary<int, TreeNodeViewModel> treeNodeDict =
+                new Dictionary<int, TreeNodeViewModel>();
 
         public ObservableCollection<TreeNodeViewModel> TreeNodes
         {
@@ -50,7 +51,7 @@ namespace Modules.Tree
         public List<TreeNodeData> GetDatas()
         {
             List<TreeNodeData> treeNodeDatas = new List<TreeNodeData>();
-            foreach (TreeNodeViewModel treeNodeViewModel in treeNodes)
+            foreach (TreeNodeViewModel treeNodeViewModel in this.treeNodes)
             {
                 treeNodeDatas.Add(treeNodeViewModel.Data);
             }

+ 2 - 2
CSharp/Game/Logic/Event/BeforeLoginWorldEvent.cs

@@ -1,5 +1,5 @@
-using Component;
-using Common.Logger;
+using Common.Logger;
+using Component;
 
 namespace Logic.Event
 {

+ 2 - 2
CSharp/Game/Logic/Event/BeforeUseItemEvent.cs

@@ -1,5 +1,5 @@
-using Component;
-using Common.Logger;
+using Common.Logger;
+using Component;
 
 namespace Logic.Event
 {

+ 3 - 3
CSharp/Game/Logic/Handler/ChatHandler.cs

@@ -1,7 +1,7 @@
-using Component;
-using Component.Config;
-using Common.Helper;
+using Common.Helper;
 using Common.Logger;
+using Component;
+using Component.Config;
 
 namespace Logic.Handler
 {

+ 5 - 2
CSharp/Platform/Common/Properties/AssemblyInfo.cs

@@ -1,10 +1,10 @@
 using System.Reflection;
-using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
 // 有关程序集的常规信息通过以下
 // 特性集控制。更改这些特性值可修改
 // 与程序集关联的信息。
+
 [assembly: AssemblyTitle("Common")]
 [assembly: AssemblyDescription("")]
 [assembly: AssemblyConfiguration("")]
@@ -17,9 +17,11 @@ using System.Runtime.InteropServices;
 // 将 ComVisible 设置为 false 使此程序集中的类型
 // 对 COM 组件不可见。  如果需要从 COM 访问此程序集中的类型,
 // 则将该类型上的 ComVisible 特性设置为 true。
+
 [assembly: ComVisible(false)]
 
 // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
+
 [assembly: Guid("95298b49-4d85-4c6c-91bd-e1cd12d74187")]
 
 // 程序集的版本信息由下面四个值组成: 
@@ -32,5 +34,6 @@ using System.Runtime.InteropServices;
 // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
 // 方法是按如下所示使用“*”: 
 // [assembly: AssemblyVersion("1.0.*")]
+
 [assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 1 - 1
CSharp/Platform/ENetTest/ENetClientServerTest.cs

@@ -1,8 +1,8 @@
 using System.Diagnostics;
 using System.Threading;
-using ENet;
 using Common.Helper;
 using Common.Logger;
+using ENet;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 
 namespace ENetTest