Beispiel #1
0
 public bool changeProcedure(PROCEDURE_TYPE procedure, string intent)
 {
     if (mSceneProcedureList.ContainsKey(procedure))
     {
         // 将上一个流程记录到返回列表中
         if (mCurProcedure != null)
         {
             mLastProcedureList.Add(mCurProcedure.getType());
         }
         if (mCurProcedure == null || mCurProcedure.getType() != procedure)
         {
             SceneProcedure targetProcedure = mSceneProcedureList[procedure];
             // 如果当前已经在一个流程中了,则要先退出当前流程,但是不要销毁流程
             if (mCurProcedure != null)
             {
                 // 需要找到共同的父节点,退到该父节点时则不再退出
                 SceneProcedure exitTo  = mCurProcedure.getSameParent(targetProcedure);
                 SceneProcedure nextPro = targetProcedure;
                 mCurProcedure.exit(exitTo, nextPro);
             }
             SceneProcedure lastProcedure = mCurProcedure;
             mCurProcedure = targetProcedure;
             if (mCurProcedure != null)
             {
                 mCurProcedure.init(lastProcedure, intent);
             }
         }
         return(true);
     }
     else
     {
         UnityUtility.logError("error : can not find scene procedure : " + procedure);
     }
     return(false);
 }
Beispiel #2
0
    // 退出场景
    public virtual void exit()
    {
        // 首先进入退出流程,然后再退出最后的流程
        CommandGameSceneChangeProcedure cmd = newCmd(out cmd);

        cmd.mProcedure = mExitProcedure;
        pushCommand(cmd, this);
        if (mCurProcedure != null)
        {
            mCurProcedure.exit(null, null);
            mCurProcedure = null;
        }
    }
Beispiel #3
0
 // 退出流程
 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;
 }
Beispiel #4
0
 public bool changeProcedure(Type procedureType, string intent, bool addToLastList = true)
 {
     if (!mSceneProcedureList.TryGetValue(procedureType, out SceneProcedure targetProcedure))
     {
         logError("can not find scene procedure : " + procedureType);
         return(false);
     }
     // 将上一个流程记录到返回列表中
     if (mCurProcedure != null && addToLastList)
     {
         mLastProcedureList.Add(mCurProcedure);
         if (mLastProcedureList.Count > mMaxLastProcedureCount)
         {
             mLastProcedureList.RemoveAt(0);
         }
     }
     if (mCurProcedure == null || mCurProcedure.getType() != procedureType)
     {
         // 如果当前已经在一个流程中了,则要先退出当前流程,但是不要销毁流程
         if (mCurProcedure != null)
         {
             // 需要找到共同的父节点,退到该父节点时则不再退出
             mCurProcedure.exit(mCurProcedure.getSameParent(targetProcedure), targetProcedure);
         }
         SceneProcedure lastProcedure = mCurProcedure;
         mCurProcedure = targetProcedure;
         mCurProcedure.init(lastProcedure, intent);
     }
     return(true);
 }
Beispiel #5
0
    // 退出流程
    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);
        }
    }
Beispiel #6
0
 // 退出场景
 public virtual void exit()
 {
     // 首先进入退出流程,然后再退出最后的流程
     CMD(out CommandGameSceneChangeProcedure cmd);
     cmd.mProcedure = mExitProcedure;
     pushCommand(cmd, this);
     mCurProcedure?.exit(null, null);
     mCurProcedure = null;
     Resources.UnloadUnusedAssets();
     GC.Collect();
 }
Beispiel #7
0
    // 退出流程
    public void exit(SceneProcedure exitTo, SceneProcedure nextPro)
    {
        // 中断自己所有未执行的命令
        foreach (var cmd in mDelayCmdList)
        {
            mCommandSystem.interruptCommand(cmd.Key);
        }
        mDelayCmdList.Clear();

        // 当停止目标为自己时,则不再退出
        if (this == exitTo)
        {
            return;
        }
        // 先退出自己
        onExit(nextPro);
        mInited = false;
        // 再退出父节点
        if (mParentProcedure != null)
        {
            mParentProcedure.exit(exitTo, nextPro);
        }
    }
Beispiel #8
0
 public bool changeProcedure(Type procedure, string intent, bool addToLastList = true)
 {
     if (mSceneProcedureList.ContainsKey(procedure))
     {
         // 将上一个流程记录到返回列表中
         if (mCurProcedure != null && addToLastList)
         {
             mLastProcedureList.Add(mCurProcedure);
             if (mLastProcedureList.Count > mMaxLastProcedureCount)
             {
                 mLastProcedureList.RemoveAt(0);
             }
         }
         if (mCurProcedure == null || mCurProcedure.getProcedureType() != procedure)
         {
             SceneProcedure targetProcedure = mSceneProcedureList[procedure];
             // 如果当前已经在一个流程中了,则要先退出当前流程,但是不要销毁流程
             if (mCurProcedure != null)
             {
                 // 需要找到共同的父节点,退到该父节点时则不再退出
                 SceneProcedure exitTo  = mCurProcedure.getSameParent(targetProcedure);
                 SceneProcedure nextPro = targetProcedure;
                 mCurProcedure.exit(exitTo, nextPro);
             }
             SceneProcedure lastProcedure = mCurProcedure;
             mCurProcedure = targetProcedure;
             mCurProcedure.init(lastProcedure, intent);
         }
         return(true);
     }
     else
     {
         logError("can not find scene procedure : " + procedure);
     }
     return(false);
 }