using TowerDefense.Towers; using Core.Utilities; using System; using TMPro; using UnityEngine; using UnityEngine.UI; using MoreMountains.NiceVibrations; using TowerDefense.Level; using KTGMGemClient; using TowerDefense.UI.HUD; using System.Collections; /// /// 无尽模式用自己的EndlessUIStart /// public class EndlessUIStart : Singleton { //public TextMeshProUGUI countDownTextNew = null; public TextMeshProUGUI timeTextNew = null; //public TextMeshProUGUI timeStatic = null; /// /// 结算界面 /// public GameObject SettlementUI; /// /// 倒计时整体的背景图片Mask /// public Image uiStartMssk = null; public AudioSource bgMusic; public static bool bFirstLoaded = false; public static bool bGameStart = false; protected float secToDo = 3f; protected float startTime = 0.0f; protected bool bossCreate = false; protected bool[] bVibrate; private bool isPause; public bool beginDragStep = false; public bool guideFourthWaveStep = false; public GameObject darkGroundImg; private CanvasGroup canvasGroup; public GameObject GMBtn; /// /// Awake is called when the script instance is being loaded. /// protected override void Awake() { base.Awake(); if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer) { GameConfig.useSDK = false; GameConfig.OpenDebug = true; GMBtn.SetActive(true); } else { GMBtn.SetActive(false); } //这里为了方便直接使用Endless2D GameObject root = GameObject.Find("ManagerRoot"); if (root == null) { root = new GameObject("ManagerRoot"); root.AddComponent(); root.AddComponent(); root.AddComponent(); root.AddComponent(); root.AddComponent(); root.AddComponent(); } firstStart = true; //EventCenter.Ins.Add((int)KTGMGemClient.EventType.JsonDataReadDone, JsonDataReadDone); } Vector2 tmpOffect;//计算适配的偏移量 bool firstStart = true; // Start is called before the first frame update void Start() { InitSDK(); bGameStart = false; bFirstLoaded = false; GameConfig.IsUpgradeTowerLevel = false; GameConfig.CreateRandomTower = true; bVibrate = new bool[4]; bVibrate[0] = bVibrate[1] = bVibrate[2] = bVibrate[3] = false; EndlessBuffSelect.instance.HideBuffUI(); EndlessSettlement settlement = SettlementUI.transform.Find("BgMask").GetComponent(); settlement.Init(); SettlementUI.SetActive(false); EndlessMaskUI.instance.Hide(); EndlessBossHPManager.instance.HideHP(); EndlessScoreManager.instance.HideScore(); float ratio = 0.06666667f; RectTransform ts = GetComponent(); float tmpScale = ratio / ts.localScale.x - 1.0f; float offect = tmpScale * (ts.sizeDelta.y * 0.5f); //Debug.Log($"tmpScale:{tmpScale} offect:{offect}"); tmpOffect = new Vector2(0, offect); transform.Find("Panel/Bottom").GetComponent().anchoredPosition += tmpOffect; transform.Find("Panel/TowerBuyBtn").GetComponent().anchoredPosition += tmpOffect; transform.Find("Panel/SwitchSpeed").GetComponent().anchoredPosition += tmpOffect; transform.Find("Panel/BuffPreviewButton").GetComponent().anchoredPosition += tmpOffect; transform.Find("Panel/BossHPBar").GetComponent().anchoredPosition -= tmpOffect * 0.5f; transform.Find("Panel/Score").GetComponent().anchoredPosition -= tmpOffect * 0.5f; transform.Find("Panel/TimeInfo").GetComponent().anchoredPosition -= tmpOffect * 0.5f; //transform.Find("Panel/Boss").GetComponent().anchoredPosition -= tmpOffect*0.5f; //darkGroundImg = transform.Find("Image_DarkGround").gameObject; darkGroundImg.GetComponent().offsetMin += tmpOffect; darkGroundImg.GetComponent().offsetMax -= tmpOffect * 0.5f; darkGroundImg.SetActive(false); //查询是否已经做过了新手引导 //CheckIsNewbie(); GameConfig.EndlessOpenAttackTowerCount = 0; GameConfig.EndlessBuyTowerCount = 0; GameConfig.EndlessPortUseSkillTowerCount = 0; AudioSourceManager.Ins.Play(AudioEnum.BGM2); fireSkillBgImg = transform.Find("Panel/Energy/FireSkillBg").GetComponent(); transform.Find("Panel/Energy/FireSkillBg/SkillBtn").GetComponent