• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IGame类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IGame的典型用法代码示例。如果您正苦于以下问题:C# IGame类的具体用法?C# IGame怎么用?C# IGame使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IGame类属于命名空间,在下文中一共展示了IGame类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: HardBall

 public HardBall(IGame game, Vector2 position)
     : base(game, game.ContentProvider.GetBallSprite(0), position, 5)
 {
     Velocity = 2;
     var target = new Vector2(Game.Random.Next() - Game.Random.Next(), Game.Random.Next() - Game.Random.Next());
     MoveTo(target);
 }
开发者ID:RavingRabbit,项目名称:Labs,代码行数:7,代码来源:HardBall.cs


示例2: TryGetGame

        public bool TryGetGame(string hash, out IGame game)
        {
            GameSetup _setup;
            Game _game;

            if (setups.TryGetValue(hash, out _setup))
            {
                game = _setup;
                return true;
            }
            else if (games.TryGetValue(hash, out _game))
            {
                game = _game;
                return true;
            }
            else
            {
                string filepath = getFilePath(hash);
                if (!File.Exists(filepath))
                {
                    game = null;
                    return false;
                }
                else
                {
                    _game = Game.FromFile(filepath);
                    games.Add(hash, _game);
                    game = _game;
                    return true;
                }
            }
        }
开发者ID:SickTeam,项目名称:GitGameServer,代码行数:32,代码来源:GameManager.cs


示例3: HealOneDamageOnCharacter

            private void HealOneDamageOnCharacter(IGame game, IEffectHandle handle, IPlayer player, ICharacterInPlay glorfindel, ICharacterInPlay character)
            {
                glorfindel.Resources -= 1;
                character.Damage -= 1;

                handle.Resolve(string.Format("{0} chose to heal 1 damage on '{1}'", player.Name, character.Title));
            }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:7,代码来源:Glorfindel_Core.cs


示例4: Update

        public override void Update(Unit unit, IGame game)
        {
            base.Update(unit, game);

            if ((game.Time - unit.BirthTime) > FleeTime)
                unit.setState(UnitFactories.States.Create(unit.Name, "fleeing"), game);
        }
开发者ID:Chirimorin,项目名称:DuckHunt,代码行数:7,代码来源:AliveUnitState.cs


示例5: PlayerActionWindow

        public PlayerActionWindow(IGame game, IPlayer player)
            : base("Player Action Window", GetDescription(player), game)
        {
            this.player = player;

            player.IsActivePlayer = true;
        }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:7,代码来源:PlayerActionWindow.cs


示例6: Handle

 public void Handle(string logLine, IHsGameState gameState, IGame game)
 {
     if (HsLogReaderConstants.CardAlreadyInCacheRegex.IsMatch(logLine))
     {
         var id = HsLogReaderConstants.CardAlreadyInCacheRegex.Match(logLine).Groups["id"].Value;
         if (game.CurrentGameMode == GameMode.Arena)
             gameState.GameHandler.HandlePossibleArenaCard(id);
         else
             gameState.GameHandler.HandlePossibleConstructedCard(id, false);
     }
     else if (HsLogReaderConstants.GoldProgressRegex.IsMatch(logLine)
              && (DateTime.Now - gameState.LastGameStart) > TimeSpan.FromSeconds(10)
              && game.CurrentGameMode != GameMode.Spectator)
     {
         int wins;
         var rawWins = HsLogReaderConstants.GoldProgressRegex.Match(logLine).Groups["wins"].Value;
         if (int.TryParse(rawWins, out wins))
         {
             TimeZoneInfo timeZone = null;
             switch (game.CurrentRegion)
             {
                 case Region.EU:
                     timeZone = TimeZoneInfo.FindSystemTimeZoneById("Central European Standard Time");
                     break;
                 case Region.US:
                     timeZone = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time");
                     break;
                 case Region.ASIA:
                     timeZone = TimeZoneInfo.FindSystemTimeZoneById("Korea Standard Time");
                     break;
             }
             if (timeZone != null)
             {
                 var region = (int)game.CurrentRegion - 1;
                 var date = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, timeZone).Date;
                 if (Config.Instance.GoldProgressLastReset[region].Date != date)
                 {
                     Config.Instance.GoldProgressTotal[region] = 0;
                     Config.Instance.GoldProgressLastReset[region] = date;
                 }
                 Config.Instance.GoldProgress[region] = wins == 3 ? 0 : wins;
                 if (wins == 3)
                     Config.Instance.GoldProgressTotal[region] += 10;
                 Config.Save();
             }
         }
     }
     else if (HsLogReaderConstants.DustRewardRegex.IsMatch(logLine))
     {
         int amount;
         if (int.TryParse(HsLogReaderConstants.DustRewardRegex.Match(logLine).Groups["amount"].Value, out amount))
             gameState.GameHandler.HandleDustReward(amount);
     }
     else if (HsLogReaderConstants.GoldRewardRegex.IsMatch(logLine))
     {
         int amount;
         if (int.TryParse(HsLogReaderConstants.GoldRewardRegex.Match(logLine).Groups["amount"].Value, out amount))
             gameState.GameHandler.HandleGoldReward(amount);
     }
 }
