📄 gamehigh.java
字号:
private void InitDelay()
{
m_delay=0; //主逻辑处理频率
m_delaygamearea=0; //游戏区刷新率
m_delayotherarea=0; //主游戏区加速下降速率
m_delayview=0; //预览区刷新率
// m_delayinfo=0; //道具区或信息区刷新率
}
public byte GetRandCell(int Maxdata)
{
return (byte)((m_randplay.nextInt()>>>1)%Maxdata);
}
private byte GetIndexToChair(int index)
{
int chair=-1;
chair=MyChair+index;
chair%=player_num;
return (byte)chair;
}
// private byte GetChairToIndex(int chair){
// int tmp=-1;
// tmp=(chair-MyChair+player_num)%player_num;
// return (byte)tmp;
// }
private void AddPlay(MoleActor actor,byte chair)
{
if(chair<0 || chair>=player_num)return;
if(havebody[chair]==false)
{
havebody[chair]=true;
havenums++;
//创建此玩家信息
m_play[chair].CreatPlayer(actor,chair);
if(actor.isReady()){
m_play[chair].SetReady(true);
}
}
}
private void DelPlay(int chair)
{
if(chair<0 || chair>=player_num)
return;
if(havebody[chair]==true)
{
m_play[chair].QuitGame();
havebody[chair]=false;
havenums--;
}
}
private void DrawBack(Graphics m_g,int leftx,int topy,int BackWidth,int BackHeight)
{
m_g.setColor(66,142,165);
m_g.fillRoundRect(leftx,topy,BackWidth,BackHeight,16,16);
m_g.setColor(166,200,200);
m_g.drawRoundRect(leftx+1,topy+1,BackWidth-2,BackHeight-2,16,16);
}
private void DrawBack(Graphics m_g,int BackWidth,int BackHeight)
{
int leftx=(SCREEN_WIDTH-BackWidth)/2;
int topy=(SCREEN_HEIGHT-BackHeight)/2;
DrawBack(m_g,leftx,topy,BackWidth,BackHeight);
}
private void DrawArea(Graphics m_g)
{
M_PaintOther(m_g);
M_PaintBottom(m_g);
M_PaintGameArea(m_g);
M_PaintView(m_g);
}
private void StartGameScen()
{
//playMusic(MUSIC_START,1,false);
// tool_use_time=0;
Index10To0=0;
gamenums=0;
// temp_add_ceng=0;
MyGameNow=false;
ThisGamePlayed=false;
for(int chair=0;chair<player_num;chair++)
{
if(havebody[chair]==true)
{
if(m_play[chair].IsReady()==true)
{
m_play[chair].InitRusHigh();
m_play[chair].SetStart();
if(chair==MyChair)
{
ThisGamePlayed=true;
}
gamenums++;
}
}
}
DaoJuToIndex=0;
for(int i=0;i<player_num;i++)
{
losebody[i]=false;
}
CellDownNum=0;
MyLevel=0;
MyLines=0;
llt=0;
OurGameNow=true;
duiwu_judge=false;
MyDJAddSpeed=0; //加速道具作用秒数
MyDJDecSpeed=0; //减速道具作用秒数
RP=Math.abs(m_randplay.nextInt()%10);
// zd_judge=0; //绘制炸弹 1:满级发送 2:连销发送 3:接到 4: 对自己
for(int i=0;i<player_num*2;i++){
zd_x[i]=0;//绘制炸弹xy
zd_y[i]=0;
}
for(int i=0;i<player_num;i++){
zd_xy[i]=false;
bz_num[i]=0; //炸弹动画的帧数
zd_judge[i]=0;
}
zd_judge_bool=false;
busyRun=false;
if(ThisGamePlayed==true)
{
LowCoinExitText.delete(0,LowCoinExitText.length());
Mystyle=GetRandCell(MAXBASESTYLE);
nextstyle=GetRandCell(MAXBASESTYLE);
nextstyle2=GetRandCell(MAXBASESTYLE);
m_play[MyChair].setnowstyle(Mystyle);
m_play[MyChair].SetCenterinfo((byte)inity,Mystyle);
m_play[MyChair].SetGoData(3);
this.gotoScenario(SCENARIO_PLAY);
BakNowSCENLIST();
this.InitDelay();
this.ReflashGameArea(true);
this.ReflashOtherArea(false);
Indexgogo=15;
}
}
private void BakNowSCENLIST()
{
MyLastScen=this.currentScenario;
}
private void GotoLastSCENLIST()
{
gotoScenario(MyLastScen);
}
private void ClearFxPoint()
{
bombindex=0;
for(int i=0;i<bombpoint.length;i++)
{
bombpoint[i][0]=-1;
bombpoint[i][1]=-1;
}
// m_fxpoint.ExitFxPoint();
}
private void ShowChatinfo(String info,boolean bool)
{
SysChatMode=false;
chatMode = bool;
ChatShow.delete(0,ChatShow.length());
ChatShow.append(info);
ChatLength=ChatShow.length()*textwidth;
ChatInfoShowx=SCREEN_WIDTH;
ShowDelay=2;
lt_tx=0;
}
private void UpdataGameData(int Chair,int score,int winCnt,int loseCnt,int drawCnt)
{
if(gm.getGameType()==1)
score=0;
gm.updateGameData( m_play[Chair].m_actorinfo.getActorID(),
score,
winCnt,
loseCnt,
drawCnt
);
}
private void DoChatTextTimer()
{
if(this.ChatLength>0&& ShowDelay==0)
{
if(ChatInfoShowx<-ChatLength)
{
lt_tx-=10;
if(lt_tx<=0){
ChatShow.delete(0,ChatShow.length());
ChatLength=0;
AfficheMode=false;
}
}
else{
if(lt_tx<SCREEN_WIDTH){
lt_tx+=10;
}
else{
ChatInfoShowx-=3;
}
}
}
}
private boolean KUANG(Graphics m_g,int s_x,int s_y,int width,int height,boolean cd){
boolean type=true;
if(cd){
if(kuang_tx<=width){
kuang_tx+=width/10;
s_x=(s_x+width/2)-kuang_tx/2;
width=kuang_tx;
type=false;
}
else{
can_push=true;
}
}
m_g.setColor(skin[12]);
m_g.fillRoundRect(s_x,s_y,width,height,25,25);
draw_bian(m_g,s_x,s_y+db_xy,0,height-db_xy*2,1,0);
draw_bian(m_g,s_x+db_xy,s_y,width-db_xy*2,0,0,1);
draw_bian(m_g,s_x+width+1,s_y+db_xy,0,height-db_xy*2,-1,0);
draw_bian(m_g,s_x+db_xy,s_y+height+1,width-db_xy*2,0,0,-1);
//drawFrame(m_g,FRAME_DBDA,s_x,s_y,MIRRORHORI,Graphics.LEFT | Graphics.TOP);
drawDB_lu(m_g,s_x,s_y);
drawDB_ru(m_g,s_x+width,s_y);
drawDB_ld(m_g,s_x,s_y+height);
drawDB_rd(m_g,s_x+width,s_y+height);
//drawFrame(m_g,FRAME_DBDA,s_x+width,s_y,0,Graphics.RIGHT | Graphics.TOP);
//drawFrame(m_g,FRAME_DBDA,s_x,s_y+height,ROTATE180,Graphics.LEFT | Graphics.BOTTOM);
// drawFrame(m_g,FRAME_DBDA,s_x+width,s_y+height,ROTATE90,Graphics.RIGHT | Graphics.BOTTOM);
return type;
}
private boolean NewText(Graphics m_g,int s_x,int s_y,int width,int height,int b_num1,int b_num1_num,int b_num2,int b_num2_num){
if(!KUANG(m_g,s_x,s_y,width,height,true)){
return false;
}
NewDrawButt(m_g,b_num1,b_num1_num,0,SCREEN_WIDTH/2-50-b_num1_num*2,s_y+height-10,true,chose_judge?true:false);
NewDrawButt(m_g,b_num2,b_num2_num,0,SCREEN_WIDTH/2+10+b_num2_num*2,s_y+height-10,true,chose_judge?false:true);
// drawFrame(m_g,FRAME_LIAN1+lnum,s_x+width/6,s_y+12,0,Graphics.LEFT|Graphics.BOTTOM);
return true;
}
private void FormatTextout(Graphics m_g,String str)
{
int totallen=str.length()*textwidth; //文字总长度
int backlines=1; //行数
int backwidth=0; //背景框尺寸
int backheight=0;
int textlinewidth=0; //一行的文字长度
backwidth=SCREEN_WIDTH;
backlines=totallen/(SCREEN_WIDTH-textwidth*2)+1;
textlinewidth=(SCREEN_WIDTH-textwidth*2)/textwidth;
backheight=backlines*textheight+textheight*2;
int topy=(SCREEN_HEIGHT-backheight)/2+textheight;
if(!KUANG(m_g,0,topy-10,backwidth,backheight,true)){
return;
}
m_g.setColor(0x9c5108);
int strindex=0;
int y=0;
for(y=0;y<backlines&&strindex+textlinewidth<str.length();y++)
{
m_g.drawSubstring(str,strindex,textlinewidth,textwidth,topy+y*textheight,Graphics.LEFT|Graphics.TOP);
strindex+=textlinewidth;
}
m_g.drawSubstring(str,strindex,str.length()-strindex,textwidth,topy+y*textheight,Graphics.LEFT|Graphics.TOP);
}
private String getEncodedString(byte[] data, int off, int len)
{
String str="";
for(int i=off;i+1<off+len;i+=2){
str+=(char)(((data[i+1]<<8)&0xff00)|((data[i])&0xff));
}
return str;
}
//========================场景逻辑驱动=========================//
// private void onChatInfoTimer()
// {
// int width=(SCREEN_WIDTH-MENUBACKWIDTH-5)-25;
// int lenght=SysChatText[ChatTextSelIndex-1].length()*textwidth;
// if(ChatTextSelIndex<0)
// return;
//
// if(lenght>width)
// {
// if(ChatTextleftx<-(lenght-width)-32 && ChatTextMoveFlag<0)
// {
// ChatTextMoveFlag=-ChatTextMoveFlag;
// }
// else
// {
// if(ChatTextleftx>32 && ChatTextMoveFlag>0)
// {
// ChatTextMoveFlag=-ChatTextMoveFlag;
// }
// }
// }
// else
// {
// if(ChatTextleftx<-32 && ChatTextMoveFlag<0)
// {
// ChatTextMoveFlag=-ChatTextMoveFlag;
// }
// else
// {
// if(ChatTextleftx>32 && ChatTextMoveFlag>0)
// {
// ChatTextMoveFlag=-ChatTextMoveFlag;
// }
// }
// }
//
// ChatTextleftx+=ChatTextMoveFlag;
// ReflashFullArea();
// }
private void DoOneSecond()
{
// System.err.println(ScoreDelay);
if(MyLookOn==true || MyChair<0)
return;
if(ShowDelay>0)
ShowDelay--;
if(ScoreDelay>0)
ScoreDelay--;
if(OurGameNow==false)
{
if(Index10To0>0)
{
if(Index10To0==10)
{
if(this.m_play[MyChair].IsReady()==false)
ShowChatinfo("游戏将在10秒后开始,请赶快按[确认]键开始。",true);
else
ShowChatinfo("10秒后开始游戏",true);
ShowDelay=2;
}
Index10To0--;
}
}
if(gamemyself==true || MyGameNow==true)
{
if(MyDJAddSpeed>0)
MyDJAddSpeed--;
if(MyDJDecSpeed>0)
MyDJDecSpeed--;
}
}
private void onPlayTimer()
{
// ====================粒子爆炸动画===================//
if(m_fxpoint.m_pointnums>0)
{
m_boolfxpoint=m_fxpoint.ProcessAllFxPoint();
}
else
{
m_boolfxpoint=false;
}
if(m_play[MyChair].del[0]!=0){
if(del_move==del_move_num.length-1){
m_play[MyChair].del_fk();
del_move=0;
// playMusic(MUSIC_BOMB,1,false);
// System.err.println(MyChair+"播放爆炸声音");
}
del_move++;
ReflashGameArea(true);
}
// if(tool_use_time>0)
if(gamemyself==false)
{
//=========================开始GO动画===============//
if(Indexgogo>0 && MyChair>=0)
{
Indexgogo--;
if(Indexgogo==0)
{
m_play[MyChair].ClearGoData();
ReflashGameArea(true);
MyGameNow=true;
}
else
{
if(Indexgogo==12){
m_play[MyChair].SetGoData(2);
ReflashGameArea(true);
}
else if(Indexgogo==9){
m_play[MyChair].SetGoData(1);
ReflashGameArea(true);
}
else if(Indexgogo==6){
m_play[MyChair].SetGoData(0);
ReflashGameArea(true);
}
ReflashFullArea();
return;
}
}
if(OurGameNow==false || MyGameNow==false || MyLookOn == true)
{
ReflashFullArea();
return;
}
}
//连续按键处理
switch(NowKeyDOWN)
{
case 1:
case 2:
if(MyDJAddSpeed>0 )
{
if(m_delay>3){
m_delay=3;
}
// break;
}
if(m_delay>1)
{
m_delay--;
ReflashFullArea();
return;
}
m_delay=2;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -