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

📄 player.java

📁 一款J2ME作得手机游戏
💻 JAVA
字号:
package org.javagarden.j2me.fivelink.client;


/**
 * 游戏玩家。
 * @author Turbo Chen
 * @created 2005-3-16
 */
public class Player
{
    public final static int BLACK = 1;
    public final static int WHITE = -1;
    
    public final static int HUMAN = 1;
    public final static int MACHINE = 0;
    
    private int chessType;
    private int score = 0;
    private int id;
    
    public int getScore()
    {
        return score;
    }
    public void setScore(int score)
    {
        this.score = score;
    }
    
    public boolean equals(Object obj)
    {
        if ( obj!=null )
        {
            if ( obj instanceof Player ) 
            {
                Player p = (Player)obj;
                if ( p.id==this.id )
                    return true;
                else 
                    return false;
            }else
                return false;
            
        }else 
            return false;
    }
    
    public String toString()
    {
        if ( this.id==MACHINE )
            return "Mobile";
        if ( this.id==HUMAN)
        	return "You";
        return "Unknown";
    }
    
    public Player(int pid, int cType)
    {
        this.id = pid;
        this.chessType = cType;
    }
    public int getChessType()
    {
        return chessType;
    }
    public void setChessType(int chessType)
    {
        this.chessType = chessType;
    }

    public int getId()
    {
        return id;
    }
    public void setId(int id)
    {
        this.id = id;
    }
}

⌨️ 快捷键说明

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