GeneratingTarget.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using TMPro;
  4. using UnityEngine;
  5. using UnityEngine.EventSystems;
  6. using UnityEngine.UI;
  7. using UnityEngine.SceneManagement;
  8. using SmartBowSDK;
  9. using System;
  10. using HyperspaceGame;
  11. using MathNet.Numerics;
  12. public class GeneratingTarget : MonoBehaviour
  13. {
  14. // 最小时间间隔(秒)
  15. float _minTimeBetweenEvents = 1.0f;
  16. public float minTimeBetweenEvents { get { return _minTimeBetweenEvents; } set { _minTimeBetweenEvents = value; } }
  17. float _maxTimeBetweenEvents = 3.0f;// 最大时间间隔(秒)
  18. public float maxTimeBetweenEvents { get { return _maxTimeBetweenEvents; } set { _maxTimeBetweenEvents = value; } }
  19. public GameObject target;
  20. public Transform UI;
  21. public TextMeshProUGUI scoreUI;
  22. public TextMeshProUGUI scoreUI1;
  23. public Text countDownUI;
  24. public TextMeshProUGUI clipsizeUI;
  25. public TextMeshProUGUI hitCountUI;
  26. public TextMeshProUGUI shootRate;
  27. public GameObject GameOver;
  28. public Score scoreCom;
  29. public Score scoreCom1;
  30. public GameObject Miss;
  31. public Image grade;
  32. public Transform tp;
  33. public GameObject bulletNull;//子弹不足UI
  34. public GameObject[] bulletImages;//子弹图片数组
  35. public GameObject SelectLv;
  36. public Image imgSlider;
  37. public Text TopScore;
  38. public Text CurLvTxt;
  39. public Text MaxLvTxt;
  40. public int bulletCount;//子弹数量
  41. public int hitCount;//击中数量
  42. private float rate;//命中率
  43. public Button BtnRestart;
  44. public Button BtnNext;
  45. public Button BtnLast;
  46. int _score;
  47. public bool stop = false;
  48. public int score { get { return _score; }
  49. set {
  50. _score = value;
  51. ShowScore();
  52. }
  53. }
  54. /// <summary>
  55. /// 游戏时间
  56. /// </summary>
  57. private float countDownTime;
  58. int countDownTimeCache;
  59. /// <summary>
  60. /// 子弹数量
  61. /// </summary>
  62. private int clipsize;
  63. const int BulletCount = 15;
  64. /// <summary>
  65. /// 靶子存在最长时间
  66. /// </summary>
  67. float _targetExistenceTimeMax = 5;
  68. public float TargetExistenceTimeMax { get { return _targetExistenceTimeMax; } set { _targetExistenceTimeMax = value; } }
  69. /// <summary>
  70. /// 靶子存在最短时间
  71. /// </summary>
  72. float _targetExistenceTimeMin = 3;
  73. public float TargetExistenceTimeMin { get { return _targetExistenceTimeMin; } set { _targetExistenceTimeMin = value; } }
  74. float _scaleMin = 1.3f;
  75. public float ScaleMin { get { return _scaleMin; } set { _scaleMin = value; } }
  76. float _scaleMax = 1.8f;
  77. public float ScaleMax { get { return _scaleMax; } set { _scaleMax = value; } }
  78. public HyperspaceGame.Font font;
  79. public AudioSource ShootingSound;
  80. public AudioSource gameSatrtSound;
  81. public AudioClip[] gameSatrtClips;
  82. //public GameObject perfect;
  83. //public GameObject gaeat;
  84. //public GameObject good;
  85. //public Image goodImage;
  86. //public Image greatImage;
  87. public static GeneratingTarget gm { get; set; }
  88. public ShootingEvent shootingEvent;
  89. /// <summary>
  90. /// 记录当前射箭是否记录分数
  91. /// </summary>
  92. private bool bAddCountScore { get; set; } = false;
  93. [HideInInspector] public bool getAddCountScore => bAddCountScore;
  94. //分数统计
  95. [HideInInspector] public UserGameAnalyse1 userGameAnalyse1;
  96. public int Index = 0;
  97. private bool unload = false;
  98. /// <summary>
  99. /// 当前难度的配置
  100. /// </summary>
  101. public Level LvCfg = null;
  102. /// <summary>
  103. /// 当前序列的配置
  104. /// </summary>
  105. public Order orderCfg = null;
  106. float nextOrderWaitTime;
  107. int curOrderIdx;
  108. bool canEnterNextOrder = true;
  109. bool isbegin = false;
  110. int tragetLeftNum;
  111. /// <summary>
  112. /// 当前序列
  113. /// </summary>
  114. public int CurOrder = 0;
  115. public static int MaxLevel = 3;
  116. public List<Sprite> ScoreLevel;
  117. public List<Sprite> EnScoreLevel;
  118. [SerializeField]
  119. RectTransform _canvasRectTransform;
  120. private void Awake()
  121. {
  122. gm = this;
  123. var scene = SceneManager.GetActiveScene();
  124. if(scene.name == "Hyperspace01")
  125. Index = 0;
  126. else if (scene.name == "Hyperspace02")
  127. Index = 1;
  128. else if(scene.name == "Hyperspace03")
  129. Index = 2;
  130. //初始化关卡配置
  131. LvCfg = Config.levels[Index];
  132. countDownTime = LvCfg.TotalTime;
  133. curOrderIdx = 0;
  134. UpdateCountDown(LvCfg.TotalTime);
  135. CurLvTxt.text = $"{Index + 1}";
  136. MaxLvTxt.text = $"/<color=#0F92D4>{MaxLevel}</color>";
  137. shootingEvent = FindObjectOfType<ShootingEvent>();
  138. scoreCom.gameObject.SetActive(false);
  139. scoreCom1.gameObject.SetActive(false);
  140. Miss.SetActive(false);
  141. stop = false;
  142. imgSlider.fillAmount = 1;
  143. ShowScore();
  144. bulletNull.SetActive(false);
  145. BtnRestart.onClick.AddListener(OnRestart);
  146. BtnNext.onClick.AddListener(OnBtnNext);
  147. BtnNext.gameObject.SetActive(Index + 1 < MaxLevel);
  148. BtnLast.onClick.AddListener(OnBtnLast);
  149. BtnLast.gameObject.SetActive(true);
  150. GameOver.SetActive(false);
  151. CreateUIManager();
  152. CreateTargetObject2D();
  153. //是否关闭背景音效
  154. if (!UserSettings.ins.openBGM) {
  155. AudioSource bgm = GetComponent<AudioSource>();
  156. bgm.Stop();
  157. }
  158. }
  159. public void OnRestart()
  160. {
  161. Restart(Index);
  162. }
  163. public void OnBtnNext()
  164. {
  165. Restart(Index + 1);
  166. }
  167. public void OnBtnLast()
  168. {
  169. //Restart(Index - 1);
  170. onUploadScore();
  171. ////结束游戏页面
  172. //userGameAnalyse1.UploadData(true);
  173. //userGameAnalyse1.onResetOverlayData();
  174. //SceneManager.LoadScene("Home", LoadSceneMode.Single);
  175. //结束游戏页面
  176. userGameAnalyse1.showResultView(() =>
  177. {
  178. gm = null;
  179. SceneManager.LoadScene("Home", LoadSceneMode.Single);
  180. });
  181. }
  182. void Start()
  183. {
  184. if (ShootCheck.ins.bluetoothDeviceStatus == BluetoothDeviceStatus.MagazineLoading)
  185. OnLoading();
  186. else
  187. OnSeparation();
  188. //Screen.SetResolution(1280, 720, false); // 设置分辨率为1920x1080,‌并设置为全屏模式
  189. Invoke("GameStart", 4);
  190. Game1();
  191. Invoke("Game2", 1);
  192. Invoke("Game3", 2);
  193. var canvases = FindObjectsByType<Canvas>(FindObjectsSortMode.InstanceID);
  194. foreach (var canvas in canvases)
  195. {
  196. if (canvas.name == "Canvas")
  197. {
  198. _canvasRectTransform = canvas.GetComponent<RectTransform>();
  199. break;
  200. }
  201. }
  202. //靶子默认状态
  203. var show = UIManager._ins.GetArrowBtnState();
  204. var arrow = shootingEvent.GetComponent<Image>();
  205. var color = arrow.color;
  206. if (show)
  207. color.a = 1;
  208. else
  209. color.a = 0;
  210. arrow.color = color;
  211. UIManager._ins.ShowQuit();
  212. }
  213. public void OpenSelectLevel()
  214. {
  215. SelectLv.SetActive(true);
  216. }
  217. public Vector2 GetCanvasSize()
  218. {
  219. return _canvasRectTransform.sizeDelta;
  220. }
  221. void Game1()
  222. {
  223. gameSatrtSound.clip = gameSatrtClips[0];
  224. if (UserSettings.ins.openEffect) gameSatrtSound.Play();
  225. }
  226. void Game2()
  227. {
  228. gameSatrtSound.clip = gameSatrtClips[1];
  229. if (UserSettings.ins.openEffect) gameSatrtSound.Play();
  230. }
  231. void Game3()
  232. {
  233. gameSatrtSound.clip = gameSatrtClips[2];
  234. if (UserSettings.ins.openEffect) gameSatrtSound.Play();
  235. }
  236. void GameStart()
  237. {
  238. isbegin = true;
  239. }
  240. private float reloadTime = 0;
  241. private void Reload(bool delay = false)
  242. {
  243. if (delay)
  244. {
  245. reloadTime = 3f;
  246. }
  247. else
  248. {
  249. clipsize = BulletCount;
  250. bulletCount -= font.Clip;
  251. bulletCount += clipsize;
  252. font.Clip = clipsize;
  253. bulletNull.SetActive(false);
  254. for (int i = 0; i < bulletImages.Length; i++)
  255. {
  256. bulletImages[i].SetActive(true);
  257. }
  258. }
  259. }
  260. public bool Reloading()
  261. {
  262. return unload;
  263. //return reloadTime > 0;
  264. }
  265. float _lastShootTime = 0;
  266. /// <summary>
  267. /// 射击
  268. /// </summary>
  269. /// <param name="bAddCount">是否是有效射箭</param>
  270. public void Shooting(bool bAddCount = false)
  271. {
  272. //加个间隔
  273. if (Time.realtimeSinceStartup - _lastShootTime < 0.5f) return;
  274. _lastShootTime = Time.realtimeSinceStartup;
  275. bAddCountScore = bAddCount;
  276. DoShoot();
  277. }
  278. private void DoShoot()
  279. {
  280. if (shootingEvent.ShootUIBtn())
  281. return;
  282. if (unload || clipsize <= 0)
  283. {
  284. Debug.Log("卸了弹夹 或者 没子弹了!");
  285. //没有子弹的声音
  286. //ShootingSound.Play();
  287. bulletImages[0].SetActive(false);
  288. bulletNull.SetActive(true);
  289. return;
  290. }
  291. else
  292. {
  293. //正常发射的声音
  294. if (UserSettings.ins.openEffect) ShootingSound.Play();
  295. }
  296. clipsize--;
  297. if (clipsize <= 0)
  298. {
  299. //Reload(true);//不自动装弹
  300. }
  301. font.Clip = clipsize;
  302. bulletImages[clipsize].SetActive(false);
  303. shootingEvent.OnShooting();
  304. }
  305. //int tempScore = 0;
  306. private void Update()
  307. {
  308. //if (reloadTime > 0)
  309. //{
  310. // reloadTime -= Time.deltaTime;
  311. // if (reloadTime <= 0)
  312. // Reload();
  313. //}
  314. #if UNITY_EDITOR
  315. if (Input.GetMouseButtonDown(0))
  316. {
  317. shootingEvent.OnPositionUpdate(Input.mousePosition);
  318. Shooting(true);
  319. }
  320. if (Input.GetKeyDown(KeyCode.W))
  321. {
  322. countDownTime = 0;
  323. }
  324. if (Input.GetKeyDown(KeyCode.R))
  325. {
  326. UIManager._ins.Reload();
  327. }
  328. //if (Input.GetKeyDown(KeyCode.T))
  329. //{
  330. // GameOverGrade(tempScore);
  331. // tempScore += 10;
  332. //}
  333. #endif
  334. if (isbegin)
  335. {
  336. if (canEnterNextOrder)//靶子全消失了 开始走序列休息时间
  337. {
  338. if (nextOrderWaitTime <= 0)
  339. {
  340. //开始下一序列
  341. TriggerRandomEvent();
  342. }
  343. nextOrderWaitTime -= Time.deltaTime;
  344. }
  345. //游戏倒计时
  346. if (countDownTime <= 0)
  347. {
  348. //游戏时间到了 结束
  349. GameEnd();
  350. }
  351. else
  352. {
  353. countDownTime -= Time.deltaTime;
  354. var timeInt = Mathf.CeilToInt(countDownTime);
  355. if(timeInt != countDownTimeCache)
  356. {
  357. countDownTimeCache = timeInt;
  358. UpdateCountDown(countDownTimeCache);
  359. }
  360. imgSlider.fillAmount = countDownTime / (float)LvCfg.TotalTime;
  361. }
  362. if (curMoveCtrl != null && curMoveCtrl is IUpdate)
  363. {
  364. (curMoveCtrl as IUpdate).Update();
  365. }
  366. }
  367. }
  368. private void UpdateCountDown(int value)
  369. {
  370. countDownUI.text = $"{value}";
  371. }
  372. private void GameEnd()
  373. {
  374. stop = true;
  375. GameOver.SetActive(true);
  376. GameOverGrade(score);
  377. isbegin = false;
  378. countDownTimeCache = 0;
  379. onShowRankView();
  380. //游戏结束上传分数
  381. onUploadScore();
  382. }
  383. /// <summary>
  384. /// 下一轮
  385. /// </summary>
  386. void TriggerRandomEvent()
  387. {
  388. canEnterNextOrder = false;
  389. Debug.Log($"新一轮创建 curOrderIdx={curOrderIdx}");
  390. if (LvCfg.orders.Length > curOrderIdx)
  391. {
  392. orderCfg = LvCfg.orders[curOrderIdx];
  393. CreateTargets();
  394. curOrderIdx++;
  395. }
  396. else
  397. GameEnd();
  398. }
  399. Dictionary<MoveType, Move> movesCtrl = new Dictionary<MoveType, Move>()
  400. {
  401. [MoveType.Stay] = new Stay(),
  402. [MoveType.VET] = new VET(),
  403. [MoveType.ROT] = new ROT(),
  404. [MoveType.W] = new W(),
  405. [MoveType.W2] = new W2(),
  406. [MoveType.RelativeHor] = new RelativeHor(),
  407. [MoveType.RelativeVet] = new RelativeVet(),
  408. [MoveType.HOR] = new HOR(),
  409. [MoveType.Diagonal] = new Diagonal(),
  410. [MoveType.LeftToRight] = new LeftToRight(),
  411. [MoveType.RightToLeft] = new RightToLeft(),
  412. };
  413. private Move curMoveCtrl;
  414. /// <summary>
  415. /// 创建当前轮靶子
  416. /// </summary>
  417. private void CreateTargets()
  418. {
  419. var createCount = orderCfg.Big + orderCfg.Middle + orderCfg.Small;
  420. Debug.Log($"创建数量 Big={orderCfg.Big} Middle={orderCfg.Middle} Small={orderCfg.Small}");
  421. tragetLeftNum = createCount;
  422. List<SpineAnimationLoader> gos = new List<SpineAnimationLoader>();
  423. for (int i = 0; i < createCount; i++)
  424. {
  425. var go = Instantiate(target, tp);
  426. var targetIns = go.GetComponent<SpineAnimationLoader>();
  427. if(i < orderCfg.Big)
  428. targetIns.Init(0.8f * 0.732f, orderCfg, OnTargetDestory);
  429. else if (i < orderCfg.Big + orderCfg.Middle)
  430. targetIns.Init(0.5f * 0.692f, orderCfg, OnTargetDestory);
  431. else
  432. targetIns.Init(0.3f * 0.733f, orderCfg, OnTargetDestory);
  433. go.SetActive(true);
  434. gos.Add(targetIns);
  435. }
  436. movesCtrl.TryGetValue(orderCfg.MoveType, out curMoveCtrl);
  437. if (curMoveCtrl == null)
  438. curMoveCtrl = movesCtrl[MoveType.Stay];
  439. curMoveCtrl.SetGo(gos);
  440. }
  441. /// <summary>
  442. /// 靶子被射击或者到时间销毁
  443. /// </summary>
  444. private void OnTargetDestory()
  445. {
  446. tragetLeftNum--;
  447. if (tragetLeftNum <= 0)
  448. {
  449. curMoveCtrl = null;
  450. Debug.Log("当前轮结束");
  451. canEnterNextOrder = true;
  452. //重置休息时间
  453. nextOrderWaitTime = orderCfg.WaitTime;
  454. }
  455. }
  456. public void ShowScore()
  457. {
  458. //font.Text = score;
  459. TopScore.text = score.ToString().PadLeft(3, '0');
  460. }
  461. public Score scoreSprite;
  462. public void ShowScoreCom(int score, Vector3 pos, Vector2 scorepos, Transform tf, int posIdx)
  463. {
  464. Debug.Log($"得分 score{score}");
  465. if (score >= 6)
  466. {
  467. var go = GameObject.Instantiate(scoreCom, pos, Quaternion.identity, _canvasRectTransform);
  468. go.gameObject.SetActive(true);
  469. go.transform.localScale = Vector3.one * 0.55f;
  470. go.ShowScore(score, scorepos);
  471. }
  472. else
  473. {
  474. var go = GameObject.Instantiate(scoreCom1, tf.position, Quaternion.identity, _canvasRectTransform);
  475. go.gameObject.SetActive(true);
  476. var halfRadius = 547f * 0.5f;
  477. var offest = tf.localScale.x * halfRadius + 80f;
  478. var x = (posIdx == 1 || posIdx == 2) ? offest : -offest;
  479. var y = (posIdx == 1 || posIdx == 4) ? offest : -offest;
  480. go.ShowScore(score, new Vector3(x, y, 0));
  481. }
  482. }
  483. public void ShowMiss(Vector3 position)
  484. {
  485. Debug.LogWarning("MISS");
  486. if (stop)
  487. return;
  488. var go = GameObject.Instantiate(Miss, position, Quaternion.identity, tp);//_canvasRectTransform
  489. go.AddComponent<CountDown>().time = 5f;
  490. go.transform.SetAsFirstSibling();
  491. go.SetActive(true);
  492. }
  493. public void GameOverGrade(int score)
  494. {
  495. //打靶游戏最近一次分数
  496. //设置一下需要上传排行榜的分数
  497. //LocalRank.RankManager.SetCurrentScore((int)score);
  498. hitCountUI.text = hitCount.ToString();
  499. var bulletUse = bulletCount - font.Clip;
  500. clipsizeUI.text = bulletUse.ToString();
  501. float rate = 0;
  502. if (hitCount != 0)
  503. rate = (float)hitCount / (float)bulletUse;
  504. if(rate == 0)
  505. {
  506. rate = 0;
  507. }
  508. shootRate.text = string.Format("{0:P0}", rate);
  509. font.Text = score;
  510. var maxScore = 0;
  511. foreach (var item in LvCfg.orders)
  512. {
  513. maxScore += item.Big + item.Middle + item.Small;
  514. }
  515. maxScore *= 10;
  516. var percent = (float)score / (float)maxScore * 100f;
  517. Debug.Log($"得分比例:{percent} score={score} maxScore={maxScore}");
  518. var index = Mathf.CeilToInt(percent / 10) - 1;
  519. if (index < 0) index = 0;
  520. grade.sprite = TextAutoLanguage2.GetLanguage() == LanguageEnum.Chinese ? ScoreLevel[index]: EnScoreLevel[index];
  521. grade.SetNativeSize();
  522. RectTransform rectTransform = grade.GetComponent<RectTransform>();
  523. rectTransform.anchoredPosition = TextAutoLanguage2.GetLanguage() == LanguageEnum.Chinese ? new Vector3(-152, 15, 1) : new Vector3(-144, 15, 1);
  524. rectTransform.localScale = TextAutoLanguage2.GetLanguage() == LanguageEnum.Chinese ? new Vector3(0.55f, 0.55f, 1) : new Vector3(0.25f, 0.25f, 1);
  525. //
  526. }
  527. public void Restart(int index)
  528. {
  529. string name = "";
  530. if (index == 0)
  531. name = "Hyperspace01";
  532. else if (index == 1)
  533. name = "Hyperspace02";
  534. else if (index == 2)
  535. name = "Hyperspace03";
  536. SceneManager.LoadScene(name);
  537. }
  538. //public void SetTarget(int index)
  539. //{
  540. // goodImage.sprite = font.sprites[index];
  541. // good.SetActive(true);
  542. //}
  543. //public void SetGreat(int index)
  544. //{
  545. // greatImage.sprite = font.sprites[index];
  546. // gaeat.SetActive(true);
  547. //}
  548. /// <summary>
  549. /// 弹夹分离
  550. /// </summary>
  551. public void OnSeparation()
  552. {
  553. unload = true;
  554. clipsize = 0;
  555. bulletCount -= font.Clip;
  556. font.Clip = clipsize;
  557. }
  558. /// <summary>
  559. /// 弹夹上膛
  560. /// </summary>
  561. public void OnLoading()
  562. {
  563. unload = false;
  564. Reload();
  565. }
  566. #region 新增 UIManager 和 TargetObject2D
  567. private GameObject uiManagerInstance;
  568. private GameObject targetObject2D;
  569. // 动态加载并生成 UIManager
  570. public void CreateUIManager()
  571. {
  572. GameObject uiManagerPrefab = Resources.Load<GameObject>("UIManager"); // 从 Resources 中加载 UIManager 预制
  573. uiManagerInstance = Instantiate(uiManagerPrefab); // 实例化 UIManager
  574. //管理分数上传
  575. userGameAnalyse1 = UserGameAnalyse1.CreateWhenGameStartAndReturn(16);
  576. }
  577. //校准靶子
  578. public void CreateTargetObject2D() {
  579. GameObject targetObject2DPrefab = Resources.Load<GameObject>("TargetObject2D");
  580. targetObject2D = Instantiate(targetObject2DPrefab, UI);
  581. }
  582. // 销毁 UIManager 实例
  583. public void DestroyUIManager()
  584. {
  585. if (UIManager._ins != null)
  586. {
  587. Destroy(UIManager._ins.gameObject); // 销毁 UIManager 实例
  588. uiManagerInstance = null;
  589. }
  590. }
  591. /// <summary>
  592. /// 射击次数
  593. /// </summary>
  594. /// <param name="count"></param>
  595. public void onShootCount(int count)
  596. {
  597. userGameAnalyse1.changeShootingCount(count);
  598. }
  599. /// <summary>
  600. /// 上传分数到服务器
  601. /// </summary>
  602. public void onUploadScore()
  603. {
  604. if (_score > 0)
  605. {
  606. Debug.Log("上传的积分为:" + _score);
  607. RankComp.Instance.uploadSinglePlayerGameRes(_score);
  608. _score = 0;
  609. }
  610. }
  611. public void onShowRankView() {
  612. if (CommonConfig.StandaloneModeOrPlatformB)
  613. {
  614. //_score = 400;
  615. //设置一下需要上传排行榜的分数
  616. LocalRank.RankManager.SetCurrentScore((int)_score);
  617. LocalRank.RankManager.CreateRankView(GlobalData.singlePlayerGameType, null);
  618. }
  619. }
  620. #endregion
  621. }