int effect, gridWidth, num, currentGridWidth, gridHeight, currentGridHeight, deltaWidth, deltaHeight, row, col, sx, sy, sw, sh; int scnWidth = MY_SCREEN_WIDTH; int scnWidth_Half = MY_SCREEN_WIDTH / 2; int scnHeight = MY_SCREEN_HEIGHT; int scnHeight_Half = MY_SCREEN_HEIGHT / 2; /** * 初始化 */ private void initEffect() { //subSelected = 0; // effect = getRandom(0, 20); effect = Math.abs(random.nextInt()) % 21; // System.out.println("Effect::" + effect); // effect = 19 + (ran.nextInt() >>> 1) % 2; // effect = 2; switch (effect) { default: break; case 0: { // 水平单一百叶窗效果 gridWidth = scnWidth >> 2; // 每一条 num = 4; currentGridWidth = 0; gridHeight = 0; currentGridHeight = 0; if (scnWidth == 176) { //deltaWidth = 8; deltaWidth = 8; } else if (scnWidth == 128) { deltaWidth = 2; } else { deltaWidth = 3; } } break; case 1: { // 竖直单一百叶窗效果 gridHeight = scnHeight >> 2; num = 4; currentGridHeight = 0; currentGridWidth = 0; gridWidth = 0; if (scnWidth == 176) { deltaHeight = 8; } else if (scnWidth == 128) { deltaHeight = 2; } else { deltaHeight = 3; } } break; case 2: { // 纵横百叶窗效果 gridWidth = scnWidth >> 1; gridHeight = scnHeight >> 1; currentGridWidth = 0; currentGridHeight = 0; num = 2; if (scnWidth == 176) { deltaWidth = 11; deltaHeight = 13; } else if (scnWidth == 128) { deltaWidth = 4; deltaHeight = 4; } else { deltaWidth = 8; deltaHeight = 9; } } break; [您有足够的威望或权限浏览此文章, 以下是加密内容:] case 3: case 4: { // 内聚/外散效果 gridWidth = scnWidth >> 1; gridHeight = scnHeight >> 1; currentGridWidth = 0; currentGridHeight = 0; // num = 4; if (scnWidth == 176) { deltaWidth = 9; deltaHeight = 11; } else if (scnWidth == 128) { deltaWidth = 4; deltaHeight = 4; } else { deltaWidth = 9; deltaHeight = 11; } } break; case 5: case 6: { // 从左/右抽出 currentGridWidth = 0; gridWidth = scnWidth; // col = 1; if (scnWidth == 176) { deltaWidth = 16; } else if (scnWidth == 128) { deltaWidth = 16; } else { deltaWidth = 16; } } break; case 7: case 8: { // 从上/下抽出 currentGridHeight = 0; gridHeight = scnHeight; // row = 1; deltaHeight = 16; } break; case 9: // 从上下往中央 case 10: { // 中央往上下 currentGridHeight = 0; gridHeight = scnHeight_Half; deltaHeight = 8; } break; case 11: // 左右往中央 case 12: { // 中央往左右 currentGridWidth = 0; gridWidth = scnWidth_Half; deltaWidth = 8; } break; case 13: // 加号往外 case 14: { // 加号往内 currentGridHeight = currentGridWidth = 0; gridWidth = scnWidth_Half; gridHeight = scnHeight_Half; if (scnWidth == 176) { deltaWidth = 11; deltaHeight = 13; } else if (scnWidth == 128) { deltaWidth = deltaHeight = 8; } else { deltaWidth = 11; deltaHeight = 13; } } break; case 15: { // 从右上抽入 } case 16: { // 从左上抽入 } case 17: { // 从右下抽入 } case 18: { // 从左下抽入 currentGridHeight = currentGridWidth = 0; gridWidth = scnWidth; gridHeight = scnHeight; if (scnWidth == 176) { deltaWidth = 11; deltaHeight = 13; } else if (scnWidth == 128) { deltaWidth = deltaHeight = 8; } else { deltaWidth = 11; deltaHeight = 13; } } break; case 19: { // 水平梳理 currentGridWidth = 0; gridWidth = scnWidth; gridHeight = scnHeight >> 2; row = 4; if (scnWidth == 176) { deltaWidth = 22; } else if (scnWidth == 128) { deltaWidth = 8; } else { deltaWidth = 8; } } break; case 20: { // 垂直梳理 currentGridHeight = 0; gridHeight = scnHeight; gridWidth = scnWidth >> 2; col = 4; if (scnWidth == 176) { deltaHeight = 26; } else if (scnWidth == 128) { deltaHeight = 8; } else { deltaHeight = 8; } } break; } // 这里保证在过场动画显示过程中不会受到玩家按键的影响 //cleanKeyStates(13); // gg.setClip(0, 0, scnWidth, scnHeight); } private void doPaintInterludeEffect() { switch (gameStates) { case -1: break; case 0: paintLogo(); break; case 1: paintLoading(); break; case 2: paintMainMenu(); break; case 3: paintHelp(); break; case 4: paintAbout(); break; case 5: paintIntroduction(); break; case 6: paintGuide(); break; case 7: paintControl(); break; case 8: paintCustom(); break; case 9: paintStaff(); break; case 10: paintOption(); break; case 11: paintMain(); break; /*********************** 玩家更新 ***********************/ case GS_P_NAV: // 玩家选择单位 paintGS_P_NAV(); break; case GS_SYS_MENU: // 选择了空地,出现系统菜单 paintGS_SYS_MENU(); break; case GS_P_SLT_MOV: // 玩家选择移动目标 paintGS_P_SLT_MOV(); break; case GS_P_MOVING: // 玩家单位移动中 paintGS_P_MOVING(); break; case GS_P_CONFIRM_MOV: // 玩家确定移动菜单 paintGS_P_CONFIRM_MOV(); break; case GS_P_SLT_TARGET: // 玩家选择攻击目标 paintGS_P_SLT_TARGET(); break; /********************** 敌人更新 *********************/ case GS_E_NAV: // 敌人选择单位 paintGS_E_NAV(); break; case GS_E_MOVING: // 敌人移动 paintGS_E_MOVING(); break; /********************** 公有更新 *********************/ case GS_FIGHTING: // 战斗 paintGS_FIGHTING(); break; case GS_VIEW_UNIT_INFO: // 查看单位信息 paintGS_VIEW_UNIT_INFO(); break; /********************** 事件相关更新 *******************/ case GS_TALK: // 对话 paintGS_TALK(); break; case GS_MOV: // 控制单位移动 paintGS_MOV(); break; case GS_FLASH_CELL: // 地块闪动 paintGS_FLASH_CELL(); break; } } /** * 画各种菜单/场景切换动画 * * @author 薛永 * * */ private void interludeEffect() { gg.setClip(0, 0, scnWidth, scnHeight); switch (effect) { default: break; case -1: { // 特效完毕 sx = 0; sy = 0; sw = scnWidth; sh = scnHeight; switch (gameStates) { case -1: break; case 0: paintLogo(); break; case 1: paintLoading(); break; case 2: paintMainMenu(); break; case 3: paintHelp(); break; case 4: paintAbout(); break; case 5: paintIntroduction(); break; case 6: paintGuide(); break; case 7: paintControl(); break; case 8: paintCustom(); break; case 9: paintStaff(); break; case 10: paintOption(); break; case 11: paintMain(); break; /*********************** 玩家更新 ***********************/ case GS_P_NAV: // 玩家选择单位 paintGS_P_NAV(); break; case GS_SYS_MENU: // 选择了空地,出现系统菜单 paintGS_SYS_MENU(); break; case GS_P_SLT_MOV: // 玩家选择移动目标 paintGS_P_SLT_MOV(); break; case GS_P_MOVING: // 玩家单位移动中 paintGS_P_MOVING(); break; case GS_P_CONFIRM_MOV: // 玩家确定移动菜单 paintGS_P_CONFIRM_MOV(); break; case GS_P_SLT_TARGET: // 玩家选择攻击目标 paintGS_P_SLT_TARGET(); break; /********************** 敌人更新 *********************/ case GS_E_NAV: // 敌人选择单位 paintGS_E_NAV(); break; case GS_E_MOVING: // 敌人移动 paintGS_E_MOVING(); break; /********************** 公有更新 *********************/ case GS_FIGHTING: // 战斗 paintGS_FIGHTING(); break; case GS_VIEW_UNIT_INFO: // 查看单位信息 paintGS_VIEW_UNIT_INFO(); break; /********************** 事件相关更新 *******************/ case GS_TALK: // 对话 paintGS_TALK(); break; case GS_MOV: // 控制单位移动 paintGS_MOV(); break; case GS_FLASH_CELL: // 地块闪动 paintGS_FLASH_CELL(); break; } } break; case 1: { // 水平百叶窗 if (currentGridHeight < gridHeight) { currentGridHeight += (deltaHeight++); for (int i = num; --i >= 0; ) { // gg.setColor(color); // gg.fillRect(0, i * gridLen, scnWidth, currentGridLen); sx = 0; sy = i * gridHeight; sw = scnWidth; sh = currentGridHeight; gg.setClip(0, i * gridHeight, scnWidth, currentGridHeight); doPaintInterludeEffect(); gg.setClip(0, 0, scnWidth, scnHeight); } } else { effect = -1; } } break; case 0: { // 垂直百叶窗 if (currentGridWidth < gridWidth) { currentGridWidth += (deltaWidth++); for (int i = num; --i >= 0; ) { // gg.setColor(color); sx = i * gridWidth; sy = 0; sw = currentGridWidth; sh = scnHeight; gg.setClip(i * gridWidth, 0, currentGridWidth, scnHeight); doPaintInterludeEffect(); gg.setClip(0, 0, scnWidth, scnHeight); } } else { effect = -1; } } break; case 2: { // 水平纵横交错百叶窗 if (currentGridHeight < gridHeight) { // S60:: 176 * 208 currentGridHeight += (deltaHeight++); currentGridWidth += (deltaWidth++); // S40:: 128 * 128 // currentGridHeight += 4; // currentGridWidth += 4; for (int i = num; --i >= 0; ) { for (int j = num; --j >= 0; ) { sx = j * gridWidth; sy = i * gridHeight; sw = currentGridWidth; sh = currentGridHeight; gg.setClip(j * gridWidth, i * gridHeight, currentGridWidth, currentGridHeight); doPaintInterludeEffect(); gg.setClip(0, 0, scnWidth, scnHeight); } } } else { effect = -1; } } break; case 3: { // 内聚效果 if (currentGridHeight < gridHeight) { // S60:: 176 * 208 currentGridHeight += (deltaHeight++); currentGridWidth += (deltaWidth++); // S40::128 * 128 // currentGridHeight += 4; // currentGridWidth += 4; sx = scnWidth_Half - currentGridWidth; sy = scnHeight_Half - currentGridHeight; sw = currentGridWidth << 1; sh = currentGridHeight << 1; gg.setClip(scnWidth_Half - currentGridWidth, scnHeight_Half - currentGridHeight, currentGridWidth << 1, currentGridHeight << 1); doPaintInterludeEffect(); gg.setClip(0, 0, scnWidth, scnHeight); // for (int i = num; --i >= 0;) { // for (int j = num; --j >= 0;) { // gg.setClip(scnWidth_Half - currentGridWidth, // scnHeight_Half - currentGridHeight, // currentGridWidth << 1, currentGridHeight << 1); // doPaintCreatePlayer(); // gg.setClip(0, 0, scnWidth, scnHeight); // } // } } else { effect = -1; } } break; case 4: { // 外散效果 if (currentGridHeight < gridHeight) { // S60::176 * 208 currentGridHeight += (deltaHeight++); currentGridWidth += (deltaWidth++); // S40::128 * 128 // currentGridHeight += 4; // currentGridWidth += 4; sx = 0; sy = 0; sw = scnWidth; sh = currentGridHeight; gg.setClip(0, 0, scnWidth, currentGridHeight); doPaintInterludeEffect(); gg.setClip(0, 0, scnWidth, scnHeight); sx = 0; sy = scnHeight - currentGridHeight; sw = scnWidth; sh = currentGridHeight; gg.setClip(0, scnHeight - currentGridHeight, scnWidth, currentGridHeight); doPaintInterludeEffect(); gg.setClip(0, 0, scnWidth, scnHeight); sx = 0; sy = currentGridHeight; sw = currentGridWidth; sh = (scnHeight_Half - currentGridHeight) << 1; gg.setClip(0, currentGridHeight, currentGridWidth, (scnHeight_Half - currentGridHeight) << 1); doPaintInterludeEffect(); gg.setClip(0, 0, scnWidth, scnHeight); sx = scnWidth - currentGridWidth; sy = currentGridHeight; sw = currentGridWidth; sh = (scnHeight_Half - currentGridHeight) << 1; gg.setClip(scnWidth - currentGridWidth, currentGridHeight, currentGridWidth, (scnHeight_Half - currentGridHeight) << 1); doPaintInterludeEffect(); gg.setClip(0, 0, scnWidth, scnHeight); } else { effect = -1; } } break; case 5: { // 从左抽出 if (currentGridWidth < gridWidth) { currentGridWidth += (deltaWidth++); sx = 0; sy = 0; sw = currentGridWidth; sh = scnHeight; gg.setClip(0, 0, currentGridWidth, scnHeight); doPaintInterludeEffect(); gg.setClip(0, 0, scnWidth, scnHeight); } else { effect = -1; } } break; case 6: { // 从右抽出 if (currentGridWidth < gridWidth) { currentGridWidth += (deltaWidth++); sx = scnWidth - currentGridWidth; sy = 0; sw = currentGridWidth; sh = scnHeight; gg.setClip(scnWidth - currentGridWidth, 0, currentGridWidth, scnHeight); doPaintInterludeEffect(); gg.setClip(0, 0, scnWidth, scnHeight); } else { effect = -1; } } break; case 7: { // 从上抽出 if (currentGridHeight < gridHeight) { currentGridHeight += (deltaHeight++); sx = 0; sy = 0; sw = scnWidth; sh = currentGridHeight; gg.setClip(0, 0, scnWidth, currentGridHeight); doPaintInterludeEffect(); gg.setClip(0, 0, scnWidth, scnHeight); } else { effect = -1; } } break; case 8: { // 从下抽出 if (currentGridHeight < gridHeight) { currentGridHeight += (deltaHeight++); sx = 0; sy = scnHeight - currentGridHeight; sw = scnWidth; sh = currentGridHeight; gg.setClip(0, scnHeight - currentGridHeight, scnWidth, currentGridHeight); doPaintInterludeEffect(); gg.setClip(0, 0, scnWidth, scnHeight); } else { effect = -1; } } break; case 9: { // 上下往中央 if (currentGridHeight < gridHeight) { currentGridHeight += (deltaHeight++); sx = 0; sy = 0; sw = scnWidth; sh = currentGridHeight; gg.setClip(0, 0, scnWidth, currentGridHeight); doPaintInterludeEffect(); gg.setClip(0, 0, scnWidth, scnHeight); sx = 0; sy = scnHeight - currentGridHeight; sw = scnWidth; sh = currentGridHeight; gg.setClip(0, scnHeight - currentGridHeight, scnWidth, currentGridHeight); doPaintInterludeEffect(); gg.setClip(0, 0, scnWidth, scnHeight); } else { effect = -1; } } break; case 10: { // 中央往上下 if (currentGridHeight < gridHeight) { currentGridHeight += (deltaHeight++); sx = 0; sy = gridHeight - currentGridHeight; sw = scnWidth; sh = currentGridHeight << 1; gg.setClip(0, gridHeight - currentGridHeight, scnWidth, currentGridHeight << 1); doPaintInterludeEffect(); gg.setClip(0, 0, scnWidth, scnHeight); } else { effect = -1; } } break; case 11: { // 左右往中央 if (currentGridWidth < gridWidth) { currentGridWidth += (deltaWidth++); sx = 0; sy = 0; sw = currentGridWidth; sh = scnHeight; gg.setClip(0, 0, currentGridWidth, scnHeight); doPaintInterludeEffect(); gg.setClip(0, 0, scnWidth, scnHeight); sx = scnWidth - currentGridWidth; sy = 0; sw = currentGridWidth; sh = scnHeight; gg.setClip(scnWidth - currentGridWidth, 0, currentGridWidth, scnHeight); doPaintInterludeEffect(); gg.setClip(0, 0, scnWidth, scnHeight); } else { effect = -1; } } break; case 12: { // 中央往左右 if (currentGridWidth < gridWidth) { currentGridWidth += (deltaWidth++); sx = gridWidth - currentGridWidth; sy = 0; sw = currentGridWidth << 1; sh = scnHeight; gg.setClip(gridWidth - currentGridWidth, 0, currentGridWidth << 1, scnHeight); doPaintInterludeEffect(); gg.setClip(0, 0, scnWidth, scnHeight); } else { effect = -1; } } break; case 13: { // 加号向外 if (currentGridHeight < gridHeight) { currentGridHeight += (deltaHeight++); currentGridWidth += (deltaWidth++); sx = 0; sy = gridHeight - currentGridHeight; sw = scnWidth; sh = currentGridHeight << 1; gg.setClip(0, gridHeight - currentGridHeight, scnWidth, currentGridHeight << 1); doPaintInterludeEffect(); gg.setClip(0, 0, scnWidth, scnHeight); sx = gridWidth - currentGridWidth; sy = 0; sw = currentGridWidth << 1; sh = gridHeight - currentGridHeight; gg.setClip(gridWidth - currentGridWidth, 0, currentGridWidth << 1, gridHeight - currentGridHeight); doPaintInterludeEffect(); gg.setClip(0, 0, scnWidth, scnHeight); sx = gridWidth - currentGridWidth; sy = gridHeight + currentGridHeight; sw = currentGridWidth << 1; sh = gridHeight - currentGridHeight; gg.setClip(gridWidth - currentGridWidth, gridHeight + currentGridHeight, currentGridWidth << 1, gridHeight - currentGridHeight); doPaintInterludeEffect(); gg.setClip(0, 0, scnWidth, scnHeight); } else { effect = -1; } } break; case 14: { // 加号向内 if (currentGridWidth < gridWidth) { currentGridHeight += (deltaHeight++); currentGridWidth += (deltaWidth++); int _width = currentGridWidth; int _height = currentGridHeight; sx = 0; sy = 0; sw = _width; sh = _height; gg.setClip(0, 0, _width, _height); doPaintInterludeEffect(); gg.setClip(0, 0, scnWidth, scnHeight); sx = 0; sy = scnHeight - currentGridHeight; sw = _width; sh = _height; gg.setClip(0, scnHeight - currentGridHeight, _width, _height); doPaintInterludeEffect(); gg.setClip(0, 0, scnWidth, scnHeight); sx = scnWidth - currentGridWidth; sy = 0; sw = _width; sh = _height; gg.setClip(scnWidth - currentGridWidth, 0, _width, _height); doPaintInterludeEffect(); gg.setClip(0, 0, scnWidth, scnWidth); sx = scnWidth - currentGridWidth; sy = scnHeight - currentGridHeight; sw = _width; sh = _height; gg.setClip(scnWidth - currentGridWidth, scnHeight - currentGridHeight, _width, _height); doPaintInterludeEffect(); gg.setClip(0, 0, scnWidth, scnHeight); } else { effect = -1; } } break; case 15: { // 向右上抽入 if (currentGridHeight < gridHeight) { currentGridHeight += (deltaHeight++); currentGridWidth += (deltaWidth++); sx = 0; sy = scnHeight - currentGridHeight; sw = currentGridWidth; sh = currentGridHeight; gg.setClip(0, scnHeight - currentGridHeight, currentGridWidth, currentGridHeight); doPaintInterludeEffect(); gg.setClip(0, 0, scnWidth, scnHeight); } else { effect = -1; } } break; case 16: { // 向左上抽入 if (currentGridHeight < gridHeight) { currentGridHeight += (deltaHeight++); currentGridWidth += (deltaWidth++); sx = gridWidth - currentGridWidth; sy = gridHeight - currentGridHeight; sw = currentGridWidth; sh = currentGridHeight; gg.setClip(gridWidth - currentGridWidth, gridHeight - currentGridHeight, currentGridWidth, currentGridHeight); doPaintInterludeEffect(); gg.setClip(0, 0, scnWidth, scnHeight); } else { effect = -1; } } break; case 17: { // 向右下抽入 if (currentGridHeight < gridHeight) { currentGridHeight += (deltaHeight++); currentGridWidth += (deltaWidth++); sx = 0; sy = 0; sw = currentGridWidth; sh = currentGridHeight; gg.setClip(0, 0, currentGridWidth, currentGridHeight); doPaintInterludeEffect(); gg.setClip(0, 0, scnWidth, scnHeight); } else { effect = -1; } } break; case 18: { // 向左下抽入 if (currentGridHeight < gridHeight) { currentGridHeight += (deltaHeight++); currentGridWidth += (deltaWidth++); sx = scnWidth - currentGridWidth; sy = 0; sw = currentGridWidth; sh = currentGridHeight; gg.setClip(scnWidth - currentGridWidth, 0, currentGridWidth, currentGridHeight); doPaintInterludeEffect(); gg.setClip(0, 0, scnWidth, scnHeight); } else { effect = -1; } } break; case 19: { // 水平梳理 if (currentGridWidth < gridWidth) { currentGridWidth += (deltaWidth++); for (int i = row; --i >= 0; ) { if ((i & 1) == 0) { sx = 0; sy = (i) * gridHeight; sw = currentGridWidth; sh = gridHeight; gg.setClip(0, (i) * gridHeight, currentGridWidth, gridHeight); } else { sx = scnWidth - currentGridWidth; sy = (i) * gridHeight; sw = currentGridWidth; sh = gridHeight; gg.setClip(scnWidth - currentGridWidth, (i) * gridHeight, currentGridWidth, gridHeight); } doPaintInterludeEffect(); gg.setClip(0, 0, scnWidth, scnHeight); } } else { effect = -1; } } break; case 20: { // 垂直梳理 if (currentGridHeight < gridHeight) { currentGridHeight += (deltaHeight++); for (int i = col; --i >= 0; ) { if ((i & 1) == 0) { sx = (i) * gridWidth; sy = 0; sw = gridWidth; sh = currentGridHeight; gg.setClip((i) * gridWidth, 0, gridWidth, currentGridHeight); } else { sx = (i) * gridWidth; sy = gridHeight - currentGridHeight; sw = gridWidth; sh = currentGridHeight; gg.setClip((i) * gridWidth, gridHeight - currentGridHeight, gridWidth, currentGridHeight); } doPaintInterludeEffect(); gg.setClip(0, 0, scnWidth, scnHeight); } } else { effect = -1; } } break; } }