⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cardcontainer.java

📁 手机游戏 JSol prototype J2ME源代码+详细注释
💻 JAVA
字号:
package de.tsr.jsol.logic;

import javax.microedition.lcdui.*;
import java.util.*;

import de.tsr.jsol.gui.GraphicsWrapper;
import de.tsr.jsol.gui.IGraphicsWrapper;
import de.tsr.jsol.util.Position;

public abstract class CardContainer implements IConnectable {
	private int _x;
	private int _y;
	
	protected int xPos = 0;
	protected int yPos = 0;
	protected Vector _singleClickDestinations;
	
	private IConnectable _up;
	private IConnectable _down;
	private IConnectable _left;
	private IConnectable _right;
	
	
	public CardContainer( int x, int y ){
		_x = x;
		_y = y;
		_singleClickDestinations = new Vector();
	}
	
	public final void Paint( Graphics g ) {
		Draw( new GraphicsWrapper( g, _x, _y ) );
	}
	
	protected abstract void Draw( IGraphicsWrapper gw );	
	
	public IConnectable Down() {
		return _down;
	}
	public IConnectable Left() {
		return _left;
	}
	public IConnectable Right() {
		return _right;
	}
	public IConnectable Up() {
		return _up;
	}
	
	public void ConnectDown(IConnectable down) {
		_down = down;
	}
	public void ConnectLeft(IConnectable left) {
		_left = left;
	}
	public void ConnectRight(IConnectable right) {
		_right = right;
	}
	public void ConnectUp(IConnectable up) {
		_up = up;
	}
	
	public Position GetCursorPosition() {
		return new Position(_x, _y );
	}
	
	protected int XPosition() {
		return _x;
	}
	protected int YPosition() {
		return _y;
	}
	
	protected void DrawEmptyContainer( IGraphicsWrapper gw ) {
		gw.setColor( 0,255,0);
		gw.drawRect(xPos,yPos,Card.width, Card.height);
		gw.drawString("O", xPos / 2, yPos / 2, Card.textLocation);
	}
	
	public void AddSingleClickDestination( CardContainer destination ) {
		_singleClickDestinations.addElement(destination);
	}
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -