void ShowHeroAnim() { //初始化切换英雄 CloseEmpty(); ClearEffect(); InitParams(true); usingHeroCID = showingCID == null?CoreEntry.portalMgr.GetLastHeroCID() : showingCID; var data = PlayerDataMgr.instance.GetHeroDataByInstanceId(usingHeroCID); if (data != null) { CoreEntry.eventMgr.TriggerEvent <bool>("showHeroSwitch", false); //设置切换类型 this.changeType = ChangeType.NEW_HERO; //回调函数 System.Action cb = () => { FinishEffect("switchIdle", () => { ResetUsingCID(); InitParams(false); ClearEffect(); EndSwitch(); }); }; if (CoreEntry.IsStageUsingHero(CoreEntry.GetGameStage())) { CoreEntry.globalObject.GetComponent <CoreEntry>().StartCoroutine(SceneMgr.DelayToInvoke(() => { //播放切换英雄特效 CreateEffect(data.resId, "idle", cb); })); needDelay = false; } else { //播放切换英雄特效 CreateEffect(data.resId, "idle", cb); } } }
void ShowVirtualHeroAnim() { virtualAction = () => { CoreEntry.virtualHeroMgr.IsVirtualSwitchHero = true; //Clear Effect Before ClearEffect(); //Close Main Camera CoreEntry.cameraMgr.CloseMainCamera(); //Get VirtualSwitchPanel virtualPanel = CoreEntry.uiMgr.GetPanelSimply(AIToyMgr.VIRTUAL_PANEL); //Mount Sound if (virtualPanel != null) { soundId = CoreEntry.soundMgr.PlaySound("MainUIsfx", "Play_Hero_Change_Before", virtualPanel.gameObject); } }; if (virtualAction == null) { return; } if (CoreEntry.IsStageUsingHero(CoreEntry.GetGameStage())) { //Wait for two frames to init new object ignoreTimeScale CoreEntry.globalObject.GetComponent <CoreEntry>().StartCoroutine(SceneMgr.DelayToInvoke(() => { virtualAction(); })); } else { virtualAction(); } }