示例#1
0
    public override bool Equals(object obj)
    {
        JsonBuilding o = obj as JsonBuilding;

        return(o != null &&
               this.type == o.type &&
               this.x == o.x &&
               this.y == o.y &&
               this.magnitude == o.magnitude &&
               this.rot == o.rot);
    }
示例#2
0
        public static Building ParseBuilding(JsonBuilding jbuilding)
        {
            Building build = new Building
            {
                Id       = jbuilding.UserBuildingId,
                Location = new Rectangle
                {
                    Point  = ParsePoint(jbuilding.UserBuildingPoint),
                    Width  = 3,
                    Length = 3
                },
                State     = (BuildState)jbuilding.State,
                Level     = jbuilding.BuildingLevel,
                Direction = BuildDirection.Normal,

                BuildingType = jbuilding.Seed > 0? BuildingType.Food:BuildingType.Gold
            };

            return(build);
        }