Ejemplo n.º 1
0
 protected override void Execute(List <LobbyUiEntity> entities)
 {
     foreach (var lobbyUiEntity in entities)
     {
         var     command       = lobbyUiEntity.commandToCreateAwardImages;
         var     textEntity    = lobbyUiContext.CreateEntity();
         Vector3 startPosition = MovingAwardsUiElementsStorage.Instance().GetStartPoint(command.awardTypeEnum);
         textEntity.AddAwardText(command.quantity, MovingAwardsUiElementsStorage.Instance().GetStartPoint(command.awardTypeEnum),
                                 command.startSpawnTime,
                                 command.startSpawnTime + TimeSpan.FromSeconds(1.5)
                                 );
         textEntity.AddPosition(startPosition);
         textEntity.AddAlpha(1);
     }
 }
Ejemplo n.º 2
0
 private void Awake()
 {
     lobbyUiStorage = FindObjectOfType <LobbyUiStorage>()
                      ?? throw new NullReferenceException(nameof(LobbyUiStorage));
     uiLayersStorage = FindObjectOfType <UiLayersStorage>()
                       ?? throw new NullReferenceException(nameof(UiLayersStorage));
     shopUiStorage = FindObjectOfType <ShopUiStorage>()
                     ?? throw new NullReferenceException(nameof(ShopUiStorage));
     movingAwardsUiStorage = FindObjectOfType <MovingAwardsUiElementsStorage>()
                             ?? throw new NullReferenceException(nameof(MovingAwardsUiElementsStorage));
     warshipsUiStorage = FindObjectOfType <WarshipsUiStorage>()
                         ?? throw new NullReferenceException(nameof(WarshipsUiStorage));
     shopUiSpawner = FindObjectOfType <ShopUiSpawner>()
                     ?? throw new NullReferenceException(nameof(shopUiSpawner));
     lobbySceneSwitcher = FindObjectOfType <LobbySceneSwitcher>()
                          ?? throw new NullReferenceException(nameof(lobbySceneSwitcher));
     inGameCurrencyPaymaster = FindObjectOfType <InGameCurrencyPaymaster>()
                               ?? throw new NullReferenceException(nameof(inGameCurrencyPaymaster));
     textTooltip = FindObjectOfType <TextTooltip>()
                   ?? throw new NullReferenceException(nameof(TextTooltip));
 }
Ejemplo n.º 3
0
        protected override void Execute(List <LobbyUiEntity> entities)
        {
            const int maxNumberOfImagesPerAwardType = 100;

            foreach (var command in entities.Select(entity => entity.commandToCreateAwardImages))
            {
                AwardTypeEnum awardTypeEnum  = command.awardTypeEnum;
                DateTime      spawnStartTime = command.startSpawnTime;
                int           remainder      = command.quantity;
                int           numberOfImages;

                if (command.quantity > maxNumberOfImagesPerAwardType)
                {
                    numberOfImages = maxNumberOfImagesPerAwardType;
                }
                else
                {
                    numberOfImages = command.quantity;
                }


                int roundedAverageIncrement = (int)Math.Round(((decimal)command.quantity / numberOfImages),
                                                              MidpointRounding.AwayFromZero);
                // log.Debug($"{nameof(roundedAverageIncrement)} {roundedAverageIncrement}");

                int index = 0;
                while (remainder != 0)
                {
                    index++;
                    LobbyUiEntity entity = contextsLobbyUi.CreateEntity();

                    Vector3 spawnPoint  = MovingAwardsUiElementsStorage.Instance().GetStartPoint(awardTypeEnum);
                    Vector3 finishPoint = MovingAwardsUiElementsStorage.Instance().GetFinishPoint(awardTypeEnum);

                    // log.Debug($"finish position {finishPoint.x} {finishPoint.y}");
                    List <ControlPoint> controlPoints = awardTrajectoryFactory
                                                        .Create(index, spawnStartTime, spawnPoint, finishPoint, random, screenHeight);

                    // log.Debug("last control point position "+controlPoints.Last().position.x+" "+controlPoints.Last().position.y);
                    int increment;
                    if (roundedAverageIncrement < remainder)
                    {
                        increment = roundedAverageIncrement;
                    }
                    else
                    {
                        increment = remainder;
                    }
                    IconTrajectory iconTrajectory = new IconTrajectory()
                    {
                        controlPoints            = controlPoints,
                        currentControlPointIndex = 1
                    };
                    entity.AddMovingIcon(increment, iconTrajectory, awardTypeEnum);
                    entity.AddPosition(controlPoints.First().position);
                    entity.AddAlpha(0);
                    entity.AddScale(new Vector3(1, 1, 1));

                    remainder -= increment;
                }
            }
        }