Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function redrawScroll():Void {
- _pathScroll.clear(true);
- var mapConfig:ChallengesMapConfigData = _data.mapConfig;
- var markerList:Array<QuestsBigMapPositionMarkerComponent> = createMarkers();
- var routesCount:Int = Math.ceil(mapConfig.maxStepsCount / QuestsMapRouteComponent.getMaxSteps()); //count of items in scroll
- var markersOnRoute:Int = Std.int(mapConfig.maxStepsCount / routesCount); //count of markers in one scroll item
- var extraMarkers:Int = Std.int(mapConfig.maxStepsCount % routesCount); //how much markers not fit in one route to complete it
- var activePart:Int = 0;
- var mapRoute:QuestsMapRouteComponent;
- for (i in 0...routesCount) {
- mapRoute = new QuestsMapRouteComponent();
- if (mapConfig.maxStepsCount - mapConfig.completedSteps < markerList.length) {
- activePart = i;
- }
- var eMarker:Int = 0;
- if (extraMarkers > 0) {
- extraMarkers--;
- eMarker = 1;
- }
- mapRoute.addMarkers(markerList.splice(0, markersOnRoute + eMarker));
- _pathScroll.add(mapRoute);
- }
- _pathScroll.tweenToIndex(activePart);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement