Răsfoiți Sursa

id改成guid

tanghai 11 ani în urmă
părinte
comite
6dd31f3672

+ 0 - 1
CSharp/Game/Model/Buff.cs

@@ -1,5 +1,4 @@
 using Common.Base;
-using MongoDB.Bson.Serialization.Attributes;
 
 namespace Model
 {

+ 0 - 6
CSharp/Game/Model/BuffComponent.cs

@@ -2,14 +2,12 @@
 using System.ComponentModel;
 using Common.Base;
 using MongoDB.Bson;
-using MongoDB.Bson.Serialization.Attributes;
 using Component = Common.Base.Component;
 
 namespace Model
 {
     public class BuffComponent: Component, ISupportInitialize
     {
-        [BsonElement]
         public HashSet<Buff> Buffs { get; set; }
 
         private Dictionary<ObjectId, Buff> buffGuidDict { get; set; }
@@ -32,10 +30,6 @@ namespace Model
             foreach (var buff in this.Buffs)
             {
                 this.buffGuidDict.Add(buff.Guid, buff);
-            }
-
-            foreach (var buff in this.Buffs)
-            {
                 this.buffTypeMMap.Add(buff.Type, buff);
             }
         }

+ 4 - 4
CSharp/Game/Model/GameObjectManager.cs

@@ -23,10 +23,10 @@ namespace Model
             this.typeGameObjects[gameObject.Type].Add(gameObject.Guid, gameObject);
         }
 
-        public GameObject Get(ObjectId id)
+        public GameObject Get(ObjectId guid)
         {
             GameObject gameObject = null;
-            this.gameObjects.TryGetValue(id, out gameObject);
+            this.gameObjects.TryGetValue(guid, out gameObject);
             return gameObject;
         }
 
@@ -57,9 +57,9 @@ namespace Model
             return true;
         }
 
-        public bool Remove(ObjectId id)
+        public bool Remove(ObjectId guid)
         {
-            GameObject gameObject = this.Get(id);
+            GameObject gameObject = this.Get(guid);
             if (gameObject == null)
             {
                 return false;