function KeyButton(x, y, width, height, normalText, shiftText, handSide, row, fingerType, alignType) {
	this.normalText = normalText;
	this.shiftText = shiftText;
	this.handSide = handSide;
	this.row = row;
	this.fingerType = fingerType;
	this.alignType = alignType;

	this.setting = new RoundRectButtonSetting(x, y, width, height, KeyButton.DEFALUT_ROUND_AMOUNT_PX);
	this.setting.strokeWidthPx = 2;

	this.buttonSolid = this.makeButtonSolidSprite(this.setting);
	this.setNormalColor();
	this.buttonStroke = this.makeButtonStrokeSprite(this.setting);

	this.baselineStroke = null;
	if(fingerType == KeyButton.INDEX_FINGER_BASELINE) {
		this.baselineStroke = this.makeBaselineStrokeSprite(this.setting, width, height);
		this.buttonStroke.addChild(this.baselineStroke);
	}

	this.buttonText = this.makeText(this.setting, this.normalText);
	if(this.normalText.length > 0) {
		this.buttonStroke.addChild(this.buttonText);
	}

	this.highlightButtonStroke = this.makeHighlightButtonStrokeSprite(this.setting);
	this.highlightButtonStroke.alpha = 0;
}

KeyButton.prototype.makeButtonSolidSprite = function(setting) {
	var btnTexture = new Phaser.Graphics()
		.beginFill(0xffffff, 0.5)
		// .lineStyle(setting.strokeWidthPx, 0xFFffff, 1)
		.drawRoundedRect(0, 0, setting.width, setting.height, setting.roundAmount)
		.endFill()
		.generateTexture();

	return game.add.sprite(
		setting.x,	// - setting.width / 2,
		setting.y,	// - setting.height / 2,
		btnTexture
	);
}

KeyButton.prototype.makeButtonStrokeSprite = function(setting) {
	var btnTexture = new Phaser.Graphics()
		.lineStyle(setting.strokeWidthPx, 0xaaaaaa, 1)
		.drawRoundedRect(0, 0, setting.width, setting.height, setting.roundAmount)
		.generateTexture();

	return game.add.sprite(
		setting.x,	// - setting.width / 2,
		setting.y,	// - setting.height / 2,
		btnTexture
	);
}

KeyButton.prototype.makeHighlightButtonStrokeSprite = function(setting) {
	var strokeWidth = setting.strokeWidthPx * 2;
	var btnTexture = new Phaser.Graphics()
		.lineStyle(strokeWidth, 0xfffff00, 1)
		.drawRoundedRect(0, 0, setting.width, setting.height, setting.roundAmount)
		.generateTexture();

	return game.add.sprite(
		setting.x - strokeWidth / 4,
		setting.y - strokeWidth / 4,
		btnTexture
	);
}

KeyButton.prototype.makeBaselineStrokeSprite = function(setting, width, height) {
	var strokePx = setting.strokeWidthPx;

	var baselineTexture = new Phaser.Graphics()
		.lineStyle(2, 0x888888)
		.moveTo(1, 1)
		.lineTo(16, 1)
		.lineStyle(2, 0xffffff)
		.moveTo(0, 0)
		.lineTo(15, 0)
		.generateTexture();

	var baselineSprite = game.add.sprite(
			strokePx + setting.width / 2,
			strokePx + setting.height - 6,
			baselineTexture
		);
	baselineSprite.anchor.set(0.5);
	return baselineSprite;
}

KeyButton.prototype.makeText = function(setting, textContent) {
	var fontStyle = { };
	if(this.alignType === KeyButton.NORMAL_KEY)
		setting.fontStyle.font = "20px Courier New";
	else
		setting.fontStyle.font = "11px Courier New";

	var OFFSET_X = 4, OFFSET_Y = 3;
	var textPosX = 0, textPosY = 0;
	switch(this.alignType) {
		case KeyButton.NORMAL_KEY:
		case KeyButton.NORMAL_FUNCTION_KEY:
		textPosX = setting.strokeWidthPx + setting.width / 2;
		textPosY = setting.strokeWidthPx + setting.height / 2 + OFFSET_Y;
		break;

		case KeyButton.LEFT_FUNCTION_KEY:
		textPosX = setting.strokeWidthPx + OFFSET_X;
		textPosY = setting.strokeWidthPx + setting.height;
		break;

		case KeyButton.CENTER_FUNCTION_KEY:
		textPosX = setting.strokeWidthPx + setting.width / 2;
		textPosY = setting.strokeWidthPx + setting.height;
		break;

		case KeyButton.RIGHT_FUNCTION_KEY:
		textPosX = setting.strokeWidthPx + setting.width - OFFSET_X;
		textPosY = setting.strokeWidthPx + setting.height;
		break;
	}

	var buttonText = game.add.text(textPosX, textPosY, textContent, setting.fontStyle);
	switch(this.alignType) {
		case KeyButton.NORMAL_KEY:
		case KeyButton.NORMAL_FUNCTION_KEY:
		buttonText.anchor.set(0.5);
		break;

		case KeyButton.LEFT_FUNCTION_KEY:
		buttonText.anchor.set(0, 1);
		break;

		case KeyButton.CENTER_FUNCTION_KEY:
		buttonText.anchor.set(0.5, 1);
		break;

		case KeyButton.RIGHT_FUNCTION_KEY:
		buttonText.anchor.set(1, 1);
		break;
	}

	return buttonText;
}


KeyButton.prototype.setNormalColor = function() {
	switch(this.fingerType) {
		case KeyButton.THUMB:
		this.buttonSolid.tint = 0x604d4d;
		break;

		case KeyButton.INDEX_FINGER:
		case KeyButton.INDEX_FINGER_BASELINE:
		this.buttonSolid.tint = 0x4d604d;
		break;

		case KeyButton.MIDDLE_FINGER:
		this.buttonSolid.tint = 0x4d4d60;
		break;

		case KeyButton.RING_FINGER:
		this.buttonSolid.tint = 0x60604d;
		break;

		case KeyButton.LITTLE_FINGER:
		this.buttonSolid.tint = 0x4d6060;
		break;

		default:
		this.buttonSolid.tint = 0x4d4d4d;
		// this.buttonSolid.alpha = 0;
	}
}

KeyButton.prototype.setTargetColor = function() {
	switch(this.fingerType) {
		case KeyButton.THUMB:
		this.buttonSolid.tint = 0xff8080;
		break;

		case KeyButton.INDEX_FINGER:
		case KeyButton.INDEX_FINGER_BASELINE:
		this.buttonSolid.tint = 0x80ff80;
		break;

		case KeyButton.MIDDLE_FINGER:
		this.buttonSolid.tint = 0x8080ff;
		break;

		case KeyButton.RING_FINGER:
		this.buttonSolid.tint = 0xffff80;
		break;

		case KeyButton.LITTLE_FINGER:
		this.buttonSolid.tint = 0x80ffff;
		break;

		default:
		this.buttonSolid.tint = 0x202020;
		// this.buttonSolid.alpha = 0;
	}
}

KeyButton.prototype.setGoodPressColor = function() {
	this.buttonSolid.tint = 0x0000ff;
}

KeyButton.prototype.setBadPressColor = function() {
	this.buttonSolid.tint = 0xff0000;
}


KeyButton.prototype.showHighlight = function() {
	this.highlightButtonStroke.alpha = 1;
}

KeyButton.prototype.hideHighlight = function() {
	this.highlightButtonStroke.alpha = 0;
}


KeyButton.prototype.onShiftPressed = function() {
	this.buttonText.text = this.shiftText;
}

KeyButton.prototype.onShiftUnpressed = function() {
	this.buttonText.text = this.normalText;
}


KeyButton.NONE_ICON					= "";
KeyButton.NONE_BUTTON_TEXT			= "";

KeyButton.DEFALUT_ROUND_AMOUNT_PX	= 10;

KeyButton.NORMAL_KEY				= "normal_key";
KeyButton.NORMAL_FUNCTION_KEY		= "normal_function_key";
KeyButton.LEFT_FUNCTION_KEY			= "left_function_key";
KeyButton.CENTER_FUNCTION_KEY		= "center_function_key";
KeyButton.RIGHT_FUNCTION_KEY		= "right_function_key";


KeyButton.NONE_HAND					= 0;
KeyButton.LEFT_HAND					= 1;
KeyButton.RIGHT_HAND				= 2;
KeyButton.BOTH_HAND					= 3;

KeyButton.NONE_FINGER				= 0;
KeyButton.THUMB						= 1;
KeyButton.INDEX_FINGER				= 2;
KeyButton.INDEX_FINGER_BASELINE		= 3;
KeyButton.MIDDLE_FINGER				= 4;
KeyButton.RING_FINGER				= 5;
KeyButton.LITTLE_FINGER				= 6;