wangguan
2020-11-25 9969ed162f8aa4bd0b977a3c1eba45358eb01f72
Assets/Scripts/TowerDefense/UI/EndlessUIStart.cs
@@ -77,8 +77,12 @@
            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()
    {
@@ -103,7 +107,7 @@
        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;
@@ -119,24 +123,9 @@
        darkGroundImg.GetComponent<RectTransform>().offsetMax -= tmpOffect * 0.5f;
        darkGroundImg.SetActive(false);
        //查询是否已经做过了新手引导
        // 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;
@@ -169,6 +158,26 @@
        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>
@@ -327,6 +336,8 @@
    /// </summary>
    private void CreateThirdWave()
    {
        CommonDebugHelper.Debug($"开始下一关");
        EndlessLevelManager.instance.NewbieUpdateLevel();
        beginDragStep = false;
        guideThirdWaveStep = true;
@@ -372,6 +383,8 @@
    {
        EndlessLevelManager.instance.RestartWave();
        GameConfig.IsNewbie = false;
        transform.Find("Panel/SwitchSpeed").gameObject.SetActive(true);
    }
    /// <summary>
@@ -549,6 +562,16 @@
    // Update is called once per frame
    void Update()
    {
        if (firstStart)
        {
            if (!GameConfig.JsonReadDone)
                return;
            else
            {
                firstStart = false;
                CheckIsNewbie();
            }
        }
        if (isPause) return;
        if (bGameStart)