📄 gamehigh.java
字号:
}
// System.err.println("MyChair="+MyChair+" 结束");
}
public void onPlayerQuit(MoleActor arg0) {
busyRun=true;
Index10To0=0;
DelPlay(arg0.getLocation());
busyRun=false;
ReflashOtherArea(true);
}
public void onMessage(Message arg0)
{
if(gm==null)
return;
int protostyle=arg0.getID();
int chair1=arg0.getLocation();
if(chair1<0 || chair1>=player_num)
return;
busyRun=true;
// System.err.println(MyChair+"号收到"+protostyle);
switch(protostyle)
{
case EM_DELCENG:
{
if(chair1==MyChair)
break;
byte len=arg0.getByte();
m_play[chair1].DelBottomCell(len);
this.ReflashOtherArea(true);
}
break;
case EM_LOWCOIN:
{
int len=arg0.getInt();
byte buf[]=new byte[len];
for(int ii=0;ii<len;ii++){
buf[ii]=arg0.getByte();
}
// arg0.getByteArray(buf,0,len);
LowCoinExitText.delete(0,LowCoinExitText.length());
String str=this.getEncodedString(buf,0,len);
LowCoinExitText.append(str);
buf=null;
}
break;
case EM_HANDUP:
{
if(OurGameNow==false)
{
if(chair1==MyChair)
MeRealHandup=true;
m_play[chair1].SetReady(true);
ReflashOtherArea(true);
}
}
break;
case EM_STARTFAIL:
{
if(chair1!=MyChair)
break;
OurGameNow=true;
m_play[chair1].SetReady(false);
ReflashOtherArea(true);
gotoScenario(SCENARIO_PLAYMYSELF);
BakNowSCENLIST();
}
break;
case EM_ASKHASPLAY:
{
if(chair1!=MyChair)
break;
// System.err.println(MyChair+" a12");
HasAskret=true;
MyGameNow=false;
byte hasplay = arg0.getByte();
if(hasplay==1)
{
OurGameNow=true;
// chatindex=0;
gotoScenario(SCENARIO_PLAYMYSELF);
BakNowSCENLIST();
}
else
{
gotoScenario(SCENARIO_HANDUP);
OurGameNow=false;
BakNowSCENLIST();
}
}
break;
case EM_QUICKREADY:
Index10To0=10;
playMusic(MUSIC_HURRY,1,true);
// System.err.println(MyChair+"播放催促声音");
break;
case EM_TEAM: //获取玩家组队信息
if(chair1==this.MyChair)
break;
m_play[chair1].m_team=arg0.getByte();
break;
case EM_ASKHASTEAM: //之前的组队信息
{
if(chair1!=MyChair)
break;
byte tmpteam[] = new byte[player_num];
for(int chair=0;chair<player_num;chair++)
{
tmpteam[chair]=arg0.getByte();
if(havebody[chair]==true && (tmpteam[chair]>=0 && tmpteam[chair]<player_num))
{
busyRun=true;
m_play[chair].m_team=tmpteam[chair];
busyRun=false;
}
}
tmpteam=null;
m_play[MyChair].m_team=0;
if(HasAskret==false)
{
HasAskret=true;
this.ReflashFullArea();
}
else
this.ReflashOtherArea(true);
}
break;
case EM_START: //开始消息
{
if(OurGameNow==true)
break;
OurGameNow=true;
gamemyself=false;
MyGameNow=false;
ThisGamePlayed=false;
// NowMenuOpen=false;
if(this.m_play[MyChair].IsReady()==false || MeRealHandup==false)
{//没有举手或举手没有成功则无法开始游戏
this.m_play[MyChair].SetReady(false);
m_play[MyChair].InitRusHigh();
// chatindex=0;
InitDelay();
for(int chair=0;chair<player_num;chair++)
{
if(havebody[chair]==true)
{
if(m_play[chair].IsReady()==true)
{
m_play[chair].SetStart();
}
}
}
gotoScenario(SCENARIO_PLAYMYSELF);
BakNowSCENLIST();
break;
}
//读取随机种子
byte randpip = arg0.getByte();
m_randplay = null;
m_randplay = new Random(randpip);
if(randpip<0){
DJC=false;
}
else{
DJC=true;
}
//进入游戏场景
StartGameScen();
if(chatMode){
ChatShow.delete(0,ChatShow.length());
Index10To0=0;
ChatLength=0;
AfficheMode=false;
}
playMusic(MUSIC_START,1,true);
// System.err.println(MyChair+"播放开始声音");
}
break;
case EM_END: //一局结束消息
Indexgogo=0;
// NowMenuOpen=false;
gamemyself=false;
MyGameNow=false;
OurGameNow=false;
HasAskret=true;
ScoreDelay=1;
llt=0;
for(int chair=0;chair<player_num;chair++)
{
if(havebody[chair]==true)
{
busyRun=true;
m_play[chair].InitRusHigh();
if(ThisGamePlayed==false)
m_play[chair].SetEnd();
busyRun=false;
}
}
if(ThisGamePlayed==false)
{
this.gotoScenario(SCENARIO_HANDUP);
this.BakNowSCENLIST();
}
ThisGamePlayed=false;
this.ClearFxPoint();
this.InitDelay();
this.ReflashFullArea();
break;
// case EM_CHAT: //聊天消息
// if(chair1==this.MyChair)
// break;
// gm.receiveChatMsg(arg0);
// break;
//
case EM_LOSETEAM://一队玩家失败时,可以从服务器得到确切的扣分和名次
{
System.out.println("收到EM_LOSETEAM的消息");
if(OurGameNow==false)
break;
//获取失败人数
int losenums=arg0.getInt();
if(losenums<0 || losenums>player_num)
break;
//初始化名次数组
int loseplayer[]=new int[losenums];
int losecoin[]=new int[losenums];
//获取失败玩家名次数据
for(int i=0;i<losenums;i++)
{
loseplayer[i]=arg0.getInt();
if(gm.getGameType()==1)
{
losecoin[i]=arg0.getInt();
}
}
busyRun=true;
boolean flag=false;
if(gm.getGameType()==1)
{
for(int i=0;i<player_num;i++)
{
m_uiddata[i]=-1;
m_coindata[i]=0;
}
}
for(int i=0;i<losenums;i++)
{
int losechair=loseplayer[i]%10;
if(havebody[losechair]==true && (m_play[losechair].IsLosed()==true || m_play[losechair].IsGameNow()==true))
{
if(losechair==this.MyChair)
flag=true;
int losescore=loseplayer[i]/100;
int loseplace=((loseplayer[i]%100)/10);
m_play[losechair].SetPlace((byte)loseplace);
m_play[losechair].SetLose();
m_play[losechair].m_nowscore = losescore;
// System.err.println("胜利的分数11 "+losescore);
if(losebody[losechair]==false)
{//本地数据是否刷新标志
losebody[losechair]=true;
this.UpdataGameData(losechair,-losescore,0,1,0);
//更新金币
m_uiddata[losechair]=this.m_play[losechair].m_actorinfo.getActorID();
m_coindata[losechair]=-losecoin[i];
}
}
}
if(gm.getGameType()==1)
gm.updateCoinData(m_uiddata,m_coindata);
loseplayer = null;
losecoin = null;
busyRun=false;
ScoreDelay=-1;
if(flag==true)
{
InitDelay();
// System.err.println("进入得分界面2");
gotoScenario(SCENARIO_SCORE);
BakNowSCENLIST();
}
else
{
this.ReflashOtherArea(true);
}
}
break;
case EM_WINLOSE: //胜负消息
{
System.out.println("收到胜负的消息");
if(OurGameNow==false)
break;
Indexgogo=0;
//获取胜利人数
int winnums=arg0.getInt();
//获取失败人数
int losenums=arg0.getInt();
//初始化名次数组
int winplayer[]=new int[winnums];
int loseplayer[]=new int[losenums];
int losecoin[]=new int[losenums];
//获取胜利玩家凳子号
for(byte i=0;i<winnums;i++)
{
winplayer[i]=arg0.getInt();
}
int winscore=arg0.getInt();
int wincoin = 0;
if(gm.getGameType()==1)
{
wincoin = arg0.getInt();
}
//获取失败玩家名次数组
for(byte i=0;i<losenums;i++)
{
loseplayer[i]=arg0.getInt();
if(gm.getGameType()==1)
{
losecoin[i]=arg0.getInt();
}
}
busyRun=true;
ScoreDelay=5;
int[] coin=new int[player_num];
if(gm.getGameType()==1)
{
for(int i=0;i<player_num;i++)
{
m_uiddata[i]=-1;
m_coindata[i]=0;
coin[i]=0;
}
}
boolean myshowenable=false;
//获得胜利玩家名次得分数据
for(byte i=0;i<winnums;i++)
{
int winchair=winplayer[i]%10;
m_coindata[winchair]=wincoin;
if(havebody[winchair]==true)
{
if(winchair==MyChair)
{
myshowenable=true;
playMusic(MUSIC_WIN,1,true);
// System.err.println(MyChair+"播放胜利声音");
}
m_play[winchair].SetPlace((byte)1);
m_play[winchair].SetWin();
m_play[winchair].m_nowscore = winscore;
// System.err.println("胜利的分数"+winscore);
this.UpdataGameData(winchair,winscore,1,0,0);
//更新金币
m_uiddata[winchair]=this.m_play[winchair].m_actorinfo.getActorID();
coin[winchair]=wincoin;
}
}
//获得失败玩家名次得分数据
for(byte i=0;i<losenums;i++)
{
int losechair=loseplayer[i]%10;
m_coindata[losechair]=-losecoin[i];
if(havebody[losechair]==true && (m_play[losechair].IsLosed()==true || m_play[losechair].IsGameNow()==true))
{
if(losechair==MyChair)
myshowenable=true;
int losescore=loseplayer[i]/100;
int loseplace=(loseplayer[i]%100)/10;
m_play[losechair].SetPlace((byte)loseplace);
m_play[losechair].SetLose();
m_play[losechair].m_nowscore =losescore;
// System.err.println("胜利的分数22 "+losescore);
if(losebody[losechair]==false)
{
losebody[losechair]=true;
this.UpdataGameData(losechair,-losescore,0,1,0);
//更新金币
m_uiddata[losechair]=this.m_play[losechair].m_actorinfo.getActorID();
coin[losechair]=-losecoin[i];
}
}
}
if(gm.getGameType()==1)
gm.updateCoinData(m_uiddata,coin);
// chatindex=3;
winplayer = null;
loseplayer = null;
losecoin = null;
coin = null;
if(myshowenable==true)
{
this.InitDelay();
// System.err.println("进入得分界面1");
gotoScenario(SCENARIO_SCORE);
BakNowSCENLIST();
}
ScoreDelay=3;
AutoExit=0;
this.ReflashOtherArea(true);
busyRun=false;
}
break;
case EM_LOSE:
{
System.out.println("收到失败的消息");
if(this.OurGameNow==false)
break;
if(chair1==this.MyChair){
playMusic(MUSIC_LOSE,1,true);
// System.err.println(MyChair+"播放失败声音");
ScoreDelay=-1;
MyDJAddSpeed=0; //加速道具作用秒数
MyDJDecSpeed=0;
gotoScenario(SCENARIO_PLAYMYSELF);
this.BakNowSCENLIST();
this.InitDelay();
this.ReflashFullArea();
break;
}
busyRun=true;
m_play[chair1].SetLose();
busyRun=false;
this.ReflashOtherArea(true);
}
break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -