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


C# IGame类代码示例

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


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


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