当前位置: 首页 > news >正文

专业做淘宝网站推广江阴企业网站建设

专业做淘宝网站推广,江阴企业网站建设,网站企业建设方案,wordpress侧边栏淘宝客摘要#xff1a;这是一款基于GitHub项目修改的中国象棋Android应用#xff0c;主要功能包括悔棋、重开局、AI等级设置和先手选择等。项目采用Android Studio开发#xff0c;compileSdkVersion为33#xff0c;支持Android 5.0(API 24)及以上系统。应用采用SoundPool实现音效…摘要这是一款基于GitHub项目修改的中国象棋Android应用主要功能包括悔棋、重开局、AI等级设置和先手选择等。项目采用Android Studio开发compileSdkVersion为33支持Android 5.0(API 24)及以上系统。应用采用SoundPool实现音效播放SharedPreferences保存游戏配置和进度并实现了完整的象棋逻辑和UI交互。主要功能模块包括游戏主界面(MainActivity)、棋盘视图(GameBoardView)和游戏逻辑(GameLogic)等支持加载上次游戏进度提供多种棋子样式选择。 1、效果展示 基于github项目修改 2、功能支持悔棋、重开、设置等级、优先出棋等 a.工程build代码情况 模块build compileSdk 33defaultConfig {applicationId com.hzy.chinese.jchessminSdk 24targetSdk 32versionCode 5versionName 1.0.4testInstrumentationRunner android.support.test.runner.AndroidJUnitRunner}工程build文件 // Top-level build file where you can add configuration options common to all sub-projects/modules.plugins {id com.android.application version 7.2.2 apply falseid com.android.library version 7.2.2 apply falseid io.github.wurensen.android-aspectjx version 3.3.2 apply false }task clean(type: Delete) {delete rootProject.buildDir }b.chess主页面代码 package com.hzy.chinese.jchess.activity;import android.content.Intent; import android.content.SharedPreferences; import android.media.AudioManager; import android.media.SoundPool; import android.os.Build; import android.os.Bundle; import android.preference.PreferenceManager; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.ProgressBar; import android.widget.Toast;import androidx.appcompat.app.AppCompatActivity;import com.hzy.chinese.jchess.R; import com.hzy.chinese.jchess.game.GameConfig; import com.hzy.chinese.jchess.game.GameLogic; import com.hzy.chinese.jchess.game.IGameCallback; import com.hzy.chinese.jchess.view.GameBoardView;import java.util.LinkedList;import butterknife.BindView; import butterknife.ButterKnife;public class MainActivity extends AppCompatActivityimplements IGameCallback {BindView(R.id.game_board)GameBoardView mGameBoard;BindView(R.id.game_progress)ProgressBar mGameProgress;private SoundPool mSoundPool;private LinkedListInteger mSoundList;private GameLogic mGameLogic;private SharedPreferences mPreference;private boolean mSoundEnable;private int mHandicapIndex;private boolean mComputerFlip;private int mPieceStyle;private int mAILevel;Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_chess);ButterKnife.bind(this);mPreference PreferenceManager.getDefaultSharedPreferences(getApplicationContext());loadDefaultConfig();initSoundPool();initGameLogic();}Overridepublic boolean onCreateOptionsMenu(Menu menu) {getMenuInflater().inflate(R.menu.menu_main_activity, menu);return super.onCreateOptionsMenu(menu);}Overridepublic boolean onOptionsItemSelected(MenuItem item) {switch (item.getItemId()) {case R.id.main_menu_exit:// 退出finish();break;case R.id.main_menu_retract:// 悔棋mGameLogic.retract();break;case R.id.main_menu_restart:// 重开mGameLogic.restart(mComputerFlip, mHandicapIndex);showMessage(getString(R.string.new_game_started));break;case R.id.main_menu_settings:// 设置startActivity(new Intent(this, SettingsActivity.class));break;}return super.onOptionsItemSelected(item);}Overrideprotected void onResume() {super.onResume();loadDefaultConfig();mGameLogic.setLevel(mAILevel);mGameBoard.setPieceTheme(mPieceStyle);mGameBoard.invalidate();}Overrideprotected void onDestroy() {if (mSoundPool ! null) {mSoundPool.release();}mPreference.edit().putString(GameConfig.PREF_LAST_FEN, mGameLogic.getCurrentFen()).apply();super.onDestroy();}private void loadDefaultConfig() {// 音效开启状态 默认 开启 true 关闭 falsemSoundEnable mPreference.getBoolean(getString(R.string.pref_sound_key), true);// 先走让子 0 1 2 3mHandicapIndex Integer.parseInt(mPreference.getString(getString(R.string.pref_handicap_key), 0));// 电脑先走 false true 则先走mComputerFlip mPreference.getBoolean(getString(R.string.pref_who_first_key), false);// 棋子样式 0 1mPieceStyle Integer.parseInt(mPreference.getString(getString(R.string.pref_piece_style_key), 0));// 电脑棋力 0 1 2 3 4mAILevel Integer.parseInt(mPreference.getString(getString(R.string.pref_level_key), 0));}private void initSoundPool() {mSoundList new LinkedList();int poolSize GameConfig.SOUND_RES_ARRAY.length;if (Build.VERSION.SDK_INT Build.VERSION_CODES.LOLLIPOP) {mSoundPool new SoundPool.Builder().setMaxStreams(poolSize).build();} else {mSoundPool new SoundPool(poolSize, AudioManager.STREAM_MUSIC, 0);}for (int res : GameConfig.SOUND_RES_ARRAY) {mSoundList.add(mSoundPool.load(this, res, 1));}}private void initGameLogic() {mGameLogic mGameBoard.getGameLogic();mGameLogic.setCallback(this);mGameLogic.setLevel(mAILevel);mGameBoard.setPieceTheme(mPieceStyle);// load last saved gameString lastFen mPreference.getString(GameConfig.PREF_LAST_FEN, );if (lastFen.isEmpty()) {mGameLogic.restart(mComputerFlip, mHandicapIndex);} else {showMessage(getString(R.string.load_last_game_finish));mGameLogic.restart(mComputerFlip, lastFen);}}Overridepublic void postPlaySound(final int soundIndex) {if (mSoundPool ! null mSoundEnable) {int soundId mSoundList.get(soundIndex);mSoundPool.play(soundId, 1, 1, 0, 0, 1);}}Overridepublic void postShowMessage(final String message) {runOnUiThread(() - showMessage(message));}private void showMessage(String message) {Toast.makeText(this, message, Toast.LENGTH_LONG).show();}Overridepublic void postShowMessage(int messageId) {postShowMessage(getString(messageId));}Overridepublic void postStartThink() {runOnUiThread(() - mGameProgress.setVisibility(View.VISIBLE));}Overridepublic void postEndThink() {runOnUiThread(() - mGameProgress.setVisibility(View.GONE));} }3、源码获取 https://download.csdn.net/download/shi450561200/91070234?spm1001.2014.3001.5501
http://www.hkea.cn/news/14399557/

相关文章:

  • 大型网站过程制作h5页面的工具有哪些
  • 如何将软件上传到公开网站太原做网站哪里好
  • 简单炫酷的编程代码怀柔网站建设优化seo
  • 昆明新建设电影院网站wordpress评论高亮
  • 中国海洋大学站群网站建设seo是啥职业
  • 大学制作网站怎么做wordpress忘記密碼
  • 网站模板 黑白个人网页设计作品欣赏图片
  • 网站建设企业官网源码页面设计的要求
  • 网站建设成本报表岑溪网站建设
  • 免费招聘网站有哪些平台百度提交入口网站网址
  • 天津建设招标网站广西建设厅网证件查询
  • wordpress切换主题宁波seo排名优化
  • 同国外做贸易的网站2021年国家大事件有哪些
  • 柳州市诚信体系建设网站荥阳seo推广
  • 科技网站设计公司有哪些wordpress 公司主页
  • 怎么做下载网站网页设计作业html代码大全
  • win2008iis7配置网站宿州网站建设哪家好
  • 邢台哪儿做wap网站好天津品牌网站建设公司
  • 做交流网站辽宁省建设厅网站
  • 常州百度网站排名ui培训公司
  • 网站开发 进度表重庆网站建站建设的费用
  • 成都网站建设网怎么做app和网站购物
  • 商城网站建设可以吗高端建站服务商
  • 网站建设需要哪些功能请别人做网站大概要多少钱
  • 做公司网站需要多久食品销售公司网站制作
  • 开发一个个人网站建设路第3小学网站电话
  • 怎么提高网站的百度收录杭州注册公司
  • 网站建设与维护费用网站需要做实名认证如何做
  • 光大成贤建设有限公司网站旅游网站项目评估
  • 山东省建设管理信息网站本地php网站搭建