Advertisement
Guest User

Untitled

a guest
Nov 26th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Haxe 1.05 KB | None | 0 0
  1. function redrawScroll():Void {
  2.         _pathScroll.clear(true);
  3.  
  4.         var mapConfig:ChallengesMapConfigData = _data.mapConfig;
  5.         var markerList:Array<QuestsBigMapPositionMarkerComponent> = createMarkers();
  6.         var routesCount:Int = Math.ceil(mapConfig.maxStepsCount / QuestsMapRouteComponent.getMaxSteps()); //count of items in scroll
  7.         var markersOnRoute:Int = Std.int(mapConfig.maxStepsCount / routesCount); //count of markers in one scroll item
  8.         var extraMarkers:Int = Std.int(mapConfig.maxStepsCount % routesCount); //how much markers not fit in one route to complete it
  9.         var activePart:Int = 0;
  10.         var mapRoute:QuestsMapRouteComponent;
  11.         for (i in 0...routesCount) {
  12.             mapRoute = new QuestsMapRouteComponent();
  13.             if (mapConfig.maxStepsCount - mapConfig.completedSteps < markerList.length) {
  14.                 activePart = i;
  15.             }
  16.             var eMarker:Int = 0;
  17.             if (extraMarkers > 0) {
  18.                 extraMarkers--;
  19.                 eMarker = 1;
  20.             }
  21.             mapRoute.addMarkers(markerList.splice(0, markersOnRoute + eMarker));
  22.             _pathScroll.add(mapRoute);
  23.         }
  24.  
  25.         _pathScroll.tweenToIndex(activePart);
  26.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement