using cfg.GuideCfg; using System; using Cysharp.Threading.Tasks; using Gameplay.Level; using Framework; using Gameplay.Unit; using Framework.Condition; namespace Gameplay.Guide { /// /// 引导步骤基类 /// public abstract class GuideStepBase { /// /// 是否等待中 /// private bool isWaiting; /// /// 完成标记 /// private bool isComplete; /// /// 引导状态 /// private E_GuideState guideState; /// /// 引导配置 /// public DataGuideCfg Cfg { get; private set; } /// /// 是否引导中 /// public bool IsGuiding { get { return E_GuideState.Guiding == guideState; } } public GuideStepBase(DataGuideCfg cfg) { Cfg = cfg; guideState = E_GuideState.Idle; isWaiting = true; isComplete = false; ConditionReactor.Instance.AddReaction(cfg.CompleteCondition, OnCompleteByCondition); } /// /// 开始引导 /// public async void StartGuide() { guideState = E_GuideState.Guiding; isWaiting = true; GuideManager.Debug($"开始id为{Cfg.Id}的引导,延迟{Cfg.StepStartDelay}秒开始"); await DoBeforeGuide(); await UniTask.WaitForSeconds(Cfg.StepStartDelay); // 延迟时间开始 isWaiting = false; DoRealBeforeGuide(); GuideManager.Debug($"实际执行id为{Cfg.Id}的引导"); DoGuide(); CommonUtils.GuideStepBiEvent(Cfg.Id, 0); // BI打点 if (isComplete) Complete(); } /// /// 跳过当前步骤 /// public void SkipStep() { } /// /// 结束引导 /// public void EndGuide() { if (!IsGuiding) return; RecoverState(); guideState = E_GuideState.Idle; } /// /// 引导开始之前 /// protected virtual async UniTask DoBeforeGuide() { await UI_GuideController.Open(); UIManager.Instance.IsEnableBack = false; InputManager.Instance.IsEnable = false; } /// /// 引导实际开始之前 /// protected virtual void DoRealBeforeGuide() { InputManager.Instance.IsEnable = true; } /// /// 引导 /// protected virtual void DoGuide() { SetGuideState(); } /// /// 引导完成之前 /// protected virtual void DoBeforeComplete() { UIManager.Instance.CloseWindow(UINameConst.UI_Guide); UIManager.Instance.IsEnableBack = true; } /// /// 设置引导状态 /// protected virtual void SetGuideState() { if (LevelManager.Instance.IsInLevel && null != LevelManager.Instance.CurrentLevel && LevelManager.Instance.CurrentLevel.IsInBattle()) { if (UIManager.Instance.CheckWindowCreated(UINameConst.UIFightInfoTip)) UIManager.Instance.CloseWindow(UINameConst.UIFightInfoTip, UIWindowCloseType.OnlyHide); PVEManager.Instance.EnableSelfAutoFight(false); LevelManager.Instance.CurrentLevel.SetSpeed(ELevelSpeed.Level_0); // 引导中战斗速度设为0 } } /// /// 还原状态 /// protected virtual void RecoverState() { if (LevelManager.Instance.IsInLevel && null != LevelManager.Instance.CurrentLevel && LevelManager.Instance.CurrentLevel.IsInBattle()) { LevelManager.Instance.CurrentLevel.SetSpeed(ELevelSpeed.DEFAULT_SPEED); // 引导完成,战斗速度还原 } } /// /// 完成引导 /// private void Complete() { if (!IsGuiding) { isComplete = true; return; } if (isWaiting) { isComplete = true; return; } GuideManager.Debug($"完成id为{Cfg.Id}的引导"); guideState = E_GuideState.Complete; DoBeforeComplete(); RecoverState(); GuideManager.Instance.CompleteStep(); CommonUtils.GuideStepBiEvent(Cfg.Id, 1); // BI打点 CommonUtils.GuideStepBiEvent(Cfg.Id.ToString()); } /// /// 通过条件完成引导 /// /// /// /// private void OnCompleteByCondition(bool conditionResult, object callBackParam, int reactionID) { if (!conditionResult) return; ConditionReactor.Instance.RemoveReaction(reactionID); Complete(); } } /// /// 点击地板 /// internal sealed class ClickFloorGuide : GuideStepBase { public static ClickFloorGuide Create(DataGuideCfg cfg) { return new ClickFloorGuide(cfg); } /// /// 底板索引 /// private readonly int floorIndex; private ClickFloorGuide(DataGuideCfg cfg) : base(cfg) { if (Cfg.GuideParams.Length <= 0) throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideType},参数数量错误:1.地板索引"); if (int.TryParse(Cfg.GuideParams[0], out int index)) floorIndex = index; else throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideType},第1个参数类型错误:应该为int类型"); } protected override async void DoGuide() { try { base.DoGuide(); await UI_GuideController.OpenByClickFloor(floorIndex, Cfg); } catch (Exception e) { DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}"); } } protected override void DoRealBeforeGuide() { base.DoRealBeforeGuide(); EventManager.Instance.Register(EventManager.EventName.Guide_ClickFloor, OnSetFightSpeed); EventManager.Instance.Register(EventManager.EventName.Guide_ClickFloor, OnClickFloor); } protected override void DoBeforeComplete() { EventManager.Instance.Unregister(EventManager.EventName.Guide_ClickFloor, OnClickFloor); EventManager.Instance.Unregister(EventManager.EventName.Guide_ClickFloor, OnSetFightSpeed); base.DoBeforeComplete(); } protected override void SetGuideState() { base.SetGuideState(); UIRoot.Instance.IsEnableGraphicRaycasterByGuide(false); GuideManager.Instance.IsControlFloor = true; GuideManager.Instance.FloorIndex = floorIndex; } protected override void RecoverState() { UIRoot.Instance.IsEnableGraphicRaycasterByGuide(true); GuideManager.Instance.IsControlFloor = false; GuideManager.Instance.FloorIndex = -1; base.RecoverState(); } /// /// 设置战斗速度 /// private void OnSetFightSpeed(int cellIndex) { if (cellIndex != floorIndex) return; if (LevelManager.Instance.IsInLevel && null != LevelManager.Instance.CurrentLevel && LevelManager.Instance.CurrentLevel.isInBattle) { //if (GuideManager.Instance.IsUseSkillSuccess) LevelManager.Instance.CurrentLevel.SetSpeed(ELevelSpeed.DEFAULT_SPEED); } } private async void OnClickFloor(int cellIndex) { if (cellIndex != floorIndex) return; await UI_GuideController.Open(); } } /// /// 点击角色 /// internal sealed class ClickCharacterGuide : GuideStepBase { public static ClickCharacterGuide Create(DataGuideCfg cfg) { return new ClickCharacterGuide(cfg); } /// /// 角色id /// private readonly int characterId; /// /// 地板索引 /// private readonly int floorIndex; private ClickCharacterGuide(DataGuideCfg cfg) : base(cfg) { if (Cfg.GuideParams.Length <= 0) throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideType},参数数量错误:1.角色id"); if (!int.TryParse(Cfg.GuideParams[0], out characterId)) throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideType},第1个参数类型错误:应该为int类型"); foreach (GameUnit gameUnit in GameUnitManager.instance.infightUnits.unitList) { if (Unit.Data.EGameUnitType.Character != gameUnit.gameunitType) continue; if (gameUnit is not Character.Character characterUnit) continue; if (characterId == characterUnit.ConfigId) floorIndex = characterUnit.transData.cellIndex; } } protected override async void DoGuide() { try { base.DoGuide(); await UI_GuideController.OpenByClickFloor(floorIndex, Cfg); } catch (Exception e) { DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}"); } } protected override void DoRealBeforeGuide() { base.DoRealBeforeGuide(); EventManager.Instance.Register(EventManager.EventName.Guide_UseSkillPre, OnSetFightSpeed); } protected override void DoBeforeComplete() { EventManager.Instance.Unregister(EventManager.EventName.Guide_UseSkillPre, OnSetFightSpeed); base.DoBeforeComplete(); } protected override void SetGuideState() { base.SetGuideState(); UIRoot.Instance.IsEnableGraphicRaycasterByGuide(false); GuideManager.Instance.IsControlFloor = true; GuideManager.Instance.FloorIndex = floorIndex; } protected override void RecoverState() { UIRoot.Instance.IsEnableGraphicRaycasterByGuide(true); GuideManager.Instance.IsControlFloor = false; GuideManager.Instance.FloorIndex = -1; base.RecoverState(); } /// /// 设置战斗速度 /// /// private void OnSetFightSpeed(int id) { if (characterId != id) return; if (LevelManager.Instance.IsInLevel && null != LevelManager.Instance.CurrentLevel && LevelManager.Instance.CurrentLevel.isInBattle) { LevelManager.Instance.CurrentLevel.SetSpeed(ELevelSpeed.DEFAULT_SPEED); } } } /// /// 点击敌人 /// internal sealed class ClickEnemyGuide : GuideStepBase { public static ClickEnemyGuide Create(DataGuideCfg cfg) { return new ClickEnemyGuide(cfg); } /// /// 地板索引 /// private readonly int floorIndex; private ClickEnemyGuide(DataGuideCfg cfg) : base(cfg) { if (Cfg.GuideParams.Length <= 0) throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideType},参数数量错误:1.敌人id"); if (!int.TryParse(Cfg.GuideParams[0], out int enemyId)) throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideType},第1个参数类型错误:应该为int类型"); foreach (GameUnit gameUnit in GameUnitManager.instance.infightUnits.unitList) { if (enemyId == gameUnit.GetID()) floorIndex = gameUnit.transData.cellIndex; } } protected override async void DoGuide() { try { base.DoGuide(); await UI_GuideController.OpenByClickFloor(floorIndex, Cfg); } catch (Exception e) { DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}"); } } protected override void SetGuideState() { base.SetGuideState(); UIRoot.Instance.IsEnableGraphicRaycasterByGuide(false); GuideManager.Instance.IsControlFloor = true; GuideManager.Instance.FloorIndex = floorIndex; } protected override void RecoverState() { UIRoot.Instance.IsEnableGraphicRaycasterByGuide(true); GuideManager.Instance.IsControlFloor = false; GuideManager.Instance.FloorIndex = -1; base.RecoverState(); } } /// /// 指向UI说明 /// internal sealed class ArrowUITipGuide : GuideStepBase { public static ArrowUITipGuide Create(DataGuideCfg cfg) { return new ArrowUITipGuide(cfg); } /// /// UI名 /// private readonly string uiName; /// /// 按钮路径 /// private readonly string buttonPath; public ArrowUITipGuide(DataGuideCfg cfg) : base(cfg) { if (Cfg.GuideParams.Length > 1) { uiName = cfg.GuideParams[0]; buttonPath = cfg.GuideParams[1]; } } protected override async void DoGuide() { try { base.DoGuide(); await UI_GuideController.OpenByArrowUITip(uiName, buttonPath, Cfg); } catch (Exception e) { DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}"); } } } /// /// 点击引导按钮 /// internal sealed class ClickButtonGuide : GuideStepBase { public static ClickButtonGuide Create(DataGuideCfg cfg) { return new ClickButtonGuide(cfg); } /// /// UI名 /// private readonly string uiName; /// /// 按钮路径 /// private readonly string buttonPath; public ClickButtonGuide(DataGuideCfg cfg) : base(cfg) { if (Cfg.GuideParams.Length < 2) throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideType},参数数量错误:1.UI名,2.按钮路径"); uiName = Cfg.GuideParams[0]; buttonPath = Cfg.GuideParams[1]; } protected override async void DoGuide() { try { base.DoGuide(); await UI_GuideController.OpenByButton(uiName, buttonPath, Cfg); } catch (Exception e) { DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}"); } } } /// /// 关卡取消选中单位 /// internal sealed class LevelCancelSelectUnitGuide : GuideStepBase { public static LevelCancelSelectUnitGuide Create(DataGuideCfg cfg) { return new LevelCancelSelectUnitGuide(cfg); } public LevelCancelSelectUnitGuide(DataGuideCfg cfg) : base(cfg) { } protected override void DoGuide() { try { base.DoGuide(); if (null != LevelManager.Instance.CurrentLevel.selectUnit) LevelManager.Instance.CurrentLevel.UnSelectUnit(); } catch (Exception e) { DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}"); } } } /* #region 引导点击 /// /// 滑动按钮 /// internal sealed class SliderButtonStep : GuideStepBase { /// /// UI名 /// private readonly string uiName; /// /// 按钮路径 /// private readonly string buttonPath; /// /// 地板索引 /// private readonly int floorIndex; public SliderButtonStep(DataGuideCfg cfg) : base(cfg) { if (Cfg.GuideTypeParams.Length <= 1) throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideStepType},参数数量错误:1.UI名,2.按钮路径,3(可选).地板索引"); uiName = Cfg.GuideTypeParams[0]; buttonPath = Cfg.GuideTypeParams[1]; if (Cfg.GuideTypeParams.Length > 2) { if (int.TryParse(Cfg.GuideTypeParams[2], out int index)) floorIndex = index; else throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideStepType},第3个参数类型错误:应该为int类型"); } } protected override async void DoGuide() { try { base.DoGuide(); await UI_GuideController.Open(UI_GuideController.E_GuideArrowType.SliderButton, uiName, buttonPath, Cfg, floorIndex); } catch (Exception e) { DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}"); } } protected override void SetGuideState() { if (LevelManager.Instance.IsInLevel && null != LevelManager.Instance.CurrentLevel && LevelManager.Instance.CurrentLevel.IsInBattle()) LevelManager.Instance.CurrentLevel.SetSpeed(ELevelSpeed.Level_0); } protected override void RecoverState() { if (LevelManager.Instance.IsInLevel && null != LevelManager.Instance.CurrentLevel && LevelManager.Instance.CurrentLevel.IsInBattle()) LevelManager.Instance.CurrentLevel.SetSpeed(ELevelSpeed.DEFAULT_SPEED); } } /// /// 滑动按钮上阵 /// internal sealed class SliderButtonBattleStep : GuideStepBase { /// /// UI名 /// private readonly string uiName; /// /// 按钮路径 /// private readonly string buttonPath; /// /// 地板索引 /// private readonly int floorIndex; public SliderButtonBattleStep(DataGuideCfg cfg) : base(cfg) { if (Cfg.GuideTypeParams.Length <= 1) throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideStepType},参数数量错误:1.UI名,2.按钮路径,3(可选).地板索引"); uiName = Cfg.GuideTypeParams[0]; buttonPath = Cfg.GuideTypeParams[1]; if (Cfg.GuideTypeParams.Length > 2) { if (int.TryParse(Cfg.GuideTypeParams[2], out int index)) floorIndex = index; else throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideStepType},第3个参数类型错误:应该为int类型"); } } protected override async void DoGuide() { try { base.DoGuide(); await UI_GuideController.Open(UI_GuideController.E_GuideArrowType.SliderButton, uiName, buttonPath, Cfg, floorIndex); } catch (Exception e) { DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}"); } } protected override void SetGuideState() { if (LevelManager.Instance.IsInLevel && null != LevelManager.Instance.CurrentLevel && LevelManager.Instance.CurrentLevel.IsInBattle()) LevelManager.Instance.CurrentLevel.SetSpeed(ELevelSpeed.Level_0); GuideManager.Instance.IsControlFloor = true; GuideManager.Instance.FloorIndex = floorIndex; EventManager.Instance.Register(EventManager.EventName.Guide_CancelModeFight, OnCancelFightModel); } protected override void RecoverState() { EventManager.Instance.Unregister(EventManager.EventName.Guide_CancelModeFight, OnCancelFightModel); if (LevelManager.Instance.IsInLevel && null != LevelManager.Instance.CurrentLevel && LevelManager.Instance.CurrentLevel.IsInBattle()) LevelManager.Instance.CurrentLevel.SetSpeed(ELevelSpeed.DEFAULT_SPEED); GuideManager.Instance.IsControlFloor = false; GuideManager.Instance.FloorIndex = -1; } private async void OnCancelFightModel() { await UniTask.Delay(300); await UI_GuideController.Open(UI_GuideController.E_GuideArrowType.SliderButton, uiName, buttonPath, Cfg, floorIndex); } } /// /// 滑动按钮使用技能 /// internal sealed class SliderButtonUseSkillStep : GuideStepBase { /// /// UI名 /// private readonly string uiName; /// /// 按钮路径 /// private readonly string buttonPath; /// /// 地板索引 /// private readonly int floorIndex; public SliderButtonUseSkillStep(DataGuideCfg cfg) : base(cfg) { if (Cfg.GuideTypeParams.Length <= 1) throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideStepType},参数数量错误:1.UI名,2.按钮路径,3(可选).地板索引"); uiName = Cfg.GuideTypeParams[0]; buttonPath = Cfg.GuideTypeParams[1]; if (Cfg.GuideTypeParams.Length > 2) { if (int.TryParse(Cfg.GuideTypeParams[2], out int index)) floorIndex = index; else throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideStepType},第3个参数类型错误:应该为int类型"); } } protected override async void DoGuide() { try { base.DoGuide(); await UI_GuideController.Open(UI_GuideController.E_GuideArrowType.SliderButton, uiName, buttonPath, Cfg, floorIndex); } catch (Exception e) { DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}"); } } protected override void SetGuideState() { if (LevelManager.Instance.IsInLevel && null != LevelManager.Instance.CurrentLevel && LevelManager.Instance.CurrentLevel.IsInBattle()) LevelManager.Instance.CurrentLevel.SetSpeed(ELevelSpeed.Level_0); GuideManager.Instance.IsControlFloor = true; GuideManager.Instance.FloorIndex = floorIndex; EventManager.Instance.Register(EventManager.EventName.UI_SKILL_CANCEL, OnCancelUseSkill); } protected override void RecoverState() { EventManager.Instance.Unregister(EventManager.EventName.UI_SKILL_CANCEL, OnCancelUseSkill); if (LevelManager.Instance.IsInLevel && null != LevelManager.Instance.CurrentLevel && LevelManager.Instance.CurrentLevel.IsInBattle()) LevelManager.Instance.CurrentLevel.SetSpeed(ELevelSpeed.DEFAULT_SPEED); GuideManager.Instance.IsControlFloor = false; GuideManager.Instance.FloorIndex = -1; } private async void OnCancelUseSkill() { AreaManager.instance.LogicUpdate(0); await UniTask.Delay(300); await UI_GuideController.Open(UI_GuideController.E_GuideArrowType.SliderButton, uiName, buttonPath, Cfg, floorIndex); } } /// /// 滑动按钮使用指挥官技能 /// internal sealed class SliderButtonUsePlayerSkillStep : GuideStepBase { /// /// UI名 /// private readonly string uiName; /// /// 按钮路径 /// private readonly string buttonPath; /// /// 地板索引 /// private readonly int floorIndex; public SliderButtonUsePlayerSkillStep(DataGuideCfg cfg) : base(cfg) { if (Cfg.GuideTypeParams.Length <= 1) throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideStepType},参数数量错误:1.UI名,2.按钮路径,3(可选).地板索引"); uiName = Cfg.GuideTypeParams[0]; buttonPath = Cfg.GuideTypeParams[1]; if (Cfg.GuideTypeParams.Length > 2) { if (int.TryParse(Cfg.GuideTypeParams[2], out int index)) floorIndex = index; else throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideStepType},第3个参数类型错误:应该为int类型"); } } protected override async void DoGuide() { try { base.DoGuide(); await UI_GuideController.Open(UI_GuideController.E_GuideArrowType.SliderButton, uiName, buttonPath, Cfg, floorIndex); } catch (Exception e) { DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}"); } } protected override void SetGuideState() { if (LevelManager.Instance.IsInLevel && null != LevelManager.Instance.CurrentLevel && LevelManager.Instance.CurrentLevel.IsInBattle()) LevelManager.Instance.CurrentLevel.SetSpeed(ELevelSpeed.Level_0); GuideManager.Instance.IsControlFloor = true; GuideManager.Instance.FloorIndex = floorIndex; EventManager.Instance.Register(EventManager.EventName.Guide_CancelPlayerSkill, OnCancelUseSkill); } protected override void RecoverState() { EventManager.Instance.Unregister(EventManager.EventName.Guide_CancelPlayerSkill, OnCancelUseSkill); if (LevelManager.Instance.IsInLevel && null != LevelManager.Instance.CurrentLevel && LevelManager.Instance.CurrentLevel.IsInBattle()) LevelManager.Instance.CurrentLevel.SetSpeed(ELevelSpeed.DEFAULT_SPEED); GuideManager.Instance.IsControlFloor = false; GuideManager.Instance.FloorIndex = -1; } private async void OnCancelUseSkill() { SkillManager.instance.playerSkillManager.LogicUpdate(0); AreaManager.instance.LogicUpdate(0); await UniTask.Delay(300); await UI_GuideController.Open(UI_GuideController.E_GuideArrowType.SliderButton, uiName, buttonPath, Cfg, floorIndex); } } #endregion /// /// 显示引导提示 /// internal sealed class ShowGuideTipStep : GuideStepBase { /// /// 引导提示配置id /// private readonly int guideTipCfgId; public ShowGuideTipStep(DataGuideCfg cfg) : base(cfg) { if (Cfg.GuideTypeParams.Length <= 0) throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideStepType},参数数量错误:1.引导Tip的Id"); if (int.TryParse(Cfg.GuideTypeParams[0], out int id)) guideTipCfgId = id; else throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideStepType},第1个参数类型错误:应该为int类型"); } protected override async void DoGuide() { try { base.DoGuide(); await UI_GuideTipController.Open(guideTipCfgId); } catch (Exception e) { DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}"); } } protected override void SetGuideState() { if (LevelManager.Instance.IsInLevel && null != LevelManager.Instance.CurrentLevel && LevelManager.Instance.CurrentLevel.IsInBattle()) LevelManager.Instance.CurrentLevel.SetSpeed(ELevelSpeed.Level_0); } protected override void RecoverState() { if (LevelManager.Instance.IsInLevel && null != LevelManager.Instance.CurrentLevel && LevelManager.Instance.CurrentLevel.IsInBattle()) LevelManager.Instance.CurrentLevel.SetSpeed(ELevelSpeed.DEFAULT_SPEED); } } /// /// 关卡上阵 /// internal sealed class LevelEmbattleStep : GuideStepBase { public LevelEmbattleStep(DataGuideCfg cfg) : base(cfg) { } protected override async UniTask DoBeforeGuide() { await base.DoBeforeGuide(); UIWindow uiWindow = UIManager.Instance.GetOpenedWindowByPath(UINameConst.UI_StartBtn_CMSBtn); if (null == uiWindow) return; Transform ts = uiWindow.gameObject.transform.Find("UIStartBtn/Image_UI_Start_BG/Button_StartBtn"); if (null == ts) return; Button btn = ts.GetComponent