当前位置: 首页>>代码示例>>C#>>正文


C# Area.Equals方法代码示例

本文整理汇总了C#中Area.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Area.Equals方法的具体用法?C# Area.Equals怎么用?C# Area.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Area的用法示例。


在下文中一共展示了Area.Equals方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OpEquals

 public void OpEquals()
 {
     var area1 = new Area(36000000, AreaUnit.MeterSquared);
     var area2 = new Area(36, AreaUnit.KilometerSquared);
     var area3 = new Area(120, AreaUnit.KilometerSquared);
     (area1 == area2).ShouldBeTrue();
     (area2 == area1).ShouldBeTrue();
     (area1 == area3).ShouldBeFalse();
     (area3 == area1).ShouldBeFalse();
     area1.Equals(area2)
          .ShouldBeTrue();
     area1.Equals((object)area2)
          .ShouldBeTrue();
     area2.Equals(area1)
          .ShouldBeTrue();
     area2.Equals((object)area1)
          .ShouldBeTrue();
 }
开发者ID:EddieGarmon,项目名称:GraduatedCylinder,代码行数:18,代码来源:AreaOperators.cs

示例2: Main

        static void Main(string[] args)
        {
            Area a45 = new Area(4, 5);
            object b45 = new Area(4, 5);
            Area c47 = new Area(4, 7);
            Area d210 = new Area(2, 10);

            bool result;

            result = a45.Equals(b45);
            result = a45 == (Area)b45;
            result = a45.Equals(c47);
            result = a45 != c47;

            int a45Hashcode = a45.GetHashCode();
            int b45Hashcode = b45.GetHashCode();
            int c47Hashcode = c47.GetHashCode();
            int d210Hashcode = d210.GetHashCode();

            result = a45.Equals(d210);
        }
开发者ID:brnn8r,项目名称:SadamsCode,代码行数:21,代码来源:Program.cs

示例3: changeActiveArea

        /// <summary>
        /// Moves the player from one area to another.
        /// </summary>
        /// <param name="arrivingArea">New area.</param>
        /// <param name="targetTile">Tile in that area the player should appear on.</param>
        public static void changeActiveArea(Area arrivingArea, Point targetTile)
        {
            Area departingArea = GameplayManager.ActiveArea;

            if (arrivingArea == departingArea)
                return;

            if (departingArea.exists(GameplayManager.Companion))
            {
                //GameplayManager.Companion.getCollider().setCollider(ColliderType.PC);
                departingArea.remove(GameplayManager.Companion);
            }

            departingArea.remove(GameplayManager.Player);

            Rectangle targetRectangle = arrivingArea.getTileRectangle(targetTile.X, targetTile.Y);
            Vector2 newPos = new Vector2(
                targetRectangle.X + arrivingArea.TileSet.tileWidth / 2,
                targetRectangle.Y + arrivingArea.TileSet.tileHeight / 2);

            Player.getCollider().move(newPos - Player.getCollider().Bounds.Center());
            if (Quest.talkedToCompanion)
            //if(true)
            {
                Companion.getCollider().move(newPos - Companion.getCollider().Bounds.Center());
                ((CompanionController)Companion).learnNewInfo(CharacterController.currPlan);
                CharacterController.currPlan = null;
                //Player.brew.extract(CharacterController.ALL_BREW);
                //Companion.brew.extract(CharacterController.ALL_BREW);
            }
            arrivingArea.add(GameplayManager.Player);

            if (!Quest.talkedToCompanion && arrivingArea.Equals(WorldManager.GetArea(Area.START)))
            {
                arrivingArea.add(GameplayManager.Companion);
                //ADD AND ALSO IF FIRST QUEST IS UNDONE!
                GameplayManager.Companion.setAbsPos(new Vector2(500, 50));
            }
            else if(Quest.talkedToCompanion)
            {
                arrivingArea.add(GameplayManager.Companion);
            }

            activeArea = arrivingArea;

            if (activeArea.GlobalLocation == Area.PARTY)
            {
                // place the companion and player into new default start locales
                double xdiff = GameplayManager.Player.m_position.X - GameplayManager.Player.m_collider.m_bounds.X;
                double ydiff = GameplayManager.Player.m_position.Y - GameplayManager.Player.m_collider.m_bounds.Y;
                GameplayManager.Player.m_position = new Vector2(Area.TILE_WIDTH * 3 + 20, Area.TILE_HEIGHT * 3);
                GameplayManager.Player.m_collider.move(new Vector2((float)(-GameplayManager.Player.m_collider.m_bounds.X + GameplayManager.Player.m_position.X - xdiff), (float)(-GameplayManager.Player.m_collider.m_bounds.Y + GameplayManager.Player.m_position.Y - ydiff)));
                GameplayManager.Player.m_position = new Vector2(Area.TILE_WIDTH * 3 + 20, Area.TILE_HEIGHT * 3);

                xdiff = GameplayManager.Companion.m_position.X - GameplayManager.Companion.m_collider.m_bounds.X;
                ydiff = GameplayManager.Companion.m_position.Y - GameplayManager.Companion.m_collider.m_bounds.Y;
                GameplayManager.Companion.m_position = new Vector2(Area.TILE_WIDTH * 3 + 20, Area.TILE_HEIGHT * 9);
                GameplayManager.Companion.m_collider.move(new Vector2((float)(-GameplayManager.Companion.m_collider.m_bounds.X + GameplayManager.Companion.m_position.X - xdiff), (float)(-GameplayManager.Companion.m_collider.m_bounds.Y + GameplayManager.Companion.m_position.Y - ydiff)));
                GameplayManager.Companion.m_position = new Vector2(Area.TILE_WIDTH * 3 + 20, Area.TILE_HEIGHT * 9);
                GameplayManager.Companion.m_collider.m_type = ColliderType.NPC;
            }
            else
            {
                GameplayManager.Companion.m_collider.m_type = ColliderType.PC;
            }
        }
开发者ID:BNHeadrick,项目名称:Bros,代码行数:71,代码来源:GameplayManager.cs

示例4: UpdateArea

        /// <summary>
        /// 
        /// </summary>
        /// <param name="original"></param>
        /// <param name="updated"></param>
        /// <returns></returns>
        public Area UpdateArea(Area original, Area updated)
        {
            var meta = UpdateAreaAuthorization(original, updated);

            if (!original.Equals(updated))
            {
                areaRepo.Update(updated);

                //-- Refresh the cache
                AppLookups.UpdateIndexEntryInCache(updated.ToCacheIndexEntry());

                //-- Send off notifications

                var action = SaveModActionAndUpdateModProfile(ModActionType.AreaEdit, original, updated, meta,
                    (m, actionID) => m.SetDetailsChanged(actionID),
                    null, "edited {0} {1}", updated.Type, updated.Name);

                postSvc.UpdateContentAddPost(action);
            }

            return updated;
        }
开发者ID:jkresner,项目名称:Climbfind_v4_2011,代码行数:28,代码来源:GeoService.Areas.cs


注:本文中的Area.Equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。