leon před 2 roky
rodič
revize
72274a2c97
100 změnil soubory, kde provedl 3570 přidání a 4181 odebrání
  1. binární
      .DS_Store
  2. binární
      DanceGame/.DS_Store
  3. binární
      DanceGame/2208x1142.jpg
  4. binární
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/.DS_Store
  5. binární
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/.DS_Store
  6. binární
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/.DS_Store
  7. 14 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/BTDataAnalysis.h
  8. 129 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/BTDataAnalysis.mm
  9. 11 35
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/BTDataProcess.h
  10. 291 516
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/BTDataProcess.mm
  11. 29 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/BTDataSend.h
  12. 163 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/BTDataSend.m
  13. 40 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/DebugView.h
  14. 242 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/DebugView.m
  15. 51 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/MainShoesAnalysis.h
  16. 551 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/MainShoesAnalysis.mm
  17. 16 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/ViceShoesAnalysis.h
  18. 12 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/ViceShoesAnalysis.m
  19. 0 19
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/Entity /UserFriendsModel.h
  20. binární
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/HTTP/.DS_Store
  21. 16 6
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/HTTP/HTTPDataProcession.h
  22. 50 50
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/HTTP/HTTPDataProcession.m
  23. 1 1
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/HTTP/socket/SocketRocketUtility.m
  24. 23 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/IOSPlatformSDK.h
  25. 125 329
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/IOSPlatformSDK.mm
  26. binární
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/.DS_Store
  27. binární
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash-master/.DS_Store
  28. binární
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash-master/AvoidCrashDemo/.DS_Store
  29. 0 116
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/AvoidCrash.h
  30. 0 212
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/AvoidCrash.m
  31. 0 17
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/AvoidCrashProtocol.h
  32. 0 37
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/AvoidCrashStubProxy.h
  33. 0 18
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/AvoidCrashStubProxy.m
  34. 0 25
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSArray+AvoidCrash.h
  35. 0 258
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSArray+AvoidCrash.m
  36. 0 25
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSAttributedString+AvoidCrash.h
  37. 0 96
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSAttributedString+AvoidCrash.m
  38. 0 24
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSDictionary+AvoidCrash.h
  39. 0 56
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSDictionary+AvoidCrash.m
  40. 0 26
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSMutableArray+AvoidCrash.h
  41. 0 169
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSMutableArray+AvoidCrash.m
  42. 0 23
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSMutableAttributedString+AvoidCrash.h
  43. 0 74
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSMutableAttributedString+AvoidCrash.m
  44. 0 24
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSMutableDictionary+AvoidCrash.h
  45. 0 95
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSMutableDictionary+AvoidCrash.m
  46. 0 29
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSMutableString+AvoidCrash.h
  47. 0 97
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSMutableString+AvoidCrash.m
  48. 0 34
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSObject+AvoidCrash.h
  49. 0 221
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSObject+AvoidCrash.m
  50. 0 29
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSString+AvoidCrash.h
  51. 0 204
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSString+AvoidCrash.m
  52. binární
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/Bugly-2.5.9/.DS_Store
  53. binární
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/Bugly-2.5.9/Bugly.framework/Bugly
  54. 163 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/Bugly-2.5.9/Bugly.framework/Headers/Bugly.h
  55. 141 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/Bugly-2.5.9/Bugly.framework/Headers/BuglyConfig.h
  56. 78 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/Bugly-2.5.9/Bugly.framework/Headers/BuglyLog.h
  57. 12 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/Bugly-2.5.9/Bugly.framework/Modules/module.modulemap
  58. 156 156
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/Tool/GameObjc.h
  59. 367 368
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/Tool/GameObjc.mm
  60. 18 8
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/Tool/MYFactoryManager.h
  61. 264 171
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/Tool/MYFactoryManager.m
  62. 4 1
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/UI/AnimationVIew/AnimationView.m
  63. 3 9
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/UI/CarouselView/ShoesCarouselView.m
  64. 1 1
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/UI/CarouselView/TXCarouselView.m
  65. 0 2
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/UI/SearchDeviceViewController.h
  66. 3 7
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/UI/SearchDeviceViewController.m
  67. binární
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/shoe_sdk_c/shoes_sdk_2.0/.DS_Store
  68. 1 1
      DanceGame/Classes/UnityAppController.h
  69. 32 11
      DanceGame/Classes/UnityAppController.mm
  70. 0 0
      DanceGame/DefaultLandscape.png
  71. 3 1
      DanceGame/Info.plist
  72. 3 4
      DanceGame/LaunchScreen-iPad.storyboard
  73. 7 8
      DanceGame/LaunchScreen-iPhone.storyboard
  74. binární
      DanceGame/LaunchScreen-iPhoneLandscape.png
  75. binární
      DanceGame/LaunchScreen-iPhonePortrait.png
  76. binární
      DanceGame/LaunchScreenImage-Landscape.png
  77. binární
      DanceGame/LaunchScreenImage-Portrait.png
  78. 2 3
      DanceGame/Unity-iPhone Tests/Unity_iPhone_Tests.m
  79. 469 492
      DanceGame/Unity-iPhone.xcodeproj/project.pbxproj
  80. 3 3
      DanceGame/Unity-iPhone.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
  81. binární
      DanceGame/Unity-iPhone.xcodeproj/project.xcworkspace/xcuserdata/duowan123.xcuserdatad/UserInterfaceState.xcuserstate
  82. 18 0
      DanceGame/Unity-iPhone.xcodeproj/project.xcworkspace/xcuserdata/duowan123.xcuserdatad/WorkspaceSettings.xcsettings
  83. 6 0
      DanceGame/Unity-iPhone.xcodeproj/xcuserdata/duowan123.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
  84. 47 67
      DanceGame/Unity-iPhone/Images.xcassets/LaunchImage.launchimage/Contents.json
  85. binární
      DanceGame/Unity-iPhone/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png
  86. binární
      DanceGame/Unity-iPhone/Images.xcassets/LaunchImage.launchimage/Default-667h@2x.png
  87. binární
      DanceGame/Unity-iPhone/Images.xcassets/LaunchImage.launchimage/Default-Portrait-736h@3x.png
  88. binární
      DanceGame/Unity-iPhone/Images.xcassets/LaunchImage.launchimage/Default.png
  89. binární
      DanceGame/Unity-iPhone/Images.xcassets/LaunchImage.launchimage/Default@2x.png
  90. binární
      DanceGame/Unity-iPhone/Images.xcassets/LaunchImage.launchimage/Default~ipad.png
  91. binární
      DanceGame/Unity-iPhone/Images.xcassets/LaunchImage.launchimage/Default~ipad@2x.png
  92. binární
      DanceGame/Unity-iPhone/Images.xcassets/LaunchImage.launchimage/Default~ipad~landscape.png
  93. binární
      DanceGame/Unity-iPhone/Images.xcassets/LaunchImage.launchimage/Default~ipad~landscape@2x.png
  94. binární
      DanceGame/Unity-iPhone/Images.xcassets/LaunchImage.launchimage/Default~ipad~landscape~nostatusbar.png
  95. binární
      DanceGame/Unity-iPhone/Images.xcassets/LaunchImage.launchimage/Default~ipad~landscape~nostatusbar@2x.png
  96. binární
      DanceGame/Unity-iPhone/Images.xcassets/LaunchImage.launchimage/Default~ipad~nostatusbar.png
  97. binární
      DanceGame/Unity-iPhone/Images.xcassets/LaunchImage.launchimage/Default~ipad~nostatusbar@2x.png
  98. 3 1
      DanceGame/Unity-iPhone/cn.entitlements
  99. 2 2
      README.md
  100. binární
      RunGame/.DS_Store

binární
.DS_Store


binární
DanceGame/.DS_Store


binární
DanceGame/2208x1142.jpg


binární
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/.DS_Store


binární
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/.DS_Store


binární
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/.DS_Store


+ 14 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/BTDataAnalysis.h

@@ -0,0 +1,14 @@
+//
+//  BTDataAnalysis.h
+//  Unity-iPhone
+//
+//  Created by duowan123 on 2022/1/26.
+//
+
+#import <Foundation/Foundation.h>
+#import "MYFactoryManager.h"
+
+@interface BTDataAnalysis : NSObject
+-(void)analysisCharacteristic:(NSData*)characteristic deviceType:(DEVICE_TYPE)deviceType;
+@end
+

+ 129 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/BTDataAnalysis.mm

@@ -0,0 +1,129 @@
+//
+//  BTDataAnalysis.m
+//  Unity-iPhone
+//
+//  Created by duowan123 on 2022/1/26.
+//
+
+#import "BTDataAnalysis.h"
+#import "IOSPlatformSDK.h"
+@implementation BTDataAnalysis
+
+#pragma mark ===============================================>> 校验 & 报文数据解析
+-(void)analysisCharacteristic:(NSData*)characteristic deviceType:(DEVICE_TYPE)deviceType{
+        
+//    NSLog(@"接收到的数据data = %@",characteristic);
+    int frameHead = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(0, 1)]];//帧头数据aa
+    int messageLength = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(1, 1)]];//报文长度
+    int messageLengthNegation = ~messageLength;//报文长度取反
+    int dataType = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(3, 1)]];//cmd类型
+    
+      if (dataType == 4){//获取主动推过来的数据
+            //右脚坐标数据
+           int right_X = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(4, 4)];
+           int right_Y = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(8, 4)];
+           int right_Z = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(12, 4)];
+           int  right_pos[3] = {right_X,right_Y,right_Z};
+          //左脚坐标数据
+           int left_X = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(16, 4)];
+           int left_Y = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(20, 4)];
+           int left_Z = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(24, 4)];
+           int  left_pos[3] = {left_X,left_Y,left_Z};
+           //右脚姿势数据
+           short righrPosture_X = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(28, 2)];
+           short righrPosture_Y = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(30, 2)];
+           short righrPosture_Z = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(32, 2)];
+           int  right_att[3] = {righrPosture_X,righrPosture_Y,righrPosture_Z};
+           //左脚姿势数据
+           short leftPosture_X = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(34, 2)];
+           short leftPosture_Y = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(36, 2)];
+           short leftPosture_Z = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(38, 2)];
+           int  left_att[3] = {leftPosture_X,leftPosture_Y,leftPosture_Z};
+           //右脚三维数据
+           short righrAcc_x = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(40, 2)];
+           short righrAcc_Y = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(42, 2)];
+           short righrAcc_z = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(44, 2)];
+           int  righr_acc[3] = {righrAcc_x,righrAcc_Y,righrAcc_z};
+           //左脚三维数据
+           short leftAcc_x = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(46, 2)];
+           short leftAcc_y = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(48, 2)];
+           short leftAcc_z = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(50, 2)];
+           int  left_acc[3] = {leftAcc_x,leftAcc_y,leftAcc_z};
+           //左脚、右脚、蹲 、跳四个动作信息数据
+           int actionInformation =  [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(52, 1)]];;//0c 16进制字符串
+                       int girlShoes  = actionInformation & 16;
+                       if (girlShoes!=0){
+                           girlShoes=1;
+                       }else{
+                           girlShoes=0;
+                       }
+                       int rightZupt  = actionInformation & 8;
+                       if (rightZupt!=0){
+                           rightZupt=1;
+                       }else{
+                           rightZupt=0;
+                       }
+                       int leftZupt = actionInformation & 4;
+                       if (leftZupt!=0){
+                            leftZupt=1;
+                        }else{
+                            leftZupt=0;
+                        }
+                       int down  = actionInformation & 2;
+                       if (down!=0){
+                            down=1;
+                        }else{
+                            down=0;
+                        }
+                       int jump  = actionInformation & 1;
+                       if (jump!=0){
+                            jump=1;
+                        }else{
+                            jump=0;
+                        }
+          
+            int rssi = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(53, 1)]];//rssi 信号强度
+            int ts = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(54, 1)]];;//ts 时间戳
+            int right_press = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(55, 2)]];//3 29新增 右鞋压力
+            int left_press = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(57, 2)]];//3 29新增 左鞋压力
+            int frameCheck =  [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(59, 1)]];//校验位
+        
+              if (deviceType==DEVICETYPE_MAIN){//主设备
+    //                   NSLog(@"主设备 接收到 鞋子动作数据 data = %@",characteristic);
+                  //调取鞋子SDK
+    //                   [self shoseSDKRight_pos:right_pos Right_att:right_att Right_acc:righr_acc LeftPos:left_pos Left_att:left_att Left_acc:left_acc ts:ts rightZupt:rightZupt leftZupt:leftZupt jump:jump down:down rssi:rssi girlShoes:girlShoes right_press:right_press left_press:left_press characteristic:characteristic];
+                  
+              }else if (deviceType==DEVICETYPE_VICE){//副设备动作数据
+                  //调取鞋子SDK
+    //                   [self viceShoseSDKRight_pos:right_pos Right_att:right_att Right_acc:righr_acc LeftPos:left_pos Left_att:left_att Left_acc:left_acc ts:ts rightZupt:rightZupt leftZupt:leftZupt jump:jump down:down rssi:rssi girlShoes:girlShoes right_press:right_press left_press:left_press characteristic:characteristic];
+              }
+                  
+        }else if (dataType == -95 && characteristic.length == 26){//获取的是查询的数据 char-->int a1 = -95
+           //A1+1 >> 1: 设备数据(左鞋,右鞋)  aa 14 eb a1 01 64 00 1a 0000981d 64 00 17 00000000 f9
+                int leftElectricity = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(5, 1)]];
+                int rightElectricity = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(15, 1)]];//龙哥新协议
+                
+                if (deviceType==DEVICETYPE_MAIN && LEManager.peripheral!=nil){//主设备
+//                    NSLog(@"主设备 接收到 鞋子硬件数据 data 26 = %@  电量 %d %d %@ %@",characteristic,leftElectricity,rightElectricity,LEManager.peripheral.name,LEManager.peripheral.identifier.UUIDString);
+                    //主 设备定时器 60秒调一次   /******************ios call unity*****************/
+                     [[IOSPlatformSDK sharedInstance] bridgingDeviceAction:DEVICETYPE_MAIN
+                                                 name:LEManager.peripheral.name
+                                              address:LEManager.peripheral.identifier.UUIDString
+                                               status:CONNECT_ED
+                                          electricity:leftElectricity<=rightElectricity?leftElectricity:rightElectricity];
+             
+                }else if (deviceType==DEVICETYPE_VICE && LEManager.vicePeripheral!=nil){//副设备
+//                    NSLog(@"副设备 接收到 鞋子硬件数据 26 = %@  电量 %d %d",characteristic,leftElectricity,rightElectricity);
+                    //副 设备定时器 60秒调一次   /******************ios call unity*****************/
+                     [[IOSPlatformSDK sharedInstance] bridgingDeviceAction:DEVICETYPE_VICE
+                                                 name:LEManager.vicePeripheral.name
+                                              address:LEManager.vicePeripheral.identifier.UUIDString
+                                               status:CONNECT_ED
+                                          electricity:leftElectricity<=rightElectricity?leftElectricity:rightElectricity];
+                    
+                }
+        }
+}
+
+
+@end

+ 11 - 35
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/BTDataProcess.h

@@ -6,12 +6,10 @@
 //
 
 #import <UIKit/UIKit.h>
-#import <CoreBluetooth/CoreBluetooth.h>
 #import "MYFactoryManager.h"
-#import "LEONBLManager.h"
-#import "CBPeripheral+ADName.h"
 
-#define Game_Type @"dance"
+#import "LEONBLManager.h"
+#import "SocketRocketUtility.h"
 
 //游戏类型
 typedef NS_ENUM(int, GAME_TYPE){
@@ -29,47 +27,25 @@ typedef NS_ENUM(NSInteger, BLETOOTH_STUTAS){
     CONNECT_LOST, // 丢失链接 /链接失败
 };
 
-#define JBSDKLog @"runLog.txt"
-
-
 @interface BTDataProcess : UIViewController
-    
-//app 跳转传过来的mac 实际是蓝牙设备的identity
-@property(copy,nonatomic)NSString * macAddress;
-//弹窗 unity主动选择链接 主0 副1 设备
-@property(assign,nonatomic)DEVICE_TYPE deviceType;
-//游戏种类 1是跳舞 3是跑酷 2是赛达尔传说 4是demo->dance
-@property(assign,nonatomic)GAME_TYPE game_id;
-@property(assign,nonatomic)int game_type;
-//蓝牙设备数据源回调给popSeaechView
-@property(copy,nonatomic)void (^deviceArrBLock)(NSMutableArray*arr);
-//主设备跳起 下蹲 步数 的总数
-@property(assign,nonatomic)int initial_jump_count;
-@property(assign,nonatomic)int initial_down_count;
-//步数回调缓存
-@property(copy,nonatomic)void (^allMotionCountBLock)(int jump_count,int crouch_count,int step_count);//蓝牙设备数据源
-//脚步交互数据
-@property(copy,nonatomic)void (^getInteractionBlock)(int interaction);//蓝牙设备数据源
-
-@property(assign,nonatomic)int isBackGround;//程序在前台还是后台
 
+@property(assign,nonatomic)int nativeAttX;
+    
 //单例->初始化蓝牙
 +(instancetype)sharedInstance;
-//初始化中心管理
--(void)initCBCentralManager;
-//app跳转直接连 或 tableview 选中
--(void)connectPeripheral:(CBPeripheral*)peripheral;
-//unity或者趣动请求 外部断开蓝牙链接
--(void)disConnedctBle;
-//监听程序从后台返回
--(void)applicationWillEnterForeground;
+
+//url 跳转
+-(void)startWithUrl:(NSURL*)url;
+//unity call 打开弹窗
+-(void)searchBLEAction:(int)type;
 
 //监听通知开始游戏
 -(void)gameStartInitData;
 //监听通知结束游戏
 -(void)gameEndInitData;
 //监听通知震动
--(void)vibrationAction:(NSNotification*)notificatio;
+-(void)vibrationAction:(int)type duration:(int)duration;
+
 @end
 
 

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 291 - 516
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/BTDataProcess.mm


+ 29 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/BTDataSend.h

@@ -0,0 +1,29 @@
+//
+//  BTDataSend.h
+//  Unity-iPhone
+//
+//  Created by duowan123 on 2021/12/21.
+//
+
+#import <Foundation/Foundation.h>
+#import "MYFactoryManager.h"
+
+#define BTDataSendInstance [BTDataSend sharedInstance]
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface BTDataSend : NSObject
+
++(instancetype)sharedInstance;
+
+//查询设备信息
+- (void)queryDevideInfo;
+//打开游戏模式
+- (void)startGameModel;
+//设置震动
+- (void)vibration:(DEVICE_TYPE)deviceType duration:(int)duration;
+//开启/关闭 激光模式
+- (void)laser:(int)state;
+@end
+
+NS_ASSUME_NONNULL_END

+ 163 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/BTDataSend.m

@@ -0,0 +1,163 @@
+//
+//  BTDataSend.m
+//  Unity-iPhone
+//
+//  Created by duowan123 on 2021/12/21.
+//
+
+#import "BTDataSend.h"
+
+@implementation BTDataSend
+
+//单例静态
+static BTDataSend* instance = nil;
++(instancetype)sharedInstance{
+//    NSLog(@"创建单例一次 1");
+     return [[self alloc] init];
+}
+
++ (instancetype)allocWithZone:(struct _NSZone *)zone{
+//    NSLog(@"创建单例一次 2");
+  static dispatch_once_t onceToken;
+  dispatch_once(&onceToken, ^{
+      instance = [super allocWithZone:zone];
+  });
+  return instance;
+}
+
+- (instancetype)init{
+//    NSLog(@"创建单例一次 3");
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        instance = [super init];
+    });
+    return instance;
+}
+
+#pragma mark ===============================================>> 蓝牙发送各类数据
+//查询设备信息
+- (void)queryDevideInfo{
+    
+    //头帧AA + 数据长度 + 长度取反 + cmd + 数据 + 校验
+    NSMutableData * writeData = [NSMutableData new];
+    
+    Byte header = 0xaa;
+    Byte length = 0x06;//长度A1->6  A2->5  A3->7
+    Byte lengthNegation = ~length;
+    Byte cmd = 0xA1;
+    Byte data = 0x1;
+
+    Byte byte[] = {header,length,lengthNegation,cmd,data};
+    writeData = [[NSMutableData alloc] initWithBytes:byte length:sizeof(byte)];
+//        [writeData appendData:msData];
+    Byte bcc = [AlgorithmTool byteSumBBC:writeData];
+
+    [writeData appendBytes:&bcc length:sizeof(bcc)];
+
+    if (LEManager.peripheral!=nil){
+        NSLog(@"发送的报文 主设备 查询设备信息 %@", writeData);
+        [LEManager writeValue:writeData forCharacteristic:LEManager.write writeType:CBCharacteristicWriteWithResponse deviceType:DEVICETYPE_MAIN];
+    }
+    if (LEManager.vicePeripheral!=nil){
+        NSLog(@"发送的报文 副设备 查询设备信息 %@", writeData);
+        [LEManager writeValue:writeData forCharacteristic:LEManager.viceWrite writeType:CBCharacteristicWriteWithResponse deviceType:DEVICETYPE_VICE];
+    }
+    
+}
+
+//打开游戏模式
+- (void)startGameModel{
+    
+    //0xaa06f9a2014c
+   //头帧AA + 数据长度 + 长度取反 + cmd + 数据 + 校验
+    NSMutableData * writeData = [NSMutableData new];
+    Byte header = 0xaa;
+    Byte length = 0x06;//长度A1->6  A2->5  A3->7
+    Byte lengthNegation = ~length;
+    Byte cmd = 0xA2;
+    Byte data = 0x1;
+    //计算校验位
+    Byte byte[] = {header,length,lengthNegation,cmd,data};
+    writeData = [[NSMutableData alloc] initWithBytes:byte length:sizeof(byte)];
+    Byte bcc = [AlgorithmTool byteSumBBC:writeData];
+    //传输数据 -->> NSData
+    [writeData appendBytes:&bcc length:sizeof(bcc)];
+
+    if (LEManager.peripheral!=nil){
+        NSLog(@"发送的报文 主设备 开启游戏模式: %@", writeData);
+        [LEManager writeValue:writeData forCharacteristic:LEManager.write writeType:CBCharacteristicWriteWithResponse deviceType:DEVICETYPE_MAIN];
+    }
+    
+    if (LEManager.vicePeripheral!=nil){
+        NSLog(@"发送的报文 副设备 开启游戏模式: %@", writeData);
+        [LEManager writeValue:writeData forCharacteristic:LEManager.viceWrite writeType:CBCharacteristicWriteWithResponse deviceType:DEVICETYPE_VICE];
+    }
+    
+}
+
+//设置震动
+- (void)vibration:(DEVICE_TYPE)deviceType duration:(int)duration{
+    
+    //头帧AA + 数据长度 + 长度取反 + cmd + 数据 + 校验
+     NSMutableData * writeData = [NSMutableData new];
+     Byte header = 0xaa;
+     Byte length = 0x07;//长度A1->6  A2->5  A3->7
+     Byte lengthNegation = ~length;
+     Byte cmd = 0xA4;
+     //振动时间 2字节
+     short ms = 100;//400毫秒
+     Byte mslow = (Byte) (0x00FF & ms);//定义第一个byte
+     Byte mshigh = (Byte) (0x00FF & (ms>>8));//定义第二个byte
+    //计算校验位
+     Byte bytes[] = {header,length,lengthNegation,cmd,mshigh,mslow};
+     Byte bcc = [AlgorithmTool bbcByte:bytes];
+    //传输数据 Byte -->> NSData
+     Byte newByte[] = {header,length,lengthNegation,cmd,mshigh,mslow,bcc};
+     writeData = [[NSMutableData alloc] initWithBytes:newByte length:sizeof(newByte)];
+
+    if (deviceType==DEVICETYPE_MAIN){
+        NSLog(@"发送的报文 主设备 设备震动 %@", writeData);
+        [LEManager writeValue:writeData forCharacteristic:LEManager.write writeType:CBCharacteristicWriteWithResponse deviceType:DEVICETYPE_MAIN];
+    }else if (deviceType == DEVICETYPE_VICE){
+        NSLog(@"发送的报文 副设备 设备震动 %@", writeData);
+        [LEManager writeValue:writeData forCharacteristic:LEManager.viceWrite writeType:CBCharacteristicWriteWithResponse deviceType:DEVICETYPE_VICE];
+    }
+    
+}
+
+//开启/关闭 激光模式
+- (void)laser:(int)state{
+    
+     //头帧AA + 数据长度 + 长度取反 + cmd + 数据 + 校验
+     NSMutableData * writeData = [NSMutableData new];
+     Byte header = 0xaa;
+     Byte length = 0x06;//长度A1->6  A2->5  A3->7
+     Byte lengthNegation = ~length;
+     Byte cmd = 0xA9;
+     //激光状态 字节
+     Byte data;
+     if (state ==0){
+        data = 0x00;
+     }else if(state==1){
+        data = 0x01;
+     }
+     //计算校验位
+     Byte bytes[] = {header,length,lengthNegation,cmd,data};
+     Byte bcc = [AlgorithmTool bbcByte:bytes];
+     //传输数据 Byte -->> NSData
+     Byte newByte[] = {header,length,lengthNegation,cmd,data,bcc};
+     writeData = [[NSMutableData alloc] initWithBytes:newByte length:sizeof(newByte)];
+
+    if (LEManager.peripheral!=nil){
+        NSLog(@"发送的报文 主设备 开启激光: %@", writeData);
+        [LEManager writeValue:writeData forCharacteristic:LEManager.write writeType:CBCharacteristicWriteWithResponse deviceType:DEVICETYPE_MAIN];
+    }
+    
+    if (LEManager.vicePeripheral!=nil){
+        NSLog(@"发送的报文 副设备 开启激光: %@", writeData);
+        [LEManager writeValue:writeData forCharacteristic:LEManager.viceWrite writeType:CBCharacteristicWriteWithResponse deviceType:DEVICETYPE_VICE];
+    }
+    
+}
+
+@end

+ 40 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/DebugView.h

@@ -0,0 +1,40 @@
+//
+//  DebugView.h
+//  Unity-iPhone
+//
+//  Created by duowan123 on 2021/12/22.
+//
+
+#import <UIKit/UIKit.h>
+#import "MYFactoryManager.h"
+
+#define DebugViewInstance [DebugView sharedInstance]
+#define JBSDKLog @"testLog.txt"
+
+@interface DebugView : UIView
+/*****测试*******/
+@property (nonatomic,strong)UILabel * testLabel;//调试框
+@property (nonatomic,strong)UIButton * uploadButton;//上传
+@property (nonatomic,strong)UIButton * clearnButton;//上传
+
+//当前的时间戳+丢包
+@property (nonatomic,strong)NSString * tempStepString;//剑波要的字符串数据 缓存plist
+@property(nonatomic,assign) NSNumber *RSSI;//威严要的测试数据
+@property(nonatomic,assign) int currentTS;//颖嘉要的测试数据
+
++(instancetype)sharedInstance;
+
+#pragma mark ===============================================>> DEBUG
+-(void)inittestLabel;
+
+//清理缓存
+- (void)clearCacheWithFilePath;
+
+//数据写入沙河
+-(void)writeFileToplist;
+
+//上传
+-(void)uploadpPlistFile;
+    
+@end
+

+ 242 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/DebugView.m

@@ -0,0 +1,242 @@
+//
+//  DebugView.m
+//  Unity-iPhone
+//
+//  Created by duowan123 on 2021/12/22.
+//
+
+#import "DebugView.h"
+
+@implementation DebugView
+#pragma mark ===============================================>> 静态的初始化方法  init的时候(建立蓝牙中心管理类,设置代理)
+//单例静态
+static DebugView* instance = nil;
++(instancetype)sharedInstance{
+//    NSLog(@"创建单例一次 1");
+     return [[self alloc] init];
+}
+
++ (instancetype)allocWithZone:(struct _NSZone *)zone{
+//    NSLog(@"创建单例一次 2");
+  static dispatch_once_t onceToken;
+  dispatch_once(&onceToken, ^{
+      instance = [super allocWithZone:zone];
+  });
+  return instance;
+}
+
+- (instancetype)init{
+//    NSLog(@"创建单例一次 3");
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        instance = [super init];
+    });
+    return instance;
+}
+
+#pragma mark ===============================================>> DEBUG
+-(void)inittestLabel{
+
+    if (self.testLabel!=nil){
+        [self.testLabel removeFromSuperview];
+    }
+    
+    if (self.uploadButton!=nil){
+        [self.uploadButton removeFromSuperview];
+    }
+    
+    if (self.clearnButton!=nil){
+        [self.clearnButton removeFromSuperview];
+    }
+    
+    self.uploadButton = [UIButton buttonWithType:UIButtonTypeCustom];
+    self.uploadButton.frame = CGRectMake(30, SCREEN_HEIGHT-40-10, SCALEoefficient(60), SCALEoefficient(25));
+    self.uploadButton.backgroundColor = [UIColor redColor];
+    [self.uploadButton addTarget: self action: @selector (button1BackGroundHighlighted:) forControlEvents:UIControlEventTouchDown];
+    [self.uploadButton addTarget: self action: @selector (button1BackGroundNormal:) forControlEvents:UIControlEventTouchUpInside];
+    [self.uploadButton setFont: [UIFont boldSystemFontOfSize:SCALEoefficient(13)]];
+    [self.uploadButton setTitle:@"上传" forState:UIControlStateNormal];
+    [self.uploadButton addTarget:self action:@selector(uploadpPlistFile) forControlEvents:UIControlEventTouchUpInside];
+    
+    self.clearnButton = [UIButton buttonWithType:UIButtonTypeCustom];
+    self.clearnButton.frame = CGRectMake(30+SCALEoefficient(60)+20, SCREEN_HEIGHT-40-10, SCALEoefficient(60), SCALEoefficient(25));
+    self.clearnButton.backgroundColor = [UIColor redColor];
+//    [self.clearnButton addTarget:self action:@selector(button1BackGroundHighlighted:) forControlEvents:UIControlEventTouchDown];
+//    [self.clearnButton addTarget:self action:@selector(button1BackGroundNormal:) forControlEvents:UIControlEventTouchUpInside];
+    [self.clearnButton setFont: [UIFont boldSystemFontOfSize:SCALEoefficient(13)]];
+    [self.clearnButton setTitle:@"清理缓存" forState:UIControlStateNormal];
+    [self.clearnButton addTarget:self action:@selector(clearCacheWithFilePath) forControlEvents:UIControlEventTouchUpInside];
+    
+    self.testLabel = [[UILabel alloc] initWithFrame:CGRectMake(SCALEoefficient(20), -20, [UIScreen mainScreen].bounds.size.width-100, SCALEoefficient(140))];
+    self.testLabel.textColor = [UIColor redColor];
+    self.testLabel.font = [UIFont boldSystemFontOfSize:SCALEoefficient(14)];
+    self.testLabel.backgroundColor = [UIColor clearColor];
+    self.testLabel.textAlignment = NSTextAlignmentLeft;
+    self.testLabel.numberOfLines = 0;
+
+    //
+    if ([UIApplication sharedApplication].keyWindow != nil){
+        [[UIApplication sharedApplication].keyWindow addSubview:self.uploadButton];
+        [[UIApplication sharedApplication].keyWindow addSubview:self.clearnButton];
+        [[UIApplication sharedApplication].keyWindow addSubview:self.testLabel];
+    }
+
+}
+
+//  button普通状态下的背景色
+- (void )button1BackGroundNormal:(UIButton *)sender
+{
+     sender.backgroundColor = [UIColor redColor];
+}
+ 
+//  button高亮状态下的背景色
+- (void )button1BackGroundHighlighted:(UIButton *)sender
+{
+     sender.backgroundColor = [UIColor orangeColor];
+}
+
+#pragma mark ===============================================>> 存储和上传数据
+//清理缓存
+- (void)clearCacheWithFilePath{
+    
+    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+    //获取完整路径
+    NSString *documentsDirectory = [paths objectAtIndex:0];
+    NSString *filePath = [documentsDirectory stringByAppendingPathComponent:JBSDKLog];//这里就是你将要存储的沙盒路径(.plist文件,名字自定义)
+    NSError *error = nil;
+    //删除子文件夹
+    [[NSFileManager defaultManager] removeItemAtPath:filePath error:&error];
+    if (error){
+        NSLog(@"清理缓存失败");
+        [PopupView showCusHUDA:@"清理失败"];
+    }else{
+        NSLog(@"清理缓存成功");
+        [PopupView showCusHUDA:@"清理成功"];
+    }
+    
+}
+
+//数据写入沙河
+-(void)writeFileToplist{
+    
+    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+    //获取完整路径
+    NSString *documentsDirectory = [paths objectAtIndex:0];
+    NSString *filePath = [documentsDirectory stringByAppendingPathComponent:JBSDKLog];//这里就是你将要存储的沙盒路径(.plist文件,名字自定义)
+
+    if(![[NSFileManager defaultManager] fileExistsAtPath:filePath]){//plistPath这个文件\文件夹是否存在
+
+        NSLog(@"-------文件不存在,写入文件----------");
+
+               NSError *error;
+               if([self.tempStepString writeToFile:filePath atomically:YES encoding:NSUTF8StringEncoding error:&error]){
+                   NSLog(@"------写入文件------success");
+               }else{
+                    NSLog(@"------写入文件------fail,error==%@",error);
+               };
+
+    }else{
+
+//     NSLog(@"-------文件存在,追加文件----------");
+       NSFileHandle *fileHandle = [NSFileHandle fileHandleForUpdatingAtPath:filePath];
+       [fileHandle seekToEndOfFile];  //将节点跳到文件的末尾
+       NSData* stringData  = [self.tempStepString dataUsingEncoding:NSUTF8StringEncoding];
+       [fileHandle writeData:stringData]; //追加写入数据
+       [fileHandle closeFile];
+
+    }
+
+}
+
+-(void)uploadpPlistFile{
+    
+    //这个方法获取出的结果是一个数组.因为有可以搜索到多个路径.
+    NSArray *array =  NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+    //在这里,我们指定搜索的是Cache目录,所以结果只有一个,取出Cache目录
+    NSString *documentsDirectory = array[0];
+//    NSLog(@"%@",documentsDirectory);
+    //拼接文件路径
+    NSString *filePathName = [documentsDirectory stringByAppendingPathComponent:JBSDKLog];
+    //如果保存的是一个数组.那就通过数组从文件当中加载.
+    NSString *string = [NSString stringWithContentsOfFile:filePathName encoding:NSUTF8StringEncoding error:nil];
+//    NSLog(@"%@",string);
+    //4.设置请求体
+    NSData *upData = [string dataUsingEncoding:NSUTF8StringEncoding];
+    //
+    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
+    manager.requestSerializer.timeoutInterval=15;
+    [manager.requestSerializer setValue:@"multipart/form-data" forHTTPHeaderField:@"Content-Type"];
+    manager.requestSerializer = [AFJSONRequestSerializer serializer];
+    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/plain",@"text/html",@"application/json",@"text/javascript",@"image/jpeg",@"image/png",@"application/octet-stream",@"application/x-www-form-urlencoded", nil];
+    //    NSLog(@"请求URL ===================>> %@",urlString);
+    NSLog(@"******************* 请求头参数 = %@ ***************************",manager.requestSerializer.HTTPRequestHeaders);
+    NSString * gameType;
+    NSString * bundleIdentifier = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"];
+    if ([bundleIdentifier isEqualToString:@"com.Oujia.Run"]){
+        gameType = @"run";
+    }else if ([bundleIdentifier isEqualToString:@"com.Oujia.Dance"]){
+        gameType = @"Dance";
+    }
+    
+    AFHTTPSessionManager *sessionManager = [[AFHTTPSessionManager alloc] initWithBaseURL:nil];
+    [sessionManager POST:@"http://172.16.14.127:8080/upload" parameters:nil headers:nil constructingBodyWithBlock:^(id<AFMultipartFormData>  _Nonnull formData){
+
+        [formData  appendPartWithFileData:upData name:@"file" fileName:[NSString stringWithFormat:@"ios_%@_%@.txt",gameType,[self getNowTimeTimestamp]] mimeType:@"text/plain"];
+
+        }progress:^(NSProgress * _Nonnull uploadProgress){
+            NSLog(@"测试数据 上传进度 = %@",uploadProgress);
+
+        }success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject){
+            NSLog(@"测试数据 上传成功");
+
+        }failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error){
+
+            for (NSString * key  in error.userInfo){
+
+                if ([key isEqualToString:@"com.alamofire.serialization.response.error.data"]){
+
+                    id errorObject = [NSJSONSerialization JSONObjectWithData:error.userInfo[key] options:1  error:nil];
+
+                    NSLog(@"测试数据 上传失败 ===>> %@",errorObject);
+                    if (errorObject !=nil && [errorObject isKindOfClass:[NSDictionary class]]){
+                        NSString * result = errorObject[@"result"];
+                        if ([result intValue] ==1){
+                            [PopupView showCusHUDA:@"测试数据 上传成功"];
+                        }
+                        
+                    }
+
+                }
+                
+          }
+            
+    }];
+ 
+}
+
+//获取当前时间戳有两种方法(以秒为单位)
+-(NSString *)getNowTimeTimestamp{
+
+    NSDateFormatter *formatter = [[NSDateFormatter alloc] init] ;
+
+    [formatter setDateStyle:NSDateFormatterMediumStyle];
+
+    [formatter setTimeStyle:NSDateFormatterShortStyle];
+
+    [formatter setDateFormat:@"YYYY-MM-dd HH:mm:ss"]; // ----------设置你想要的格式,hh与HH的区别:分别表示12小时制,24小时制
+
+    //设置时区,这个对于时间的处理有时很重要
+
+    NSTimeZone* timeZone = [NSTimeZone timeZoneWithName:@"Asia/Shanghai"];
+
+    [formatter setTimeZone:timeZone];
+
+    NSDate *datenow = [NSDate date];//现在时间,你可以输出来看下是什么格式
+
+    NSString *timeSp = [NSString stringWithFormat:@"%ld", (long)[datenow timeIntervalSince1970]];
+
+    return timeSp;
+
+}
+   
+@end

+ 51 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/MainShoesAnalysis.h

@@ -0,0 +1,51 @@
+////
+////  MainShoesAnalysis.h
+////  Unity-iPhone
+////
+////  Created by duowan123 on 2021/12/4.
+////
+//
+//#import <Foundation/Foundation.h>
+//#import "MYFactoryManager.h"
+//
+//NS_ASSUME_NONNULL_BEGIN
+//
+//@interface MainShoesAnalysis : NSObject
+//
+//
+//+(instancetype)sharedInstance;
+//
+////弹窗 unity主动选择链接 主0 副1 设备
+//@property(assign,nonatomic)DEVICE_TYPE deviceType;
+////游戏种类 1是跳舞 3是跑酷 2是赛达尔传说 4是demo->dance
+//@property(assign,nonatomic)GAME_TYPE game_type;
+//
+////主设备跳起 下蹲 步数 的总数
+//@property(assign,nonatomic)int initial_jump_count;
+//@property(assign,nonatomic)int initial_down_count;
+////步数回调缓存
+//@property(copy,nonatomic)void (^allMotionCountBLock)(int jump_count,int crouch_count,int step_count);//蓝牙设备数据源
+////脚步交互数据
+//@property(copy,nonatomic)void (^getInteractionBlock)(int interaction);//蓝牙设备数据源
+//
+//@property(assign,nonatomic)int isBackGround;//程序在前台还是后台
+//
+//@property(nonatomic,assign)BOOL gameModel;//是否开启游戏模式
+//
+///*****测试*******/
+//@property (nonatomic,strong)UILabel * testLabel;//调试框
+//@property (nonatomic,strong)UIButton * uploadButton;//上传
+//@property (nonatomic,strong)UIButton * clearnButton;//上传
+//
+////当前的时间戳+丢包
+//@property (nonatomic,assign)int  tempTs;
+//@property (nonatomic,assign)int  loss;
+//@property (nonatomic,assign)int  totalPackages;
+//@property (nonatomic,strong)NSString * tempStepString;//剑波要的字符串数据 缓存plist
+//@property(nonatomic,assign) NSNumber *RSSI;//威严要的测试数据
+//@property(nonatomic,assign) int currentTS;//颖嘉要的测试数据
+//
+//
+//@end
+//
+//NS_ASSUME_NONNULL_END

+ 551 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/MainShoesAnalysis.mm

@@ -0,0 +1,551 @@
+////
+////  MainShoesAnalysis.m
+////  Unity-iPhone
+////
+////  Created by duowan123 on 2021/12/4.
+////
+//
+//#import "MainShoesAnalysis.h"
+//
+//@interface MainShoesAnalysis()
+//{
+//@private
+//Game *game;
+//}
+//
+//@end
+//
+//@implementation MainShoesAnalysis
+//
+////单例静态
+//static MainShoesAnalysis* instance = nil;
+//+(instancetype)sharedInstance{
+////    NSLog(@"创建单例一次 1");
+//     return [[self alloc] init];
+//}
+//
+//+ (instancetype)allocWithZone:(struct _NSZone *)zone{
+////    NSLog(@"创建单例一次 2");
+//  static dispatch_once_t onceToken;
+//  dispatch_once(&onceToken, ^{
+//      instance = [super allocWithZone:zone];
+//  });
+//  return instance;
+//}
+//
+//- (instancetype)init{
+////    NSLog(@"创建单例一次 3");
+//    static dispatch_once_t onceToken;
+//    dispatch_once(&onceToken, ^{
+//        instance = [super init];
+//    });
+//    return instance;
+//}
+//
+//#pragma mark ===============================================>> 校验 & 报文数据解析
+//-(void)verifyData:(CBCharacteristic*)characteristic deviceType:(DEVICE_TYPE)deviceType{
+//    
+//     if (characteristic.value.length>3){
+//         
+//         //带cmd位的有效数据  计算校验位
+//         if ([AlgorithmTool verificationRusult:characteristic.value]==YES){
+//             
+//             [self analysisCharacteristic:characteristic.value deviceType:deviceType];
+//                              
+//         }
+//         
+//     }else{
+//         
+//         NSLog(@"无效报文");
+//         
+//     }
+//     
+//}
+//
+//-(void)analysisCharacteristic:(NSData*)characteristic deviceType:(DEVICE_TYPE)deviceType{
+//        
+////        NSLog(@"接收到的数据data = %@",characteristic);
+//    
+//    int frameHead = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(0, 1)]];//帧头数据aa
+//    int messageLength = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(1, 1)]];//报文长度
+//    int messageLengthNegation = ~messageLength;//报文长度取反
+//    int dataType = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(3, 1)]];//cmd类型
+//    
+//      if (dataType == 4){//获取主动推过来的数据
+//            //右脚坐标数据
+//           int right_X = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(4, 4)];
+//           int right_Y = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(8, 4)];
+//           int right_Z = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(12, 4)];
+//           int  right_pos[3] = {right_X,right_Y,right_Z};
+//          //左脚坐标数据
+//           int left_X = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(16, 4)];
+//           int left_Y = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(20, 4)];
+//           int left_Z = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(24, 4)];
+//           int  left_pos[3] = {left_X,left_Y,left_Z};
+//           //右脚姿势数据
+//           short righrPosture_X = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(28, 2)];
+//           short righrPosture_Y = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(30, 2)];
+//           short righrPosture_Z = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(32, 2)];
+//           int  right_att[3] = {righrPosture_X,righrPosture_Y,righrPosture_Z};
+//           //左脚姿势数据
+//           short leftPosture_X = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(34, 2)];
+//           short leftPosture_Y = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(36, 2)];
+//           short leftPosture_Z = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(38, 2)];
+//           int  left_att[3] = {leftPosture_X,leftPosture_Y,leftPosture_Z};
+//           //右脚三维数据
+//           short righrAcc_x = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(40, 2)];
+//           short righrAcc_Y = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(42, 2)];
+//           short righrAcc_z = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(44, 2)];
+//           int  righrAcc[3] = {righrAcc_x,righrAcc_Y,righrAcc_z};
+//           //左脚三维数据
+//           short leftAcc_x = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(46, 2)];
+//           short leftAcc_y = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(48, 2)];
+//           short leftAcc_z = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(50, 2)];
+//           int  left_acc[3] = {leftAcc_x,leftAcc_y,leftAcc_z};
+//           //左脚、右脚、蹲 、跳四个动作信息数据
+//           int actionInformation =  [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(52, 1)]];;//0c 16进制字符串
+//                       int girlShoes  = actionInformation & 16;
+//                       if (girlShoes!=0){
+//                           girlShoes=1;
+//                       }else{
+//                           girlShoes=0;
+//                       }
+//                       int rightZupt  = actionInformation & 8;
+//                       if (rightZupt!=0){
+//                           rightZupt=1;
+//                       }else{
+//                           rightZupt=0;
+//                       }
+//                       int leftZupt = actionInformation & 4;
+//                       if (leftZupt!=0){
+//                            leftZupt=1;
+//                        }else{
+//                            leftZupt=0;
+//                        }
+//                       int down  = actionInformation & 2;
+//                       if (down!=0){
+//                            down=1;
+//                        }else{
+//                            down=0;
+//                        }
+//                       int jump  = actionInformation & 1;
+//                       if (jump!=0){
+//                            jump=1;
+//                        }else{
+//                            jump=0;
+//                        }
+//          
+//            int rssi = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(53, 1)]];//rssi 信号强度
+//            int ts = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(54, 1)]];;//ts 时间戳
+//            int right_press = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(55, 2)]];//3 29新增 右鞋压力
+//            int left_press = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(57, 2)]];//3 29新增 左鞋压力
+//            int frameCheck =  [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(59, 1)]];//校验位
+//        
+//               if (deviceType==DEVICETYPE_MAIN){//主设备
+//                   
+////                   NSLog(@"主设备 接收到 鞋子动作数据 data = %@",characteristic);
+//                   //调取鞋子SDK
+//                   [self shoseSDKRight_pos:right_pos Right_att:right_att Right_acc:righrAcc LeftPos:left_pos Left_att:left_att Left_acc:left_acc ts:ts rightZupt:rightZupt leftZupt:leftZupt jump:jump down:down rssi:rssi girlShoes:girlShoes right_press:right_press left_press:left_press characteristic:characteristic];
+//                   
+//               }else if (deviceType==DEVICETYPE_VICE){//副设备动作数据
+//                   
+////                   NSLog(@"副设备 接收到 鞋子动作数据 data = %@",characteristic);
+//                   //调取鞋子SDK
+//  
+//                   
+//               }
+//              
+//        }else if (dataType == -95){//获取的是查询的数据 char-->int a1 = -95
+//
+//            if (characteristic.length == 74){//A1+0  >> 0: 设备基本信息 ==>> 预留参数 趣动app用 sdk暂未调用
+//                
+////                NSString *deviceModel = [[NSString alloc] initWithData:[characteristic subdataWithRange:NSMakeRange(5, 18)] encoding:NSUTF8StringEncoding];
+////                NSString *softwareVer = [AlgorithmTool hexadecimalString:[characteristic subdataWithRange:NSMakeRange(69, 2)]];//0102
+////                NSString *hardwareVer = [AlgorithmTool hexadecimalString:[characteristic subdataWithRange:NSMakeRange(71, 2)]];//0104
+//                
+//            }else if (characteristic.length == 26){//A1+1 >> 1: 设备数据(左鞋,右鞋)  aa 14 eb a1 01 64 00 1a 0000981d 64 00 17 00000000 f9
+//                
+//                int leftElectricity = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(5, 1)]];
+////                int leftTempreature = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(6, 1)]];
+////                int leftPressure = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(7, 4)]];
+////                int leftStepCount = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(11, 4)]];
+////                int rightElectricity = [self dataToInt:[characteristic subdataWithRange:NSMakeRange(12, 1)]];
+//                int rightElectricity = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(15, 1)]];//龙哥新协议
+////                int rightTempreature = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(16, 1)]];
+////                int rightPressure = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(17, 4)]];
+////                int rightStepCount = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(21, 4)]];
+//                
+//                if (deviceType==DEVICETYPE_MAIN && LEManager.peripheral!=nil){//主设备
+//                    
+////                    NSLog(@"主设备 接收到 鞋子硬件数据 data 26 = %@  电量 %d %d %@ %@",characteristic,leftElectricity,rightElectricity,LEManager.peripheral.name,LEManager.peripheral.identifier.UUIDString);
+//
+//                    //主 设备定时器 60秒调一次   /******************ios call unity*****************/
+//                     [[IOSPlatformSDK sharedInstance] bridgingDeviceAction:DEVICETYPE_MAIN
+//                                                 name:LEManager.peripheral.name
+//                                              address:LEManager.peripheral.identifier.UUIDString
+//                                               status:CONNECT_ED
+//                                          electricity:20];
+//             
+//                }else if (deviceType==DEVICETYPE_VICE && LEManager.vicePeripheral!=nil){//副设备
+//                    
+//                    NSLog(@"副设备 接收到 鞋子硬件数据 26 = %@  电量 %d %d",characteristic,leftElectricity,rightElectricity);
+//
+//                    //副 设备定时器 60秒调一次   /******************ios call unity*****************/
+//                     [[IOSPlatformSDK sharedInstance] bridgingDeviceAction:DEVICETYPE_VICE
+//                                                 name:LEManager.vicePeripheral.name
+//                                              address:LEManager.vicePeripheral.identifier.UUIDString
+//                                               status:CONNECT_ED
+//                                          electricity:leftElectricity<=rightElectricity?leftElectricity:rightElectricity];
+//                    
+//                }
+//             
+//           }
+//            
+//      }
+//    
+//}
+//
+//#pragma mark ===============================================>> 主设备 报文数据解析后 -- 调用蓝牙鞋子SDK装换数据 -- ios call unity 更新游戏动作
+//-(void)shoseSDKRight_pos:(int[3])right_pos
+//               Right_att:(int[3])right_att
+//               Right_acc:(int[3])right_acc
+//                 LeftPos:(int[3])left_pos
+//                Left_att:(int[3])left_att
+//                Left_acc:(int[3])left_acc
+//                      ts:(int)ts
+//               rightZupt:(int)rightZupt
+//                leftZupt:(int)leftZupt
+//                    jump:(int)jump
+//                    down:(int)down
+//                    rssi:(int)rssi
+//               girlShoes:(int)girlShoes
+//             right_press:(int)right_press
+//              left_press:(int)left_press
+//          characteristic:(NSData*)characteristic{
+//    
+//    /********************初始化 运动轨迹算法 SDK *****************/
+//    //游戏数据
+//    NSData * validData= [characteristic subdataWithRange:NSMakeRange(4, characteristic.length-4)];
+//    Byte * buff = (Byte*)[validData bytes];
+//    game->GameProcessBuf(buff, (int)validData.length);
+//    
+//    int length = 4;
+//    int result[length];
+//    game->getGameResult(result);
+//    //   NSLog(@"result == %d %d %d %d \n",result[0],result[1],result[2],result[3]);
+//
+//    
+//    /******************步频数据处理 + 回调*****************/
+//    int leftStepStatus =  game->getStepStatus(LEFT_FOOT);
+//    int leftStepFreq =  game->getStepFreq(LEFT_FOOT);
+//    int leftStepCount =  game->getStepCount(LEFT_FOOT);
+//    int rightStepStatus =  game->getStepStatus(RIGHT_FOOT);
+//    int rightStepFreq =  game->getStepFreq(RIGHT_FOOT);
+//    int rightStepCount =  game->getStepCount(RIGHT_FOOT);
+//        
+//    /******************左右脚动作数据处理 + 回调*****************/
+//    int motionLeft = result[0];//左脚的动作
+//    int motionRight = result[1];//右脚的动作
+//    int motionJump = result[2];//jump
+//    int motionDown = result[3];//down
+////    if (motionLeft==-1 && motionRight == -1&& motionJump == -1&& motionDown == -1){//无效动作
+////        return;
+////    }else{
+//        //跳跃和蹲下的动作 双脚是同步的
+//        if (motionJump == MOTION_JUMP){
+//            motionLeft = motionJump;
+//            motionRight = motionJump;
+//            NSLog(@" 主设备 ================================== 跳起来 ");
+//        }
+//    
+//        if (motionDown == MOTION_DOWN){
+//            motionLeft = motionDown;
+//            motionRight = motionDown;
+//            NSLog(@" 主设备 =================================== 蹲下去 ");
+//        }
+////    }
+//    
+//    /****************** ios call unity*****************/
+//        if (self.gameModel==YES){//当前是游戏模式
+//
+//            //跑酷需要回调步频
+//            if (self.game_type == GAME_TYPE_RUN){
+//                [[IOSPlatformSDK sharedInstance] bridgingStepAction:DEVICETYPE_MAIN leftStatus:leftStepStatus rightStatus:rightStepStatus leftFrag:leftStepFreq rightFrag:rightStepFreq];
+//            }
+//            //左右脚动作
+//            [[IOSPlatformSDK sharedInstance] bridgingMotionAction:DEVICETYPE_MAIN left:motionLeft right:motionRight];
+//
+//        }else{//当前是交互模式
+//
+//            int interaction = game->getInteractionCMD();
+////            NSLog(@"主设备 当前的脚步交互动作 ===== >> %d",interaction);
+//            [[IOSPlatformSDK sharedInstance] bridgingInteraction:DEVICETYPE_MAIN code:interaction];
+//            if (self.getInteractionBlock){
+//                self.getInteractionBlock(interaction);
+//            }
+//        }
+//    
+//    /******************数据回调缓存*****************/
+//    //标记初始值
+//    if (self.initial_jump_count==0){
+//        self.initial_jump_count = game->getGameJumpCount();
+//    }
+//    if (self.initial_down_count==0) {
+//        self.initial_down_count = game->getGameDownCount();
+//    }
+//    //总数
+//    int total_jump_count = game->getGameJumpCount();
+//    int total_dump_count = game->getGameDownCount();
+//    //当局游戏次数
+//    int current_jump_count = total_jump_count - self.initial_jump_count;
+//    int current_dump_count = total_dump_count - self.initial_down_count;
+//    //数据回调缓存
+//    if (self.allMotionCountBLock){
+//        self.allMotionCountBLock(current_jump_count, current_dump_count, leftStepCount + rightStepCount);
+//    }
+//    
+//    /********************剑波 & 威严 要的图表数据 *****************/
+//    NSString * aString = [NSString stringWithUTF8String:game->getGameDataStr().c_str()];
+//    if (self.RSSI==nil){
+//        self.RSSI = 0;
+//    }
+//     aString = [NSString stringWithFormat:@"%@,%@",aString,self.RSSI];
+//    self.tempStepString = [NSString stringWithFormat:@"%@\n",aString];
+//    if (self.tempStepString!=nil && self.tempStepString.length>1){
+//        [self writeFileToplist];
+//    }
+//  
+//    /********************调试窗数据 *****************/
+//    NSArray *aArray = [self.tempStepString componentsSeparatedByString:@","];
+////    dispatch_async(dispatch_get_main_queue(), ^{
+//        if (self.testLabel!=nil){
+//            self.testLabel.text = [NSString stringWithFormat:@"right:[%d,%d,%d] [%d,%d,%d] [%d,%d,%d] \nleft:[%d,%d,%d] [%d,%d,%d] [%d,%d,%d] \nZupt:[%d,%d]  press:[%d,%d] \nj&d[%d %d]  rssi:[%d %@] ts:%d \n脚步: %@ %@\n步频: %d %d ",right_pos[0],right_pos[1],right_pos[2],right_att[0],right_att[1],right_att[2],right_acc[0],right_acc[1],right_acc[2],left_pos[0],left_pos[1],left_pos[2],left_att[0],left_att[1],left_att[2],left_acc[0],left_acc[1],left_acc[2],rightZupt,leftZupt,right_press,left_press,jump,down,rssi,self.RSSI,ts,aArray[aArray.count-2],aArray.lastObject,leftStepFreq,rightStepFreq];
+//        }
+////    });
+//    
+//    /********************颖嘉+的ts丢包数据 *****************/
+//    NSString * tsString =  aArray[aArray.count-4];
+//    int tsInt = [tsString  intValue];
+//    int total;
+//    //1....255
+//    if (tsInt > self.currentTS){
+//         total = tsInt - self.currentTS - 1;
+//    }
+//    //255...1
+//    if (tsInt < self.currentTS){
+//        if (tsInt ==0) {
+//            total = (255-self.currentTS) + tsInt + 1 - 1;
+//        }else{
+//            total = (255-self.currentTS) + tsInt - 1;
+//        }
+//    }
+////    NSLog(@"tsInt = %d  currentTS = %d total = %d",tsInt,self.currentTS,total);
+//    if (total > 20){
+//        dispatch_async(dispatch_get_main_queue(), ^{
+//            AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
+//            [PopupView showCusHUDA:[NSString stringWithFormat:@"丢包数: %d",total]];
+//        });
+//    }
+//    self.currentTS = tsInt;
+//    
+//}
+//
+//
+//#pragma mark ===============================================>> DEBUG
+//-(void)inittestLabel{
+//
+//    if (self.testLabel!=nil){
+//        [self.testLabel removeFromSuperview];
+//    }
+//    
+//    if (self.uploadButton!=nil){
+//        [self.uploadButton removeFromSuperview];
+//    }
+//    
+//    if (self.clearnButton!=nil){
+//        [self.clearnButton removeFromSuperview];
+//    }
+//    
+//    self.uploadButton = [UIButton buttonWithType:UIButtonTypeCustom];
+//    self.uploadButton.frame = CGRectMake(30, SCREEN_HEIGHT-40-10, SCALEoefficient(75), SCALEoefficient(30));
+//    self.uploadButton.backgroundColor = [UIColor redColor];
+//    [self.uploadButton addTarget: self action: @selector (button1BackGroundHighlighted:) forControlEvents:UIControlEventTouchDown];
+//    [self.uploadButton addTarget: self action: @selector (button1BackGroundNormal:) forControlEvents:UIControlEventTouchUpInside];
+//    [self.uploadButton setFont: [UIFont boldSystemFontOfSize:SCALEoefficient(15)]];
+//    [self.uploadButton setTitle:@"上传" forState:UIControlStateNormal];
+//    [self.uploadButton addTarget:self action:@selector(uploadpPlistFile) forControlEvents:UIControlEventTouchUpInside];
+//    
+//    self.clearnButton = [UIButton buttonWithType:UIButtonTypeCustom];
+//    self.clearnButton.frame = CGRectMake(30+SCALEoefficient(75)+20, SCREEN_HEIGHT-40-10, SCALEoefficient(75), SCALEoefficient(30));
+//    self.clearnButton.backgroundColor = [UIColor redColor];
+////    [self.clearnButton addTarget:self action:@selector(button1BackGroundHighlighted:) forControlEvents:UIControlEventTouchDown];
+////    [self.clearnButton addTarget:self action:@selector(button1BackGroundNormal:) forControlEvents:UIControlEventTouchUpInside];
+//    [self.clearnButton setFont: [UIFont boldSystemFontOfSize:SCALEoefficient(15)]];
+//    [self.clearnButton setTitle:@"清理缓存" forState:UIControlStateNormal];
+//    [self.clearnButton addTarget:self action:@selector(clearCacheWithFilePath) forControlEvents:UIControlEventTouchUpInside];
+//    
+//    self.testLabel = [[UILabel alloc] initWithFrame:CGRectMake(SCALEoefficient(20), 0, [UIScreen mainScreen].bounds.size.width-100, SCALEoefficient(160))];
+//    self.testLabel.textColor = [UIColor redColor];
+//    self.testLabel.font = [UIFont boldSystemFontOfSize:SCALEoefficient(14)];
+//    self.testLabel.backgroundColor = [UIColor clearColor];
+//    self.testLabel.textAlignment = NSTextAlignmentCenter;
+//    self.testLabel.numberOfLines = 0;
+//
+//    if ([UIApplication sharedApplication].keyWindow != nil){
+//        [[UIApplication sharedApplication].keyWindow addSubview:self.uploadButton];
+//        [[UIApplication sharedApplication].keyWindow addSubview:self.clearnButton];
+//        [[UIApplication sharedApplication].keyWindow addSubview:self.testLabel];
+//    }
+//
+//}
+//
+////  button普通状态下的背景色
+//- ( void )button1BackGroundNormal:(UIButton *)sender
+//{
+//     sender.backgroundColor = [UIColor redColor];
+//}
+// 
+////  button高亮状态下的背景色
+//- ( void )button1BackGroundHighlighted:(UIButton *)sender
+//{
+//     sender.backgroundColor = [UIColor orangeColor];
+//}
+//
+//#pragma mark ===============================================>> 存储和上传数据
+//- (void)clearCacheWithFilePath{
+//    
+//    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+//    //获取完整路径
+//    NSString *documentsDirectory = [paths objectAtIndex:0];
+//    NSString *filePath = [documentsDirectory stringByAppendingPathComponent:JBSDKLog];//这里就是你将要存储的沙盒路径(.plist文件,名字自定义)
+//    NSError *error = nil;
+//    //删除子文件夹
+//    [[NSFileManager defaultManager] removeItemAtPath:filePath error:&error];
+//    if (error){
+//        NSLog(@"清理缓存失败");
+//        [PopupView showCusHUDA:@"清理失败"];
+//    }else{
+//        NSLog(@"清理缓存成功");
+//        [PopupView showCusHUDA:@"清理成功"];
+//    }
+//    
+//}
+//
+////数据写入沙河
+//-(void)writeFileToplist{
+//    
+//    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+//    //获取完整路径
+//    NSString *documentsDirectory = [paths objectAtIndex:0];
+//    NSString *filePath = [documentsDirectory stringByAppendingPathComponent:JBSDKLog];//这里就是你将要存储的沙盒路径(.plist文件,名字自定义)
+//
+//    if(![[NSFileManager defaultManager] fileExistsAtPath:filePath]){//plistPath这个文件\文件夹是否存在
+//
+//        NSLog(@"-------文件不存在,写入文件----------");
+//
+//               NSError *error;
+//               if([self.tempStepString writeToFile:filePath atomically:YES encoding:NSUTF8StringEncoding error:&error]){
+//                   NSLog(@"------写入文件------success");
+//               }else{
+//                    NSLog(@"------写入文件------fail,error==%@",error);
+//               };
+//
+//    }else{
+//
+////     NSLog(@"-------文件存在,追加文件----------");
+//       NSFileHandle *fileHandle = [NSFileHandle fileHandleForUpdatingAtPath:filePath];
+//       [fileHandle seekToEndOfFile];  //将节点跳到文件的末尾
+//       NSData* stringData  = [self.tempStepString dataUsingEncoding:NSUTF8StringEncoding];
+//       [fileHandle writeData:stringData]; //追加写入数据
+//       [fileHandle closeFile];
+//
+//    }
+//
+//}
+//
+//-(void)uploadpPlistFile{
+//    
+//    //这个方法获取出的结果是一个数组.因为有可以搜索到多个路径.
+//    NSArray *array =  NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+//    //在这里,我们指定搜索的是Cache目录,所以结果只有一个,取出Cache目录
+//    NSString *documentsDirectory = array[0];
+////    NSLog(@"%@",documentsDirectory);
+//    //拼接文件路径
+//    NSString *filePathName = [documentsDirectory stringByAppendingPathComponent:JBSDKLog];
+//    //如果保存的是一个数组.那就通过数组从文件当中加载.
+//    NSString *string = [NSString stringWithContentsOfFile:filePathName encoding:NSUTF8StringEncoding error:nil];
+////    NSLog(@"%@",string);
+//    //4.设置请求体
+//    NSData *upData = [string dataUsingEncoding:NSUTF8StringEncoding];
+//    //
+//    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
+//    manager.requestSerializer.timeoutInterval=15;
+//    [manager.requestSerializer setValue:@"multipart/form-data" forHTTPHeaderField:@"Content-Type"];
+//    manager.requestSerializer = [AFJSONRequestSerializer serializer];
+//    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/plain",@"text/html",@"application/json",@"text/javascript",@"image/jpeg",@"image/png",@"application/octet-stream",@"application/x-www-form-urlencoded", nil];
+//    //    NSLog(@"请求URL ===================>> %@",urlString);
+//    NSLog(@"******************* 请求头参数 = %@ ***************************",manager.requestSerializer.HTTPRequestHeaders);
+//    
+//    AFHTTPSessionManager *sessionManager = [[AFHTTPSessionManager alloc] initWithBaseURL:nil];
+//    [sessionManager POST:@"http://172.16.14.127:8080/upload" parameters:nil headers:nil constructingBodyWithBlock:^(id<AFMultipartFormData>  _Nonnull formData){
+//
+//        [formData  appendPartWithFileData:upData name:@"file" fileName:[NSString stringWithFormat:@"ios_%@_%@.txt",Game_Type,[self getNowTimeTimestamp]] mimeType:@"text/plain"];
+//
+//        }progress:^(NSProgress * _Nonnull uploadProgress){
+//            NSLog(@"上传进度 = %@",uploadProgress);
+//
+//        }success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject){
+//            NSLog(@"上传成功");
+//
+//        }failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error){
+//
+//            for (NSString * key  in error.userInfo){
+//
+//                if ([key isEqualToString:@"com.alamofire.serialization.response.error.data"]){
+//
+//                    id errorObject = [NSJSONSerialization JSONObjectWithData:error.userInfo[key] options:1  error:nil];
+//
+//                    NSLog(@"上传失败 ===>> %@",errorObject);
+//                    if (errorObject !=nil && [errorObject isKindOfClass:[NSDictionary class]]){
+//                        NSString * result = errorObject[@"result"];
+//                        if ([result intValue] ==1){
+//                            [PopupView showCusHUDA:@"上传成功"];
+//                        }
+//                        
+//                    }
+//
+//                }
+//                
+//          }
+//            
+//    }];
+// 
+//}
+//
+////获取当前时间戳有两种方法(以秒为单位)
+//-(NSString *)getNowTimeTimestamp{
+//
+//    NSDateFormatter *formatter = [[NSDateFormatter alloc] init] ;
+//
+//    [formatter setDateStyle:NSDateFormatterMediumStyle];
+//
+//    [formatter setTimeStyle:NSDateFormatterShortStyle];
+//
+//    [formatter setDateFormat:@"YYYY-MM-dd HH:mm:ss"]; // ----------设置你想要的格式,hh与HH的区别:分别表示12小时制,24小时制
+//
+//    //设置时区,这个对于时间的处理有时很重要
+//
+//    NSTimeZone* timeZone = [NSTimeZone timeZoneWithName:@"Asia/Shanghai"];
+//
+//    [formatter setTimeZone:timeZone];
+//
+//    NSDate *datenow = [NSDate date];//现在时间,你可以输出来看下是什么格式
+//
+//    NSString *timeSp = [NSString stringWithFormat:@"%ld", (long)[datenow timeIntervalSince1970]];
+//
+//    return timeSp;
+//
+//}
+//   
+//@end
+//

+ 16 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/ViceShoesAnalysis.h

@@ -0,0 +1,16 @@
+//
+//  ViceShoesAnalysis.h
+//  Unity-iPhone
+//
+//  Created by duowan123 on 2021/12/4.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface ViceShoesAnalysis : NSObject
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 12 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/ViceShoesAnalysis.m

@@ -0,0 +1,12 @@
+//
+//  ViceShoesAnalysis.m
+//  Unity-iPhone
+//
+//  Created by duowan123 on 2021/12/4.
+//
+
+#import "ViceShoesAnalysis.h"
+
+@implementation ViceShoesAnalysis
+
+@end

+ 0 - 19
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/Entity /UserFriendsModel.h

@@ -25,25 +25,6 @@
 
 @interface RankModel : NSObject
 
-//               "id":70,
-//               "rank_id":5,
-//               "game_id":3,
-//               "user_id":144,
-//               "score":8924,
-//               "duration":349,
-//               "consume":0,
-//               "finish_at":"2021-09-06 09:54:09",
-//               "rate_begin":"2021-09-01",
-//               "rate_end":"2021-09-30",
-//               "user_name":"用户不存在",
-//               "user_avatar":"http://static.ouj.com/shoes/test/avatar/avatar_144_791469ce78a423b24a65e06921a1777a.jpg",
-//               "user_level":3,
-//               "user_gender":1,
-//               "user_age":null,
-//               "achievements":Array[13],
-//               "achievements_show":Array[4],
-//               "position":1
-
 @property (nonatomic, assign) int trans_id;
 @property (nonatomic, assign) int rank_id;
 @property (nonatomic, assign) int game_id;

binární
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/HTTP/.DS_Store


+ 16 - 6
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/HTTP/HTTPDataProcession.h

@@ -12,14 +12,24 @@
 #define RequestSerializerType_URLEncoded @"application/x-www-form-urlencoded"
 #define RequestSerializerType_FormData @"form-data"
 
+#define CFBundleVersion [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]
+#define OS @"2"
+
 //#define BASE_URL @"http://shoes-api.hiyd.com"//正式环境
 #define BASE_URL @"http://test-shoes-api.hiyd.com"//测试环境
-#define GAME_INVITE [NSString stringWithFormat:@"%@%@",BASE_URL,@"/game/invite"]
-#define GAME_RECORD [NSString stringWithFormat:@"%@%@",BASE_URL,@"/gameRecord/addGame"]
-#define GAME_FRIENDS [NSString stringWithFormat:@"%@%@",BASE_URL,@"/forum/friends?limit=1000"]
-#define GAME_RANK [NSString stringWithFormat:@"%@%@",BASE_URL,@"/rank/game?ver=1.1.1&os=1"]
-#define GAME_START [NSString stringWithFormat:@"%@%@",BASE_URL,@"/game/start"]
-#define GAME_END [NSString stringWithFormat:@"%@%@",BASE_URL,@"/game/end"]
+//#define GAME_INVITE [NSString stringWithFormat:@"%@%@",BASE_URL,@"/game/invite"]
+//#define GAME_RECORD [NSString stringWithFormat:@"%@%@",BASE_URL,@"/gameRecord/addGame"]
+//#define GAME_FRIENDS [NSString stringWithFormat:@"%@%@",BASE_URL,@"/forum/friends"]
+//#define GAME_RANK [NSString stringWithFormat:@"%@%@",BASE_URL,@"/rank/game"]
+//#define GAME_START [NSString stringWithFormat:@"%@%@",BASE_URL,@"/game/start"]
+//#define GAME_END [NSString stringWithFormat:@"%@%@",BASE_URL,@"/game/end"]
+
+#define GAME_INVITE [NSString stringWithFormat:@"%@%@?v=%@&os=%@",BASE_URL,@"/game/invite",CFBundleVersion,OS]
+#define GAME_RECORD [NSString stringWithFormat:@"%@%@?v=%@&os=%@",BASE_URL,@"/gameRecord/addGame",CFBundleVersion,OS]
+#define GAME_FRIENDS [NSString stringWithFormat:@"%@%@?v=%@&os=%@",BASE_URL,@"/forum/friends",CFBundleVersion,OS]
+#define GAME_RANK [NSString stringWithFormat:@"%@%@?v=%@&os=%@",BASE_URL,@"/rank/game",CFBundleVersion,OS]
+#define GAME_START [NSString stringWithFormat:@"%@%@?v=%@&os=%@",BASE_URL,@"/game/start",CFBundleVersion,OS]
+#define GAME_END [NSString stringWithFormat:@"%@%@?v=%@&os=%@",BASE_URL,@"/game/end",CFBundleVersion,OS]
 
 typedef void(^SuccessBlock)(id data);
 typedef void(^FailBlock)(id errorDes);

+ 50 - 50
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/HTTP/HTTPDataProcession.m

@@ -143,10 +143,10 @@
 
 #pragma mark --------- request
 +(void)getFriendsList:(UserFriendsDataBlock)userFriendsDataBlock{
+    
+    NSString *urlString =  [NSString stringWithFormat:@"%@&limit=%@&v=%@&os=%@",GAME_FRIENDS,@"1000",CFBundleVersion,OS];
 
-    NSLog(@"gameFriends token ===>> %@ ",IOSSDK_TOKEN);
-
-    [HTTPDataProcession getHTTPDataProcession:GAME_FRIENDS token:IOSSDK_TOKEN  success:^(id data){
+    [HTTPDataProcession getHTTPDataProcession:urlString token:[MYFactoryManager getToken]  success:^(id data){
             // 网络访问成功
 //            NSLog(@"data=%@",[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]);
             NSError * error;
@@ -154,7 +154,7 @@
         
 //                NSLog(@"gameFriends dictionary === %@ ",dictionary);
 
-            if (!error){
+            if (!error && dictionary!=nil &&![dictionary isKindOfClass:[NSNull class]]){
                 
                 int code = [dictionary[@"code"] intValue];
 
@@ -162,6 +162,9 @@
                     
                     NSDictionary * dict = dictionary[@"data"];
                     NSArray * arr = dict[@"list"];
+                    if (arr == nil || [arr isKindOfClass:[NSNull class]]) {
+                        return;
+                    }
                     
                     NSMutableArray * userArr = [NSMutableArray new];//存储数据
 
@@ -210,25 +213,21 @@
     
 }
 
-
 + (void)inviteFriends:(int)friendid info:(char*)info inviteDataBlock:(InviteDataBlock)inviteDataBlock{
-
-    NSDictionary * jsonDict = [IOS_NSUSERDEFAULT objectForKey:IOSSDK_USERINFO];
-
-    NSString * token = [jsonDict objectForKey:@"token"];
+    
     NSString * invite_user_id = [NSString stringWithFormat:@"%d",friendid];
     NSString * invite = [NSString stringWithFormat:@"%s",info];
-    NSString * game_id = jsonDict[@"game_id"];
-    NSLog(@"InviteFriend ===>> token:%@  friendid:%d  info:%s",token,friendid,info);
-    
-    NSString *urlString = [NSString stringWithFormat:@"%@?invite_user_id=%@&invite=%@&game_id=%@",GAME_INVITE,invite_user_id,invite,game_id];
-    [HTTPDataProcession getHTTPDataProcession:urlString token:token  success:^(id data){
+    NSString *urlString = [NSString stringWithFormat:@"%@&invite_user_id=%@&invite=%@&game_id=%@",GAME_INVITE,invite_user_id,invite,[MYFactoryManager getGameId]];
+    //    NSLog(@"InviteFriend ===>> token:%@  friendid:%d  info:%s",token,friendid,info);
+    NSLog(@"InviteFriend urlString ===>> %@",urlString);
+
+    [HTTPDataProcession getHTTPDataProcession:urlString token:[MYFactoryManager getToken]  success:^(id data){
         
             NSError * error;
             NSDictionary *dictionary =[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:&error];
 //                NSLog(@"gameFriends dictionary === %@ ",dictionary);
 
-            if (!error){
+        if (!error && dictionary!=nil &&![dictionary isKindOfClass:[NSNull class]]){
                 
                 int code = [dictionary[@"code"] intValue];
 
@@ -239,7 +238,9 @@
                  }
                 
               }
+        
             }fail:^(id errorDes){
+                
     }];
     
 }
@@ -253,18 +254,18 @@
         scoreType = @"friend";
     }
     
-    NSString *urlString = [NSString stringWithFormat:@"%@&game_id=%@&scope=%@",GAME_RANK,IOSSDK_GAMEID,scoreType];
+    NSString *urlString = [NSString stringWithFormat:@"%@&game_id=%@&scope=%@",GAME_RANK,[MYFactoryManager getGameId],scoreType];
 
     NSLog(@"urlString == %@",urlString);
     
-    [HTTPDataProcession getHTTPDataProcession:urlString token:IOSSDK_TOKEN  success:^(id data){
+    [HTTPDataProcession getHTTPDataProcession:urlString token:[MYFactoryManager getToken]  success:^(id data){
 
             NSError * error;
             NSDictionary *dictionary =[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:&error];
         
 //            NSLog(@"GetRank dictionary === %@ ",dictionary);
         
-            if (!error){
+        if (!error && dictionary!=nil &&![dictionary isKindOfClass:[NSNull class]]){
 
                 int code = [dictionary[@"code"] intValue];
 
@@ -280,7 +281,9 @@
                             
                             NSDictionary * dict = dictionary[@"data"];
                             NSArray * arr = dict[@"records"];
-                            
+                            if (arr == nil || [arr isKindOfClass:[NSNull class]]) {
+                                return;
+                            }
                             NSMutableArray * userArr = [NSMutableArray new];//存储数据
                             
                             NSMutableDictionary * list = [NSMutableDictionary new];
@@ -299,7 +302,7 @@
 
 //                            [gameFriends setValue:model.status forKey:@"status"];
                             NSMutableDictionary * user = [NSMutableDictionary new];
-                            [user setObject:[NSNumber numberWithInt:model.trans_id] forKey:@"id"];
+                            [user setObject:[NSNumber numberWithInt:model.user_id] forKey:@"id"];
                             [user setValue:model.user_name forKey:@"nickname"];
                             [user setObject:[NSNumber numberWithInt:model.user_gender] forKey:@"gender"];
                             [user setValue:@"" forKey:@"address"];
@@ -341,27 +344,26 @@
     
 }
 
-
 /**
  开始游戏
  @param level 等级
 */
 +(void)gameStart{
 
-    NSString *urlString = [NSString stringWithFormat:@"%@?id=%@",GAME_START,IOSSDK_GAMEID];
-    [HTTPDataProcession getHTTPDataProcession:urlString token:IOSSDK_TOKEN  success:^(id data){
+    NSString *urlString = [NSString stringWithFormat:@"%@&id=%@",GAME_START,[MYFactoryManager getGameId]];
+    [HTTPDataProcession getHTTPDataProcession:urlString token:[MYFactoryManager getToken]  success:^(id data){
         
             NSError * error;
             NSDictionary *dictionary =[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:&error];
 //                NSLog(@"gameFriends dictionary === %@ ",dictionary);
 
-            if (!error){
+        if (!error && dictionary!=nil && ![dictionary isKindOfClass:[NSNull class]]){
                 
                 int code = [dictionary[@"code"] intValue];
 
                 if (code==0){//
                     
-                    NSLog(@"gameStart 上传成功  ==>> %@",dictionary[@"message"]);
+                NSLog(@"gameStart 上传成功  ==>> %@",dictionary[@"message"]);
                     
                  }
                 
@@ -382,14 +384,14 @@
 */
 +(void)gameEnd{
     
-    NSString *urlString = [NSString stringWithFormat:@"%@?id=%@",GAME_END,IOSSDK_GAMEID];
-    [HTTPDataProcession getHTTPDataProcession:urlString token:IOSSDK_TOKEN  success:^(id data){
+    NSString *urlString = [NSString stringWithFormat:@"%@&id=%@",GAME_END,[MYFactoryManager getGameId]];
+    [HTTPDataProcession getHTTPDataProcession:urlString token:[MYFactoryManager getToken]  success:^(id data){
         
             NSError * error;
             NSDictionary *dictionary =[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:&error];
 //                NSLog(@"gameFriends dictionary === %@ ",dictionary);
 
-            if (!error){
+        if (!error && dictionary!=nil &&![dictionary isKindOfClass:[NSNull class]]){
                 
                 int code = [dictionary[@"code"] intValue];
 
@@ -407,7 +409,6 @@
 
     }];
     
-    
 }
 
 +(void)postGameRecord:(int)level
@@ -419,8 +420,7 @@
     
     NSMutableDictionary * sportRecord = [NSMutableDictionary new];
     //缓存的token、game_id
-    NSString * token = IOSSDK_TOKEN;
-    NSString * game_id = IOSSDK_GAMEID;
+    NSString * game_id = [MYFactoryManager getGameId];
     [sportRecord setObject:game_id forKey:@"game_id"];//游戏类型
     //预留字段:默认
     [sportRecord setObject:@0 forKey:@"consume"];//卡路里默认0
@@ -433,17 +433,15 @@
     [sportRecord setObject:[NSNumber numberWithInt:record] forKey:@"record"];
     [sportRecord setObject:[NSNumber numberWithInt:mode] forKey:@"mode"];
     [sportRecord setObject:[NSNumber numberWithInt:opponentId] forKey:@"opponentId"];
-    //新增加时间戳字段
-     if ( [IOS_NSUSERDEFAULT objectForKey:IOSSDK_TIMESTAMP]!=nil){
-         NSString * timestamp =  [IOS_NSUSERDEFAULT objectForKey:IOSSDK_TIMESTAMP];
-         [sportRecord setObject:timestamp forKey:@"play_group"];
-     }else{
-         [sportRecord setObject:[AlgorithmTool returnTimestamp] forKey:@"play_group"];
-     }
-
-//    NSLog(@"%@",sportRecord);
-//    return;
-    
+   
+   //新增加时间戳字段
+    if ( [IOS_NSUSERDEFAULT objectForKey:IOSSDK_TIMESTAMP]!=nil){
+        NSString * timestamp =  [IOS_NSUSERDEFAULT objectForKey:IOSSDK_TIMESTAMP];
+        [sportRecord setObject:timestamp forKey:@"play_group"];
+    }else{
+        [sportRecord setObject:[AlgorithmTool returnTimestamp] forKey:@"play_group"];
+    }
+  
     //缓存的动作数据和持续时间
     NSDictionary * acheDict = [IOS_NSUSERDEFAULT objectForKey:IOSSDK_BLESDKDATA];
     if (acheDict!=nil){
@@ -454,22 +452,24 @@
         [sportRecord setObject:@0 forKey:@"step"];
         [sportRecord setObject:@0 forKey:@"duration"];
     }
-             
-    [HTTPDataProcession postHTTPDataProcession:GAME_RECORD withParams:sportRecord  token:token success:^(id data){
-           
-        NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
+    
+    NSLog(@"%@",sportRecord);
+
+    [HTTPDataProcession postHTTPDataProcession:GAME_RECORD withParams:sportRecord  token:[MYFactoryManager getToken] success:^(id data){
+        NSError * error;
+        NSDictionary *dictionary = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&error];
 
-        if (dic!=nil){
+        if (!error && dictionary!=nil &&![dictionary isKindOfClass:[NSNull class]]){
 
-            int code = [dic[@"code"] intValue];
+            int code = [dictionary[@"code"] intValue];
 
             if (code==0){
                 
-                NSLog(@"GameEnd 上传成功 %@",dic);
+                NSLog(@"GameEnd 上传成功 %@",dictionary);
                 gameEndDataBlock(@"上传成功");
                 
         }else{
-                NSLog(@"请求错误 =========== >>> %@",dic[@"msg"]);
+                NSLog(@"请求错误 =========== >>> %@",dictionary[@"msg"]);
              }
             
         }

+ 1 - 1
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/HTTP/socket/SocketRocketUtility.m

@@ -118,7 +118,7 @@ static SocketRocketUtility* instance = nil;
     self.socket = [[SRWebSocket alloc] initWithURLRequest:
                    [NSURLRequest requestWithURL:[NSURL URLWithString:@"ws://172.16.14.127/examples/websocket/chat"]]];//这里填写你服务器的地址
     
-    NSLog(@"请求的websocket地址:%@",self.socket.url.absoluteString);
+//    NSLog(@"请求的websocket地址:%@",self.socket.url.absoluteString);
     self.socket.delegate = self;   //实现这个 SRWebSocketDelegate 协议
     [self.socket open];     //open 就是直接连接了
 }

+ 23 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/IOSPlatformSDK.h

@@ -60,6 +60,17 @@
 */
 -(void)bridgingInteraction:(int)cusid
                       code:(int)code;
+
+/**
+*趣动通知好友邀请事件
+ * code:
+ * userChar:
+ * infoChar:
+*/
+-(void)bridgingInvite:(int)code
+                  userChar:(const char *)userChar
+                  infoChar:(const char *)infoChar;
+
 @end
 
 //****************** unity call  ios  start ******************//
@@ -102,11 +113,16 @@ extern void ConnectDevice(int type);
  * 震动
  * type: 设备ID
  * duration: 时长 ms [100 .. 1000]
+ leftOrRight:针对三轮车
  */
 extern "C" {
 extern void  Vibrate(int type,int duration);
 }
 
+extern "C" {
+void  Vibrates(int type,int duration,int leftOrRight);
+}
+
 /**
  * unity获取用户好友 -->> ios端根据用户token值请求http好友列表 ios将列表json的数组数据传给unity
  */
@@ -168,3 +184,10 @@ void ShowInviteFriend(int code, char * info);
 extern "C" {
 void GetRank(int type);
 }
+
+/**
+* Unity call ios 获取鞋子角度
+*/
+extern "C" {
+int NativeGetAttX(int cusId);
+}

+ 125 - 329
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/IOSPlatformSDK.mm

@@ -7,8 +7,11 @@
 
 
 #import "IOSPlatformSDK.h"
+//#import "AvoidCrash.h"
+//#import <Bugly/Bugly.h>
 
-#pragma mark ============================>> ios call unity C语言指针声明 start
+#pragma mark ============================>> ios call unity (定义名字参数和C#类一样的方法)
+//大概流程就是先将C#的函数指针存入OC内存,在OC需要回调unity的时候就可以使用不同的指针来回调不同的unity方法
 /**
 *运动数据
 * left: 左鞋动作代码
@@ -61,26 +64,22 @@ typedef void (* ActionHandler) (int cusid, int code);
 */
 typedef void (* GetRankHandler)(int conde,const char * userJson);
 
-ActionHandler actionHandler;
-MotionHandler motionHandler;
-StepHandler stepHandler;
-DeviceHandler deviceHandler;
-UserFriendsHandler userFriendsHandler;
-InviteFriendHandler inviteFriendHandler;
-GetRankHandler getRankHandler;
-
-//
-#pragma mark ============================>> ios call unity C语言指针声明 结束
-
-@interface IOSPlatformSDK ()
-
-//计算游戏启动时间
-@property(nonatomic,strong)NSDate * firstTime;
-
-@property(nonatomic,strong)UILabel * testLabel;
-@property(copy,nonatomic)NSString * macAddress;
-
-@end
+/** array: x,y,z姿态数据
+* 单位:弧度
+* 使用时要将数据 除以 10000
+* 转换角度可以使用 Mathf.Rad2Deg
+*/
+typedef void (* RotateHandler)(int cusid,int right_pos[3],int left_pos[3],int right_att[3],int left_att[3],int righrAcc[3],int leftAcc[3]);
+
+#pragma mark ============================>> 声明 静态指针变量的实例 在unity call ios时候将该指针存储在内存中,在需要ios call unity时,用该指针调用unity的函数接口
+static ActionHandler actionHandler;
+static MotionHandler motionHandler;
+static StepHandler stepHandler;
+static DeviceHandler deviceHandler;
+static UserFriendsHandler userFriendsHandler;
+static InviteFriendHandler inviteFriendHandler;
+static GetRankHandler getRankHandler;
+static RotateHandler rotateHandler;
 
 @implementation IOSPlatformSDK
 
@@ -102,251 +101,52 @@ static IOSPlatformSDK * instance;
     static dispatch_once_t onceToken;
     dispatch_once(&onceToken, ^{
         instance = [super init];
-        [self initNotification];
- 
-        [Bugly startWithAppId:@"403d275730"];
+        [BTDataProcess sharedInstance];
+//        [Bugly startWithAppId:@"36a0c05291"];
         //防奔溃
-        [AvoidCrash makeAllEffective];
-        NSArray *noneSelClassStrings = @[
-                                         @"NSString"
-                                         ];
-        [AvoidCrash setupNoneSelClassStringsArr:noneSelClassStrings];
-        NSArray *noneSelClassPrefix = @[
-                                        @"AvoidCrash"
-                                        ];
-        [AvoidCrash setupNoneSelClassStringPrefixsArr:noneSelClassPrefix];
-        //监听通知:AvoidCrashNotification, 获取AvoidCrash捕获的崩溃日志的详细信息
-        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(dealwithCrashMessage:) name:AvoidCrashNotification object:nil];
+//        [AvoidCrash makeAllEffective];
+//        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(dealwithCrashMessage:) name:AvoidCrashNotification object:nil];
     });
     return instance;
 }
 
-- (void)dealwithCrashMessage:(NSNotification *)note{
-
- NSDictionary *info = note.userInfo;
-  NSString *errorReason = [NSString stringWithFormat:@"【ErrorReason】%@========【ErrorPlace】%@========【DefaultToDo】%@========【ErrorName】%@", info[@"errorReason"], info[@"errorPlace"], info[@"defaultToDo"], info[@"errorName"]];
-  NSArray *callStack = info[@"callStackSymbols"];
-  [self reportErrorName:@"Bugly_ErrorName_AvoidCrash" errorReason:errorReason callStack:callStack extraInfo:nil];
-
-}
-
-/** 上报错误信息 */
-- (void)reportErrorName:(NSString *)errorName errorReason:(NSString *)errorReason callStack:(NSArray *)aStackArray extraInfo:(NSDictionary *)info{
-[Bugly reportExceptionWithCategory:3 name:errorName reason:errorReason callStack:aStackArray extraInfo:info terminateApp:NO];
-}
-
-#pragma mark ============================>> public method app跳转直链
--(void)startWithUrl:(NSURL*)url{//
-    
-    if (url==nil){
-        return;
-    }
-    NSString * urlString = [url absoluteString];
-    NSArray * stringArr = [urlString componentsSeparatedByString:@"//"];
-    NSString * arr2 = stringArr[1];
-    NSString* finsalString = [arr2 stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
-    NSDictionary * urlDict = [AlgorithmTool dictionaryWithJsonString:finsalString];
-    NSLog(@"Schemes_Url转码的dict ========= %@",urlDict);
-        
-    //固定一个时间戳
-    NSString * timestamp =   [AlgorithmTool returnTimestamp];
-    [IOS_NSUSERDEFAULT setObject:timestamp forKey:IOSSDK_TIMESTAMP];
-    [IOS_NSUSERDEFAULT synchronize];
-    
-    if (urlDict!=nil){
-        //缓存用户信息数据
-        [IOS_NSUSERDEFAULT setObject:urlDict forKey:IOSSDK_USERINFO];
-        [IOS_NSUSERDEFAULT synchronize];
-        //主副设备:deviceType  游戏种类:game_id  mac地址:macAddress
-        BTDataProcess* bleInstance = [BTDataProcess sharedInstance];
-        bleInstance.deviceType = DEVICETYPE_MAIN;
-        NSString * game_id = urlDict[@"game_id"];
-        bleInstance.game_id = (GAME_TYPE)[game_id intValue];
-        if ([urlDict objectForKey:@"mac"]!=nil){
-            bleInstance.macAddress = [urlDict objectForKey:@"mac"];
-            self.macAddress = [urlDict objectForKey:@"mac"];
-        }
-        //链接蓝牙
-        [bleInstance initCBCentralManager];
-        //数据存入plist
-        bleInstance.allMotionCountBLock = ^(int jump_count, int crouch_count, int step_count){
-//            NSLog(@"jump_count = %d crouch_count = %d step_count = %d ",jump_count,crouch_count,step_count);
-            [self cacheAllMotionCount:jump_count crouchCount:crouch_count stepCount:step_count];
-        };
-    }
-    //先打开app后已经创建了label,第二次open重新赋值
-    self.testLabel.text = [NSString stringWithFormat:@"%@ mac: %@",self.openStyle,self.macAddress];
-    
-}
-
-#pragma mark ============================>> private 各类通知处理事件
--(void)initNotification{
-    
-    //监听各类通知action
-    [CUS_NOTIFICATIONCENTER addObserver:self selector:@selector(gameStartInitData) name:@"gameStartInitData" object:nil];
-    [CUS_NOTIFICATIONCENTER addObserver:self selector:@selector(gameEndInitData:) name:@"gameEndInitData" object:nil];
-    [CUS_NOTIFICATIONCENTER addObserver:self selector:@selector(searchBLEAction:) name:@"searchBLEAction" object:nil];
-    //监听 app group 消息 ==>> 好友邀请信息
-    CFStringRef invite = (__bridge CFStringRef)@"INVITE_NOTIFICATION";
-    CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(),
-                                    NULL,
-                                    inviteFriends,
-                                    invite,
-                                    NULL,
-                                    CFNotificationSuspensionBehaviorDeliverImmediately);
-    
-}
-
-//趣动app:广播的通知回调
-void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo){
-        
-    //group.com.Oujia.AppAndGame 沙河数据
-    NSUserDefaults* userDefault = [[NSUserDefaults alloc] initWithSuiteName:@"group.com.Oujia.AppAndGame"];
-    //趣动传过来的 invite json字符串转字典
-    NSString * string = [userDefault objectForKey:@"invite"];
-    NSData * data = [string dataUsingEncoding:NSUTF8StringEncoding];
-    NSDictionary * inviteDict = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
-    if (inviteDict!=nil){
-        //字典取值
-        NSDictionary * invite = [inviteDict objectForKey:@"invite"];
-        NSDictionary * user =  [invite objectForKey:@"user"];
-        //user字典转字符串
-        NSData * userData = [NSJSONSerialization dataWithJSONObject:user options:NSJSONWritingPrettyPrinted error:nil];
-        NSString * userString =  [[NSString alloc] initWithData:userData encoding:NSUTF8StringEncoding];
-        const char * userChar =[userString UTF8String];
-        //info字典转字符串
-        NSString * infoString = invite[@"info"];
-        const char * infoChar =[infoString UTF8String];
-        NSLog(@"IOS_SKD 回调好友邀请信息 GetInviteInfo ===>>  %s , %s",userChar,infoChar);
-        inviteFriendHandler(0,userChar,infoChar);
-        
-    }
-    
-}
-
-//通知开始游戏
--(void)gameStartInitData{
-    NSLog(@"unity call ios 通知开始游戏 --> IOSPlatformSDK");
-    [[BTDataProcess sharedInstance] gameStartInitData];
-    if ([self existUserInfo]){
-        self.firstTime = [NSDate date];
-    }
-}
+//- (void)dealwithCrashMessage:(NSNotification *)note{
+//
+// NSDictionary *info = note.userInfo;
+//  NSString *errorReason = [NSString stringWithFormat:@"【ErrorReason】%@========【ErrorPlace】%@========【DefaultToDo】%@========【ErrorName】%@", info[@"errorReason"], info[@"errorPlace"], info[@"defaultToDo"], info[@"errorName"]];
+//  NSLog(@"errorReason = %@",errorReason);
+//  NSArray *callStack = info[@"callStackSymbols"];
+//  [self reportErrorName:@"Bugly_ErrorName_AvoidCrash" errorReason:errorReason callStack:callStack extraInfo:nil];
+//
+//}
+//
+///** 上报错误信息 */
+//- (void)reportErrorName:(NSString *)errorName errorReason:(NSString *)errorReason callStack:(NSArray *)aStackArray extraInfo:(NSDictionary *)info{
+//    [Bugly reportExceptionWithCategory:3 name:errorName reason:errorReason callStack:aStackArray extraInfo:info terminateApp:NO];
+//}
 
-//通知结束游戏
--(void)gameEndInitData:(NSNotification*)notification{
-    [[BTDataProcess sharedInstance] gameEndInitData];
-    NSLog(@"unity call ios 通知结束游戏 --> IOSPlatformSDK");
+#pragma mark ============================>> public method app 跳转直链
+-(void)startWithUrl:(NSURL*)url{
+    [BTDataInstance startWithUrl:url];
 }
 
-//通知弹出蓝牙搜索框
--(void)searchBLEAction:(NSNotification*)notification{
-    
-    NSLog(@"unity call ios 通知游戏弹窗 --> IOSPlatformSDK");
-    if ([instance existUserInfo]==NO){
-        return;
-    }
-    /***************************初始化蓝牙数据处理工具***************************/
-    //主副设备:deviceType  游戏种类:game_id  mac地址:macAddress
-    BTDataProcess* bleInstance = [BTDataProcess sharedInstance];
-    NSDictionary * notificationDict = notification.userInfo;
-    NSNumber * typeNumber = [notificationDict objectForKey:@"type"];
-    int type = [typeNumber intValue];
-    bleInstance.deviceType = (DEVICE_TYPE)type;
-    NSDictionary * jsonDict = [IOS_NSUSERDEFAULT objectForKey:IOSSDK_USERINFO];
-    NSString * game_id = jsonDict[@"game_id"];
-    bleInstance.game_id = (GAME_TYPE)[game_id intValue];
-    bleInstance.macAddress = @"";
-    //初始化蓝牙CBCentralManager
-    [bleInstance initCBCentralManager];
-    //缓存动作数据
-    bleInstance.allMotionCountBLock = ^(int jump_count, int crouch_count, int step_count){
-//        NSLog(@"jump_count = %d crouch_count = %d step_count = %d ",jump_count,crouch_count,step_count);
-        [self cacheAllMotionCount:jump_count crouchCount:crouch_count stepCount:step_count];
-    };
-
-    /***************************搜索蓝牙外设弹窗***************************/
-    SearchDeviceViewController  * searchVC = [SearchDeviceViewController  new];
-    [self addTOwindow:searchVC];
-    //searchVC搜索蓝牙Button
-    searchVC.searchDeviceTask = ^{
-        [bleInstance initCBCentralManager];
-    };
-    //BTDataProces搜索到的蓝牙外设-->searchVC
-    bleInstance.deviceArrBLock = ^(NSMutableArray * arr){//蓝牙数据回调 刷新popView数据
-        searchVC.deviceArray = arr;
-        [searchVC reloadData];
-//        [searchVC hideAnimation];
-    };
-    //点击searchVC的tableViewCell链接选中的蓝牙
-    searchVC.connectDeviceBlock = ^(CBPeripheral * peripheral){
-        bleInstance.deviceType = (DEVICE_TYPE)type;
-//        NSLog(@"connectDeviceBlock = %@ %ld",peripheral,(long)bleInstance.deviceType);
-        [bleInstance connectPeripheral:peripheral];
-        bleInstance.macAddress = peripheral.identifier.UUIDString;
-    };
-    
-    //bleInstance脚步交互动作-->searchVC
-    bleInstance.getInteractionBlock = ^(int interaction){
-        if (interaction!=-1){
-            NSLog(@"BTDataProcess 有效交互动作 ===>> %d",interaction);
-//            [searchVC getInteraction:interaction];
-        }else{
-//            NSLog(@"BTDataProcess 无效交互动作 ===>> %@",@"原地");
-        }
-    };
-    
-}
 //
-#pragma mark ============================>> private 全局弹窗
--(void)addTOwindow:(UIViewController*)searchVC{
-    
-    UIViewController *rootVC = [[UIApplication sharedApplication].delegate window].rootViewController;
-    UIViewController *parent = rootVC;
-    while ((parent = rootVC.presentedViewController) != nil ){
-    rootVC = parent;
-    }
-    while ([rootVC isKindOfClass:[UINavigationController class]]){
-    rootVC = [(UINavigationController *)rootVC topViewController];
-    }
-    [rootVC addChildViewController:searchVC];
-    [rootVC.view addSubview:searchVC.view];
-    
-}
-
-#pragma mark ============================>> private 缓存处理
+#pragma mark ============================>> private
 //是否已经缓存到用户信息
 -(BOOL)existUserInfo{
     
     NSDictionary * jsonDict = [IOS_NSUSERDEFAULT objectForKey:IOSSDK_USERINFO];
-     if (jsonDict==nil){
-//         [PopupView showCusHUDA:@"获取趣动用户数据失败"];
-         return YES;
+     if ([jsonDict isKindOfClass:[NSNull class]] || jsonDict == nil || [jsonDict isEqual:[NSNull null]]){
+         [PopupView showCusHUDA:@"获取用户信息失败,请从趣动启动"];
+         return NO;
      }else{
          return YES;
      }
     
 }
 
-//玩游戏过程中缓存 动作数据 和时间戳
--(void)cacheAllMotionCount:(int)jump_count crouchCount:(int)crouch_count stepCount:(int)step_count{
-    
-    //游戏持续时间
-    NSTimeInterval durationTime = [[NSDate date] timeIntervalSinceDate:self.firstTime];//游戏总共经历的时长 秒数
-    //缓存pilst文件
-    NSMutableDictionary * bleDict = [NSMutableDictionary new];
-    [bleDict setObject:[NSNumber numberWithInt:durationTime] forKey:@"duration"];
-    [bleDict setObject:[NSNumber numberWithInt:jump_count] forKey:@"jump"];
-    [bleDict setObject:[NSNumber numberWithInt:crouch_count] forKey:@"crouch"];
-    [bleDict setObject:[NSNumber numberWithInt:step_count] forKey:@"step"];
-    NSDictionary * dict = [NSDictionary dictionaryWithDictionary:bleDict];
-    //归档缓存
-    [IOS_NSUSERDEFAULT setObject:dict forKey:IOSSDK_BLESDKDATA];
-    [IOS_NSUSERDEFAULT synchronize];
-    
-}
-
-#pragma mark ============================>> ios call unity
+//
+#pragma mark ============================>> ios call unity (数据处理后的回调)
 -(void)bridgingMotionAction:(int)cusid
                        left:(int)left
                       right:(int)right{
@@ -360,8 +160,9 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
               rightStatus:(int)rightStatus
                  leftFrag:(int)leftFrag
                 rightFrag:(int)rightFrag{
-    //        NSLog(@"deviceHandler ===>> %d %@ %@ %d %d",cusid,name,address,status,electricity);
-    stepHandler(cusid,leftStatus,rightStatus,leftFrag,rightFrag);
+    if (stepHandler != nil){
+        stepHandler(cusid,leftStatus,rightStatus,leftFrag,rightFrag);
+    }
 }
 
 -(void)bridgingDeviceAction:(int)cusid
@@ -370,24 +171,31 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
                      status:(int)status
                 electricity:(int)electricity{
 //        NSLog(@"deviceHandler ===>> %d %@ %@ %d %d",cusid,name,address,status,electricity);
-    //
     const char * charName =[name UTF8String];
     const char * charAddress =[address UTF8String];
-    if (deviceHandler!=nil){
+    if (deviceHandler != nil){
         deviceHandler(cusid,charName,charAddress,status,electricity);
     }
+    
 }
 
 -(void)bridgingInteraction:(int)cusid
                       code:(int)code{
     //传给unity ---> 旧版游戏未用到
-//    actionHandler(cusid,code);
+    if (actionHandler != nil){
+//            actionHandler(cusid,code);
+    }
 }
 
-@end
+-(void)bridgingInvite:(int)code
+             userChar:(const char *)userChar
+             infoChar:(const char *)infoChar{
+        inviteFriendHandler(0,userChar,infoChar);
+}
 
+@end
 
-#pragma mark ============================>> unity call ios
+#pragma mark ============================>> unity call ios (声明unity call ios的托管函数 & 接收unity传过来的指针)
 /**
  * c语言字符串指针malloc
  */
@@ -476,16 +284,14 @@ extern "C" {void PointerGetRankHandler(GetRankHandler  handler){
  * 游戏开始
  */
 void GameStart(){
-    
    NSLog(@"Unity 请求开始游戏 GameStart ===>>");
-
    if ([instance existUserInfo]==NO){
         return;
    }
-    
-   [CUS_NOTIFICATIONCENTER postNotificationName:@"gameStartInitData" object:nil];
-   [HTTPDataProcession gameStart];
-
+    //蓝牙
+    [BTDataInstance gameStartInitData];
+    //http
+    [HTTPDataProcession gameStart];
 }
 
 /**
@@ -499,21 +305,17 @@ void GameStart(){
 void GameEnd(int level, double score, int record, int mode, int opponentId){
     
     NSLog(@"Unity 请求结束游戏 GameEnd ===>> %d %f %d %d %d",level,score,record,mode,opponentId);
-    
     if ([instance existUserInfo]==NO){
         return;
     }
-    
-    [CUS_NOTIFICATIONCENTER postNotificationName:@"gameEndInitData" object:nil];
-
+    [BTDataInstance gameEndInitData];
+    //http
     [HTTPDataProcession gameEnd];
-
     //上传数据
     [HTTPDataProcession postGameRecord:level score:score record:record mode:mode opponentId:opponentId gameEndDataBlock:^(NSString *jsonString){
         NSLog(@"IOS_SKD 回调结束游戏请求 GameEnd ===> %@",jsonString);
     }];
-    
- }
+}
 
 /**
 * 搜索设备
@@ -521,10 +323,12 @@ void GameEnd(int level, double score, int record, int mode, int opponentId){
 */
 void SearchDevice(int type){
     //unity 有两个search按钮 type 0是主设备 1是副设备
-    NSDictionary * dict = @{@"type":@(type)};
-    NSLog(@"Unity 请求搜索设备 SearchDevice ===>> %@",dict);
-    [CUS_NOTIFICATIONCENTER postNotificationName:@"searchBLEAction" object:nil userInfo:dict];
-  }
+    NSLog(@"Unity 请求搜索设备 type ===>> %d",type);
+    if ([instance existUserInfo]==NO){
+        return;
+    }
+    [BTDataInstance searchBLEAction:type];
+}
 
 /**
 * 链接设备
@@ -532,6 +336,9 @@ void SearchDevice(int type){
 */
 void ConnectDevice(int type){
     NSLog(@"Unity 请求链接设备 ConnectDevice ===>> %d",type);
+    if ([instance existUserInfo]==NO){
+        return;
+    }
     //unity 有两个connect按钮 type 0是第一个玩家 1是第二个玩家
 }
 
@@ -541,31 +348,36 @@ void ConnectDevice(int type){
 * duration: 时长 ms [100 .. 1000]
 */
 void  Vibrate(int type,int duration){
-    //unity 有两个search按钮 type 0是主设备 1是副设备
-    NSMutableDictionary * obj = [NSMutableDictionary new];
-    [obj setObject:@(type) forKey:@"type"];
-    [obj setObject:@(duration) forKey:@"duration"];
-    NSDictionary * dict = [NSDictionary dictionaryWithDictionary:obj];
-    NSLog(@"vibrate ===>> %@",dict);
-    [CUS_NOTIFICATIONCENTER postNotificationName:@"vibrationAction" object:nil userInfo:dict];
+    if ([instance existUserInfo]==NO){
+        return;
+    }
+    [BTDataInstance vibrationAction:type duration:duration];
+}
+
+/**
+* 震动
+* type: 设备ID
+* duration: 时长 ms [100 .. 1000]
+*/
+void  Vibrates(int type,int duration,int leftOrRight){
+    if ([instance existUserInfo]==NO){
+        return;
+    }
+    [BTDataInstance vibrationAction:type duration:duration];
 }
 
 /**
 * unity获取用户好友列表 -->> ios端根据用户token值请求http好友列表 ios将列表json的数组数据传给unity
 */
 void GetUserFriends(){
-    
-    NSLog(@"Unity 请求好友列表 GetUserFriends ===>>");
-
+//    NSLog(@"Unity 请求好友列表 GetUserFriends ===>>");
     if ([instance existUserInfo]==NO){
         return;
     }
-    
     [HTTPDataProcession getFriendsList:^(int code, const char *jsonString){
         NSLog(@"IOS_SKD 回调好友列表 GetUserFriends ===> %s",jsonString);
         userFriendsHandler(code,jsonString);//异步回调
     }];
-
 }
 
 /**
@@ -573,25 +385,14 @@ void GetUserFriends(){
 */
  char *  GetUserInfoJson(){
      
-     NSLog(@"Unity 请求用户信息 GetUserInfoJson ===>>");
-
+//     NSLog(@"Unity 请求用户信息 GetUserInfoJson ===>>");
      if ([instance existUserInfo]==NO){
          return MakeStringCopy("");
      }else{
-         
-         NSDictionary * jsonDict = [IOS_NSUSERDEFAULT objectForKey:IOSSDK_USERINFO];
-         NSDictionary * user = jsonDict[@"user"];
-         
-         if (user!=nil){
-             NSData *jsonData = [NSJSONSerialization dataWithJSONObject:user options:NSJSONWritingPrettyPrinted error:nil];
-             NSString * userJsonString =  [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
-             const char * cuschart =[userJsonString UTF8String];
-             NSLog(@"IOS_SKD 回调用户信息 GetUserInfoJson ===> %@",userJsonString);
-             //要先copy 不然c#调用free的时候回闪退
-             return MakeStringCopy(cuschart);
-         }else{
-             return MakeStringCopy("");
-         }
+         const char * cuschart = [[MYFactoryManager getUserInfo] UTF8String];
+         NSLog(@"IOS_SKD 回调用户信息 GetUserInfoJson ===> %@",[MYFactoryManager getUserInfo]);
+         //要先copy 不然c#调用free的时候回闪退
+         return MakeStringCopy(cuschart);
      }
      
 }
@@ -602,6 +403,9 @@ void GetUserFriends(){
 */
 void DisConnectDevice(int type){
     NSLog(@"Unity 请求断开蓝牙链接 disConnectDevice ===>>");
+    if ([instance existUserInfo]==NO){
+        return;
+    }
 }
 
 /**
@@ -609,22 +413,17 @@ void DisConnectDevice(int type){
 * friendid: 游戏好友ID
 */
 void InviteFriend(int friendid,char * info){
-    
     NSLog(@"Unity 点击邀请好友 InviteFriend ===>>");
-
     if ([instance existUserInfo]==NO){
         return;
     }
-
     [HTTPDataProcession inviteFriends:friendid info:info inviteDataBlock:^(NSString *jsonString){
-        
 //        NSLog(@"IOS_SKD 回调点击邀请好友事件 InviteFriend ===>>");
         dispatch_async(dispatch_get_main_queue(), ^{
         [PopupView showCusHUDA:jsonString];
         });
         
     }];
-   
 }
 
 /**
@@ -636,27 +435,14 @@ void GetInviteInfo(){
     NSLog(@"Unity获取好友邀请信息 GetInviteInfo ===>>");
     if ([instance existUserInfo]==NO){
         return;
-    }else{
-        
-        NSDictionary * jsonDict = [IOS_NSUSERDEFAULT objectForKey:IOSSDK_USERINFO];
-        NSDictionary * invite = jsonDict[@"invite"];
-        if (invite!=nil){
-            
-            //user字典 -> 字符串 -> Char
-            NSDictionary * user =  [invite objectForKey:@"user"];
-            NSData * userData = [NSJSONSerialization dataWithJSONObject:user options:NSJSONWritingPrettyPrinted error:nil];
-            NSString * userString =  [[NSString alloc] initWithData:userData encoding:NSUTF8StringEncoding];
-            const char * userChar =[userString UTF8String];
-            
-            //info字符串 -> Char
-            NSString * info = invite[@"info"];
-            const char * infoChar =[info UTF8String];
-            
-            NSLog(@"IOS_SKD 回调好友邀请信息 GetInviteInfo ===>>  %s , %s",userChar,infoChar);
-            inviteFriendHandler(0,userChar,infoChar);
-            
-        }
     }
+    //user字典 -> 字符串 -> Char
+    const char * userChar = [[MYFactoryManager getInviteUser] UTF8String];
+    //info字符串 -> Char
+    const char * infoChar =[[MYFactoryManager getInviteInfo] UTF8String];
+    NSLog(@"IOS_SKD 回调好友邀请信息 GetInviteInfo ===>>  %s , %s",userChar,infoChar);
+    inviteFriendHandler(0,userChar,infoChar);
+    
 }
 
 /**
@@ -664,6 +450,9 @@ void GetInviteInfo(){
 */
 void ScreenProjection(){
     NSLog(@"Unity 请求投屏事件 ScreenProjection ===>>");
+    if ([instance existUserInfo]==NO){
+        return;
+    }
 }
 
 /**
@@ -672,6 +461,9 @@ void ScreenProjection(){
 */
 void ShowInviteFriend(int code, char * info){
     NSLog(@"Unity 请求打开好友列表弹窗 ShowInviteFriend ===>>");
+    if ([instance existUserInfo]==NO){
+        return;
+    }
 }
 
 /**
@@ -680,17 +472,21 @@ void ShowInviteFriend(int code, char * info){
  *ios 请求完数据后用 PointerGetRankHandler 回调数据给unity
 */
 void GetRank(int type){
-    
-    NSLog(@"Unity 获取榜单列表数据 GetRank ===>> %d",type);
+//    NSLog(@"Unity 获取榜单列表数据 GetRank ===>> %d",type);
     if ([instance existUserInfo]==NO){
         return;
     }
     [HTTPDataProcession GetRank:type rankDataBlock:^(const char *jsonString){
-        
         NSLog(@"IOS_SKD 回调 榜单列表数据 GetRank ===>> %d %s",type,jsonString);
-
         getRankHandler(type,jsonString);
-        
     }];
 
 }
+
+
+/**
+ * Unity call ios 获取鞋子角度
+*/
+int NativeGetAttX(int cusId){
+  return BTDataInstance.nativeAttX;
+}

binární
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/.DS_Store


binární
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash-master/.DS_Store


binární
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash-master/AvoidCrashDemo/.DS_Store


+ 0 - 116
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/AvoidCrash.h

@@ -1,116 +0,0 @@
-//
-//  AvoidCrash.h
-//  https://github.com/chenfanfang/AvoidCrash
-//
-//  Created by mac on 16/9/21.
-//  Copyright © 2016年 chenfanfang. All rights reserved.
-//
-
-//===================================================
-//   使用方法和注意事项:
-//   https://www.jianshu.com/p/2b90aa96c0a0
-//===================================================
-
-#import <Foundation/Foundation.h>
-#import <objc/runtime.h>
-
-//category
-#import "NSObject+AvoidCrash.h"
-
-#import "NSArray+AvoidCrash.h"
-#import "NSMutableArray+AvoidCrash.h"
-
-#import "NSDictionary+AvoidCrash.h"
-#import "NSMutableDictionary+AvoidCrash.h"
-
-#import "NSString+AvoidCrash.h"
-#import "NSMutableString+AvoidCrash.h"
-
-#import "NSAttributedString+AvoidCrash.h"
-#import "NSMutableAttributedString+AvoidCrash.h"
-
-//define
-#import "AvoidCrashStubProxy.h"
-
-
-
-
-
-@interface AvoidCrash : NSObject
-
-//===================================================
-//   使用方法和注意事项:
-//   https://www.jianshu.com/p/2b90aa96c0a0
-//===================================================
-
-
-
-/**
- *  
- *  开始生效.你可以在AppDelegate的didFinishLaunchingWithOptions方法中调用becomeEffective方法
- *  【默认不开启  对”unrecognized selector sent to instance”防止崩溃的处理】
- *
- *  这是全局生效,若你只需要部分生效,你可以单个进行处理,比如:
- *  [NSArray avoidCrashExchangeMethod];
- *  [NSMutableArray avoidCrashExchangeMethod];
- *  .................
- *  .................
- *
- */
-+ (void)becomeEffective;
-
-
-/** 
- *  相比于becomeEffective,增加
- *  对”unrecognized selector sent to instance”防止崩溃的处理
- *
- *  但是必须配合:
- *            setupClassStringsArr:和
- *            setupNoneSelClassStringPrefixsArr
- *            这两个方法可以同时使用
- */
-+ (void)makeAllEffective;
-
-
-
-/** 
- *  初始化一个需要防止”unrecognized selector sent to instance”的崩溃的类名数组
- *  ⚠️不可将@"NSObject"加入classStrings数组中
- *  ⚠️不可将UI前缀的字符串加入classStrings数组中
- */
-+ (void)setupNoneSelClassStringsArr:(NSArray<NSString *> *)classStrings;
-
-
-/**
- *  初始化一个需要防止”unrecognized selector sent to instance”的崩溃的类名前缀的数组
- *  ⚠️不可将UI前缀的字符串(包括@"UI")加入classStringPrefixs数组中
- *  ⚠️不可将NS前缀的字符串(包括@"NS")加入classStringPrefixs数组中
- */
-+ (void)setupNoneSelClassStringPrefixsArr:(NSArray<NSString *> *)classStringPrefixs;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-//您可以忽略以下方法
-
-+ (void)exchangeClassMethod:(Class)anClass method1Sel:(SEL)method1Sel method2Sel:(SEL)method2Sel;
-
-+ (void)exchangeInstanceMethod:(Class)anClass method1Sel:(SEL)method1Sel method2Sel:(SEL)method2Sel;
-
-+ (void)noteErrorWithException:(NSException *)exception defaultToDo:(NSString *)defaultToDo;
-
-
-@end

+ 0 - 212
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/AvoidCrash.m

@@ -1,212 +0,0 @@
-//
-//  AvoidCrash.m
-//  https://github.com/chenfanfang/AvoidCrash
-//
-//  Created by mac on 16/9/21.
-//  Copyright © 2016年 chenfanfang. All rights reserved.
-//
-
-#import "AvoidCrash.h"
-
-#define key_errorName        @"errorName"
-#define key_errorReason      @"errorReason"
-#define key_errorPlace       @"errorPlace"
-#define key_defaultToDo      @"defaultToDo"
-#define key_callStackSymbols @"callStackSymbols"
-#define key_exception        @"exception"
-
-@implementation AvoidCrash
-
-+ (void)becomeEffective {
-    [self effectiveIfDealWithNoneSel:NO];
-}
-
-+ (void)makeAllEffective {
-    [self effectiveIfDealWithNoneSel:YES];
-}
-
-+ (void)effectiveIfDealWithNoneSel:(BOOL)dealWithNoneSel {
-    static dispatch_once_t onceToken;
-    dispatch_once(&onceToken, ^{
-        
-        [NSObject avoidCrashExchangeMethodIfDealWithNoneSel:dealWithNoneSel];
-        
-        [NSArray avoidCrashExchangeMethod];
-        [NSMutableArray avoidCrashExchangeMethod];
-        
-        [NSDictionary avoidCrashExchangeMethod];
-        [NSMutableDictionary avoidCrashExchangeMethod];
-        
-        [NSString avoidCrashExchangeMethod];
-        [NSMutableString avoidCrashExchangeMethod];
-        
-        [NSAttributedString avoidCrashExchangeMethod];
-        [NSMutableAttributedString avoidCrashExchangeMethod];
-    });
-}
-
-+ (void)setupNoneSelClassStringsArr:(NSArray<NSString *> *)classStrings {
-    [NSObject setupNoneSelClassStringsArr:classStrings];
-}
-
-/**
- *  初始化一个需要防止”unrecognized selector sent to instance”的崩溃的类名前缀的数组
- */
-+ (void)setupNoneSelClassStringPrefixsArr:(NSArray<NSString *> *)classStringPrefixs {
-    [NSObject setupNoneSelClassStringPrefixsArr:classStringPrefixs];
-}
-
-/**
- *  类方法的交换
- *
- *  @param anClass    哪个类
- *  @param method1Sel 方法1
- *  @param method2Sel 方法2
- */
-+ (void)exchangeClassMethod:(Class)anClass method1Sel:(SEL)method1Sel method2Sel:(SEL)method2Sel {
-    Method method1 = class_getClassMethod(anClass, method1Sel);
-    Method method2 = class_getClassMethod(anClass, method2Sel);
-    method_exchangeImplementations(method1, method2);
-}
-
-
-/**
- *  对象方法的交换
- *
- *  @param anClass    哪个类
- *  @param method1Sel 方法1(原本的方法)
- *  @param method2Sel 方法2(要替换成的方法)
- */
-+ (void)exchangeInstanceMethod:(Class)anClass method1Sel:(SEL)method1Sel method2Sel:(SEL)method2Sel {
-    
-    
-    Method originalMethod = class_getInstanceMethod(anClass, method1Sel);
-    Method swizzledMethod = class_getInstanceMethod(anClass, method2Sel);
-    
-    BOOL didAddMethod =
-    class_addMethod(anClass,
-                    method1Sel,
-                    method_getImplementation(swizzledMethod),
-                    method_getTypeEncoding(swizzledMethod));
-    
-    if (didAddMethod) {
-        class_replaceMethod(anClass,
-                            method2Sel,
-                            method_getImplementation(originalMethod),
-                            method_getTypeEncoding(originalMethod));
-    }
-    
-    else {
-        method_exchangeImplementations(originalMethod, swizzledMethod);
-    }
-    
-}
-
-
-
-/**
- *  获取堆栈主要崩溃精简化的信息<根据正则表达式匹配出来>
- *
- *  @param callStackSymbols 堆栈主要崩溃信息
- *
- *  @return 堆栈主要崩溃精简化的信息
- */
-
-+ (NSString *)getMainCallStackSymbolMessageWithCallStackSymbols:(NSArray<NSString *> *)callStackSymbols {
-    
-    //mainCallStackSymbolMsg的格式为   +[类名 方法名]  或者 -[类名 方法名]
-    __block NSString *mainCallStackSymbolMsg = nil;
-    
-    //匹配出来的格式为 +[类名 方法名]  或者 -[类名 方法名]
-    NSString *regularExpStr = @"[-\\+]\\[.+\\]";
-    
-    
-    NSRegularExpression *regularExp = [[NSRegularExpression alloc] initWithPattern:regularExpStr options:NSRegularExpressionCaseInsensitive error:nil];
-    
-    
-    for (int index = 2; index < callStackSymbols.count; index++) {
-        NSString *callStackSymbol = callStackSymbols[index];
-        
-        [regularExp enumerateMatchesInString:callStackSymbol options:NSMatchingReportProgress range:NSMakeRange(0, callStackSymbol.length) usingBlock:^(NSTextCheckingResult * _Nullable result, NSMatchingFlags flags, BOOL * _Nonnull stop) {
-            if (result) {
-                NSString* tempCallStackSymbolMsg = [callStackSymbol substringWithRange:result.range];
-                
-                //get className
-                NSString *className = [tempCallStackSymbolMsg componentsSeparatedByString:@" "].firstObject;
-                className = [className componentsSeparatedByString:@"["].lastObject;
-                
-                NSBundle *bundle = [NSBundle bundleForClass:NSClassFromString(className)];
-                
-                //filter category and system class
-                if (![className hasSuffix:@")"] && bundle == [NSBundle mainBundle]) {
-                    mainCallStackSymbolMsg = tempCallStackSymbolMsg;
-                    
-                }
-                *stop = YES;
-            }
-        }];
-        
-        if (mainCallStackSymbolMsg.length) {
-            break;
-        }
-    }
-    
-    return mainCallStackSymbolMsg;
-}
-
-
-/**
- *  提示崩溃的信息(控制台输出、通知)
- *
- *  @param exception   捕获到的异常
- *  @param defaultToDo 这个框架里默认的做法
- */
-+ (void)noteErrorWithException:(NSException *)exception defaultToDo:(NSString *)defaultToDo {
-
-    //堆栈数据
-    NSArray *callStackSymbolsArr = [NSThread callStackSymbols];
-    
-    //获取在哪个类的哪个方法中实例化的数组  字符串格式 -[类名 方法名]  或者 +[类名 方法名]
-    NSString *mainCallStackSymbolMsg = [AvoidCrash getMainCallStackSymbolMessageWithCallStackSymbols:callStackSymbolsArr];
-    
-    if (mainCallStackSymbolMsg == nil) {
-        
-        mainCallStackSymbolMsg = @"崩溃方法定位失败,请您查看函数调用栈来排查错误原因";
-        
-    }
-    
-    NSString *errorName = exception.name;
-    NSString *errorReason = exception.reason;
-    //errorReason 可能为 -[__NSCFConstantString avoidCrashCharacterAtIndex:]: Range or index out of bounds
-    //将avoidCrash去掉
-    errorReason = [errorReason stringByReplacingOccurrencesOfString:@"avoidCrash" withString:@""];
-    
-    NSString *errorPlace = [NSString stringWithFormat:@"Error Place:%@",mainCallStackSymbolMsg];
-    
-    NSString *logErrorMessage = [NSString stringWithFormat:@"\n\n%@\n\n%@\n%@\n%@\n%@",AvoidCrashSeparatorWithFlag, errorName, errorReason, errorPlace, defaultToDo];
-    
-    logErrorMessage = [NSString stringWithFormat:@"%@\n\n%@\n\n",logErrorMessage,AvoidCrashSeparator];
-    AvoidCrashLog(@"%@",logErrorMessage);
-    
-    
-    //请忽略下面的赋值,目的只是为了能顺利上传到cocoapods
-    logErrorMessage = logErrorMessage;
-    
-    NSDictionary *errorInfoDic = @{
-                                   key_errorName        : errorName,
-                                   key_errorReason      : errorReason,
-                                   key_errorPlace       : errorPlace,
-                                   key_defaultToDo      : defaultToDo,
-                                   key_exception        : exception,
-                                   key_callStackSymbols : callStackSymbolsArr
-                                   };
-    
-    //将错误信息放在字典里,用通知的形式发送出去
-    dispatch_async(dispatch_get_main_queue(), ^{
-        [[NSNotificationCenter defaultCenter] postNotificationName:AvoidCrashNotification object:nil userInfo:errorInfoDic];
-    });
-}
-
-
-
-@end

+ 0 - 17
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/AvoidCrashProtocol.h

@@ -1,17 +0,0 @@
-//
-//  AvoidCrashProtocol.h
-//  https://github.com/chenfanfang/AvoidCrash
-//
-//  Created by chenfanfang on 2017/7/22.
-//  Copyright © 2017年 chenfanfang. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-
-@protocol AvoidCrashProtocol <NSObject>
-
-@required
-+ (void)avoidCrashExchangeMethod;
-
-@end

+ 0 - 37
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/AvoidCrashStubProxy.h

@@ -1,37 +0,0 @@
-//
-//  AvoidCrashStubProxy.h
-//  https://github.com/chenfanfang/AvoidCrash
-//
-//  Created by chenfanfang on 2017/7/25.
-//  Copyright © 2017年 chenfanfang. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-
-#define AvoidCrashNotification @"AvoidCrashNotification"
-#define AvoidCrashIsiOS(version) ([[UIDevice currentDevice].systemVersion floatValue] >= version)
-
-
-//user can ignore below define
-#define AvoidCrashDefaultReturnNil  @"AvoidCrash default is to return nil to avoid crash."
-#define AvoidCrashDefaultIgnore     @"AvoidCrash default is to ignore this operation to avoid crash."
-
-#define AvoidCrashSeparator         @"================================================================"
-#define AvoidCrashSeparatorWithFlag @"========================AvoidCrash Log=========================="
-
-
-#ifdef DEBUG
-
-#define  AvoidCrashLog(...) NSLog(@"%@",[NSString stringWithFormat:__VA_ARGS__])
-
-#else
-
-#define AvoidCrashLog(...)
-#endif
-
-@interface AvoidCrashStubProxy : NSObject
-
-- (void)proxyMethod;
-
-@end

+ 0 - 18
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/AvoidCrashStubProxy.m

@@ -1,18 +0,0 @@
-//
-//  AvoidCrashStubProxy.m
-//  https://github.com/chenfanfang/AvoidCrash
-//
-//  Created by chenfanfang on 2017/7/25.
-//  Copyright © 2017年 chenfanfang. All rights reserved.
-//
-
-#import "AvoidCrashStubProxy.h"
-
-
-@implementation AvoidCrashStubProxy
-
-- (void)proxyMethod {
-    
-}
-
-@end

+ 0 - 25
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSArray+AvoidCrash.h

@@ -1,25 +0,0 @@
-//
-//  NSArray+AvoidCrash.h
-//  https://github.com/chenfanfang/AvoidCrash
-//
-//  Created by mac on 16/9/21.
-//  Copyright © 2016年 chenfanfang. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import "AvoidCrashProtocol.h"
-
-@interface NSArray (AvoidCrash)<AvoidCrashProtocol>
-
-
-@end
-
-
-/**
- *  Can avoid crash method
- *
- *  1. NSArray的快速创建方式 NSArray *array = @[@"chenfanfang", @"AvoidCrash"];  //这种创建方式其实调用的是2中的方法
- *  2. +(instancetype)arrayWithObjects:(const id  _Nonnull __unsafe_unretained *)objects count:(NSUInteger)cnt
- *  3. - (id)objectAtIndex:(NSUInteger)index
- *  4. - (void)getObjects:(__unsafe_unretained id  _Nonnull *)objects range:(NSRange)range
- */    

+ 0 - 258
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSArray+AvoidCrash.m

@@ -1,258 +0,0 @@
-//
-//  NSArray+AvoidCrash.m
-//  https://github.com/chenfanfang/AvoidCrash
-//
-//  Created by mac on 16/9/21.
-//  Copyright © 2016年 chenfanfang. All rights reserved.
-//
-
-#import "NSArray+AvoidCrash.h"
-
-#import "AvoidCrash.h"
-
-@implementation NSArray (AvoidCrash)
-
-
-+ (void)avoidCrashExchangeMethod {
-    
-    static dispatch_once_t onceToken;
-    dispatch_once(&onceToken, ^{
-        //=================
-        //   class method
-        //=================
-        
-        //instance array method exchange
-        [AvoidCrash exchangeClassMethod:[self class] method1Sel:@selector(arrayWithObjects:count:) method2Sel:@selector(AvoidCrashArrayWithObjects:count:)];
-        
-        
-        
-        //====================
-        //   instance method
-        //====================
-        
-        Class __NSArray = NSClassFromString(@"NSArray");
-        Class __NSArrayI = NSClassFromString(@"__NSArrayI");
-        Class __NSSingleObjectArrayI = NSClassFromString(@"__NSSingleObjectArrayI");
-        Class __NSArray0 = NSClassFromString(@"__NSArray0");
-        
-        
-        //objectsAtIndexes:
-        [AvoidCrash exchangeInstanceMethod:__NSArray method1Sel:@selector(objectsAtIndexes:) method2Sel:@selector(avoidCrashObjectsAtIndexes:)];
-        
-        
-        //objectAtIndex:
-        
-        [AvoidCrash exchangeInstanceMethod:__NSArrayI method1Sel:@selector(objectAtIndex:) method2Sel:@selector(__NSArrayIAvoidCrashObjectAtIndex:)];
-        
-        [AvoidCrash exchangeInstanceMethod:__NSSingleObjectArrayI method1Sel:@selector(objectAtIndex:) method2Sel:@selector(__NSSingleObjectArrayIAvoidCrashObjectAtIndex:)];
-        
-        [AvoidCrash exchangeInstanceMethod:__NSArray0 method1Sel:@selector(objectAtIndex:) method2Sel:@selector(__NSArray0AvoidCrashObjectAtIndex:)];
-        
-        //objectAtIndexedSubscript:
-        if (AvoidCrashIsiOS(11.0)) {
-            [AvoidCrash exchangeInstanceMethod:__NSArrayI method1Sel:@selector(objectAtIndexedSubscript:) method2Sel:@selector(__NSArrayIAvoidCrashObjectAtIndexedSubscript:)];
-        }
-        
-        
-        //getObjects:range:
-        [AvoidCrash exchangeInstanceMethod:__NSArray method1Sel:@selector(getObjects:range:) method2Sel:@selector(NSArrayAvoidCrashGetObjects:range:)];
-        
-        [AvoidCrash exchangeInstanceMethod:__NSSingleObjectArrayI method1Sel:@selector(getObjects:range:) method2Sel:@selector(__NSSingleObjectArrayIAvoidCrashGetObjects:range:)];
-        
-        [AvoidCrash exchangeInstanceMethod:__NSArrayI method1Sel:@selector(getObjects:range:) method2Sel:@selector(__NSArrayIAvoidCrashGetObjects:range:)];
-    });
-    
-    
-}
-
-
-//=================================================================
-//                        instance array
-//=================================================================
-#pragma mark - instance array
-
-
-+ (instancetype)AvoidCrashArrayWithObjects:(const id  _Nonnull __unsafe_unretained *)objects count:(NSUInteger)cnt {
-    
-    id instance = nil;
-    
-    @try {
-        instance = [self AvoidCrashArrayWithObjects:objects count:cnt];
-    }
-    @catch (NSException *exception) {
-        
-        NSString *defaultToDo = @"AvoidCrash default is to remove nil object and instance a array.";
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-        
-        //以下是对错误数据的处理,把为nil的数据去掉,然后初始化数组
-        NSInteger newObjsIndex = 0;
-        id  _Nonnull __unsafe_unretained newObjects[cnt];
-        
-        for (int i = 0; i < cnt; i++) {
-            if (objects[i] != nil) {
-                newObjects[newObjsIndex] = objects[i];
-                newObjsIndex++;
-            }
-        }
-        instance = [self AvoidCrashArrayWithObjects:newObjects count:newObjsIndex];
-    }
-    @finally {
-        return instance;
-    }
-}
-
-
-
-//=================================================================
-//                     objectAtIndexedSubscript:
-//=================================================================
-#pragma mark - objectAtIndexedSubscript:
-- (id)__NSArrayIAvoidCrashObjectAtIndexedSubscript:(NSUInteger)idx {
-    id object = nil;
-    
-    @try {
-        object = [self __NSArrayIAvoidCrashObjectAtIndexedSubscript:idx];
-    }
-    @catch (NSException *exception) {
-        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-    }
-    @finally {
-        return object;
-    }
-
-}
-
-
-//=================================================================
-//                       objectsAtIndexes:
-//=================================================================
-#pragma mark - objectsAtIndexes:
-
-- (NSArray *)avoidCrashObjectsAtIndexes:(NSIndexSet *)indexes {
-    
-    NSArray *returnArray = nil;
-    @try {
-        returnArray = [self avoidCrashObjectsAtIndexes:indexes];
-    } @catch (NSException *exception) {
-        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-        
-    } @finally {
-        return returnArray;
-    }
-}
-
-
-//=================================================================
-//                         objectAtIndex:
-//=================================================================
-#pragma mark - objectAtIndex:
-
-//__NSArrayI  objectAtIndex:
-- (id)__NSArrayIAvoidCrashObjectAtIndex:(NSUInteger)index {
-    id object = nil;
-    
-    @try {
-        object = [self __NSArrayIAvoidCrashObjectAtIndex:index];
-    }
-    @catch (NSException *exception) {
-        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-    }
-    @finally {
-        return object;
-    }
-}
-
-
-
-//__NSSingleObjectArrayI objectAtIndex:
-- (id)__NSSingleObjectArrayIAvoidCrashObjectAtIndex:(NSUInteger)index {
-    id object = nil;
-    
-    @try {
-        object = [self __NSSingleObjectArrayIAvoidCrashObjectAtIndex:index];
-    }
-    @catch (NSException *exception) {
-        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-    }
-    @finally {
-        return object;
-    }
-}
-
-//__NSArray0 objectAtIndex:
-- (id)__NSArray0AvoidCrashObjectAtIndex:(NSUInteger)index {
-    id object = nil;
-    
-    @try {
-        object = [self __NSArray0AvoidCrashObjectAtIndex:index];
-    }
-    @catch (NSException *exception) {
-        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-    }
-    @finally {
-        return object;
-    }
-}
-
-
-//=================================================================
-//                           getObjects:range:
-//=================================================================
-#pragma mark - getObjects:range:
-
-//NSArray getObjects:range:
-- (void)NSArrayAvoidCrashGetObjects:(__unsafe_unretained id  _Nonnull *)objects range:(NSRange)range {
-    
-    @try {
-        [self NSArrayAvoidCrashGetObjects:objects range:range];
-    } @catch (NSException *exception) {
-        
-        NSString *defaultToDo = AvoidCrashDefaultIgnore;
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-        
-    } @finally {
-        
-    }
-}
-
-
-//__NSSingleObjectArrayI  getObjects:range:
-- (void)__NSSingleObjectArrayIAvoidCrashGetObjects:(__unsafe_unretained id  _Nonnull *)objects range:(NSRange)range {
-    
-    @try {
-        [self __NSSingleObjectArrayIAvoidCrashGetObjects:objects range:range];
-    } @catch (NSException *exception) {
-        
-        NSString *defaultToDo = AvoidCrashDefaultIgnore;
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-        
-    } @finally {
-        
-    }
-}
-
-
-//__NSArrayI  getObjects:range:
-- (void)__NSArrayIAvoidCrashGetObjects:(__unsafe_unretained id  _Nonnull *)objects range:(NSRange)range {
-    
-    @try {
-        [self __NSArrayIAvoidCrashGetObjects:objects range:range];
-    } @catch (NSException *exception) {
-        
-        NSString *defaultToDo = AvoidCrashDefaultIgnore;
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-        
-    } @finally {
-        
-    }
-}
-
-
-
-
-@end

+ 0 - 25
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSAttributedString+AvoidCrash.h

@@ -1,25 +0,0 @@
-//
-//  NSAttributedString+AvoidCrash.h
-//  https://github.com/chenfanfang/AvoidCrash
-//
-//  Created by mac on 16/10/15.
-//  Copyright © 2016年 chenfanfang. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import "AvoidCrashProtocol.h"
-
-@interface NSAttributedString (AvoidCrash)<AvoidCrashProtocol>
-
-
-@end
-
-/**
- *  Can avoid crash method
- *
- *  1.- (instancetype)initWithString:(NSString *)str
- *  2.- (instancetype)initWithAttributedString:(NSAttributedString *)attrStr
- *  3.- (instancetype)initWithString:(NSString *)str attributes:(NSDictionary<NSString *,id> *)attrs
- *
- *
- */

+ 0 - 96
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSAttributedString+AvoidCrash.m

@@ -1,96 +0,0 @@
-//
-//  NSAttributedString+AvoidCrash.m
-//  https://github.com/chenfanfang/AvoidCrash
-//
-//  Created by mac on 16/10/15.
-//  Copyright © 2016年 chenfanfang. All rights reserved.
-//
-
-#import "NSAttributedString+AvoidCrash.h"
-
-#import "AvoidCrash.h"
-
-@implementation NSAttributedString (AvoidCrash)
-
-+ (void)avoidCrashExchangeMethod {
-    
-    static dispatch_once_t onceToken;
-    dispatch_once(&onceToken, ^{
-        
-        Class NSConcreteAttributedString = NSClassFromString(@"NSConcreteAttributedString");
-        
-        //initWithString:
-        [AvoidCrash exchangeInstanceMethod:NSConcreteAttributedString method1Sel:@selector(initWithString:) method2Sel:@selector(avoidCrashInitWithString:)];
-        
-        //initWithAttributedString
-        [AvoidCrash exchangeInstanceMethod:NSConcreteAttributedString method1Sel:@selector(initWithAttributedString:) method2Sel:@selector(avoidCrashInitWithAttributedString:)];
-        
-        //initWithString:attributes:
-        [AvoidCrash exchangeInstanceMethod:NSConcreteAttributedString method1Sel:@selector(initWithString:attributes:) method2Sel:@selector(avoidCrashInitWithString:attributes:)];
-    });
-
-}
-
-//=================================================================
-//                           initWithString:
-//=================================================================
-#pragma mark - initWithString:
-
-- (instancetype)avoidCrashInitWithString:(NSString *)str {
-    id object = nil;
-    
-    @try {
-        object = [self avoidCrashInitWithString:str];
-    }
-    @catch (NSException *exception) {
-        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-    }
-    @finally {
-        return object;
-    }
-}
-
-
-//=================================================================
-//                          initWithAttributedString
-//=================================================================
-#pragma mark - initWithAttributedString
-
-- (instancetype)avoidCrashInitWithAttributedString:(NSAttributedString *)attrStr {
-    id object = nil;
-    
-    @try {
-        object = [self avoidCrashInitWithAttributedString:attrStr];
-    }
-    @catch (NSException *exception) {
-        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-    }
-    @finally {
-        return object;
-    }
-}
-
-
-//=================================================================
-//                      initWithString:attributes:
-//=================================================================
-#pragma mark - initWithString:attributes:
-
-- (instancetype)avoidCrashInitWithString:(NSString *)str attributes:(NSDictionary<NSString *,id> *)attrs {
-    id object = nil;
-    
-    @try {
-        object = [self avoidCrashInitWithString:str attributes:attrs];
-    }
-    @catch (NSException *exception) {
-        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-    }
-    @finally {
-        return object;
-    }
-}
-
-@end

+ 0 - 24
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSDictionary+AvoidCrash.h

@@ -1,24 +0,0 @@
-//
-//  NSDictionary+AvoidCrash.h
-//  https://github.com/chenfanfang/AvoidCrash
-//
-//  Created by mac on 16/9/21.
-//  Copyright © 2016年 chenfanfang. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import "AvoidCrashProtocol.h"
-
-@interface NSDictionary (AvoidCrash)<AvoidCrashProtocol>
-
-
-@end
-
-
-/**
- *  Can avoid crash method
- *
- *  1. NSDictionary的快速创建方式 NSDictionary *dict = @{@"frameWork" : @"AvoidCrash"}; //这种创建方式其实调用的是2中的方法
- *  2. +(instancetype)dictionaryWithObjects:(const id  _Nonnull __unsafe_unretained *)objects forKeys:(const id<NSCopying>  _Nonnull __unsafe_unretained *)keys count:(NSUInteger)cnt
- *
- */

+ 0 - 56
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSDictionary+AvoidCrash.m

@@ -1,56 +0,0 @@
-//
-//  NSDictionary+AvoidCrash.m
-//  https://github.com/chenfanfang/AvoidCrash
-//
-//  Created by mac on 16/9/21.
-//  Copyright © 2016年 chenfanfang. All rights reserved.
-//
-
-#import "NSDictionary+AvoidCrash.h"
-
-#import "AvoidCrash.h"
-
-@implementation NSDictionary (AvoidCrash)
-
-+ (void)avoidCrashExchangeMethod {
-    
-    static dispatch_once_t onceToken;
-    dispatch_once(&onceToken, ^{
-        
-        [AvoidCrash exchangeClassMethod:self method1Sel:@selector(dictionaryWithObjects:forKeys:count:) method2Sel:@selector(avoidCrashDictionaryWithObjects:forKeys:count:)];
-    });
-}
-
-
-+ (instancetype)avoidCrashDictionaryWithObjects:(const id  _Nonnull __unsafe_unretained *)objects forKeys:(const id<NSCopying>  _Nonnull __unsafe_unretained *)keys count:(NSUInteger)cnt {
-    
-    id instance = nil;
-    
-    @try {
-        instance = [self avoidCrashDictionaryWithObjects:objects forKeys:keys count:cnt];
-    }
-    @catch (NSException *exception) {
-        
-        NSString *defaultToDo = @"AvoidCrash default is to remove nil key-values and instance a dictionary.";
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-        
-        //处理错误的数据,然后重新初始化一个字典
-        NSUInteger index = 0;
-        id  _Nonnull __unsafe_unretained newObjects[cnt];
-        id  _Nonnull __unsafe_unretained newkeys[cnt];
-        
-        for (int i = 0; i < cnt; i++) {
-            if (objects[i] && keys[i]) {
-                newObjects[index] = objects[i];
-                newkeys[index] = keys[i];
-                index++;
-            }
-        }
-        instance = [self avoidCrashDictionaryWithObjects:newObjects forKeys:newkeys count:index];
-    }
-    @finally {
-        return instance;
-    }
-}
-
-@end

+ 0 - 26
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSMutableArray+AvoidCrash.h

@@ -1,26 +0,0 @@
-//
-//  NSMutableArray+AvoidCrash.h
-//  https://github.com/chenfanfang/AvoidCrash
-//
-//  Created by mac on 16/9/21.
-//  Copyright © 2016年 chenfanfang. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import "AvoidCrashProtocol.h"
-
-@interface NSMutableArray (AvoidCrash)<AvoidCrashProtocol>
-
-
-@end
-
-
-/**
- *  Can avoid crash method
- *
- *  1. - (id)objectAtIndex:(NSUInteger)index
- *  2. - (void)setObject:(id)obj atIndexedSubscript:(NSUInteger)idx
- *  3. - (void)removeObjectAtIndex:(NSUInteger)index
- *  4. - (void)insertObject:(id)anObject atIndex:(NSUInteger)index
- *  5. - (void)getObjects:(__unsafe_unretained id  _Nonnull *)objects range:(NSRange)range
- */

+ 0 - 169
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSMutableArray+AvoidCrash.m

@@ -1,169 +0,0 @@
-//
-//  NSMutableArray+AvoidCrash.m
-//  https://github.com/chenfanfang/AvoidCrash
-//
-//  Created by mac on 16/9/21.
-//  Copyright © 2016年 chenfanfang. All rights reserved.
-//
-
-#import "NSMutableArray+AvoidCrash.h"
-
-#import "AvoidCrash.h"
-
-@implementation NSMutableArray (AvoidCrash)
-
-+ (void)avoidCrashExchangeMethod {
-    
-    static dispatch_once_t onceToken;
-    dispatch_once(&onceToken, ^{
-        
-        Class arrayMClass = NSClassFromString(@"__NSArrayM");
-        
-        
-        //objectAtIndex:
-        [AvoidCrash exchangeInstanceMethod:arrayMClass method1Sel:@selector(objectAtIndex:) method2Sel:@selector(avoidCrashObjectAtIndex:)];
-        
-        //objectAtIndexedSubscript
-        if (AvoidCrashIsiOS(11.0)) {
-            [AvoidCrash exchangeInstanceMethod:arrayMClass method1Sel:@selector(objectAtIndexedSubscript:) method2Sel:@selector(avoidCrashObjectAtIndexedSubscript:)];
-        }
-        
-        
-        //setObject:atIndexedSubscript:
-        [AvoidCrash exchangeInstanceMethod:arrayMClass method1Sel:@selector(setObject:atIndexedSubscript:) method2Sel:@selector(avoidCrashSetObject:atIndexedSubscript:)];
-        
-        
-        //removeObjectAtIndex:
-        [AvoidCrash exchangeInstanceMethod:arrayMClass method1Sel:@selector(removeObjectAtIndex:) method2Sel:@selector(avoidCrashRemoveObjectAtIndex:)];
-        
-        //insertObject:atIndex:
-        [AvoidCrash exchangeInstanceMethod:arrayMClass method1Sel:@selector(insertObject:atIndex:) method2Sel:@selector(avoidCrashInsertObject:atIndex:)];
-        
-        //getObjects:range:
-        [AvoidCrash exchangeInstanceMethod:arrayMClass method1Sel:@selector(getObjects:range:) method2Sel:@selector(avoidCrashGetObjects:range:)];
-    });
-    
-    
-    
-}
-
-
-//=================================================================
-//                    array set object at index
-//=================================================================
-#pragma mark - get object from array
-
-
-- (void)avoidCrashSetObject:(id)obj atIndexedSubscript:(NSUInteger)idx {
-    
-    @try {
-        [self avoidCrashSetObject:obj atIndexedSubscript:idx];
-    }
-    @catch (NSException *exception) {
-        [AvoidCrash noteErrorWithException:exception defaultToDo:AvoidCrashDefaultIgnore];
-    }
-    @finally {
-        
-    }
-}
-
-
-//=================================================================
-//                    removeObjectAtIndex:
-//=================================================================
-#pragma mark - removeObjectAtIndex:
-
-- (void)avoidCrashRemoveObjectAtIndex:(NSUInteger)index {
-    @try {
-        [self avoidCrashRemoveObjectAtIndex:index];
-    }
-    @catch (NSException *exception) {
-        [AvoidCrash noteErrorWithException:exception defaultToDo:AvoidCrashDefaultIgnore];
-    }
-    @finally {
-        
-    }
-}
-
-
-//=================================================================
-//                    insertObject:atIndex:
-//=================================================================
-#pragma mark - set方法
-- (void)avoidCrashInsertObject:(id)anObject atIndex:(NSUInteger)index {
-    @try {
-        [self avoidCrashInsertObject:anObject atIndex:index];
-    }
-    @catch (NSException *exception) {
-        [AvoidCrash noteErrorWithException:exception defaultToDo:AvoidCrashDefaultIgnore];
-    }
-    @finally {
-        
-    }
-}
-
-
-//=================================================================
-//                           objectAtIndex:
-//=================================================================
-#pragma mark - objectAtIndex:
-
-- (id)avoidCrashObjectAtIndex:(NSUInteger)index {
-    id object = nil;
-    
-    @try {
-        object = [self avoidCrashObjectAtIndex:index];
-    }
-    @catch (NSException *exception) {
-        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-    }
-    @finally {
-        return object;
-    }
-}
-
-//=================================================================
-//                     objectAtIndexedSubscript:
-//=================================================================
-#pragma mark - objectAtIndexedSubscript:
-- (id)avoidCrashObjectAtIndexedSubscript:(NSUInteger)idx {
-    id object = nil;
-    
-    @try {
-        object = [self avoidCrashObjectAtIndexedSubscript:idx];
-    }
-    @catch (NSException *exception) {
-        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-    }
-    @finally {
-        return object;
-    }
-    
-}
-
-
-//=================================================================
-//                         getObjects:range:
-//=================================================================
-#pragma mark - getObjects:range:
-
-- (void)avoidCrashGetObjects:(__unsafe_unretained id  _Nonnull *)objects range:(NSRange)range {
-    
-    @try {
-        [self avoidCrashGetObjects:objects range:range];
-    } @catch (NSException *exception) {
-        
-        NSString *defaultToDo = AvoidCrashDefaultIgnore;
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-        
-    } @finally {
-        
-    }
-}
-
-
-
-
-@end

+ 0 - 23
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSMutableAttributedString+AvoidCrash.h

@@ -1,23 +0,0 @@
-//
-//  NSMutableAttributedString+AvoidCrash.h
-//  https://github.com/chenfanfang/AvoidCrash
-//
-//  Created by mac on 16/10/15.
-//  Copyright © 2016年 chenfanfang. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import "AvoidCrashProtocol.h"
-
-@interface NSMutableAttributedString (AvoidCrash)<AvoidCrashProtocol>
-
-
-@end
-
-
-/**
- *  Can avoid crash method
- *
- *  1.- (instancetype)initWithString:(NSString *)str
- *  2.- (instancetype)initWithString:(NSString *)str attributes:(NSDictionary<NSString *,id> *)attrs
- */

+ 0 - 74
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSMutableAttributedString+AvoidCrash.m

@@ -1,74 +0,0 @@
-//
-//  NSMutableAttributedString+AvoidCrash.m
-//  https://github.com/chenfanfang/AvoidCrash
-//
-//  Created by mac on 16/10/15.
-//  Copyright © 2016年 chenfanfang. All rights reserved.
-//
-
-#import "NSMutableAttributedString+AvoidCrash.h"
-
-#import "AvoidCrash.h"
-
-@implementation NSMutableAttributedString (AvoidCrash)
-
-+ (void)avoidCrashExchangeMethod {
-    
-    static dispatch_once_t onceToken;
-    dispatch_once(&onceToken, ^{
-        
-        Class NSConcreteMutableAttributedString = NSClassFromString(@"NSConcreteMutableAttributedString");
-        
-        //initWithString:
-        [AvoidCrash exchangeInstanceMethod:NSConcreteMutableAttributedString method1Sel:@selector(initWithString:) method2Sel:@selector(avoidCrashInitWithString:)];
-        
-        //initWithString:attributes:
-        [AvoidCrash exchangeInstanceMethod:NSConcreteMutableAttributedString method1Sel:@selector(initWithString:attributes:) method2Sel:@selector(avoidCrashInitWithString:attributes:)];
-    });
-}
-
-//=================================================================
-//                          initWithString:
-//=================================================================
-#pragma mark - initWithString:
-
-
-- (instancetype)avoidCrashInitWithString:(NSString *)str {
-    id object = nil;
-    
-    @try {
-        object = [self avoidCrashInitWithString:str];
-    }
-    @catch (NSException *exception) {
-        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-    }
-    @finally {
-        return object;
-    }
-}
-
-
-//=================================================================
-//                     initWithString:attributes:
-//=================================================================
-#pragma mark - initWithString:attributes:
-
-
-- (instancetype)avoidCrashInitWithString:(NSString *)str attributes:(NSDictionary<NSString *,id> *)attrs {
-    id object = nil;
-    
-    @try {
-        object = [self avoidCrashInitWithString:str attributes:attrs];
-    }
-    @catch (NSException *exception) {
-        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-    }
-    @finally {
-        return object;
-    }
-}
-
-
-@end

+ 0 - 24
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSMutableDictionary+AvoidCrash.h

@@ -1,24 +0,0 @@
-//
-//  NSMutableDictionary+AvoidCrash.h
-//  https://github.com/chenfanfang/AvoidCrash
-//
-//  Created by mac on 16/9/22.
-//  Copyright © 2016年 chenfanfang. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import "AvoidCrashProtocol.h"
-
-@interface NSMutableDictionary (AvoidCrash)<AvoidCrashProtocol>
-
-
-@end
-
-
-/**
- *  Can avoid crash method
- *
- *  1. - (void)setObject:(id)anObject forKey:(id<NSCopying>)aKey
- *  2. - (void)removeObjectForKey:(id)aKey
- *
- */

+ 0 - 95
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSMutableDictionary+AvoidCrash.m

@@ -1,95 +0,0 @@
-//
-//  NSMutableDictionary+AvoidCrash.m
-//  https://github.com/chenfanfang/AvoidCrash
-//
-//  Created by mac on 16/9/22.
-//  Copyright © 2016年 chenfanfang. All rights reserved.
-//
-
-#import "NSMutableDictionary+AvoidCrash.h"
-
-#import "AvoidCrash.h"
-
-@implementation NSMutableDictionary (AvoidCrash)
-
-+ (void)avoidCrashExchangeMethod {
-    
-    static dispatch_once_t onceToken;
-    dispatch_once(&onceToken, ^{
-        Class dictionaryM = NSClassFromString(@"__NSDictionaryM");
-        
-        //setObject:forKey:
-        [AvoidCrash exchangeInstanceMethod:dictionaryM method1Sel:@selector(setObject:forKey:) method2Sel:@selector(avoidCrashSetObject:forKey:)];
-        
-        //setObject:forKeyedSubscript:
-        if (AvoidCrashIsiOS(11.0)) {
-            [AvoidCrash exchangeInstanceMethod:dictionaryM method1Sel:@selector(setObject:forKeyedSubscript:) method2Sel:@selector(avoidCrashSetObject:forKeyedSubscript:)];
-        }
-        
-        
-        
-        //removeObjectForKey:
-        Method removeObjectForKey = class_getInstanceMethod(dictionaryM, @selector(removeObjectForKey:));
-        Method avoidCrashRemoveObjectForKey = class_getInstanceMethod(dictionaryM, @selector(avoidCrashRemoveObjectForKey:));
-        method_exchangeImplementations(removeObjectForKey, avoidCrashRemoveObjectForKey);
-    });
-}
-
-
-//=================================================================
-//                       setObject:forKey:
-//=================================================================
-#pragma mark - setObject:forKey:
-
-- (void)avoidCrashSetObject:(id)anObject forKey:(id<NSCopying>)aKey {
-    
-    @try {
-        [self avoidCrashSetObject:anObject forKey:aKey];
-    }
-    @catch (NSException *exception) {
-        [AvoidCrash noteErrorWithException:exception defaultToDo:AvoidCrashDefaultIgnore];
-    }
-    @finally {
-        
-    }
-}
-
-//=================================================================
-//                  setObject:forKeyedSubscript:
-//=================================================================
-#pragma mark - setObject:forKeyedSubscript:
-- (void)avoidCrashSetObject:(id)obj forKeyedSubscript:(id<NSCopying>)key {
-    @try {
-        [self avoidCrashSetObject:obj forKeyedSubscript:key];
-    }
-    @catch (NSException *exception) {
-        [AvoidCrash noteErrorWithException:exception defaultToDo:AvoidCrashDefaultIgnore];
-    }
-    @finally {
-        
-    }
-}
-
-
-//=================================================================
-//                       removeObjectForKey:
-//=================================================================
-#pragma mark - removeObjectForKey:
-
-- (void)avoidCrashRemoveObjectForKey:(id)aKey {
-    
-    @try {
-        [self avoidCrashRemoveObjectForKey:aKey];
-    }
-    @catch (NSException *exception) {
-        [AvoidCrash noteErrorWithException:exception defaultToDo:AvoidCrashDefaultIgnore];
-    }
-    @finally {
-        
-    }
-}
-
-
-
-
-@end

+ 0 - 29
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSMutableString+AvoidCrash.h

@@ -1,29 +0,0 @@
-//
-//  NSMutableString+AvoidCrash.h
-//  https://github.com/chenfanfang/AvoidCrash
-//
-//  Created by mac on 16/10/6.
-//  Copyright © 2016年 chenfanfang. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import "AvoidCrashProtocol.h"
-
-@interface NSMutableString (AvoidCrash)<AvoidCrashProtocol>
-
-
-@end
-
-
-/**
- *  Can avoid crash method
- *
- *  1. 由于NSMutableString是继承于NSString,所以这里和NSString有些同样的方法就不重复写了
- *  2. - (void)replaceCharactersInRange:(NSRange)range withString:(NSString *)aString
- *  3. - (void)insertString:(NSString *)aString atIndex:(NSUInteger)loc
- *  4. - (void)deleteCharactersInRange:(NSRange)range
- *
- */
-
-
-

+ 0 - 97
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSMutableString+AvoidCrash.m

@@ -1,97 +0,0 @@
-//
-//  NSMutableString+AvoidCrash.m
-//  https://github.com/chenfanfang/AvoidCrash
-//
-//  Created by mac on 16/10/6.
-//  Copyright © 2016年 chenfanfang. All rights reserved.
-//
-
-#import "NSMutableString+AvoidCrash.h"
-
-#import "AvoidCrash.h"
-
-@implementation NSMutableString (AvoidCrash)
-
-+ (void)avoidCrashExchangeMethod {
-    
-    static dispatch_once_t onceToken;
-    dispatch_once(&onceToken, ^{
-        
-        Class stringClass = NSClassFromString(@"__NSCFString");
-        
-        //replaceCharactersInRange
-        [AvoidCrash exchangeInstanceMethod:stringClass method1Sel:@selector(replaceCharactersInRange:withString:) method2Sel:@selector(avoidCrashReplaceCharactersInRange:withString:)];
-        
-        //insertString:atIndex:
-        [AvoidCrash exchangeInstanceMethod:stringClass method1Sel:@selector(insertString:atIndex:) method2Sel:@selector(avoidCrashInsertString:atIndex:)];
-        
-        //deleteCharactersInRange
-        [AvoidCrash exchangeInstanceMethod:stringClass method1Sel:@selector(deleteCharactersInRange:) method2Sel:@selector(avoidCrashDeleteCharactersInRange:)];
-    });
-}
-
-//=================================================================
-//                     replaceCharactersInRange
-//=================================================================
-#pragma mark - replaceCharactersInRange
-
-- (void)avoidCrashReplaceCharactersInRange:(NSRange)range withString:(NSString *)aString {
-    
-    @try {
-        [self avoidCrashReplaceCharactersInRange:range withString:aString];
-    }
-    @catch (NSException *exception) {
-        NSString *defaultToDo = AvoidCrashDefaultIgnore;
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-    }
-    @finally {
-        
-    }
-}
-
-//=================================================================
-//                     insertString:atIndex:
-//=================================================================
-#pragma mark - insertString:atIndex:
-
-- (void)avoidCrashInsertString:(NSString *)aString atIndex:(NSUInteger)loc {
-    
-    @try {
-        [self avoidCrashInsertString:aString atIndex:loc];
-    }
-    @catch (NSException *exception) {
-        NSString *defaultToDo = AvoidCrashDefaultIgnore;
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-    }
-    @finally {
-        
-    }
-}
-
-//=================================================================
-//                   deleteCharactersInRange
-//=================================================================
-#pragma mark - deleteCharactersInRange
-
-- (void)avoidCrashDeleteCharactersInRange:(NSRange)range {
-    
-    @try {
-        [self avoidCrashDeleteCharactersInRange:range];
-    }
-    @catch (NSException *exception) {
-        NSString *defaultToDo = AvoidCrashDefaultIgnore;
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-    }
-    @finally {
-        
-    }
-}
-
-
-
-
-
-
-
-
-@end

+ 0 - 34
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSObject+AvoidCrash.h

@@ -1,34 +0,0 @@
-//
-//  NSObject+AvoidCrash.h
-//  https://github.com/chenfanfang/AvoidCrash
-//
-//  Created by mac on 16/10/11.
-//  Copyright © 2016年 chenfanfang. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-
-@interface NSObject (AvoidCrash)
-
-/** 
- *  ifDealWithNoneSel : 是否开启"unrecognized selector sent to instance"异常的捕获
- */
-+ (void)avoidCrashExchangeMethodIfDealWithNoneSel:(BOOL)ifDealWithNoneSel;
-
-
-+ (void)setupNoneSelClassStringsArr:(NSArray<NSString *> *)classStrings;
-
-+ (void)setupNoneSelClassStringPrefixsArr:(NSArray<NSString *> *)classStringPrefixs;
-
-@end
-
-/**
- *  Can avoid crash method
- *
- *  1.- (void)setValue:(id)value forKey:(NSString *)key
- *  2.- (void)setValue:(id)value forKeyPath:(NSString *)keyPath
- *  3.- (void)setValue:(id)value forUndefinedKey:(NSString *)key //这个方法一般用来重写,不会主动调用
- *  4.- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues
- *  5. unrecognized selector sent to instance
- */

+ 0 - 221
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSObject+AvoidCrash.m

@@ -1,221 +0,0 @@
-//
-//  NSObject+AvoidCrash.m
-//  https://github.com/chenfanfang/AvoidCrash
-//
-//  Created by mac on 16/10/11.
-//  Copyright © 2016年 chenfanfang. All rights reserved.
-//
-
-#import "NSObject+AvoidCrash.h"
-#import "AvoidCrash.h"
-#import "AvoidCrashStubProxy.h"
-
-@implementation NSObject (AvoidCrash)
-
-
-+ (void)avoidCrashExchangeMethodIfDealWithNoneSel:(BOOL)ifDealWithNoneSel {
-    
-    static dispatch_once_t onceToken;
-    dispatch_once(&onceToken, ^{
-        //setValue:forKey:
-        [AvoidCrash exchangeInstanceMethod:[self class] method1Sel:@selector(setValue:forKey:) method2Sel:@selector(avoidCrashSetValue:forKey:)];
-        
-        //setValue:forKeyPath:
-        [AvoidCrash exchangeInstanceMethod:[self class] method1Sel:@selector(setValue:forKeyPath:) method2Sel:@selector(avoidCrashSetValue:forKeyPath:)];
-        
-        //setValue:forUndefinedKey:
-        [AvoidCrash exchangeInstanceMethod:[self class] method1Sel:@selector(setValue:forUndefinedKey:) method2Sel:@selector(avoidCrashSetValue:forUndefinedKey:)];
-        
-        //setValuesForKeysWithDictionary:
-        [AvoidCrash exchangeInstanceMethod:[self class] method1Sel:@selector(setValuesForKeysWithDictionary:) method2Sel:@selector(avoidCrashSetValuesForKeysWithDictionary:)];
-        
-        
-        //unrecognized selector sent to instance
-        if (ifDealWithNoneSel) {
-            [AvoidCrash exchangeInstanceMethod:[self class] method1Sel:@selector(methodSignatureForSelector:) method2Sel:@selector(avoidCrashMethodSignatureForSelector:)];
-            [AvoidCrash exchangeInstanceMethod:[self class] method1Sel:@selector(forwardInvocation:) method2Sel:@selector(avoidCrashForwardInvocation:)];
-        }
-    });
-}
-
-
-//=================================================================
-//              unrecognized selector sent to instance
-//=================================================================
-#pragma mark - unrecognized selector sent to instance
-
-
-static NSMutableArray *noneSelClassStrings;
-static NSMutableArray *noneSelClassStringPrefixs;
-
-+ (void)setupNoneSelClassStringsArr:(NSArray<NSString *> *)classStrings {
-    
-    if (noneSelClassStrings) {
-        
-        NSString *warningMsg = [NSString stringWithFormat:@"\n\n%@\n\n[AvoidCrash setupNoneSelClassStringsArr:];\n调用一此即可,多次调用会自动忽略后面的调用\n\n%@\n\n",AvoidCrashSeparatorWithFlag,AvoidCrashSeparator];
-        AvoidCrashLog(@"%@",warningMsg);
-    }
-    
-    static dispatch_once_t onceToken;
-    dispatch_once(&onceToken, ^{
-        noneSelClassStrings = [NSMutableArray array];
-        for (NSString *className in classStrings) {
-            if ([className hasPrefix:@"UI"] == NO &&
-                [className isEqualToString:NSStringFromClass([NSObject class])] == NO) {
-                [noneSelClassStrings addObject:className];
-                
-            } else {
-                NSString *warningMsg = [NSString stringWithFormat:@"\n\n%@\n\n[AvoidCrash setupNoneSelClassStringsArr:];\n会忽略UI开头的类和NSObject类(请使用NSObject的子类)\n\n%@\n\n",AvoidCrashSeparatorWithFlag,AvoidCrashSeparator];
-                AvoidCrashLog(@"%@",warningMsg);
-            }
-        }
-    });
-}
-
-/**
- *  初始化一个需要防止”unrecognized selector sent to instance”的崩溃的类名前缀的数组
- */
-+ (void)setupNoneSelClassStringPrefixsArr:(NSArray<NSString *> *)classStringPrefixs {
-    if (noneSelClassStringPrefixs) {
-        
-        NSString *warningMsg = [NSString stringWithFormat:@"\n\n%@\n\n[AvoidCrash setupNoneSelClassStringPrefixsArr:];\n调用一此即可,多次调用会自动忽略后面的调用\n\n%@\n\n",AvoidCrashSeparatorWithFlag,AvoidCrashSeparator];
-        AvoidCrashLog(@"%@",warningMsg);
-    }
-    
-    static dispatch_once_t onceToken;
-    dispatch_once(&onceToken, ^{
-        
-        noneSelClassStringPrefixs = [NSMutableArray array];
-        for (NSString *classNamePrefix in classStringPrefixs) {
-            if ([classNamePrefix hasPrefix:@"UI"] == NO &&
-                [classNamePrefix hasPrefix:@"NS"] == NO) {
-                [noneSelClassStringPrefixs addObject:classNamePrefix];
-                
-            } else {
-                NSString *warningMsg = [NSString stringWithFormat:@"\n\n%@\n\n[AvoidCrash setupNoneSelClassStringsArr:];\n会忽略UI开头的类和NS开头的类\n若需要对NS开头的类防止”unrecognized selector sent to instance”(比如NSArray),请使用setupNoneSelClassStringsArr:\n\n%@\n\n",AvoidCrashSeparatorWithFlag,AvoidCrashSeparator];
-                AvoidCrashLog(@"%@",warningMsg);
-            }
-        }
-    });
-}
-
-- (NSMethodSignature *)avoidCrashMethodSignatureForSelector:(SEL)aSelector {
-    
-    NSMethodSignature *ms = [self avoidCrashMethodSignatureForSelector:aSelector];
-    
-    BOOL flag = NO;
-    if (ms == nil) {
-        for (NSString *classStr in noneSelClassStrings) {
-            if ([self isKindOfClass:NSClassFromString(classStr)]) {
-                ms = [AvoidCrashStubProxy instanceMethodSignatureForSelector:@selector(proxyMethod)];
-                flag = YES;
-                break;
-            }
-        }
-    }
-    if (flag == NO) {
-        NSString *selfClass = NSStringFromClass([self class]);
-        for (NSString *classStrPrefix in noneSelClassStringPrefixs) {
-            if ([selfClass hasPrefix:classStrPrefix]) {
-                ms = [AvoidCrashStubProxy instanceMethodSignatureForSelector:@selector(proxyMethod)];
-            }
-        }
-    }
-    return ms;
-}
-
-- (void)avoidCrashForwardInvocation:(NSInvocation *)anInvocation {
-    
-    @try {
-        [self avoidCrashForwardInvocation:anInvocation];
-        
-    } @catch (NSException *exception) {
-        NSString *defaultToDo = AvoidCrashDefaultIgnore;
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-        
-    } @finally {
-        
-    }
-    
-}
-
-
-//=================================================================
-//                         setValue:forKey:
-//=================================================================
-#pragma mark - setValue:forKey:
-
-- (void)avoidCrashSetValue:(id)value forKey:(NSString *)key {
-    @try {
-        [self avoidCrashSetValue:value forKey:key];
-    }
-    @catch (NSException *exception) {
-        NSString *defaultToDo = AvoidCrashDefaultIgnore;
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-    }
-    @finally {
-        
-    }
-}
-
-
-//=================================================================
-//                     setValue:forKeyPath:
-//=================================================================
-#pragma mark - setValue:forKeyPath:
-
-- (void)avoidCrashSetValue:(id)value forKeyPath:(NSString *)keyPath {
-    @try {
-        [self avoidCrashSetValue:value forKeyPath:keyPath];
-    }
-    @catch (NSException *exception) {
-        NSString *defaultToDo = AvoidCrashDefaultIgnore;
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-    }
-    @finally {
-        
-    }
-}
-
-
-
-//=================================================================
-//                     setValue:forUndefinedKey:
-//=================================================================
-#pragma mark - setValue:forUndefinedKey:
-
-- (void)avoidCrashSetValue:(id)value forUndefinedKey:(NSString *)key {
-    @try {
-        [self avoidCrashSetValue:value forUndefinedKey:key];
-    }
-    @catch (NSException *exception) {
-        NSString *defaultToDo = AvoidCrashDefaultIgnore;
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-    }
-    @finally {
-        
-    }
-}
-
-
-//=================================================================
-//                  setValuesForKeysWithDictionary:
-//=================================================================
-#pragma mark - setValuesForKeysWithDictionary:
-
-- (void)avoidCrashSetValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues {
-    @try {
-        [self avoidCrashSetValuesForKeysWithDictionary:keyedValues];
-    }
-    @catch (NSException *exception) {
-        NSString *defaultToDo = AvoidCrashDefaultIgnore;
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-    }
-    @finally {
-        
-    }
-}
-
-
-
-@end

+ 0 - 29
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSString+AvoidCrash.h

@@ -1,29 +0,0 @@
-//
-//  NSString+AvoidCrash.h
-//  https://github.com/chenfanfang/AvoidCrash
-//
-//  Created by mac on 16/10/5.
-//  Copyright © 2016年 chenfanfang. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import "AvoidCrashProtocol.h"
-
-@interface NSString (AvoidCrash)<AvoidCrashProtocol>
-
-
-@end
-
-
-/**
- *  Can avoid crash method
- *
- *  1. - (unichar)characterAtIndex:(NSUInteger)index
- *  2. - (NSString *)substringFromIndex:(NSUInteger)from
- *  3. - (NSString *)substringToIndex:(NSUInteger)to {
- *  4. - (NSString *)substringWithRange:(NSRange)range {
- *  5. - (NSString *)stringByReplacingOccurrencesOfString:(NSString *)target withString:(NSString *)replacement
- *  6. - (NSString *)stringByReplacingOccurrencesOfString:(NSString *)target withString:(NSString *)replacement options:(NSStringCompareOptions)options range:(NSRange)searchRange
- *  7. - (NSString *)stringByReplacingCharactersInRange:(NSRange)range withString:(NSString *)replacement
- *
- */

+ 0 - 204
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSString+AvoidCrash.m

@@ -1,204 +0,0 @@
-//
-//  NSString+AvoidCrash.m
-//  https://github.com/chenfanfang/AvoidCrash
-//
-//  Created by mac on 16/10/5.
-//  Copyright © 2016年 chenfanfang. All rights reserved.
-//
-
-#import "NSString+AvoidCrash.h"
-
-#import "AvoidCrash.h"
-
-@implementation NSString (AvoidCrash)
-
-+ (void)avoidCrashExchangeMethod {
-    
-    static dispatch_once_t onceToken;
-    dispatch_once(&onceToken, ^{
-        Class stringClass = NSClassFromString(@"__NSCFConstantString");
-        
-        //characterAtIndex
-        [AvoidCrash exchangeInstanceMethod:stringClass method1Sel:@selector(characterAtIndex:) method2Sel:@selector(avoidCrashCharacterAtIndex:)];
-        
-        //substringFromIndex
-        [AvoidCrash exchangeInstanceMethod:stringClass method1Sel:@selector(substringFromIndex:) method2Sel:@selector(avoidCrashSubstringFromIndex:)];
-        
-        //substringToIndex
-        [AvoidCrash exchangeInstanceMethod:stringClass method1Sel:@selector(substringToIndex:) method2Sel:@selector(avoidCrashSubstringToIndex:)];
-        
-        //substringWithRange:
-        [AvoidCrash exchangeInstanceMethod:stringClass method1Sel:@selector(substringWithRange:) method2Sel:@selector(avoidCrashSubstringWithRange:)];
-        
-        //stringByReplacingOccurrencesOfString:
-        [AvoidCrash exchangeInstanceMethod:stringClass method1Sel:@selector(stringByReplacingOccurrencesOfString:withString:) method2Sel:@selector(avoidCrashStringByReplacingOccurrencesOfString:withString:)];
-        
-        //stringByReplacingOccurrencesOfString:withString:options:range:
-        [AvoidCrash exchangeInstanceMethod:stringClass method1Sel:@selector(stringByReplacingOccurrencesOfString:withString:options:range:) method2Sel:@selector(avoidCrashStringByReplacingOccurrencesOfString:withString:options:range:)];
-        
-        //stringByReplacingCharactersInRange:withString:
-        [AvoidCrash exchangeInstanceMethod:stringClass method1Sel:@selector(stringByReplacingCharactersInRange:withString:) method2Sel:@selector(avoidCrashStringByReplacingCharactersInRange:withString:)];
-    });
-    
-}
-
-
-//=================================================================
-//                           characterAtIndex:
-//=================================================================
-#pragma mark - characterAtIndex:
-
-- (unichar)avoidCrashCharacterAtIndex:(NSUInteger)index {
-    
-    unichar characteristic;
-    @try {
-        characteristic = [self avoidCrashCharacterAtIndex:index];
-    }
-    @catch (NSException *exception) {
-        
-        NSString *defaultToDo = @"AvoidCrash default is to return a without assign unichar.";
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-    }
-    @finally {
-        return characteristic;
-    }
-}
-
-//=================================================================
-//                           substringFromIndex:
-//=================================================================
-#pragma mark - substringFromIndex:
-
-- (NSString *)avoidCrashSubstringFromIndex:(NSUInteger)from {
-    
-    NSString *subString = nil;
-    
-    @try {
-        subString = [self avoidCrashSubstringFromIndex:from];
-    }
-    @catch (NSException *exception) {
-        
-        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-        subString = nil;
-    }
-    @finally {
-        return subString;
-    }
-}
-
-//=================================================================
-//                           substringToIndex
-//=================================================================
-#pragma mark - substringToIndex
-
-- (NSString *)avoidCrashSubstringToIndex:(NSUInteger)to {
-    
-    NSString *subString = nil;
-    
-    @try {
-        subString = [self avoidCrashSubstringToIndex:to];
-    }
-    @catch (NSException *exception) {
-        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-        subString = nil;
-    }
-    @finally {
-        return subString;
-    }
-}
-
-
-//=================================================================
-//                           substringWithRange:
-//=================================================================
-#pragma mark - substringWithRange:
-
-- (NSString *)avoidCrashSubstringWithRange:(NSRange)range {
-    
-    NSString *subString = nil;
-    
-    @try {
-        subString = [self avoidCrashSubstringWithRange:range];
-    }
-    @catch (NSException *exception) {
-        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-        subString = nil;
-    }
-    @finally {
-        return subString;
-    }
-}
-
-//=================================================================
-//                stringByReplacingOccurrencesOfString:
-//=================================================================
-#pragma mark - stringByReplacingOccurrencesOfString:
-
-- (NSString *)avoidCrashStringByReplacingOccurrencesOfString:(NSString *)target withString:(NSString *)replacement {
-    
-    NSString *newStr = nil;
-    
-    @try {
-        newStr = [self avoidCrashStringByReplacingOccurrencesOfString:target withString:replacement];
-    }
-    @catch (NSException *exception) {
-        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-        newStr = nil;
-    }
-    @finally {
-        return newStr;
-    }
-}
-
-//=================================================================
-//  stringByReplacingOccurrencesOfString:withString:options:range:
-//=================================================================
-#pragma mark - stringByReplacingOccurrencesOfString:withString:options:range:
-
-- (NSString *)avoidCrashStringByReplacingOccurrencesOfString:(NSString *)target withString:(NSString *)replacement options:(NSStringCompareOptions)options range:(NSRange)searchRange {
-    
-    NSString *newStr = nil;
-    
-    @try {
-        newStr = [self avoidCrashStringByReplacingOccurrencesOfString:target withString:replacement options:options range:searchRange];
-    }
-    @catch (NSException *exception) {
-        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-        newStr = nil;
-    }
-    @finally {
-        return newStr;
-    }
-}
-
-
-//=================================================================
-//       stringByReplacingCharactersInRange:withString:
-//=================================================================
-#pragma mark - stringByReplacingCharactersInRange:withString:
-
-- (NSString *)avoidCrashStringByReplacingCharactersInRange:(NSRange)range withString:(NSString *)replacement {
-
-    
-    NSString *newStr = nil;
-    
-    @try {
-        newStr = [self avoidCrashStringByReplacingCharactersInRange:range withString:replacement];
-    }
-    @catch (NSException *exception) {
-        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
-        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
-        newStr = nil;
-    }
-    @finally {
-        return newStr;
-    }
-}
-
-
-@end

binární
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/Bugly-2.5.9/.DS_Store


binární
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/Bugly-2.5.9/Bugly.framework/Bugly


+ 163 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/Bugly-2.5.9/Bugly.framework/Headers/Bugly.h

@@ -0,0 +1,163 @@
+//
+//  Bugly.h
+//
+//  Version: 2.5(9)
+//
+//  Copyright (c) 2017年 Tencent. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+#import "BuglyConfig.h"
+#import "BuglyLog.h"
+
+BLY_START_NONNULL
+
+@interface Bugly : NSObject
+
+/**
+ *  初始化Bugly,使用默认BuglyConfigs
+ *
+ *  @param appId 注册Bugly分配的应用唯一标识
+ */
++ (void)startWithAppId:(NSString * BLY_NULLABLE)appId;
+
+/**
+ *  使用指定配置初始化Bugly
+ *
+ *  @param appId 注册Bugly分配的应用唯一标识
+ *  @param config 传入配置的 BuglyConfig
+ */
++ (void)startWithAppId:(NSString * BLY_NULLABLE)appId
+                config:(BuglyConfig * BLY_NULLABLE)config;
+
+/**
+ *  使用指定配置初始化Bugly
+ *
+ *  @param appId 注册Bugly分配的应用唯一标识
+ *  @param development 是否开发设备
+ *  @param config 传入配置的 BuglyConfig
+ */
++ (void)startWithAppId:(NSString * BLY_NULLABLE)appId
+     developmentDevice:(BOOL)development
+                config:(BuglyConfig * BLY_NULLABLE)config;
+
+/**
+ *  设置用户标识
+ *
+ *  @param userId 用户标识
+ */
++ (void)setUserIdentifier:(NSString *)userId;
+
+/**
+ *  更新版本信息
+ *
+ *  @param version 应用版本信息
+ */
++ (void)updateAppVersion:(NSString *)version;
+
+/**
+ *  设置关键数据,随崩溃信息上报
+ *
+ *  @param value KEY
+ *  @param key VALUE
+ */
++ (void)setUserValue:(NSString *)value
+              forKey:(NSString *)key;
+
+/**
+ *  获取USER ID
+ *
+ *  @return USER ID
+ */
++ (NSString *)buglyUserIdentifier;
+
+/**
+ *  获取关键数据
+ *
+ *  @return 关键数据
+ */
++ (NSDictionary * BLY_NULLABLE)allUserValues;
+
+/**
+ *  设置标签
+ *
+ *  @param tag 标签ID,可在网站生成
+ */
++ (void)setTag:(NSUInteger)tag;
+
+/**
+ *  获取当前设置标签
+ *
+ *  @return 当前标签ID
+ */
++ (NSUInteger)currentTag;
+
+/**
+ *  获取设备ID
+ *
+ *  @return 设备ID
+ */
++ (NSString *)buglyDeviceId;
+
+/**
+ *  上报自定义Objective-C异常
+ *
+ *  @param exception 异常信息
+ */
++ (void)reportException:(NSException *)exception;
+
+/**
+ *  上报错误
+ *
+ *  @param error 错误信息
+ */
++ (void)reportError:(NSError *)error;
+
+/**
+ *    @brief 上报自定义错误
+ *
+ *    @param category    类型(Cocoa=3,CSharp=4,JS=5,Lua=6)
+ *    @param aName       名称
+ *    @param aReason     错误原因
+ *    @param aStackArray 堆栈
+ *    @param info        附加数据
+ *    @param terminate   上报后是否退出应用进程
+ */
++ (void)reportExceptionWithCategory:(NSUInteger)category
+                               name:(NSString *)aName
+                             reason:(NSString *)aReason
+                          callStack:(NSArray *)aStackArray
+                          extraInfo:(NSDictionary *)info
+                       terminateApp:(BOOL)terminate;
+
+/**
+ *  SDK 版本信息
+ *
+ *  @return SDK版本号
+ */
++ (NSString *)sdkVersion;
+
+/**
+ *  APP 版本信息
+ *
+ *  @return SDK版本号
+ */
++ (NSString *)appVersion;
+
+/**
+ *  App 是否发生了连续闪退
+ *  如果 启动SDK 且 5秒内 闪退,且次数达到 3次 则判定为连续闪退
+ *
+ *  @return 是否连续闪退
+ */
++ (BOOL)isAppCrashedOnStartUpExceedTheLimit;
+
+/**
+ *  关闭bugly监控
+ */
++ (void)closeCrashReport;
+
+BLY_END_NONNULL
+
+@end

+ 141 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/Bugly-2.5.9/Bugly.framework/Headers/BuglyConfig.h

@@ -0,0 +1,141 @@
+//
+//  BuglyConfig.h
+//  Bugly
+//
+//  Copyright (c) 2016年 Tencent. All rights reserved.
+//
+
+#pragma once
+
+#define BLY_UNAVAILABLE(x) __attribute__((unavailable(x)))
+
+#if __has_feature(nullability)
+#define BLY_NONNULL __nonnull
+#define BLY_NULLABLE __nullable
+#define BLY_START_NONNULL _Pragma("clang assume_nonnull begin")
+#define BLY_END_NONNULL _Pragma("clang assume_nonnull end")
+#else
+#define BLY_NONNULL
+#define BLY_NULLABLE
+#define BLY_START_NONNULL
+#define BLY_END_NONNULL
+#endif
+
+#import <Foundation/Foundation.h>
+
+#import "BuglyLog.h"
+
+BLY_START_NONNULL
+
+@protocol BuglyDelegate <NSObject>
+
+@optional
+/**
+ *  发生异常时回调
+ *
+ *  @param exception 异常信息
+ *
+ *  @return 返回需上报记录,随异常上报一起上报
+ */
+- (NSString * BLY_NULLABLE)attachmentForException:(NSException * BLY_NULLABLE)exception;
+
+
+/**
+ *  策略激活时回调
+ *
+ *  @param tacticInfo
+ *
+ *  @return app是否弹框展示
+ */
+- (BOOL) h5AlertForTactic:(NSDictionary *)tacticInfo;
+
+@end
+
+@interface BuglyConfig : NSObject
+
+/**
+ *  SDK Debug信息开关, 默认关闭
+ */
+@property (nonatomic, assign) BOOL debugMode;
+
+/**
+ *  设置自定义渠道标识
+ */
+@property (nonatomic, copy) NSString *channel;
+
+/**
+ *  设置自定义版本号
+ */
+@property (nonatomic, copy) NSString *version;
+
+/**
+ *  设置自定义设备唯一标识
+ */
+@property (nonatomic, copy) NSString *deviceIdentifier;
+
+/**
+ *  卡顿监控开关,默认关闭
+ */
+@property (nonatomic) BOOL blockMonitorEnable;
+
+/**
+ *  卡顿监控判断间隔,单位为秒
+ */
+@property (nonatomic) NSTimeInterval blockMonitorTimeout;
+
+/**
+ *  设置 App Groups Id (如有使用 Bugly iOS Extension SDK,请设置该值)
+ */
+@property (nonatomic, copy) NSString *applicationGroupIdentifier;
+
+/**
+ *  进程内还原开关,默认开启
+ */
+@property (nonatomic) BOOL symbolicateInProcessEnable;
+
+/**
+ *  非正常退出事件记录开关,默认关闭
+ */
+@property (nonatomic) BOOL unexpectedTerminatingDetectionEnable;
+
+/**
+ *  页面信息记录开关,默认开启
+ */
+@property (nonatomic) BOOL viewControllerTrackingEnable;
+
+/**
+ *  Bugly Delegate
+ */
+@property (nonatomic, assign) id<BuglyDelegate> delegate;
+
+/**
+ * 控制自定义日志上报,默认值为BuglyLogLevelSilent,即关闭日志记录功能。
+ * 如果设置为BuglyLogLevelWarn,则在崩溃时会上报Warn、Error接口打印的日志
+ */
+@property (nonatomic, assign) BuglyLogLevel reportLogLevel;
+
+/**
+ *  崩溃数据过滤器,如果崩溃堆栈的模块名包含过滤器中设置的关键字,则崩溃数据不会进行上报
+ *  例如,过滤崩溃堆栈中包含搜狗输入法的数据,可以添加过滤器关键字SogouInputIPhone.dylib等
+ */
+@property (nonatomic, copy) NSArray *excludeModuleFilter;
+
+/**
+ * 控制台日志上报开关,默认开启
+ */
+@property (nonatomic, assign) BOOL consolelogEnable;
+
+/**
+ * 崩溃退出超时,如果监听到崩溃后,App一直没有退出,则到达超时时间后会自动abort进程退出
+ * 默认值 5s, 单位 秒
+ * 当赋值为0时,则不会自动abort进程退出
+ */
+@property (nonatomic, assign) NSUInteger crashAbortTimeout;
+
+/**
+ *  设置自定义联网、crash上报域名
+ */
+@property (nonatomic, copy) NSString *crashServerUrl;
+
+@end
+BLY_END_NONNULL

+ 78 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/Bugly-2.5.9/Bugly.framework/Headers/BuglyLog.h

@@ -0,0 +1,78 @@
+//
+//  BuglyLog.h
+//  Bugly
+//
+//  Copyright (c) 2017年 Tencent. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+// Log level for Bugly Log
+typedef NS_ENUM(NSUInteger, BuglyLogLevel) {
+    BuglyLogLevelSilent  = 0,
+    BuglyLogLevelError   = 1,
+    BuglyLogLevelWarn    = 2,
+    BuglyLogLevelInfo    = 3,
+    BuglyLogLevelDebug   = 4,
+    BuglyLogLevelVerbose = 5,
+};
+#pragma mark -
+
+OBJC_EXTERN void BLYLog(BuglyLogLevel level, NSString *format, ...) NS_FORMAT_FUNCTION(2, 3);
+
+OBJC_EXTERN void BLYLogv(BuglyLogLevel level, NSString *format, va_list args) NS_FORMAT_FUNCTION(2, 0);
+
+#pragma mark -
+#define BUGLY_LOG_MACRO(_level, fmt, ...) [BuglyLog level:_level tag:nil log:fmt, ##__VA_ARGS__]
+
+#define BLYLogError(fmt, ...)   BUGLY_LOG_MACRO(BuglyLogLevelError, fmt, ##__VA_ARGS__)
+#define BLYLogWarn(fmt, ...)    BUGLY_LOG_MACRO(BuglyLogLevelWarn,  fmt, ##__VA_ARGS__)
+#define BLYLogInfo(fmt, ...)    BUGLY_LOG_MACRO(BuglyLogLevelInfo, fmt, ##__VA_ARGS__)
+#define BLYLogDebug(fmt, ...)   BUGLY_LOG_MACRO(BuglyLogLevelDebug, fmt, ##__VA_ARGS__)
+#define BLYLogVerbose(fmt, ...) BUGLY_LOG_MACRO(BuglyLogLevelVerbose, fmt, ##__VA_ARGS__)
+
+#pragma mark - Interface
+@interface BuglyLog : NSObject
+
+/**
+ *    @brief  初始化日志模块
+ *
+ *    @param level 设置默认日志级别,默认BLYLogLevelSilent
+ *
+ *    @param printConsole 是否打印到控制台,默认NO
+ */
++ (void)initLogger:(BuglyLogLevel) level consolePrint:(BOOL)printConsole;
+
+/**
+ *    @brief 打印BLYLogLevelInfo日志
+ *
+ *    @param format   日志内容 总日志大小限制为:字符串长度30k,条数200
+ */
++ (void)log:(NSString *)format, ... NS_FORMAT_FUNCTION(1, 2);
+
+/**
+ *    @brief  打印日志
+ *
+ *    @param level 日志级别
+ *    @param message   日志内容 总日志大小限制为:字符串长度30k,条数200
+ */
++ (void)level:(BuglyLogLevel) level logs:(NSString *)message;
+
+/**
+ *    @brief  打印日志
+ *
+ *    @param level 日志级别
+ *    @param format   日志内容 总日志大小限制为:字符串长度30k,条数200
+ */
++ (void)level:(BuglyLogLevel) level log:(NSString *)format, ... NS_FORMAT_FUNCTION(2, 3);
+
+/**
+ *    @brief  打印日志
+ *
+ *    @param level  日志级别
+ *    @param tag    日志模块分类
+ *    @param format   日志内容 总日志大小限制为:字符串长度30k,条数200
+ */
++ (void)level:(BuglyLogLevel) level tag:(NSString *) tag log:(NSString *)format, ... NS_FORMAT_FUNCTION(3, 4);
+
+@end

+ 12 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/Bugly-2.5.9/Bugly.framework/Modules/module.modulemap

@@ -0,0 +1,12 @@
+framework module Bugly {
+	umbrella header "Bugly.h"
+	
+	export *
+	module * { export * }
+	
+	link framework "Foundation"
+	link framework "Security"
+	link framework "SystemConfiguration"
+	link "c++"
+	link "z"
+}

+ 156 - 156
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/Tool/GameObjc.h

@@ -1,157 +1,157 @@
-
-#import <Foundation/Foundation.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface GameObjc : NSObject
-+ (instancetype)new NS_UNAVAILABLE;
-- (instancetype)init NS_UNAVAILABLE;
-- (instancetype)initWithGametype:(int)gametype NS_DESIGNATED_INITIALIZER;
-
-- (void)gameProcess:(int)timeStamp
-           rightPos:(int *)rightPos
-           rightAtt:(int *)rightAtt
-           rightAcc:(int *)rightAcc
-          rightZupt:(int)rightZupt
-        right_press:(int)right_press
-            leftPos:(int *)leftPos
-            leftAtt:(int *)leftAtt
-           leftAcc:(int *)leftAcc
-           leftZupt:(int)leftZupt
-         left_press:(int)left_press
-               jump:(int)jump
-               down:(int)down
-               rssi:(int)rssi
-         girl_shoes:(int)girl_shoes;
-
-- (void)runGameProcess:(int)timeStamp
-              rightPos:(int *)rightPos
-              rightAtt:(int *)rightAtt
-              rightAcc:(int *)rightAcc
-             rightZupt:(int)rightZupt
-           right_press:(int)right_press
-               leftPos:(int *)leftPos
-               leftAtt:(int *)leftAtt
-              leftAcc:(int *)leftAcc
-              leftZupt:(int)leftZupt
-            left_press:(int)left_press
-                  jump:(int)jump
-                  down:(int)down
-            girl_shoes:(int)girl_shoes;
-
-- (void)getGameResult:(int *)matrix;
-
-- (int)getStepFreq:(int)leftOrRight;
-- (int)getStepStatus:(int)leftOrRight;
-- (int)getStepCount:(int)leftOrRight;
-
-- (float)getGamePos:(int)left_or_right index:(int)index;
-
-- (void)start;
-- (void)end;
-- (void)isBingo;
--(int)getInteractionCMD;
--(NSString*)getGameDataStr;
--(void)GameProcessBuf:(uint8_t*)buff length:(int)length;
-
-/// 向外提供,手动释放,如需要,可调用
-- (void)handRelease;
-
-@end
-
-@interface RunGameObjc : NSObject
-- (int)getResultLeftRight:(int *)pos
-                   devNum:(short)devNum;
-- (int)getResultJump:(short)jump;
-- (int)getResultDown:(short)down;
-- (void)setResultConLeft:(short)zupt;
-- (void)setResultConRight:(short)zupt;
-- (int)getResultLeft:(int *)pos girl_shoes:(int)girl_shoes;
-- (int)getResultRight:(int *)pos girl_shoes:(int)girl_shoes;
-- (void)process:(int)timeStamp
-       rightPos:(int *)rightPos
-       rightAtt:(int *)rightAtt
-       rightAcc:(int *)rightAcc
-      rightZupt:(int)rightZupt
-    right_press:(int)right_press
-        leftPos:(int *)leftPos
-        leftAtt:(int *)leftAtt
-       leftAcc:(int *)leftAcc
-       leftZupt:(int)leftZupt
-     left_press:(int)left_press
-           jump:(int)jump
-           down:(int)down
-     girl_shoes:(int)girl_shoes;
-- (void)getResult:(int *)dec;
-/// 向外提供,手动释放
-- (void)handRelease;
-@end
-
-@interface DanceGameObjc : NSObject
-//- (int)gamePositionProcess:(int *)pos
-//                   stepPos:(int *)stepPos
-//                      rssi:(int)rssi
-//               hostOrSlave:(short)hostOrSlave;
-//- (void)gameBoundary:(int *)globalPos;
-//- (int)getDirectionFloat:(float *)pos rssi:(int)rssi;
-//- (short)danceGameProcess:(int *)pos
-//                     zupt:(short)zupt
-//                     rssi:(int)rssi
-//              hostOrSlave:(short)hostOrSlave;
-- (void)process:(int *)rightPos
-       rightAtt:(int *)rightAtt
-      rightZupt:(int)rightZupt
-    right_press:(int)right_press
-        leftPos:(int *)leftPos
-        leftAtt:(int *)leftAtt
-       leftZupt:(int)leftZupt
-     left_press:(int)left_press
-           jump:(int)jump
-           down:(int)down
-           rssi:(int)rssi;
-
-- (void)getResult:(int *)matrix;
-//- (float)getRssiDistance:(int)rssi;
-//- (int)savePosAndRssi:(int *)pos
-//                 zupt:(short)zupt
-//                 rssi:(int)rssi
-//          hostOrSlave:(short)hostOrSlave;
-/// 向外提供,手动释放,如需要,可调用
-- (void)handRelease;
-@end
-
-
-@interface FootStepObjc : NSObject
-//pos开辟3个空间
-- (void)stepCal:(int)timeStamp posList:(int *)pos zupt:(int)zupt girl_shoes:(int)girl_shoes;
-- (int)getStepFreq;
-- (int)getStepStatus;
-- (int)getStepCount;
-/// 向外提供,手动释放,如需要,可调用
-- (void)handRelease;
-@end
-
-
-@interface InertialTrajProcessObjc : NSObject
-- (void)trajRotate:(int *)pos;
-//rotateMatrix只能开辟4个空间
-- (void)trajRotate:(int *)pos
-      rotateMatrix:(float *)rotateMatrix;
-- (void)resetHeading:(short)heading;
-/// 向外提供,手动释放
-- (void)handRelease;
-@end
-
-//@interface OriginTrajObj : NSObject
-//- (void)process:(int*)right_pos
-//        right_att:(int*)right_att
-//        right_zupt:(int)right_zupt
-//        left_pos:(int*)left_pos
-//        left_att:(int*)left_att
-//        left_zupt:(int) left_zupt;
-//
-//- (float)getGamePos:(int)left_or_right
-//               index:(int)index;
+//
+//#import <Foundation/Foundation.h>
+//
+//NS_ASSUME_NONNULL_BEGIN
+//
+//@interface GameObjc : NSObject
+//+ (instancetype)new NS_UNAVAILABLE;
+//- (instancetype)init NS_UNAVAILABLE;
+//- (instancetype)initWithGametype:(int)gametype NS_DESIGNATED_INITIALIZER;
+//
+//- (void)gameProcess:(int)timeStamp
+//           rightPos:(int *)rightPos
+//           rightAtt:(int *)rightAtt
+//           rightAcc:(int *)rightAcc
+//          rightZupt:(int)rightZupt
+//        right_press:(int)right_press
+//            leftPos:(int *)leftPos
+//            leftAtt:(int *)leftAtt
+//           leftAcc:(int *)leftAcc
+//           leftZupt:(int)leftZupt
+//         left_press:(int)left_press
+//               jump:(int)jump
+//               down:(int)down
+//               rssi:(int)rssi
+//         girl_shoes:(int)girl_shoes;
+//
+//- (void)runGameProcess:(int)timeStamp
+//              rightPos:(int *)rightPos
+//              rightAtt:(int *)rightAtt
+//              rightAcc:(int *)rightAcc
+//             rightZupt:(int)rightZupt
+//           right_press:(int)right_press
+//               leftPos:(int *)leftPos
+//               leftAtt:(int *)leftAtt
+//              leftAcc:(int *)leftAcc
+//              leftZupt:(int)leftZupt
+//            left_press:(int)left_press
+//                  jump:(int)jump
+//                  down:(int)down
+//            girl_shoes:(int)girl_shoes;
+//
+//- (void)getGameResult:(int *)matrix;
+//
+//- (int)getStepFreq:(int)leftOrRight;
+//- (int)getStepStatus:(int)leftOrRight;
+//- (int)getStepCount:(int)leftOrRight;
+//
+//- (float)getGamePos:(int)left_or_right index:(int)index;
+//
+//- (void)start;
+//- (void)end;
+//- (void)isBingo;
+//-(int)getInteractionCMD;
+//-(NSString*)getGameDataStr;
+//-(void)GameProcessBuf:(uint8_t*)buff length:(int)length;
+//
+///// 向外提供,手动释放,如需要,可调用
+//- (void)handRelease;
+//
+//@end
+//
+//@interface RunGameObjc : NSObject
+//- (int)getResultLeftRight:(int *)pos
+//                   devNum:(short)devNum;
+//- (int)getResultJump:(short)jump;
+//- (int)getResultDown:(short)down;
+//- (void)setResultConLeft:(short)zupt;
+//- (void)setResultConRight:(short)zupt;
+//- (int)getResultLeft:(int *)pos girl_shoes:(int)girl_shoes;
+//- (int)getResultRight:(int *)pos girl_shoes:(int)girl_shoes;
+//- (void)process:(int)timeStamp
+//       rightPos:(int *)rightPos
+//       rightAtt:(int *)rightAtt
+//       rightAcc:(int *)rightAcc
+//      rightZupt:(int)rightZupt
+//    right_press:(int)right_press
+//        leftPos:(int *)leftPos
+//        leftAtt:(int *)leftAtt
+//       leftAcc:(int *)leftAcc
+//       leftZupt:(int)leftZupt
+//     left_press:(int)left_press
+//           jump:(int)jump
+//           down:(int)down
+//     girl_shoes:(int)girl_shoes;
+//- (void)getResult:(int *)dec;
+///// 向外提供,手动释放
+//- (void)handRelease;
+//@end
+//
+//@interface DanceGameObjc : NSObject
+////- (int)gamePositionProcess:(int *)pos
+////                   stepPos:(int *)stepPos
+////                      rssi:(int)rssi
+////               hostOrSlave:(short)hostOrSlave;
+////- (void)gameBoundary:(int *)globalPos;
+////- (int)getDirectionFloat:(float *)pos rssi:(int)rssi;
+////- (short)danceGameProcess:(int *)pos
+////                     zupt:(short)zupt
+////                     rssi:(int)rssi
+////              hostOrSlave:(short)hostOrSlave;
+//- (void)process:(int *)rightPos
+//       rightAtt:(int *)rightAtt
+//      rightZupt:(int)rightZupt
+//    right_press:(int)right_press
+//        leftPos:(int *)leftPos
+//        leftAtt:(int *)leftAtt
+//       leftZupt:(int)leftZupt
+//     left_press:(int)left_press
+//           jump:(int)jump
+//           down:(int)down
+//           rssi:(int)rssi;
+//
+//- (void)getResult:(int *)matrix;
+////- (float)getRssiDistance:(int)rssi;
+////- (int)savePosAndRssi:(int *)pos
+////                 zupt:(short)zupt
+////                 rssi:(int)rssi
+////          hostOrSlave:(short)hostOrSlave;
+///// 向外提供,手动释放,如需要,可调用
+//- (void)handRelease;
+//@end
+//
+//
+//@interface FootStepObjc : NSObject
+////pos开辟3个空间
+//- (void)stepCal:(int)timeStamp posList:(int *)pos zupt:(int)zupt girl_shoes:(int)girl_shoes;
+//- (int)getStepFreq;
+//- (int)getStepStatus;
+//- (int)getStepCount;
+///// 向外提供,手动释放,如需要,可调用
+//- (void)handRelease;
+//@end
+//
+//
+//@interface InertialTrajProcessObjc : NSObject
+//- (void)trajRotate:(int *)pos;
+////rotateMatrix只能开辟4个空间
+//- (void)trajRotate:(int *)pos
+//      rotateMatrix:(float *)rotateMatrix;
+//- (void)resetHeading:(short)heading;
+///// 向外提供,手动释放
+//- (void)handRelease;
 //@end
-
-NS_ASSUME_NONNULL_END
+//
+////@interface OriginTrajObj : NSObject
+////- (void)process:(int*)right_pos
+////        right_att:(int*)right_att
+////        right_zupt:(int)right_zupt
+////        left_pos:(int*)left_pos
+////        left_att:(int*)left_att
+////        left_zupt:(int) left_zupt;
+////
+////- (float)getGamePos:(int)left_or_right
+////               index:(int)index;
+////@end
+//
+//NS_ASSUME_NONNULL_END

+ 367 - 368
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/Tool/GameObjc.mm

@@ -1,388 +1,387 @@
-
-#import "GameObjc.h"
-#include "Game.h"
-#include "DanceGame.h"
-#include "FootStep.h"
-#include "InertialTrajProcess.h"
-//#include "OriginTraj.h"
-//#include <math.h>
-
-#define NSLog(format, ...) printf("TIME:%s FILE:%s(%d行) FUNCTION:%s \n %s\n\n",__TIME__, [[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, __PRETTY_FUNCTION__, [[NSString stringWithFormat:(format), ##__VA_ARGS__] UTF8String])
-
-@interface GameObjc()
-{
-@private
-    Game *game;
-    int gametype;
-}
-@end
-
-@implementation GameObjc
-
-- (instancetype)initWithGametype:(int)gametype{
-    self = [super init];
-    if (self){
-        gametype = gametype;
-        game = new Game(gametype);
-    }
-    return self;
-}
-
-- (void)gameProcess:(int)timeStamp
-           rightPos:(int *)rightPos
-           rightAtt:(int *)rightAtt
-           rightAcc:(int *)rightAcc
-          rightZupt:(int)rightZupt
-        right_press:(int)right_press
-            leftPos:(int *)leftPos
-            leftAtt:(int *)leftAtt
-           leftAcc:(int *)leftAcc
-           leftZupt:(int)leftZupt
-         left_press:(int)left_press
-               jump:(int)jump
-               down:(int)down
-               rssi:(int)rssi
-         girl_shoes:(int)girl_shoes{
-    game->GameProcess(timeStamp, rightPos, rightAtt, rightAcc,rightZupt,right_press,leftPos, leftAtt, leftAcc,leftZupt, left_press,jump,down, rssi,girl_shoes);
-}
-
-- (void)runGameProcess:(int)timeStamp
-              rightPos:(int *)rightPos
-              rightAtt:(int *)rightAtt
-              rightAcc:(int *)rightAcc
-             rightZupt:(int)rightZupt
-           right_press:(int)right_press
-               leftPos:(int *)leftPos
-               leftAtt:(int *)leftAtt
-              leftAcc:(int *)leftAcc
-              leftZupt:(int)leftZupt
-            left_press:(int)left_press
-                  jump:(int)jump
-                  down:(int)down
-            girl_shoes:(int)girl_shoes{
-    game->RunGameProcess(rightPos, rightAtt, rightAcc,rightZupt,right_press,leftPos, leftAtt, leftAcc,leftZupt, left_press,jump,down,girl_shoes);
-    
-}
-
-- (void)getGameResult:(int *)matrix{
-    game->getGameResult(matrix);
-}
-
-- (int)getStepFreq:(int)leftOrRight{
-    return game->getStepFreq(leftOrRight);
-}
-- (int)getStepStatus:(int)leftOrRight{
-    return game->getStepStatus(leftOrRight);
-}
-- (int)getStepCount:(int)leftOrRight{
-    return game->getStepCount(leftOrRight);
-}
-
-- (float)getGamePos:(int)left_or_right index:(int)index{
-    return game->getGamePos(left_or_right, index);
-}
-
-- (void)start{
-    game->start(nil);
-}
-- (void)end{
-    game->end();
-}
-
-- (void)isBingo{
-    game->isBingo();
-}
-
--(int)getInteractionCMD{
-    return game->getInteractionCMD();
-}
-
--(NSString*)getGameDataStr{
-    
-//    NSString * string =  [NSString stringWithCString:game->getGameDataStr().c_str() encoding:[NSString defaultCStringEncoding]];
-    NSString * aString = [NSString stringWithUTF8String:game->getGameDataStr().c_str()];
-//    NSLog(@"剑波需要的数据1 %@",string);
-//    NSLog(@"剑波需要的数据2 %@",aString);
-    return aString;
-    
-}
-
--(void)GameProcessBuf:(uint8_t*)buff length:(int)length{
-    
-    game->GameProcessBuf(buff, length);
-    
-}
-
-/// 向外提供,手动释放
-- (void)handRelease{
-    delete game;
-}
-- (void)dealloc{
-    delete game;
-}
-
-@end
-
-@interface RunGameObjc ()
-{
-    @private
-    RunGame * runGame;
-}
-@end
-
-@implementation RunGameObjc
-- (instancetype)init{
-    self = [super init];
-    if (self) {
-        runGame = new RunGame();
-    }
-    return self;
-}
-- (int)getResultLeftRight:(int *)pos
-                   devNum:(short)devNum{
-    return runGame->getResultLeftRight(pos, devNum);
-}
-- (int)getResultJump:(short)jump{
-    return runGame->getResultJump(jump);
-}
-- (int)getResultDown:(short)down{
-    return runGame->getResultDown(down);
-}
-- (void)setResultConLeft:(short)zupt{
-    runGame->setResultConLeft(zupt);
-}
-- (void)setResultConRight:(short)zupt{
-     runGame->setResultConRight(zupt);
-}
-- (int)getResultLeft:(int *)pos girl_shoes:(int)girl_shoes pitch:(float)pitch{
-    return runGame->getResultLeft(pos,girl_shoes,pitch);
-}
-- (int)getResultRight:(int *)pos girl_shoes:(int)girl_shoes pitch:(float)pitch{
-    return runGame->getResultRight(pos,girl_shoes,pitch);
-}
-
-- (void)process:(int)timeStamp
-       rightPos:(int *)rightPos
-       rightAtt:(int *)rightAtt
-       rightAcc:(int *)rightAcc
-      rightZupt:(int)rightZupt
-    right_press:(int)right_press
-        leftPos:(int *)leftPos
-        leftAtt:(int *)leftAtt
-       leftAcc:(int *)leftAcc
-       leftZupt:(int)leftZupt
-     left_press:(int)left_press
-           jump:(int)jump
-           down:(int)down
-     girl_shoes:(int)girl_shoes{
-    
-    runGame->Process(rightPos, rightAtt, rightAcc,rightZupt,right_press,leftPos, leftAtt, leftAcc,leftZupt, left_press,jump,down,girl_shoes);
-    
-//    Process(int* right_pos, int* right_att, int* right_acc, int right_zupt, int right_press,
-//                 int* left_pos, int* left_att, int* left_acc, int left_zupt, int left_press,
-//                 int jump, int down, int girl_shoes)
-    
-}
-
-- (void)getResult:(int *)dec{
-    runGame->getResult(dec);
-}
-
-/// 向外提供,手动释放
-- (void)handRelease{
-    delete runGame;
-}
-- (void)dealloc{
-    delete runGame;
-}
-@end
-
-@interface DanceGameObjc()
-{
-@private
-    DanceGame *danceGame;
-}
-@end
-
-@implementation DanceGameObjc
-- (instancetype)init{
-    self = [super init];
-    if (self) {
-        danceGame = new DanceGame();
-    }
-    return self;
-}
-
-//- (int)gamePositionProcess:(int *)pos
-//                   stepPos:(int *)stepPos
-//                      rssi:(int)rssi
-//               hostOrSlave:(short)hostOrSlave{
-//    //SInt16 ==> short*
-//    return  danceGame->game_position_process(pos, stepPos, rssi, hostOrSlave);
-//}
-
-//- (void)gameBoundary:(int *)globalPos{
-//    danceGame->game_boundary(globalPos);
-//}
-//- (int)getDirectionFloat:(float *)pos
-//                    rssi:(int)rssi{
-//    //float==>32位
-//    return  danceGame->getDirectionFloat(pos,rssi);
-//}
-//- (short)danceGameProcess:(int *)pos
-//                     zupt:(short)zupt
-//                     rssi:(int)rssi
-//              hostOrSlave:(short)hostOrSlave{
-//    return danceGame->dance_game_process(pos, zupt, rssi, hostOrSlave);
-//}
-
-- (void)process:(int *)rightPos
-       rightAtt:(int *)rightAtt
-       rightAcc:(int *)rightAcc
-      rightZupt:(int)rightZupt
-    right_press:(int)right_press
-        leftPos:(int *)leftPos
-        leftAtt:(int *)leftAtt
-       leftAcc:(int *)leftAcc
-       leftZupt:(int)leftZupt
-     left_press:(int)left_press
-           jump:(int)jump
-           down:(int)down
-           rssi:(int)rssi{
-    danceGame->Process(rightPos, rightAtt,rightAcc, rightZupt, right_press,leftPos, leftAtt,leftAtt, leftZupt, left_press,jump, down, rssi);
-}
-
-- (void)getResult:(int *)matrix{
-    danceGame->getResult(matrix);
-}
-//- (float)getRssiDistance:(int)rssi{
-//    return danceGame->getRssiDistance(rssi);
-//}
-//- (int)savePosAndRssi:(int *)pos
-//                 zupt:(short)zupt
-//                 rssi:(int)rssi
-//          hostOrSlave:(short)hostOrSlave{
-//    return danceGame->savePosAndRssi(pos, zupt, rssi, hostOrSlave);
-//}
-/// 向外提供,手动释放
-- (void)handRelease{
-    delete danceGame;
-}
-- (void)dealloc{
-    delete danceGame;
-}
-@end
-
-@interface FootStepObjc ()
-{
-@private
-    FootStep *footStep;
-}
-@end
-
-@implementation FootStepObjc
-
-- (instancetype)init{
-    self = [super init];
-    if (self) {
-        footStep = new FootStep();
-    }
-    return self;
-}
-//pos开辟3个空间
-- (void)stepCal:(int)timeStamp posList:(int *)pos zupt:(int)zupt girl_shoes:(int)girl_shoes{
-    footStep->stepCal(timeStamp, pos, zupt,girl_shoes);
-}
-- (int)getStepFreq{
-    return footStep->getStepFreq();
-}
-- (int)getStepStatus{
-    return footStep->getStepStatus();
-}
-- (int)getStepCount{
-    return footStep->getStepCount();
-}
-- (void)dealloc{
-    delete footStep;
-}
-/// 向外提供,手动释放
-- (void)handRelease{
-    delete footStep;
-}
-
-@end
-
-@interface InertialTrajProcessObjc ()
-{
-    @private
-    InertialTrajProcess * inertialTrajProcess;
-}
-@end
-@implementation InertialTrajProcessObjc
-- (instancetype)init{
-    self = [super init];
-    if (self){
-        inertialTrajProcess = new InertialTrajProcess();
-    }
-    return self;
-}
-
-- (void)trajRotate:(int *)pos{
-    inertialTrajProcess->TrajRotate(pos);
-}
-
-//rotateMatrix只能开辟4个空间
-- (void)trajRotate:(int *)pos
-      rotateMatrix:(float *)rotateMatrix{
-    inertialTrajProcess->TrajRotate(pos,rotateMatrix);
-}
-- (void)resetHeading:(short)heading{
-    inertialTrajProcess->ResetHeading(heading);
-}
-/// 向外提供,手动释放
-- (void)handRelease{
-    delete inertialTrajProcess;
-}
-- (void)dealloc{
-    delete inertialTrajProcess;
-}
-@end
-
-
-//@interface OriginTrajObj ()
+//
+//#import "GameObjc.h"
+//#include "Game.h"
+//#include "DanceGame.h"
+//#include "FootStep.h"
+//#include "InertialTrajProcess.h"
+////#include "OriginTraj.h"
+////#include <math.h>
+//
+//#define NSLog(format, ...) printf("TIME:%s FILE:%s(%d行) FUNCTION:%s \n %s\n\n",__TIME__, [[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, __PRETTY_FUNCTION__, [[NSString stringWithFormat:(format), ##__VA_ARGS__] UTF8String])
+//
+//
+//@interface GameObjc()
+//{
+//@private
+//    Game *game;
+//    int gametype;
+//}
+//@end
+//
+//@implementation GameObjc
+//
+//- (instancetype)initWithGametype:(int)gametype{
+//    self = [super init];
+//    if (self){
+//        gametype = gametype;
+//        game = new Game(gametype);
+//    }
+//    return self;
+//}
+//
+//- (void)gameProcess:(int)timeStamp
+//           rightPos:(int *)rightPos
+//           rightAtt:(int *)rightAtt
+//           rightAcc:(int *)rightAcc
+//          rightZupt:(int)rightZupt
+//        right_press:(int)right_press
+//            leftPos:(int *)leftPos
+//            leftAtt:(int *)leftAtt
+//           leftAcc:(int *)leftAcc
+//           leftZupt:(int)leftZupt
+//         left_press:(int)left_press
+//               jump:(int)jump
+//               down:(int)down
+//               rssi:(int)rssi
+//         girl_shoes:(int)girl_shoes{
+//    game->GameProcess(timeStamp, rightPos, rightAtt, rightAcc,rightZupt,right_press,leftPos, leftAtt, leftAcc,leftZupt, left_press,jump,down, rssi,girl_shoes);
+//}
+//
+//- (void)runGameProcess:(int)timeStamp
+//              rightPos:(int *)rightPos
+//              rightAtt:(int *)rightAtt
+//              rightAcc:(int *)rightAcc
+//             rightZupt:(int)rightZupt
+//           right_press:(int)right_press
+//               leftPos:(int *)leftPos
+//               leftAtt:(int *)leftAtt
+//              leftAcc:(int *)leftAcc
+//              leftZupt:(int)leftZupt
+//            left_press:(int)left_press
+//                  jump:(int)jump
+//                  down:(int)down
+//            girl_shoes:(int)girl_shoes{
+//    game->RunGameProcess(rightPos, rightAtt, rightAcc,rightZupt,right_press,leftPos, leftAtt, leftAcc,leftZupt, left_press,jump,down,girl_shoes);
+//
+//}
+//
+//- (void)getGameResult:(int *)matrix{
+//    game->getGameResult(matrix);
+//}
+//
+//- (int)getStepFreq:(int)leftOrRight{
+//    return game->getStepFreq(leftOrRight);
+//}
+//- (int)getStepStatus:(int)leftOrRight{
+//    return game->getStepStatus(leftOrRight);
+//}
+//- (int)getStepCount:(int)leftOrRight{
+//    return game->getStepCount(leftOrRight);
+//}
+//
+//- (float)getGamePos:(int)left_or_right index:(int)index{
+//    return game->getGamePos(left_or_right, index);
+//}
+//
+//- (void)start{
+//    game->start(nil);
+//}
+//- (void)end{
+//    game->end();
+//}
+//
+//- (void)isBingo{
+//    game->isBingo();
+//}
+//
+//-(int)getInteractionCMD{
+//    return game->getInteractionCMD();
+//}
+//
+//-(NSString*)getGameDataStr{
+//
+////    NSString * string =  [NSString stringWithCString:game->getGameDataStr().c_str() encoding:[NSString defaultCStringEncoding]];
+//    NSString * aString = [NSString stringWithUTF8String:game->getGameDataStr().c_str()];
+////    NSLog(@"剑波需要的数据1 %@",string);
+////    NSLog(@"剑波需要的数据2 %@",aString);
+//    return aString;
+//
+//}
+//
+//-(void)GameProcessBuf:(uint8_t*)buff length:(int)length{
+//
+//    game->GameProcessBuf(buff, length);
+//
+//}
+//
+///// 向外提供,手动释放
+//- (void)handRelease{
+//    delete game;
+//}
+//- (void)dealloc{
+//    delete game;
+//}
+//
+//@end
+//
+//@interface RunGameObjc ()
 //{
 //    @private
-//    OriginTraj * originTraj;
+//    RunGame * runGame;
 //}
 //@end
-//@implementation OriginTrajObj
+//
+//@implementation RunGameObjc
 //- (instancetype)init{
 //    self = [super init];
-//    if (self){
-//        originTraj = new OriginTraj();
+//    if (self) {
+//        runGame = new RunGame();
+//    }
+//    return self;
+//}
+//- (int)getResultLeftRight:(int *)pos
+//                   devNum:(short)devNum{
+//    return runGame->getResultLeftRight(pos, devNum);
+//}
+//- (int)getResultJump:(short)jump{
+//    return runGame->getResultJump(jump);
+//}
+//- (int)getResultDown:(short)down{
+//    return runGame->getResultDown(down);
+//}
+//- (void)setResultConLeft:(short)zupt{
+//    runGame->setResultConLeft(zupt);
+//}
+//- (void)setResultConRight:(short)zupt{
+//     runGame->setResultConRight(zupt);
+//}
+//- (int)getResultLeft:(int *)pos girl_shoes:(int)girl_shoes{
+//    return runGame->getResultLeft(pos,girl_shoes);
+//}
+//- (int)getResultRight:(int *)pos girl_shoes:(int)girl_shoes{
+//    return runGame->getResultRight(pos,girl_shoes);
+//}
+//
+//- (void)process:(int)timeStamp
+//       rightPos:(int *)rightPos
+//       rightAtt:(int *)rightAtt
+//       rightAcc:(int *)rightAcc
+//      rightZupt:(int)rightZupt
+//    right_press:(int)right_press
+//        leftPos:(int *)leftPos
+//        leftAtt:(int *)leftAtt
+//       leftAcc:(int *)leftAcc
+//       leftZupt:(int)leftZupt
+//     left_press:(int)left_press
+//           jump:(int)jump
+//           down:(int)down
+//     girl_shoes:(int)girl_shoes{
+//
+//    runGame->Process(rightPos, rightAtt, rightAcc,rightZupt,right_press,leftPos, leftAtt, leftAcc,leftZupt, left_press,jump,down,girl_shoes);
+//
+////    Process(int* right_pos, int* right_att, int* right_acc, int right_zupt, int right_press,
+////                 int* left_pos, int* left_att, int* left_acc, int left_zupt, int left_press,
+////                 int jump, int down, int girl_shoes)
+//
+//}
+//
+//- (void)getResult:(int *)dec{
+//    runGame->getResult(dec);
+//}
+//
+///// 向外提供,手动释放
+//- (void)handRelease{
+//    delete runGame;
+//}
+//- (void)dealloc{
+//    delete runGame;
+//}
+//@end
+//
+//@interface DanceGameObjc()
+//{
+//@private
+//    DanceGame *danceGame;
+//}
+//@end
+//
+//@implementation DanceGameObjc
+//- (instancetype)init{
+//    self = [super init];
+//    if (self) {
+//        danceGame = new DanceGame();
 //    }
 //    return self;
 //}
 //
-//- (void)process:(int*)right_pos
-//        right_att:(int*)right_att
-//        right_zupt:(int)right_zupt
-//        left_pos:(int*)left_pos
-//        left_att:(int*)left_att
-//      left_zupt:(int) left_zupt{
-//    originTraj->Process(right_pos, right_att, right_zupt, left_pos, left_att, left_zupt);
+////- (int)gamePositionProcess:(int *)pos
+////                   stepPos:(int *)stepPos
+////                      rssi:(int)rssi
+////               hostOrSlave:(short)hostOrSlave{
+////    //SInt16 ==> short*
+////    return  danceGame->game_position_process(pos, stepPos, rssi, hostOrSlave);
+////}
+//
+////- (void)gameBoundary:(int *)globalPos{
+////    danceGame->game_boundary(globalPos);
+////}
+////- (int)getDirectionFloat:(float *)pos
+////                    rssi:(int)rssi{
+////    //float==>32位
+////    return  danceGame->getDirectionFloat(pos,rssi);
+////}
+////- (short)danceGameProcess:(int *)pos
+////                     zupt:(short)zupt
+////                     rssi:(int)rssi
+////              hostOrSlave:(short)hostOrSlave{
+////    return danceGame->dance_game_process(pos, zupt, rssi, hostOrSlave);
+////}
+//
+//- (void)process:(int *)rightPos
+//       rightAtt:(int *)rightAtt
+//       rightAcc:(int *)rightAcc
+//      rightZupt:(int)rightZupt
+//    right_press:(int)right_press
+//        leftPos:(int *)leftPos
+//        leftAtt:(int *)leftAtt
+//       leftAcc:(int *)leftAcc
+//       leftZupt:(int)leftZupt
+//     left_press:(int)left_press
+//           jump:(int)jump
+//           down:(int)down
+//           rssi:(int)rssi{
+//    danceGame->Process(rightPos, rightAtt,rightAcc, rightZupt, right_press,leftPos, leftAtt,leftAtt, leftZupt, left_press,jump, down, rssi);
+//}
+//
+//- (void)getResult:(int *)matrix{
+//    danceGame->getResult(matrix);
+//}
+////- (float)getRssiDistance:(int)rssi{
+////    return danceGame->getRssiDistance(rssi);
+////}
+////- (int)savePosAndRssi:(int *)pos
+////                 zupt:(short)zupt
+////                 rssi:(int)rssi
+////          hostOrSlave:(short)hostOrSlave{
+////    return danceGame->savePosAndRssi(pos, zupt, rssi, hostOrSlave);
+////}
+///// 向外提供,手动释放
+//- (void)handRelease{
+//    delete danceGame;
+//}
+//- (void)dealloc{
+//    delete danceGame;
+//}
+//@end
+//
+//@interface FootStepObjc ()
+//{
+//@private
+//    FootStep *footStep;
 //}
+//@end
 //
-//- (float)getGamePos:(int)left_or_right
-//              index:(int)index{
-//    return originTraj->getGamePos(left_or_right, index);
+//@implementation FootStepObjc
+//
+//- (instancetype)init{
+//    self = [super init];
+//    if (self) {
+//        footStep = new FootStep();
+//    }
+//    return self;
+//}
+////pos开辟3个空间
+////- (void)stepCal:(int)timeStamp posList:(int *)pos zupt:(int)zupt girl_shoes:(int)girl_shoes{
+//    footStep->stepCal(timeStamp, pos, zupt,girl_shoes);
+//}
+//- (int)getStepFreq{
+//    return footStep->getStepFreq();
+//}
+//- (int)getStepStatus{
+//    return footStep->getStepStatus();
+//}
+//- (int)getStepCount{
+//    return footStep->getStepCount();
+//}
+//- (void)dealloc{
+//    delete footStep;
+//}
+///// 向外提供,手动释放
+//- (void)handRelease{
+//    delete footStep;
 //}
 //
+//@end
+//
+//@interface InertialTrajProcessObjc ()
+//{
+//    @private
+//    InertialTrajProcess * inertialTrajProcess;
+//}
+//@end
+//@implementation InertialTrajProcessObjc
+//- (instancetype)init{
+//    self = [super init];
+//    if (self) {
+//        inertialTrajProcess = new InertialTrajProcess();
+//    }
+//    return self;
+//}
+//- (void)trajRotate:(int *)pos{
+//    inertialTrajProcess->TrajRotate(pos);
+//}
+////rotateMatrix只能开辟4个空间
+//- (void)trajRotate:(int *)pos
+//      rotateMatrix:(float *)rotateMatrix{
+//    inertialTrajProcess->TrajRotate(pos,rotateMatrix);
+//}
+//- (void)resetHeading:(short)heading{
+//    inertialTrajProcess->ResetHeading(heading);
+//}
 ///// 向外提供,手动释放
 //- (void)handRelease{
-//    delete originTraj;
+//    delete inertialTrajProcess;
 //}
 //- (void)dealloc{
-//    delete originTraj;
+//    delete inertialTrajProcess;
 //}
 //@end
+//
+//
+////@interface OriginTrajObj ()
+////{
+////    @private
+////    OriginTraj * originTraj;
+////}
+////@end
+////@implementation OriginTrajObj
+////- (instancetype)init{
+////    self = [super init];
+////    if (self){
+////        originTraj = new OriginTraj();
+////    }
+////    return self;
+////}
+////
+////- (void)process:(int*)right_pos
+////        right_att:(int*)right_att
+////        right_zupt:(int)right_zupt
+////        left_pos:(int*)left_pos
+////        left_att:(int*)left_att
+////      left_zupt:(int) left_zupt{
+////    originTraj->Process(right_pos, right_att, right_zupt, left_pos, left_att, left_zupt);
+////}
+////
+////- (float)getGamePos:(int)left_or_right
+////              index:(int)index{
+////    return originTraj->getGamePos(left_or_right, index);
+////}
+////
+/////// 向外提供,手动释放
+////- (void)handRelease{
+////    delete originTraj;
+////}
+////- (void)dealloc{
+////    delete originTraj;
+////}
+////@end

+ 18 - 8
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/Tool/MYFactoryManager.h

@@ -15,8 +15,6 @@
 #import "AlgorithmTool.h"
 #import "UIColor+Hex.h"
 
-//#import "IOSPlatformSDK.h"
-//
 //蓝牙
 #import <CoreBluetooth/CoreBluetooth.h>
 #import "BTDataProcess.h"
@@ -26,6 +24,10 @@
 #define RIGHT_FOOT_OC 2
 //蓝牙框架封装
 #import "LEONBLManager.h"
+#import "BTDataSend.h"
+#import "BTDataAnalysis.h"
+#import "CBPeripheral+ADName.h"
+#define BTDataInstance [BTDataProcess sharedInstance]
 #define LEManager [LEONBLManager sharedInstance]
 
 //http
@@ -34,14 +36,14 @@
 //第三方
 #import "AFNetworking.h"
 #import "MBProgressHUD.h"
-#import "AvoidCrash.h"
-#import <Bugly/Bugly.h>
 
 //UI
 #import "SearchDeviceViewController.h"
 #import "AnimationView.h"
 #import "PopupView.h"
 #import "NoDeviceTip.h"
+#import <AudioToolbox/AudioToolbox.h>
+#import "DebugView.h"
 
 /*************************** 获取屏幕 宽度、高度 ***************************/
 #define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)
@@ -62,13 +64,12 @@
 #define IOSSDK_USERINFO @"iosSdk_userInfo"
 //缓存的步频数据
 #define IOSSDK_BLESDKDATA @"iosSdk_bleSdk_frequency"
-//游戏组数时间戳
+//游戏组数时间戳 参数是play_gorup
 #define IOSSDK_TIMESTAMP @"iosSdk_timestamp"
 //custom System UserDefaults
 #define IOS_NSUSERDEFAULT [NSUserDefaults standardUserDefaults]
 #define CUS_NOTIFICATIONCENTER [NSNotificationCenter defaultCenter]
-#define IOSSDK_TOKEN [[IOS_NSUSERDEFAULT objectForKey:IOSSDK_USERINFO] objectForKey:@"token"]
-#define IOSSDK_GAMEID [[IOS_NSUSERDEFAULT objectForKey:IOSSDK_USERINFO] objectForKey:@"game_id"]
+
 //#define IOSSDK_GAMEID @"3"
 //#define IOSSDK_TOKEN @"shoes:61652aa99523f9.65681365I94"
 
@@ -77,7 +78,7 @@
 @property (nonatomic,assign) UIBackgroundTaskIdentifier bgTask;
 
 #pragma mark -- UI
-//danli
+//单例
 +(instancetype)sharedInstance;
 //边框
 + (void)makeBoundsWithView:(UIView *)view color:(UIColor *)color width:(CGFloat)width;
@@ -93,6 +94,15 @@
 +(void)postGroupCFNotificaiton:(NSString*)string;
 //开启后台任务保活
 -(void)comeToBackgroundMode;
+
++(NSString*)getUserInfo;
++(NSString*)getToken;
++(NSString*)getGameId;
++(NSString*)getGameType;
++(NSString*)getGameMac;
++(NSString*)getInviteUser;
++(NSString*)getInviteInfo;
+
 //#pragma mark -- 参数判断
 //+(BOOL)ifLoogIn:(BOOL)tip;
 //+(bool)internetStatus;

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 264 - 171
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/Tool/MYFactoryManager.m


+ 4 - 1
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/UI/AnimationVIew/AnimationView.m

@@ -217,10 +217,13 @@
     
 }
 
-
 //初始化小风扇动画
 -(void)addAnimation{
     
+    if (self.animationView!=nil){
+        [self stopAnimation];
+    }
+    
     self.animationView =  [UIView new];
     self.animationView.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
     self.animationView.backgroundColor = RGBA(76, 76, 76, 0.8);

+ 3 - 9
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/UI/CarouselView/ShoesCarouselView.m

@@ -59,14 +59,6 @@ UIScrollViewDelegate
 
 @implementation ShoesCarouselView
 
-//- (UIView*)hitTest:(CGPoint)point withEvent:(UIEvent *)event{
-//    UIView *hitView = [super hitTest:point withEvent:event];
-//    //如果上层透明视图是window 和 按钮(uibutton 继承自UIControl )就允许点击
-//    if(hitView.window == self && ![hitView isKindOfClass:[UIControl class]]){
-//        return nil;
-//    }
-//    return hitView;
-//}
 
 #pragma mark - 生命周期
 - (instancetype)initWithCoder:(NSCoder *)coder{
@@ -79,7 +71,9 @@ UIScrollViewDelegate
         self.currentState.isDidScroll = NO;
         self.currentState.isCenter = NO;
         self.currentState.isRestrict = NO;
+        
         self.userInteractionEnabled = NO;
+  
     }
     return self;
     
@@ -371,7 +365,7 @@ UIScrollViewDelegate
 -(TXCarouselViewLayout *)carouselViewLayout{
     
     if (!_carouselViewLayout){
-        CGFloat itemsHeight = self.carouselSize.height*itemHight;
+        CGFloat itemsHeight = _carouselSize.height*itemHight;
         _carouselViewLayout = [[TXCarouselViewLayout alloc] init];
         _carouselViewLayout.itemSize = CGSizeMake(itemsHeight, itemsHeight);
         _carouselViewLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;

+ 1 - 1
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/UI/CarouselView/TXCarouselView.m

@@ -300,7 +300,7 @@ UIScrollViewDelegate
 -(TXCarouselViewLayout *)carouselViewLayout{
     
     if (!_carouselViewLayout){
-        CGFloat itemsHeight = self.carouselSize.height*itemHight;
+        CGFloat itemsHeight = _carouselSize.height*itemHight;
         _carouselViewLayout = [[TXCarouselViewLayout alloc] init];
         _carouselViewLayout.itemSize = CGSizeMake(itemsHeight, itemsHeight);
         _carouselViewLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;

+ 0 - 2
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/UI/SearchDeviceViewController.h

@@ -17,8 +17,6 @@
 
 @property (copy,nonatomic)void(^connectDeviceBlock)(CBPeripheral * peripheral);
 
-@property (nonatomic, copy)void(^searchDeviceTask)();
-
 //
 -(void)reloadData;
 

+ 3 - 7
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/UI/SearchDeviceViewController.m

@@ -13,7 +13,6 @@
 @interface SearchDeviceViewController ()<ConnectDeviceDelegate>
 //
 @property (strong, nonatomic)ShoesCarouselView * shoesCarouselView;
-@property (nonatomic, strong) NSMutableArray *array;
 
 //button
 @property(nonatomic,strong)UIButton * nextButton;//
@@ -28,9 +27,6 @@
 
 @implementation SearchDeviceViewController
 
-
-
-
 -(void)viewDidLoad{
     
     [super viewDidLoad];
@@ -119,7 +115,7 @@
     self.connectButton.backgroundColor = [UIColor colorWithRed:255/255.0 green:221/255.0 blue:0/255.0 alpha:1.0];
     self.connectButton.layer.masksToBounds = YES;
     self.connectButton.layer.cornerRadius = SCALEoefficient(20);
-    [self.connectButton setImageEdgeInsets:UIEdgeInsetsMake(0, SCALEoefficient(-15), 15, 0)];
+    [self.connectButton setImageEdgeInsets:UIEdgeInsetsMake(0, SCALEoefficient(-15), 0, 0)];
 //    self.connectButton.imageView.contentMode = UIViewContentModeScaleAspectFit;
     
     NSArray * array = @[@"gamepop_leftarrow_notes",@"gamepop_rihgtarrow_notes",@"gamepop_close_notes",@"gamepop_determine_notes"];
@@ -168,7 +164,7 @@
         TXCarouselCellModel *model = [[TXCarouselCellModel alloc]init];
         model.newsId = i;
         model.peripheral = self.deviceArray[i];
-//        NSLog(@"model.peripheral === >> %@",model.peripheral.name);
+        NSLog(@"model.peripheral === >> %@",model.peripheral.name);
         [dataArr addObject:model];
     }
     [self.shoesCarouselView setArrayData:dataArr];
@@ -214,7 +210,7 @@
 //
 //    self.tipView.hidden = NO;
 //    if(self.searchDeviceTask){
-//        self.searchDeviceTask();
+//        [BTDataInstance initCBCentralManager];
 //    }
 //
 //}

binární
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/shoe_sdk_c/shoes_sdk_2.0/.DS_Store


+ 1 - 1
DanceGame/Classes/UnityAppController.h

@@ -8,7 +8,7 @@
 @class UnityViewControllerBase;
 @class DisplayConnection;
 
-@interface UnityAppController : NSObject<UIApplicationDelegate>
+@interface UnityAppController : NSObject<UIApplicationDelegate,UIAlertViewDelegate>
 {
     UnityView*          _unityView;
     CADisplayLink*      _displayLink;

+ 32 - 11
DanceGame/Classes/UnityAppController.mm

@@ -297,7 +297,7 @@ extern "C" void UnityRequestQuit()
 
     //注册初始化
     [[FitfunSDKManager ff_sharedInstance] ff_registerSDK];
-    
+   
 //     [FitfunSDKManager application:application didFinishLaunchingWithOptions:launchOptions];
     
 //    以下是几种打开App方式
@@ -312,12 +312,22 @@ extern "C" void UnityRequestQuit()
       NSURL *url = [launchOptions objectForKey:UIApplicationLaunchOptionsURLKey];
          NSLog(@"打开方式 通过URL打开的  ===== >> %@",url);
          IOSPlatformSDK * sdk = [IOSPlatformSDK sharedInstance];
-         sdk.openStyle = @"启动前 通过URL打开的";
          [sdk startWithUrl:url];
      }else if (!launchOptions){
          NSLog(@"打开方式 手动点击打开");
-         IOSPlatformSDK * sdk = [IOSPlatformSDK sharedInstance];
-         sdk.openStyle = @"手动打开";
+        [IOSPlatformSDK sharedInstance];
+//         BOOL QA = [[FitfunYDManager ff_sharedInstance] judegServerEnvironmentQA];
+//         NSLog(@"Unity 请求用户信息 GetUserInfoJson ===>> %d",QA);
+//             if (QA == 0) {//正式环境+无数据=桌面启动
+//             //应该是这个,如果不允许的话
+//             UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示"
+//                                                             message:@"请从趣动启动"
+//                                                            delegate:self
+//                                                   cancelButtonTitle:@"确定"
+//                                                   otherButtonTitles:nil];
+//             [alert show];
+//
+//         }
      }
     
      [Bugly startWithAppId:@"403d275730"];
@@ -325,11 +335,24 @@ extern "C" void UnityRequestQuit()
     
 }
 
+//kill 程序
+- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
+{
+    NSLog(@"clickedButtonAtIndex");
+    UIWindow *window = [UIApplication sharedApplication].delegate.window;
+     
+    [UIView animateWithDuration:1.0f animations:^{
+        window.alpha = 0;
+        window.frame = CGRectMake(0, window.bounds.size.width, 0, 0);
+    } completion:^(BOOL finished) {
+        exit(0);
+    }];
+ 
+}
+
 - (void)applicationDidEnterBackground:(UIApplication*)application{
     ::printf("-> applicationDidEnterBackground()\n");
-    //开启后台任务保活
-    BTDataProcess * sharedInstance =  [BTDataProcess sharedInstance];
-    sharedInstance.isBackGround = YES;
+
     //开启后台任务保活
 //    [self comeToBackgroundMode];
     
@@ -339,16 +362,14 @@ extern "C" void UnityRequestQuit()
 {
     ::printf("-> applicationWillEnterForeground()\n");
     
-    BTDataProcess * sharedInstance =  [BTDataProcess sharedInstance];
-    sharedInstance.isBackGround = NO;
-    [sharedInstance applicationWillEnterForeground];
-    
+
     // applicationWillEnterForeground: might sometimes arrive *before* actually initing unity (e.g. locking on startup)
     if (_unityAppReady)
     {
         // if we were showing video before going to background - the view size may be changed while we are in background
         [GetAppController().unityView recreateRenderingSurfaceIfNeeded];
     }
+    
 }
 
 

+ 0 - 0
DanceGame/Unity-iPhone/Images.xcassets/LaunchImage.launchimage/Default-Landscape-736h@3x.png → DanceGame/DefaultLandscape.png


+ 3 - 1
DanceGame/Info.plist

@@ -5,7 +5,7 @@
 	<key>CFBundleDevelopmentRegion</key>
 	<string>zh_CN</string>
 	<key>CFBundleDisplayName</key>
-	<string>DanceGame</string>
+	<string>趣动舞蹈</string>
 	<key>CFBundleExecutable</key>
 	<string>${EXECUTABLE_NAME}</string>
 	<key>CFBundleIconFiles</key>
@@ -251,6 +251,8 @@
 			<string>{768, 1024}</string>
 		</dict>
 	</array>
+	<key>UILaunchStoryboardName</key>
+	<string>LaunchScreen-iPhone</string>
 	<key>UILaunchStoryboardName~ipad</key>
 	<string>LaunchScreen</string>
 	<key>UILaunchStoryboardName~iphone</key>

+ 3 - 4
DanceGame/LaunchScreen-iPad.storyboard

@@ -1,10 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="UnityLaunchScreen-ViewController">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="UnityLaunchScreen-ViewController">
     <device id="ipad9_7" orientation="portrait" layout="fullscreen" appearance="light"/>
     <dependencies>
         <deployment version="4352" identifier="iOS"/>
-        <development version="9000" identifier="xcode"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <scenes>
@@ -39,6 +38,6 @@
         </scene>
     </scenes>
     <resources>
-        <image name="LaunchScreen-iPad.png" width="2208" height="1242"/>
+        <image name="LaunchScreen-iPad.png" width="1" height="1"/>
     </resources>
 </document>

+ 7 - 8
DanceGame/LaunchScreen-iPhone.storyboard

@@ -1,10 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="UnityLaunchScreen-ViewController">
-    <device id="ipad9_7" orientation="portrait" layout="fullscreen" appearance="light"/>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="UnityLaunchScreen-ViewController">
+    <device id="retina6_0" orientation="landscape" appearance="light"/>
     <dependencies>
         <deployment version="4352" identifier="iOS"/>
-        <development version="9000" identifier="xcode"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <scenes>
@@ -17,11 +16,11 @@
                         <viewControllerLayoutGuide type="bottom" id="BH2-mn-4Lm"/>
                     </layoutGuides>
                     <view key="view" userInteractionEnabled="NO" contentMode="scaleToFill" id="UnityLaunchScreen-RootView" userLabel="RootView">
-                        <rect key="frame" x="0.0" y="0.0" width="768" height="1024"/>
+                        <rect key="frame" x="0.0" y="0.0" width="844" height="390"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
-                            <imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="LaunchScreen-iPhonePortrait.png" translatesAutoresizingMaskIntoConstraints="NO" id="UnityLaunchScreen-ImageView" userLabel="ImageView">
-                                <rect key="frame" x="0.0" y="0.0" width="768" height="1024"/>
+                            <imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="2208x1142.jpg" translatesAutoresizingMaskIntoConstraints="NO" id="UnityLaunchScreen-ImageView" userLabel="ImageView">
+                                <rect key="frame" x="0.0" y="0.0" width="844" height="390"/>
                             </imageView>
                         </subviews>
                         <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@@ -39,6 +38,6 @@
         </scene>
     </scenes>
     <resources>
-        <image name="LaunchScreen-iPhonePortrait.png" width="1242" height="2208"/>
+        <image name="2208x1142.jpg" width="2208" height="1242"/>
     </resources>
 </document>

binární
DanceGame/LaunchScreen-iPhoneLandscape.png


binární
DanceGame/LaunchScreen-iPhonePortrait.png


binární
DanceGame/LaunchScreenImage-Landscape.png


binární
DanceGame/LaunchScreenImage-Portrait.png


+ 2 - 3
DanceGame/Unity-iPhone Tests/Unity_iPhone_Tests.m

@@ -24,14 +24,13 @@
     // player loop here.
 #ifdef PLATFORM_TVOS
     UnityAppController* unityApp = [(UIApplication*)[UIApplication sharedApplication] delegate];
-    while (running)
-    {
+    while (running){
         [unityApp repaint];
         [[NSRunLoop mainRunLoop] runUntilDate: [NSDate dateWithTimeIntervalSinceNow: 0.001f]];
     }
 #endif
-
     [self waitForExpectationsWithTimeout: 1000000 handler: nil];
+    
 }
 
 @end

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 469 - 492
DanceGame/Unity-iPhone.xcodeproj/project.pbxproj


+ 3 - 3
DanceGame/Unity-iPhone.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings

@@ -2,7 +2,7 @@
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
-	<key>BuildSystemType</key>
-	<string>Original</string>
+	<key>PreviewsEnabled</key>
+	<false/>
 </dict>
-</plist>
+</plist>

binární
DanceGame/Unity-iPhone.xcodeproj/project.xcworkspace/xcuserdata/duowan123.xcuserdatad/UserInterfaceState.xcuserstate


+ 18 - 0
DanceGame/Unity-iPhone.xcodeproj/project.xcworkspace/xcuserdata/duowan123.xcuserdatad/WorkspaceSettings.xcsettings

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>BuildLocationStyle</key>
+	<string>UseAppPreferences</string>
+	<key>CustomBuildLocationType</key>
+	<string>RelativeToDerivedData</string>
+	<key>DerivedDataLocationStyle</key>
+	<string>Default</string>
+	<key>IssueFilterStyle</key>
+	<string>ShowActiveSchemeOnly</string>
+	<key>LiveSourceIssuesEnabled</key>
+	<true/>
+	<key>ShowSharedSchemesAutomaticallyEnabled</key>
+	<true/>
+</dict>
+</plist>

+ 6 - 0
DanceGame/Unity-iPhone.xcodeproj/xcuserdata/duowan123.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Bucket
+   uuid = "215AE89F-B36F-4AFC-81C4-3331868F0444"
+   type = "1"
+   version = "2.0">
+</Bucket>

+ 47 - 67
DanceGame/Unity-iPhone/Images.xcassets/LaunchImage.launchimage/Contents.json

@@ -3,31 +3,30 @@
     {
       "extent" : "full-screen",
       "idiom" : "iphone",
-      "filename" : "Default.png",
+      "minimum-system-version" : "8.0",
       "orientation" : "portrait",
-      "scale" : "1x"
+      "scale" : "3x",
+      "subtype" : "736h"
     },
     {
       "extent" : "full-screen",
       "idiom" : "iphone",
-      "filename" : "Default@2x.png",
-      "minimum-system-version" : "7.0",
-      "orientation" : "portrait",
-      "scale" : "2x"
+      "minimum-system-version" : "8.0",
+      "orientation" : "landscape",
+      "scale" : "3x",
+      "subtype" : "736h"
     },
     {
       "extent" : "full-screen",
       "idiom" : "iphone",
-      "subtype" : "retina4",
-      "filename" : "Default-568h@2x.png",
+      "minimum-system-version" : "8.0",
       "orientation" : "portrait",
-      "scale" : "2x"
+      "scale" : "2x",
+      "subtype" : "667h"
     },
     {
       "extent" : "full-screen",
       "idiom" : "iphone",
-      "subtype" : "retina4",
-      "filename" : "Default-568h@2x.png",
       "minimum-system-version" : "7.0",
       "orientation" : "portrait",
       "scale" : "2x"
@@ -35,128 +34,109 @@
     {
       "extent" : "full-screen",
       "idiom" : "iphone",
-      "filename" : "Default@2x.png",
+      "minimum-system-version" : "7.0",
       "orientation" : "portrait",
-      "scale" : "2x"
+      "scale" : "2x",
+      "subtype" : "retina4"
     },
     {
-      "extent" : "to-status-bar",
+      "extent" : "full-screen",
       "idiom" : "ipad",
-      "filename" : "Default~ipad.png",
+      "minimum-system-version" : "7.0",
       "orientation" : "portrait",
       "scale" : "1x"
     },
     {
-      "extent" : "to-status-bar",
-      "idiom" : "ipad",
-      "filename" : "Default~ipad@2x.png",
-      "orientation" : "portrait",
-      "scale" : "2x"
-    },
-    {
-      "extent" : "to-status-bar",
+      "extent" : "full-screen",
       "idiom" : "ipad",
-      "filename" : "Default~ipad~landscape.png",
+      "minimum-system-version" : "7.0",
       "orientation" : "landscape",
       "scale" : "1x"
     },
     {
-      "extent" : "to-status-bar",
+      "extent" : "full-screen",
       "idiom" : "ipad",
-      "filename" : "Default~ipad~landscape@2x.png",
-      "orientation" : "landscape",
+      "minimum-system-version" : "7.0",
+      "orientation" : "portrait",
       "scale" : "2x"
     },
     {
       "extent" : "full-screen",
       "idiom" : "ipad",
-      "filename" : "Default~ipad~nostatusbar.png",
       "minimum-system-version" : "7.0",
-      "orientation" : "portrait",
-      "scale" : "1x"
+      "orientation" : "landscape",
+      "scale" : "2x"
     },
     {
       "extent" : "full-screen",
-      "idiom" : "ipad",
-      "filename" : "Default~ipad~nostatusbar.png",
+      "idiom" : "iphone",
       "orientation" : "portrait",
       "scale" : "1x"
     },
     {
       "extent" : "full-screen",
-      "idiom" : "ipad",
-      "filename" : "Default~ipad~nostatusbar@2x.png",
-      "minimum-system-version" : "7.0",
+      "idiom" : "iphone",
       "orientation" : "portrait",
       "scale" : "2x"
     },
     {
       "extent" : "full-screen",
+      "idiom" : "iphone",
+      "orientation" : "portrait",
+      "scale" : "2x",
+      "subtype" : "retina4"
+    },
+    {
+      "extent" : "to-status-bar",
       "idiom" : "ipad",
-      "filename" : "Default~ipad~nostatusbar@2x.png",
       "orientation" : "portrait",
-      "scale" : "2x"
+      "scale" : "1x"
     },
     {
       "extent" : "full-screen",
       "idiom" : "ipad",
-      "filename" : "Default~ipad~landscape~nostatusbar.png",
-      "minimum-system-version" : "7.0",
-      "orientation" : "landscape",
+      "orientation" : "portrait",
       "scale" : "1x"
     },
     {
-      "extent" : "full-screen",
+      "extent" : "to-status-bar",
       "idiom" : "ipad",
-      "filename" : "Default~ipad~landscape~nostatusbar.png",
       "orientation" : "landscape",
       "scale" : "1x"
     },
     {
       "extent" : "full-screen",
       "idiom" : "ipad",
-      "filename" : "Default~ipad~landscape~nostatusbar@2x.png",
-      "minimum-system-version" : "7.0",
       "orientation" : "landscape",
-      "scale" : "2x"
+      "scale" : "1x"
     },
     {
-      "extent" : "full-screen",
+      "extent" : "to-status-bar",
       "idiom" : "ipad",
-      "filename" : "Default~ipad~landscape~nostatusbar@2x.png",
-      "orientation" : "landscape",
+      "orientation" : "portrait",
       "scale" : "2x"
     },
     {
       "extent" : "full-screen",
-      "idiom" : "iphone",
-      "subtype" : "736h",
-      "filename" : "Default-Portrait-736h@3x.png",
-      "minimum-system-version" : "8.0",
+      "idiom" : "ipad",
       "orientation" : "portrait",
-      "scale" : "3x"
+      "scale" : "2x"
     },
     {
-      "extent" : "full-screen",
-      "idiom" : "iphone",
-      "subtype" : "736h",
-      "filename" : "Default-Landscape-736h@3x.png",
-      "minimum-system-version" : "8.0",
+      "extent" : "to-status-bar",
+      "idiom" : "ipad",
       "orientation" : "landscape",
-      "scale" : "3x"
+      "scale" : "2x"
     },
     {
       "extent" : "full-screen",
-      "idiom" : "iphone",
-      "subtype" : "667h",
-      "filename" : "Default-667h@2x.png",
-      "minimum-system-version" : "8.0",
-      "orientation" : "portrait",
+      "idiom" : "ipad",
+      "orientation" : "landscape",
       "scale" : "2x"
     }
   ],
   "info" : {
-    "version" : 1,
-    "author" : "xcode"
+    "author" : "xcode",
+    "version" : 1
   }
-}
+}

binární
DanceGame/Unity-iPhone/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png


binární
DanceGame/Unity-iPhone/Images.xcassets/LaunchImage.launchimage/Default-667h@2x.png


binární
DanceGame/Unity-iPhone/Images.xcassets/LaunchImage.launchimage/Default-Portrait-736h@3x.png


binární
DanceGame/Unity-iPhone/Images.xcassets/LaunchImage.launchimage/Default.png


binární
DanceGame/Unity-iPhone/Images.xcassets/LaunchImage.launchimage/Default@2x.png


binární
DanceGame/Unity-iPhone/Images.xcassets/LaunchImage.launchimage/Default~ipad.png


binární
DanceGame/Unity-iPhone/Images.xcassets/LaunchImage.launchimage/Default~ipad@2x.png


binární
DanceGame/Unity-iPhone/Images.xcassets/LaunchImage.launchimage/Default~ipad~landscape.png


binární
DanceGame/Unity-iPhone/Images.xcassets/LaunchImage.launchimage/Default~ipad~landscape@2x.png


binární
DanceGame/Unity-iPhone/Images.xcassets/LaunchImage.launchimage/Default~ipad~landscape~nostatusbar.png


binární
DanceGame/Unity-iPhone/Images.xcassets/LaunchImage.launchimage/Default~ipad~landscape~nostatusbar@2x.png


binární
DanceGame/Unity-iPhone/Images.xcassets/LaunchImage.launchimage/Default~ipad~nostatusbar.png


binární
DanceGame/Unity-iPhone/Images.xcassets/LaunchImage.launchimage/Default~ipad~nostatusbar@2x.png


+ 3 - 1
DanceGame/Unity-iPhone/cn.entitlements

@@ -3,6 +3,8 @@
 <plist version="1.0">
 <dict>
 	<key>com.apple.security.application-groups</key>
-	<array/>
+	<array>
+		<string>group.com.Oujia.AppAndGame</string>
+	</array>
 </dict>
 </plist>

+ 2 - 2
README.md

@@ -7,7 +7,7 @@ IDE:xcode 12.5以上
 ```
 
 #### <2>配置证书:
-1.打开xcode,在工具栏Preference -> Accounts处添加公司开发者账号:
+1.打开xcode,在工具栏Preference ->+ Accounts处添加公司开发者账号:
 ```
 账号:gzouyou@163.com
 密码:Gzouyou1
@@ -18,4 +18,4 @@ IDE:xcode 12.5以上
 ```
 1.真机调试:打开xcode,在edit scheme位置选中你要调试的真机,command+R
 2.导出ipa包:打开xcode,在工具栏选中Product -> Archive -> Distribute App -> AppStore/Ad hoc -> Expert
-```
+```

binární
RunGame/.DS_Store


Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů