Moved music control
This commit is contained in:
@@ -133,7 +133,6 @@ public class Vars{
|
|||||||
public static GlobalData data;
|
public static GlobalData data;
|
||||||
public static EntityCollisions collisions;
|
public static EntityCollisions collisions;
|
||||||
public static DefaultWaves defaultWaves;
|
public static DefaultWaves defaultWaves;
|
||||||
public static MusicControl mcont;
|
|
||||||
|
|
||||||
public static Control control;
|
public static Control control;
|
||||||
public static Logic logic;
|
public static Logic logic;
|
||||||
@@ -209,7 +208,6 @@ public class Vars{
|
|||||||
|
|
||||||
state = new GameState();
|
state = new GameState();
|
||||||
data = new GlobalData();
|
data = new GlobalData();
|
||||||
mcont = new MusicControl();
|
|
||||||
|
|
||||||
mobile = Core.app.getType() == ApplicationType.Android || Core.app.getType() == ApplicationType.iOS || testMobile;
|
mobile = Core.app.getType() == ApplicationType.Android || Core.app.getType() == ApplicationType.iOS || testMobile;
|
||||||
ios = Core.app.getType() == ApplicationType.iOS;
|
ios = Core.app.getType() == ApplicationType.iOS;
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import static io.anuke.mindustry.Vars.*;
|
|||||||
*/
|
*/
|
||||||
public class Control implements ApplicationListener{
|
public class Control implements ApplicationListener{
|
||||||
public final Saves saves;
|
public final Saves saves;
|
||||||
|
public final MusicControl music;
|
||||||
|
|
||||||
private Interval timer = new Interval(2);
|
private Interval timer = new Interval(2);
|
||||||
private boolean hiscore = false;
|
private boolean hiscore = false;
|
||||||
@@ -42,6 +43,7 @@ public class Control implements ApplicationListener{
|
|||||||
public Control(){
|
public Control(){
|
||||||
batch = new SpriteBatch();
|
batch = new SpriteBatch();
|
||||||
saves = new Saves();
|
saves = new Saves();
|
||||||
|
music = new MusicControl();
|
||||||
data = new GlobalData();
|
data = new GlobalData();
|
||||||
|
|
||||||
Unit.dp.product = settings.getInt("uiscale", 100) / 100f;
|
Unit.dp.product = settings.getInt("uiscale", 100) / 100f;
|
||||||
@@ -311,15 +313,15 @@ public class Control implements ApplicationListener{
|
|||||||
|
|
||||||
if(state.is(State.menu)){
|
if(state.is(State.menu)){
|
||||||
if(ui.deploy.isShown()){
|
if(ui.deploy.isShown()){
|
||||||
mcont.silence(); //TODO deploy music
|
music.silence(); //TODO deploy music
|
||||||
}else if(ui.editor.isShown()){
|
}else if(ui.editor.isShown()){
|
||||||
mcont.play(Musics.editor);
|
music.play(Musics.editor);
|
||||||
}else{
|
}else{
|
||||||
mcont.play(Musics.menu);
|
music.play(Musics.menu);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
//TODO game music
|
//TODO game music
|
||||||
mcont.silence();
|
music.silence();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!state.is(State.menu)){
|
if(!state.is(State.menu)){
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import io.anuke.arc.audio.*;
|
|||||||
import io.anuke.arc.math.*;
|
import io.anuke.arc.math.*;
|
||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
|
|
||||||
|
/** Controls playback of multiple music tracks.*/
|
||||||
public class MusicControl{
|
public class MusicControl{
|
||||||
private static final float finTime = 80f, foutTime = 80f;
|
private static final float finTime = 80f, foutTime = 80f;
|
||||||
private @Nullable Music current;
|
private @Nullable Music current;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ project.ext.assetsDir = new File("../core/assets")
|
|||||||
def IKVM_DIR = System.env.IKVM_HOME
|
def IKVM_DIR = System.env.IKVM_HOME
|
||||||
def getTarget = { return project.hasProperty("target") ? project.properties["target"] : "windows" }
|
def getTarget = { return project.hasProperty("target") ? project.properties["target"] : "windows" }
|
||||||
|
|
||||||
task run(dependsOn: classes, type: JavaExec) {
|
task run(dependsOn: classes, type: JavaExec){
|
||||||
main = project.mainClassName
|
main = project.mainClassName
|
||||||
classpath = sourceSets.main.runtimeClasspath
|
classpath = sourceSets.main.runtimeClasspath
|
||||||
standardInput = System.in
|
standardInput = System.in
|
||||||
@@ -29,7 +29,7 @@ task run(dependsOn: classes, type: JavaExec) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task dist(type: Jar, dependsOn: classes) {
|
task dist(type: Jar, dependsOn: classes){
|
||||||
from files(sourceSets.main.output.classesDirs)
|
from files(sourceSets.main.output.classesDirs)
|
||||||
from files(sourceSets.main.output.resourcesDir)
|
from files(sourceSets.main.output.resourcesDir)
|
||||||
from {configurations.compile.collect {zipTree(it)}}
|
from {configurations.compile.collect {zipTree(it)}}
|
||||||
@@ -45,7 +45,7 @@ task dist(type: Jar, dependsOn: classes) {
|
|||||||
if(target == "linux") exclude('**.dll', "**.dylib")
|
if(target == "linux") exclude('**.dll', "**.dylib")
|
||||||
archivesBaseName = appName + "-" + target
|
archivesBaseName = appName + "-" + target
|
||||||
|
|
||||||
manifest {
|
manifest{
|
||||||
attributes 'Main-Class': project.mainClassName
|
attributes 'Main-Class': project.mainClassName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user