protected override void onInit(SceneProcedure lastProcedure, string intent) { // 从待机流程和选择赛道流程跳转过来,正常显示布局 if (!lastProcedure.isThisOrParent(PROCEDURE_TYPE.PT_START_SETTING)) { // 设置摄像机的变换 RoleDisplay roleDisplay = mSceneSystem.getScene <RoleDisplay>(GameDefine.ROLE_DISPLAY); GameCamera mainCamera = mCameraManager.getMainCamera(); if (!lastProcedure.isThisOrParent(PROCEDURE_TYPE.PT_START_SELECT_TRACK)) { mainCamera.copyCamera(roleDisplay.mCameraPositionObject0); LayoutTools.LOAD_NGUI_SHOW(LAYOUT_TYPE.LT_BUTTOM_PROMPT, 9); } else { Transform cameraPos0 = roleDisplay.mCameraTransform0; ObjectTools.MOVE_OBJECT(mainCamera, mainCamera.getPosition(), cameraPos0.localPosition, 0.5f); ObjectTools.ROTATE_OBJECT(mainCamera, mainCamera.getRotation(), cameraPos0.localEulerAngles, 0.5f); } LayoutTools.LOAD_NGUI_SHOW(LAYOUT_TYPE.LT_SELECT_ROLE, 9); } // 从设置流程跳转过来,立即显示布局 else { LayoutTools.LOAD_NGUI_SHOW(LAYOUT_TYPE.LT_BUTTOM_PROMPT, 9); } LayoutTools.LOAD_NGUI_SHOW(LAYOUT_TYPE.LT_RETURN, 0); // 设置当前选中角色 CommandStartSceneSelectRole cmd = newCmd(out cmd); cmd.mIndex = mRoleSystem.getSelectedIndex(); cmd.mPlayAudio = false; pushCommand(cmd, mGameScene); }
protected override void onPrepareExit(SceneProcedure nextProcedure) { base.onPrepareExit(nextProcedure); if (nextProcedure.isThisOrParent(PROCEDURE_TYPE.PT_START_SELECT_ROLE) || nextProcedure.isThisOrParent(PROCEDURE_TYPE.PT_START_SELECT_TRACK)) { LayoutTools.HIDE_LAYOUT(LAYOUT_TYPE.LT_VOLUME_SETTING); } }
// 退出流程 public void exit(SceneProcedure exitTo, SceneProcedure nextPro) { // 中断自己所有未执行的命令 interruptAllCommand(); // 当停止目标为自己时,则不再退出,此时需要判断当前将要进入的流程是否为当前流程的子流程 // 如果是,则需要调用onExitToChild,执行退出当前并且进入子流程的操作 // 如果不是则不需要调用,不需要执行任何退出操作 if (this == exitTo) { if (nextPro != null && nextPro.isThisOrParent(mType)) { onExitToChild(nextPro); onExitSelf(); } return; } // 先退出自己 onExit(nextPro); onExitSelf(); mInited = false; // 再退出父节点 mParentProcedure?.exit(exitTo, nextPro); // 退出完毕后就修改标记 mPrepareTimer.stop(); mPrepareNext = null; mPrepareIntent = null; }
// 退出流程 public void exit(SceneProcedure exitTo, SceneProcedure nextPro) { // 中断自己所有未执行的命令 int count = mDelayCmdList.Count; for (int i = 0; i < count; ++i) { mCommandSystem.interruptCommand(mDelayCmdList[i]); } mDelayCmdList.Clear(); // 当停止目标为自己时,则不再退出,此时需要判断当前将要进入的流程是否为当前流程的子流程 // 如果是,则需要调用onExitToChild,执行退出当前并且进入子流程的操作 // 如果不是则不需要调用,不需要执行任何退出操作 if (this == exitTo) { if (nextPro != null && nextPro.isThisOrParent(mProcedureType)) { onExitToChild(nextPro); onExitSelf(); } return; } // 先退出自己 onExit(nextPro); onExitSelf(); mInited = false; // 再退出父节点 if (mParentProcedure != null) { mParentProcedure.exit(exitTo, nextPro); } }
public bool atProcedure(PROCEDURE_TYPE type) { if (mCurProcedure == null) { return(false); } return(mCurProcedure.isThisOrParent(type)); }
public bool atProcedure(Type type) { if (mCurProcedure == null) { return(false); } return(mCurProcedure.isThisOrParent(type)); }
public bool isThisOrParent(PROCEDURE_TYPE type) { // 判断是否是自己的类型 if (mProcedureType == type) { return(true); } // 判断是否为父节点的类型 if (mParentProcedure != null) { return(mParentProcedure.isThisOrParent(type)); } // 没有父节点,返回false return(false); }
// 由GameScene调用 // 进入流程 public void init(SceneProcedure lastProcedure, string intent) { // 如果父节点还没有初始化,则先初始化父节点 if (mParentProcedure != null && !mParentProcedure.mInited) { mParentProcedure.init(lastProcedure, intent); } // 再初始化自己,如果是从子节点返回到父节点,则需要调用另外一个初始化函数 if (lastProcedure != null && lastProcedure.isThisOrParent(mProcedureType)) { onInitFromChild(lastProcedure, intent); } else { onInit(lastProcedure, intent); } mInited = true; }
protected override void onInit(SceneProcedure lastProcedure, string intent) { if (lastProcedure.isThisOrParent(PROCEDURE_TYPE.PT_START_SETTING)) { LayoutTools.LOAD_NGUI_SHOW(LAYOUT_TYPE.LT_BUTTOM_PROMPT, 0); } LayoutTools.LOAD_NGUI_SHOW(LAYOUT_TYPE.LT_SELECT_TRACK, 0); RoleDisplay roleDisplay = mSceneSystem.getScene <RoleDisplay>(GameDefine.ROLE_DISPLAY); Transform cameraPos1 = roleDisplay.mCameraTransform1; GameCamera mainCamera = mCameraManager.getMainCamera(); ObjectTools.MOVE_OBJECT(mainCamera, mainCamera.getPosition(), cameraPos1.localPosition, 0.5f); ObjectTools.ROTATE_OBJECT(mainCamera, mainCamera.getRotation(), cameraPos1.localEulerAngles, 0.5f); CommandStartSceneSelectTrack cmdTrack = newCmd(out cmdTrack); cmdTrack.mTrack = mRaceSystem.getTrackIndex(); cmdTrack.mPlayAudio = false; pushCommand(cmdTrack, mGameScene); }