Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
子毅 董 committed Feb 2, 2021
1 parent e42d7e7 commit e0d89fa
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 14 deletions.
Binary file modified app/libs/游戏引擎7e.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions app/src/main/assets/data/size.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
45,55,70,90,100,130
0.4,0.3,0.2,0.1,0,0
40,60,80,90,115,140
0.2,0.3,0.4,0.1,0,0
33 changes: 27 additions & 6 deletions app/src/main/java/com/hcdxg/mygame/CustomView.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.media.AudioManager;
import android.media.SoundPool;
import android.view.KeyEvent;
import android.widget.EditText;
import android.widget.Toast;

import com.uxyq7e.test.Button;
Expand Down Expand Up @@ -92,8 +93,20 @@ public boolean down()
@Override
public boolean up()
{
exportBlocks("test");
Toast.makeText(MainActivity.ma,"导出完成",Toast.LENGTH_SHORT).show();
File save_dir=new File(Screen.FILE_SD, MainActivity.exp_dir_name);
if(!save_dir.exists()) save_dir.mkdirs();

final EditText et=new EditText(MainActivity.ma);
//et.setEms(9);
new AlertDialog.Builder(MainActivity.ma).setTitle("输入名称")
.setIcon(R.drawable.ic_launcher)
.setView(et).setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
exportBlocks(et.getText().toString());
Toast.makeText(MainActivity.ma,"导出至:手机储存/"+MainActivity.exp_dir_name+"/"+et.getText().toString()+".zip",Toast.LENGTH_SHORT).show();
}
}).setNegativeButton("取消",null).show();
return true;
}
});
Expand Down Expand Up @@ -196,7 +209,7 @@ public boolean down() {

@Override
public boolean up() {
Screen.sp.play(((BlockItem)gv.user_data).sound, 1, 1, 1, 0, 1);
sp.play(((BlockItem)gv.user_data).sound, 1, 1, 1, 0, 1);
return true;
}
});
Expand Down Expand Up @@ -254,8 +267,9 @@ public boolean changeSound(GameView gv,String path){

BlockItem bl=(BlockItem)gv.user_data;
sp.unload(bl.sound);
bl.sound=Screen.sp.load(path,1);
bl.sound_data=readFile(new File(MainActivity.data_dir, path));

bl.sound=sp.load(path,1);
bl.sound_data=readFile(new File(path));
return true;
}

Expand Down Expand Up @@ -284,6 +298,13 @@ public void reload(){
Block.load_size_rate();
sp.release();
sp=new SoundPool(10, AudioManager.STREAM_MUSIC,100);
sp.setOnLoadCompleteListener(new SoundPool.OnLoadCompleteListener() {
@Override
public void onLoadComplete(SoundPool soundPool, int sampleId,
int status) {
System.out.println("load:"+sampleId);
}
});
for(int i=0;i<Block.ball_size.length;i++){
addItem(BitmapFactory.decodeFile(new File(MainActivity.data_dir,i+".png").toString()),
Block.ball_size[i],Block.ball_rate[i],new File(MainActivity.data_dir, i+".wav"),i);
Expand All @@ -299,7 +320,7 @@ public void reload(){
public void exportBlocks(String name){
saveChages();
try {
ZipUtil.zip(MainActivity.data_dir, new File(Screen.FILE_SD, name+".zip").toString());
ZipUtil.zip(MainActivity.data_dir, new File(Screen.FILE_SD, MainActivity.exp_dir_name+"/"+name+".zip").toString());
} catch (IOException e) {
e.printStackTrace();
}
Expand Down
12 changes: 6 additions & 6 deletions app/src/main/java/com/hcdxg/mygame/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ public Game(){
body_remove=new Vector<Body>();
caidan=false;
//addblock();
create(-5,810,10,2220,0,0.5f,0.3f,0,-2);
create(1085,810,10,2220,0,0.5f,0.3f,0,-2);
create(540,1925,1080,10,0,0.5f,0.3f,0,-1);
create(-5,810,10,2220,0,0.5f,0.1f,0,-2);
create(1085,810,10,2220,0,0.5f,0.1f,0,-2);
create(540,1925,1080,10,0,0.5f,0.1f,0,-1);
//Body bbo=create(540,-5,1080,10,0,0.5f,0.3f,0,-2);
//bbo.getFixtureList().m_filter.groupIndex=-1;
Button back=new Button(0,0,120,120);
Expand Down Expand Up @@ -195,11 +195,11 @@ public void addblock(){
public void addblock(int id, Block bpos){
Body bo;
Vec2 center=bpos.getposition_center();
float mass=(float)Math.pow(Block.ball_size[id]/10f,2);
float mass=(float)Math.pow(Block.ball_size[id]/100f,2);
if(id>=0)
bo=createc(center.x,center.y,mass,bpos.angle,createc_fix(Block.ball_size[id],mass,0.2f,0.3f,count));
bo=createc(center.x,center.y,mass,bpos.angle,createc_fix(Block.ball_size[id],mass,0.2f,0.1f,count));
else
bo=createc(center.x,center.y,mass,bpos.angle,createc_fix(75,mass,0.2f,0.3f,count));
bo=createc(center.x,center.y,mass,bpos.angle,createc_fix(75,mass,0.2f,0.1f,count));
Block blo=new Block(bo,id);
blo.setposition_center(bpos.x,bpos.y);
blo.id=count;
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/com/hcdxg/mygame/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class MainActivity extends AppCompatActivity
public static SharedPreferences fs;
public static boolean creat;
public static String data_dir;
public static String exp_dir_name="synthesis";

public static MainActivity ma;

Expand Down

0 comments on commit e0d89fa

Please sign in to comment.