private void ShowGhostOnTile(MapTile tile) { ghostTile = tile; if (CurrentFactory == null) { tile.HandleMouseEnter(); return; } if (!CurrentFactory.CanBuildOnto(tile, out _)) { return; } tile.HandleMouseEnter(); if (Ghost == null) { return; } Ghost.Tile = tile; Ghost.RenderOnto(tile.Canvas, tile.ScreenPosition); foreach (var renderer in Ghost.GameObject.GetComponentsInChildren <SpriteRenderer>()) { Color color = renderer.color; color.a = 0.5f; renderer.color = color; } }
/// <summary> /// Close the current factory /// </summary> public static void CloseFactory() { if (CurrentFactory != null) { _logger.Debug("Closing NHibernate session factory"); CurrentFactory.Close(); CurrentFactory = null; } }
public void Should_Throw_ArgumentOutOfRangeException_And_ReturnStartPosition_When_RoverGetsOutOfPlato() { IPosition startPosition = CurrentFactory.CreateInputObject <IPosition>(); startPosition.X = 3; startPosition.Y = 3; startPosition.Direction = Direction.East; IDriver driver = new Driver.Driver(CurrentPlato, startPosition); ICommandList commandLists = CurrentFactory.CreateInputObject <ICommandList>(); commandLists.AddRange("MMMMMM".Select(p => (CommandType)p).ToArray()); Assert.Throws <ArgumentOutOfRangeException>(() => driver.Drive(commandLists)); Assert.IsTrue(startPosition.Equals(driver.CurrentPosition)); }
public ICircuitBreaker CreateBreaker(object arg) { if (CurrentFactory == null) { switch (Type) { case CircuitBreakerFactoryType.None: CurrentFactory = new NoCircuitBreakerFactory(); break; case CircuitBreakerFactoryType.AppConfig: CurrentFactory = new AppConfigCircuitBreakerFactory(); break; } } return(CurrentFactory?.CreateBreaker(arg)); }
void OnNotify(MapTile tile) { if (CurrentFactory == null) { infoBox.SetInfo(tile.Structure); return; } if (!CurrentFactory.CanBuildOnto(tile, out string reason)) { ShowPopupInfo(reason); return; } CurrentFactory.BuildOnto(tile); // Update Ghosts HideGhostOnTile(tile); ShowGhostOnTile(tile); BuiltEvent?.Invoke(); }
public void Should_WorkFine_WhenEverythinkOk_Scenario_2() { IPosition startPosition = CurrentFactory.CreateInputObject <IPosition>(); startPosition.X = 3; startPosition.Y = 3; startPosition.Direction = Direction.East; IDriver driver = new Driver.Driver(CurrentPlato, startPosition); ICommandList commandLists = CurrentFactory.CreateInputObject <ICommandList>(); commandLists.AddRange("MMRMMRMRRM".Select(p => (CommandType)p).ToArray()); IPosition lastPosition = driver.Drive(commandLists); Assert.AreEqual(lastPosition.X, 5); Assert.AreEqual(lastPosition.Y, 1); Assert.AreEqual(lastPosition.Direction, Direction.East); }
public static ISession OpenSession() { return(CurrentFactory.OpenSession()); }
public static bool TryGetLocalized( string key, out string value) { return(CurrentFactory .TryGetLocalized(key, out value)); }
public static string GetLocalized( string key) { return(CurrentFactory .GetLocalized(key)); }
public static string GetDefaultCultureName() { return(CurrentFactory .GetDefaultCultureName()); }
public static void ReloadLocalizations <T>() where T : ILocalizationProvider { CurrentFactory .ReloadLocalizations <T>(); }
public static void SetDefaultCulture( CultureInfo culture) { CurrentFactory .SetDefaultCulture(culture); }
public static void SetDefaultCulture( string cultureName) { CurrentFactory .SetDefaultCulture(cultureName); }
public static void OnLocalizationUpdated() { CurrentFactory .OnLocalizationUpdated(); }
public static void OnLocalizationUpdated( ILocalizationModule localization) { CurrentFactory .OnLocalizationUpdated(localization); }
/// <summary> /// Open a new NHibernate session and save reference in CurrentSession property /// </summary> /// <param name="filters">Session filters</param> public static void StartSession() { _logger.Debug("Starting NHibernate session"); CurrentSession = CurrentFactory.OpenSession(); CurrentSession.FlushMode = NHibernate.FlushMode.Never; // TODO: Think if this is wanted }
public static bool SwitchLocalization( string cultureName) { return(CurrentFactory .SwitchLocalization(cultureName)); }