/// <summary> /// 下一个事件 /// </summary> void MoveNextEvent(Vector2 currPos) { if (events.Count == 0) { if (execOK != null) { execOK(currPos); } return; } var evData = events.Dequeue(); if (evData == null) { MoveNextEvent(currPos); return; } GLogger.Yellow("MoveNext evType:" + evData.type); var currEvent = sceneEvents[evData.type]; if (currEvent != null) { if (evData.type == EventsType.MoveNpc || evData.type == EventsType.MoveCamera) { currEvent.OnExecute(currPos, evData.value, () => MoveNextEvent(currPos)); } else { currEvent.OnExecute(evData.value, () => MoveNextEvent(currPos)); } } }
/// <summary> /// 下一个事件 /// </summary> void MoveNextEvent(Vector2 currPos) { if (events.Count == 0) { if (execOK != null) { execOK(currPos); } return; } var evData = events.Dequeue(); if (evData == null) { MoveNextEvent(currPos); return; } GLogger.Yellow("MoveNext evType:" + evData.type); switch (evData.type) { case EventsType.SpawnHeroNpc: OnEvSpawnHeroNpc(() => MoveNextEvent(currPos)); break; case EventsType.SpawnTeamNpc: OnEvSpawnTeamNpc(evData.value, () => MoveNextEvent(currPos)); break; case EventsType.Dungeon: OnEvDungeon(evData.value, () => MoveNextEvent(currPos)); break; case EventsType.Dialog: OnEvDialog(evData.value, () => MoveNextEvent(currPos)); break; case EventsType.MoveCamera: OnEvMoveCamera(currPos, evData.value, () => MoveNextEvent(currPos)); break; case EventsType.MoveNpc: OnEvMoveNpc(currPos, evData.value, () => MoveNextEvent(currPos)); break; case EventsType.LoadScene: OnEvLoadScene(evData.value, () => MoveNextEvent(currPos)); break; case EventsType.StartFight: OnEvStartFight(evData.value, () => MoveNextEvent(currPos)); break; } }
/// <summary> /// 当载入关卡 /// </summary> static IEnumerator OnLoadLevel(LevelType levelType, LuaTable self, LuaFunction onLeave, LuaFunction onEnter) { Scene scene = SceneManager.GetActiveScene(); var levelName = scene.name.FirstCharToUpper(); LevelType currLevel = (LevelType)Enum.Parse(typeof(LevelType), levelName); var op = SceneManager.LoadSceneAsync(levelType.ToString()); yield return(op); yield return(new WaitForSeconds(0.1f)); if (LevelType.Loader == levelType) { if (onLeave != null) { onLeave.Call <LuaTable, LevelType, Action>(self, currLevel, delegate() { Util.StartCoroutine(OnLoadLevel(newLevel, self, onLeave, onEnter)); }); onLeave.Dispose(); onLeave = null; } } else { if (onEnter != null) { var loadMsg = "OnLoadLevel " + levelType + " OK!!!"; onEnter.Call <LuaTable, LevelType, Action>(self, levelType, () => GLogger.Yellow(loadMsg)); onEnter.Dispose(); onEnter = null; self.Dispose(); self = null; } } }
public void Initialize(Vector2 pos) { currPos = pos; GLogger.Yellow("Initialize Battle Pos====================:>>" + pos); embattlePosMgr.Initialize(pos); }
/// <summary> /// 当载入关卡 /// </summary> static IEnumerator OnLoadLevel(LevelType levelType, LuaTable self, LuaFunction onLeave, LuaFunction onEnter) { int levelid = (int)levelType; var op = SceneManager.LoadSceneAsync(levelid); yield return(op); yield return(new WaitForSeconds(0.1f)); if (LevelType.Loader == levelType) { if (onLeave != null) { onLeave.Call <LuaTable, LevelType, Action>(self, levelType, (Action) delegate() { Util.StartCoroutine(OnLoadLevel(newLevel, self, onLeave, onEnter)); }); onLeave.Dispose(); onLeave = null; } } else { if (onEnter != null) { var loadMsg = "OnLoadLevel " + levelType + " OK!!!"; onEnter.Call <LuaTable, LevelType, Action>(self, levelType, () => GLogger.Yellow(loadMsg)); onEnter.Dispose(); onEnter = null; self.Dispose(); self = null; } } }