📄 menuwindow.java
字号:
}
private void initMenu_General( int[] aiItems )
{
m_menuContainer.m_iContainerType = CONTAINER_STACK;
m_menuContainer.setPadding((-3)/*@FONT_PADDING*/);
for (int i=0; i<aiItems.length; i++)
{
appendMenuItem( TorinoCanvas.getString( aiItems[i] ));
}
}
//#ifdef _IS_SPRINT
// private void initMenu_GameLobbyPrompt()
// {
// m_menuContainer.m_iContainerType = CONTAINER_NORMAL;
//
// // initalize "reset records?" prompt
// m_resetPrompt = new Window(m_canvas);
// m_resetPrompt.m_iContainerType = Window.CONTAINER_STACK;
// m_menuContainer.addToFront( m_resetPrompt );
// m_resetPrompt.setAlignment( Drawable.ALIGNH_CENTER | Drawable.ALIGNV_MIDDLE );
// m_resetPrompt.setPadding((-3)/*@FONT_PADDING*/);
//
// Label label = createMenuLabel( LABEL_NORMAL );
// label.setAlignment( Drawable.ALIGNH_CENTER );
// m_resetPrompt.addToBack(label);
// label.setText( STRING_REGISTER_ON );
//
// label = createMenuLabel( LABEL_NORMAL );
// label.setAlignment( Drawable.ALIGNH_CENTER );
// m_resetPrompt.addToBack(label);
// label.setText( STRING_GAME_LOBBY_Q );
//
// Window shelf = new Window( m_canvas );
// shelf.setDimensions(72/*@YESNO_SHELF_WIDTH*/,0);
// shelf.setAlignment( Drawable.ALIGNH_CENTER );
// m_resetPrompt.addToBack(shelf);
//
// m_yesLabel = createMenuLabel( LABEL_NORMAL );
// m_yesLabel.setAlignment( Drawable.ALIGNH_LEFT | Drawable.ALIGNV_MIDDLE );
// shelf.addToBack(m_yesLabel);
// m_yesLabel.setText( STRING_YES );
//
// m_noLabel = createMenuLabel( LABEL_HIGHLIGHT );
// m_noLabel.setAlignment( Drawable.ALIGNH_RIGHT | Drawable.ALIGNV_MIDDLE );
// shelf.addToBack(m_noLabel);
// m_noLabel.setText( STRING_NO );
//
// shelf.sizeToChildren();
// m_resetPrompt.sizeToChildren();
// }
//#endif
private boolean m_bConfigureButton;
private boolean m_bResetRecords;
//#ifdef _SPRINT_MRC
// private boolean m_bCancelLicense;
//#endif
private boolean m_bYesNo;
private Window m_itemStack;
private Label m_difficulty;
private Label m_difficultySelection;
//#ifndef _NO_SOUND
private Label m_sound;
private Label m_soundOnOff;
//#endif
private Label m_tips;
private Label m_tipsOnOff;
//#ifdef _MULTI_LANG
// private Label m_selectLang;
//#endif
private Label m_resetRecords;
//#ifdef _SPRINT_MRC
// private Label m_cancelLicense;
//#endif
//#ifndef _NO_ONLINE
//#ifndef _IS_SPRINT
// private Label m_changeName;
//#endif
//#endif
private Window m_resetPrompt;
private Label m_yesLabel;
private Label m_noLabel;
private int m_iSettingsCount;
private void initMenu_Settings()
{
m_menuContainer.m_iContainerType = CONTAINER_NORMAL;
m_bConfigureButton = false;
m_bResetRecords = false;
//#ifdef _SPRINT_MRC
// m_bCancelLicense = false;
//#endif
m_bYesNo = false;
m_itemStack = new Window(m_canvas);
m_itemStack.m_iContainerType = Window.CONTAINER_STACK;
m_itemStack.setDimensions( m_iWidth-4, 0 );
m_menuContainer.addToFront( m_itemStack );
m_itemStack.setAlignment( Drawable.ALIGNH_CENTER );
m_itemStack.setPadding((-3)/*@FONT_PADDING*/);
Window container = new Window(m_canvas);
// difficulty selection
container = new Window(m_canvas);
container.setDimensions( m_iWidth-4, 0 );
container.setAlignment( Drawable.ALIGNH_CENTER );
m_itemStack.addToBack( container );
m_difficulty = createMenuLabel( LABEL_NORMAL );
m_difficulty.setAlignment( Drawable.ALIGNH_LEFT | Drawable.ALIGNV_MIDDLE );
container.addToBack(m_difficulty);
m_difficulty.setText( STRING_DIFFICULTY );
m_difficultySelection = createMenuLabel( LABEL_NORMAL );
m_difficultySelection.setAlignment( Drawable.ALIGNH_RIGHT | Drawable.ALIGNV_MIDDLE );
container.addToBack(m_difficultySelection);
m_difficultySelection.setText( STRING_EASY + m_data.iDifficulty );
container.sizeToChildren();
//#ifndef _NO_SOUND
// sound selection
container = new Window(m_canvas);
container.setDimensions( m_iWidth-4, 0 );
container.setAlignment( Drawable.ALIGNH_CENTER );
m_itemStack.addToBack( container );
m_sound = createMenuLabel( LABEL_NORMAL );
m_sound.setAlignment( Drawable.ALIGNH_LEFT | Drawable.ALIGNV_MIDDLE );
container.addToBack(m_sound);
m_sound.setText( STRING_SOUND );
m_soundOnOff = createMenuLabel( LABEL_NORMAL );
m_soundOnOff.setAlignment( Drawable.ALIGNH_RIGHT | Drawable.ALIGNV_MIDDLE );
container.addToBack(m_soundOnOff);
if (m_data.bDisableSound)
m_soundOnOff.setText( STRING_OFF );
else
m_soundOnOff.setText( STRING_ON );
container.sizeToChildren();
//#endif
// tips selection
container = new Window(m_canvas);
container.setDimensions( m_iWidth-4, 0 );
container.setAlignment( Drawable.ALIGNH_CENTER );
m_itemStack.addToBack( container );
m_tips = createMenuLabel( LABEL_NORMAL );
m_tips.setAlignment( Drawable.ALIGNH_LEFT | Drawable.ALIGNV_MIDDLE );
container.addToBack(m_tips);
m_tips.setText( STRING_TIPS );
m_tipsOnOff = createMenuLabel( LABEL_NORMAL );
m_tipsOnOff.setAlignment( Drawable.ALIGNH_RIGHT | Drawable.ALIGNV_MIDDLE );
container.addToBack(m_tipsOnOff);
if (m_data.bDisableTips)
m_tipsOnOff.setText( STRING_OFF );
else
m_tipsOnOff.setText( STRING_ON );
container.sizeToChildren();
//#ifdef _MULTI_LANG
// // change language
// m_selectLang = createMenuLabel( LABEL_NORMAL );
// m_selectLang.setAlignment( Drawable.ALIGNH_LEFT );
// m_itemStack.addToBack(m_selectLang);
// m_selectLang.setDimensions( m_iWidth-4, m_selectLang.m_iHeight );
// m_selectLang.setTextNoResize( STRING_SELECT_LANGUAGE );
//#endif
// reset records
m_resetRecords = createMenuLabel( LABEL_NORMAL );
m_resetRecords.setAlignment( Drawable.ALIGNH_LEFT );
m_itemStack.addToBack(m_resetRecords);
m_resetRecords.setDimensions( m_iWidth-4, m_resetRecords.m_iHeight );
m_resetRecords.setTextNoResize( STRING_RESET_RECORDS );
//#ifdef _SPRINT_MRC
// // reset records
// m_cancelLicense = createMenuLabel( LABEL_NORMAL );
// m_cancelLicense.setAlignment( Drawable.ALIGNH_LEFT );
// m_itemStack.addToBack(m_cancelLicense);
// m_cancelLicense.setDimensions( m_iWidth-4, m_cancelLicense.m_iHeight );
// m_cancelLicense.setTextNoResize( STRING_CANCEL_MRC );
//#endif
// change online name
//#ifndef _NO_ONLINE
//#ifndef _IS_SPRINT
// if (m_data.iGameMode == 0/*@GAMEMODE_NONE*/)
// {
// m_changeName = createMenuLabel( LABEL_NORMAL );
// m_changeName.setAlignment( Drawable.ALIGNH_LEFT );
// m_itemStack.addToBack(m_changeName);
// m_changeName.setDimensions( m_iWidth-4, m_changeName.m_iHeight );
// m_changeName.setTextNoResize( STRING_CHANGE_ONLINE_NAME );
// m_iSettingsCount = ITEM_SETTINGS_COUNT;
// }
// else
//#endif
//#endif
m_iSettingsCount = ITEM_SETTINGS_NAME;
m_itemStack.sizeToChildren();
// initalize "reset records?" prompt
m_resetPrompt = new Window(m_canvas);
m_resetPrompt.m_iContainerType = Window.CONTAINER_STACK;
m_menuContainer.addToFront( m_resetPrompt );
m_resetPrompt.setAlignment( Drawable.ALIGNH_CENTER | Drawable.ALIGNV_MIDDLE );
m_resetPrompt.setPadding((-3)/*@FONT_PADDING*/);
m_resetPrompt.m_bVisible = false;
Label label = createMenuLabel( LABEL_NORMAL );
label.setAlignment( Drawable.ALIGNH_CENTER );
m_resetPrompt.addToBack(label);
label.setText( STRING_ARE_YOU_SURE );
Window shelf = new Window( m_canvas );
shelf.setDimensions(72/*@YESNO_SHELF_WIDTH*/,0);
shelf.setAlignment( Drawable.ALIGNH_CENTER );
m_resetPrompt.addToBack(shelf);
m_yesLabel = createMenuLabel( LABEL_NORMAL );
m_yesLabel.setAlignment( Drawable.ALIGNH_LEFT | Drawable.ALIGNV_MIDDLE );
shelf.addToBack(m_yesLabel);
m_yesLabel.setText( STRING_YES );
m_noLabel = createMenuLabel( LABEL_HIGHLIGHT );
m_noLabel.setAlignment( Drawable.ALIGNH_RIGHT | Drawable.ALIGNV_MIDDLE );
shelf.addToBack(m_noLabel);
m_noLabel.setText( STRING_NO );
shelf.sizeToChildren();
m_resetPrompt.sizeToChildren();
m_iSelection = -1;
selectSetting(0);
m_canvas.setKeyLabels( STRING_OK, STRING_BACK );
m_canvas.m_bNeedPaint = true;
}
private void selectSetting( int iSelection )
{
if (iSelection == m_iSelection)
return;
// deselect old
switch( m_iSelection )
{
case ITEM_SETTINGS_DIFFICULTY:
m_difficulty.m_iFgColor = m_difficultySelection.m_iFgColor = 0x717AA7/*@COLOR_MENU_TEXT*/;
m_difficulty.m_iStyle = m_difficultySelection.m_iStyle = 0;
break;
//#ifndef _NO_SOUND
case ITEM_SETTINGS_SOUND:
m_sound.m_iFgColor = m_soundOnOff.m_iFgColor = 0x717AA7/*@COLOR_MENU_TEXT*/;
m_sound.m_iStyle = m_soundOnOff.m_iStyle = 0;
break;
//#endif
case ITEM_SETTINGS_TIPS:
m_tips.m_iFgColor = m_tipsOnOff.m_iFgColor = 0x717AA7/*@COLOR_MENU_TEXT*/;
m_tips.m_iStyle = m_tipsOnOff.m_iStyle = 0;
break;
//#ifdef _MULTI_LANG
// case ITEM_SETTINGS_SELECTLANG:
// m_selectLang.m_iFgColor = 0x717AA7/*@COLOR_MENU_TEXT*/;
// m_selectLang.m_iStyle = 0;
// break;
//#endif
case ITEM_SETTINGS_RESETRECORDS:
m_resetRecords.m_iFgColor = 0x717AA7/*@COLOR_MENU_TEXT*/;
m_resetRecords.m_iStyle = 0;
break;
//#ifdef _SPRINT_MRC
// case ITEM_SETTING_CANCEL_MRC:
// m_cancelLicense.m_iFgColor = 0x717AA7/*@COLOR_MENU_TEXT*/;
// m_cancelLicense.m_iStyle = 0;
// break;
//#endif
//#ifndef _NO_ONLINE
//#ifndef _IS_SPRINT
// case ITEM_SETTINGS_NAME:
// m_changeName.m_iFgColor = 0x717AA7/*@COLOR_MENU_TEXT*/;
// m_changeName.m_iStyle = 0;
// break;
//#endif
//#endif
}
// select new
switch( iSelection )
{
case ITEM_SETTINGS_DIFFICULTY:
m_difficulty.m_iFgColor = m_difficultySelection.m_iFgColor = 0x9DACFD/*@COLOR_MENU_SELECTED*/;
m_difficulty.m_iStyle = m_difficultySelection.m_iStyle = Label.STYLE_OUTLINE|Label.STYLE_SCROLLING;
break;
//#ifndef _NO_SOUND
case ITEM_SETTINGS_SOUND:
m_sound.m_iFgColor = m_soundOnOff.m_iFgColor = 0x9DACFD/*@COLOR_MENU_SELECTED*/;
m_sound.m_iStyle = m_soundOnOff.m_iStyle = Label.STYLE_OUTLINE|Label.STYLE_SCROLLING;
break;
//#endif
case ITEM_SETTINGS_TIPS:
m_tips.m_iFgColor = m_tipsOnOff.m_iFgColor = 0x9DACFD/*@COLOR_MENU_SELECTED*/;
m_tips.m_iStyle = m_tipsOnOff.m_iStyle = Label.STYLE_OUTLINE|Label.STYLE_SCROLLING;
break;
//#ifdef _MULTI_LANG
// case ITEM_SETTINGS_SELECTLANG:
// m_selectLang.m_iFgColor = 0x9DACFD/*@COLOR_MENU_SELECTED*/;
// m_selectLang.m_iStyle = Label.STYLE_OUTLINE|Label.STYLE_SCROLLING;
// break;
//#endif
case ITEM_SETTINGS_RESETRECORDS:
m_resetRecords.m_iFgColor = 0x9DACFD/*@COLOR_MENU_SELECTED*/;
m_resetRecords.m_iStyle = Label.STYLE_OUTLINE|Label.STYLE_SCROLLING;
break;
//#ifdef _SPRINT_MRC
// case ITEM_SETTING_CANCEL_MRC:
// m_cancelLicense.m_iFgColor = 0x9DACFD/*@COLOR_MENU_SELECTED*/;
// m_cancelLicense.m_iStyle = Label.STYLE_OUTLINE|Label.STYLE_SCROLLING;
// break;
//#endif
//#ifndef _NO_ONLINE
//#ifndef _IS_SPRINT
// case ITEM_SETTINGS_NAME:
// m_changeName.m_iFgColor = 0x9DACFD/*@COLOR_MENU_SELECTED*/;
// m_changeName.m_iStyle = Label.STYLE_OUTLINE|Label.STYLE_SCROLLING;
// break;
//#endif
//#endif
}
m_iSelection = iSelection;
}
//#ifndef _FULL_SPLASH
boolean m_bNoPressKeyFlash=false;
private void initMenu_Splash() throws IOException
{
m_menuContainer.m_iContainerType = CONTAINER_NORMAL;
// TODO: for the Epyx version, we'll need to place Epyx and Ironstone logos, too
Image src = TorinoCanvas.loadPackedImage( RESFILE_COMMON, 0/*@RES_MENULOGO*//*@RES_SPLASHGAME*/ );
Sprite logo = new Sprite(src);
logo.setPosition( 0, m_iFillY + ((m_iFillHeight-logo.m_iHeight)>>1) - m_menuContainer.m_iY);
logo.setAlignment( Drawable.ALIGNH_CENTER );
m_menuContainer.addToFront(logo);
m_keyPrompt = createMenuLabel( LABEL_HIGHLIGHT );
m_keyPrompt.setAlignment( Drawable.ALIGNH_CENTER | Drawable.ALIGNV_BOTTOM );
m_keyPrompt.m_iStyle |= Label.STYLE_SCROLLING;
m_menuContainer.addToFront( m_keyPrompt );
m_keyPrompt.setDimensions( m_iWidth-4, m_keyPrompt.m_iHeight );
//#ifdef _IS_SPRINT
// m_welcomePrompt = createMenuLabel( LABEL_HIGHLIGHT );
// m_welcomePrompt.setAlignment( Drawable.ALIGNH_CENTER | Drawable.ALIGNV_NONE );
// m_welcomePrompt.m_iStyle |= Label.STYLE_SCROLLING;
// m_menuContainer.addToFront( m_welcomePrompt );
// m_welcomePrompt.setDimensions( m_iWidth-4, m_welcomePrompt.m_iHeight );
// m_welcomePrompt.setPosition( m_welcomePrompt.m_iX, m_keyPrompt.m_iY - m_welcomePrompt.m_iHeight );
//
// if (m_canvas.m_bLoggingIn)
// {
// m_keyPrompt.setTextNoResize(STRING_LOGGING_IN);
// m_bLoggingIn = true;
// }
// else
// {
//#endif
m_keyPrompt.setTextNoResize(STRING_PRESS_ANY_KEY);
//#ifdef _IS_SPRINT
// String s = TorinoCanvas.getString( STRING_WELCOME ) + " " + m_canvas.m_sGLName;
// m_welcomePrompt.setTextNoResize( s );
// m_bLoggingIn = false;
// }
//#endif
if (m_keyPrompt.m_iImageWidth > m_iWidth-2)
m_bNoPressKeyFlash = true;
m_canvas.setKeyLabels( STRING_OK, STRING_EXIT );
}
//#endif
//#ifndef _IS_SPRINT
private void initMenu_SelectPlayers()
{
m_menuContainer.m_iContainerType = CONTAINER_STACK;
m_menuContainer.setPadding((-3)/*@FONT_PADDING*/);
for (int i=0; i<4/*@_MAX_HUMAN_PLAYERS*/; i++)
{
appendMenuItem( Integer.toString(i+1) + " " + TorinoCanvas.getString( (i==0)?STRING_PLAYER:STRING_PLAYERS ) );
}
m_canvas.setKeyLabels( STRING_OK, STRING_BACK );
}
//#endif
private void initMenu_SelectCountry() throws IOException
{
m_menuContainer.m_iContainerType = CONTAINER_NORMAL;
Window flagStack = new Window(m_canvas);
flagStack.m_iContainerType = CONTAINER_STACK;
flagStack.setAlignment( Drawable.ALIGNH_CENTER | Drawable.ALIGNV_MIDDLE );
flagStack.setPadding(3);
m_menuContainer.addToFront(flagStack);
Window shelf = new Window(m_canvas);
shelf.m_iContainerType = CONTAINER_SHELF;
shelf.setAlignment( Drawable.ALIGNH_CENTER );
shelf.setPadding(8);
flagStack.addToBack(shelf);
//#ifdef _IS_NokiaS60
//
// short[] src = TorinoCanvas.loadPackedPalPixels( RESFILE_MENU, 7/*@RES_ARROWSLR*/,
// RESFILE_MENU, 7/*@RES_ARROWSLR*/+1 );
//#else
Image src = TorinoCanvas.loadPackedImage( RESFILE_COMMON, 7/*@RES_ARROWSLR*/ );
//#endif
Sprite arrow = new Sprite(src, 5/*@ARROW_WIDTH*/, 7/*@ARROW_HEIGHT*/);
arrow.setAlignment( Drawable.ALIGNV_MIDDLE );
shelf.addToBack(arrow);
Window flagContainer = new Window(m_canvas);
flagContainer.setAlignment( Drawable.ALIGNV_MIDDLE );
flagContainer.m_iFrameColor = 0x717AA7/*@COLOR_MENU_TEXT*/;
flagContainer.m_iPaintFlags = Window.PAINT_FRAME;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -