Commit 83d705d8 authored by fallenstardust's avatar fallenstardust

expansions支持卡图和脚本读取

parent 7ff12e57
......@@ -48,6 +48,8 @@ void DeckManager::LoadLFList(const char* path, bool load_none) {
}
fclose(fp);
}
if(!load_none)
return;
LFList nolimit;
myswprintf(nolimit.listName, L"N/A");
nolimit.hash = 0;
......
......@@ -291,18 +291,22 @@ extern "C" DECL_DLLEXPORT int32 query_field_info(ptr pduel, byte* buf) {
duel* ptduel = (duel*)pduel;
*buf++ = MSG_RELOAD_FIELD;
*buf++ = ptduel->game_field->core.duel_rule;
int32 ct = 2;
for(int playerid = 0; playerid < 2; ++playerid) {
auto& player = ptduel->game_field->player[playerid];
*((int*)(buf)) = player.lp;
buf += 4;
ct += 4;
for(auto cit = player.list_mzone.begin(); cit != player.list_mzone.end(); ++cit) {
card* pcard = *cit;
if(pcard) {
*buf++ = 1;
*buf++ = pcard->current.position;
*buf++ = pcard->xyz_materials.size();
ct += 3;
} else {
*buf++ = 0;
ct++;
}
}
for(auto cit = player.list_szone.begin(); cit != player.list_szone.end(); ++cit) {
......@@ -310,8 +314,10 @@ extern "C" DECL_DLLEXPORT int32 query_field_info(ptr pduel, byte* buf) {
if(pcard) {
*buf++ = 1;
*buf++ = pcard->current.position;
ct += 2;
} else {
*buf++ = 0;
ct++;
}
}
*buf++ = player.list_main.size();
......@@ -320,8 +326,10 @@ extern "C" DECL_DLLEXPORT int32 query_field_info(ptr pduel, byte* buf) {
*buf++ = player.list_remove.size();
*buf++ = player.list_extra.size();
*buf++ = player.extra_p_count;
ct += 6;
}
*buf++ = ptduel->game_field->core.current_chain.size();
ct++;
for(auto chit = ptduel->game_field->core.current_chain.begin(); chit != ptduel->game_field->core.current_chain.end(); ++chit) {
effect* peffect = chit->triggering_effect;
*((int*)(buf)) = peffect->get_handler()->data.code;
......@@ -333,8 +341,9 @@ extern "C" DECL_DLLEXPORT int32 query_field_info(ptr pduel, byte* buf) {
*buf++ = chit->triggering_sequence;
*((int*)(buf)) = peffect->description;
buf += 4;
ct += 15;
}
return 0;
return ct;
}
extern "C" DECL_DLLEXPORT void set_responsei(ptr pduel, int32 value) {
((duel*)pduel)->set_responsei(value);
......
......@@ -925,7 +925,8 @@ unsigned char* android_script_reader(const char* script_name, int* slen) {
fclose(fp);
*slen = len;
return script_buffer;
} else if (typeDir == "script") {
//} else if (typeDir == "script") {
} else {
//try to find in directory based script.
if (access(script_name, F_OK) != -1) {
FILE *fp;
......@@ -962,9 +963,9 @@ unsigned char* android_script_reader(const char* script_name, int* slen) {
return script_buffer;
}
}
} else {
LOGW("read %s failed: unknown script source", script_name);
return 0;
//} else {
// LOGW("read %s failed: unknown script source", script_name);
// return 0;
}
}
......
......@@ -13,7 +13,7 @@ android {
flavorDimensions "versionCode"
vectorDrawables.useSupportLibrary = true
ndk {
abiFilters "armeabi","armeabi-v7a"
abiFilters "armeabi-v7a"
}
}
compileOptions {
......
......@@ -55,6 +55,7 @@ public interface Constants {
String FONT_DIRECTORY = "fonts";
String CORE_STRING_PATH = "strings.conf";
String CORE_LIMIT_PATH = "lflist.conf";
String CORE_CUSTOM_LIMIT_PATH = "expansions/lflist.conf";
String CORE_SYSTEM_PATH = "system.conf";
String CORE_SKIN_PATH = "textures";
String CORE_SKIN_PENDULUM_PATH = CORE_SKIN_PATH + "/extra";
......@@ -62,6 +63,7 @@ public interface Constants {
String CORE_EXPANSIONS = "expansions";
String CORE_SINGLE_PATH = "single";
String CORE_IMAGE_PATH = "pics";
String CORE_EXPANSIONS_IMAGE_PATH = "expansions/pics";
String CORE_IMAGE_FIELD_PATH = "field";
String CORE_SCRIPT_PATH = "script";
String CORE_REPLAY_PATH = "replay";
......
......@@ -177,11 +177,18 @@ public class ImageLoader implements Closeable {
public void bindImage(ImageView imageview, long code, Drawable pre, boolean isBig) {
String name = Constants.CORE_IMAGE_PATH + "/" + code;
String name_ex = Constants.CORE_EXPANSIONS_IMAGE_PATH + "/" + code;
String path = AppsSettings.get().getResourcePath();
boolean bind = false;
File zip = new File(path, Constants.CORE_PICS_ZIP);
for (String ex : Constants.IMAGE_EX) {
File file = new File(AppsSettings.get().getResourcePath(), name + ex);
File file_ex = new File(AppsSettings.get().getResourcePath(), name_ex + ex);
if (file_ex.exists()) {
bind(file_ex, imageview, Constants.BPG.equals(ex), code, pre, isBig);
bind = true;
return;
} else
if (file.exists()) {
bind(file, imageview, Constants.BPG.equals(ex), code, pre, isBig);
bind = true;
......
package cn.garymb.ygomobile.ui.home;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
......@@ -108,7 +107,7 @@ abstract class HomeActivity extends BaseActivity implements NavigationView.OnNav
checkForceUpdateSilent();
//ServiceDuelAssistant
startService(new Intent(this, ServiceDuelAssistant.class));
BtnJoinQQGroup();
StartMycard();
}
@Override
......@@ -232,10 +231,9 @@ abstract class HomeActivity extends BaseActivity implements NavigationView.OnNav
case R.id.action_deck_manager:
startActivity(new Intent(this, DeckManagerActivity.getDeckManager()));
break;
case R.id.action_mycard:
if (Constants.SHOW_MYCARD) {
startActivity(new Intent(this, MyCardActivity.class));
}
case R.id.action_join_qq_group:
String key = "dRkD2L9QgYiYmQoqJUgkR4QUth9UhuT4";
joinQQGroup(key);
break;
case R.id.action_help: {
WebActivity.open(this, getString(R.string.help), Constants.URL_HELP);
......@@ -355,12 +353,12 @@ abstract class HomeActivity extends BaseActivity implements NavigationView.OnNav
private void initBoomMenuButton(BoomMenuButton menu) {
final SparseArray<Integer> mMenuIds = new SparseArray<>();
addMenuButton(mMenuIds, menu, R.id.action_game, R.string.action_game, R.drawable.start);
addMenuButton(mMenuIds, menu, R.id.action_join_qq_group, R.string.Join_QQ, R.drawable.joinqqgroup);
addMenuButton(mMenuIds, menu, R.id.action_card_search, R.string.tab_search, R.drawable.search);
addMenuButton(mMenuIds, menu, R.id.action_deck_manager, R.string.deck_manager, R.drawable.deck);
addMenuButton(mMenuIds, menu, R.id.action_add_server, R.string.action_add_server, R.drawable.addsever);
addMenuButton(mMenuIds, menu, R.id.action_mycard, R.string.mycard, R.drawable.mycard);
addMenuButton(mMenuIds, menu, R.id.action_game, R.string.action_game, R.drawable.start);
addMenuButton(mMenuIds, menu, R.id.action_help, R.string.help, R.drawable.help);
addMenuButton(mMenuIds, menu, R.id.action_reset_game_res, R.string.reset_game_res, R.drawable.downloadimages);
......@@ -401,10 +399,11 @@ abstract class HomeActivity extends BaseActivity implements NavigationView.OnNav
findViewById(R.id.cube).startAnimation(shake); //给组件播放动画效果
}
public void BtnJoinQQGroup() {
$(R.id.btn_join_qq_group).setOnClickListener((v) -> {
String key = "dRkD2L9QgYiYmQoqJUgkR4QUth9UhuT4";
joinQQGroup(key);
public void StartMycard() {
$(R.id.btn_mycard).setOnClickListener((v) -> {
if (Constants.SHOW_MYCARD) {
startActivity(new Intent(this, MyCardActivity.class));
}
});
}
......
......@@ -50,11 +50,13 @@ public class ImageUpdater implements DialogInterface.OnCancelListener {
private int mError = 0;
File mPicsPath;
File mPicsExPath;
public ImageUpdater(BaseActivity context) {
mContext = context;
mCardLoader = new CardLoader(context);
mPicsPath = new File(AppsSettings.get().getResourcePath(), Constants.CORE_IMAGE_PATH);
mPicsExPath = new File(AppsSettings.get().getResourcePath(), Constants.CORE_EXPANSIONS_IMAGE_PATH);
}
public boolean isRunning() {
......@@ -167,6 +169,10 @@ public class ImageUpdater implements DialogInterface.OnCancelListener {
if (file.exists()) {
return true;
}
File fileex = new File(mPicsExPath, name + ex);
if (fileex.exists()) {
return true;
}
}
if (mZipFile != null) {
ZipEntry entry = null;
......
......@@ -16,11 +16,13 @@ import cn.garymb.ygomobile.utils.MD5Util;
import ocgcore.data.LimitList;
import static cn.garymb.ygomobile.Constants.CORE_LIMIT_PATH;
import static cn.garymb.ygomobile.Constants.CORE_CUSTOM_LIMIT_PATH;
public class LimitManager {
private static LimitManager sManager = new LimitManager();
private final List<LimitList> mLimitLists = new ArrayList<>();
private String lastMd5;
private String lastCustomMd5;
private int mCount;
private LimitManager() {
......@@ -44,18 +46,36 @@ public class LimitManager {
}
return null;
}
public boolean load_custom() {
File stringfile = new File(AppsSettings.get().getResourcePath(), CORE_CUSTOM_LIMIT_PATH);
if (stringfile == null) {
return false;
}
/*
String md5 = MD5Util.getFileMD5(stringfile.getAbsolutePath());
if (TextUtils.equals(md5, lastCustomMd5)) {
return true;
}
lastCustomMd5 = md5;
*/
return loadFile(stringfile.getAbsolutePath(), false);
}
public boolean load() {
boolean custom_res = load_custom();
File stringfile = new File(AppsSettings.get().getResourcePath(), CORE_LIMIT_PATH);
/*
String md5 = MD5Util.getFileMD5(stringfile.getAbsolutePath());
if (TextUtils.equals(md5, lastMd5)) {
return true;
}
lastMd5 = md5;
return loadFile(stringfile.getAbsolutePath());
*/
return loadFile(stringfile.getAbsolutePath(), custom_res);
}
public boolean loadFile(String path) {
public boolean loadFile(String path, boolean leave) {
if (path == null || path.length() == 0) {
return false;
}
......@@ -63,8 +83,10 @@ public class LimitManager {
if (file.isDirectory() || !file.exists()) {
return false;
}
mLimitLists.clear();
mLimitLists.add(new LimitList(null));
if (!leave) {
mLimitLists.clear();
mLimitLists.add(new LimitList(null));
}
InputStreamReader in = null;
FileInputStream inputStream = null;
try {
......@@ -104,6 +126,9 @@ public class LimitManager {
}
}
if (tmp != null) {
mLimitLists.add(tmp);
}
} catch (Exception e) {
Log.e("kk", "limit", e);
} finally {
......
......@@ -33,51 +33,56 @@
android:layout_height="match_parent"
android:orientation="vertical">
<com.nightonke.boommenu.BoomMenuButton
android:id="@+id/bmb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|left"
android:background="@drawable/buttonfunction"
app:bmb_buttonEnum="textOutsideCircle"
app:bmb_buttonPlaceEnum="buttonPlace_sc_9_1"
app:bmb_dimColor="#80000000"
app:bmb_normalColor="@android:color/transparent"
app:bmb_piecePlaceEnum="piecePlace_dot_9_1">
<com.nightonke.boommenu.BoomMenuButton
android:id="@+id/bmb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@drawable/buttonfunction"
app:bmb_buttonEnum="textOutsideCircle"
app:bmb_buttonPlaceEnum="buttonPlace_sc_9_1"
app:bmb_dimColor="#80000000"
app:bmb_normalColor="@android:color/transparent"
app:bmb_piecePlaceEnum="piecePlace_dot_9_1">
<ImageView
android:id="@+id/cube"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center"
app:srcCompat="@drawable/cube" />
</com.nightonke.boommenu.BoomMenuButton>
<ImageView
android:id="@+id/cube"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center"
app:srcCompat="@drawable/cube" />
</com.nightonke.boommenu.BoomMenuButton>
<TextView
android:layout_width="72dp"
android:layout_width="75dp"
android:layout_height="20dp"
android:gravity="center_horizontal"
android:text="功能菜单" />
android:gravity="bottom|center_horizontal"
android:text="@string/Function_Menu"
android:textSize="10sp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/btn_join_qq_group"
<LinearLayout
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:layout_gravity="bottom"
android:src="@drawable/joinqqgroup" />
<TextView
android:layout_width="72dp"
android:layout_height="2dp"
android:gravity="center_horizontal"
android:text="加群" />
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="50dp"
android:layout_height="17dp" />
<ImageView
android:id="@+id/btn_mycard"
android:layout_width="50dp"
android:layout_height="60dp"
android:gravity="bottom"
android:src="@drawable/mycard" />
<TextView
android:layout_width="50dp"
android:layout_height="20dp"
android:gravity="bottom|center_horizontal"
android:text="@string/mycard"
android:textSize="10sp"/>
</LinearLayout>
</LinearLayout>
</FrameLayout>
\ No newline at end of file
......@@ -15,7 +15,7 @@
android:icon="@drawable/ic_add"
android:title="@string/action_add_server"/>
<item
android:id="@+id/action_mycard"
android:id="@+id/action_join_qq_group"
android:icon="@drawable/ic_home_black"
android:title="@string/mycard"/>
<item
......
......@@ -26,5 +26,7 @@
<item>"마스터룰4"가 아니라 "뉴마스터룰"입니다.</item>
<item>리플레이 오류는 보통 서버와 클라이언트의 스크립트 차이로 발생하며 마땅한 해결법은 아직 없습니다. 가능한 클라우드 리플레이를 이용해주십시오. </item>
<item>게임중 검은네모칸이 발생할 경우 좌측상단의 카드 이미지를 두번 터치 해주세요.</item>
<item>강해지기 위해 단순히 티어덱을 배끼는 것 만이 아니라 덱을 사용하며 이해하는 과정이 필요합니다.</item>
<item>초보유저든, 복귀유저든 배울 마음만 있다면 크게 어렵지 않습니다.</item>
</string-array>
</resources>
\ No newline at end of file
......@@ -208,4 +208,6 @@
\n그후 YGOMobile의 다른앱 표시 권한이 혀용되어 있는지 확인하십시오.</string>
<string name="OpenTIP">빠른 사용법</string>
<string name="Open_Alert_Window">애플리케이션 관리</string>
<string name="Function_Menu">특징 메뉴</string>
<string name="Join_QQ">QQ Group</string>
</resources>
......@@ -11,20 +11,22 @@
</string-array>
<string-array name="tips">
<item>游戏王圈子不大,珍惜一起玩的人</item>
<item>界面偏了还点不准?试试去「设置」→打勾/取消「在游戏隐藏虚拟键」</item>
<item>界面偏了还点不准?试试去「功能菜单」→「设置」→打勾/取消「在游戏隐藏虚拟键」</item>
<item>主页每个服务器按住左划就会出现「编辑」和「删除」哦</item>
<item>试试点击左下角浮动的「贤者之石」会有更多功能</item>
<item>想不联网也打人机?左下角→「单人游戏」→「人机模式」</item>
<item>卡图怎么没了?点击左下角→「重置资源」</item>
<item>试试点击左下角浮动的「功能菜单」会有更多功能</item>
<item>想不联网也打人机?「功能菜单」→「单人游戏」→「人机模式」</item>
<item>卡图怎么没了?点击「功能菜单」→「重置资源」</item>
<item>卡组自己组更能享受游戏乐趣,自己组也更容易神抽哦</item>
<item>看到每个服务器右下的宝石了吗?点点看吧</item>
<item>先行卡和正式卡密码不同,打了补丁要注意区分哦</item>
<item>觉得遇到BUG先确定是否真的是BUG再进行反馈哈</item>
<item>不懂怎么更新?去设置-「检查更新」看看</item>
<item>不知道怎么用,可以点开左下-「教程」查看使用方法</item>
<item>维护开发不容易,欢迎前往左下角→「支持我们」留下您的心意</item>
<item>不懂怎么更新?去「功能菜单」→「设置」→「检查更新」看看</item>
<item>不知道怎么用,可以点开「功能菜单」→「教程」查看使用方法</item>
<item>维护开发不容易,欢迎前往「功能菜单」→「支持我们」留下您的心意</item>
<item>没有所谓的“大师规则4”只有「新大师规则」哦</item>
<item>录像出错就删了吧,暂时还没有解决办法</item>
<item>决斗中文字变黑块了?点点左上卡图就可消除</item>
<item>录像出错就删了吧,暂时还没有解决办法T.T</item>
<item>决斗中文字变黑块了?点点左上大卡图就可消除</item>
<item>再强的卡组抄来也不会变强哦,自己努力组卡定会有回报</item>
<item>不管是新手还是回归玩家,只要肯学习,不用多久就能成为大佬哦</item>
</string-array>
</resources>
\ No newline at end of file
......@@ -208,4 +208,6 @@
\n并确保本软件后台运行中</string>
<string name="OpenTIP">快捷加房使用方法</string>
<string name="Open_Alert_Window">去打开悬浮窗</string>
<string name="Function_Menu">功能菜单</string>
<string name="Join_QQ">水友群</string>
</resources>
......@@ -25,5 +25,7 @@
<item>there's no so-called "MR4",that's "New Master Rule"</item>
<item>Delete the Replay which shows "error occurs",we will fix one day</item>
<item>you can click card image on left top to clean the black bar in words while dueling</item>
<item>others' Good deck not always be good for you, try to Build your own style</item>
<item>Keep playing and learning, you'll be strong soon.even beginner and returner</item>
</string-array>
</resources>
\ No newline at end of file
......@@ -211,4 +211,6 @@
\nand keep the soft run in the background</string>
<string name="OpenTIP">about Quick Join in Game</string>
<string name="Open_Alert_Window">To Open Pop-ups</string>
<string name="Function_Menu">MENU</string>
<string name="Join_QQ">QQ Group</string>
</resources>
......@@ -25,7 +25,7 @@
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="5px" />
</cn.garymb.ygomobile.ui.online.MyCardWebView>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment