Exemplo n.º 1
0
 public bool atSelfProcedure(Type type)
 {
     if (mCurProcedure == null)
     {
         return(false);
     }
     return(mCurProcedure.getProcedureType() == type);
 }
Exemplo n.º 2
0
 // 是否在指定的流程,不考虑子流程
 public bool atSelfProcedure(PROCEDURE_TYPE type)
 {
     if (mCurProcedure == null)
     {
         return(false);
     }
     return(mCurProcedure.getProcedureType() == type);
 }
Exemplo n.º 3
0
 public bool addChildProcedure(SceneProcedure child)
 {
     if (child == null)
     {
         return(false);
     }
     if (mChildProcedureList.ContainsKey(child.getProcedureType()))
     {
         return(false);
     }
     child.setParent(this);
     mChildProcedureList.Add(child.getProcedureType(), child);
     return(true);
 }
Exemplo n.º 4
0
    // 更新流程
    public void update(float elapsedTime)
    {
        // 先更新父节点
        if (mParentProcedure != null)
        {
            mParentProcedure.update(elapsedTime);
        }
        // 再更新自己
        onUpdate(elapsedTime);

        // 正在准备退出流程时,累计时间,
        if (mCurPrepareTime >= 0.0f)
        {
            mCurPrepareTime += elapsedTime;
            if (mCurPrepareTime >= mExitTime)
            {
                mExitTime       = -1.0f;
                mCurPrepareTime = -1.0f;
                // 超过了准备时间,强制跳转流程
                CommandGameSceneChangeProcedure cmd = newCmd(out cmd);
                cmd.mProcedure = mPrepareNext.getProcedureType();
                cmd.mIntent    = mPrepareIntent;
                pushCommand(cmd, mGameScene);
            }
        }
    }
Exemplo n.º 5
0
    public T addProcedure <T>(Type parent = null) where T : SceneProcedure
    {
        SceneProcedure procedure = createProcedure <T>(this);

        if (parent != null)
        {
            SceneProcedure parentProcedure = getProcedure(parent);
            if (parentProcedure == null)
            {
                logError("invalid parent procedure, procedure:" + procedure.getProcedureType());
            }
            parentProcedure.addChildProcedure(procedure);
        }
        mSceneProcedureList.Add(procedure.getProcedureType(), procedure);
        return(procedure as T);
    }
Exemplo n.º 6
0
    public void Update()
    {
        SceneProcedure sceneProcedure = mGameScene.getCurSceneProcedure();

        if (sceneProcedure != null)
        {
            mCurProcedure = sceneProcedure.getProcedureType();
        }
    }
Exemplo n.º 7
0
    public T addProcedure <T>(PROCEDURE_TYPE type, SceneProcedure parent = null) where T : SceneProcedure
    {
        SceneProcedure procedure = createProcedure <T>(this, type);

        if (parent != null)
        {
            parent.addChildProcedure(procedure);
        }
        mSceneProcedureList.Add(procedure.getProcedureType(), procedure);
        return(procedure as T);
    }
Exemplo n.º 8
0
 protected override void onInit(SceneProcedure lastProcedure, string intent)
 {
     LayoutTools.LOAD_NGUI_SHOW(LAYOUT_TYPE.LT_STAND_BY, 1);
     if (lastProcedure.getProcedureType() != PROCEDURE_TYPE.PT_START_SELECT_ROLE)
     {
         mSceneSystem.activeScene(GameDefine.ROLE_DISPLAY);
         mSceneSystem.initScene(GameDefine.ROLE_DISPLAY);
         // 播放背景音乐
         GameTools.PLAY_AUDIO_SCENE(SOUND_DEFINE.SD_MENU_BACKGROUND, true);
     }
 }
Exemplo n.º 9
0
 public SceneProcedure getParent(Type type)
 {
     // 没有父节点,返回null
     if (mParentProcedure == null)
     {
         return(null);
     }
     // 有父节点,则判断类型是否匹配,匹配则返回父节点
     if (mParentProcedure.getProcedureType() == type)
     {
         return(mParentProcedure);
     }
     // 不匹配,则继续向上查找
     return(mParentProcedure.getParent(type));
 }
Exemplo n.º 10
0
 // 更新流程
 public void update(float elapsedTime)
 {
     // 先更新父节点
     mParentProcedure?.update(elapsedTime);
     // 再更新自己
     onUpdate(elapsedTime);
     // 检查准备退出流程
     if (mPrepareTimer.tickTimer(elapsedTime))
     {
         // 超过了准备时间,强制跳转流程
         CommandGameSceneChangeProcedure cmd = newCmd(out cmd);
         cmd.mProcedure = mPrepareNext.getProcedureType();
         cmd.mIntent    = mPrepareIntent;
         pushCommand(cmd, mGameScene);
     }
 }
    public override void execute()
    {
        GameScene gameScene = mReceiver as GameScene;
        // 当流程正在准备跳转流程时,不允许再跳转
        SceneProcedure curProcedure = gameScene.getCurProcedure();

        if (curProcedure != null && curProcedure.isPreparingExit())
        {
            logError("procedure is preparing to change, can not change again!");
            return;
        }
        // 不能重复进入同一流程
        if (curProcedure != null && curProcedure.getProcedureType() == mProcedure)
        {
            return;
        }
        gameScene.changeProcedure(mProcedure, mIntent);
    }
Exemplo n.º 12
0
    public T addProcedure <T>(PROCEDURE_TYPE type, PROCEDURE_TYPE parent = PROCEDURE_TYPE.PT_NONE) where T : SceneProcedure
    {
        SceneProcedure procedure = createProcedure <T>(this, type);

        if (parent != PROCEDURE_TYPE.PT_NONE)
        {
            SceneProcedure parentProcedure = getSceneProcedure(parent);
            if (parentProcedure != null)
            {
                parentProcedure.addChildProcedure(procedure);
            }
            else
            {
                logError("invalid parent procedure, procedure:" + type);
            }
        }
        mSceneProcedureList.Add(procedure.getProcedureType(), procedure);
        return(procedure as T);
    }
    public override void execute()
    {
        GameScene gameScene = mReceiver as GameScene;
        // 当流程正在准备跳转流程时,不允许再跳转
        SceneProcedure curProcedure = gameScene.getCurSceneProcedure();

        if (curProcedure != null && curProcedure.isPreparingExit())
        {
            UnityUtility.logError("procedure is preparing to change, can not change again!");
        }
        else
        {
            if (curProcedure == null || curProcedure.getProcedureType() != mProcedure)
            {
                gameScene.changeProcedure(mProcedure, mIntent);
                if (mFrameLogSystem != null)
                {
                    mFrameLogSystem.logProcedure("进入流程 : " + mProcedure.ToString());
                }
            }
        }
    }