Browse Source

1.添加b端环境处理。修改游戏单机版适配等

slambb 1 year ago
parent
commit
13523076d0
37 changed files with 1574 additions and 632 deletions
  1. 3 0
      Assets/AppleSignInUnity/AppleAuthSample/AppleLoginHelper.cs
  2. 15 3
      Assets/BowArrow/InfraredCamera/InfraredDemo.cs
  3. 1 1
      Assets/BowArrow/InfraredCamera/Resources/InfraredDemo.prefab
  4. 1 1
      Assets/BowArrow/Resources/Prefabs/Views/Home/DeviceViewInfrared.prefab
  5. 7 2
      Assets/BowArrow/Resources/Prefabs/Views/Home/ModeSelectView.prefab
  6. 29 29
      Assets/BowArrow/Scripts/Bluetooth/BluetoothAim.cs
  7. 31 4
      Assets/BowArrow/Scripts/CommonConfig.cs
  8. 14 0
      Assets/BowArrow/Scripts/Components/TextAutoLanguage2/Resources/TextAutoLanguage2/cn.json
  9. 13 0
      Assets/BowArrow/Scripts/Components/TextAutoLanguage2/Resources/TextAutoLanguage2/en.json
  10. 3 2
      Assets/BowArrow/Scripts/Editor/EditPlay.cs
  11. 87 62
      Assets/BowArrow/Scripts/Game/GameAssistUI.cs
  12. 12 11
      Assets/BowArrow/Scripts/Manager/HomeMgr.cs
  13. 7 0
      Assets/BowArrow/Scripts/Manager/LoginMgr/LoginMgr.cs
  14. 2 3
      Assets/BowArrow/Scripts/Manager/ViewMgr.cs
  15. 9 1
      Assets/BowArrow/Scripts/Network/SocketComp/UserComp.cs
  16. 2 0
      Assets/BowArrow/Scripts/Standalone/StandaloneAPI.cs
  17. 2 1
      Assets/BowArrow/Scripts/View/Home/HomeView.cs
  18. 71 4
      Assets/BowArrow/Scripts/View/Home/HomeView_BottomBarView.cs
  19. 30 20
      Assets/BowArrow/Scripts/View/Home/HomeView_ChallengeOption.cs
  20. 64 31
      Assets/BowArrow/Scripts/View/Home/ModeSelectView.cs
  21. 46 44
      Assets/DuckHunter/Scripts/GameUI.cs
  22. 59 49
      Assets/FruitMaster/Scripts/OverallLogics.cs
  23. 34 26
      Assets/Game_Hyperspace/Script/UIManager.cs
  24. 292 294
      Assets/SmartBow/Resources/SmartBow/Prefabs/Views/Home/SettingsView.prefab
  25. 16 1
      Assets/SmartBow/Scripts/Views/GameResultView.cs
  26. 17 0
      Assets/SmartBow/Scripts/Views/InfraredViewParts/InfraredScreenPositioningView.cs
  27. 136 17
      Assets/SmartBow/Scripts/Views/SettingsView.cs
  28. 72 0
      Assets/SmartBow/Scripts/Views/SettingsViewParts/BoxBackStageManagement.cs
  29. 11 0
      Assets/SmartBow/Scripts/Views/SettingsViewParts/BoxBackStageManagement.cs.meta
  30. 119 0
      Assets/SmartBow/Scripts/Views/SettingsViewParts/BoxUserSettings.cs
  31. 11 0
      Assets/SmartBow/Scripts/Views/SettingsViewParts/BoxUserSettings.cs.meta
  32. 87 9
      Assets/SmartBow/Scripts/Views/ViewManager2.cs
  33. BIN
      Assets/SmartBow/Textures/Settings/Level/SelectItem2.png
  34. 123 0
      Assets/SmartBow/Textures/Settings/Level/SelectItem2.png.meta
  35. BIN
      Assets/SmartBow/Textures/Settings/Level/SelectItem3.png
  36. 123 0
      Assets/SmartBow/Textures/Settings/Level/SelectItem3.png.meta
  37. 25 17
      Assets/WildAttack/Scripts/UI/MainPanel.cs

+ 3 - 0
Assets/AppleSignInUnity/AppleAuthSample/AppleLoginHelper.cs

@@ -30,6 +30,9 @@ public class AppleLoginHelper : MonoBehaviour
 
     private void Awake()
     {
+        if (CommonConfig.StandaloneMode) return;
+        string sceneName = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name;
+        Debug.Log("AppleLoginHelperµ±Ç°³¡¾°Ãû³Æ: " + sceneName);
         DontDestroyOnLoad(this);
         gameObject.name = "AppleLoginHelper";
         ins = this;

+ 15 - 3
Assets/BowArrow/InfraredCamera/InfraredDemo.cs

@@ -40,8 +40,15 @@ public class InfraredDemo : MonoBehaviour
         InitDebugScreenPoint();
         gameObject.AddComponent<FPSTester>();
 
-        mBtnSee.interactable = false;
-        mBtnSee.transform.Find("Text").GetComponent<Text>().text = "等待初始化..";
+        if (CommonConfig.StandaloneModeOrPlatformB)
+        {
+            mBtnSee.gameObject.SetActive(false);
+        }
+        else {
+            mBtnSee.interactable = false;
+            mBtnSee.transform.Find("Text").GetComponent<Text>().text = "等待初始化..";
+        }
+   
         //直接初始化一次
         //InitInfraredCamera();
 
@@ -73,7 +80,12 @@ public class InfraredDemo : MonoBehaviour
         _visiable = value;
         transform.Find("Background").gameObject.SetActive(value);
         transform.Find("InfraredCamera").gameObject.SetActive(value);
-        transform.Find("BtnSee").GetComponentInChildren<Text>().text = value ? "隐藏界面" : "调试红外";
+        //如果是b端,控制这里按钮显示
+        if (CommonConfig.StandaloneModeOrPlatformB)
+        {
+            mBtnSee.gameObject.SetActive(value);
+        }
+        mBtnSee.GetComponentInChildren<Text>().text = value ? "隐藏界面" : "调试红外";
         //if (value) InitInfraredCamera();
 
         if (!hasCalled && value)

+ 1 - 1
Assets/BowArrow/InfraredCamera/Resources/InfraredDemo.prefab

@@ -7994,7 +7994,7 @@ Canvas:
   m_VertexColorAlwaysGammaSpace: 0
   m_AdditionalShaderChannelsFlag: 0
   m_SortingLayerID: 0
-  m_SortingOrder: 1
+  m_SortingOrder: 9999
   m_TargetDisplay: 0
 --- !u!114 &8879181981555265241
 MonoBehaviour:

+ 1 - 1
Assets/BowArrow/Resources/Prefabs/Views/Home/DeviceViewInfrared.prefab

@@ -7105,7 +7105,7 @@ Canvas:
   m_VertexColorAlwaysGammaSpace: 0
   m_AdditionalShaderChannelsFlag: 0
   m_SortingLayerID: 0
-  m_SortingOrder: 1
+  m_SortingOrder: 10
   m_TargetDisplay: 0
 --- !u!114 &8677266362471276961
 MonoBehaviour:

+ 7 - 2
Assets/BowArrow/Resources/Prefabs/Views/Home/ModeSelectView.prefab

@@ -2588,6 +2588,7 @@ Canvas:
   m_OverrideSorting: 0
   m_OverridePixelPerfect: 0
   m_SortingBucketNormalizedSize: 0
+  m_VertexColorAlwaysGammaSpace: 0
   m_AdditionalShaderChannelsFlag: 0
   m_SortingLayerID: 0
   m_SortingOrder: 1
@@ -2644,7 +2645,11 @@ MonoBehaviour:
   m_Script: {fileID: 11500000, guid: 87584a66b237c3745895f24664bbf72a, type: 3}
   m_Name: 
   m_EditorClassIdentifier: 
-  isShowButton: 0
+  allButtons:
+  - {fileID: 5918711544913229050}
+  - {fileID: 5335974329003615350}
+  - {fileID: 8086339659889037025}
+  - {fileID: 8828427261806947588}
   buttons:
   - {fileID: 5918711544913229050}
   - {fileID: 5335974329003615350}
@@ -2678,7 +2683,7 @@ RectTransform:
   m_GameObject: {fileID: 8677266362914771145}
   m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
   m_LocalPosition: {x: 0, y: 0, z: 0}
-  m_LocalScale: {x: 1.0680318, y: 1.0680318, z: 1.0680318}
+  m_LocalScale: {x: 1, y: 1, z: 1}
   m_ConstrainProportionsScale: 0
   m_Children: []
   m_Father: {fileID: 8677266362471276963}

+ 29 - 29
Assets/BowArrow/Scripts/Bluetooth/BluetoothAim.cs

@@ -170,26 +170,26 @@ public class BluetoothAim : MonoBehaviour
             DoConnect();
         }
         if (doConnect) Connect();
-        if (CommonConfig.StandaloneMode)
-        {
-            if (!userDoConnect && status == BluetoothStatusEnum.Connect)
-            {
-                if (notUserDoConnectTime == 0)
-                {
-                    DoConnect();
-                    notUserDoConnectTime = 0.1f;
-                }
-                else
-                {
-                    notUserDoConnectTime += Time.deltaTime;
-                    if (notUserDoConnectTime > 2.5f)
-                    {
-                        DoConnect();
-                        notUserDoConnectTime = 0.1f;
-                    }
-                }
-            }
-        }
+        //if (CommonConfig.StandaloneMode)
+        //{
+        //    if (!userDoConnect && status == BluetoothStatusEnum.Connect)
+        //    {
+        //        if (notUserDoConnectTime == 0)
+        //        {
+        //            DoConnect();
+        //            notUserDoConnectTime = 0.1f;
+        //        }
+        //        else
+        //        {
+        //            notUserDoConnectTime += Time.deltaTime;
+        //            if (notUserDoConnectTime > 2.5f)
+        //            {
+        //                DoConnect();
+        //                notUserDoConnectTime = 0.1f;
+        //            }
+        //        }
+        //    }
+        //}
     }
 
     void SetStatus(BluetoothStatusEnum statusValue)
@@ -332,15 +332,15 @@ public class BluetoothAim : MonoBehaviour
                     {
                         if (status != BluetoothStatusEnum.ConnectSuccess) return;
                         InitWhenConenct();
-                        if (CommonConfig.StandaloneMode)
-                        {
-                            if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "Home"
-                                && PersistenHandler.ins.menuBackCtr.views.Count == 0
-                                && !FindObjectOfType<NewUserGuider>())
-                            {
-                                ViewMgr.Instance.ShowView<GameStartView>();
-                            }
-                        }
+                        //if (CommonConfig.StandaloneMode)
+                        //{
+                        //    if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "Home"
+                        //        && PersistenHandler.ins.menuBackCtr.views.Count == 0
+                        //        && !FindObjectOfType<NewUserGuider>())
+                        //    {
+                        //        ViewMgr.Instance.ShowView<GameStartView>();
+                        //    }
+                        //}
                     });
                 }
             };

