var a = new Array(); var b = new Array(); var ksjmCursor = 0; function ksjminit() { ksjminitName(); ksjminitRectChoose(); ksjminitRectChoosePic(); ksjmsetVisible(0); Laya.stage.on(laya.events.Event.KEY_DOWN, this, ksjmOnKeyDown); } function ksjminitName() { var a1 = new laya.display.Text(); a1.text = "再续冒险之旅"; a1.x = 50; a1.y = 50; a1.color = "red"; a1.fontSize = 20; Laya.stage.addChild(a1); var a2 = new laya.display.Text(); a2.text = "新的冒险之旅"; a2.x = 50; a2.y = 50 + 30 * 1; a2.color = "red"; a2.fontSize = 20; Laya.stage.addChild(a2); var a3 = new laya.display.Text(); a3.text = "冒险者的传承"; a3.x = 50; a3.y = 50 + 30 * 2; a3.color = "red"; a3.fontSize = 20; Laya.stage.addChild(a3); var a4 = new laya.display.Text(); a4.text = "打开网页"; a4.x = 50; a4.y = 50 + 30 * 3; a4.color = "red"; a4.fontSize = 20; Laya.stage.addChild(a4); var a5 = new laya.display.Text(); a5.text = "变更设定"; a5.x = 50; a5.y = 50 + 30 * 4; a5.color = "red"; a5.fontSize = 20; Laya.stage.addChild(a5); var a6 = new laya.display.Text(); a6.text = "退出"; a6.x = 50; a6.y = 50 + 30 * 5; a6.color = "red"; a6.fontSize = 20; Laya.stage.addChild(a6); } function ksjminitRectChoose(){ for(var i = 0; i < 6; i++){ a[i] = new laya.display.Sprite(); if (i == 0 || i == 1 || i == 2) { a[i].graphics.drawRect(50, 50 + 30 * i, 6 * 20 + 5 + 10, 20, "white"); } if (i == 3 || i == 4) { a[i].graphics.drawRect(50, 50 + 30 * i, 3 * 20 + 5 + 30, 20, "white"); } if (i == 5) { a[i].graphics.drawRect(50, 50 + 30 * i, 2 * 20 + 5 + 10, 20, "white"); } a[i].alpha = 0.25; a[i].visible = true; Laya.stage.addChild(a[i]); } } function ksjminitRectChoosePic() { for(var i = 0; i < 6; i++){ b[i] = new laya.display.Sprite(); if (i == 0 || i == 1 || i == 2) { b[i].loadImage("rectChoosePic.png",50 + 6 * 20 + 5 ,50 + 30 * i + 5, 10 ,10); } if (i == 3 || i == 4) { b[i].loadImage("rectChoosePic.png",50 + 4 * 20 + 5 ,50 + 30 * i + 5, 10 ,10); } if (i == 5) { b[i].loadImage("rectChoosePic.png",50 + 2 * 20 + 5 ,50 + 30 * i + 5, 10 ,10); } b[i].visible = true; Laya.stage.addChild(b[i]); } } function ksjmOnKeyDown(e) { switch(e.keyCode){ case 38:{ if ( (ksjmCursor - 1) <= 0 ) { ksjmCursor = 0; }else{ ksjmCursor--; } break; } case 40:{ if ( (ksjmCursor + 1) >= 5 ) { ksjmCursor = 5; }else{ ksjmCursor++; } break; } } ksjmsetVisible(ksjmCursor); } function ksjmsetVisible(index) { for(var i = 0; i < 6 ; i++){ if (index == i) { a[i].visible = true; b[i].visible = true; }else{ a[i].visible = false; b[i].visible = false; } } }