using asap.core; using cfg; using Game; using Script.RuntimeScript.Interface; using Script.RuntimeScript.model.Data; using UnityEngine; namespace Script.RuntimeScript.GameLogic { public class SpecialEventItem : MonoBehaviour, BroadEffectInterface { public int PlayEffectPriority { set; get; } = 0; public GridPropData Data { get; set; } private Animation _ani; GameObject animationRoot; GameObject dgSand_sandpit; private void Awake() { animationRoot = this.transform.Find("AnimationRoot").gameObject; dgSand_sandpit = this.transform.Find("SandpitRoot").gameObject; } public void Start() { dgSand_sandpit.SetActive(false); animationRoot.SetActive(false); this.gameObject.SetActive(true); } public void ShowSandpit() { dgSand_sandpit.SetActive(true); } public async void PlayEffect(bool overCheck) { int upDelay = SandDigEventConst.BigShovelAnimTime; if (overCheck) { upDelay = SandDigEventConst.InUpDelay; } await System.Threading.Tasks.Task.Delay(upDelay); animationRoot.SetActive(true); if (_ani == null) { _ani = animationRoot.GetComponent(); } string effectName = string.Empty; DiggingGameManager diggingGameManager = GContext.container.Resolve(); var configInit = diggingGameManager.DataModel.digActivityConfig; float time = configInit.SpecRowColAniTime; if (Data.Config.DiggingType is BombClear) { GContext.Publish(new EventUISound("audio_ui_sanddig_starfish")); effectName = (Data.Config.DiggingType as BombClear).AppearAnim; //time = SandDigEventConst.BombAnimTime; time = configInit.SpecBombAniTime; } else if (Data.Config.DiggingType is ColumnClear) { GContext.Publish(new EventUISound("audio_ui_sanddig_crab")); effectName = (Data.Config.DiggingType as ColumnClear).AppearAnim; } else if (Data.Config.DiggingType is RowClear) { GContext.Publish(new EventUISound("audio_ui_sanddig_crab")); effectName = (Data.Config.DiggingType as RowClear).AppearAnim; } else { DiggingGameManager.LogWarning("特殊事件没有配置动画,请检查!"); this.gameObject.SetActive(false); } GContext.Publish(new ExplosionClick(this)); if (!string.IsNullOrEmpty(effectName)) { _ani.Play(effectName); await Awaiters.Seconds(time); this.gameObject.SetActive(false); } } } }