?? main.java
字號:
/**************************************************************
* ************************************************************
* 此項目是新框架“悠樂空間_棋牌”下的新項目:攀枝花麻將
* 從項目工程的命名、具體游戲的包的命名都遵從公司規定的命名規則
* 新框架下項目最大的特征就是在收發報文機制方面做了較大的調整
* @date :2008-11-10 Monday
* @author :Welliam
* ************************************************************
**************************************************************/
import javax.microedition.io.ConnectionNotFoundException;
import javax.microedition.lcdui.Display;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.microedition.rms.RecordStore;
public class Main extends MIDlet
{
static Main midletInstance;
static Display s_display;
static Hall s_hall;
private String rmsName = "IPTVRMS";
private RecordStore recordStore;
public Main()
{
// TODO 自動生成構造函數存根
midletInstance = this;
}
protected void destroyApp(boolean arg0)
{// throws MIDletStateChangeException {
// TODO 自動生成方法存根
if (midletInstance != null)
midletInstance = null;
notifyDestroyed();
}
protected void pauseApp()
{
// TODO 自動生成方法存根
}
protected void startApp() throws MIDletStateChangeException
{
// TODO 自動生成方法存根
GB2312CovertUTF.readUTF();
Hall.minStartCondition = 1;
Hall.Test =false;//給測試用true 給平臺用false
//需要用戶名密碼的用TRUE 需要令牌環的用false
//Def.bDgg=false;
System.out.println("Def.bDgg"+Def.bDgg+"Hall.Test"+Hall.Test);
if(Def.bDgg)
{
Hall.accountID = 142;
//Hall.accountID = 10006940;
//Hall.accountID = 10006941;
//Hall.accountID = 10006942;
// Hall.accountID = 10006943;
// Hall.accountID = 10006944;
// Hall.accountID = 10006945;
Hall.playerpsw = "96e79218965eb72c92a549dd5a330112";
// Hall.server = new String("192.168.18.16");
// Hall.port = 32323;
// Hall.server = new String("192.168.0.179");
// Hall.port = 2008;
// Hall.server = new String("192.168.0.80");
// Hall.port = 5123;
//Hall.server = new String("118.123.242.9");
Hall.server = new String("192.168.0.107");
Hall.port = 188;
//Hall.token="1541f0f50ae5290cf8a661e1d53375f889a104d3c39ce9ce";
//System.out.println(Hall.Test+"debug"+Hall.token);
}else
{
try{
rmsOpen();
byte[] tmp1=recordStore.getRecord(1);
Hall.accountID = Integer.parseInt((new String(tmp1)).trim());
byte[] tmp2 =recordStore.getRecord(2);
Hall.roomId = Integer.parseInt((new String(tmp2)).trim());
byte[] tmp3 =recordStore.getRecord(3);
Hall.server = (new String(tmp3)).trim();
byte[] tmp4 =recordStore.getRecord(4);
Hall.port = Integer.parseInt((new String(tmp4)).trim());
byte[] tmp5 =recordStore.getRecord(5);
Hall.playerpsw = (new String(tmp5)).trim();
//System.out.println(Hall.Test+"try"+Hall.token);
}
catch(Exception e)
{
e.printStackTrace();
/*Hall.server = getAppProperty("server");
Hall.url = getAppProperty("url");
Hall.port = Integer.parseInt(getAppProperty("port"));
Hall.roomId = Integer.parseInt(getAppProperty("roomid"));
Hall.accountID = Integer.parseInt(getAppProperty("accountid"));
Hall.playerpsw = getAppProperty("roompsw");*/
Hall.server = getAppProperty("server");
Hall.url = getAppProperty("url");
Hall.port = Integer.parseInt(getAppProperty("port"));
//Hall.server = new String("192.168.0.179");
//Hall.port = 2008;
System.out.println("Hall.server"+Hall.server+Hall.Test+"exceptiontoken"+Hall.token);
if(Hall.Test)
{
Hall.accountID = Integer.parseInt(getAppProperty("accountid"));
Hall.playerpsw = getAppProperty("playerpsw");
System.out.println("id"+Hall.accountID+"Hall.playerpsw"+Hall.playerpsw);
}
else
{
// Hall.accountID = Integer.parseInt(getAppProperty("accountid"));
//System.out.println("getAppProperty"+getAppProperty("accountid"));
// Hall.accountID=142;
// Hall.server = new String("192.168.0.107");
// Hall.port = 188;
Hall.token = getAppProperty("token");
// Hall.playerpsw = "96e79218965eb72c92a549dd5a330112";
// System.out.println("Hall.accountIDis"+Hall.accountID+"Hall.token"+Hall.token);
}
}
}
if(s_hall==null)s_hall = new Hall(this);
}
//跳轉頁面
public void goToReturnURL()
{
Runtime.getRuntime().gc();
try
{
System.out.println("hall.url ========="+ Hall.url);
platformRequest(Hall.url);
}
catch (ConnectionNotFoundException e)
{
e.printStackTrace();
}
//加下面這段是因為長虹的盒子會跳轉不成功,沒有反映,因此需要加這段來結束游戲
try
{
destroyApp(true);
}catch(Exception e)
{
System.out.println(e.toString());
}
}
////////////////////RMS////////////////////////////
// 打開RecordStore
public void rmsOpen()throws Exception
{
try
{
recordStore=RecordStore.openRecordStore(this.rmsName,true);
}catch(Exception e)
{
// canvas.paintText("openRecordStore Failed!");
return;
}
}
// 關閉RecordStore
public void rmsClose()throws Exception
{
if(recordStore!=null)
{
try
{
recordStore.closeRecordStore();
}catch(Exception e)
{
}
}
}
// 列出所有存在的RecordStore
public void rmsListRecordStores()throws Exception
{
try{
if(RecordStore.listRecordStores()!=null)
{
for(int i=0;;i++)
{
if(RecordStore.listRecordStores()[i]!=null)
{
// canvas.paintText(RecordStore.listRecordStores()[i]);
}
else
{
break;
}
}
}
else
{
}
// canvas.paintText("RecordStore is empty!");
}catch(Exception e)
{
throw new Exception(this.rmsName+"::open::"+e);
}
}
// 獲取RecordStore
public RecordStore rmsGetRecordStore()
{
return this.recordStore;
}
// 獲取RecordStore的名字
public String rmsGetRMSName()
{
return this.rmsName;
}
// static Main midletInstance;
// static Hall s_game;
// static Display s_display;
// private RecordStore recordStore;
// private String rmsName = "IPTVRMS";
// public static String returnurl = "";//加上這個參數--返回頁面的地址
// public Main() {
// midletInstance = this;
// }
//
// protected void destroyApp(boolean arg0){// throws MIDletStateChangeException {
// if (midletInstance != null)
// midletInstance = null;
// notifyDestroyed();
// }
//
// protected void pauseApp() {
// // TODO 響應外部中斷
//
// }
//
// //跳轉頁面
// public void goToReturnURL(){
// try {
// platformRequest(returnurl);
// } catch (ConnectionNotFoundException e) {
// e.printStackTrace();
// }
//
//
// //加下面這段是因為長虹的盒子會跳轉不成功,沒有反映,因此需要加這段來結束游戲
// try{
// destroyApp(true);
// }catch(Exception e){
// System.out.println(e.toString());
// }
// }
//
// protected void startApp() throws MIDletStateChangeException {
// GB2312CovertUTF.readUTF();
// if(Def.bDgg)
// returnurl = "http://60.190.228.110/sichuan/";
// else
// returnurl = getAppProperty("returnurl");//機頂盒需要從頁面上獲取返回頁面的地址,游戲調用頁面也會加上這個參數,參數名就用“returnurl”
// if(Def.bDgg){
//
//// Hall.s_server = new String("60.190.228.61");
//// Hall.s_port = 8103;
//
//// Hall.s_server = new String("172.16.4.42");
//// Hall.s_port = 8089;
// // ==========================================================
// /**外網:血戰到底 viewXuedi 192.168.1.51 8151 溫沛煉 201100403 麻將類**/
//// Hall.s_server = new String("192.168.0.163");//080602 AM 連湯湯電腦
//// Hall.s_port = 8164;//080602 AM 連湯湯電腦
//// Hall.s_port = 8063;//080602 AM 連湯湯電腦
//
// //Hall.s_server = new String("192.168.1.126");//080528 PM
// Hall.s_server = new String("192.168.0.171");//080528 PM
// Hall.s_port = 8152;//080919 PM
//
// Hall.s_roomid = 201101403;//201100403;//080528 PM
// //Hall.s_roomid = 201101401;//080528 PM
//
// Hall.s_acountid = 11101773;/*2008-4-23 AM*///welliam
//// Hall.s_acountid = 8059158;
//// Hall.s_acountid = 11101774;
//// Hall.s_acountid = 11101775;
//// Hall.s_acountid = 11100534;
//
// //Hall.s_acountid = 11101776;
// Hall.s_roompsw = "96e79218965eb72c92a549dd5a330112";
//
// }else{
// try{
// rmsOpen();
// byte[] tmp1=recordStore.getRecord(1);
// Hall.s_acountid = Integer.parseInt((new String(tmp1)).trim());
// byte[] tmp2 =recordStore.getRecord(2);
// Hall.s_roomid = Integer.parseInt((new String(tmp2)).trim());
// byte[] tmp3 =recordStore.getRecord(3);
// Hall.s_server = (new String(tmp3)).trim();
// byte[] tmp4 =recordStore.getRecord(4);
// Hall.s_port = Integer.parseInt((new String(tmp4)).trim());
// byte[] tmp5 =recordStore.getRecord(5);
// Hall.s_roompsw = (new String(tmp5)).trim();
// }catch(Exception e){
// e.printStackTrace();
// Hall.s_server = getAppProperty("server");
// Hall.s_port = Integer.parseInt(getAppProperty("port"));
// Hall.s_roomid = Integer.parseInt(getAppProperty("roomid"));
// Hall.s_acountid = Integer.parseInt(getAppProperty("accountid"));
// Hall.s_roompsw = getAppProperty("roompsw");
// }
// }
// if (s_game == null) {
// s_game = new Hall(this);
// }
// if(Def.bCon&&Def.bCMID){
// s_game._commu.connect();
// s_game._commu.checkServer();
// }
// }
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -