Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String thisinput = //The original slider input given (before k split it up)
- public Slider( String input, int numPoints, double sliderX, double beatSpace )
- {
- super( input );
- type = k[on++];
- int oddX, oddY;
- //This is where things get confusing.
- //In format 10, merely splitting via : will return bogus numbers.
- //Use thisinput to split numerous times
- String[] split = thisinput.split("[|]");
- //With these splits pull out the needed information
- //Substring to take the first part out of the slider text since k took care of it
- String aftertype = thisinput.substring(split[0].length());
- split = aftertype.split("[|]");
- //Now we need to find the first comma, that's the proper split we need.
- for(int i=0;i<split.length;i++)
- {
- //Find first split with a comma in it, that's what is needed.
- if (split[i].indexOf(',')!=-1)
- {
- aftertype = split[i];
- break;
- }
- }
- //Now get the ending x time (I called it oddX since it's only used when repeats are odd)
- split = aftertype.split("[:]");
- oddX = Integer.parseInt(split[0]);
- aftertype = split[1];
- //Split it up with commas now. This either has 3 or 4 parts to it (the 4th we can ignore)
- split = aftertype.split("[,]");
- oddY = Integer.parseInt(split[0]);
- repeats = Integer.parseInt(split[1]);
- sliderLength = Double.parseDouble(split[2]);
- allTimes = new int[repeats + 1];
- //And that's it for the special parsing. Hope this helps!
- //Oh yeah, and the odd repeats check is changed, go look at it. vvvvv
- // For now, takes a rounded time, instead of proper calibration
- double timeInterval = ( sliderLength * beatSpace ) / ( 100 * sliderX );
- for ( int i = 0; i < repeats + 1; i++ )
- {
- allTimes[i] = (int)( time + i * timeInterval );
- }
- endTime = allTimes[allTimes.length - 1];
- // For now, uses the last node for endX and endY
- if ( repeats % 2 == 0 )
- {
- endX = x;
- endY = y;
- }
- else
- {
- //Using the parsed odd values if repeat count is odd
- endX = oddX;
- endY = oddY;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement