本文整理汇总了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);
}
示例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;
}
}
}
示例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));
}
示例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);
}
示例5: PlayerActionWindow
public PlayerActionWindow(IGame game, IPlayer player)
: base("Player Action Window", GetDescription(player), game)
{
this.player = player;
player.IsActivePlayer = true;
}
示例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);
}
}
示例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;
}
示例8: RemoveFromGame
public override void RemoveFromGame(IGame game)
{
players = null;
asteroids = null;
bullets = null;
games = null;
}
示例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);
}
示例10: CanBeAttachedTo
public override bool CanBeAttachedTo(IGame game, ICanHaveAttachments cardInPlay)
{
if (cardInPlay == null)
throw new ArgumentNullException("cardInPlay");
return (cardInPlay is IHeroCard);
}
示例11: GameEngine
public GameEngine(IGame game, IBatBowlDecision batBowlDecision, ICoinToss coinToss, IDeliveryEngine deliveryEngine )
{
_game = game;
_batBowlDecision = batBowlDecision;
_coinToss = coinToss;
_deliveryEngine = deliveryEngine;
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}