| | |
| | | protected override void Awake() |
| | | { |
| | | base.Awake(); |
| | | //这里为了方便直接使用Endless2D |
| | | GameObject root = GameObject.Find("ManagerRoot"); |
| | | |
| | | if (root == null) |
| | |
| | | root.AddComponent<JsonDataReader>(); |
| | | root.AddComponent<JsonDataInit>(); |
| | | } |
| | | 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() |
| | | { |
| | |
| | | float tmpScale = ratio / ts.localScale.x - 1.0f; |
| | | float offect = tmpScale * (ts.sizeDelta.y * 0.5f); |
| | | //Debug.Log($"tmpScale:{tmpScale} offect:{offect}"); |
| | | Vector2 tmpOffect = new Vector2(0, offect); |
| | | tmpOffect = new Vector2(0, offect); |
| | | transform.Find("Panel/Bottom").GetComponent<RectTransform>().anchoredPosition += tmpOffect; |
| | | transform.Find("Panel/TowerBuyBtn").GetComponent<RectTransform>().anchoredPosition += tmpOffect; |
| | | transform.Find("Panel/SwitchSpeed").GetComponent<RectTransform>().anchoredPosition += tmpOffect; |
| | | |
| | | transform.Find("Panel/BossHPBar").GetComponent<RectTransform>().anchoredPosition -= tmpOffect * 0.5f; |
| | | transform.Find("Panel/Score").GetComponent<RectTransform>().anchoredPosition -= tmpOffect * 0.5f; |
| | |
| | | darkGroundImg.GetComponent<RectTransform>().offsetMax -= tmpOffect * 0.5f; |
| | | |
| | | darkGroundImg.SetActive(false); |
| | | |
| | | //查询是否已经做过了新手引导 |
| | | int guide = PlayerPrefs.GetInt("GemBattleGuide"); |
| | | // GameConfig.IsNewbie = guide == 0; |
| | | // cx test |
| | | GameConfig.IsNewbie = false; |
| | | if (GameConfig.IsNewbie) |
| | | { |
| | | Debug.Log("开始新手引导"); |
| | | GameConfig.CanDragTower = false; |
| | | Pause(); |
| | | HideUIMask(); |
| | | countDownTextNew.text = ""; |
| | | countDownTextNew.gameObject.SetActive(false); |
| | | |
| | | |
| | | GameObject guideObj = Instantiate(Resources.Load<GameObject>("UI/Guide/GuidePanel"), transform.Find("Panel")); |
| | | guideObj.GetComponent<RectTransform>().offsetMin += tmpOffect; |
| | | AddGuideEvent(); |
| | | } |
| | | //CheckIsNewbie(); |
| | | |
| | | GameConfig.EndlessOpenAttackTowerCount = 0; |
| | | GameConfig.EndlessBuyTowerCount = 0; |
| | |
| | | EventCenter.Ins.Add((int)KTGMGemClient.EventType.SkillLevelUpBuff, SkillLevelUpBuff); |
| | | |
| | | |
| | | } |
| | | |
| | | private void CheckIsNewbie() |
| | | { |
| | | //GameConfig.IsNewbie = false; |
| | | if (GameConfig.IsNewbie) |
| | | { |
| | | Debug.Log("开始新手引导"); |
| | | GameConfig.CanDragTower = false; |
| | | Pause(); |
| | | HideUIMask(); |
| | | countDownTextNew.text = ""; |
| | | countDownTextNew.gameObject.SetActive(false); |
| | | |
| | | GameObject guideObj = Instantiate(Resources.Load<GameObject>("UI/Guide/GuidePanel"), transform.Find("Panel")); |
| | | guideObj.GetComponent<RectTransform>().offsetMin += tmpOffect; |
| | | AddGuideEvent(); |
| | | |
| | | transform.Find("Panel/SwitchSpeed").gameObject.SetActive(false); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | private void CreateThirdWave() |
| | | { |
| | | CommonDebugHelper.Debug($"开始下一关"); |
| | | |
| | | EndlessLevelManager.instance.NewbieUpdateLevel(); |
| | | beginDragStep = false; |
| | | guideThirdWaveStep = true; |
| | |
| | | { |
| | | EndlessLevelManager.instance.RestartWave(); |
| | | GameConfig.IsNewbie = false; |
| | | transform.Find("Panel/SwitchSpeed").gameObject.SetActive(true); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | // Update is called once per frame |
| | | void Update() |
| | | { |
| | | if (firstStart) |
| | | { |
| | | if (!GameConfig.JsonReadDone) |
| | | return; |
| | | else |
| | | { |
| | | firstStart = false; |
| | | CheckIsNewbie(); |
| | | } |
| | | } |
| | | if (isPause) return; |
| | | |
| | | if (bGameStart) |