浏览代码

返回按钮监听,注册自动生成账号

lvjincheng 3 年之前
父节点
当前提交
26fdea39f5

+ 51 - 5
Assets/BowArrow/Scripts/Expand/PersistenHandler.cs

@@ -1,12 +1,14 @@
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
+using UnityEngine.SceneManagement;
 
 //持久化的处理脚本,在app启动时就应开始常驻
 public class PersistenHandler : MonoBehaviour
 {
-    public static PersistenHandler ins;
+    public MenuBackController menuBackCtr = new MenuBackController();
 
+    public static PersistenHandler ins;
     public static void Init() {
         if (ins) return;
         GameObject obj = new GameObject("PersistenHandler");
@@ -14,18 +16,62 @@ public class PersistenHandler : MonoBehaviour
         DontDestroyOnLoad(obj);
     }
 
-    long lastPressExitTime = 0;
-
     void Update()
+    {
+        menuBackCtr.Update();
+    }
+}
+public class MenuBackController {
+    public List<MenuBackInterface> views = new List<MenuBackInterface>();
+    long lastPressExitTime = 0;
+    public void Update()
     {
         if (Input.GetKeyDown(KeyCode.Escape)) {
             long lastLast = lastPressExitTime;
             lastPressExitTime = JC.CS.Utility.GetTimestamp();
             if (lastPressExitTime - lastLast < 10 * 1000) {
-                Application.Quit();
+                OnTwiceBack();
             } else {
-                PopupMgr.ins.ShowTip("再按一次退出APP");
+                OnOnceBack();
             }
         }
     }
+    public void BanTwice() {
+        lastPressExitTime = 0;
+    }
+    public void OnOnceBack() {
+        var sceneName = SceneManager.GetActiveScene().name;
+        if (sceneName == "Entry") {
+            BanTwice();
+            Debug.Log("菜单退出: " + sceneName);
+            Application.Quit();
+            return;
+        }
+        if (sceneName.StartsWith("Game")) {
+            BanTwice();
+            Debug.Log("菜单返回主页");
+            SceneManager.LoadScene("Home", LoadSceneMode.Single);
+            return;
+        }
+        if (views.Count > 0) {
+            BanTwice();
+            MenuBackInterface i = views[views.Count - 1];
+            if (i.OnMenuBack()) {
+                views.Remove(i);
+                Debug.Log("菜单返回成功: " + i);
+            } else {
+                Debug.Log("菜单返回失败: " + i);
+            }
+            return;
+        }
+        Debug.Log("菜单退出APP询问");
+        PopupMgr.ins.ShowTip("再按一次退出APP");
+    }
+    public void OnTwiceBack() {
+        Debug.Log("菜单退出APP");
+        Application.Quit();
+    }
+}
+public interface MenuBackInterface {
+    public bool OnMenuBack();
 }

+ 13 - 1
Assets/BowArrow/Scripts/Manager/LoginMgr/AgreementPopup.cs

