Advertisement
Guest User

GameManagerCombineMap

a guest
May 14th, 2021
502
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 38.75 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using Steamworks;
  6. using TMPro;
  7. using UnityEngine;
  8. using UnityEngine.Analytics;
  9. using UnityEngine.SceneManagement;
  10. using UnityEngine.UI;
  11. public class GameManager : MonoBehaviour
  12. {
  13. public List<Rigidbody> SpawnedWeapons
  14. {
  15. get
  16. {
  17. return this.mSpawnedWeapons;
  18. }
  19. }
  20. public static GameManager Instance
  21. {
  22. get
  23. {
  24. return GameManager._instance;
  25. }
  26. }
  27. public Controller LastWinner { get; private set; }
  28. public virtual void Awake()
  29. {
  30. Application.SetStackTraceLogType(LogType.Log, StackTraceLogType.None);
  31. Application.SetStackTraceLogType(LogType.Warning, StackTraceLogType.None);
  32. Debug.Log("StickVer " + StickFightConstants.VERSION_VALUE);
  33. this.numberOfMaps = Application.levelCount - 2;
  34. this.levelSelector = base.GetComponent<LevelSelection>();
  35. this.onlineRoom = base.GetComponent<OnlineRoom>();
  36. this.vicotory = base.GetComponent<Vicotory>();
  37. this.mCountDownHandler = UnityEngine.Object.FindObjectOfType<CountDown>();
  38. if (GameManager._instance != null && GameManager._instance != this)
  39. {
  40. UnityEngine.Object.Destroy(base.gameObject);
  41. }
  42. else
  43. {
  44. GameManager._instance = this;
  45. }
  46. this.m_WeaponSelectionHandler = UnityEngine.Object.FindObjectOfType<WeaponSelectionHandler>();
  47. this.mNetworkManager = UnityEngine.Object.FindObjectOfType<MultiplayerManager>();
  48. this.lastMapNumber = new MapWrapper
  49. {
  50. MapType = 0,
  51. MapData = BitConverter.GetBytes(0)
  52. };
  53. }
  54. public virtual void Start()
  55. {
  56. GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(GameObject.Find("Show Wins"));
  57. gameObject.transform.SetParent(GameObject.Find("GameSettingsMask").transform.GetChild(0).GetChild(1), false);
  58. gameObject.transform.SetSiblingIndex(10);
  59. gameObject.name = "Combine Maps";
  60. gameObject.GetComponentInChildren<TextMeshProUGUI>().text = "COMBINE MAPS";
  61. Navigation navigation = gameObject.transform.GetChild(1).GetComponent<Button>().navigation;
  62. navigation.mode = Navigation.Mode.Explicit;
  63. navigation.selectOnUp = GameObject.Find("Show Wins").transform.GetChild(1).GetComponent<Button>();
  64. gameObject.transform.GetChild(1).GetComponent<Button>().navigation = navigation;
  65. Navigation navigation2 = GameObject.Find("Show Wins").transform.GetChild(1).GetComponent<Button>().navigation;
  66. navigation2.mode = Navigation.Mode.Explicit;
  67. navigation2.selectOnDown = gameObject.transform.GetChild(1).GetComponent<Button>();
  68. GameObject.Find("Show Wins").transform.GetChild(1).GetComponent<Button>().navigation = navigation2;
  69. Navigation navigation3 = gameObject.transform.parent.FindChild("Back").GetChild(0).GetComponent<Button>().navigation;
  70. navigation3.mode = Navigation.Mode.Explicit;
  71. navigation3.selectOnUp = gameObject.transform.GetChild(1).GetComponent<Button>();
  72. gameObject.transform.parent.FindChild("Back").GetChild(0).GetComponent<Button>().navigation = navigation3;
  73. this.controllerHandler = base.GetComponent<ControllerHandler>();
  74. this.winText = base.GetComponentInChildren<WinText>(true).GetComponent<TextMeshProUGUI>();
  75. this.au = base.GetComponentInChildren<AudioSource>();
  76. this.hoardHandler = UnityEngine.Object.FindObjectOfType<HoardHandler>();
  77. this.crown = UnityEngine.Object.FindObjectOfType<Crown>();
  78. this.InitAnalytics();
  79. }
  80. public virtual void InitAnalytics()
  81. {
  82. ulong steamID = SteamUser.GetSteamID().m_SteamID;
  83. Analytics.SetUserId(steamID.ToString());
  84. GameManager.m_AnalyticsTrigger = AnalytcisTrigger.Instance;
  85. }
  86. public virtual void OnGUI()
  87. {
  88. }
  89. public virtual void Update()
  90. {
  91. if (GameManager.inFight && !GameManager.stillInMenu)
  92. {
  93. GameObject.Find("GameSettingsMask").transform.GetChild(0).GetChild(1).GetChild(10).gameObject.SetActive(false);
  94. Navigation navigation = GameObject.Find("Show Wins").transform.GetChild(1).GetComponent<Button>().navigation;
  95. navigation.mode = Navigation.Mode.Explicit;
  96. navigation.selectOnDown = GameObject.Find("GameSettingsMask").transform.GetChild(0).GetChild(1).FindChild("Back").GetChild(0).GetComponent<Button>();
  97. GameObject.Find("Show Wins").transform.GetChild(1).GetComponent<Button>().navigation = navigation;
  98. Navigation navigation2 = GameObject.Find("GameSettingsMask").transform.GetChild(0).GetChild(1).FindChild("Back").GetChild(0).GetComponent<Button>().navigation;
  99. navigation2.mode = Navigation.Mode.Explicit;
  100. navigation2.selectOnUp = GameObject.Find("Show Wins").transform.GetChild(1).GetComponent<Button>();
  101. GameObject.Find("GameSettingsMask").transform.GetChild(0).GetChild(1).FindChild("Back").GetChild(0).GetComponent<Button>().navigation = navigation2;
  102. }
  103. if (Input.GetKeyDown(KeyCode.R))
  104. {
  105. this.StartMatch(this.levelSelector.GetNextLevel(), true);
  106. }
  107. Cursor.lockState = CursorLockMode.Confined;
  108. if (GameManager.inFight)
  109. {
  110. this.randomWeaponCounter -= Time.deltaTime;
  111. }
  112. if (this.randomWeaponCounter < 0f)
  113. {
  114. this.SpawnRandomWeapon();
  115. }
  116. if (GameManager.inFight && !GameManager.stillInMenu)
  117. {
  118. this.matchTime += Time.deltaTime;
  119. }
  120. else
  121. {
  122. this.matchTime = 0f;
  123. }
  124. this.hoardHandler.specificNumber = (int)Mathf.Clamp((this.matchTime - this.secondsBeforeSuddendeath) / 10f, 0f, (float)OptionsHolder.bots);
  125. }
  126. public virtual MapWrapper GetCurrentMap()
  127. {
  128. return this.lastMapNumber;
  129. }
  130. public virtual void RestartGame()
  131. {
  132. if (MatchmakingHandler.IsNetworkMatch)
  133. {
  134. MatchmakingHandler.Instance.Disconnect(false);
  135. }
  136. Application.LoadLevel(Application.loadedLevel);
  137. GameManager.stillInMenu = true;
  138. PauseManager.isPaused = false;
  139. GameManager.inFight = false;
  140. GameManager.playersBeingMoved = 0;
  141. Time.timeScale = 1f;
  142. TimeHandler.managerTime = 1f;
  143. TimeHandler.pauseTime = 1f;
  144. DisableIfPlayed.hasPlayed = true;
  145. }
  146. public virtual void SpawnRandomWeapon()
  147. {
  148. if (this.dontSpawnItems)
  149. {
  150. return;
  151. }
  152. if (OptionsHolder.weaponsSpawn == 2)
  153. {
  154. return;
  155. }
  156. if (MatchmakingHandler.IsNetworkMatch && !MultiplayerManager.IsServer)
  157. {
  158. return;
  159. }
  160. if (OptionsHolder.weaponsSpawn == 1)
  161. {
  162. this.randomWeaponCounter = UnityEngine.Random.Range(3f, 5f);
  163. }
  164. if (OptionsHolder.weaponsSpawn == 0)
  165. {
  166. this.randomWeaponCounter = UnityEngine.Random.Range(5f, 8f);
  167. }
  168. if (OptionsHolder.weaponsSpawn == 3)
  169. {
  170. this.randomWeaponCounter = UnityEngine.Random.Range(8f, 12f);
  171. }
  172. this.randomWeaponCounter += this.extraSpawnWeaponTime;
  173. float num = UnityEngine.Random.Range(0f, 8f);
  174. if (this.spawnedLastWeaponOnLeftSide)
  175. {
  176. num *= -1f;
  177. }
  178. this.spawnedLastWeaponOnLeftSide = !this.spawnedLastWeaponOnLeftSide;
  179. float num2 = 11f;
  180. if (GameManager.Instance)
  181. {
  182. num2 *= GameManager.Instance.LastAppliedScale;
  183. }
  184. Vector3 vector = Vector3.up * num2 + Vector3.forward * num;
  185. GameObject original;
  186. int randomWeaponIndex = this.m_WeaponSelectionHandler.GetRandomWeaponIndex(true, out original);
  187. if (randomWeaponIndex < 0)
  188. {
  189. return;
  190. }
  191. bool flag = false;
  192. if (this.lastMapNumber.MapType == 0)
  193. {
  194. int num3 = BitConverter.ToInt32(this.lastMapNumber.MapData, 0);
  195. flag = (num3 >= 104 && num3 <= 124);
  196. }
  197. if (MatchmakingHandler.IsNetworkMatch)
  198. {
  199. this.mNetworkManager.SpawnWeapon(randomWeaponIndex, vector, flag);
  200. }
  201. else
  202. {
  203. GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(original, vector, Quaternion.identity);
  204. if (flag)
  205. {
  206. gameObject.GetComponent<WeaponPickUp>().ChangeToPresent();
  207. }
  208. this.mSpawnedWeapons.Add(gameObject.GetComponent<Rigidbody>());
  209. }
  210. if ((double)UnityEngine.Random.value > 0.9)
  211. {
  212. this.SpawnRandomWeapon();
  213. }
  214. }
  215. public virtual void DissarmPlayers()
  216. {
  217. foreach (Controller controller in this.controllerHandler.players)
  218. {
  219. if (!(controller == null))
  220. {
  221. controller.GetComponent<Fighting>().Dissarm();
  222. DragHandler[] componentsInChildren = controller.GetComponentsInChildren<DragHandler>();
  223. for (int i = 0; i < componentsInChildren.Length; i++)
  224. {
  225. componentsInChildren[i].extraDrag = 0f;
  226. }
  227. }
  228. }
  229. }
  230. public virtual void RevivePlayer(Controller playerToRevive, bool newMap = true)
  231. {
  232. if (playerToRevive == null)
  233. {
  234. Debug.LogWarning("Trying to revive null player");
  235. return;
  236. }
  237. int count = this.playersAlive.Count;
  238. bool flag = false;
  239. for (int i = 0; i < count; i++)
  240. {
  241. if (this.playersAlive[i] == null)
  242. {
  243. this.playersAlive[i] = playerToRevive;
  244. flag = true;
  245. break;
  246. }
  247. }
  248. if (!flag)
  249. {
  250. this.playersAlive.Add(playerToRevive);
  251. }
  252. bool flag2 = false;
  253. HealthHandler component = playerToRevive.GetComponent<HealthHandler>();
  254. if (component == null)
  255. {
  256. Debug.LogWarning("Trying to revive player without HealthHandler");
  257. return;
  258. }
  259. component.health = 100f;
  260. component.sinceSpawn = 0f;
  261. if (component.FirstDeathFlag)
  262. {
  263. flag2 = true;
  264. if (newMap)
  265. {
  266. if (component.DiedWithinSeconds(1f))
  267. {
  268. playerToRevive.GetComponent<CharacterInformation>().isDead = true;
  269. }
  270. else
  271. {
  272. component.FirstDeathFlag = false;
  273. }
  274. }
  275. }
  276. else
  277. {
  278. playerToRevive.GetComponent<CharacterInformation>().isDead = false;
  279. playerToRevive.gameObject.SetActive(true);
  280. }
  281. playerToRevive.GetComponent<CharacterInformation>().sinceFallen = 2f;
  282. playerToRevive.GetComponent<GrabHandler>().EndGrab();
  283. playerToRevive.damager = null;
  284. if (MatchmakingHandler.IsNetworkMatch)
  285. {
  286. playerToRevive.GetComponent<global::NetworkPlayer>().SetActive(true);
  287. }
  288. if (flag2)
  289. {
  290. this.playersAlive.Remove(playerToRevive);
  291. }
  292. WinCounterUI winCounterUI = UnityEngine.Object.FindObjectOfType<WinCounterUI>();
  293. if (winCounterUI != null)
  294. {
  295. winCounterUI.RefreshWinTexts();
  296. }
  297. }
  298. public virtual void ReviveAllPlayers(bool newMap = true)
  299. {
  300. this.playersAlive.Clear();
  301. foreach (Controller playerToRevive in this.controllerHandler.players)
  302. {
  303. this.RevivePlayer(playerToRevive, newMap);
  304. }
  305. }
  306. public virtual void RemovePlayer(Controller player)
  307. {
  308. this.playersAlive.Remove(player);
  309. }
  310. public virtual void KillPlayer(Controller playerToKill)
  311. {
  312. if (this.playersAlive.Contains(playerToKill))
  313. {
  314. this.playersAlive.Remove(playerToKill);
  315. }
  316. if (playerToKill.damager != null && !playerToKill.damager.isAI)
  317. {
  318. if (this.crown.crownBarrer == playerToKill)
  319. {
  320. this.crown.SetNewKing(playerToKill.damager, false);
  321. playerToKill.damager.GetComponent<CharacterStats>().crownSteals++;
  322. }
  323. playerToKill.damager.OnKilledEnemy(playerToKill);
  324. playerToKill.damager.GetComponent<CharacterStats>().kills++;
  325. }
  326. else
  327. {
  328. playerToKill.GetComponent<CharacterStats>().suicides++;
  329. }
  330. int num = 0;
  331. Controller controller = null;
  332. foreach (Controller controller2 in this.playersAlive)
  333. {
  334. if (controller2 != null && !controller2.GetComponent<CharacterInformation>().isDead)
  335. {
  336. controller = controller2;
  337. num++;
  338. }
  339. }
  340. if (num <= 1)
  341. {
  342. if (MatchmakingHandler.IsNetworkMatch)
  343. {
  344. if (MultiplayerManager.IsServer)
  345. {
  346. if (GameManager.stillInMenu && this.mNetworkManager.GetPlayersInLobby(false) < 2)
  347. {
  348. return;
  349. }
  350. MapWrapper nextLevel = this.levelSelector.GetNextLevel();
  351. byte indexOfWinner = (num != 0) ? ((byte)controller.GetComponent<global::NetworkPlayer>().NetworkSpawnID) : byte.MaxValue;
  352. this.LastWinner = controller;
  353. this.mNetworkManager.ChangeMap(nextLevel, indexOfWinner);
  354. bool customMap = this.lastMapNumber.MapType == 2;
  355. GameManager.m_AnalyticsTrigger.OnMatchEnd(true, customMap);
  356. }
  357. }
  358. else
  359. {
  360. this.AllButOnePlayersDied();
  361. }
  362. }
  363. playerToKill.OnDeath();
  364. playerToKill.GetComponent<CharacterStats>().deaths++;
  365. }
  366. public virtual GameObject FindWeaponByIndex(int weaponIndex)
  367. {
  368. int num = (this.weapons == null) ? 0 : this.weapons.Length;
  369. for (int i = 0; i < num; i++)
  370. {
  371. GameObject gameObject = this.weapons[i];
  372. if (gameObject)
  373. {
  374. string text = gameObject.name.Split(new char[]
  375. {
  376. '('
  377. })[0].Replace("Gun", string.Empty);
  378. int num2;
  379. if (int.TryParse(text, out num2))
  380. {
  381. if (weaponIndex == num2)
  382. {
  383. return this.weapons[i];
  384. }
  385. }
  386. else
  387. {
  388. Debug.LogError(string.Concat(new object[]
  389. {
  390. "Could not parse weaponNumber: ",
  391. text,
  392. " Index: ",
  393. weaponIndex
  394. }));
  395. }
  396. }
  397. }
  398. num = ((this.weaponsT2 == null) ? 0 : this.weaponsT2.Length);
  399. for (int j = 0; j < num; j++)
  400. {
  401. GameObject gameObject2 = this.weaponsT2[j];
  402. if (gameObject2)
  403. {
  404. string text2 = gameObject2.name.Split(new char[]
  405. {
  406. '('
  407. })[0].Replace("Gun", string.Empty);
  408. int num3;
  409. if (int.TryParse(text2, out num3))
  410. {
  411. if (weaponIndex == num3)
  412. {
  413. return this.weaponsT2[j];
  414. }
  415. }
  416. else
  417. {
  418. Debug.LogError(string.Concat(new object[]
  419. {
  420. "Could not parse weaponNumber: ",
  421. text2,
  422. " Index: ",
  423. weaponIndex
  424. }));
  425. }
  426. }
  427. }
  428. num = ((this.weaponsT3 == null) ? 0 : this.weaponsT3.Length);
  429. for (int k = 0; k < num; k++)
  430. {
  431. GameObject gameObject3 = this.weaponsT3[k];
  432. if (gameObject3)
  433. {
  434. string text3 = gameObject3.name.Split(new char[]
  435. {
  436. '('
  437. })[0].Replace("Gun", string.Empty);
  438. int num4;
  439. if (int.TryParse(text3, out num4))
  440. {
  441. if (weaponIndex == num4)
  442. {
  443. return this.weaponsT3[k];
  444. }
  445. }
  446. else
  447. {
  448. Debug.LogError(string.Concat(new object[]
  449. {
  450. "Could not parse weaponNumber: ",
  451. text3,
  452. " Index: ",
  453. weaponIndex
  454. }));
  455. }
  456. }
  457. }
  458. num = ((this.weaponSpeciaTier == null) ? 0 : this.weaponSpeciaTier.Length);
  459. for (int l = 0; l < num; l++)
  460. {
  461. GameObject gameObject4 = this.weaponSpeciaTier[l];
  462. if (gameObject4)
  463. {
  464. string text4 = gameObject4.name.Split(new char[]
  465. {
  466. '('
  467. })[0].Replace("Gun", string.Empty);
  468. int num5;
  469. if (int.TryParse(text4, out num5))
  470. {
  471. if (weaponIndex == num5)
  472. {
  473. return this.weaponSpeciaTier[l];
  474. }
  475. }
  476. else
  477. {
  478. Debug.LogError(string.Concat(new object[]
  479. {
  480. "Could not parse weaponNumber: ",
  481. text4,
  482. " Index: ",
  483. weaponIndex
  484. }));
  485. }
  486. }
  487. }
  488. throw new Exception("Could not find weapon with index: " + weaponIndex);
  489. }
  490. public virtual int GetPlayersAlive()
  491. {
  492. return this.playersAlive.Count;
  493. }
  494. public List<CharacterActions> SavedDevicesForNetwork
  495. {
  496. get
  497. {
  498. return this.mSavedDevicesForNetwork;
  499. }
  500. }
  501. public virtual int KillAllPlayers(bool network)
  502. {
  503. int num = 0;
  504. if (this.mSavedDevicesForNetwork.Count == 0)
  505. {
  506. foreach (Controller controller in this.playersAlive)
  507. {
  508. if (controller.HasControl)
  509. {
  510. this.mSavedDevicesForNetwork.Add(controller.PlayerActions);
  511. }
  512. UnityEngine.Object.Destroy(controller.gameObject);
  513. num++;
  514. }
  515. }
  516. this.playersAlive.Clear();
  517. return num;
  518. }
  519.  
  520. // Token: 0x06000198 RID: 408 RVA: 0x000191AC File Offset: 0x000173AC
  521. public virtual void KillAllPlayers(List<Controller> playersToCheck)
  522. {
  523. this.playersAlive.Clear();
  524. if (playersToCheck == null)
  525. {
  526. return;
  527. }
  528. foreach (Controller controller in playersToCheck)
  529. {
  530. if (!(controller == null) && controller.HasControl)
  531. {
  532. this.playersAlive.Add(controller);
  533. }
  534. }
  535. }
  536.  
  537. // Token: 0x06000199 RID: 409 RVA: 0x00019220 File Offset: 0x00017420
  538. public virtual void AllButOnePlayersDied()
  539. {
  540. this.mSpawnedWeapons.Clear();
  541. this.onlineRoom.hasStarted = true;
  542. Controller controller = null;
  543. foreach (Controller controller2 in this.playersAlive)
  544. {
  545. if (controller2 != null)
  546. {
  547. controller = controller2;
  548. break;
  549. }
  550. }
  551. if (controller == null)
  552. {
  553. Debug.LogWarning("Ending match with no player alive");
  554. }
  555. if (controller != null)
  556. {
  557. this.winText.color = controller.gameObject.GetComponentInChildren<SpriteRenderer>().GetComponent<SetColorWhenDamaged>().startColor;
  558. }
  559. this.winText.text = this.vicotory.GetRandomWinText();
  560. this.winText.gameObject.SetActive(true);
  561. this.au.PlayOneShot(this.winClips[UnityEngine.Random.Range(0, this.winClips.Length)]);
  562. if (GameManager.stillInMenu)
  563. {
  564. this.EnableObjects();
  565. }
  566. if (controller != null)
  567. {
  568. this.LastWinner = controller;
  569. }
  570. this.StartMatch(this.levelSelector.GetNextLevel(), true);
  571. if (controller != null)
  572. {
  573. this.crown.SetNewKing(controller, true);
  574. }
  575. bool customMap = this.lastMapNumber.MapType == 2 || this.lastMapNumber.MapType == 1;
  576. GameManager.m_AnalyticsTrigger.OnMatchEnd(false, customMap);
  577. }
  578. public virtual void EnableObjects()
  579. {
  580. foreach (GameObject gameObject in this.enableOnStart)
  581. {
  582. if (gameObject)
  583. {
  584. gameObject.SetActive(true);
  585. }
  586. }
  587. foreach (GameObject gameObject2 in this.disableOnStart)
  588. {
  589. if (gameObject2)
  590. {
  591. gameObject2.SetActive(false);
  592. }
  593. }
  594. }
  595. public virtual void StartMatch(MapWrapper mapIndex, bool MovePlayers = true)
  596. {
  597. if (GameManager.inFight && this.OnMatchEnded != null)
  598. {
  599. this.OnMatchEnded();
  600. }
  601. if (this.LastWinner != null && this.LastWinner.HasControl)
  602. {
  603. if (SteamStatsAndAchievements.Instance.TransientMemory.Copy<int>("DeathsByFalling").GetValue(0) >= ControllerHandler.Instance.ActivePlayers.Count - 1 && ControllerHandler.Instance.ActivePlayers.Count > 1)
  604. {
  605. SteamStatsAndAchievements.Instance.UnlockAchievement(SteamStatsAndAchievements.EAchievement.Walkover);
  606. }
  607. if (this.currentMapInfo != null && this.currentMapInfo.metaData.Contains("IceWorld"))
  608. {
  609. DestructiblePiece[] array = UnityEngine.Object.FindObjectsOfType<DestructiblePiece>();
  610. if (array.Length != 0)
  611. {
  612. bool flag = true;
  613. DestructiblePiece[] array2 = array;
  614. for (int i = 0; i < array2.Length; i++)
  615. {
  616. Rigidbody component = array2[i].GetComponent<Rigidbody>();
  617. if (component && component.isKinematic)
  618. {
  619. flag = false;
  620. break;
  621. }
  622. }
  623. if (flag)
  624. {
  625. SteamStatsAndAchievements.Instance.UnlockAchievement(SteamStatsAndAchievements.EAchievement.IceAge);
  626. }
  627. }
  628. }
  629. }
  630. if (this.LastWinner != null)
  631. {
  632. this.LastWinner.GetComponent<CharacterStats>().wins++;
  633. UnityEngine.Object.FindObjectOfType<WinCounterUI>().IncrementWinCounter(this.LastWinner);
  634. }
  635. this.EnableObjects();
  636. GameManager.inFight = false;
  637. if (OptionsHolder.weaponsSpawn == 1)
  638. {
  639. this.randomWeaponCounter = UnityEngine.Random.Range(0.5f, 1f);
  640. }
  641. if (OptionsHolder.weaponsSpawn == 0)
  642. {
  643. this.randomWeaponCounter = UnityEngine.Random.Range(2f, 4f);
  644. }
  645. if (OptionsHolder.weaponsSpawn == 3)
  646. {
  647. this.randomWeaponCounter = UnityEngine.Random.Range(4f, 8f);
  648. }
  649. this.randomWeaponCounter += this.extraSpawnWeaponTime;
  650. this.secondsBeforeSuddendeath = 25f;
  651. base.StartCoroutine(this.StartMapSequence(mapIndex, MovePlayers));
  652. if (MatchmakingHandler.IsNetworkMatch)
  653. {
  654. this.m_CustomMapInfoHandler.ShowSubscribe();
  655. }
  656. }
  657. public virtual void LoadMapCourotine(MapWrapper map)
  658. {
  659. base.StartCoroutine(this.LoadMap(map));
  660. }
  661. public virtual IEnumerator StartMapSequence(MapWrapper mapIndex, bool MovePlayers = true)
  662. {
  663. Debug.Log("StartMapSequence0");
  664. while (TimeHandler.managerTime > 0.01f)
  665. {
  666. TimeHandler.managerTime = Mathf.Lerp(TimeHandler.managerTime, 0f, Time.unscaledDeltaTime * 3f);
  667. yield return null;
  668. }
  669. SteamStatsAndAchievements.Instance.CleanUpAndStoreStats();
  670. foreach (Rigidbody rigidbody in UnityEngine.Object.FindObjectsOfType<Rigidbody>())
  671. {
  672. if (rigidbody.gameObject.scene.name != "MainScene")
  673. {
  674. rigidbody.isKinematic = true;
  675. }
  676. }
  677. foreach (Controller controller in this.controllerHandler.players)
  678. {
  679. if (!(controller == null))
  680. {
  681. controller.OnUnloadMap();
  682. Rigidbody[] componentsInChildren = controller.transform.root.GetComponentsInChildren<Rigidbody>(true);
  683. for (int j = 0; j < componentsInChildren.Length; j++)
  684. {
  685. componentsInChildren[j].isKinematic = true;
  686. }
  687. }
  688. }
  689. TimeHandler.managerTime = 1f;
  690. RemoveOnLevelChange[] array2 = UnityEngine.Object.FindObjectsOfType<RemoveOnLevelChange>();
  691. for (int k = 0; k < array2.Length; k++)
  692. {
  693. array2[k].gameObject.AddComponent<ShrinkOverTime>();
  694. }
  695. Collider[] componentsInChildren2 = base.GetComponentsInChildren<Collider>();
  696. for (int l = 0; l < componentsInChildren2.Length; l++)
  697. {
  698. componentsInChildren2[l].enabled = false;
  699. }
  700. this.isLoading = true;
  701. if (!this.levelSelector.IsDownloadingMaps() && !this.levelSelector.LastMapNeededDownloading())
  702. {
  703. this.LoadMapCourotine(mapIndex);
  704. }
  705. Debug.Log("isLoading0");
  706. yield return new WaitWhile(() => this.isLoading);
  707. yield return null;
  708. Debug.Log("isLoading1");
  709. if (!this.loadSuccessful)
  710. {
  711. Debug.LogWarning("StartMapSequence load failed");
  712. yield break;
  713. }
  714. if (MatchmakingHandler.IsNetworkMatch)
  715. {
  716. MultiplayerManager multiplayerManager = UnityEngine.Object.FindObjectOfType<MultiplayerManager>();
  717. multiplayerManager.CheckForGroundWeapons();
  718. multiplayerManager.UpdateUI();
  719. }
  720. byte b = 0;
  721. while ((int)b < this.controllerHandler.players.Count)
  722. {
  723. Controller controller2 = this.controllerHandler.players[(int)b];
  724. if (!(controller2 == null))
  725. {
  726. Vector3 targetPosition = new Vector3(0f, 12f, 0f);
  727. if (MatchmakingHandler.IsNetworkMatch && controller2.HasControl && !MovePlayers)
  728. {
  729. targetPosition = ((!controller2.GetComponent<HealthHandler>().FirstDeathFlag) ? new Vector3(0f, 12f, 0f) : new Vector3(0f, -100f, 0f));
  730. }
  731. else
  732. {
  733. int num = (int)b;
  734. if (b < 0 || (int)b >= this.currentMapInfo.spawnPoints.Length)
  735. {
  736. Debug.LogWarning("Trying to use invalid spawnpoint");
  737. num = 0;
  738. }
  739. targetPosition = this.currentMapInfo.spawnPoints[num].localPosition;
  740. }
  741. base.StartCoroutine(this.MovePlayer(controller2.GetComponentInChildren<Hip>().GetComponent<Rigidbody>(), targetPosition));
  742. }
  743. b += 1;
  744. }
  745. if (GameManager.stillInMenu)
  746. {
  747. GameManager.stillInMenu = false;
  748. UnityEngine.Object.Destroy(base.transform.Find("Map").gameObject);
  749. foreach (Rigidbody rigidbody2 in base.GetComponentsInChildren<Rigidbody>())
  750. {
  751. rigidbody2.gameObject.AddComponent<ConstantForce>().force = Vector3.forward * 1000000f;
  752. rigidbody2.gameObject.AddComponent<RemoveAfterSeconds>();
  753. }
  754. }
  755. else
  756. {
  757. base.StartCoroutine(this.RemoveMap(this.lastMapNumber));
  758. }
  759. this.m_CustomMapInfoHandler.HideSubscribe();
  760. this.m_CustomMapInfoHandler.AssignNewMap(mapIndex);
  761. yield return new WaitForSecondsRealtime(1.1f);
  762. this.mapAnimation.state1 = false;
  763. if (this.currentMapInfo != null)
  764. {
  765. this.currentMapInfo.dontFollowTheSwoosher = false;
  766. base.StartCoroutine(this.PrepareMapForTravel(this.currentMapInfo.gameObject, true));
  767. this.currentMapInfo.gameObject.SetActive(true);
  768. }
  769. else
  770. {
  771. Debug.LogError("Missing currentMapInfo");
  772. }
  773. this.lastMapNumber = mapIndex;
  774. Debug.Log("StartMapSequence1");
  775. yield break;
  776. }
  777. public virtual void OnLevelFinishedLoading(Scene scene, LoadSceneMode mode)
  778. {
  779. Debug.Log("OnLevelFinishedLoading");
  780. this.isLoadingInternal = false;
  781. }
  782. public virtual void OnMapSizeChanged(float newSize)
  783. {
  784. this.m_CameraAspectFix.SetMapSize(newSize);
  785. float num = newSize / 10f;
  786. foreach (BoxCollider boxCollider in UnityEngine.Object.FindObjectsOfType<BoxCollider>())
  787. {
  788. if (boxCollider.name == "Death")
  789. {
  790. boxCollider.transform.root.localScale = new Vector3(1f, num, num);
  791. break;
  792. }
  793. }
  794. BarsHandler[] array2 = UnityEngine.Object.FindObjectsOfType<BarsHandler>();
  795. for (int j = 0; j < array2.Length; j++)
  796. {
  797. array2[j].transform.localScale = new Vector3(1f, num, num);
  798. }
  799. foreach (BackGround backGround in UnityEngine.Object.FindObjectsOfType<BackGround>())
  800. {
  801. backGround.transform.localScale = backGround.StartScale * num;
  802. }
  803. this.winText.gameObject.SetActive(false);
  804. Vector3 localScale = this.GameCanvas.transform.localScale;
  805. Vector3 localScale2 = new Vector3(localScale.x / this.LastAppliedScale * num, localScale.y / this.LastAppliedScale * num, localScale.z);
  806. this.GameCanvas.transform.localScale = localScale2;
  807. this.LastAppliedScale = num;
  808. }
  809. public virtual IEnumerator LoadMap(MapWrapper mapIndex)
  810. {
  811. if (this.oldMap != null && PlayerPrefs.GetInt("Combine Maps") == 1)
  812. {
  813. UnityEngine.Object.Destroy(this.oldMap.gameObject);
  814. }
  815. this.loadSuccessful = true;
  816. this.isLoadingInternal = true;
  817. if (mapIndex.MapType > 0)
  818. {
  819. bool flag = this.levelSelector.LoadCustomLevel(mapIndex, new Action<float>(this.OnMapSizeChanged));
  820. this.isLoadingInternal = false;
  821. if (!flag)
  822. {
  823. this.loadSuccessful = false;
  824. UnityEngine.Object.FindObjectOfType<LoadingScreenManager>().LoadThenFail(ConnectionErrorType.DownloadFailure, string.Empty);
  825. yield break;
  826. }
  827. Debug.Log("Loaded custom map: " + mapIndex);
  828. }
  829. else
  830. {
  831. int num;
  832. using (MemoryStream memoryStream = new MemoryStream(mapIndex.MapData))
  833. {
  834. using (BinaryReader binaryReader = new BinaryReader(memoryStream))
  835. {
  836. num = binaryReader.ReadInt32();
  837. }
  838. }
  839. Debug.Log("Loading Scene: " + SceneManager.GetSceneByBuildIndex(num).name);
  840. SceneManager.sceneLoaded += this.OnLevelFinishedLoading;
  841. SceneManager.LoadScene(num, LoadSceneMode.Additive);
  842. this.OnMapSizeChanged(10f);
  843. }
  844. if (this.currentMapInfo)
  845. {
  846. this.oldMap = this.currentMapInfo;
  847. }
  848. Debug.Log("LoadMapWait0");
  849. yield return new WaitWhile(() => this.isLoadingInternal);
  850. yield return null;
  851. Debug.Log("LoadMapWait1");
  852. foreach (MapInfo mapInfo in UnityEngine.Object.FindObjectsOfType<MapInfo>())
  853. {
  854. if (!this.oldMap || mapInfo != this.oldMap)
  855. {
  856. this.currentMapInfo = mapInfo;
  857. BackGround componentInChildren = mapInfo.GetComponentInChildren<BackGround>();
  858. if (componentInChildren)
  859. {
  860. componentInChildren.enabled = true;
  861. }
  862. mapInfo.gameObject.SetActive(false);
  863. }
  864. }
  865. if (this.currentMapInfo != null)
  866. {
  867. this.dontSpawnItems = this.currentMapInfo.dontSpawnItems;
  868. this.extraSpawnWeaponTime = this.currentMapInfo.extraWeaponSpawnTime;
  869. }
  870. this.isLoading = false;
  871. yield break;
  872. }
  873. public virtual IEnumerator RemoveMap(MapWrapper mapIndex)
  874. {
  875. this.mapAnimation.state1 = true;
  876. base.StartCoroutine(this.PrepareMapForTravel(this.oldMap.gameObject, false));
  877. BackGround componentInChildren = this.oldMap.GetComponentInChildren<BackGround>();
  878. if (componentInChildren)
  879. {
  880. componentInChildren.FadeOut();
  881. }
  882. yield return new WaitForSecondsRealtime(1f);
  883. Debug.Log("Trying to unload scene nr: " + mapIndex);
  884. if (mapIndex.MapType == 0 && PlayerPrefs.GetInt("Combine Maps") == 0)
  885. {
  886. SceneManager.UnloadScene(BitConverter.ToInt32(mapIndex.MapData, 0));
  887. }
  888. else if (mapIndex.MapType == 0 && PlayerPrefs.GetInt("Combine Maps") == 1)
  889. {
  890. Debug.Log("Finally?");
  891. }
  892. else if (PlayerPrefs.GetInt("Combine Maps") == 1)
  893. {
  894. Debug.Log("Finally?");
  895. }
  896. else
  897. {
  898. UnityEngine.Object.Destroy(this.oldMap.gameObject);
  899. }
  900. yield break;
  901. }
  902. public virtual IEnumerator PrepareMapForTravel(GameObject map, bool comingIn)
  903. {
  904. Rigidbody[] componentsInChildren = map.gameObject.GetComponentsInChildren<Rigidbody>();
  905. for (int i = 0; i < componentsInChildren.Length; i++)
  906. {
  907. componentsInChildren[i].isKinematic = true;
  908. }
  909. foreach (ConfigurableJoint configurableJoint in map.gameObject.GetComponentsInChildren<ConfigurableJoint>(true))
  910. {
  911. GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(configurableJoint.gameObject, configurableJoint.transform.position, configurableJoint.transform.rotation);
  912. gameObject.AddComponent<JointDummy>();
  913. gameObject.transform.parent = configurableJoint.transform.parent;
  914. ConfigurableJoint[] components = gameObject.GetComponents<ConfigurableJoint>();
  915. for (int k = 0; k < components.Length; k++)
  916. {
  917. UnityEngine.Object.Destroy(components[k]);
  918. }
  919. ConstantForce[] components2 = gameObject.GetComponents<ConstantForce>();
  920. for (int l = 0; l < components2.Length; l++)
  921. {
  922. UnityEngine.Object.Destroy(components2[l]);
  923. }
  924. UnityEngine.Object.Destroy(gameObject.GetComponent<Rigidbody>());
  925. configurableJoint.gameObject.SetActive(false);
  926. }
  927. yield return new WaitForSecondsRealtime(1f);
  928. while (this.mapAnimation.isAnimating)
  929. {
  930. yield return null;
  931. }
  932. JointDummy[] array = UnityEngine.Object.FindObjectsOfType<JointDummy>();
  933. for (int m = 0; m < array.Length; m++)
  934. {
  935. UnityEngine.Object.Destroy(array[m].gameObject);
  936. }
  937. if (map)
  938. {
  939. ConfigurableJoint[] componentsInChildren3 = map.gameObject.GetComponentsInChildren<ConfigurableJoint>(true);
  940. for (int n = 0; n < componentsInChildren3.Length; n++)
  941. {
  942. componentsInChildren3[n].gameObject.SetActive(true);
  943. }
  944. }
  945. if (map)
  946. {
  947. foreach (Rigidbody rigidbody in map.gameObject.GetComponentsInChildren<Rigidbody>())
  948. {
  949. DestructiblePiece component = rigidbody.GetComponent<DestructiblePiece>();
  950. if ((!component || component.simpleDestruction || component.eventDestruction) && !rigidbody.GetComponent<DontEnableRig>())
  951. {
  952. rigidbody.isKinematic = false;
  953. }
  954. }
  955. }
  956. if (MatchmakingHandler.IsNetworkMatch)
  957. {
  958. P2PStatistics.StartRecording();
  959. }
  960. if (comingIn)
  961. {
  962. if (MatchmakingHandler.IsNetworkMatch)
  963. {
  964. this.mMultiplayerManager.InitMapDataObjects();
  965. TimeHandler.managerTime = 0f;
  966. this.mMultiplayerManager.ReadyUp();
  967. yield return new WaitForSecondsRealtime(0.5f);
  968. this.mMultiplayerManager.InitSyncedObjects();
  969. base.StartCoroutine(this.StartCountdownAfterSeconds(MultiplayerManager.k_MAX_SECONDS_UNTIL_AUTO_START));
  970. using (List<Controller>.Enumerator enumerator = this.controllerHandler.players.GetEnumerator())
  971. {
  972. while (enumerator.MoveNext())
  973. {
  974. Controller controller = enumerator.Current;
  975. if (!(controller == null))
  976. {
  977. componentsInChildren = controller.transform.root.GetComponentsInChildren<Rigidbody>(true);
  978. for (int num = 0; num < componentsInChildren.Length; num++)
  979. {
  980. componentsInChildren[num].isKinematic = false;
  981. }
  982. }
  983. }
  984. yield break;
  985. }
  986. }
  987. yield return new WaitForSecondsRealtime(1f);
  988. this.m_CustomMapInfoHandler.HideMapInfo();
  989. }
  990. yield break;
  991. }
  992. public virtual IEnumerator StartCountdownAfterSeconds(float seconds)
  993. {
  994. float timer = 0f;
  995. bool play = true;
  996. while (timer < seconds)
  997. {
  998. timer += Time.unscaledDeltaTime;
  999. if (GameManager.inFight)
  1000. {
  1001. play = false;
  1002. this.mWaitTextAnimator.state1 = false;
  1003. break;
  1004. }
  1005. if (timer >= 1f && !this.mPlayingCountdown)
  1006. {
  1007. this.mWaitTextAnimator.state1 = true;
  1008. }
  1009. yield return 0;
  1010. }
  1011. if (play)
  1012. {
  1013. this.StartCountDown();
  1014. }
  1015. yield break;
  1016. }
  1017. public virtual void StartCountDown()
  1018. {
  1019. this.mWaitTextAnimator.state1 = false;
  1020. base.StartCoroutine(this.CountDownCoroutine());
  1021. }
  1022. public virtual IEnumerator CountDownCoroutine()
  1023. {
  1024. if (this.mPlayingCountdown)
  1025. {
  1026. yield break;
  1027. }
  1028. this.m_CustomMapInfoHandler.HideMapInfo();
  1029. this.mPlayingCountdown = true;
  1030. TimeHandler.managerTime = 0f;
  1031. this.mCountDownHandler.Countdown();
  1032. yield return new WaitForSecondsRealtime(1f);
  1033. GameManager.inFight = true;
  1034. TimeHandler.managerTime = 1f;
  1035. this.mPlayingCountdown = false;
  1036. yield break;
  1037. }
  1038. public virtual IEnumerator MovePlayer(Rigidbody player, Vector3 targetPosition)
  1039. {
  1040. if (!player)
  1041. {
  1042. yield break;
  1043. }
  1044. GameManager.playersBeingMoved++;
  1045. Rigidbody[] componentsInChildren = player.transform.root.GetComponentsInChildren<Rigidbody>();
  1046. for (int i = 0; i < componentsInChildren.Length; i++)
  1047. {
  1048. componentsInChildren[i].isKinematic = true;
  1049. }
  1050. player.transform.root.GetComponent<SetMovementAbility>().Reset();
  1051. this.DissarmPlayers();
  1052. player.transform.root.GetComponent<Controller>().SetCollision(false);
  1053. Vector3 movementDirection = targetPosition + Vector3.up * 1f - player.position;
  1054. float t = 0f;
  1055. float lastStep = 0f;
  1056. while (t < this.movePlayerTime)
  1057. {
  1058. if (!player)
  1059. {
  1060. yield break;
  1061. }
  1062. t += Time.deltaTime;
  1063. float num = this.movePlayerCurve.Evaluate(t / this.movePlayerTime);
  1064. float num2 = this.movePlayerCurve.Evaluate(lastStep / this.movePlayerTime);
  1065. float d = num - num2;
  1066. componentsInChildren = player.transform.root.GetComponentsInChildren<Rigidbody>();
  1067. for (int j = 0; j < componentsInChildren.Length; j++)
  1068. {
  1069. componentsInChildren[j].transform.position += d * movementDirection;
  1070. }
  1071. lastStep = t;
  1072. yield return null;
  1073. }
  1074. while (this.mapAnimation.isAnimating)
  1075. {
  1076. if (!player)
  1077. {
  1078. yield break;
  1079. }
  1080. Vector3 b = targetPosition + Vector3.up * 1f - player.transform.position;
  1081. foreach (Rigidbody rigidbody in player.transform.root.GetComponentsInChildren<Rigidbody>())
  1082. {
  1083. if (rigidbody)
  1084. {
  1085. rigidbody.transform.position += b;
  1086. }
  1087. }
  1088. yield return null;
  1089. }
  1090. if (player)
  1091. {
  1092. if (!MatchmakingHandler.IsNetworkMatch)
  1093. {
  1094. componentsInChildren = player.transform.root.GetComponentsInChildren<Rigidbody>(true);
  1095. for (int l = 0; l < componentsInChildren.Length; l++)
  1096. {
  1097. componentsInChildren[l].isKinematic = false;
  1098. }
  1099. }
  1100. player.transform.root.GetComponent<Controller>().SetCollision(true);
  1101. }
  1102. this.ReviveAllPlayers(true);
  1103. if (!MatchmakingHandler.IsNetworkMatch)
  1104. {
  1105. GameManager.inFight = true;
  1106. }
  1107. yield break;
  1108. }
  1109. public virtual void NetworkAllPlayersDiedButOne(MapWrapper newlevel, byte winner)
  1110. {
  1111. this.onlineRoom.hasStarted = true;
  1112. P2PStatistics.StopRecording();
  1113. List<Controller> playerControllers = this.mNetworkManager.PlayerControllers;
  1114. if (winner != 255)
  1115. {
  1116. Controller controller = null;
  1117. if ((int)winner < playerControllers.Count)
  1118. {
  1119. controller = playerControllers[(int)winner];
  1120. }
  1121. if (controller != null)
  1122. {
  1123. this.crown.SetNewKing(controller, true);
  1124. this.LastWinner = controller;
  1125. this.winText.text = this.vicotory.GetRandomWinText();
  1126. this.winText.color = controller.GetComponentInChildren<SpriteRenderer>().GetComponent<SetColorWhenDamaged>().startColor;
  1127. this.winText.gameObject.SetActive(true);
  1128. }
  1129. }
  1130. if (this.au)
  1131. {
  1132. this.au.PlayOneShot(this.winClips[UnityEngine.Random.Range(0, this.winClips.Length)]);
  1133. }
  1134. foreach (Controller controller2 in playerControllers)
  1135. {
  1136. if (!(controller2 == null))
  1137. {
  1138. controller2.GetComponent<global::NetworkPlayer>().SetActive(false);
  1139. }
  1140. }
  1141. this.StartMatch(newlevel, true);
  1142. }
  1143. public virtual byte FindWeaponIdByName(string weaponName)
  1144. {
  1145. int num = this.weapons.Length;
  1146. byte b = 0;
  1147. while ((int)b < num)
  1148. {
  1149. string name = this.weapons[(int)b].name;
  1150. if (weaponName.Split(new char[]
  1151. {
  1152. '('
  1153. })[0].ToLower() == name.ToLower())
  1154. {
  1155. return b;
  1156. }
  1157. b += 1;
  1158. }
  1159. num = this.weaponsT2.Length;
  1160. byte b2 = 0;
  1161. while ((int)b2 < num)
  1162. {
  1163. string name2 = this.weaponsT2[(int)b2].name;
  1164. if (weaponName.Split(new char[]
  1165. {
  1166. '('
  1167. })[0].ToLower() == name2.ToLower())
  1168. {
  1169. return (byte)((int)b2 + this.weapons.Length);
  1170. }
  1171. b2 += 1;
  1172. }
  1173. num = this.weaponsT3.Length;
  1174. byte b3 = 0;
  1175. while ((int)b3 < num)
  1176. {
  1177. string name3 = this.weaponsT3[(int)b3].name;
  1178. if (weaponName.Split(new char[]
  1179. {
  1180. '('
  1181. })[0].ToLower() == name3.ToLower())
  1182. {
  1183. return (byte)((int)b3 + this.weaponsT2.Length);
  1184. }
  1185. b3 += 1;
  1186. }
  1187. Debug.LogError("Could not find weapon named: " + weaponName);
  1188. return byte.MaxValue;
  1189. }
  1190. public virtual GameObject GetWeaponWithIndexAndOverFlow(byte weaponID)
  1191. {
  1192. Debug.Log("Trying to find weapon with overflow: " + weaponID);
  1193. int num = this.weapons.Length;
  1194. int num2 = this.weapons.Length + this.weaponsT2.Length;
  1195. int num3 = num2 + this.weaponsT3.Length;
  1196. GameObject[] array = this.weapons;
  1197. if ((int)weaponID < num)
  1198. {
  1199. Debug.Log("Found Weapon In Tier 1! Real ID" + (int)weaponID);
  1200. return array[(int)weaponID];
  1201. }
  1202. array = this.weaponsT2;
  1203. int num4;
  1204. if ((int)weaponID < num2)
  1205. {
  1206. num4 = (int)weaponID - num;
  1207. Debug.Log("Found Weapon In Tier 2! Real ID" + num4);
  1208. return array[num4];
  1209. }
  1210. array = this.weaponsT3;
  1211. if ((int)weaponID >= num3)
  1212. {
  1213. array = this.weaponSpeciaTier;
  1214. num4 = (int)weaponID - num3;
  1215. Debug.Log("Found Weapon In Special Tier! Real ID" + num4);
  1216. return array[num4];
  1217. }
  1218. num4 = (int)weaponID - num2;
  1219. Debug.Log("Found Weapon In Tier 3! Real ID" + num4);
  1220. return array[num4];
  1221. }
  1222. public virtual CharacterActions GetNextSavedDeviceForNetwork()
  1223. {
  1224. if (this.mSavedDevicesForNetwork == null || this.mSavedDevicesForNetwork.Count <= 1)
  1225. {
  1226. return this.GetDefaultBindings();
  1227. }
  1228. CharacterActions characterActions = this.mSavedDevicesForNetwork[0];
  1229. this.mSavedDevicesForNetwork[0] = null;
  1230. if (characterActions == null)
  1231. {
  1232. for (int i = 1; i < this.mSavedDevicesForNetwork.Count; i++)
  1233. {
  1234. characterActions = this.mSavedDevicesForNetwork[i];
  1235. if (characterActions != null)
  1236. {
  1237. this.mSavedDevicesForNetwork[i] = null;
  1238. break;
  1239. }
  1240. }
  1241. }
  1242. if (characterActions == null)
  1243. {
  1244. return this.GetDefaultBindings();
  1245. }
  1246. return characterActions;
  1247. }
  1248. public virtual CharacterActions GetDefaultBindings()
  1249. {
  1250. return CharacterActions.CreateWithAnyBindings();
  1251. }
  1252. public virtual void DisableAllPlayers()
  1253. {
  1254. foreach (Controller controller in this.playersAlive)
  1255. {
  1256. if (controller != null)
  1257. {
  1258. controller.gameObject.SetActive(false);
  1259. }
  1260. }
  1261. }
  1262. public virtual void SaveDevicesForNextGame(List<Controller> players)
  1263. {
  1264. this.mSavedDevicesForNetwork.Clear();
  1265. if (players == null)
  1266. {
  1267. return;
  1268. }
  1269. foreach (Controller controller in players)
  1270. {
  1271. if (!(controller == null) && controller.HasControl)
  1272. {
  1273. this.mSavedDevicesForNetwork.Add(controller.PlayerActions);
  1274. }
  1275. }
  1276. }
  1277. public virtual bool IsInLobby()
  1278. {
  1279. bool flag = this.lastMapNumber.MapType > 0;
  1280. byte[] mapData = this.lastMapNumber.MapData;
  1281. return !flag && BitConverter.ToInt32(mapData, 0) == 0;
  1282. }
  1283. public static int playersBeingMoved;
  1284. public static bool inFight;
  1285. public static bool stillInMenu = true;
  1286. public static bool spawnWeaponsAsPresents = true;
  1287. public CodeStateAnimation mapAnimation;
  1288. public AnimationCurve movePlayerCurve;
  1289. public float movePlayerTime = 1f;
  1290. protected ControllerHandler controllerHandler;
  1291. protected List<Rigidbody> mSpawnedWeapons = new List<Rigidbody>();
  1292. public List<Controller> playersAlive = new List<Controller>();
  1293. public MultiplayerManager mMultiplayerManager;
  1294. public P2PPackageHandler P2PPackageHandler;
  1295. protected MapInfo[] maps;
  1296. public MapInfo currentMapInfo;
  1297. public MapInfo oldMap;
  1298. public GameObject mapHolder;
  1299. public MapWrapper lastMapNumber;
  1300. public GameObject[] weapons;
  1301. public GameObject[] weaponsT2;
  1302. public GameObject[] weaponsT3;
  1303. public GameObject[] weaponSpeciaTier;
  1304. public GameObject[] GodWeapons;
  1305. public GameObject[] poolRanged;
  1306. public GameObject[] poolMeele;
  1307. public GameObject[] poolSniper;
  1308. public GameObject[] poolHandguns;
  1309. public GameObject[] poolExplosive;
  1310. public GameObject[] poolSnakes;
  1311. public GameObject[] poolLava;
  1312. public TextMeshProUGUI winText;
  1313. protected float randomWeaponCounter = 99f;
  1314. protected AudioSource au;
  1315. public AudioClip[] winClips;
  1316. public bool isLoading;
  1317. protected bool isLoadingInternal;
  1318. protected bool dontSpawnItems;
  1319. protected float secondsBeforeSuddendeath;
  1320. public float matchTime;
  1321. protected HoardHandler hoardHandler;
  1322. protected Crown crown;
  1323. protected Vicotory vicotory;
  1324. public bool testing;
  1325. protected bool loadSuccessful = true;
  1326. protected static GameManager _instance;
  1327. public int numberOfMaps;
  1328. protected CountDown mCountDownHandler;
  1329. [SerializeField]
  1330. protected CodeStateAnimation mWaitTextAnimator;
  1331. protected LevelSelection levelSelector;
  1332. protected OnlineRoom onlineRoom;
  1333. protected WeaponSelectionHandler m_WeaponSelectionHandler;
  1334. protected MultiplayerManager mNetworkManager;
  1335. public TMP_InputField chatInputField;
  1336. public GameObject[] enableOnStart;
  1337. public GameObject[] disableOnStart;
  1338. [SerializeField]
  1339. protected CustomMapInfoSubscriberHandler m_CustomMapInfoHandler;
  1340. protected bool spawnedLastWeaponOnLeftSide;
  1341. protected float extraSpawnWeaponTime;
  1342. public Action OnMatchEnded;
  1343. public GameObject GameCanvas;
  1344. protected static AnalytcisTrigger m_AnalyticsTrigger;
  1345. protected List<CharacterActions> mSavedDevicesForNetwork = new List<CharacterActions>();
  1346. [SerializeField]
  1347. protected AspectFix m_CameraAspectFix;
  1348. [SerializeField]
  1349. protected Transform m_Bars;
  1350. public float LastAppliedScale = 1f;
  1351. protected bool mPlayingCountdown;
  1352. public bool ForCombine;
  1353. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement