NewUserGuiderManager.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6. using UnityEngine.SceneManagement;
  7. using JC.Unity.UI;
  8. public class NewUserGuiderManager : MonoBehaviour
  9. {
  10. [SerializeField] GameObject prefab_NewUserGuider;
  11. public static NewUserGuiderManager ins;
  12. void Awake()
  13. {
  14. if (ins) {
  15. Destroy(gameObject);
  16. return;
  17. }
  18. ins = this;
  19. DontDestroyOnLoad(gameObject);
  20. }
  21. void OnDestroy()
  22. {
  23. if (ins == this) ins = null;
  24. if (onSceneLoaded_added) SceneManager.sceneLoaded -= onSceneLoaded;
  25. }
  26. void Start()
  27. {
  28. SceneManager.sceneLoaded += onSceneLoaded; onSceneLoaded_added = true;
  29. if (!IsUserGuideFinished()) {
  30. ExecuteCurConfig();
  31. SaveUserGuideFinished(true);
  32. }
  33. }
  34. bool onSceneLoaded_added = false;
  35. void onSceneLoaded(Scene scene, LoadSceneMode loadSceneMode) { //初始话的场景不会触发
  36. if (scene.name == "Game" && GameMgr.gameType == 1) {
  37. switch (curConfigKey) {
  38. case "开始-限时游戏":
  39. OnClickedDestroyed(curConfigKey);
  40. break;
  41. case "限时游戏-选择距离":
  42. ExecuteCurConfig();
  43. break;
  44. }
  45. }
  46. }
  47. public void OnSkip()
  48. {
  49. curConfigKey = null;
  50. SaveUserGuideFinished(true);
  51. }
  52. public void OnEnd()
  53. {
  54. curConfigKey = null;
  55. SaveUserGuideFinished(true);
  56. }
  57. public void ReviewNewUserGuide()
  58. {
  59. int viewCount = PersistenHandler.ins.menuBackCtr.views.Count;
  60. for (int i = 0; i < viewCount; i++) {
  61. PersistenHandler.ins.menuBackCtr.OnOnceBack();
  62. }
  63. curConfigKey = "模块开机";
  64. ExecuteCurConfig();
  65. }
  66. void SaveUserGuideFinished(bool finished) {
  67. PlayerPrefs.SetInt("NewUserGuiderFinished", finished ? 1 : 0);
  68. }
  69. bool IsUserGuideFinished() {
  70. return PlayerPrefs.GetInt("NewUserGuiderFinished", 0) == 1 ? true : false;
  71. }
  72. void InitConfigs()
  73. {
  74. if (configsInited) return;
  75. configsInited = true;
  76. NewUserGuiderConfig config = new NewUserGuiderConfig();
  77. config.hitPosType = 1;
  78. config.hitPos = new Vector2(-86.4f, -70.3f);
  79. config.pointerRotZ = 120;
  80. config.pointerPosType = 1;
  81. config.pointerPos = new Vector2(-155, -31);
  82. config.frameTipPosType = 1;
  83. config.frameTipPos = new Vector2(-73.5f, 106);
  84. config.frameTipText = "长按模块上的<color=#FFA500>“开机”</color>键,当绿灯闪烁时,即模块处于等待连接的状态。";
  85. config.onStart = (g) => g.transform.Find("IconModule").gameObject.SetActive(true);
  86. configs.Add("模块开机", config);
  87. config = new NewUserGuiderConfig();
  88. config.hitActive = false;
  89. config.pointerActive = false;
  90. config.frameTipPivot = "ct";
  91. config.frameTipPosType = 1;
  92. config.frameTipPos = Vector2.zero;
  93. config.frameTipText = "恭喜您完成了本次新手教程,下次如果还\n要" +
  94. "<color=#FFA500>了解本教程</color>请在<color=#FFA500>游戏教程中选择新手指导</color>。";
  95. config.onStart = (g) => {
  96. g.GetMaskClickedEvent().AddListener(() => {
  97. OnEnd();
  98. });
  99. GameMode gameMode = GameMgr.ins.gameMode;
  100. if (gameMode.GetType().Equals(typeof(TimeLimitGameMode))) {
  101. gameMode.PauseTimeCounting(g);
  102. g.action_OnDestroy += () => gameMode.ResumeTimeCounting(g);
  103. }
  104. };
  105. configs.Add("教程结束", config);
  106. config = new NewUserGuiderConfig();
  107. config.frameTipPivot = "rb";
  108. config.frameTipPos = Vector2.zero;
  109. config.frameTipText = "点击<color=#FFA500>视角归位按钮,按完按键后立刻以标准射箭姿势瞄准\n靶心</color>," +
  110. "3秒后完成视角的自动归位。";
  111. config.onPrepare = (g) => {
  112. if (!GameAssistUI.ins) {
  113. g.customPreparePass = false;
  114. return;
  115. }
  116. g.customPreparePass = true;
  117. g.hollowOutMask.isTargetRectCanThrough = false;
  118. RectTransform btn4 = GameAssistUI.ins.transform.Find("Button4") as RectTransform;
  119. g.hollowOutMask.SetTarget(btn4);
  120. RectTransform btn4_img = btn4.Find("Image") as RectTransform;
  121. g.config.hitPos = btn4_img.position;
  122. g.config.pointerRotZ = 120;
  123. g.config.pointerPos = btn4_img.position + RectTransformUtils.CanvasV3ToScreenV3(new Vector3(-60, 60), btn4);
  124. g.config.frameTipPos = btn4_img.position + RectTransformUtils.CanvasV3ToScreenV3(new Vector3(-120, 120), btn4);
  125. // g.clickedWillPlayAudioBtn = false;
  126. // g.GetMaskClickedEvent().AddListener(() => {
  127. // btn4.GetComponent<Button>().onClick.Invoke();
  128. // });
  129. GameMode gameMode = GameMgr.ins.gameMode;
  130. if (gameMode.GetType().Equals(typeof(TimeLimitGameMode))) {
  131. gameMode.PauseTimeCounting(g);
  132. g.action_OnDestroy += () => gameMode.ResumeTimeCounting(g);
  133. }
  134. };
  135. config.onStart = (g) => {
  136. g.GetMaskClickedEvent().RemoveAllListeners();
  137. g.GetNewUserGuiderButton().onClick += g.OnClick_ToNext;
  138. };
  139. configs.Add("视角归位-触发", config);
  140. config = new NewUserGuiderConfig();
  141. config.frameTipPivot = "lc";
  142. config.frameTipText = "请参考图中小人的姿势,<color=#FFA500>立即瞄准屏幕中\n的靶心</color>,3秒后完成视角的自动归位。";
  143. config.onPrepare = (g) => {
  144. float rectSideLen = RectTransformUtils.ScreenV3ToCanvasV3(Vector3.right * Screen.height * 100 / 720f, g.GetComponent<RectTransform>()).x;
  145. Vector2 rectSize = new Vector2(rectSideLen, rectSideLen);
  146. RectTransform iconRect = g.transform.Find("IconRect") as RectTransform;
  147. iconRect.sizeDelta = rectSize;
  148. iconRect.gameObject.SetActive(true);
  149. g.hollowOutMask.isTargetRectCanThrough = false;
  150. g.hollowOutMask.SetTarget(iconRect);
  151. g.config.hitPosType = 1;
  152. g.config.hitPos = Vector2.zero;
  153. g.config.pointerPosType = 1;
  154. g.config.pointerRotZ = 120;
  155. g.config.pointerPos = new Vector2(-rectSideLen / 2 * 1.2f, rectSideLen / 2 * 1.1f);
  156. RectTransform iconHumanShoot = g.transform.Find("IconHumanShoot") as RectTransform;
  157. iconHumanShoot.anchoredPosition = g.config.pointerPos;
  158. iconHumanShoot.gameObject.SetActive(true);
  159. g.config.frameTipPosType = 1;
  160. g.config.frameTipPos = new Vector2(rectSideLen / 2 * 1.3f, 0);
  161. GameMode gameMode = GameMgr.ins.gameMode;
  162. if (gameMode.GetType().Equals(typeof(TimeLimitGameMode))) {
  163. gameMode.PauseTimeCounting(g);
  164. g.action_OnDestroy += () => gameMode.ResumeTimeCounting(g);
  165. }
  166. };
  167. configs.Add("视角归位-瞄准", config);
  168. config = new NewUserGuiderConfig();
  169. config.frameTipPivot = "lb";
  170. config.frameTipText = "点击<color=#FFA500>“连接”</color>等待设备提示连接成功,此时模块处于绿灯常亮的状态。";
  171. config.onPrepare = (g) => {
  172. RectTransform btn = GameObject.Find("HomeView/HomeViewRenderBow/Btn").GetComponent<RectTransform>();
  173. g.hollowOutMask.SetTarget(btn);
  174. g.hollowOutMask.isTargetRectCanThrough = false;
  175. g.SetIconPointerHitOpacity(0.5f);
  176. g.config.hitPos = btn.position;
  177. g.config.pointerPos = btn.position + RectTransformUtils.CanvasV3ToScreenV3(Vector3.up * 80f, btn);
  178. g.config.frameTipPos = btn.position + RectTransformUtils.CanvasV3ToScreenV3(Vector3.up * 150f, btn);
  179. };
  180. configs.Add("连接设备", config);
  181. config = new NewUserGuiderConfig();
  182. config.frameTipPivot = "lt";
  183. config.frameTipText = "点击<color=#FFA500>联机游戏</color>进入游戏";
  184. config.onPrepare = (g) => {
  185. RectTransform btn = GameObject.Find("HomeView/RightPanel/Item (1)").GetComponent<RectTransform>();
  186. g.hollowOutMask.SetTarget(btn);
  187. g.hollowOutMask.isTargetRectCanThrough = false;
  188. g.config.hitPos = RectTransformUtils.GetPositionByPivot(btn, new Vector2(0.5f, 0.6f));
  189. g.config.pointerPos = RectTransformUtils.GetPositionByPivot(btn, new Vector2(0.8f, 0.9f));
  190. g.config.frameTipPos = RectTransformUtils.GetPositionByPivot(btn, Vector2.zero);
  191. };
  192. configs.Add("联机游戏", config);
  193. config = new NewUserGuiderConfig();
  194. config.frameTipPivot = "lt";
  195. config.frameTipText = "点击<color=#FFA500>开始游戏</color>,开始对局吧!";
  196. config.onPrepare = (g) => {
  197. RectTransform btn = GameObject.Find("HomeView/RightPanel/Item").GetComponent<RectTransform>();
  198. g.hollowOutMask.SetTarget(btn);
  199. g.hollowOutMask.isTargetRectCanThrough = false;
  200. g.config.hitPos = RectTransformUtils.GetPositionByPivot(btn, new Vector2(0.5f, 0.6f));
  201. g.config.pointerPos = RectTransformUtils.GetPositionByPivot(btn, new Vector2(0.8f, 0.9f));
  202. g.config.frameTipPos = RectTransformUtils.GetPositionByPivot(btn, Vector2.zero);
  203. g.GetMaskClickedEvent().AddListener(() => {
  204. GameObject.Instantiate(SceneResMgr.ins.GetPrefab("GameStartView"));
  205. });
  206. };
  207. configs.Add("开始游戏", config);
  208. config = new NewUserGuiderConfig();
  209. config.frameTipPivot = "lt";
  210. config.frameTipText = "点击<color=#FFA500>弓箭</color>,查看更多信息。";
  211. config.onPrepare = (g) => {
  212. RectTransform btn = GameObject.Find("HomeView/HomeViewRenderBow/BtnShowDetail").GetComponent<RectTransform>();
  213. g.hollowOutMask.SetTarget(btn);
  214. g.hollowOutMask.isTargetRectCanThrough = false;
  215. g.config.hitPos = RectTransformUtils.GetPositionByPivot(btn, Vector2.one * 0.5f);
  216. g.config.pointerPos = RectTransformUtils.GetPositionByPivot(btn, new Vector2(0.8f, 0.7f));
  217. g.config.frameTipPos = RectTransformUtils.GetPositionByPivot(btn, new Vector2(0.8f, 0.5f));
  218. HomeViewRenderBow homeViewRenderBow = FindObjectOfType<HomeViewRenderBow>();
  219. if (homeViewRenderBow) {
  220. g.clickedWillPlayAudioBtn = false;
  221. g.GetMaskClickedEvent().AddListener(homeViewRenderBow.OnClick_ShowDeviceView);
  222. }
  223. };
  224. configs.Add("弓箭详情", config);
  225. config = new NewUserGuiderConfig();
  226. config.frameTipPivot = "rt";
  227. config.frameTipText = "点击查看<color=#FFA500>商城</color>";
  228. config.onPrepare = (g) => {
  229. RectTransform btn = GameObject.Find("TopBarView/TopBar/IconShop").GetComponent<RectTransform>();
  230. g.hollowOutMask.SetTarget(btn);
  231. g.hollowOutMask.isTargetRectCanThrough = false;
  232. g.SetIconPointerHitOpacity(0.6f);
  233. g.config.hitPos = RectTransformUtils.GetPositionByPivot(btn, Vector2.one * 0.5f);
  234. g.config.pointerRotZ = 180;
  235. g.config.pointerPos = RectTransformUtils.GetPositionByPivot(btn, Vector2.one * -0.1f);
  236. g.config.frameTipPos = RectTransformUtils.GetPositionByPivot(btn, Vector2.zero)
  237. + RectTransformUtils.CanvasV3ToScreenV3(Vector3.down * 80f, g.iconPointer);
  238. };
  239. configs.Add("查看商城", config);
  240. config = new NewUserGuiderConfig();
  241. config.frameTipPivot = "rt";
  242. config.frameTipText = "点击<color=#FFA500>设置</color>了解更多";
  243. config.onPrepare = (g) => {
  244. RectTransform btn = GameObject.Find("TopBarView/TopBar/IconSetUp").GetComponent<RectTransform>();
  245. g.hollowOutMask.SetTarget(btn);
  246. g.hollowOutMask.isTargetRectCanThrough = false;
  247. g.SetIconPointerHitOpacity(0.6f);
  248. g.config.hitPos = RectTransformUtils.GetPositionByPivot(btn, Vector2.one * 0.5f);
  249. g.config.pointerRotZ = 180;
  250. g.config.pointerPos = RectTransformUtils.GetPositionByPivot(btn, Vector2.one * -0.1f);
  251. g.config.frameTipPos = RectTransformUtils.GetPositionByPivot(btn, Vector2.zero)
  252. + RectTransformUtils.CanvasV3ToScreenV3(Vector3.down * 80f, g.iconPointer);
  253. };
  254. configs.Add("查看设置", config);
  255. config = new NewUserGuiderConfig();
  256. config.frameTipPivot = "lt";
  257. config.frameTipText = "点击切换<color=#FFA500>好友/排行榜</color>";
  258. config.onPrepare = (g) => {
  259. RectTransform btn = GameObject.Find("HomeView/FriendBar/FrameBtnTop").GetComponent<RectTransform>();
  260. g.hollowOutMask.SetTarget(btn);
  261. g.hollowOutMask.isTargetRectCanThrough = false;
  262. g.SetIconPointerHitOpacity(0.6f);
  263. g.config.hitPos = RectTransformUtils.GetPositionByPivot(btn, Vector2.one * 0.5f);
  264. g.config.pointerRotZ = -30;
  265. g.config.pointerPos = RectTransformUtils.GetPositionByPivot(btn, new Vector2(1.2f, 0.9f));
  266. g.config.frameTipPos = RectTransformUtils.GetPositionByPivot(btn, new Vector2(1.2f, 0));
  267. };
  268. configs.Add("切换好友/排行榜", config);
  269. config = new NewUserGuiderConfig();
  270. config.frameTipPivot = "lc";
  271. config.frameTipText = "展开查看<color=#FFA500>更多详情</color>";
  272. config.onPrepare = (g) => {
  273. RectTransform btn = GameObject.Find("HomeView/FriendBar/FrameBtnBottom").GetComponent<RectTransform>();
  274. g.hollowOutMask.SetTarget(btn);
  275. g.hollowOutMask.isTargetRectCanThrough = false;
  276. g.SetIconPointerHitOpacity(0.8f);
  277. g.config.hitPos = RectTransformUtils.GetPositionByPivot(btn, Vector2.one * 0.5f);
  278. g.config.pointerRotZ = -30;
  279. g.config.pointerPos = RectTransformUtils.GetPositionByPivot(btn, new Vector2(1, 0.9f));
  280. g.config.frameTipPos = RectTransformUtils.GetPositionByPivot(btn, new Vector2(1.5f, 0.5f));
  281. };
  282. configs.Add("展开好友/排行榜", config);
  283. config = new NewUserGuiderConfig();
  284. config.frameTipPivot = "rt";
  285. config.frameTipText = "将安装了模块的智能弓箭<color=#FFA500>静置在一个平面</color>";
  286. config.onPrepare = (g) => {
  287. if (!DeviceView1.ins) {
  288. g.customPreparePass = false;
  289. return;
  290. }
  291. g.customPreparePass = true;
  292. RectTransform btn = DeviceView1.ins.transform.Find("ItemInfo/BowOptions/GyrCalibrate") as RectTransform;
  293. g.hollowOutMask.SetTarget(btn);
  294. g.hollowOutMask.isTargetRectCanThrough = false;
  295. g.SetIconPointerHitOpacity(0.8f);
  296. g.config.hitPos = RectTransformUtils.GetPositionByPivot(btn, Vector2.one * 0.5f);
  297. g.config.pointerRotZ = 180;
  298. g.config.pointerPos = RectTransformUtils.GetPositionByPivot(btn, new Vector2(-0.1f, 0.2f));
  299. g.config.frameTipPos = RectTransformUtils.GetPositionByPivot(btn, new Vector2(0.3f, 0))
  300. + RectTransformUtils.CanvasV3ToScreenV3(Vector3.down * 80f, g.iconPointer);
  301. };
  302. configs.Add("设备-陀螺仪校准", config);
  303. config = new NewUserGuiderConfig();
  304. config.frameTipPivot = "rt";
  305. config.frameTipText = "将安装了模块的智能弓箭<color=#FFA500>沿着每一个轴旋转</color>";
  306. config.onPrepare = (g) => {
  307. if (!DeviceView1.ins) {
  308. g.customPreparePass = false;
  309. return;
  310. }
  311. g.customPreparePass = true;
  312. RectTransform btn = DeviceView1.ins.transform.Find("ItemInfo/BowOptions/MagCalibrate") as RectTransform;
  313. g.hollowOutMask.SetTarget(btn);
  314. g.hollowOutMask.isTargetRectCanThrough = false;
  315. g.SetIconPointerHitOpacity(0.8f);
  316. g.config.hitPos = RectTransformUtils.GetPositionByPivot(btn, Vector2.one * 0.5f);
  317. g.config.pointerRotZ = 180;
  318. g.config.pointerPos = RectTransformUtils.GetPositionByPivot(btn, new Vector2(-0.1f, 0.2f));
  319. g.config.frameTipPos = RectTransformUtils.GetPositionByPivot(btn, new Vector2(0.3f, 0))
  320. + RectTransformUtils.CanvasV3ToScreenV3(Vector3.down * 60f, g.iconPointer);
  321. DeviceView1 deviceView1 = FindObjectOfType<DeviceView1>();
  322. if (deviceView1) {
  323. g.clickedWillPlayAudioBtn = false;
  324. g.GetMaskClickedEvent().AddListener(deviceView1.OnClick_Back);
  325. }
  326. };
  327. configs.Add("设备-地磁计校准", config);
  328. config = new NewUserGuiderConfig();
  329. config.frameTipPivot = "lt";
  330. config.frameTipText = "点击<color=#FFA500>“限时游戏”</color>选择游戏类型";
  331. config.onPrepare = (g) => {
  332. if (!GameStartView.ins) {
  333. g.customPreparePass = false;
  334. return;
  335. }
  336. g.customPreparePass = true;
  337. RectTransform btn = GameStartView.ins.transform.Find("EntryList/Item (1)") as RectTransform;
  338. g.hollowOutMask.SetTarget(btn);
  339. g.hollowOutMask.isTargetRectCanThrough = false;
  340. g.config.hitPos = RectTransformUtils.GetPositionByPivot(btn, Vector2.one * 0.5f);
  341. g.config.pointerRotZ = 180;
  342. g.config.pointerPos = RectTransformUtils.GetPositionByPivot(btn, new Vector2(0.2f, 0.3f));
  343. g.config.frameTipPos = RectTransformUtils.GetPositionByPivot(btn, new Vector2(0.4f, 0.15f));
  344. };
  345. config.onStart = (g) => {
  346. GameStartView gameStartView = FindObjectOfType<GameStartView>();
  347. if (gameStartView) {
  348. string ck = g.config.key;
  349. g.GetMaskClickedEvent().RemoveAllListeners();
  350. g.GetMaskClickedEvent().AddListener(() => {
  351. gameStartView.GoTo("限时");
  352. //后续在NewUserGuiderManager.onSceneLoaded触发
  353. });
  354. }
  355. };
  356. configs.Add("开始-限时游戏", config);
  357. config = new NewUserGuiderConfig();
  358. config.frameTipPivot = "lc";
  359. config.frameTipText = "选择距离<color=#FFA500>“10米”</color>开始游戏吧!";
  360. config.onPrepare = (g) => {
  361. if (g.hollowOutMask.enabled) g.hollowOutMask.enabled = false;
  362. if (!TimeLimitGameDistanceSelectView.ins) {
  363. g.customPreparePass = false;
  364. return;
  365. }
  366. g.customPreparePass = true;
  367. g.hollowOutMask.enabled = true;
  368. RectTransform btn = TimeLimitGameDistanceSelectView.ins.transform.Find("Layout/Item") as RectTransform;
  369. g.hollowOutMask.SetTarget(btn);
  370. g.hollowOutMask.isTargetRectCanThrough = false;
  371. g.config.hitPos = RectTransformUtils.GetPositionByPivot(btn, Vector2.one * 0.5f);
  372. g.config.pointerRotZ = -30;
  373. g.config.pointerPos = RectTransformUtils.GetPositionByPivot(btn, new Vector2(0.85f, 0.5f));
  374. g.config.frameTipPos = RectTransformUtils.GetPositionByPivot(btn, new Vector2(1.15f, 0.4f));
  375. g.clickedWillPlayAudioBtn = false;
  376. g.GetMaskClickedEvent().AddListener(() => {
  377. btn.GetComponent<Button>().onClick.Invoke();
  378. });
  379. };
  380. configs.Add("限时游戏-选择距离", config);
  381. }
  382. #if UNITY_EDITOR
  383. bool warn_test = false;
  384. void Update() {
  385. if (!warn_test) {
  386. warn_test = true;
  387. Debug.LogWarning("F3-重置设备校准引导,规则引导");
  388. Debug.LogWarning("F4-重置新手引导记录");
  389. }
  390. if (Input.GetKeyDown(KeyCode.F3)) {
  391. Debug.Log("重置设备校准引导,规则引导");
  392. AimHandler.ins.MagCalibrater = new o0._9Axis.MagnetometerAutoCalibrater();
  393. UserSettings.ins.deviceCalibrateGuideFinish = false;
  394. UserSettings.ins.gameRuleGuideFinish = new HashSet<int>();
  395. }
  396. if (Input.GetKeyDown(KeyCode.F4)) {
  397. Debug.Log("重置新手引导记录");
  398. SaveUserGuideFinished(false);
  399. }
  400. }
  401. #endif
  402. private Dictionary<string, NewUserGuiderConfig> configs = new Dictionary<string, NewUserGuiderConfig>();
  403. private bool configsInited = false;
  404. [SerializeField] public string curConfigKey = "模块开机";
  405. private List<string> configKeyList = new List<string>(new string[]{
  406. "模块开机",
  407. "连接设备",
  408. "弓箭详情",
  409. "设备-陀螺仪校准",
  410. "设备-地磁计校准",
  411. "查看设置",
  412. "查看商城",
  413. "切换好友/排行榜",
  414. "展开好友/排行榜",
  415. "联机游戏",
  416. "开始游戏",
  417. "开始-限时游戏",
  418. "限时游戏-选择距离",
  419. "视角归位-触发",
  420. "视角归位-瞄准",
  421. "教程结束",
  422. });
  423. void ExecuteCurConfig() {
  424. InitConfigs();
  425. NewUserGuiderConfig config = configs[curConfigKey];
  426. config.key = curConfigKey;
  427. NewUserGuider guider = Instantiate(prefab_NewUserGuider).GetComponent<NewUserGuider>();
  428. guider.config = config;
  429. }
  430. public void OnClickedDestroyed(string configKey) {
  431. int nextIndex = configKeyList.IndexOf(configKey) + 1;
  432. if (nextIndex >= configKeyList.Count) return;
  433. curConfigKey = configKeyList[nextIndex];
  434. ExecuteCurConfig();
  435. }
  436. }
  437. public class NewUserGuiderConfig
  438. {
  439. public string key;
  440. //0:position,1:anchoredPosition
  441. public int hitPosType = 0;
  442. public Vector2 hitPos;
  443. public bool hitActive = true;
  444. //icon pointer rotation z
  445. public float pointerRotZ;
  446. public int pointerPosType = 0;
  447. public Vector2 pointerPos;
  448. public bool pointerActive = true;
  449. //frameTip-Pivot l:left,r:right,t:top,b:bottom,ct:center
  450. public string frameTipPivot = "lt";
  451. public int frameTipPosType = 0;
  452. public Vector2 frameTipPos;
  453. //frameTip text
  454. public string frameTipText;
  455. public Action<NewUserGuider> onPrepare;
  456. public Action<NewUserGuider> onStart;
  457. }