package wealk.android.jewels;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import javax.microedition.khronos.opengles.GL10;
import org.anddev.andengine.audio.sound.Sound;
import org.anddev.andengine.audio.sound.SoundFactory;
import org.anddev.andengine.engine.Engine;
import org.anddev.andengine.engine.camera.Camera;
import org.anddev.andengine.engine.handler.IUpdateHandler;
import org.anddev.andengine.engine.handler.timer.ITimerCallback;
import org.anddev.andengine.engine.handler.timer.TimerHandler;
import org.anddev.andengine.engine.options.EngineOptions;
import org.anddev.andengine.engine.options.EngineOptions.ScreenOrientation;
import org.anddev.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
import org.anddev.andengine.entity.scene.Scene;
import org.anddev.andengine.entity.scene.Scene.IOnSceneTouchListener;
import org.anddev.andengine.entity.shape.modifier.AlphaModifier;
import org.anddev.andengine.entity.shape.modifier.LoopShapeModifier;
import org.anddev.andengine.entity.shape.modifier.RotationModifier;
import org.anddev.andengine.entity.shape.modifier.ScaleModifier;
import org.anddev.andengine.entity.shape.modifier.SequenceShapeModifier;
import org.anddev.andengine.entity.sprite.Sprite;
import org.anddev.andengine.entity.text.ChangeableText;
import org.anddev.andengine.entity.text.Text;
import org.anddev.andengine.input.touch.TouchEvent;
import org.anddev.andengine.opengl.font.Font;
import org.anddev.andengine.opengl.font.FontFactory;
import org.anddev.andengine.opengl.texture.Texture;
import org.anddev.andengine.opengl.texture.TextureOptions;
import org.anddev.andengine.opengl.texture.region.TextureRegion;
import org.anddev.andengine.opengl.texture.region.TextureRegionFactory;
import org.anddev.andengine.ui.activity.BaseGameActivity;
import org.anddev.andengine.util.Debug;
import org.anddev.andengine.util.HorizontalAlign;
import org.anddev.andengine.util.MathUtils;
import wealk.android.jewels.constants.IConstants;
import wealk.android.jewels.entity.BackgroundCell;
import wealk.android.jewels.entity.BorderSprite;
import wealk.android.jewels.entity.JewelSprite;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Handler;
import android.os.Message;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.Toast;
/**
* @author Qingfeng
* @time 2010-11-03 ~ 2010
*/
public class Jewels extends BaseGameActivity implements IOnSceneTouchListener, IConstants {
// ===========================================================
// Constants
// ===========================================================
/**屏幕尺寸**/
private static final int CAMERA_WIDTH = 320;
private static final int CAMERA_HEIGHT = 480;
/**场景分层**/
private static final int LAYER_BACKGROUND = 0;
private static final int LAYER_BG_CELL = LAYER_BACKGROUND + 1;
private static final int LAYER_JEWELS = LAYER_BG_CELL + 1;
private static final int LAYER_SCORE = LAYER_JEWELS + 1;
// ===========================================================
// Fields
// ===========================================================
private Camera mCamera;//镜头
protected Scene mMainScene;//主场景
/**游戏模式**/
private String mGameModel;
/**游戏状态**/
private boolean mGameRunning;//游戏的总开关(可处理来电、任务切换等)
private boolean mIsSwaping;//交换状态
private final int MOVE_UP = 1;//上移
private final int MOVE_DOWN = 2;//下移
private final int MOVE_LEFT = 3;//左移
private final int MOVE_RIGHT = 4;//右移
private final int FALL = 5;//下落
private final int DEAD = 6;//死局
private final int CHECK = 0;//执行检测
private int STATE = CHECK;//一开始就检测,没有移动命令的时候也一直检测
/**游戏音效**/
private Sound mSwapErrorSound;//交换后不消去
private Sound mFallSound;//下落
private Sound mRemoveSound;//消去
private Sound mStartingSound;//开场音乐
private final int SPEED = 4;//移动速度
private int moveValue = 0;//交换移动的临时距离
/**背景**/
private int mCurBGNum;//当前使用的背景的编号
private Texture mBackgroundTexture,mBackground2Texture;
protected TextureRegion mBackgroundTextureRegion;
protected TextureRegion mBackground2TextureRegion;//游戏开始时的一个背景动画
/**钻石**/
private HashMap<String, JewelSprite> mHashMap;
private Texture[] mJewelTexture;
protected TextureRegion[] mJewelTextureRegion;
/**钻石边框**/
private BorderSprite mBorder;
private Texture mBorderTexture;
private TextureRegion mBorderTextureRegion;
/**单元格board**/
private Texture mBoardTexture;
private TextureRegion mBoardTextureRegion;
/**单元格背景**/
private Texture mBGCellTexture;
private TextureRegion mBGCellTextureRegion;
/**bonus**/
private Sprite mBonus;
private Texture mBonusStaticBGTexture,mBonusBGTexture,mBonusTexture;
private TextureRegion mBonusStaticBGTextureRegion,mBonusBGTextureRegion,mBonusTextureRegion;
/**LongestChain字体**/
private Texture mLongestChainFontTexture;
private Font mLongestChainFont;
/**关卡**/
private int mChapter = 1;
private float mChapterStep = 12;//关卡进度条每次增加到长度(每过一关递减)
private Texture mChapterTexture;
private Font mChapterFont;
private ChangeableText mChapterText,mXText;
/**最长连接**/
private int mLongestChain = 0;
private int mLongestChainTemp = 0;
private ChangeableText mLongestChainText;
/**分数**/
private int mScore = 0;
private Texture mScoreFontTexture;
private Font mScoreFont;
private ChangeableText mScoreBGText,mScoreText;
/**发光精灵**/
private Sprite mSpark,mSpark2;
private Texture mSparkTexture,mSpark2Texture;
private TextureRegion mSparkTextureRegion,mSpark2TextureRegion;
private int mCurRow,mCurCol;//当前选中的行、列
private int mLastRow,mLastCol;//上一个选中的行、列
private ArrayList<String> mDeadArrList;//可消去的钻石地址队列
private int mTime = 0;//每一次10秒后还不做任何操作就自动提示
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public Engine onLoadEngine() {
this.mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
return new Engine(new EngineOptions(true, ScreenOrientation.PORTRAIT,
new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), this.mCamera).setNeedsSound(true));//需要播放音效
}
@Override
public void onLoadResources() {
TextureRegionFactory.setAssetBasePath("gfx/");
/*背景*/
this.mCurBGNum = MathUtils.random(1, 4);
String bgPath = "bground" + String.valueOf(this.mCurBGNum) + ".png";
this.mBackgroundTexture = new Texture(512, 1024, TextureOptions.DEFAULT);
this.mBackground2Texture = new Texture(512, 1024, TextureOptions.DEFAULT);
this.mBackgroundTextureRegion = TextureRegionFactory.createFromAsset
(this.mBackgroundTexture, this, bgPath, 0, 0);
this.mBackground2TextureRegion = TextureRegionFactory.createFromAsset
(this.mBackground2Texture, this, "title_bg"+String.valueOf(this.mCurBGNum)+".png", 0, 0);
this.mEngine.getTextureManager().loadTexture(this.mBackgroundTexture);
this.mEngine.getTextureManager().loadTexture(this.mBackground2Texture);
/*钻石*/
this.mJewelTexture = new Texture[7];
this.mJewelTextureRegion = new TextureRegion[7];
for(int i=0; i<this.mJewelTexture.length; i++){
this.mJewelTexture[i] = new Texture(64, 64, TextureOptions.DEFAULT);
}
this.mJewelTextureRegion[0] = TextureRegionFactory.createFromAsset
(this.mJewelTe
没有合适的资源?快使用搜索试试~ 我知道了~
Android 游戏源代码 Jewels(含截图)
共76个文件
png:45个
java:12个
ogg:7个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 13 浏览量
2022-06-23
08:32:00
上传
评论
收藏 2.13MB RAR 举报
温馨提示
Android 游戏源代码 Jewels(含截图)Android 游戏源代码 Jewels(含截图)Android 游戏源代码 Jewels(含截图)Android 游戏源代码 Jewels(含截图)Android 游戏源代码 Jewels(含截图)Android 游戏源代码 Jewels(含截图)Android 游戏源代码 Jewels(含截图)Android 游戏源代码 Jewels(含截图)Android 游戏源代码 Jewels(含截图)Android 游戏源代码 Jewels(含截图)Android 游戏源代码 Jewels(含截图)Android 游戏源代码 Jewels(含截图)Android 游戏源代码 Jewels(含截图)Android 游戏源代码 Jewels(含截图)Android 游戏源代码 Jewels(含截图)Android 游戏源代码 Jewels(含截图)Android 游戏源代码 Jewels(含截图)Android 游戏源代码 Jewels(含截图)Android 游戏源代码 Jewels(含截图)Android 游戏源代码 Jewels(含截图)
资源推荐
资源详情
资源评论
收起资源包目录
Android 游戏源代码 Jewels(含截图).rar (76个子文件)
Jewels
.project 842B
default.properties 364B
bin
proguard.cfg 1KB
.settings
org.eclipse.core.resources.prefs 88B
AndroidManifest.xml 783B
Jewels.png 248KB
src
wealk
android
jewels
SQLiteHelper.java 6KB
JewelsActivity.java 346B
Menu.java 20KB
Jewels.java 50KB
constants
IConstants.java 1KB
entity
JewelCell.java 597B
ICell.java 570B
BackgroundCell.java 615B
BorderSprite.java 2KB
JewelSprite.java 3KB
ISprite.java 327B
project.properties 360B
res
values
strings.xml 134B
layout
submit.xml 460B
main.xml 385B
drawable-ldpi
ic_launcher.png 2KB
drawable-hdpi
ic_launcher.png 4KB
drawable
icon.png 5KB
drawable-mdpi
ic_launcher.png 3KB
.classpath 420B
lib
andengine.jar 764KB
gen
wealk
android
jewels
R.java 803B
assets
raw
drop2.ogg 13KB
illegal_move.ogg 11KB
drop1.ogg 11KB
remove.ogg 11KB
nextlevel.ogg 64KB
glug2.ogg 5KB
gameover.ogg 57KB
fonts
bluehigh.ttf 55KB
gfx
menubutton1.png 2KB
title_bg4.png 111KB
jewel2.png 5KB
jewel_dead2.png 4KB
jewel4.png 5KB
bground2.png 65KB
bonusbar_fill.png 2KB
title_bg3.png 104KB
jewel_dead4.png 4KB
arrow_right.png 538B
jewel_dead5.png 4KB
bground3.png 72KB
ranking_bg.png 80KB
bg_cell.png 116B
jewel_dead7.png 4KB
backarrow.png 1KB
logo.png 14KB
title_bg1.png 111KB
jewel_dead6.png 4KB
bonusbar.png 520B
scorefont2.png 1KB
jewel3.png 5KB
jewel5.png 5KB
hdpi_title_bg1.png 137KB
menubutton2.png 2KB
jewel1.png 4KB
jewel6.png 4KB
selection.png 736B
jewel_dea.png 4KB
jewel7.png 5KB
board.png 23KB
spark1.png 658B
jewel_dead3.png 4KB
scorefont.png 4KB
arrow_left.png 527B
title_bg2.png 102KB
bground1.png 87KB
spark2.png 435B
bground4.png 90KB
bonus.png 2KB
共 76 条
- 1
资源评论
金枝玉叶9
- 粉丝: 124
- 资源: 7640
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功