Ejemplo n.º 1
0
        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;
            }
        }
Ejemplo n.º 2
0
 /// <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));
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 7
0
 public static ISession OpenSession()
 {
     return(CurrentFactory.OpenSession());
 }
Ejemplo n.º 8
0
 public static bool TryGetLocalized(
     string key, out string value)
 {
     return(CurrentFactory
            .TryGetLocalized(key, out value));
 }
Ejemplo n.º 9
0
 public static string GetLocalized(
     string key)
 {
     return(CurrentFactory
            .GetLocalized(key));
 }
Ejemplo n.º 10
0
 public static string GetDefaultCultureName()
 {
     return(CurrentFactory
            .GetDefaultCultureName());
 }
Ejemplo n.º 11
0
 public static void ReloadLocalizations <T>()
     where T : ILocalizationProvider
 {
     CurrentFactory
     .ReloadLocalizations <T>();
 }
Ejemplo n.º 12
0
 public static void SetDefaultCulture(
     CultureInfo culture)
 {
     CurrentFactory
     .SetDefaultCulture(culture);
 }
Ejemplo n.º 13
0
 public static void SetDefaultCulture(
     string cultureName)
 {
     CurrentFactory
     .SetDefaultCulture(cultureName);
 }
Ejemplo n.º 14
0
 public static void OnLocalizationUpdated()
 {
     CurrentFactory
     .OnLocalizationUpdated();
 }
Ejemplo n.º 15
0
 public static void OnLocalizationUpdated(
     ILocalizationModule localization)
 {
     CurrentFactory
     .OnLocalizationUpdated(localization);
 }
Ejemplo n.º 16
0
 /// <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
 }
Ejemplo n.º 17
0
 public static bool SwitchLocalization(
     string cultureName)
 {
     return(CurrentFactory
            .SwitchLocalization(cultureName));
 }