开发者ID:radoraykov,项目名称:Hearthstone-Deck-Tracker,代码行数:60,代码来源:RachelleHandler.cs


示例7: SourceCodeListViewModel

 public SourceCodeListViewModel(IGame game)
 {
     this.game = game;
     List<DirectoryListing> baseListings = new List<DirectoryListing>();
     foreach (ISourceCode source in game.Sources)
     {
         string dn = Path.GetDirectoryName(source.RelativeName);
         string[] dirs = Regex.Split(dn, @"[\\/]");
         DirectoryListing d = null;
         foreach (var baseListing in baseListings)
         {
             if (baseListing.Name == dirs[0])
             {
                 d = baseListing;
             }
         }
         if (d == null)
         {
             d = new DirectoryListing();
             d.Name = dirs[0];
             baseListings.Add(d);
         }
         d.GetOrCreateDirectoryListing(dirs).Sources.Add(source);
     }
     DirectoryListings = baseListings;
 }
开发者ID:DamienHauta,项目名称:Ns2Docs,代码行数:26,代码来源:SourceCodeListViewModel.cs


示例8: RemoveFromGame

 public override void RemoveFromGame(IGame game)
 {
     players = null;
     asteroids = null;
     bullets = null;
     games = null;
 }
开发者ID:kinlam,项目名称:RUN-SHOOT,代码行数:7,代码来源:CollisionSystem.cs


示例9: Initialize

        /// <summary>
        /// Initialize this system to a working state.
        /// </summary>
        /// <param name="game">
        /// The <see cref="IGame"/> game, that requested the initialization. That is the game,
        /// the system will be running in.
        /// </param>
        public override void Initialize(IGame game)
        {
            base.Initialize(game);
            this.Game.ComponentSystem.RegisterComponentType<DestructableComponent>();

            this.Game.EventManager.RegisterListener(CollisionEvents.CollisionEntered, this.OnCollisionEntered);
        }
开发者ID:Pr3s4ri0,项目名称:HelGames.Teaching.ComponentSystem,代码行数:14,代码来源:DestructableSystem.cs


示例10: CanBeAttachedTo

        public override bool CanBeAttachedTo(IGame game, ICanHaveAttachments cardInPlay)
        {
            if (cardInPlay == null)
                throw new ArgumentNullException("cardInPlay");

            return (cardInPlay is IHeroCard);
        }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:7,代码来源:UnexpectedCourage.cs


示例11: GameEngine

 public GameEngine(IGame game, IBatBowlDecision batBowlDecision, ICoinToss coinToss, IDeliveryEngine deliveryEngine )
 {
     _game = game;
     _batBowlDecision = batBowlDecision;
     _coinToss = coinToss;
     _deliveryEngine = deliveryEngine;
 }
开发者ID:djrhodes,项目名称:CricketSim,代码行数:7,代码来源:GameEngine.cs


示例12: Handle

		public void Handle(string logLine, IHsGameState gameState, IGame game)
		{
			if(HsLogReaderConstants.CardAlreadyInCacheRegex.IsMatch(logLine))
			{
				var id = HsLogReaderConstants.CardAlreadyInCacheRegex.Match(logLine).Groups["id"].Value;
				if(game.CurrentGameMode == GameMode.Arena)
					gameState.GameHandler.HandlePossibleArenaCard(id);
				else
					gameState.GameHandler.HandlePossibleConstructedCard(id, false);
			}
			else if(HsLogReaderConstants.GoldProgressRegex.IsMatch(logLine) && (DateTime.Now - gameState.LastGameStart) > TimeSpan.FromSeconds(10)
			        && game.CurrentGameMode != GameMode.Spectator)
			{
				int wins;
				var rawWins = HsLogReaderConstants.GoldProgressRegex.Match(logLine).Groups["wins"].Value;
				if(int.TryParse(rawWins, out wins))
				{
					var timeZone = GetTimeZoneInfo(game.CurrentRegion);
					if(timeZone != null)
						UpdateGoldProgress(wins, game, timeZone);
				}
			}
			else if(HsLogReaderConstants.DustRewardRegex.IsMatch(logLine))
			{
				int amount;
				if(int.TryParse(HsLogReaderConstants.DustRewardRegex.Match(logLine).Groups["amount"].Value, out amount))
					gameState.GameHandler.HandleDustReward(amount);
			}
			else if(HsLogReaderConstants.GoldRewardRegex.IsMatch(logLine))
			{
				int amount;
				if(int.TryParse(HsLogReaderConstants.GoldRewardRegex.Match(logLine).Groups["amount"].Value, out amount))
					gameState.GameHandler.HandleGoldReward(amount);
			}
		}
开发者ID:joshuaduffy,项目名称:Hearthstone-Deck-Tracker,代码行数:35,代码来源:RachelleHandler.cs


示例13: FormGame

            private IGame m_gameState; // Game state variable

            public FormGame()
            {
                InitializeComponent();

                try
                {
                // Load the remoting configuration file
                RemotingConfiguration.Configure("remoting.config", false);

                // TODO: Remove this for the remoting.config
                m_gameState = (IGame)Activator.GetObject(typeof(IGame),
                    "http://localhost:10000/gamestate.soap");

                // Register callback
                m_gameState.RegisterClientCallback(new Callback(this));

                // TEST CODE
                m_gameState.revealCell(2, 2);
                foreach (Cell cell in m_gameState.Board.ClientCells)
                {
                    MessageBox.Show("Is Mine? " + cell.IsMine.ToString() + "\nPerimitive Mines: " + cell.PerimitiveMines + "\nLocation: " + cell.LocX + "," + cell.LocY);
                }
                }
                catch (Exception ex)
                {
                MessageBox.Show(ex.Message);
                }
            }
开发者ID:mrcrassi,项目名称:multisweeper,代码行数:30,代码来源:FormGame.cs


示例14: Handle

 public void Handle(string logLine, IHsGameState gameState, IGame game)
 {
     if (gameState.AwaitingRankedDetection)
     {
         gameState.LastAssetUnload = DateTime.Now;
         gameState.WaitingForFirstAssetUnload = false;
     }
     if (logLine.Contains("Medal_Ranked_"))
     {
         var match = Regex.Match(logLine, "Medal_Ranked_(?<rank>(\\d+))");
         if (match.Success)
         {
             int rank;
             if (int.TryParse(match.Groups["rank"].Value, out rank))
                 gameState.GameHandler.SetRank(rank);
         }
     }
     else if (logLine.Contains("rank_window"))
     {
         gameState.FoundRanked = true;
         gameState.GameHandler.SetGameMode(GameMode.Ranked);
     }
     else if (HsLogReaderConstants.UnloadCardRegex.IsMatch(logLine))
     {
         var id = HsLogReaderConstants.UnloadCardRegex.Match(logLine).Groups["id"].Value;
         if (game.CurrentGameMode == GameMode.Arena)
             gameState.GameHandler.HandlePossibleArenaCard(id);
         else
             gameState.GameHandler.HandlePossibleConstructedCard(id, true);
     }
 }
开发者ID:karimsah,项目名称:Hearthstone-Deck-Tracker,代码行数:31,代码来源:AssetHandler.cs


示例15: Handle

 public void Handle(string logLine, IHsGameState gameState, IGame game)
 {
     if (HsLogReaderConstants.CardAlreadyInCacheRegex.IsMatch(logLine))
     {
         var id = HsLogReaderConstants.CardAlreadyInCacheRegex.Match(logLine).Groups["id"].Value;
         if (game.CurrentGameMode == GameMode.Arena)
             gameState.GameHandler.HandlePossibleArenaCard(id);
         else
             gameState.GameHandler.HandlePossibleConstructedCard(id, false);
     }
     else if ((DateTime.Now - gameState.LastGameStart) > TimeSpan.FromSeconds(10)
              && game.CurrentGameMode != GameMode.Spectator)
     {
         GoldTracking(logLine, game);
     }
     else if (HsLogReaderConstants.DustRewardRegex.IsMatch(logLine))
     {
         int amount;
         if (int.TryParse(HsLogReaderConstants.DustRewardRegex.Match(logLine).Groups["amount"].Value,
             out amount))
             gameState.GameHandler.HandleDustReward(amount);
     }
     else if (HsLogReaderConstants.GoldRewardRegex.IsMatch(logLine))
     {
         int amount;
         if (int.TryParse(HsLogReaderConstants.GoldRewardRegex.Match(logLine).Groups["amount"].Value,
             out amount))
             gameState.GameHandler.HandleGoldReward(amount);
     }
 }
开发者ID:graydon-armstrong,项目名称:Hearthstone-Deck-Tracker,代码行数:30,代码来源:RachelleHandler.cs


示例16: Handle

        public void Handle(string logLine, IHsGameState gameState, IGame game)
        {
            if (logLine[9] != 'R' && logLine[16] != 'r') // [Bob] ---Register
                return;

            if (logLine.Length == 29 && logLine[23] == 'B' && logLine[25] == 'x') // ---RegisterScreenBox---
            {
                if (game.CurrentGameMode == GameMode.Spectator)
                    gameState.GameEnd();
            }
            else if (logLine.Length == 31 && logLine[23] == 'F' && logLine[27] == 'e') // ---RegisterScreenForge---
            {
                gameState.GameHandler.SetGameMode(GameMode.Arena);
                game.ResetArenaCards();
            }
            else if (logLine.Length == 34)
            {
                if (logLine[23] == 'P' && logLine[30] == 'e') // ---RegisterScreenPractice---
                    gameState.GameHandler.SetGameMode(GameMode.Practice);
                else if (logLine[23] == 'T' && logLine[30] == 's') // ---RegisterScreenTourneys---
                    gameState.GameHandler.SetGameMode(GameMode.Casual);
                else if (logLine[23] == 'F' && logLine[30] == 'y') // ---RegisterScreenFriendly---
                    gameState.GameHandler.SetGameMode(GameMode.Friendly);
                else if (logLine[23] == 'e' && logLine[24] == 'N' && logLine[30] == 's') // RegisterProfileNotices
                    gameState.GameLoaded = true;
            }
            else if (logLine.Length == 35 && logLine[17] == 'F' && logLine[22] == 'd' && logLine[23] == 'C') // RegisterFriendChallenge
            {
                gameState.GameHandler.HandleInMenu();
            }
            else if (logLine.Length == 43 && logLine[23] == 'C' && logLine[32] == 'n' && logLine[33] == 'M' && logLine[39] == 'r')// ---RegisterScreenCollectionManager---
                gameState.GameHandler.ResetConstructedImporting();
        }
开发者ID:radoraykov,项目名称:Hearthstone-Deck-Tracker,代码行数:33,代码来源:BobHandler.cs


示例17: Initialize

        public void Initialize(IGame game, int starCount)
        {
            rand = new Random();
            this.game = game;

            int starCount1 = starCount;
            int starCount2 = starCount / Star2Divisor;
            int starCount3 = starCount / Star3Divisor;

            stars1 = new List<Vector2>(starCount1);
            stars2 = new List<Vector2>(starCount2);
            stars3 = new List<Vector2>(starCount3);

            for (int i = 0; i < starCount1; ++i)
            {
                int x = rand.Next(game.Width);
                int y = rand.Next(game.Height);
                stars1.Add(new Vector2(x, y));
            }

            for (int i = 0; i < starCount2; ++i)
            {
                int x = rand.Next(game.Width);
                int y = rand.Next(game.Height);
                stars2.Add(new Vector2(x, y));
            }

            for (int i = 0; i < starCount3; ++i)
            {
                int x = rand.Next(game.Width);
                int y = rand.Next(game.Height);
                stars3.Add(new Vector2(x, y));
            }
        }
开发者ID:tdicola,项目名称:blacknectar_2ndhalf,代码行数:34,代码来源:StarField.cs


示例18: Travel

        public virtual void Travel(IGame game)
        {
            if (game.QuestArea.ActiveLocation != null)
                return;

            game.AddEffect(this);
        }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:7,代码来源:TravelEffectBase.cs


示例19: AddToGame

 public override void AddToGame(IGame game)
 {
     games = game.GetNodeList<GameNode>();
     players = game.GetNodeList<PlayerCollisionNode>();
     asteroids = game.GetNodeList<AsteroidCollisionNode>();
     bullets = game.GetNodeList<BulletCollisionNode>();
 }
开发者ID:kinlam,项目名称:RUN-SHOOT,代码行数:7,代码来源:CollisionSystem.cs


示例20: RemoveFromGame

 public override void RemoveFromGame(IGame game)
 {
     spaceships = null;
     asteroids = null;
     bullets = null;
     games = null;
 }
开发者ID:MarcelMalik,项目名称:UnityAshteroids,代码行数:7,代码来源:CollisionSystem.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IGameContext类代码示例发布时间:2022-05-24
下一篇:
C# IGalleryObject类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap