Skip to content

Commit

Permalink
1. 修复网络服务故障
Browse files Browse the repository at this point in the history
2. 新增魔器英雄选项
3. 配合新出的魔器技能,现在选择技能时现在会进行检查,避免同时装备魔器技能和专有技能
4. 修复一些BUG
  • Loading branch information
jay committed Oct 17, 2022
1 parent 0f5988a commit a75a164
Show file tree
Hide file tree
Showing 54 changed files with 1,605 additions and 735 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<bitmap android:gravity="fill" android:src="@drawable/background"/>
</item>
</layer-list>
6 changes: 6 additions & 0 deletions android/app/src/main/res/drawable-night/launch_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<bitmap android:gravity="fill" android:src="@drawable/background"/>
</item>
</layer-list>
18 changes: 18 additions & 0 deletions android/app/src/main/res/values-night-v31/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:forceDarkAllowed">false</item>
<item name="android:windowFullscreen">false</item>
<item name="android:windowSplashScreenBackground">#000000</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>
4 changes: 3 additions & 1 deletion android/app/src/main/res/values-night/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
<item name="android:forceDarkAllowed">false</item>
<item name="android:windowFullscreen">false</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Expand All @@ -15,4 +17,4 @@
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>
</resources>
8 changes: 5 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,27 @@ buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
jcenter()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.android.tools.build:gradle:7.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}

Expand Down
3 changes: 1 addition & 2 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
103 changes: 103 additions & 0 deletions flutter_native_splash.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,106 @@ flutter_native_splash:
#info_plist_files:
# - 'ios/Runner/Info-Debug.plist'
# - 'ios/Runner/Info-Release.plist'


# flutter_native_splash:

# This package generates native code to customize Flutter's default white native splash screen
# with background color and splash image.
# Customize the parameters below, and run the following command in the terminal:
# flutter pub run flutter_native_splash:create
# To restore Flutter's default white splash screen, run the following command in the terminal:
# flutter pub run flutter_native_splash:remove

# color or background_image is the only required parameter. Use color to set the background
# of your splash screen to a solid color. Use background_image to set the background of your
# splash screen to a png image. This is useful for gradients. The image will be stretch to the
# size of the app. Only one parameter can be used, color and background_image cannot both be set.
# color: "#42a5f5"
#background_image: "assets/background.png"

# Optional parameters are listed below. To enable a parameter, uncomment the line by removing
# the leading # character.

# The image parameter allows you to specify an image used in the splash screen. It must be a
# png file and should be sized for 4x pixel density.
#image: assets/splash.png

# The branding property allows you to specify an image used as branding in the splash screen.
# It must be a png file. Currently, it is only supported for Android < v12 and iOS.
#branding: assets/dart.png

# To position the branding image at the bottom of the screen you can use bottom, bottomRight,
# and bottomLeft. The default values is bottom if not specified or specified something else.
#branding_mode: bottom

# The color_dark, background_image_dark, image_dark, branding_dark are parameters that set the background
# and image when the device is in dark mode. If they are not specified, the app will use the
# parameters from above. If the image_dark parameter is specified, color_dark or
# background_image_dark must be specified. color_dark and background_image_dark cannot both be
# set.
#color_dark: "#042a49"
#background_image_dark: "assets/dark-background.png"
#image_dark: assets/splash-invert.png
#branding_dark: assets/dart_dark.png

# Android 12 handles the splash screen differently than previous versions. Please visit
# https://developer.android.com/guide/topics/ui/splash-screen
# Following are Android 12 specific parameter.
# android_12:
# The image parameter sets the splash screen icon image. If this parameter is not specified,
# the app's launcher icon will be used instead.
# Please note that the splash screen will be clipped to a circle on the center of the screen.
# App icon with an icon background: This should be 960×960 pixels, and fit within a circle
# 640 pixels in diameter.
# App icon without an icon background: This should be 1152×1152 pixels, and fit within a circle
# 768 pixels in diameter.
# image: assets/Feh.png

# App icon background color.
#icon_background_color: "#111111"

# The image_dark parameter and icon_background_color_dark set the image and icon background
# color when the device is in dark mode. If they are not specified, the app will use the
# parameters from above.
#image_dark: assets/android12splash-invert.png
#icon_background_color_dark: "#eeeeee"

# The android, ios and web parameters can be used to disable generating a splash screen on a given
# platform.
#android: false
#ios: false
#web: false

# The position of the splash image can be set with android_gravity, ios_content_mode, and
# web_image_mode parameters. All default to center.
#
# android_gravity can be one of the following Android Gravity (see
# https://developer.android.com/reference/android/view/Gravity): bottom, center,
# center_horizontal, center_vertical, clip_horizontal, clip_vertical, end, fill, fill_horizontal,
# fill_vertical, left, right, start, or top.
#android_gravity: center
#
# ios_content_mode can be one of the following iOS UIView.ContentMode (see
# https://developer.apple.com/documentation/uikit/uiview/contentmode): scaleToFill,
# scaleAspectFit, scaleAspectFill, center, top, bottom, left, right, topLeft, topRight,
# bottomLeft, or bottomRight.
#ios_content_mode: center
#
# web_image_mode can be one of the following modes: center, contain, stretch, and cover.
#web_image_mode: center

# To hide the notification bar, use the fullscreen parameter. Has no effect in web since web
# has no notification bar. Defaults to false.
# NOTE: Unlike Android, iOS will not automatically show the notification bar when the app loads.
# To show the notification bar, add the following code to your Flutter app:
# WidgetsFlutterBinding.ensureInitialized();
# SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom, SystemUiOverlay.top]);
#fullscreen: true

# If you have changed the name(s) of your info.plist file(s), you can specify the filename(s)
# with the info_plist_files parameter. Remove only the # characters in the three lines below,
# do not remove any spaces:
#info_plist_files:
# - 'ios/Runner/Info-Debug.plist'
# - 'ios/Runner/Info-Release.plist'
52 changes: 52 additions & 0 deletions lib/core/build_checker/build_checker.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// ignore_for_file: public_member_api_docs, sort_constructors_first
import 'package:feh_rebuilder/models/person/person.dart';
import 'package:feh_rebuilder/models/skill/skill.dart';

class CheckResult {
bool result;
String msg;
CheckResult({
required this.result,
this.msg = "",
});
}

abstract class BuilderCheckerPolicy {
CheckResult check(Person person, List<Skill?> skills);
}

/// 传承英雄不能设置祝福
class BuilderChecker1 implements BuilderCheckerPolicy {
@override
CheckResult check(Person person, List<Skill?> skills) {
if (person.legendary?.kind == 1 &&
(person.legendary?.element ?? 0) <= 4 &&
(person.legendary?.element ?? 0) >= 1) {
if (skills.length >= 8 && skills[7] != null) {
return CheckResult(result: false, msg: "传承英雄不能设置祝福");
}
}
return CheckResult(result: true);
}
}

/// 非魔器英雄不能同时装备魔器技能和专有技能
class BuilderChecker2 implements BuilderCheckerPolicy {
@override
CheckResult check(Person person, List<Skill?> skills) {
// 第九位技能是英雄的专有技能,部分追加专武的角色会因此造成问题,这里手动取前八位
var s = skills.sublist(0, 8);
// 非魔器英雄 且 技能列表中存在魔器技能
if (person.legendary?.kind != 5 &&
s.any((skill) => skill?.arcaneWeapon == true)) {
// 如果有除SID_歌う SID_踊る外的专有技能
if (s.any((skill) =>
(skill?.exclusive ?? false) &&
!["SID_歌う", "SID_踊る", "SID_奏でる"].contains(skill?.idTag))) {
return CheckResult(result: false, msg: "非魔器英雄不能同时装备魔器技能和专有技能");
}
}

return CheckResult(result: true);
}
}
14 changes: 9 additions & 5 deletions lib/core/filters/person.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ enum PersonFilterType {
isMythic,
// 开花英雄
isAscendant,
// 魔器英雄
isRearmed,

moveType,
weaponType,
Expand Down Expand Up @@ -51,15 +53,15 @@ class PersonFilter implements Filter<Person, PersonFilterType> {

@override
List<Person> get output {
List<Person> _output = [];
List<Person> result = [];

for (Person t in input) {
if (filtFunc(t)) {
_output.add(t);
result.add(t);
}
}

return _output;
return result;
}

@override
Expand Down Expand Up @@ -97,12 +99,14 @@ class PersonFilter implements Filter<Person, PersonFilterType> {
_legendaryKind.contains(person.legendary?.element);
case PersonFilterType.isAscendant:
return person.legendary?.kind == 4;
case PersonFilterType.isRearmed:
return person.legendary?.kind == 5;
case PersonFilterType.recentlyUpdated:
return person.recentlyUpdate;
case PersonFilterType.gameVersion:
Set<int> _valid =
Set<int> valid1 =
(valid as Set<GameVersionEnum>).map((e) => e.index + 1).toSet();
return _valid.contains((person.versionNum! / 100).floor());
return valid1.contains((person.versionNum! / 100).floor());
default:
throw "错误的过滤类型";
}
Expand Down
12 changes: 9 additions & 3 deletions lib/env_provider.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:io';

import 'package:feh_rebuilder/core/build_checker/build_checker.dart';
import 'package:feh_rebuilder/core/platform_info.dart';
import 'package:path_provider/path_provider.dart';
import 'package:path/path.dart' as p;
Expand All @@ -16,13 +17,13 @@ class EnvProvider {
static late final String tempDir;

/// 程序版本
static const String appVersion = "1.2.1";
static const String appVersion = "1.3.0";

/// 内建数据版本,必须与data.bin保持一致
static const int builtinDbVersion = 1649208732256;
static const int builtinDbVersion = 1665996648097;

/// app版本
static const int appVersionCode = 15;
static const int appVersionCode = 30;

static Future<void> init() async {
platformType = PlatformInfo().getCurrentPlatformType();
Expand All @@ -44,4 +45,9 @@ class EnvProvider {
throw UnsupportedError("暂不支持该平台");
}
}

static List<BuilderCheckerPolicy> activeBuildCheckers = [
BuilderChecker1(),
BuilderChecker2()
];
}
2 changes: 1 addition & 1 deletion lib/home_screens/cubit/screens_cubit.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:bloc/bloc.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

class ScreensCubit extends Cubit<int> {
ScreensCubit() : super(0);
Expand Down
2 changes: 1 addition & 1 deletion lib/home_screens/favourites/bloc/favscreen_bloc.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:feh_rebuilder/core/enum/page_state.dart';
import 'package:feh_rebuilder/models/person/person.dart';
import 'package:feh_rebuilder/models/personBuild/person_build.dart';
import 'package:feh_rebuilder/repositories/repository.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_swipe_action_cell/flutter_swipe_action_cell.dart';

part 'favscreen_event.dart';
Expand Down
2 changes: 2 additions & 0 deletions lib/home_screens/favourites/page.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// ignore_for_file: use_build_context_synchronously

import 'package:feh_rebuilder/home_screens/favourites/bloc/favscreen_bloc.dart';
import 'package:feh_rebuilder/my_18n/extension.dart';
import 'package:feh_rebuilder/pages/hero_detail/page.dart';
Expand Down
8 changes: 4 additions & 4 deletions lib/home_screens/home/bloc/home_bloc.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:feh_rebuilder/core/enum/game_version.dart';
import 'package:feh_rebuilder/core/enum/languages.dart';
Expand All @@ -14,6 +13,7 @@ import 'package:feh_rebuilder/core/filters/person.dart';
import 'package:feh_rebuilder/models/person/person.dart';
import 'package:feh_rebuilder/repositories/repository.dart';
import 'package:feh_rebuilder/widgets/jumpable_listview.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

part 'home_event.dart';
part 'home_state.dart';
Expand Down Expand Up @@ -316,13 +316,13 @@ class HomeBloc extends Bloc<HomeEvent, HomeState> {

// 华为的机器读取当前的locale似乎会和其他机器不一样,这里直接传值

String _localeStr = lang.locale.toString();
String localeStr = lang.locale.toString();

_sortByTranslations(source, _localeStr);
_sortByTranslations(source, localeStr);

for (var person in source) {
String translatedNames =
person.translatedNames[_localeStr] ?? person.roman!;
person.translatedNames[localeStr] ?? person.roman!;
if (!grouped.containsKey(translatedNames[0].toUpperCase())) {
grouped.addAll({
translatedNames[0].toUpperCase(): [person]
Expand Down
Loading

0 comments on commit a75a164

Please sign in to comment.