+ 31 - 4
Assets/BowArrow/Scripts/CommonConfig.cs

@@ -79,13 +79,14 @@ public class CommonConfig
         {
             if (serverType == ServerType.Produce)
             {
-                Debug.Log("****************** 正式服务器: "+ serverIndex + " ********************");
+                Debug.Log("****************** 正式服务器: " + serverIndex + " ********************");
                 if (serverIndex == 0)
                     return "https://www.xmjssvr.com/SmartBowBusinessServer";//"http://118.195.187.121/SmartBowBusinessServer";等备案再使用域名
                 else if (serverIndex == 1)
                     return "https://www.wonderfittervr.com/SmartBowBusinessServer";//"http://54.165.56.200/SmartBowBusinessServer";
             }
-            else if(serverType == ServerType.Test) {
+            else if (serverType == ServerType.Test)
+            {
                 Debug.Log("****************** 测试服务器 ********************");
                 //测试服务器
                 return "http://www.b-beng.com/SmartBowBusinessServer";
@@ -103,17 +104,19 @@ public class CommonConfig
     /// </summary>
     public static readonly string SmartBowSdkURL = "http://43.132.127.96/SmartBowBusinessServer";
 
+
+    #region 根据不同平台不同版本配置打包 bool
     /// <summary>
     /// 单机模式是否开启
     /// </summary>
-    public static bool StandaloneMode = false;
+    public static bool StandaloneMode { get; } = false; // 默认false
 
     /// <summary>
     /// 是否开启设备验证。
     /// 暂时Pc开启验证
     /// </summary>
 #if UNITY_STANDALONE_WIN || UNITY_EDITOR
-    public static bool EnableDecryption = false;
+    public static bool EnableDecryption = false; // 默认true
 #else
     public static bool EnableDecryption = false;
 #endif
@@ -122,4 +125,28 @@ public class CommonConfig
     /// 是否打包红外软件App,这里主要和九轴有区别
     /// </summary>
     public static bool bInfraredApp { get; } = true;
+
+    //打包App 的端,比如打包B 端就设置 B
+    public static OperatingPlatform OP { get; } = OperatingPlatform.A;
+
+    //是否是投币功能
+    public static bool bSupportCoin { get; } = false; 
+
+    #endregion
+
+
+    //单机版,B端,投币功能
+    public static bool StandaloneModeOrPlatformB { get => StandaloneMode && OP == OperatingPlatform.B && bSupportCoin; }
+
 }
+
+//打包App 的端
+public enum OperatingPlatform
+{
+    //A端
+    A,
+    //B端
+    B,
+    //C端
+    C,
+}

+ 14 - 0
Assets/BowArrow/Scripts/Components/TextAutoLanguage2/Resources/TextAutoLanguage2/cn.json

@@ -23,6 +23,9 @@
   "gps_go-to-open": "前往打开",
   "gps_giveup-open": "不打开了",
 
+  "UnitCoin": "币",
+  "UnitSeconds": "秒",
+
   /**
   登录注册 页面
   **/
@@ -495,6 +498,17 @@
   "NewUser": "新用户",
   "BowToScreenDis": "弓到屏幕的距离",
   "ScreenSize": "屏幕尺寸",
+  "UserSettings": "用户设置",
+  "BackStageManagement": "后台管理",
+
+  "DebuggingInfrared": "调试红外",
+  "EquipmentSelection": "设备选择",
+  "ScreenCalibration": "屏幕定位",
+  "InfraredCenterCalibration": "准心校准",
+  "DeviceConnect": "设备连接",
+  "CoinRatio": "投币比例(局)",
+  "GameDuration": "游戏时长(局)",
+
 
   "CalibrationTime": "视角校准时间 (3~20s)",
   "BowToScreenDisBest": "最佳弓距屏幕距离",

+ 13 - 0
Assets/BowArrow/Scripts/Components/TextAutoLanguage2/Resources/TextAutoLanguage2/en.json

@@ -23,6 +23,9 @@
   "gps_go-to-open": "Go to open",
   "gps_giveup-open": "Not open",
 
+  "UnitCoin": "Coin",
+  "UnitSeconds": "Seconds",
+
   /**
   登录注册 页面
   **/
@@ -545,6 +548,16 @@
   "BowStablity": "Bow Stablity",
   "BowToScreenDis": "Bow-To-Screen Distance",
   "ScreenSize": "Screen Size",
+  "UserSettings": "User Settings",
+  "BackStageManagement": "Back-stage Management",
+
+  "DebuggingInfrared": "Debugging Infrared",
+  "EquipmentSelection": "Equipment Selection",
+  "ScreenCalibration": "Screen Calibration",
+  "InfraredCenterCalibration": "Infrared Center Calibration",
+  "DeviceConnect": "Device Connect",
+  "CoinRatio": "Coin Ratio(per round)",
+  "GameDuration": "Game Duration(per round)",
 
   "CalibrationTime": "Calibration Time (3~20s)",
   "BowToScreenDisBest": "Best Bow-to-screen Distance",

+ 3 - 2
Assets/BowArrow/Scripts/Editor/EditPlay.cs

@@ -11,11 +11,12 @@ public class EditPlay : MonoBehaviour
     [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
     private static void Initialize()
     {
-
+        RefreshMenuChecked();
         if (Menu.GetChecked("播放场景/Entry场景"))
         {
             Debug.Log("Play的Entry场景!");
-            SceneManager.LoadScene("Entry");
+            string sceneName = SceneManager.GetActiveScene().name;
+            if (sceneName != "Entry")SceneManager.LoadScene("Entry");
         }
         else {
             Debug.Log("Play的Current场景!");

+ 87 - 62
Assets/BowArrow/Scripts/Game/GameAssistUI.cs

@@ -42,87 +42,112 @@ public class GameAssistUI : MonoBehaviour
     void Start()
     {
         this.transform.Find("Button0").GetComponent<Button>().onClick.AddListener(onBtnBack);
-        this.transform.Find("Button1").GetComponent<Button>().onClick.AddListener(delegate(){
-            AudioMgr.ins.PlayBtn();
-            GameRuleView.Create();
-        });
+
+        Button guideBtn = this.transform.Find("Button1").GetComponent<Button>();
         btnScaleAim = this.transform.Find("Button2").GetComponent<Button>();
-        btnScaleAim.onClick.AddListener(delegate(){
-            AudioMgr.ins.PlayBtn();
-            if (btnScaleAim.GetComponentInChildren<Image>().material == outlight) {
-                closeScaleAim();
-            } else {
-                bool success = openScaleAim();
-                if (!success) ShowOpenScaleAimFailTip();
-            }
-        });
+
+        guideBtn.gameObject.SetActive(!CommonConfig.StandaloneModeOrPlatformB);
+        btnScaleAim.gameObject.SetActive(!CommonConfig.StandaloneModeOrPlatformB);
         btnScaleShoot = this.transform.Find("Button3").GetComponent<Button>();
+
         //枪类型下隐藏
-        if (GlobalData.MyDeviceMode == DeviceMode.Gun)
+        if (GlobalData.MyDeviceMode == DeviceMode.Gun || CommonConfig.StandaloneModeOrPlatformB)
         {
             btnScaleShoot.gameObject.SetActive(false);
         }
-        btnScaleShoot.onClick.AddListener(delegate(){
-            AudioMgr.ins.PlayBtn();
-            if (btnScaleShoot.GetComponentInChildren<Image>().material == outlight) {
-                closeScaleShoot();
-            } else {
-                bool success = openScaleShoot();
-                if (!success) ShowOpenScaleShootFailTip();
-            }
-        });
-        Button btnIdentity = this.transform.Find("Button4").GetComponent<Button>();
-        //手枪不显示视角归位,连接接红外也不显示视角归位
-        if (GlobalData.MyDeviceMode == DeviceMode.Gun || BluetoothAim.ins && BluetoothAim.ins.isMainConnectToInfraredDevice())
-        {
-            btnIdentity.gameObject.SetActive(false);
-
-            //显示控制准心按钮
-            Button crossHairBtn = transform.Find("Button5").GetComponent<Button>();
-            crossHairBtn.gameObject.SetActive(true);
-            //设置准心是否显示
-            if(InfraredDemo._ins) CrossHair.ins.SetOnlyShow(InfraredDemo._ins.getCrosshairValue() == 1);
-            bool onInitOpen = CrossHair.ins.GetOpen() && CrossHair.ins.GetOnlyShow();
-            Image crossHairImage = crossHairBtn.GetComponentInChildren<Image>();
-            crossHairImage.material = onInitOpen? outlight:null;
-            crossHairBtn.onClick.AddListener(delegate () {
+
+        if (!CommonConfig.StandaloneModeOrPlatformB) 
+        { 
+            guideBtn.onClick.AddListener(delegate () {
+                AudioMgr.ins.PlayBtn();
+                GameRuleView.Create();
+            });
+            btnScaleAim.onClick.AddListener(delegate () {
                 AudioMgr.ins.PlayBtn();
-                bool onlyShow = !CrossHair.ins.GetOnlyShow();
-                CrossHair.ins.SetOnlyShow(onlyShow);
-                //保存准心状态
-                if (InfraredDemo._ins) InfraredDemo._ins.setCrosshairValue(onlyShow);
-                if (onlyShow)
+                if (btnScaleAim.GetComponentInChildren<Image>().material == outlight)
                 {
-                   crossHairImage.material = outlight;
+                    closeScaleAim();
                 }
                 else
                 {
-                   crossHairImage.material = null;
+                    bool success = openScaleAim();
+                    if (!success) ShowOpenScaleAimFailTip();
                 }
             });
 
-            //校准
-            Button offsetBtn = transform.Find("Button6").GetComponent<Button>();
-            offsetBtn.gameObject.SetActive(true);
-            offsetBtn.onClick.AddListener(delegate () {
+
+            btnScaleShoot.onClick.AddListener(delegate () {
                 AudioMgr.ins.PlayBtn();
-                AutoResetView.DoIdentity();
+                if (btnScaleShoot.GetComponentInChildren<Image>().material == outlight)
+                {
+                    closeScaleShoot();
+                }
+                else
+                {
+                    bool success = openScaleShoot();
+                    if (!success) ShowOpenScaleShootFailTip();
+                }
             });
         }
-        else {
-            btnIdentity.gameObject.SetActive(true);
+      
+        Button btnIdentity = this.transform.Find("Button4").GetComponent<Button>();
+
+        if (!CommonConfig.StandaloneModeOrPlatformB)
+        {
+            //手枪不显示视角归位,连接接红外也不显示视角归位
+            if (GlobalData.MyDeviceMode == DeviceMode.Gun || BluetoothAim.ins && BluetoothAim.ins.isMainConnectToInfraredDevice())
+            {
+                btnIdentity.gameObject.SetActive(false);
+                //显示控制准心按钮
+                Button crossHairBtn = transform.Find("Button5").GetComponent<Button>();
+                crossHairBtn.gameObject.SetActive(true);
+                //设置准心是否显示
+                if (InfraredDemo._ins) CrossHair.ins.SetOnlyShow(InfraredDemo._ins.getCrosshairValue() == 1);
+                bool onInitOpen = CrossHair.ins.GetOpen() && CrossHair.ins.GetOnlyShow();
+                Image crossHairImage = crossHairBtn.GetComponentInChildren<Image>();
+                crossHairImage.material = onInitOpen ? outlight : null;
+                crossHairBtn.onClick.AddListener(delegate () {
+                    AudioMgr.ins.PlayBtn();
+                    bool onlyShow = !CrossHair.ins.GetOnlyShow();
+                    CrossHair.ins.SetOnlyShow(onlyShow);
+                    //保存准心状态
+                    if (InfraredDemo._ins) InfraredDemo._ins.setCrosshairValue(onlyShow);
+                    if (onlyShow)
+                    {
+                        crossHairImage.material = outlight;
+                    }
+                    else
+                    {
+                        crossHairImage.material = null;
+                    }
+                });
+
+                //校准
+                Button offsetBtn = transform.Find("Button6").GetComponent<Button>();
+                offsetBtn.gameObject.SetActive(true);
+                offsetBtn.onClick.AddListener(delegate () {
+                    AudioMgr.ins.PlayBtn();
+                    AutoResetView.DoIdentity();
+                });
+            }
+            else
+            {
+                btnIdentity.gameObject.SetActive(true);
+
+                btnIdentity.onClick.AddListener(delegate () {
+                    if (btnIdentity.GetComponent<LongPressMonitor>().isLongPress) return;
+                    AudioMgr.ins.PlayBtn();
+                    AutoResetView.DoIdentity();
+                    action_OnClickBtnIdentity?.Invoke();
+                });
+                btnIdentity.gameObject.AddComponent<LongPressMonitor>().onLongPress += () => {
+                    AudioMgr.ins.PlayBtn();
+                    if (SB_EventSystem.ins) SB_EventSystem.ins.AwakenSimulateMouse();
+                };
+            }
 
-            btnIdentity.onClick.AddListener(delegate () {
-                if (btnIdentity.GetComponent<LongPressMonitor>().isLongPress) return;
-                AudioMgr.ins.PlayBtn();
-                AutoResetView.DoIdentity();
-                action_OnClickBtnIdentity?.Invoke();
-            });
-            btnIdentity.gameObject.AddComponent<LongPressMonitor>().onLongPress += () => {
-                AudioMgr.ins.PlayBtn();
-                if (SB_EventSystem.ins) SB_EventSystem.ins.AwakenSimulateMouse();
-            };
         }
+       
 
 
         // ------ 查看靶子 ------

+ 12 - 11
Assets/BowArrow/Scripts/Manager/HomeMgr.cs

@@ -14,22 +14,22 @@ public class HomeMgr : MonoBehaviour
         PersistenHandler.Init();
         //ViewMgr.Instance.ShowView<TopBarView>();
         ViewMgr.Instance.ShowView<HomeView>();
-        ViewMgr.Instance.ShowView<HomeFrameView>();
+        //ViewMgr.Instance.ShowView<HomeFrameView>();
         Instantiate(SceneResourceManager.Instance.GetPrefab("DeviceBatteryView"));
         Instantiate(SceneResourceManager.Instance.GetPrefab("AuthLoginMask"));
         //Instantiate(SceneResourceManager.Instance.GetPrefab("RenderBowCamera"));
         Instantiate(SceneResourceManager.Instance.GetPrefab("NewUserGuiderManager"));
         //标记某些界面不需要销毁
-        ViewMgr.Instance.SetViewDontDestroy<GameStartView>();
-        ViewMgr.Instance.SetViewDontDestroy<ChallengeOptionView>();
+        // ViewMgr.Instance.SetViewDontDestroy<GameStartView>();
+        //ViewMgr.Instance.SetViewDontDestroy<ChallengeOptionView>();
         ViewMgr.Instance.SetViewDontDestroy<RoleSelectView>();
-        ViewMgr.Instance.SetViewDontDestroy<PKGameOptionView>();
+        //ViewMgr.Instance.SetViewDontDestroy<PKGameOptionView>();
         ViewMgr.Instance.SetViewDontDestroy<PKMatchView>();
         //显示缓存的隐藏页面
-        ViewMgr.Instance.ResumeView<GameStartView>();
-        ViewMgr.Instance.ResumeView<ChallengeOptionView>();
+        //ViewMgr.Instance.ResumeView<GameStartView>();
+        //ViewMgr.Instance.ResumeView<ChallengeOptionView>();
         ViewMgr.Instance.ResumeView<RoleSelectView>();
-        ViewMgr.Instance.ResumeView<PKGameOptionView>();
+        //ViewMgr.Instance.ResumeView<PKGameOptionView>();
         ViewMgr.Instance.ResumeView<PKMatchView>();
         //红外界面
         InfraredDemo.Create();
@@ -38,7 +38,8 @@ public class HomeMgr : MonoBehaviour
     void Start()
     {
         Time.timeScale = 1; //保证时间缩放为1
-        if (CommonConfig.StandaloneMode)
+        //现在b端进行单机版本
+        if (CommonConfig.StandaloneModeOrPlatformB)
         {
             DoTweenUtil.CallDelay(0.1f, () => new UserPlayer());
             StandaloneAPI.InitTimeCounter();
@@ -51,10 +52,10 @@ public class HomeMgr : MonoBehaviour
         if (ins == this) ins = null;
         ViewMgr.Instance.DestroyAllViewsExcludeDontDestroy();
         //隐藏可缓存的页面
-        ViewMgr.Instance.HideView<GameStartView>();
-        ViewMgr.Instance.HideView<ChallengeOptionView>();
+        //ViewMgr.Instance.HideView<GameStartView>();
+        //ViewMgr.Instance.HideView<ChallengeOptionView>();
         ViewMgr.Instance.HideView<RoleSelectView>();
-        ViewMgr.Instance.HideView<PKGameOptionView>();
+        //ViewMgr.Instance.HideView<PKGameOptionView>();
         ViewMgr.Instance.HideView<PKMatchView>();
     }
 }

+ 7 - 0
Assets/BowArrow/Scripts/Manager/LoginMgr/LoginMgr.cs

@@ -193,6 +193,13 @@ public class UserSettings
     //游戏里面的弓箭手臂(在所有游戏中,游戏设置里的‘手臂弓箭’这个选项,默认为关;即在游戏中,不出现手臂和弓箭的模型)
     public bool openBowAndArrow = false;
 
+    //选择的红外连接设备
+    public string selectDevicesName = "";
+
+    //b端 每一局的设置
+    public int PerRoundCoin = 2; //投币
+    public int PerRoundSeconds = 1200;//时间
+
     //设备校准引导-是否已经完成
     public bool deviceCalibrateGuideFinish = false;
     //游戏规则引导-是否已经完成(完成则保存对应的GameType)

+ 2 - 3
Assets/BowArrow/Scripts/Manager/ViewMgr.cs

@@ -14,14 +14,13 @@ public class ViewMgr : ViewManager<ViewMgr>
         viewMgrCanvasScaler.screenMatchMode = CanvasScaler.ScreenMatchMode.MatchWidthOrHeight;
         viewMgrCanvasScaler.matchWidthOrHeight = 0f;
         //设置视图组
-        SetViewGroup<HomeFrameView>(1);
+        //SetViewGroup<HomeFrameView>(1);
     }
 
     //以下名称的预制体通过SceneResourceManager获取
     HashSet<string> scenePrefabs = new HashSet<string>(new string[] {
         //Home
-        "TopBarView", "HomeView", "GameStartView", "ChallengeOptionView", 
-        "PKGameOptionView", "PKMatchView", "RoleSelectView"
+        "HomeView", "PKMatchView", "RoleSelectView"
     });
     protected override GameObject LoadViewPrefab(string viewName)
     {

+ 9 - 1
Assets/BowArrow/Scripts/Network/SocketComp/UserComp.cs

@@ -41,7 +41,15 @@ public class UserComp : JCUnityLib.Singleton<UserComp>
             //{
             //    if (res.code == 0) onResumeCalibrateRecord(res.data as string);
             //}));
-            onResumeCalibrateRecord(PlayerPrefs.GetString(GetCalibrateDataStorageLocalKey(mac), ""));
+            //onResumeCalibrateRecord(PlayerPrefs.GetString(GetCalibrateDataStorageLocalKey(mac), ""));
+            string key = GetCalibrateDataStorageLocalKey(mac);
+            if (PlayerPrefs.HasKey(key))
+            {
+                // 存储值存在,获取并处理
+                string calibrateData = PlayerPrefs.GetString(key, "");
+                if(calibrateData.Length >0)
+                    onResumeCalibrateRecord(calibrateData);
+            }
         }
     } 
 

+ 2 - 0
Assets/BowArrow/Scripts/Standalone/StandaloneAPI.cs

@@ -91,5 +91,7 @@ public class StandaloneAPI
     public static void InsertCoinForAddTime()
     {
         AddGameTimeCountDown(5 * 60);
+        Debug.Log("UserSettings.ins.PerRoundCoin:" + UserSettings.ins.PerRoundCoin);
+        Debug.Log("UserSettings.ins.PerRoundSeconds:"+ UserSettings.ins.PerRoundSeconds);
     }
 }

+ 2 - 1
Assets/BowArrow/Scripts/View/Home/HomeView.cs

@@ -239,7 +239,8 @@ public class HomeView : JCUnityLib.ViewBase
                 break;
             case "我的":
                 //ViewMgr.Instance.ShowView<MeView>();
-                ViewManager2.ShowView(ViewManager2.Path_PersonalView);
+                if (!CommonConfig.StandaloneMode)
+                    ViewManager2.ShowView(ViewManager2.Path_PersonalView);
                 break;
             default:
                 break;

+ 71 - 4
Assets/BowArrow/Scripts/View/Home/HomeView_BottomBarView.cs

@@ -2,21 +2,87 @@
 using System.Collections.Generic;
 using UnityEngine;
 using JCUnityLib;
+using System.Linq;
+using UnityEngine.UI;
 
 public class HomeView_BottomBarView : MonoBehaviour
 {
     // Start is called before the first frame update
     void Start()
     {
- 
+        Dictionary<string, Transform> actionMap = new Dictionary<string, Transform>
+                        {
+                            { "IconConnect", null },
+                            { "IconGuider", null },
+                            //{ "IconShop", null },
+                            //{ "IconNewUser", null },
+                            { "IconFriend", null },
+                            { "IconRank", null },
+                            { "IconSetUp", null }
+                        };
+
+        SortChildObjects(actionMap);
+        // 按条件禁用特定按钮的交互性
+        switch (CommonConfig.OP)
+        {
+            case OperatingPlatform.B:
+                DisableButtonInteractivity(actionMap, new List<string> { "IconGuider", "IconFriend", "IconRank" });
+                break;
+        }
+    }
+
+    void DisableButtonInteractivity(Dictionary<string, Transform> actionMap, List<string> buttonNames)
+    {
+        foreach (var buttonName in buttonNames)
+        {
+            // 检查 actionMap 中是否有该键且对应的 Transform 不为 null
+            if (actionMap.TryGetValue(buttonName, out Transform buttonTransform) && buttonTransform != null)
+            {
+                Image image = buttonTransform.GetComponent<Image>();
+                if (image != null) {
+                    image.color = new Color(200f / 255f, 200f / 255f, 200f / 255f, 130f / 255f);
+                }
+                Button button = buttonTransform.GetComponent<Button>();
+                if (button != null)
+                {
+                    button.interactable = false;
+                }
+            }
+        }
     }
+    void SortChildObjects(Dictionary<string, Transform> actionMap)
+    {
+
+        // 查找子对象并按名称填充 actionMap
+        foreach (Transform child in transform)
+        {
+            if (actionMap.ContainsKey(child.name))
+            {
+                actionMap[child.name] = child;
+            }
+            else
+            {
+                // 如果子对象不在 actionMap 中,则隐藏它
+                child.gameObject.SetActive(false);
+            }
+        }
 
+        // 获取按字典定义顺序的子对象列表(过滤掉未找到的对象)
+        var sortedChildren = actionMap.Values.Where(child => child != null).ToList();
+
+        // 重新排列子对象
+        for (int i = 0; i < sortedChildren.Count; i++)
+        {
+            sortedChildren[i].SetSiblingIndex(i);
+        }
+    }
     // Update is called once per frame
     //void Update()
     //{
-        
+
     //}
-    public void GoToConnect() {
+    public void GoToConnect()
+    {
         Debug.Log("进入连接页面");
         AudioMgr.ins.PlayBtn();
         ViewMgr.Instance.ShowView<DeviceViewInfrared>();
@@ -52,7 +118,8 @@ public class HomeView_BottomBarView : MonoBehaviour
         //ViewManager2.ShowView(ViewManager2.Path_ConnectGuidanceView);
     }
 
-    public void GoToFriends() {
+    public void GoToFriends()
+    {
         Debug.Log("进入好友页面");
         AudioMgr.ins.PlayBtn();
         ViewManager2.ShowView(ViewManager2.Path_SocialView);

+ 30 - 20
Assets/BowArrow/Scripts/View/Home/HomeView_ChallengeOption.cs

@@ -219,29 +219,39 @@ public class HomeView_ChallengeOption : MonoBehaviour
                 //进入模式选择页面
                 ViewMgr.Instance.ShowView<ModeSelectView>();
 
-                if (GlobalData.MyDeviceMode == DeviceMode.Gun)
+                //连接弓箭并且是9轴的情况下
+                if (_startGameType == 1 && AimHandler.ins.bRuning9Axis())
                 {
-                    ModeSelectView.ins.InitGunButtons();
+                    ModeSelectView.ins.isShowButton = true;
                 }
-                else {
-                    //连接弓箭
-                    if (_startGameType == 1)
-                    {
-                        //当连接HOUYI Pro和其他红外设备时候,双弓射箭也需要屏蔽掉
-                        if (BluetoothAim.ins.isMainConnectToInfraredDevice())
-                        {
-                            ModeSelectView.ins.isShowButton = false;
-                        }
-                        else {
-                            ModeSelectView.ins.isShowButton = true;
-                        }
-                    }
-                    else
-                    {
-                        ModeSelectView.ins.isShowButton = false;
-                    }
-                    ModeSelectView.ins.InitButtons();
+                else
+                {
+                    ModeSelectView.ins.isShowButton = false;
                 }
+            
+                //if (GlobalData.MyDeviceMode == DeviceMode.Gun)
+                //{
+                //    ModeSelectView.ins.InitGunButtons();
+                //}
+                //else {
+                //    //连接弓箭
+                //    if (_startGameType == 1)
+                //    {
+                //        //当连接HOUYI Pro和其他红外设备时候,双弓射箭也需要屏蔽掉
+                //        if (BluetoothAim.ins.isMainConnectToInfraredDevice())
+                //        {
+                //            ModeSelectView.ins.isShowButton = false;
+                //        }
+                //        else {
+                //            ModeSelectView.ins.isShowButton = true;
+                //        }
+                //    }
+                //    else
+                //    {
+                //        ModeSelectView.ins.isShowButton = false;
+                //    }
+                //    ModeSelectView.ins.InitButtons();
+                //}
                 break;
             default:
                 StartGame(_startGameType);

+ 64 - 31
Assets/BowArrow/Scripts/View/Home/ModeSelectView.cs

@@ -8,8 +8,9 @@ public class ModeSelectView : JCUnityLib.ViewBase
 {
     public static ModeSelectView ins;
     public bool isShowButton { get; set; } = false;
-
-    [SerializeField] List<Button> buttons;
+    [SerializeField]
+    List<Button> allButtons;
+    List<Button> buttons = new List<Button>();
     private void Awake()
     {
         ins = this;
@@ -17,36 +18,68 @@ public class ModeSelectView : JCUnityLib.ViewBase
     // Start is called before the first frame update
     void Start()
     {
-        
-    }
-    //枪模式下显示
-    public void InitGunButtons() {
-        //for (int i = buttons.Count - 1; i > 0; i--)
-        //{
-        //    Destroy(buttons[i].gameObject);
-        //    buttons.RemoveAt(i);
-        //}
-        Destroy(buttons[3].gameObject);
-        buttons.RemoveAt(buttons.Count - 1);
-        for (int i = 0; i < buttons.Count; i++)
+        if (CommonConfig.StandaloneMode)
         {
-            int temp = i;
-            buttons[i].onClick.AddListener(() => {
-                AudioMgr.ins.PlayBtn();
-                OnChangeButton(temp);
-            });
+            buttons.Add(allButtons[0]);
+            buttons.Add(allButtons[1]);
         }
-    }
-    public void InitButtons() {
-        if (isShowButton)
+        else
         {
-            buttons[3].gameObject.SetActive(true);
+            if (GlobalData.MyDeviceMode == DeviceMode.Gun)
+            {
+                buttons.Add(allButtons[0]);
+                buttons.Add(allButtons[1]);
+                buttons.Add(allButtons[2]);
+            }
+            else
+            {
+                buttons.Add(allButtons[0]);
+                buttons.Add(allButtons[1]);
+                buttons.Add(allButtons[2]);
+
+                // 目前只有奥运射箭和塔防有双人模式,先显示奥运射箭
+                if (isShowButton && allButtons.Count > 3)
+                {
+                    buttons.Add(allButtons[3]);
+                    allButtons[3].gameObject.SetActive(true);
+                }
+            }
         }
-        else
+
+        // 设置未添加的按钮为隐藏
+        HideUnselectedButtons();
+
+        // 初始化按钮
+        InitButtons();
+    }
+    private void HideUnselectedButtons()
+    {
+        foreach (var button in allButtons)
         {
-            Destroy(buttons[3].gameObject);
-            buttons.RemoveAt(buttons.Count - 1);
+            // 如果当前按钮不在 buttons 中,隐藏它
+            if (!buttons.Contains(button))
+            {
+                button.gameObject.SetActive(false);
+            }
+            else
+            {
+                // 如果在 buttons 中,确保设置为可见
+                button.gameObject.SetActive(true);
+            }
         }
+    }
+    //枪模式下显示
+    //public void InitGunButtons() {
+    //    for (int i = 0; i < buttons.Count; i++)
+    //    {
+    //        int temp = i;
+    //        buttons[i].onClick.AddListener(() => {
+    //            AudioMgr.ins.PlayBtn();
+    //            OnChangeButton(temp);
+    //        });
+    //    }
+    //}
+    public void InitButtons() {
         for (int i = 0; i < buttons.Count; i++)
         {
             int temp = i;
@@ -55,11 +88,11 @@ public class ModeSelectView : JCUnityLib.ViewBase
                 OnChangeButton(temp);
             });
 
-            if (GameMgr.judgmentGameType != 1 && i == 3)
-            {
-                //目前只有奥运射箭和塔防有双人模式,先显示奥运射箭
-                buttons[i].gameObject.SetActive(false);
-            }
+            //if (GameMgr.judgmentGameType != 1 && i == 3)
+            //{
+            //    //目前只有奥运射箭和塔防有双人模式,先显示奥运射箭
+            //    buttons[i].gameObject.SetActive(false);
+            //}
         }
     }
     void OnDestroy()

+ 46 - 44
Assets/DuckHunter/Scripts/GameUI.cs

@@ -34,57 +34,59 @@ namespace DuckHunter
                 UnityEngine.SceneManagement.SceneManager.LoadScene("DuckHunter");
             });
 
-            if (GlobalData.MyDeviceMode == DeviceMode.Gun || BluetoothAim.ins && BluetoothAim.ins.isMainConnectToInfraredDevice())
-            {
-                btnAim.gameObject.SetActive(false);
+            if (!CommonConfig.StandaloneModeOrPlatformB) {
+                if (GlobalData.MyDeviceMode == DeviceMode.Gun || BluetoothAim.ins && BluetoothAim.ins.isMainConnectToInfraredDevice())
+                {
+                    //btnAim.gameObject.SetActive(false);
 
-                btnCrosshair.gameObject.SetActive(true);
+                    btnCrosshair.gameObject.SetActive(true);
 
-                //获取设置值和一个存储值
-                bool onInitOpen = InfraredDemo._ins ? InfraredDemo._ins.bInitCrosshairShow() : true;
-                Image crossHairImage = btnCrosshair.GetComponentInChildren<Image>();
-                crossHairImage.material = onInitOpen ? outlight : null;
+                    //获取设置值和一个存储值
+                    bool onInitOpen = InfraredDemo._ins ? InfraredDemo._ins.bInitCrosshairShow() : true;
+                    Image crossHairImage = btnCrosshair.GetComponentInChildren<Image>();
+                    crossHairImage.material = onInitOpen ? outlight : null;
 
-                btnCrosshair.onClick.AddListener(delegate () {
-                    AudioManager.Instance.PlayBtn();
-                    bool onlyShow = !CrossHair.Instance.GetOnlyShow();
-                    CrossHair.Instance.SetOnlyShow(onlyShow);
-                    //记录准心值
-                    if (InfraredDemo._ins) InfraredDemo._ins.setCrosshairValue(onlyShow);
+                    btnCrosshair.onClick.AddListener(delegate () {
+                        AudioManager.Instance.PlayBtn();
+                        bool onlyShow = !CrossHair.Instance.GetOnlyShow();
+                        CrossHair.Instance.SetOnlyShow(onlyShow);
+                        //记录准心值
+                        if (InfraredDemo._ins) InfraredDemo._ins.setCrosshairValue(onlyShow);
 
-                    if (onlyShow)
-                    {
-                        crossHairImage.material = outlight;
-                    }
-                    else
-                    {
-                        crossHairImage.material = null;
-                    }
-                });
+                        if (onlyShow)
+                        {
+                            crossHairImage.material = outlight;
+                        }
+                        else
+                        {
+                            crossHairImage.material = null;
+                        }
+                    });
 
-                //校准
-                btnCalibrationOffset.gameObject.SetActive(true);
-                btnCalibrationOffset.onClick.AddListener(delegate () {
-                    AudioMgr.ins.PlayBtn();
-                    SmartBowController.Instance.ResetAim();
-                });
-            }
-            else {
-                btnAim.gameObject.SetActive(true);
-                btnAim.onClick.AddListener(() =>
-                {
-                    if (btnAim.GetComponent<LongPressMonitor>().isLongPress) return;
-                    AudioManager.Instance.PlayBtn();
-                    SmartBowController.Instance.ResetAim();
-                });
-                btnAim.gameObject.AddComponent<LongPressMonitor>().onLongPress += () =>
+                    //校准
+                    btnCalibrationOffset.gameObject.SetActive(true);
+                    btnCalibrationOffset.onClick.AddListener(delegate () {
+                        AudioMgr.ins.PlayBtn();
+                        SmartBowController.Instance.ResetAim();
+                    });
+                }
+                else
                 {
-                    AudioManager.Instance.PlayBtn();
-                    if (SB_EventSystem.ins) SB_EventSystem.ins.AwakenSimulateMouse();
-                };
+                    btnAim.gameObject.SetActive(true);
+                    btnAim.onClick.AddListener(() =>
+                    {
+                        if (btnAim.GetComponent<LongPressMonitor>().isLongPress) return;
+                        AudioManager.Instance.PlayBtn();
+                        SmartBowController.Instance.ResetAim();
+                    });
+                    btnAim.gameObject.AddComponent<LongPressMonitor>().onLongPress += () =>
+                    {
+                        AudioManager.Instance.PlayBtn();
+                        if (SB_EventSystem.ins) SB_EventSystem.ins.AwakenSimulateMouse();
+                    };
+                }
             }
-
-                
+               
             btnBack.onClick.AddListener(() => {
                 AudioManager.Instance.PlayBtn();
                 // UnityEngine.SceneManagement.SceneManager.LoadScene("Home", UnityEngine.SceneManagement.LoadSceneMode.Single);

+ 59 - 49
Assets/FruitMaster/Scripts/OverallLogics.cs

@@ -40,49 +40,55 @@ public class OverallLogics : MonoBehaviour
     void Start()
     {
         // ShutdownBtn.onClick.AddListener(Shutdown);
-        if (GlobalData.MyDeviceMode == DeviceMode.Gun || BluetoothAim.ins && BluetoothAim.ins.isMainConnectToInfraredDevice())
+        // 如果不是b端单机模式
+        if (!CommonConfig.StandaloneModeOrPlatformB)
         {
-            ResetAimBtn.gameObject.SetActive(false);
-
-            //获取设置值和一个存储值
-            bool onInitOpen = InfraredDemo._ins? InfraredDemo._ins.bInitCrosshairShow():true;
-            Debug.Log("onInitOpen:"+ onInitOpen);
-            Image crossHairImage = CrossHairBtn.transform.Find("Image").GetComponent<Image>();
-            crossHairImage.material = onInitOpen ? outlight : null;
-            //StartGame 控制 AimingCross_img
-    
-            CrossHairBtn.onClick.AddListener(delegate ()
+            if (GlobalData.MyDeviceMode == DeviceMode.Gun || BluetoothAim.ins && BluetoothAim.ins.isMainConnectToInfraredDevice())
             {
-                bool onlyShow = !JCFruitMaster.ins.GetOnlyShow();
-                JCFruitMaster.ins.SetOnlyShow(onlyShow);
-                //记录准心值
-                if (InfraredDemo._ins) InfraredDemo._ins.setCrosshairValue(onlyShow);
+                ResetAimBtn.gameObject.SetActive(false);
 
-                if (onlyShow)
+                //获取设置值和一个存储值
+                bool onInitOpen = InfraredDemo._ins ? InfraredDemo._ins.bInitCrosshairShow() : true;
+                Debug.Log("onInitOpen:" + onInitOpen);
+                Image crossHairImage = CrossHairBtn.transform.Find("Image").GetComponent<Image>();
+                crossHairImage.material = onInitOpen ? outlight : null;
+                //StartGame 控制 AimingCross_img
+
+                CrossHairBtn.onClick.AddListener(delegate ()
                 {
-                    crossHairImage.material = outlight;
-                }
-                else
+                    bool onlyShow = !JCFruitMaster.ins.GetOnlyShow();
+                    JCFruitMaster.ins.SetOnlyShow(onlyShow);
+                    //记录准心值
+                    if (InfraredDemo._ins) InfraredDemo._ins.setCrosshairValue(onlyShow);
+
+                    if (onlyShow)
+                    {
+                        crossHairImage.material = outlight;
+                    }
+                    else
+                    {
+                        crossHairImage.material = null;
+                    }
+                });
+
+                //校准
+                CalibrationOffsetBtn.onClick.AddListener(delegate ()
                 {
-                    crossHairImage.material = null;
-                }
-            });
-
-            //校准
-            CalibrationOffsetBtn.onClick.AddListener(delegate () {
-                AudioMgr.ins.PlayBtn();
-                GetComponent<SmartBowManager>().ResetAim();
-                //ResetAim();
-            });
+                    AudioMgr.ins.PlayBtn();
+                    GetComponent<SmartBowManager>().ResetAim();
+                    //ResetAim();
+                });
+            }
+            else
+            {
+                ResetAimBtn.onClick.AddListener(ResetAim);
+                ResetAimBtn.gameObject.AddComponent<LongPressMonitor>().onLongPress += ResetAimLongPress;
+            }
         }
-        else
-        {
-            ResetAimBtn.onClick.AddListener(ResetAim);
-            ResetAimBtn.gameObject.AddComponent<LongPressMonitor>().onLongPress += ResetAimLongPress;
+        else {
+            ResetAimBtn.gameObject.SetActive(false);
         }
-
        
-
         //GetComponent<SmartBowManager>().OnConnectionLost += OnSmartBowConnectionLost;
         _startGameBtn.onClick.AddListener(StartGame);
         GetComponent<GamingManager>().OnGameEnd += OnGameEnd;
@@ -115,26 +121,30 @@ public class OverallLogics : MonoBehaviour
     public void SetCrosshairOutLight() {
 
         if (AimHandler.ins&&AimHandler.ins.bRuning9Axis()) return;
-        //显示准心控制
-        CrossHairBtn.gameObject.SetActive(true);
-
-        CalibrationOffsetBtn.gameObject.SetActive(true);
-
         //关闭9轴按钮
         ResetAimBtn.gameObject.SetActive(false);
 
-        Image crossHairImage = CrossHairBtn.transform.Find("Image").GetComponent<Image>();
+        if (!CommonConfig.StandaloneModeOrPlatformB) 
+        {
+            //显示准心控制
+            CrossHairBtn.gameObject.SetActive(true);
 
-        bool onlyShow = JCFruitMaster.ins.GetOnlyShow();
+            CalibrationOffsetBtn.gameObject.SetActive(true);
 
-        if (onlyShow)
-        {
-            crossHairImage.material = outlight;
-        }
-        else
-        {
-            crossHairImage.material = null;
+            Image crossHairImage = CrossHairBtn.transform.Find("Image").GetComponent<Image>();
+
+            bool onlyShow = JCFruitMaster.ins.GetOnlyShow();
+
+            if (onlyShow)
+            {
+                crossHairImage.material = outlight;
+            }
+            else
+            {
+                crossHairImage.material = null;
+            }
         }
+  
     }
 
     // Update is called once per frame

+ 34 - 26
Assets/Game_Hyperspace/Script/UIManager.cs

@@ -57,32 +57,40 @@ namespace HyperspaceGame
 
             image = GeneratingTarget.gm.shootingEvent.GetComponent<Image>();
 
-            //获取设置值和一个存储值
-            bool onInitOpen = InfraredDemo._ins ? InfraredDemo._ins.bInitCrosshairShow() : true;
-            Image crossHairImage = _btnCrosshair.GetComponentInChildren<Image>();
-            crossHairImage.material = onInitOpen ? outlight : null;
-
-            _btnCrosshair.onClick.AddListener(delegate () {
-                AudioMgr.ins.PlayBtn();
-                bool onlyShow = !GetOnlyShow();
-                SetOnlyShow(onlyShow);
-                //记录准心值
-                if (InfraredDemo._ins) InfraredDemo._ins.setCrosshairValue(onlyShow);
-                if (onlyShow)
-                {
-                    crossHairImage.material = outlight;
-                }
-                else
-                {
-                    crossHairImage.material = null;
-                }
-            });
-
-            //校准
-            _btnCalibrationOffset.onClick.AddListener(delegate () {
-                AudioMgr.ins.PlayBtn();
-                AutoResetView.DoIdentity();
-            });
+            //b端单人
+            if (CommonConfig.StandaloneModeOrPlatformB) 
+            {
+                _btnCrosshair.gameObject.SetActive(false);
+                _btnCalibrationOffset.gameObject.SetActive(false);
+            } else {
+
+                //获取设置值和一个存储值
+                bool onInitOpen = InfraredDemo._ins ? InfraredDemo._ins.bInitCrosshairShow() : true;
+                Image crossHairImage = _btnCrosshair.GetComponentInChildren<Image>();
+                crossHairImage.material = onInitOpen ? outlight : null;
+
+                _btnCrosshair.onClick.AddListener(delegate () {
+                    AudioMgr.ins.PlayBtn();
+                    bool onlyShow = !GetOnlyShow();
+                    SetOnlyShow(onlyShow);
+                    //记录准心值
+                    if (InfraredDemo._ins) InfraredDemo._ins.setCrosshairValue(onlyShow);
+                    if (onlyShow)
+                    {
+                        crossHairImage.material = outlight;
+                    }
+                    else
+                    {
+                        crossHairImage.material = null;
+                    }
+                });
+
+                //校准
+                _btnCalibrationOffset.onClick.AddListener(delegate () {
+                    AudioMgr.ins.PlayBtn();
+                    AutoResetView.DoIdentity();
+                });
+            }
 
 
             _btnQuit.onClick.AddListener(OnShutDown);

File diff suppressed because it is too large
+ 292 - 294
Assets/SmartBow/Resources/SmartBow/Prefabs/Views/Home/SettingsView.prefab


+ 16 - 1
Assets/SmartBow/Scripts/Views/GameResultView.cs

@@ -3,6 +3,7 @@ using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.UI;
 using System;
+using UnityEngine.SceneManagement;
 
 public class GameResultView : MonoBehaviour
 {
@@ -64,6 +65,20 @@ public class GameResultView : MonoBehaviour
     {
         AudioMgr.ins.PlayBtn();
         OnBackClicked?.Invoke();
-        ViewManager2.RemoveView(ViewManager2.Path_GameResultView);
+        //ViewManager2.RemoveView(ViewManager2.Path_GameResultView);
+    }
+    //这个脚本存在时候。任何切换操作都直接处理删除
+    void OnSceneUnloaded(Scene scene)
+    {
+        ViewManager2.HideView(ViewManager2.Path_GameResultView);
+    }
+    void OnEnable()
+    {
+        SceneManager.sceneUnloaded += OnSceneUnloaded;
+    }
+
+    void OnDisable()
+    {
+        SceneManager.sceneUnloaded -= OnSceneUnloaded;
     }
 }

+ 17 - 0
Assets/SmartBow/Scripts/Views/InfraredViewParts/InfraredScreenPositioningView.cs

@@ -11,6 +11,7 @@ using InfraredManager;
 using Org.BouncyCastle.Asn1.Crmf;
 using ZIM.Unity;
 using o0.Project;
+using UnityEngine.SceneManagement;
 
 public class LinePosition
 {
@@ -1120,5 +1121,21 @@ public class InfraredScreenPositioningView : JCUnityLib.ViewBase
         pos3.anchoredPosition = ScreenLocate.quadUnityVectorList[3].pixelToLocalPosition_AnchorCenter(Vector2.one, canvasRectTransform.rect);
     }
 
+    //这个脚本存在时候。任何切换操作都直接处理删除
+    void OnSceneUnloaded(Scene scene)
+    {
+        ViewManager2.HideView(ViewManager2.Path_ConnectGuidanceView);
+        ViewManager2.HideView(ViewManager2.Path_InfraredScreenPositioningView);
+    }
+    void OnEnable()
+    {
+        SceneManager.sceneUnloaded += OnSceneUnloaded;
+    }
+
+    void OnDisable()
+    {
+        SceneManager.sceneUnloaded -= OnSceneUnloaded;
+    }
+
     #endregion
 }

+ 136 - 17
Assets/SmartBow/Scripts/Views/SettingsView.cs

@@ -3,10 +3,11 @@ using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.UI;
 using UnityEngine.SceneManagement;
+using System.Linq;
 
 namespace SmartBow
 {
-    public class SettingsView : MonoBehaviour, MenuBackInterface
+    public class SettingsView : JCUnityLib.ViewBase, MenuBackInterface
     {
         [SerializeField] Transform panelLeftContent;
         [SerializeField] Transform BtnNewUserObj;
@@ -16,16 +17,93 @@ namespace SmartBow
             PersistenHandler.ins?.menuBackCtr.views.Add(this);
             //ShowBoxSound(true);
 
-            if (CommonConfig.bInfraredApp) {
+            switch (CommonConfig.OP)
+            {
+                case OperatingPlatform.A:
+                    if (CommonConfig.bInfraredApp)
+                    {
+                        //隐藏弓到屏幕的距离
+                        Dictionary<string, Transform> actionMapInfrared= new Dictionary<string, Transform>
+                        {
+                            { "BtnSound", null },
+                            { "BtnLanguage", null },
+                            { "BtnNewUser", null },
+                            { "BtnLevel", null },
+                            { "BtnUserAgreement", null },
+                            { "BtnPrivacyPolicy", null },
+                            { "BtnAboutUs", null }
+                        };
+                        SortChildObjects(actionMapInfrared);
+                    }
+                    else {
+                        Dictionary<string, Transform> actionMapA = new Dictionary<string, Transform>
+                        {
+                            { "BtnSound", null },
+                            { "BtnLanguage", null },
+                            { "BtnNewUser", null },
+                            { "BtnScreenDistance", null },//弓到屏幕的距离
+                            { "BtnLevel", null },
+                            { "BtnUserAgreement", null },
+                            { "BtnPrivacyPolicy", null },
+                            { "BtnAboutUs", null }
+                        };
 
-                //隐藏弓到屏幕的距离
-                foreach (Transform item in panelLeftContent)
-                {
-                    if (item.name == "BtnScreenDistance") {
-                        item.gameObject.SetActive(false);
+                        SortChildObjects(actionMapA);
                     }
+                    break;
+                case OperatingPlatform.B:
+                    // 定义排序字典
+                    Dictionary<string, Transform> actionMapB = new Dictionary<string, Transform>
+                    {
+                        { "BtnSound", null },
+                        { "BtnLanguage", null },
+                        { "BtnLevel", null },
+                        { "BtnUserSettings", null },
+                        { "BtnBackStageManagement", null },
+                        { "BtnAboutUs", null }
+                    };
+                    SortChildObjects(actionMapB);
+                    break;
+                case OperatingPlatform.C:
+                    //隐藏弓到屏幕的距离
+                    Dictionary<string, Transform> actionMapInfraredC = new Dictionary<string, Transform>
+                        {
+                            { "BtnSound", null },
+                            { "BtnLanguage", null },
+                            { "BtnNewUser", null },
+                            { "BtnLevel", null },
+                            { "BtnUserAgreement", null },
+                            { "BtnPrivacyPolicy", null },
+                            { "BtnAboutUs", null }
+                        };
+                    SortChildObjects(actionMapInfraredC);
+                    break;
+            }
+
+        }
+        void SortChildObjects(Dictionary<string, Transform> actionMap) {
+          
+            // 查找子对象并按名称填充 actionMap
+            foreach (Transform child in panelLeftContent)
+            {
+                if (actionMap.ContainsKey(child.name))
+                {
+                    actionMap[child.name] = child;
+                }
+                else
+                {
+                    // 如果子对象不在 actionMap 中,则隐藏它
+                    child.gameObject.SetActive(false);
                 }
-                ShowBoxScreenDistance(false);
+            }
+
+            // 获取按字典定义顺序的子对象列表(过滤掉未找到的对象)
+            var sortedChildren = actionMap.Values.Where(child => child != null).ToList();
+
+            // 重新排列子对象
+            for (int i = 0; i < sortedChildren.Count; i++)
+            {
+                sortedChildren[i].SetSiblingIndex(i);
             }
         }
 
@@ -71,17 +149,58 @@ namespace SmartBow
                 }
             }
         }
-
         void ShowBox(string itemName)
         {
-            ShowBoxSound(itemName == "BtnSound");
-            ShowBoxLevel(itemName == "BtnLevel");
-            ShowBoxNewUser(itemName == "BtnNewUser");
-            if (!CommonConfig.bInfraredApp)ShowBoxScreenDistance(itemName == "BtnScreenDistance");
-            ShowBoxLanguage(itemName == "BtnLanguage");
-            ShowBoxUserAgreement(itemName == "BtnUserAgreement");
-            ShowBoxPrivacyPolicy(itemName == "BtnPrivacyPolicy");
-            ShowBoxAboutUs(itemName == "BtnAboutUs");
+            // 定义所有 ShowBox 方法,并将初始状态设为 false
+            var actionMap = new Dictionary<string, System.Action<bool>>
+            {
+                { "BtnSound", ShowBoxSound },
+                { "BtnLevel", ShowBoxLevel },
+                { "BtnNewUser", ShowBoxNewUser },
+                { "BtnUserSettings", ShowBoxUserSettings },
+                { "BtnBackStageManagement",ShowBackStageManagement},
+                { "BtnLanguage", ShowBoxLanguage },
+                { "BtnUserAgreement", ShowBoxUserAgreement },
+                { "BtnPrivacyPolicy", ShowBoxPrivacyPolicy },
+                { "BtnAboutUs", ShowBoxAboutUs }
+            };
+
+            // 如果不是红外应用,则包括 BtnScreenDistance
+            if (!CommonConfig.bInfraredApp)
+            {
+                actionMap["BtnScreenDistance"] = ShowBoxScreenDistance;
+            }
+
+            // 先将所有状态设为 false
+            foreach (var action in actionMap.Values)
+            {
+                action(false);
+            }
+
+            // 将指定的 itemName 对应的按钮设为 true
+            if (actionMap.TryGetValue(itemName, out var selectedAction))
+            {
+                selectedAction(true);
+            }
+        }
+        //void ShowBox(string itemName)
+        //{
+        //    ShowBoxSound(itemName == "BtnSound");
+        //    ShowBoxLevel(itemName == "BtnLevel");
+        //    ShowBoxNewUser(itemName == "BtnNewUser");
+        //    ShowBoxUserSettings(itemName == "BtnUserSettings");
+        //    if (!CommonConfig.bInfraredApp)ShowBoxScreenDistance(itemName == "BtnScreenDistance");
+        //    ShowBoxLanguage(itemName == "BtnLanguage");
+        //    ShowBoxUserAgreement(itemName == "BtnUserAgreement");
+        //    ShowBoxPrivacyPolicy(itemName == "BtnPrivacyPolicy");
+        //    ShowBoxAboutUs(itemName == "BtnAboutUs");
+        //}
+        public void ShowBoxUserSettings(bool show) {
+            transform.Find("PanelContent/BoxUserSettings").gameObject.SetActive(show);
+        }
+        public void ShowBackStageManagement(bool show)
+        {
+            transform.Find("PanelContent/BoxBackStageManagement").gameObject.SetActive(show);
         }
         public void ShowBoxSound(bool show)
         {

+ 72 - 0
Assets/SmartBow/Scripts/Views/SettingsViewParts/BoxBackStageManagement.cs

@@ -0,0 +1,72 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.Events;
+using UnityEngine.UI;
+
+public class BoxBackStageManagement : MonoBehaviour
+{
+    [SerializeField] InputField inputCoin;
+    [SerializeField] InputField inputSeconds;
+    int CoinMaxLimit = 10;// 个
+    int SecondsMaxLimit = 1200;// 秒
+    // Start is called before the first frame update
+    void Start()
+    {
+        InitInputCoin();
+        InitInputSeconds();
+    }
+    void InitInputCoin()
+    {
+        inputCoin.text = UserSettings.ins.PerRoundCoin + "";
+        UnityAction<string> onEndEdit_inputSize = (string str) => {
+            inputCoin.SetTextWithoutNotify("");
+            float v = (float)System.Math.Round(double.Parse(str), 2);
+            if (v < 1 || v > CoinMaxLimit)
+            {
+                PopupMgr.ins.ShowTip(TextAutoLanguage2.GetTextByCNKey("输入值不在常规范围内"));
+                return;
+            }
+            SetCoin(v);
+            //save
+            UserSettings.ins.PerRoundCoin =(int)(v);
+            UserSettings.ins.Save();
+        };
+        inputCoin.onEndEdit.AddListener(onEndEdit_inputSize);
+    }
+    void SetCoin(float v)
+    {
+        string vStr = v.ToString("#0");
+        inputCoin.text = vStr; //+ TextAutoLanguage2.GetTextByKey("UnitCoin")
+    }
+    void InitInputSeconds()
+    {
+        inputSeconds.text = UserSettings.ins.PerRoundSeconds + "";
+        UnityAction<string> onEndEdit_inputSize = (string str) => {
+            inputSeconds.SetTextWithoutNotify("");
+            float v = (float)System.Math.Round(double.Parse(str), 2);
+            if (v < 1 || v > SecondsMaxLimit)
+            {
+                PopupMgr.ins.ShowTip(TextAutoLanguage2.GetTextByCNKey("输入值不在常规范围内"));
+                return;
+            }
+            SetSeconds(v);
+            //save
+            UserSettings.ins.PerRoundSeconds = (int)v;
+            UserSettings.ins.Save();
+        };
+
+        inputSeconds.onEndEdit.AddListener(onEndEdit_inputSize);
+        //if (CommonConfig.isReleaseVersion)
+        //{
+        //    //inputSize.transform.parent.gameObject.SetActive(false);
+        //    //transform.Find("Items/BowCameraFixed").gameObject.SetActive(false);
+        //}
+    }
+
+    void SetSeconds(float v)
+    {
+        string vStr = v.ToString("#0");
+        inputSeconds.text = vStr; //+ TextAutoLanguage2.GetTextByKey("UnitSeconds")
+    }
+}

+ 11 - 0
Assets/SmartBow/Scripts/Views/SettingsViewParts/BoxBackStageManagement.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 1f78bc6d95c85ec459f69837020b5f9f
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 119 - 0
Assets/SmartBow/Scripts/Views/SettingsViewParts/BoxUserSettings.cs

@@ -0,0 +1,119 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.UI;
+
+namespace CustomUIView
+{
+    public class BoxUserSettings : MonoBehaviour
+    {
+        [SerializeField] Transform boxSelectDevices;
+        [SerializeField] GameObject[] boxDevices;
+        readonly string[] SelectDevicesStrs = { "ARTEMIS Pro", "Pistol M9", "HOUYI Pro" };
+        int selectDevicesIndex = 0; // 用于保存当前选择的设备索引
+        // Start is called before the first frame update
+        void Start()
+        {
+            for (int i = 0; i < boxDevices.Length; i++)
+            {
+                Text text = boxDevices[i].GetComponentInChildren<Text>();
+                text.text = SelectDevicesStrs[i];
+                Button button = boxDevices[i].GetComponent<Button>();
+                string deviceName = SelectDevicesStrs[i]; // 捕获当前的设备名称
+                button.onClick.AddListener(() =>
+                {
+                    OnClick_SelectDevice(deviceName);
+                });
+            }
+            // 获取用户设置中保存的设备名称
+            string selectDeviceName = UserSettings.ins.selectDevicesName;
+
+            // 如果名称存在于数组中,则获取其索引,否则默认选第一个
+            selectDevicesIndex = System.Array.IndexOf(SelectDevicesStrs, selectDeviceName);
+            if (selectDevicesIndex < 0) selectDevicesIndex = 0;
+
+            // 渲染选择的设备
+            RenderSelectDevicesIndex(selectDevicesIndex);
+        }
+
+        public void RenderSelectDevicesIndex(int value)
+        {
+            for (int i = 0; i < SelectDevicesStrs.Length; i++)
+            {
+                var item = boxSelectDevices.GetChild(i);
+                var text = item.GetComponentInChildren<Text>();
+
+                // 根据是否为选中设备设置颜色
+                if (i == value)
+                {
+                    item.GetComponent<Image>().color = new Color(16 / 255f, 194 / 255f, 198 / 255f, 1f);
+                }
+                else
+                {
+                    item.GetComponent<Image>().color = new Color(96 / 255f, 96 / 255f, 96 / 255f, 1f);
+                }
+
+                // 设置设备名称
+                text.text = SelectDevicesStrs[i];
+            }
+        }
+
+        // 当用户点击选择设备时调用
+        void OnClick_SelectDevice(string name)
+        {
+            // 获取选中设备的索引
+            int newValue = System.Array.IndexOf(SelectDevicesStrs, name);
+
+            // 如果选择不同设备,更新选择
+            if (selectDevicesIndex != newValue)
+            {
+                // 播放按钮音效
+                AudioMgr.ins.PlayBtn();
+
+                // 更新选择的设备索引和名称
+                selectDevicesIndex = newValue;
+                UserSettings.ins.selectDevicesName = SelectDevicesStrs[selectDevicesIndex];
+                UserSettings.ins.Save();
+
+                // 渲染更新后的选择
+                RenderSelectDevicesIndex(selectDevicesIndex);
+
+                //todo 调用串口后续流程?
+            }
+        }
+
+        /**
+         * 调试
+         */
+        public void OnClick_EnterDebuggingInfrared() {
+            if (InfraredDemo._ins != null) {
+                InfraredDemo._ins.OnClick_See(); 
+            }
+        }
+
+        public void OnClick_EnterDeviceConnect() {
+            AudioMgr.ins.PlayBtn();
+            ViewMgr.Instance.ShowView<DeviceViewInfrared>();
+        }
+
+        public void OnClick_EnterInfraredCenterCalibration()
+        {
+            //红外设备校准偏离点
+            InfraredDemo._ins?.OnClick_SetAdjustPointsOffset();
+
+        }
+        public void OnClick_ScreenCalibration()
+        {
+            //进入屏幕定位
+            ViewManager2.ShowView(ViewManager2.Path_InfraredView);
+
+        }
+
+        // Update is called once per frame
+        //void Update()
+        //{
+
+        //}
+    }
+}
+

+ 11 - 0
Assets/SmartBow/Scripts/Views/SettingsViewParts/BoxUserSettings.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 13c582886fcb0814a9c321c448f78e5a
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 87 - 9
Assets/SmartBow/Scripts/Views/ViewManager2.cs

@@ -12,21 +12,69 @@ public class ViewManager2
 
     private static List<ViewCacheInfo> _ViewCacheInfos = new();
 
+    private static GameObject currentViewParent;
+
     public static void ShowView(string path)
     {
-        string fullPath = "SmartBow/Prefabs/Views/" + path;
-        _DestroyExistViews(fullPath);
-        GameObject o = Object.Instantiate(Resources.Load<GameObject>(fullPath));
-        ViewCacheInfo viewCacheInfo = new ViewCacheInfo();
-        viewCacheInfo.fullPath = fullPath;
-        viewCacheInfo.gameObject = o;
-        _ViewCacheInfos.Add(viewCacheInfo);
+        InstantiateView(path);
+    }
+
+    public static GameObject getGameObjectAndShowView(string path)
+    {
+        GameObject o = InstantiateView(path);
+        return o;
     }
 
-    public static GameObject getGameObjectAndShowView(string path) {
+    static GameObject InstantiateView(string path)
+    {
+        //查找创造的ViewMgr 第一个层级作为ViewManager2的父节点
+        if (currentViewParent == null)
+        {
+            currentViewParent = ViewMgr.Instance.transform.Find("0").gameObject;
+        }
         string fullPath = "SmartBow/Prefabs/Views/" + path;
         _DestroyExistViews(fullPath);
-        GameObject o = Object.Instantiate(Resources.Load<GameObject>(fullPath));
+        GameObject o = Object.Instantiate(Resources.Load<GameObject>(fullPath), currentViewParent.transform);
+        // 根据条件是否设置原来的sorting
+        if (path == Path_GameResultView)
+        {
+            o.GetComponent<Canvas>().overrideSorting = true;
+        }
+        // 检查并移除 Canvas Scaler 组件
+        //UnityEngine.UI.CanvasScaler canvasScaler = o.GetComponent<UnityEngine.UI.CanvasScaler>();
+        //if (canvasScaler != null)
+        //{
+        //    Object.Destroy(canvasScaler);
+        //}
+        // 返回删除CanvasScaler对象
+        // 设置CanvasScaler RectTransform 的属性
+        RectTransform rectTransform = RemoveCanvasScaler(o.transform);
+
+        //RectTransform rectTransform = o.GetComponent<RectTransform>();
+        //if (rectTransform != null)
+        //{
+        //    rectTransform.localScale = Vector3.one; // 重置缩放
+        //    rectTransform.sizeDelta = ((RectTransform)currentViewParent.transform).rect.size; // 设置大小
+        //    rectTransform.anchoredPosition = Vector2.zero; // 重置位置
+        //}
+        // 设置 RectTransform 全屏适应父级
+        if (rectTransform != null)
+        {
+            if (rectTransform == o.GetComponent<RectTransform>())
+            {
+                rectTransform.anchorMin = Vector2.zero;      // 左下角对齐父级
+                rectTransform.anchorMax = Vector2.one;       // 右上角对齐父级
+                rectTransform.offsetMin = Vector2.zero;      // 移除左下角偏移
+                rectTransform.offsetMax = Vector2.zero;      // 移除右上角偏移
+                rectTransform.localScale = Vector3.one;      // 确保缩放为 1
+            }
+            else {
+                rectTransform.pivot = new Vector2(0.5f, 0.5f);
+                rectTransform.localScale = Vector3.one;      // 确保缩放为 1
+                rectTransform.sizeDelta = ((RectTransform)currentViewParent.transform).rect.size; // 设置大小
+                rectTransform.anchoredPosition = Vector2.zero; // 重置位置
+            }
+        }
         ViewCacheInfo viewCacheInfo = new ViewCacheInfo();
         viewCacheInfo.fullPath = fullPath;
         viewCacheInfo.gameObject = o;
@@ -34,6 +82,36 @@ public class ViewManager2
         return o;
     }
 
+    static RectTransform RemoveCanvasScaler(Transform parent)
+    {
+        // 检查自身是否有 Canvas 组件
+        Canvas canvas = parent.GetComponent<Canvas>();
+        if (canvas != null)
+        {
+            // 检查并移除 Canvas Scaler 组件
+            UnityEngine.UI.CanvasScaler canvasScaler = parent.GetComponent<UnityEngine.UI.CanvasScaler>();
+            if (canvasScaler != null)
+            {
+                Object.Destroy(canvasScaler);
+                return parent.GetComponent<RectTransform>(); // 返回删除 CanvasScaler 的 RectTransform
+            }
+        }
+        else
+        {
+            // 如果没有 Canvas,轮询子物体
+            foreach (Transform child in parent)
+            {
+                RectTransform result = RemoveCanvasScaler(child);
+                if (result != null) // 如果找到了被删除的 RectTransform,则返回
+                {
+                    return result;
+                }
+            }
+        }
+
+        return null; // 如果没有找到,则返回 null
+    }
+
     public static void HideView(string path)
     {
         string fullPath = "SmartBow/Prefabs/Views/" + path;

BIN
Assets/SmartBow/Textures/Settings/Level/SelectItem2.png


+ 123 - 0
Assets/SmartBow/Textures/Settings/Level/SelectItem2.png.meta

@@ -0,0 +1,123 @@
+fileFormatVersion: 2
+guid: c016aac1501f37846a542a3b9645c92a
+TextureImporter:
+  internalIDToNameTable: []
+  externalObjects: {}
+  serializedVersion: 12
+  mipmaps:
+    mipMapMode: 0
+    enableMipMap: 0
+    sRGBTexture: 1
+    linearTexture: 0
+    fadeOut: 0
+    borderMipMap: 0
+    mipMapsPreserveCoverage: 0
+    alphaTestReferenceValue: 0.5
+    mipMapFadeDistanceStart: 1
+    mipMapFadeDistanceEnd: 3
+  bumpmap:
+    convertToNormalMap: 0
+    externalNormalMap: 0
+    heightScale: 0.25
+    normalMapFilter: 0
+  isReadable: 0
+  streamingMipmaps: 0
+  streamingMipmapsPriority: 0
+  vTOnly: 0
+  ignoreMasterTextureLimit: 0
+  grayScaleToAlpha: 0
+  generateCubemap: 6
+  cubemapConvolution: 0
+  seamlessCubemap: 0
+  textureFormat: 1
+  maxTextureSize: 2048
+  textureSettings:
+    serializedVersion: 2
+    filterMode: 1
+    aniso: 1
+    mipBias: 0
+    wrapU: 1
+    wrapV: 1
+    wrapW: 0
+  nPOTScale: 0
+  lightmap: 0
+  compressionQuality: 50
+  spriteMode: 1
+  spriteExtrude: 1
+  spriteMeshType: 1
+  alignment: 0
+  spritePivot: {x: 0.5, y: 0.5}
+  spritePixelsToUnits: 100
+  spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+  spriteGenerateFallbackPhysicsShape: 1
+  alphaUsage: 1
+  alphaIsTransparency: 1
+  spriteTessellationDetail: -1
+  textureType: 8
+  textureShape: 1
+  singleChannelComponent: 0
+  flipbookRows: 1
+  flipbookColumns: 1
+  maxTextureSizeSet: 0
+  compressionQualitySet: 0
+  textureFormatSet: 0
+  ignorePngGamma: 0
+  applyGammaDecoding: 0
+  cookieLightType: 0
+  platformSettings:
+  - serializedVersion: 3
+    buildTarget: DefaultTexturePlatform
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  - serializedVersion: 3
+    buildTarget: Standalone
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  - serializedVersion: 3
+    buildTarget: Android
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  spriteSheet:
+    serializedVersion: 2
+    sprites: []
+    outline: []
+    physicsShape: []
+    bones: []
+    spriteID: 5e97eb03825dee720800000000000000
+    internalID: 0
+    vertices: []
+    indices: 
+    edges: []
+    weights: []
+    secondaryTextures: []
+    nameFileIdTable: {}
+  spritePackingTag: 
+  pSDRemoveMatte: 0
+  pSDShowRemoveMatteOption: 0
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

BIN
Assets/SmartBow/Textures/Settings/Level/SelectItem3.png


+ 123 - 0
Assets/SmartBow/Textures/Settings/Level/SelectItem3.png.meta

@@ -0,0 +1,123 @@
+fileFormatVersion: 2
+guid: 6910cabde3588fd4bab4aca225dc82b3
+TextureImporter:
+  internalIDToNameTable: []
+  externalObjects: {}
+  serializedVersion: 12
+  mipmaps:
+    mipMapMode: 0
+    enableMipMap: 0
+    sRGBTexture: 1
+    linearTexture: 0
+    fadeOut: 0
+    borderMipMap: 0
+    mipMapsPreserveCoverage: 0
+    alphaTestReferenceValue: 0.5
+    mipMapFadeDistanceStart: 1
+    mipMapFadeDistanceEnd: 3
+  bumpmap:
+    convertToNormalMap: 0
+    externalNormalMap: 0
+    heightScale: 0.25
+    normalMapFilter: 0
+  isReadable: 0
+  streamingMipmaps: 0
+  streamingMipmapsPriority: 0
+  vTOnly: 0
+  ignoreMasterTextureLimit: 0
+  grayScaleToAlpha: 0
+  generateCubemap: 6
+  cubemapConvolution: 0
+  seamlessCubemap: 0
+  textureFormat: 1
+  maxTextureSize: 2048
+  textureSettings:
+    serializedVersion: 2
+    filterMode: 1
+    aniso: 1
+    mipBias: 0
+    wrapU: 1
+    wrapV: 1
+    wrapW: 0
+  nPOTScale: 0
+  lightmap: 0
+  compressionQuality: 50
+  spriteMode: 1
+  spriteExtrude: 1
+  spriteMeshType: 1
+  alignment: 0
+  spritePivot: {x: 0.5, y: 0.5}
+  spritePixelsToUnits: 100
+  spriteBorder: {x: 28, y: 26, z: 28, w: 24}
+  spriteGenerateFallbackPhysicsShape: 1
+  alphaUsage: 1
+  alphaIsTransparency: 1
+  spriteTessellationDetail: -1
+  textureType: 8
+  textureShape: 1
+  singleChannelComponent: 0
+  flipbookRows: 1
+  flipbookColumns: 1
+  maxTextureSizeSet: 0
+  compressionQualitySet: 0
+  textureFormatSet: 0
+  ignorePngGamma: 0
+  applyGammaDecoding: 0
+  cookieLightType: 0
+  platformSettings:
+  - serializedVersion: 3
+    buildTarget: DefaultTexturePlatform
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  - serializedVersion: 3
+    buildTarget: Standalone
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  - serializedVersion: 3
+    buildTarget: Android
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  spriteSheet:
+    serializedVersion: 2
+    sprites: []
+    outline: []
+    physicsShape: []
+    bones: []
+    spriteID: 5e97eb03825dee720800000000000000
+    internalID: 1537655665
+    vertices: []
+    indices: 
+    edges: []
+    weights: []
+    secondaryTextures: []
+    nameFileIdTable: {}
+  spritePackingTag: 
+  pSDRemoveMatte: 0
+  pSDShowRemoveMatteOption: 0
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 25 - 17
Assets/WildAttack/Scripts/UI/MainPanel.cs

@@ -109,29 +109,37 @@ namespace WildAttack
             //_btnCalibrateGyr.onClick.AddListener(OnClick_CalibrateGyr);
             //_btnCalibrateMag.onClick.AddListener(OnClick_CalibrateMag);
 
-            if (BluetoothAim.ins && BluetoothAim.ins.isMainConnectToInfraredDevice())
+            if (CommonConfig.StandaloneModeOrPlatformB)
             {
                 _btnResetAim.gameObject.SetActive(false);
-
-                //校准
-                _btnCalibrationOffset.gameObject.SetActive(true);
-                _btnCalibrationOffset.onClick.AddListener(delegate () {
-                    AudioMgr.ins.PlayBtn();
-                    OnClick_ResetAim();
-                });
             }
             else {
-                _btnResetAim.onClick.AddListener(() => {
-                    if (_btnResetAim.GetComponent<LongPressMonitor>().isLongPress) return;
-                    OnClick_ResetAim();
-                });
-                _btnResetAim.gameObject.AddComponent<LongPressMonitor>().onLongPress += () =>
+
+                if (BluetoothAim.ins && BluetoothAim.ins.isMainConnectToInfraredDevice())
+                {
+                    _btnResetAim.gameObject.SetActive(false);
+
+                    //校准
+                    _btnCalibrationOffset.gameObject.SetActive(true);
+                    _btnCalibrationOffset.onClick.AddListener(delegate () {
+                        AudioMgr.ins.PlayBtn();
+                        OnClick_ResetAim();
+                    });
+                }
+                else
                 {
-                    AudioMgr.ins?.PlayBtn();
-                    if (SB_EventSystem.ins) SB_EventSystem.ins.AwakenSimulateMouse();
-                };
+                    _btnResetAim.onClick.AddListener(() => {
+                        if (_btnResetAim.GetComponent<LongPressMonitor>().isLongPress) return;
+                        OnClick_ResetAim();
+                    });
+                    _btnResetAim.gameObject.AddComponent<LongPressMonitor>().onLongPress += () =>
+                    {
+                        AudioMgr.ins?.PlayBtn();
+                        if (SB_EventSystem.ins) SB_EventSystem.ins.AwakenSimulateMouse();
+                    };
+                }
             }
-               
+  
             //_btnStopRotationSensor.onClick.AddListener(OnClick_StopRotationSensor);
             //_btnStopShootingSensor.onClick.AddListener(OnClick_StopShootingSensor);
 

Some files were not shown because too many files changed in this diff