| | |
| | | private bool isPause; |
| | | |
| | | public bool beginDragStep = false; |
| | | public bool guideThirdWaveStep = false; |
| | | public bool guideFourthWaveStep = false; |
| | | |
| | | public GameObject darkGroundImg; |
| | | |
| | | private CanvasGroup canvasGroup; |
| | | |
| | | public GameObject GMBtn; |
| | | |
| | | /// <summary> |
| | | /// Awake is called when the script instance is being loaded. |
| | |
| | | |
| | | if (root == null) |
| | | { |
| | | root = new GameObject("ManagerRoot"); |
| | | root.AddComponent<DoNotDestory>(); |
| | | root.AddComponent<MasterSocket>(); |
| | | root.AddComponent<TDAA_SDKManager>(); |
| | | root.AddComponent<AudioSourceManager>(); |
| | | root.AddComponent<JsonDataReader>(); |
| | | root.AddComponent<JsonDataInit>(); |
| | | if (Application.platform == RuntimePlatform.WindowsEditor || |
| | | Application.platform == RuntimePlatform.WindowsPlayer) |
| | | { |
| | | GameConfig.useSDK = false; |
| | | } |
| | | |
| | | root = new GameObject("ManagerRoot"); |
| | | |
| | | root.AddComponent<DoNotDestory>(); |
| | | root.AddComponent<MasterSocket>(); |
| | | root.AddComponent<TDAA_SDKManager>(); |
| | | root.AddComponent<AudioSourceManager>(); |
| | | root.AddComponent<JsonDataReader>(); |
| | | root.AddComponent<JsonDataInit>(); |
| | | } |
| | | firstStart = true; |
| | | //EventCenter.Ins.Add((int)KTGMGemClient.EventType.JsonDataReadDone, JsonDataReadDone); |
| | |
| | | InitSDK(); |
| | | bGameStart = false; |
| | | bFirstLoaded = false; |
| | | GameConfig.IsUpgradeTowerLevel = false; |
| | | GameConfig.CreateRandomTower = true; |
| | | |
| | | bVibrate = new bool[4]; |
| | |
| | | skillSliderVStartP = skillSliderValueRect.anchoredPosition; |
| | | skillSliderVStartHeight = skillSliderValueRect.sizeDelta; |
| | | |
| | | skillPS1 = transform.Find("Panel/Energy/FireSkillBg/Effect_UI_JiNengTuBiao/03 (9)").GetComponent<ParticleSystem>(); |
| | | skillPS2 = transform.Find("Panel/Energy/FireSkillBg/Effect_UI_JiNengTuBiao_02/03 (16)").GetComponent<ParticleSystem>(); |
| | | skillPS1 = transform.Find("Panel/Energy/FireSkillBg/Effect_UI_JiNengTuBiao/03").gameObject; |
| | | skillPS2 = transform.Find("Panel/Energy/FireSkillBg/Effect_UI_JiNengTuBiao_02/03").gameObject; |
| | | |
| | | skillPS1.SetActive(false); |
| | | skillPS2.SetActive(false); |
| | | |
| | | transform.Find("Panel/BuffPreviewButton").gameObject.SetActive(false); |
| | | transform.Find("Panel/SwitchSpeed").gameObject.SetActive(false); |
| | | GMBtn.SetActive(false); |
| | | |
| | | GameConfig.EnergyCount = 0; |
| | | GameConfig.SkillLevel = 1; |
| | | |
| | | //CalculateSkillSliderValue(); |
| | | transform.Find("Panel/Energy").gameObject.SetActive(false); |
| | | |
| | | canvasGroup = transform.Find("Panel").GetComponent<CanvasGroup>(); |
| | | |
| | | EventCenter.Ins.Add<int>((int)KTGMGemClient.EventType.EnergyUp, EnergyUp); |
| | | EventCenter.Ins.Add((int)KTGMGemClient.EventType.SkillLevelUpBuff, SkillLevelUpBuff); |
| | |
| | | |
| | | private void CheckIsNewbie() |
| | | { |
| | | int guide = PlayerPrefs.GetInt("GemBattleGuide"); |
| | | GameConfig.IsNewbie = guide == 0; |
| | | |
| | | //GameConfig.IsNewbie = true; |
| | | |
| | | GameConfig.IsNewbieStart = GameConfig.IsNewbie; |
| | | |
| | | if (GameConfig.IsNewbie) |
| | | { |
| | | EndlessRandomTower.instance.SetCountDown(false); |
| | | |
| | | 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")); |
| | | GameObject prefab = Resources.Load<GameObject>("UI/Guide/GuidePanel"); |
| | | GameObject guideObj = Instantiate(prefab, transform.Find("Panel")); |
| | | guideObj.GetComponent<RectTransform>().offsetMin += tmpOffect; |
| | | AddGuideEvent(); |
| | | } |
| | | } |
| | | |
| | | public void GameOver() |
| | | { |
| | | canvasGroup.alpha = 0; |
| | | canvasGroup.interactable = false; |
| | | GuideEnergyUp(0); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | transform.Find("Panel/BuffPreviewButton").gameObject.SetActive(true); |
| | | transform.Find("Panel/SwitchSpeed").gameObject.SetActive(true); |
| | | // cx test |
| | | // GMBtn.SetActive(true); |
| | | } |
| | | |
| | | fireSkillCost = JsonDataCenter.GetSkillLevelInfo(fireSkillID, GameConfig.SkillLevel).cost; |
| | |
| | | /// </summary> |
| | | private void AddGuideEvent() |
| | | { |
| | | EventCenter.Ins.Add((int)KTGMGemClient.EventType.CreateFireLv2, CreateFireLv2); |
| | | EventCenter.Ins.Add((int)KTGMGemClient.EventType.CreateWoodLv2, CreateWoodLv2); |
| | | EventCenter.Ins.Add((int)KTGMGemClient.EventType.CreateFirstWave, CreateFirstWave); |
| | | EventCenter.Ins.Add((int)KTGMGemClient.EventType.RestartWave, RestartWave); |
| | | EventCenter.Ins.Add<int>((int)KTGMGemClient.EventType.AddGold, AddGold); |
| | | EventCenter.Ins.Add((int)KTGMGemClient.EventType.CreateFireLv1, CreateFireLv1); |
| | | EventCenter.Ins.Add((int)KTGMGemClient.EventType.CreateWaterLv1, CreateWaterLv1); |
| | | |
| | | EventCenter.Ins.Add((int)KTGMGemClient.EventType.CreateSecondWave, CreateSecondWave); |
| | | EventCenter.Ins.Add((int)KTGMGemClient.EventType.CreateThirdWave, CreateThirdWave); |
| | | EventCenter.Ins.Add((int)KTGMGemClient.EventType.CreateThirdWaveDone, CreateThirdWaveDone); |
| | | |
| | | EventCenter.Ins.Add((int)KTGMGemClient.EventType.CreateFourthWave, CreateFourthWave); |
| | | EventCenter.Ins.Add((int)KTGMGemClient.EventType.CreateFourthWaveDone, CreateFourthWaveDone); |
| | | EventCenter.Ins.Add<int>((int)KTGMGemClient.EventType.GuideEnergyUp, GuideEnergyUp); |
| | | |
| | | |
| | |
| | | /// <summary> |
| | | /// 在(2,3)位置放置一个火元素的塔 |
| | | /// </summary> |
| | | private void CreateFireLv2() |
| | | private void CreateWoodLv2() |
| | | { |
| | | Tower aTower = EndlessRandomTower.instance.getTowerByName("GrowUpTower"); |
| | | //GrowUpTower 火 |
| | | //BlinkTower 木 |
| | | //CopyCatTower 水 |
| | | |
| | | Tower aTower = EndlessRandomTower.instance.getTowerByName("BlinkTower"); |
| | | EndlessGameUI.instance.PlaceTowerForce(aTower, new IntVector2(2, 3), 2); |
| | | } |
| | | |
| | |
| | | private void CreateFirstWave() |
| | | { |
| | | Restart(); |
| | | EventCenter.Ins.Add((int)KTGMGemClient.EventType.FireTowerChargeEnd, OnFireTowerChargeEnd); |
| | | //EventCenter.Ins.Add((int)KTGMGemClient.EventType.FireTowerChargeEnd, OnFireTowerChargeEnd); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | Pause(); |
| | | EndlessLevelManager.instance.PauseWave(); |
| | | EventCenter.Ins.Remove((int)KTGMGemClient.EventType.FireTowerChargeEnd, OnFireTowerChargeEnd); |
| | | EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.ChargingEnd); |
| | | //EventCenter.Ins.Remove((int)KTGMGemClient.EventType.FireTowerChargeEnd, OnFireTowerChargeEnd); |
| | | //EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.ChargingEnd); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <summary> |
| | | /// 在攻击位置上创建一个1级的木塔 |
| | | /// </summary> |
| | | private void CreateFireLv1() |
| | | { |
| | | Tower aTower = EndlessRandomTower.instance.getTowerByName("GrowUpTower"); |
| | | EndlessGameUI.instance.PlaceTowerForce(aTower, new IntVector2(1, 3), 1); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 在攻击位置上创建一个1级的木塔 |
| | | /// </summary> |
| | | private void CreateWaterLv1() |
| | | { |
| | | Tower aTower = EndlessRandomTower.instance.getTowerByName("BlinkTower"); |
| | | EndlessGameUI.instance.PlaceTowerForce(aTower, new IntVector2(1, 3), 1); |
| | | Tower aTower = EndlessRandomTower.instance.getTowerByName("CopyCatTower"); |
| | | EndlessGameUI.instance.PlaceTowerForce(aTower, new IntVector2(3, 3), 1); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | |
| | | EndlessLevelManager.instance.NewbieUpdateLevel(); |
| | | beginDragStep = false; |
| | | guideThirdWaveStep = true; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 第三关出兵完毕,暂停出兵 |
| | | /// </summary> |
| | | private void CreateThirdWaveDone() |
| | | private void CreateFourthWaveDone() |
| | | { |
| | | EndlessLevelManager.instance.PauseWave(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 开始第四关 |
| | | /// </summary> |
| | | private void CreateFourthWave() |
| | | { |
| | | CommonDebugHelper.Debug($"开始下一关"); |
| | | |
| | | EndlessLevelManager.instance.NewbieUpdateLevel(); |
| | | guideFourthWaveStep = true; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | |
| | | private Color disColor = new Color(1.0f, 1.0f, 1.0f, 0); |
| | | private Text fireSkillLevelText; |
| | | private Image fireSkillBgImg; |
| | | private ParticleSystem skillPS1, skillPS2; |
| | | private GameObject skillPS1, skillPS2; |
| | | |
| | | /// <summary> |
| | | /// 点击火技能 |
| | | /// </summary> |
| | | private void OnClickFireSkillBtn() |
| | | { |
| | | if (GameConfig.InfiniteSkill) |
| | | { |
| | | GuideEnergyUp(200); |
| | | EndlessWaveLineManager.instance.PlayAllWaveLineEffect(); |
| | | AgentInsManager.instance.ExecAllWavelineAttack(fireSkillID, GameConfig.SkillLevel, false); |
| | | return; |
| | | } |
| | | |
| | | //Debug.Log("释放了火技能:" + GameConfig.EnergyCount + " fireSkillCost:" + fireSkillCost); |
| | | if (GameConfig.EnergyCount >= fireSkillCost) |
| | | { |
| | |
| | | EndlessWaveLineManager.instance.PlayAllWaveLineEffect(); |
| | | AgentInsManager.instance.ExecAllWavelineAttack(fireSkillID, GameConfig.SkillLevel, false); |
| | | ++GameConfig.EndlessPortUseSkillTowerCount; |
| | | } |
| | | else |
| | | { |
| | | AudioSourceManager.Ins.Play(AudioEnum.UIDisable); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | if (GameConfig.EnergyCount == energyMax) |
| | | { |
| | | |
| | | Debug.Log("能量已满"); |
| | | //Debug.Log("能量已满"); |
| | | if (fireSkillBgImg.color != disColor) |
| | | { |
| | | fireSkillBgImg.color = disColor; |
| | | } |
| | | skillPS1.Play(); |
| | | skillPS2.Play(); |
| | | if (!skillPS1.activeSelf) skillPS1.SetActive(true); |
| | | if (!skillPS2.activeSelf) skillPS2.SetActive(true); |
| | | |
| | | //skillPS1.Play(); |
| | | //skillPS2.Play(); |
| | | } |
| | | else |
| | | { |
| | | Debug.Log("能量达到一次使用"); |
| | | //Debug.Log("能量达到一次使用"); |
| | | if (fireSkillBgImg.color != normalColor) |
| | | { |
| | | fireSkillBgImg.color = normalColor; |
| | | } |
| | | if (skillPS1.isPlaying) skillPS1.Stop(); |
| | | if (!skillPS2.isPlaying) skillPS2.Play(); |
| | | if (skillPS1.activeSelf) skillPS1.SetActive(false); |
| | | if (!skillPS2.activeSelf) skillPS2.SetActive(true); |
| | | //if (skillPS1.isPlaying) skillPS1.Stop(); |
| | | //if (!skillPS2.isPlaying) skillPS2.Play(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //Debug.Log("能量不够"); |
| | | if (fireSkillBgImg.color != normalColor) |
| | | { |
| | | fireSkillBgImg.color = normalColor; |
| | | } |
| | | if (skillPS1.isPlaying) skillPS1.Stop(); |
| | | if (skillPS2.isPlaying) skillPS2.Stop(); |
| | | if (skillPS1.activeSelf) skillPS1.SetActive(false); |
| | | if (skillPS2.activeSelf) skillPS2.SetActive(false); |
| | | // if (skillPS1.isPlaying) skillPS1.Stop(); |
| | | // if (skillPS2.isPlaying) skillPS2.Stop(); |
| | | |
| | | } |
| | | } |
| | |
| | | |
| | | public bool IsGameRunning { get { return !isPause; } } |
| | | |
| | | private bool isUpgradeTowerLevel; |
| | | |
| | | // Update is called once per frame |
| | | void Update() |
| | | { |
| | |
| | | if (bGameStart) |
| | | { |
| | | startTime += Time.deltaTime; |
| | | |
| | | // if (!isUpgradeTowerLevel && startTime >= JsonDataCenter.DOUBLE_GEM_TIME) |
| | | // { |
| | | // EndlessRandomTower.instance.UpdateDescDisplay(); |
| | | // isUpgradeTowerLevel = true; |
| | | // } |
| | | |
| | | timeTextNew.text = ConvertTime((float)Math.Ceiling(startTime)); |
| | | } |
| | | |