6 Revize b50535f42c ... cfbbd32d45

Autor SHA1 Zpráva Datum
  kidd3166 cfbbd32d45 up před 1 rokem
  kidd3166 16c2368789 up před 1 rokem
  kidd3166 84beeb9dbf http error před 1 rokem
  kidd3166 67198cffe0 http error před 1 rokem
  kidd3166 64d1dc7c14 优化游戏详情页先显示封面,点击再加载视频 před 1 rokem
  kidd3166 6253f17cb7 rollback před 1 rokem

+ 4 - 0
lib/application.dart

@@ -94,6 +94,10 @@ class Application {
     } catch (e) {
       print(e);
     }
+    infos.forEach((key, value) {
+      if(value is String)
+        infos[key] = Uri.encodeComponent(value);
+    });
     return infos;
   }
 

+ 40 - 8
lib/pages/game/game_detail.dart

@@ -1219,7 +1219,7 @@ class __VideoWidgetState extends State<_VideoWidget> {
   void initState() {
     super.initState();
 
-    controller = VideoPlayerController.network(widget.data.introduceVideo ?? "")..initialize();
+    controller = VideoPlayerController.network(widget.data.introduceVideo ?? "");
     controller.setLooping(true);
     if (controller.value.isPlaying == true) {
       overlay();
@@ -1313,13 +1313,17 @@ class __VideoWidgetState extends State<_VideoWidget> {
                                       height: 50.0,
                                     ),
                                     onTap: () {
-                                      if (v.isPlaying) {
-                                        controller.pause();
-                                      } else {
-                                        if (controller.value.position.compareTo(controller.value.duration) == 0) {
-                                          controller.seekTo(Duration.zero);
+                                      if(controller.value.isInitialized) {
+                                        if (v.isPlaying) {
+                                          controller.pause();
+                                        } else {
+                                          if (controller.value.position.compareTo(controller.value.duration) == 0) {
+                                            controller.seekTo(Duration.zero);
+                                          }
+                                          controller.play();
                                         }
-                                        controller.play();
+                                      }else{
+                                        controller.initialize().then((value) => controller.play());
                                       }
                                       overlay();
                                     },
@@ -1356,8 +1360,36 @@ class __VideoWidgetState extends State<_VideoWidget> {
                           ),
                         ),
                       );
-                    } else {
+                    }else if(v.isBuffering) {
                       return Center(child: CircularProgressIndicator());
+                    } else {
+                      return Container(
+                        width: double.infinity,
+                        height: double.infinity,
+                        child: Stack(
+                          fit: StackFit.expand,
+                          children: <Widget>[
+                            CachedNetworkImage(imageUrl: '${widget.data.introduceVideoCover}', fit: BoxFit.fitWidth,),
+                            Container(
+                              width: double.infinity,
+                              height: double.infinity,
+                              decoration: BoxDecoration(color: const Color(0xFF040404).withOpacity(.05)),
+                            ),
+                            Center(
+                              child: InkWell(
+                                child: Image.asset(
+                                  "lib/assets/img/game_icon_play.png",
+                                  height: 50.0,
+                                ),
+                                onTap: () {
+                                  controller.initialize().then((value) => controller.play());
+                                  overlay();
+                                },
+                              ),
+                            ),
+                          ],
+                        ),
+                      );
                     }
                   }),
               if (widget.isFullScreen)

+ 5 - 2
lib/pages/run/run_start.dart

@@ -209,8 +209,8 @@ class _PageState extends LifecycleState<RunStartPage> with TickerProviderStateMi
     AMapFlutterLocation.updatePrivacyAgree(true);
     AMapFlutterLocation.setApiKey(KEY_ANDROID, KEY_IOS);
 
-    _startLocation();
     await _addStepCount(true);
+    _startLocation();
   }
 
   _playAudio(List<String> audios) {
@@ -528,7 +528,10 @@ class _PageState extends LifecycleState<RunStartPage> with TickerProviderStateMi
     // }));
 
     if (Platform.isAndroid) {
-      await Permission.activityRecognition.request();
+      bool permissions = await Permission.activityRecognition.isGranted;
+      if (!permissions) {
+        return;
+      }
     }
 
     addSubscription(Pedometer.stepDetectionStream.listen((event) {

+ 10 - 4
lib/provider/bluetooth.dart

@@ -90,8 +90,12 @@ class Bluetooth with InjectApi, GameLog {
     characteristicWrite = null;
     characteristicNotify = null;
     if(_streamSubscriptions.isNotEmpty) {
-      for (StreamSubscription<dynamic> subscription in _streamSubscriptions) {
-        await subscription.cancel();
+      try {
+        for (StreamSubscription<dynamic> subscription in _streamSubscriptions) {
+                await subscription.cancel();
+              }
+      } catch (e) {
+        print(e);
       }
     }
     _streamSubscriptions.clear();
@@ -255,7 +259,7 @@ class Bluetooth with InjectApi, GameLog {
         autoConnect();
       } else if (state == BleStatus.unknown) {
       } else if (state == BleStatus.poweredOff) {
-        clearDevice(deleteStep: false);
+        // clearDevice(deleteStep: false);
         // ToastUtil.show("蓝牙服务已关闭");
       } else {}
     });
@@ -603,7 +607,9 @@ class Bluetooth with InjectApi, GameLog {
       await Future.delayed(Duration(seconds: 3));
     }
 
-    await disconnectDevice("断开蓝牙连接 $_connecting");
+    if(_connecting) {
+      await disconnectDevice("断开蓝牙连接 $_connecting");
+    }
 
     //
     // notifyConnectTime("F");

+ 13 - 12
lib/widgets/dialog/search_device.dart

@@ -167,29 +167,30 @@ class BluetoothOffScreen extends StatelessWidget {
       mainAxisSize: MainAxisSize.min,
       children: <Widget>[
         SizedBox(
-          height: 20,
+          height: 30,
         ),
         Image.asset("lib/assets/img/pop_icon_bluetooth.png"),
         SizedBox(
           height: 20,
         ),
         Text(
-          '蓝牙未开启',
+          '手机蓝牙未开启,请打开手机蓝牙',
           style: Theme.of(context).textTheme.bodyText2!,
         ),
         SizedBox(
           height: 10,
         ),
-        GestureDetector(
-          behavior: HitTestBehavior.opaque,
-          onTap: () async {
-            if (Platform.isAndroid) {
-              AndroidIntent intent = AndroidIntent(action: "android.bluetooth.adapter.action.REQUEST_ENABLE");
-              await intent.launch();
-            } else if (Platform.isIOS) {
-              launch("App-Prefs:root=Bluetooth");
-            }
-          },
+        if (Platform.isAndroid)
+          GestureDetector(
+            behavior: HitTestBehavior.opaque,
+            onTap: () async {
+              if (Platform.isAndroid) {
+                AndroidIntent intent = AndroidIntent(action: "android.bluetooth.adapter.action.REQUEST_ENABLE");
+                await intent.launch();
+              } else if (Platform.isIOS) {
+                launch("App-Prefs:root=Bluetooth");
+              }
+            },
           child: Center(
             child: Row(
               mainAxisSize: MainAxisSize.min,

+ 1 - 3
lib/widgets/dialog/search_device_connect.dart

@@ -47,6 +47,7 @@ class _SearchDeviceConnectDialog extends State<SearchDeviceConnectDialog> with S
     }));
 
     addSubscription(_flutterReactiveBle.connectedDeviceStream.listen((event) {
+      if(_timer == null)return;
       // if (event.failure != null) return;
 
       // print("11111111111111111111111 $event $_timer");
@@ -111,9 +112,6 @@ class _SearchDeviceConnectDialog extends State<SearchDeviceConnectDialog> with S
   _checkError() {
     setState(() {
       _error = _timer == null && (_state[0] == DeviceConnectionState.disconnected || (_state[1] == DeviceConnectionState.disconnected || _state[1] == DeviceConnectionState.disconnecting));
-      if(_error){
-        bluetooth.disconnectDevice("连接超时");
-      }
       // print("bluetooth - check error $_error $_state ");
     });
     // bool finish = _state[0] == DeviceConnectionState.connected && _state[1] == DeviceConnectionState.connected;

+ 1 - 1
plugin/shoes_sdk/ios/Classes/include/pub.h

@@ -44,7 +44,7 @@ using namespace std;
 
 #define PRESS_MIN 41000
 
-#define GAME_VERSION "0.5.63"
+#define GAME_VERSION "0.5.64"
 
 enum CMD_MOTION
 {

+ 22 - 0
plugin/shoes_sdk/ios/Classes/src/FingerGuessing.cpp

@@ -191,6 +191,24 @@ void FingerGuessing::Process(int time_stamp, int* right_pos, int* right_att, int
 	int* left_pos, int* left_att, int* left_acc, int left_zupt, int left_front_press, int left_back_press,
 	int jump, int down, int rssi)
 {
+
+	//由于刚触地的时候,会偶尔丢掉触地信号的关键帧,现在在线补充一下
+	
+	int online_zupt = extract_motion.online_detect_touch_floor( right_front_press,  left_front_press, right_back_press,  left_back_press);
+
+	if (online_zupt & 0x01)
+	{
+		std::cout << "test :: left_zupt" << endl;
+		left_zupt = 1;
+	}
+	if (online_zupt & 0x02)
+	{
+		std::cout << "test :: right_zupt" << endl;
+		right_zupt = 1;
+	}
+
+
+
 	//缓存一步内的空中数据
 	setData(right_shoes_data_vector, time_stamp, right_pos[0] * 0.001f, right_pos[1] * 0.001f, right_pos[2] * 0.001f,
 		right_att[0] * 0.0001f, right_att[1] * 0.0001f, right_att[2] * 0.0001f, right_zupt, rssi);
@@ -217,6 +235,8 @@ void FingerGuessing::Process(int time_stamp, int* right_pos, int* right_att, int
 			//根据过往记录的位置点来,来优化
 			//ProcessResult(left_global_pos, left_step_data_vector, left_global_pos_vector, LEFT_FOOT);
 
+			addMotionCount(STEP_COUNT);
+
 			left_cmd_step_data_vector = left_step_data_vector;
 
 			float dy = left_step_data_vector.back().pos_y - left_step_data_vector.front().pos_y;
@@ -243,6 +263,8 @@ void FingerGuessing::Process(int time_stamp, int* right_pos, int* right_att, int
 			//根据过往记录的位置点来,来优化
 			//ProcessResult(right_global_pos, right_step_data_vector, right_global_pos_vector, RIGHT_FOOT);
 
+			addMotionCount(STEP_COUNT);
+
 			right_cmd_step_data_vector = right_step_data_vector;
 
 			float dy = right_step_data_vector.back().pos_y - right_step_data_vector.front().pos_y;

+ 10 - 10
plugin/shoes_sdk/ios/Classes/src/JumpHouse.cpp

@@ -44,25 +44,25 @@ void JumpHouse::Process(int time_stamp, int* right_pos, int* right_att, int* rig
 	int* left_pos, int* left_att, int* left_acc, int left_zupt, int left_front_press, int left_back_press,
 	int jump, int down, int rssi)
 {
-	//锟斤拷锟斤拷一锟斤拷锟节的匡拷锟斤拷锟斤拷锟斤拷
+	//缓存一步内的空中数据
 	setData(right_shoes_data_vector, time_stamp, right_pos[0] * 0.001f, right_pos[1] * 0.001f, right_pos[2] * 0.001f,
 		right_att[0] * 0.0001f, right_att[1] * 0.0001f, right_att[2] * 0.0001f, right_zupt, rssi);
 
 	setData(left_shoes_data_vector, time_stamp, left_pos[0] * 0.001f, left_pos[1] * 0.001f, left_pos[2] * 0.001f,
 		left_att[0] * 0.0001f, left_att[1] * 0.0001f, left_att[2] * 0.0001f, left_zupt, rssi);
 
-	//锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟捷o拷锟斤拷锟斤拷锟饺�拷锟轿伙拷锟�
+	//根据新来的数据,计算的全局位置
 	calGlobalPos(right_shoes_data_vector, right_step_data_vector, right_global_pos, right_heading, 0, RIGHT_FOOT);
 
 	calGlobalPos(left_shoes_data_vector, left_step_data_vector, left_global_pos, left_heading, 0, LEFT_FOOT);
 
-	//锟斤拷锟斤拷锟脚革拷锟斤拷氐锟斤拷锟斤拷锟�
+	//补充后脚跟落地的问题
 
 	left_back_press_vector.push_back(left_back_press);
 
 	if(left_back_press_vector.size()> 10)
 	{
-		//锟斤拷示锟叫达拷锟斤拷锟斤拷锟斤拷时锟津,达拷锟斤拷锟斤拷锟�, 锟角诧拷锟斤拷为锟劫达拷锟斤拷
+		//表示有触地命令时候,触发检测, 是不是为假触地
 		left_back_press_vector.pop_front();
 		auto max_point = std::max_element(left_back_press_vector.begin(), left_back_press_vector.end());
 		auto min_point = std::min_element(left_back_press_vector.begin(), left_back_press_vector.end());
@@ -99,7 +99,7 @@ void JumpHouse::Process(int time_stamp, int* right_pos, int* right_att, int* rig
 
 	if (right_back_press_vector.size() > 10)
 	{
-		//锟斤拷示锟叫达拷锟斤拷锟斤拷锟斤拷时锟津,达拷锟斤拷锟斤拷锟�, 锟角诧拷锟斤拷为锟劫达拷锟斤拷
+		//表示有触地命令时候,触发检测, 是不是为假触地
 		right_back_press_vector.pop_front();
 		auto max_point = std::max_element(right_back_press_vector.begin(), right_back_press_vector.end());
 		auto min_point = std::min_element(right_back_press_vector.begin(), right_back_press_vector.end());
@@ -181,7 +181,7 @@ void JumpHouse::Process(int time_stamp, int* right_pos, int* right_att, int* rig
 		}
 	}
 
-	//通锟斤拷锟斤拷锟劫度★拷锟皆硷拷vector锟窖撅拷锟斤拷锟斤拷锟剿匡拷锟叫碉拷锟斤拷锟斤拷锟斤拷锟斤拷位锟叫讹拷锟斤拷锟斤拷锟斤拷锟斤拷锟绞憋拷锟斤拷锟斤拷锟斤拷锟绞憋拷锟斤拷锟斤拷锟斤拷锟斤拷时锟叫断碉拷效锟斤拷锟斤拷锟斤拷时锟斤拷为锟剿等猴拷锟绞碉拷RSSI
+	//通过加速度、以及vector已经缓存了空中的数据来定位判断命令所需的时间戳,这个时间戳是起延时判断的效果,延时是为了等合适的RSSI
 	if (left_step_data_vector.size() > 4 && left_step_data_vector.front().zupt == 1 && left_step_data_vector.back().zupt == 1
 		&& (left_back_press_detect_time == 0 || left_back_press_detect_time == 50))
 	{
@@ -214,7 +214,7 @@ void JumpHouse::Process(int time_stamp, int* right_pos, int* right_att, int* rig
 
 	}
 
-	/*锟斤拷蛹锟斤拷俣裙锟斤拷锟斤拷锟�
+	/*添加加速度过滤器
 	for (int i = 1; i < 3; i++)
 	{
 		for (int k = 0; k < 3; k++)
@@ -271,11 +271,11 @@ void JumpHouse::Process(int time_stamp, int* right_pos, int* right_att, int* rig
 
 	count++;
 
-	//锟斤拷锟斤拷锟斤拷锟斤拷
+	//重置命令
 	memset(result, -1, 4 * sizeof(int));
 
-	//锟叫讹拷双锟脚达拷锟截碉拷时锟斤拷, rssi < 23 锟斤拷锟斤拷锟轿伙拷锟斤拷锟饺灰裁伙拷旆�拷锟斤拷锟�
-	//锟斤拷锟斤拷锟斤拷rssi锟斤拷锟接筹拷锟叫癸拷锟矫碉拷
+	//判断双脚触地的时候, rssi < 23 必须归位,不然也没办法处理
+	//看起来rssi的延迟有够烂的
 
 	if (left_init == 1 && time_stamp - left_cmd_wait_time >= 9 && time_stamp - left_cmd_wait_time < 20 && left_press_valid > 0)
 	{

+ 12 - 12
plugin/shoes_sdk/ios/Classes/src/Tricycle.cpp

@@ -37,7 +37,7 @@ void Tricycle::Process(int time_stamp, int* right_pos, int* right_att, int* righ
 	int* left_pos, int* left_att, int* left_acc, int left_zupt, int left_front_press, int left_back_press,
 	int jump, int down, int rssi)
 {
-	//1锟斤拷确锟斤拷锟斤拷始锟侥凤拷锟斤拷
+	//1、确定初始的方向
 
 
 	if (left_acc_z_queue.size() > 10)
@@ -83,8 +83,8 @@ void Tricycle::Process(int time_stamp, int* right_pos, int* right_att, int* righ
 	float cur_right_heading = right_att[0] * 0.0001f;
 
 
-	//锟斤拷锟斤拷锟绞硷拷锟斤拷锟�
-	if (left_zupt_count > 50 && right_zupt_count > 50)
+	//计算初始方向
+	if (left_zupt_count > 100 && right_zupt_count > 100)
 	{
 		left_foot_init_heading = cur_left_heading;
 		right_foot_init_heading = cur_right_heading;
@@ -113,10 +113,10 @@ void Tricycle::Process(int time_stamp, int* right_pos, int* right_att, int* righ
 
 	float game_heading_offset = (left_heading_offset + right_heading_offset) * 0.5f;
 
-	//std::cout << "前锟斤拷锟斤拷锟斤拷 锟斤拷" << game_heading_offset / PI * 180.0f<<endl;
+	//std::cout << "前进度数 :" << game_heading_offset / PI * 180.0f<<endl;
 
-	//2锟斤拷锟斤拷锟斤拷锟酵放碉拷锟斤拷
-	//锟斤拷锟斤拷锟斤拷一锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟绞憋拷锟姐,锟斤拷锟斤拷么锟叫讹拷双锟斤拷同时锟斤拷锟截o拷锟斤拷锟斤拷锟斤拷锟斤拷0.5S锟斤拷锟揭的达拷小锟斤拷锟饺达拷锟斤拷锟斤拷锟脚号碉拷同时锟斤拷锟斤拷
+	//2、控制释放道具
+	//先设置一个触发命令的时间点,即怎么判定双脚同时触地,现在设置0.5S左右的大小来等待触地信号的同时到达
 
 	int down_prop = -1;
 
@@ -127,13 +127,13 @@ void Tricycle::Process(int time_stamp, int* right_pos, int* right_att, int* righ
 		left_jump_status = 1;
 		right_jump_status = 1;
 
-		//统锟斤拷锟斤拷
+		//统计跳
 		addMotionCount(JUMP_COUNT);
 
-		std::cout << "锟斤拷锟斤拷锟叫筹拷锟斤拷锟斤拷" << endl;
+		std::cout << "过程中出现跳" << endl;
 	}
 
-	//统锟狡诧拷锟斤拷
+	//统计步数
 	if (left_zupt && last_left_zupt == 0)
 	{
 		result[0] = MOTION_LEFT_ON_FLOOR;
@@ -163,14 +163,14 @@ void Tricycle::Process(int time_stamp, int* right_pos, int* right_att, int* righ
 
 			prop_status = up_prop;
 
-			std::cout << "锟较诧拷 锟斤拷锟斤拷锟斤拷品" << endl;
+			std::cout << "上层 发放物品" << endl;
 		}
 		else if (left_jump_status == 1 && right_jump_status == 1)
 		{
 			if (abs(left_pos_offset) < 100 && abs(right_pos_offset) < 100 && prop_status == 1)
 			{
 				up_prop = 1;
-				std::cout << "锟斤拷为锟较革拷状态锟斤拷 锟较层发锟斤拷锟斤拷品锟斤拷锟斤拷锟斤拷 锟斤拷锟揭诧拷锟� 锟较层发锟斤拷锟斤拷品" << endl;
+				std::cout << "因为上个状态是 上层发放物品,所以 这次也是 上层发放物品" << endl;
 			}
 			else if (abs(left_pos_offset) < 80 && abs(right_pos_offset) < 80)
 			{
@@ -178,7 +178,7 @@ void Tricycle::Process(int time_stamp, int* right_pos, int* right_att, int* righ
 
 				prop_status = 0;
 
-				std::cout << "锟铰诧拷 锟斤拷锟斤拷锟斤拷品" << endl;
+				std::cout << "下层 发放物品" << endl;
 			}
 			else
 			{

+ 1 - 1
pubspec.yaml

@@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
 # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
 # Read more about iOS versioning at
 # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
-version: 1.5.1+15102
+version: 1.5.2+15203
 
 environment:
   sdk: ">=2.16.0 <3.0.0"