private IEnumerator LoadStory(string storyName) { GM.AssetLoader <GameObject> obj = new GM.AssetLoader <GameObject>(storyName, controller.gameObject); yield return(obj); if (obj != null && obj.Success) { curChapter = obj.Instance.GetMonoILRComponent <LTStoryChapter>(); if (curChapter == null) { OnStoryPlaySuccEvent(); EB.Debug.LogError("LTStroyChapter is Null, StoryName:{0}", storyName); yield break; } curChapter.mDMono.name = storyName; curChapter.blackMask = blackMask; curChapter.talkAni = talkAni; curChapter.talkLab = talkLab; curChapter.talkShadowLab = talkShadowLab; curChapter.skipObj = skipObj; curChapter.mDMono.transform.SetParent(controller.transform); curChapter.mDMono.transform.localPosition = Vector3.zero; curChapter.mDMono.transform.localEulerAngles = Vector3.zero; curChapter.mDMono.transform.localScale = Vector3.one; curChapter.panel.depth = panel.depth + 1; curChapter.panel.sortingOrder = panel.sortingOrder + 1; SetTextureAll(); yield return(null); curChapter.PlayAni(); } else { OnStoryPlaySuccEvent(); EB.Debug.LogError("LTStroy is Null, StoryName:{0}", storyName); } }
private void OnStoryPlaySuccEvent() { if (curChapter != null) { curChapter.StopBgm(); } if (mStoryAction != null) { if (curChapter != null) { string name = curChapter.mDMono.name; curChapter.mDMono.gameObject.CustomSetActive(false); skipObj.CustomSetActive(false); Object.Destroy(curChapter.mDMono.gameObject); EB.Assets.UnloadAssetByName(curChapter.mDMono.name, true); curChapter = null; } mStoryAction(); return; } if (StoryAction != null) { StoryAction(); StoryAction = null; } if (curChapter != null) { Object.Destroy(curChapter.mDMono.gameObject); EB.Assets.UnloadAssetByName(curChapter.mDMono.name, true); curChapter = null; } UnloadAsset(); controller.Close(); }