@@ -2,7 +2,7 @@ using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 /* 弹窗-用户协议和隐私政策 */
-public class AgreementPopup : MonoBehaviour
+public class AgreementPopup : MonoBehaviour, MenuBackInterface
 {
     void Awake() {
         HyperlinkText hyperlinkText = null;
@@ -23,12 +23,24 @@ public class AgreementPopup : MonoBehaviour
     
     void Start()
     {
+        PersistenHandler.ins?.menuBackCtr.views.Add(this);
+
         if (PlayerPrefs.GetInt("AgreementPopupChecked", 0) == 1) {
             this.gameObject.SetActive(false);
             AgreenmentOption.ins.SetAgreementChecked(true);
         }
     }
 
+    void OnDestroy()
+    {
+        PersistenHandler.ins?.menuBackCtr.views.Remove(this);
+    }
+
+    public bool OnMenuBack() {
+        Disagree();
+        return true;
+    }
+
     public void Agree() {
         PlayerPrefs.SetInt("AgreementPopupChecked", 1);
         this.gameObject.SetActive(false);

+ 14 - 1
Assets/BowArrow/Scripts/Manager/LoginMgr/AgreementView.cs

@@ -4,8 +4,21 @@ using UnityEngine;
 using UnityEngine.UI;
 using UnityEngine.Networking;
 /* 界面-用户协议和隐私政策 */
-public class AgreementView : MonoBehaviour
+public class AgreementView : MonoBehaviour, MenuBackInterface
 {
+    void Start()
+    {
+        PersistenHandler.ins?.menuBackCtr.views.Add(this);
+    }
+    void OnDestroy()
+    {
+        PersistenHandler.ins?.menuBackCtr.views.Remove(this);
+    }
+    public bool OnMenuBack() {
+        Destroy(gameObject);
+        return true;
+    }
+
     public void EnterUserAgreement() {
         GetTitleText().text = TextAutoLanguage2.GetTextByKey("agreement_user");
         StartCoroutine(GetUserAgreement());

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

@@ -50,13 +50,13 @@ public class LoginView : MonoBehaviour
 
     void Update() {
         #if UNITY_EDITOR
-            if (Input.GetKeyDown(KeyCode.Q)) {
+            if (Input.GetKeyDown(KeyCode.F1)) {
                 GetInputField(loginInUser).text = "lvjincheng";
                 GetInputField(loginInPWD).text = "19980301";
                 GetInputField(loginInCaptcha1).text = captcha_Login.ToString();
                 LoginNormal();
             }
-            if (Input.GetKeyDown(KeyCode.W)) {
+            if (Input.GetKeyDown(KeyCode.F2)) {
                 GetInputField(loginInUser).text = "tester";
                 GetInputField(loginInPWD).text = "123456";
                 GetInputField(loginInCaptcha1).text = captcha_Login.ToString();

+ 2 - 0
Assets/BowArrow/Scripts/Manager/LoginMgr/RegisterView.cs

@@ -36,6 +36,8 @@ public class RegisterView : MonoBehaviour
             GameObject.FindObjectOfType<LoginMgr>().showLoginView();
         };
         agreementPopup.gameObject.SetActive(true);
+        //他们觉得注册时候玩家填写用户名有点麻烦,所以想用户名自动生成
+        GetInputField(registerInUser).text = (JC.CS.Utility.GetTimestamp() / 1000).ToString();
     }
 
     void Start()

+ 13 - 1
Assets/BowArrow/Scripts/View/AboutUsView.cs

@@ -2,8 +2,20 @@ using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 /* 界面-关于我们 */
-public class AboutUsView : MonoBehaviour
+public class AboutUsView : MonoBehaviour, MenuBackInterface
 {
+    void Start()
+    {
+        PersistenHandler.ins?.menuBackCtr.views.Add(this);
+    }
+    void OnDestroy()
+    {
+        PersistenHandler.ins?.menuBackCtr.views.Remove(this);
+    }
+    public bool OnMenuBack() {
+        Destroy(gameObject);
+        return true;
+    }
     public void Back() {
         AudioMgr.ins.PlayBtn();
         Destroy(this.gameObject);

+ 8 - 1
Assets/BowArrow/Scripts/View/ChallengeOptionView.cs

@@ -3,14 +3,16 @@ using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.SceneManagement;
 /* 界面-挑战关卡选择 */
-public class ChallengeOptionView : MonoBehaviour
+public class ChallengeOptionView : MonoBehaviour, MenuBackInterface
 {
     void Start() {
         HomeMgr.CacheView(this);
+        PersistenHandler.ins?.menuBackCtr.views.Add(this);
     }
 
     void OnDestroy() {
         HomeMgr.RemoveCacheView(this);
+        PersistenHandler.ins?.menuBackCtr.views.Remove(this);
     }
 
     public void StartGame(int gameType) {
@@ -38,4 +40,9 @@ public class ChallengeOptionView : MonoBehaviour
         AudioMgr.ins.PlayBtn();
         Destroy(this.gameObject);
     }
+
+    public bool OnMenuBack() {
+        Destroy(gameObject);
+        return true;
+    }
 }

+ 14 - 1
Assets/BowArrow/Scripts/View/CourseView.cs

@@ -3,7 +3,7 @@ using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.UI;
 /* 教程界面(主界面功能) */
-public class CourseView : MonoBehaviour
+public class CourseView : MonoBehaviour, MenuBackInterface
 {
     [SerializeField] GameObject scrollViewContent;
     [SerializeField] GameObject scrollViewContentItem;
@@ -40,9 +40,22 @@ public class CourseView : MonoBehaviour
         }
     }
 
+    void Start()
+    {
+        PersistenHandler.ins?.menuBackCtr.views.Add(this);
+    }
+    void OnDestroy()
+    {
+        PersistenHandler.ins?.menuBackCtr.views.Remove(this);
+    }
+
     public void back() {
         AudioMgr.ins.PlayBtn();
         Destroy(this.gameObject);
     }
 
+    public bool OnMenuBack() {
+        Destroy(gameObject);
+        return true;
+    }
 }

+ 11 - 1
Assets/BowArrow/Scripts/View/DeviceCalibrateView.cs

@@ -3,7 +3,7 @@ using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.UI;
 /* 设备校准界面,公用(设备界面的校准、校准教程) */
-public class DeviceCalibrateView : MonoBehaviour
+public class DeviceCalibrateView : MonoBehaviour, MenuBackInterface
 {
     [SerializeField] Button btnGyrCalibrate;
     [SerializeField] Text progressGyrCalibrate;
@@ -73,11 +73,15 @@ public class DeviceCalibrateView : MonoBehaviour
             }
         }
         RefreshPage();
+        if (!guide) {
+            PersistenHandler.ins?.menuBackCtr.views.Add(this);
+        }
     }
 
     void OnDestroy()
     {
         if (ins == this) ins = null;
+        PersistenHandler.ins?.menuBackCtr.views.Remove(this);
         try { 
             GlobalEventCenter.ins.onDeviceCalibrateViewAwakeChanged?.Invoke(false); 
         } catch (System.Exception e) { Debug.LogError(e.Message); }
@@ -90,6 +94,12 @@ public class DeviceCalibrateView : MonoBehaviour
         // }
     }
 
+    public bool OnMenuBack() {
+        var is_interactable = btnFinish.interactable;
+        if (is_interactable) Destroy(gameObject);
+        return is_interactable;
+    }
+
     bool canUpdateGyrCalibrateProgress = false;
 
     float calibrateMagStartTime = 0; //地磁校准开始时刻

+ 13 - 1
Assets/BowArrow/Scripts/View/DeviceView.cs

@@ -3,7 +3,7 @@ using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.UI;
 /* 设备界面 */
-public class DeviceView : MonoBehaviour
+public class DeviceView : MonoBehaviour, MenuBackInterface
 {
     Transform scrollContent;
     Transform itemPrefab;
@@ -13,6 +13,8 @@ public class DeviceView : MonoBehaviour
     List<DeviceInfo> deviceList;
     void Start()
     {
+        PersistenHandler.ins?.menuBackCtr.views.Add(this);
+
         scrollContent = this.transform.Find("ScrollView/Viewport/Content");
         itemPrefab = scrollContent.GetChild(0);
         itemPrefab.gameObject.SetActive(false);
@@ -93,11 +95,21 @@ public class DeviceView : MonoBehaviour
         // SelectAccForArrow(LoginMgr.myUserInfo.arrowAccValue);
     }
 
+    void OnDestroy()
+    {
+        PersistenHandler.ins?.menuBackCtr.views.Remove(this);
+    }
+
     void FixedUpdate()
     {
         UpdateBtnForConnect();
     }
 
+    public bool OnMenuBack() {
+        Destroy(gameObject);
+        return true;
+    }
+
     BluetoothStatusEnum bowStatus;
     // BluetoothStatusEnum arrowStatus;
     void UpdateBtnForConnect() {

+ 9 - 1
Assets/BowArrow/Scripts/View/FriendView.cs

@@ -6,7 +6,7 @@ using UnityEngine.UI;
 using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 /* 界面-好友 */
-public class FriendView : MonoBehaviour
+public class FriendView : MonoBehaviour, MenuBackInterface
 {
     [SerializeField] GameObject myFriendBox;
     [SerializeField] GameObject friendRequestBox;
@@ -24,6 +24,8 @@ public class FriendView : MonoBehaviour
 
     void Start()
     {
+        PersistenHandler.ins?.menuBackCtr.views.Add(this);
+
         if (UserPlayer.ins != null) {
             UserPlayer.ins.tempData.onUpdate += onUserPlayerTempDataUpdate;
             onUserPlayerTempDataUpdate();
@@ -32,11 +34,17 @@ public class FriendView : MonoBehaviour
     }
 
     void OnDestroy() {
+        PersistenHandler.ins?.menuBackCtr.views.Remove(this);
         if (UserPlayer.ins != null) {
             UserPlayer.ins.tempData.onUpdate -= onUserPlayerTempDataUpdate;
         }
     }
 
+    public bool OnMenuBack() {
+        Destroy(gameObject);
+        return true;
+    }
+
     void onUserPlayerTempDataUpdate() {
         try {
             var data = UserPlayer.ins.tempData;

+ 9 - 2
Assets/BowArrow/Scripts/View/GameStartView.cs

@@ -3,16 +3,23 @@ using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.SceneManagement;
 /* 界面-游戏开始 */
-public class GameStartView : MonoBehaviour
+public class GameStartView : MonoBehaviour, MenuBackInterface
 {
     void Start() {
+        PersistenHandler.ins?.menuBackCtr.views.Add(this);
         HomeMgr.CacheView(this);
     }
 
     void OnDestroy() {
+        PersistenHandler.ins?.menuBackCtr.views.Remove(this);
         HomeMgr.RemoveCacheView(this);
     }
-
+    
+    public bool OnMenuBack() {
+        Destroy(gameObject);
+        return true;
+    }
+    
     public void GoTo(string target) {
         AudioMgr.ins.PlayBtn();
         switch (target)

+ 13 - 1
Assets/BowArrow/Scripts/View/MeView.cs

@@ -3,7 +3,7 @@ using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.UI;
 /* 我的信息界面(点击主界面头像进入) */
-public class MeView : MonoBehaviour
+public class MeView : MonoBehaviour, MenuBackInterface
 {
     [SerializeField] Image avatarImage;
     [SerializeField] Text nameText;
@@ -11,11 +11,23 @@ public class MeView : MonoBehaviour
 
     void Start()
     {
+        PersistenHandler.ins?.menuBackCtr.views.Add(this);
+
         this.transform.Find("AvatarFrame").GetComponent<Button>().onClick.AddListener(ShowAvatarSelectView);
 
         RenderAfterSave();
     }
 
+    void OnDestroy()
+    {
+        PersistenHandler.ins?.menuBackCtr.views.Remove(this);
+    }
+
+    public bool OnMenuBack() {
+        Destroy(gameObject);
+        return true;
+    }
+
     public void Back() {
         AudioMgr.ins.PlayBtn();
         Destroy(this.gameObject);

+ 8 - 1
Assets/BowArrow/Scripts/View/PKGameOptionView.cs

@@ -3,14 +3,21 @@ using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.SceneManagement;
 
-public class PKGameOptionView : MonoBehaviour
+public class PKGameOptionView : MonoBehaviour, MenuBackInterface
 {
     void Start() {
         HomeMgr.CacheView(this);
+        PersistenHandler.ins?.menuBackCtr.views.Add(this);
     }
 
     void OnDestroy() {
         HomeMgr.RemoveCacheView(this);
+        PersistenHandler.ins?.menuBackCtr.views.Remove(this);
+    }
+
+    public bool OnMenuBack() {
+        Destroy(gameObject);
+        return true;
     }
 
     public void GoTo(string target) {

+ 8 - 1
Assets/BowArrow/Scripts/View/PKMatchView.cs

@@ -5,7 +5,7 @@ using UnityEngine;
 using UnityEngine.UI;
 using Newtonsoft.Json.Linq;
 /* 界面-PK匹配 */
-public class PKMatchView : MonoBehaviour
+public class PKMatchView : MonoBehaviour, MenuBackInterface
 {
     [SerializeField] Sprite[] matchHeadBGList;
 
@@ -19,6 +19,7 @@ public class PKMatchView : MonoBehaviour
     void Start()
     {
         HomeMgr.CacheView(this);
+        PersistenHandler.ins?.menuBackCtr.views.Add(this);
 
         Sprite avatar = RoleMgr.GetAvatar(LoginMgr.myUserInfo.avatarID);
         string nickname = LoginMgr.myUserInfo.nickname;
@@ -29,6 +30,12 @@ public class PKMatchView : MonoBehaviour
     void OnDestroy()
     {
         HomeMgr.RemoveCacheView(this);
+        PersistenHandler.ins?.menuBackCtr.views.Remove(this);
+    }
+
+    public bool OnMenuBack() {
+        Destroy(gameObject);
+        return true;
     }
 
     #region 左栏条目切换

+ 10 - 1
Assets/BowArrow/Scripts/View/PKMatchingView.cs

@@ -5,7 +5,7 @@ using UnityEngine;
 using UnityEngine.UI;
 using UnityEngine.SceneManagement;
 /* 界面-PK匹配中 */
-public class PKMatchingView : MonoBehaviour
+public class PKMatchingView : MonoBehaviour, MenuBackInterface
 {
     [SerializeField] Sprite[] matchHeadBGList;
 
@@ -47,11 +47,14 @@ public class PKMatchingView : MonoBehaviour
 
     public void OnDestroy() {
         if (ins == this) ins = null;
+        PersistenHandler.ins?.menuBackCtr.views.Remove(this);
         PKComp.ins.cancelRandomMatch();
     }
 
     void Start()
     {
+        PersistenHandler.ins?.menuBackCtr.views.Add(this);
+
         Sprite avatar = RoleMgr.GetAvatar(LoginMgr.myUserInfo.avatarID);
         string nickname = LoginMgr.myUserInfo.nickname;
         RenderPlayerInfo(1, avatar, nickname, true);
@@ -78,6 +81,12 @@ public class PKMatchingView : MonoBehaviour
         }
     }
 
+    public bool OnMenuBack() {
+        var isActive = this.transform.Find("Back").gameObject.activeSelf;
+        if (isActive) Destroy(gameObject);
+        return isActive;
+    }
+
     public void EnterGameSceneOnMatchSuccess() {
         int otherIndex = (GlobalData.playerIndexInRoom + 1) % 2;
         MatchPlayerInfo info = GlobalData.matchPlayerInfos[otherIndex];

+ 13 - 1
Assets/BowArrow/Scripts/View/RankView.cs

@@ -5,7 +5,7 @@ using UnityEngine;
 using UnityEngine.UI;
 using Newtonsoft.Json.Linq;
 /* 界面-排行榜 */
-public class RankView : MonoBehaviour
+public class RankView : MonoBehaviour, MenuBackInterface
 {
     [SerializeField] GameObject rankListBox;
 
@@ -19,9 +19,21 @@ public class RankView : MonoBehaviour
     }
 
     void Start() {
+        PersistenHandler.ins?.menuBackCtr.views.Add(this);
+
         SetBtnTabSelected(btnTabs[0]);
     }
 
+    void OnDestroy()
+    {
+        PersistenHandler.ins?.menuBackCtr.views.Remove(this);
+    }
+
+    public bool OnMenuBack() {
+        Destroy(gameObject);
+        return true;
+    }
+
     public void Back() {
         AudioMgr.ins.PlayBtn();
         Destroy(this.gameObject);

+ 9 - 1
Assets/BowArrow/Scripts/View/RoleSelectView.cs

@@ -4,13 +4,15 @@ using UnityEngine;
 using UnityEngine.UI;
 using UnityEngine.SceneManagement;
 /* PK模式的角色选择界面 */
-public class RoleSelectView : MonoBehaviour
+public class RoleSelectView : MonoBehaviour, MenuBackInterface
 {
     bool[] inited = {false, false};
 
     void Start()
     {
         HomeMgr.CacheView(this);
+        PersistenHandler.ins?.menuBackCtr.views.Add(this);
+
         GlobalData.localPK_playerRoleIDs[0] = LoginMgr.myUserInfo.avatarID;
         RenderPlayer(0);
         RenderPlayer(1);
@@ -18,6 +20,12 @@ public class RoleSelectView : MonoBehaviour
 
     void OnDestroy() {
         HomeMgr.RemoveCacheView(this);
+        PersistenHandler.ins?.menuBackCtr.views.Remove(this);
+    }
+
+    public bool OnMenuBack() {
+        Destroy(gameObject);
+        return true;
     }
 
     void RenderPlayer(int playerIndex) {

+ 13 - 1
Assets/BowArrow/Scripts/View/SetUpView.cs

@@ -6,7 +6,7 @@ using UnityEngine.UI;
 using UnityEngine.Events;
 using UnityEngine.SceneManagement;
 /* 设置界面 */
-public class SetUpView : MonoBehaviour
+public class SetUpView : MonoBehaviour, MenuBackInterface
 {
     [SerializeField] Image[] crossHairOptionChecks;
     InputField inputSize;
@@ -14,6 +14,8 @@ public class SetUpView : MonoBehaviour
 
     void Start()
     {
+        PersistenHandler.ins?.menuBackCtr.views.Add(this);
+
         this.transform.Find("Items/BGM/Check").gameObject.SetActive(UserSettings.ins.openBGM);
         this.transform.Find("Items/Effect/Check").gameObject.SetActive(UserSettings.ins.openEffect);
         this.transform.Find("Items/BowCameraFixed/Check").gameObject.SetActive(UserSettings.ins.bowCameraFixed);
@@ -24,6 +26,16 @@ public class SetUpView : MonoBehaviour
         InitForRotateConvert();
     }
 
+    void OnDestroy()
+    {
+        PersistenHandler.ins?.menuBackCtr.views.Remove(this);
+    }
+
+    public bool OnMenuBack() {
+        Destroy(gameObject);
+        return true;
+    }
+
     void InitForRotateConvert() {
         inputSize = transform.Find("RotateConvert/InputSize").GetComponent<InputField>();
         inputDistance = transform.Find("RotateConvert/InputDistance").GetComponent<InputField>();

+ 16 - 1
Assets/BowArrow/Scripts/View/SetUpView1.cs

@@ -4,7 +4,7 @@ using UnityEngine;
 using UnityEngine.UI;
 using UnityEngine.SceneManagement;
 /* 设置界面1 */
-public class SetUpView1 : MonoBehaviour
+public class SetUpView1 : MonoBehaviour, MenuBackInterface
 {
     void Awake() {
         if (CommonConfig.needToExamine) {
@@ -13,6 +13,21 @@ public class SetUpView1 : MonoBehaviour
         }
     }
 
+    void Start()
+    {
+        PersistenHandler.ins?.menuBackCtr.views.Add(this);
+    }
+
+    void OnDestroy()
+    {
+        PersistenHandler.ins?.menuBackCtr.views.Remove(this);
+    }
+
+    public bool OnMenuBack() {
+        Destroy(gameObject);
+        return true;
+    }
+
     public void GoToGameSetupView() {
         AudioMgr.ins.PlayBtn();
         GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/SetUpView"), Vector3.zero, new Quaternion());

+ 13 - 2
Assets/BowArrow/Scripts/View/ShopView.cs

@@ -5,7 +5,7 @@ using UnityEngine;
 using UnityEngine.UI;
 using JC;
 /* 商城界面 */
-public class ShopView : MonoBehaviour
+public class ShopView : MonoBehaviour, MenuBackInterface
 {
     [SerializeField] Sprite[] optionSprites;
     [SerializeField] GameObject options;
@@ -15,8 +15,19 @@ public class ShopView : MonoBehaviour
     [SerializeField] GameObject introduceItem;
 
     void Start() {
+        PersistenHandler.ins?.menuBackCtr.views.Add(this);
+
         InitOptions();
-        
+    }
+
+    void OnDestroy()
+    {
+        PersistenHandler.ins?.menuBackCtr.views.Remove(this);
+    }
+
+    public bool OnMenuBack() {
+        Destroy(gameObject);
+        return true;
     }
 
     void InitOptions() {

+ 14 - 1
Assets/BowArrow/Scripts/View/VideoView.cs

@@ -4,7 +4,7 @@ using UnityEngine;
 using UnityEngine.UI;
 using UnityEngine.Video;
 /* 教程界面(主界面功能) */
-public class VideoView : MonoBehaviour
+public class VideoView : MonoBehaviour, MenuBackInterface
 {
     GameObject videoBG;
     RawImage videoBox;
@@ -45,6 +45,19 @@ public class VideoView : MonoBehaviour
         ShowUiForPause(false);
     }
 
+    void Start()
+    {
+        PersistenHandler.ins?.menuBackCtr.views.Add(this);
+    }
+    void OnDestroy()
+    {
+        PersistenHandler.ins?.menuBackCtr.views.Remove(this);
+    }
+    public bool OnMenuBack() {
+        Destroy(gameObject);
+        return true;
+    }
+
     float unpreparetime = 0;
 
     void Update() {