فهرست منبع

我的设备剔除

lvjincheng 3 سال پیش
والد
کامیت
2069663429

+ 19 - 8
Assets/BowArrow/Resources/Prefabs/Views/DeviceView.prefab

@@ -109,9 +109,9 @@ RectTransform:
   m_Father: {fileID: 3543481331434029199}
   m_RootOrder: 0
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
-  m_AnchorMin: {x: 0, y: 0}
-  m_AnchorMax: {x: 0, y: 0}
-  m_AnchoredPosition: {x: 0, y: 0}
+  m_AnchorMin: {x: 0, y: 1}
+  m_AnchorMax: {x: 0, y: 1}
+  m_AnchoredPosition: {x: 50, y: -28}
   m_SizeDelta: {x: 201, y: 56}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!222 &4542964095527048273
@@ -547,9 +547,9 @@ RectTransform:
   m_Father: {fileID: 3543481331434029199}
   m_RootOrder: 1
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
-  m_AnchorMin: {x: 0, y: 0}
-  m_AnchorMax: {x: 0, y: 0}
-  m_AnchoredPosition: {x: 0, y: 0}
+  m_AnchorMin: {x: 0, y: 1}
+  m_AnchorMax: {x: 0, y: 1}
+  m_AnchoredPosition: {x: 50, y: -99}
   m_SizeDelta: {x: 201, y: 56}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!222 &5737319029028786020
@@ -850,6 +850,7 @@ MonoBehaviour:
   textID: 14
   layoutRebuildObject: {fileID: 0}
   textFormatArgs: []
+  languageFontSizes: []
 --- !u!1 &4079762785333813956
 GameObject:
   m_ObjectHideFlags: 0
@@ -1215,7 +1216,7 @@ GameObject:
   m_Icon: {fileID: 0}
   m_NavMeshLayer: 0
   m_StaticEditorFlags: 0
-  m_IsActive: 1
+  m_IsActive: 0
 --- !u!224 &3543481331434029199
 RectTransform:
   m_ObjectHideFlags: 0
@@ -1523,6 +1524,7 @@ MonoBehaviour:
   textID: 500
   layoutRebuildObject: {fileID: 0}
   textFormatArgs: []
+  languageFontSizes: []
 --- !u!1 &6926199113413025615
 GameObject:
   m_ObjectHideFlags: 0
@@ -1618,6 +1620,7 @@ MonoBehaviour:
   textID: 502
   layoutRebuildObject: {fileID: 0}
   textFormatArgs: []
+  languageFontSizes: []
 --- !u!1 &7019445005435185944
 GameObject:
   m_ObjectHideFlags: 0
@@ -1821,6 +1824,7 @@ MonoBehaviour:
   textID: 504
   layoutRebuildObject: {fileID: 0}
   textFormatArgs: []
+  languageFontSizes: []
 --- !u!1 &7985663070476847356
 GameObject:
   m_ObjectHideFlags: 0
@@ -1916,6 +1920,7 @@ MonoBehaviour:
   textID: 501
   layoutRebuildObject: {fileID: 0}
   textFormatArgs: []
+  languageFontSizes: []
 --- !u!1 &8101875084823499781
 GameObject:
   m_ObjectHideFlags: 0
@@ -2415,6 +2420,7 @@ MonoBehaviour:
   textID: 0
   layoutRebuildObject: {fileID: 0}
   textFormatArgs: []
+  languageFontSizes: []
 --- !u!1 &8677266361357496147
 GameObject:
   m_ObjectHideFlags: 0
@@ -2692,6 +2698,7 @@ MonoBehaviour:
   textID: 0
   layoutRebuildObject: {fileID: 0}
   textFormatArgs: []
+  languageFontSizes: []
 --- !u!1 &8677266361696092475
 GameObject:
   m_ObjectHideFlags: 0
@@ -2825,6 +2832,7 @@ MonoBehaviour:
   textID: 0
   layoutRebuildObject: {fileID: 0}
   textFormatArgs: []
+  languageFontSizes: []
 --- !u!1 &8677266361829081374
 GameObject:
   m_ObjectHideFlags: 0
@@ -3314,7 +3322,7 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0, y: 0}
   m_AnchorMax: {x: 0, y: 0}
-  m_AnchoredPosition: {x: 108.26143, y: 0}
+  m_AnchoredPosition: {x: 105.223274, y: 0}
   m_SizeDelta: {x: 0, y: 0}
   m_Pivot: {x: 1, y: 0.5}
 --- !u!222 &8677266362387219396
@@ -3374,6 +3382,7 @@ MonoBehaviour:
   textID: 68
   layoutRebuildObject: {fileID: 0}
   textFormatArgs: []
+  languageFontSizes: []
 --- !u!114 &947526348215273518
 MonoBehaviour:
   m_ObjectHideFlags: 0
@@ -3499,6 +3508,7 @@ MonoBehaviour:
   textID: 23
   layoutRebuildObject: {fileID: 0}
   textFormatArgs: []
+  languageFontSizes: []
 --- !u!1 &8677266362436726988
 GameObject:
   m_ObjectHideFlags: 0
@@ -4484,3 +4494,4 @@ MonoBehaviour:
   textID: 503
   layoutRebuildObject: {fileID: 0}
   textFormatArgs: []
+  languageFontSizes: []

+ 26 - 25
Assets/BowArrow/Scripts/Bluetooth/ShootCheck.cs

@@ -115,23 +115,23 @@ public class ShootCheck : MonoBehaviour
     }
     public void OnBluetoothReady(BluetoothShoot bluetoothShoot) 
     {
-        if (LoginMgr.myUserInfo.arrowAccValue == 16)
-        {
-            cmd.a = "y";
-        }
-        else
-        {
-            cmd.a = "x";
-        }
+        // if (LoginMgr.myUserInfo.arrowAccValue == 16)
+        // {
+        //     cmd.a = "y";
+        // }
+        // else
+        // {
+        //     cmd.a = "x";
+        // }
 
-        bluetoothShoot.WriteData(JsonUtility.ToJson(cmd).Replace("\"", ""));
+        // bluetoothShoot.WriteData(JsonUtility.ToJson(cmd).Replace("\"", ""));
 
-        Sequence sequence = DOTween.Sequence();
-        sequence.PrependInterval(1).AppendCallback(delegate() {
-            canAdjustNormalOrHightMode = true;
-            AdjustNormalOrHightMode();
-        });
-        sequence.SetUpdate(true);
+        // Sequence sequence = DOTween.Sequence();
+        // sequence.PrependInterval(1).AppendCallback(delegate() {
+        //     canAdjustNormalOrHightMode = true;
+        //     AdjustNormalOrHightMode();
+        // });
+        // sequence.SetUpdate(true);
     }
 
     //===普通模式和高速模式的切换===
@@ -215,7 +215,8 @@ public class ShootCheck : MonoBehaviour
     float ToAcceleratedSpeed(byte b1, byte b2)
     {
         int value = TwoByteToInt(b1, b2);
-        return (float)value / 32768 * LoginMgr.myUserInfo.arrowAccValue;
+        // return (float)value / 32768 * LoginMgr.myUserInfo.arrowAccValue;
+        return (float)value / 32768;
     }
     
     int TwoByteToInt(byte b1, byte b2)
@@ -241,15 +242,15 @@ public class ShootCheck : MonoBehaviour
             {
                 maxAcc = acc;
             }
-            if (acc > 15.9f && LoginMgr.myUserInfo.arrowAccValue == 16) {
-                double p1 = -1.56729339506415;
-                double p2 = 0.0397744840580165;
-                double p3 = 4.73453844008481;
-
-                float x = (keyAccList.Count + 1) * 2; //单位毫秒
-                double y = 1.0 / (p1+p2*Mathf.Pow(x, 0.5f)*Mathf.Log(x)+p3/Mathf.Pow(x, 0.5f));
-                acc = (float) y;
-            }
+            // if (acc > 15.9f && LoginMgr.myUserInfo.arrowAccValue == 16) {
+            //     double p1 = -1.56729339506415;
+            //     double p2 = 0.0397744840580165;
+            //     double p3 = 4.73453844008481;
+
+            //     float x = (keyAccList.Count + 1) * 2; //单位毫秒
+            //     double y = 1.0 / (p1+p2*Mathf.Pow(x, 0.5f)*Mathf.Log(x)+p3/Mathf.Pow(x, 0.5f));
+            //     acc = (float) y;
+            // }
             Vector3 keyAcc = new Vector3(ax, acc, az);
             keyAccList.Enqueue(keyAcc);
             keyTimeList.Enqueue(t);

+ 2 - 1
Assets/BowArrow/Scripts/Manager/DeviceMgr.cs

@@ -26,7 +26,8 @@ public class DeviceMgr
         List<DeviceInfo> deviceInfos = LoginMgr.myUserInfo.deviceList;
         if (deviceInfos.Count == 0) {
             // 加入初始设备
-            int[] ids = {1000, 1001, 2000};
+            // int[] ids = {1000, 1001, 2000};
+            int[] ids = {1000, 2000};
             foreach (var id in ids) {
                 DeviceInfo deviceInfo = new DeviceInfo();
                 deviceInfo.id = id;

+ 1 - 2
Assets/BowArrow/Scripts/Manager/LoginMgr.cs

@@ -318,8 +318,8 @@ public class UserInfo {
     public string pwd = "";
     public int avatarID = 0;
     public string nickname = "超级射手";
-    public string phone = "";
     public int gender = 0;
+    public string phone = "";
     public string birthday = "";
     public string national = "";
     public string region = "";
@@ -328,7 +328,6 @@ public class UserInfo {
     public int diamond = 1000;
     public List<PropInfo> bagList = new List<PropInfo>();
     public List<DeviceInfo> deviceList = new List<DeviceInfo>();
-    public int arrowAccValue = 16;
     public Hashtable timeLimitGameHighestScores = new Hashtable();
     public bool deviceCalibrateGuideFinish = false;
     public bool gameRule1GuideFinish = false;

+ 40 - 38
Assets/BowArrow/Scripts/View/DeviceView.cs

@@ -68,29 +68,29 @@ public class DeviceView : MonoBehaviour
             });
         }
         //初始化箭的加速计按钮选项
-        Button[] arrowOptionBtns = arrowOptions.GetComponentsInChildren<Button>();
-        for (int i = 0; i < arrowOptionBtns.Length; i++)
-        {
-            int optionID = i;
-            arrowOptionBtns[i].onClick.AddListener(delegate() {
-                AudioMgr.ins.PlayBtn();
-                //select
-                int acc = 16;
-                if (optionID == 1) {
-                    acc = 64;
-                }
-                SelectAccForArrow(acc);
-                //save
-                LoginMgr.myUserInfo.arrowAccValue = acc;
-                LoginMgr.myUserInfo.Save();
+        // Button[] arrowOptionBtns = arrowOptions.GetComponentsInChildren<Button>();
+        // for (int i = 0; i < arrowOptionBtns.Length; i++)
+        // {
+        //     int optionID = i;
+        //     arrowOptionBtns[i].onClick.AddListener(delegate() {
+        //         AudioMgr.ins.PlayBtn();
+        //         //select
+        //         int acc = 16;
+        //         if (optionID == 1) {
+        //             acc = 64;
+        //         }
+        //         SelectAccForArrow(acc);
+        //         //save
+        //         LoginMgr.myUserInfo.arrowAccValue = acc;
+        //         LoginMgr.myUserInfo.Save();
 
-                //关闭设备连接,用于提醒更换设备
-                if (BluetoothShoot.ins.status == BluetoothStatusEnum.ConnectSuccess) {
-                    BluetoothShoot.ins.DoConnect();
-                }
-            });
-        }
-        SelectAccForArrow(LoginMgr.myUserInfo.arrowAccValue);
+        //         //关闭设备连接,用于提醒更换设备
+        //         if (BluetoothShoot.ins.status == BluetoothStatusEnum.ConnectSuccess) {
+        //             BluetoothShoot.ins.DoConnect();
+        //         }
+        //     });
+        // }
+        // SelectAccForArrow(LoginMgr.myUserInfo.arrowAccValue);
     }
 
     void FixedUpdate()
@@ -99,7 +99,7 @@ public class DeviceView : MonoBehaviour
     }
 
     BluetoothStatusEnum bowStatus;
-    BluetoothStatusEnum arrowStatus;
+    // BluetoothStatusEnum arrowStatus;
     void UpdateBtnForConnect() {
         if (currentDeviceInfo == null) return;
         if (currentDeviceInfo.inuse && currentDeviceInfo.config.type == 1) {
@@ -115,19 +115,19 @@ public class DeviceView : MonoBehaviour
                 }
             }
         }
-        if (currentDeviceInfo.inuse && currentDeviceInfo.config.type == 2) {
-            if (BluetoothShoot.ins && arrowStatus != BluetoothShoot.ins.status) {
-                arrowStatus = BluetoothShoot.ins.status;
-                (int textID, Color color) = BluetoothStatus.GetStatusInfo(BluetoothShoot.ins.status);
-                btnConnect.GetComponentInChildren<TextAutoLanguage>().SetText(textID);
-                btnConnect.GetComponentInChildren<Text>().color = color;
-                if (BluetoothShoot.ins.status == BluetoothStatusEnum.Connect) {
-                    btnConnect.GetComponent<Button>().enabled = true;
-                } else {
-                    btnConnect.GetComponent<Button>().enabled = false;
-                }
-            }
-        }
+        // if (currentDeviceInfo.inuse && currentDeviceInfo.config.type == 2) {
+        //     if (BluetoothShoot.ins && arrowStatus != BluetoothShoot.ins.status) {
+        //         arrowStatus = BluetoothShoot.ins.status;
+        //         (int textID, Color color) = BluetoothStatus.GetStatusInfo(BluetoothShoot.ins.status);
+        //         btnConnect.GetComponentInChildren<TextAutoLanguage>().SetText(textID);
+        //         btnConnect.GetComponentInChildren<Text>().color = color;
+        //         if (BluetoothShoot.ins.status == BluetoothStatusEnum.Connect) {
+        //             btnConnect.GetComponent<Button>().enabled = true;
+        //         } else {
+        //             btnConnect.GetComponent<Button>().enabled = false;
+        //         }
+        //     }
+        // }
     }
 
     void SelectAccForArrow(float acc)
@@ -178,14 +178,16 @@ public class DeviceView : MonoBehaviour
                 i <= deviceInfo.config.difficulty ? starLight.sprite : starDark.sprite;
         }
         bowOptions.SetActive(deviceInfo.config.type == 1);
-        arrowOptions.SetActive(deviceInfo.config.type == 2);
+        // arrowOptions.SetActive(deviceInfo.config.type == 2);
         //重置连接按钮
         (int textID, Color color) = BluetoothStatus.GetStatusInfo(BluetoothStatusEnum.Connect);
         btnConnect.GetComponentInChildren<TextAutoLanguage>().SetText(textID);
         btnConnect.GetComponentInChildren<Text>().color = color;
         btnConnect.GetComponent<Button>().enabled = true;
         bowStatus = BluetoothStatusEnum.None;
-        arrowStatus = BluetoothStatusEnum.None;
+        // arrowStatus = BluetoothStatusEnum.None;
+        //是弓才激活连接按钮
+        btnConnect.gameObject.SetActive(currentDeviceInfo.config.type == 1);
     }
 
     public void LeftPointer()