Exemplo n.º 1
0
        public EAnalyzeStageStatus Init(AnalyzeWrap wrap, ShaderAnalyzeParams param)
        {
            m_AnalyzeWrap = wrap;
            m_Params      = param;

            int amount = init(wrap, param);
            EAnalyzeStageStatus status = EAnalyzeStageStatus.Success;

            switch (amount)
            {
            case InitComplete:
                status = EAnalyzeStageStatus.Complete;
                break;

            case InitUnknown:
                status = EAnalyzeStageStatus.Success;
                break;

            case InitError:
                status = EAnalyzeStageStatus.Error;
                break;

            case InitFinish:
                status = EAnalyzeStageStatus.Finish;
                break;

            default:
                status = EAnalyzeStageStatus.Success;
                Amount = amount;
                break;
            }

            return(status);
        }
Exemplo n.º 2
0
        public EAnalyzeStageStatus Execute()
        {
            int index = 0;

            while (index < CountPerFrame && CurrentIndex < Amount)
            {
                EAnalyzeStageStatus status = execute(CurrentIndex);
                if (status == EAnalyzeStageStatus.Error)
                {
                    return(EAnalyzeStageStatus.Error);
                }
                else if (status == EAnalyzeStageStatus.Finish)
                {
                    return(EAnalyzeStageStatus.Finish);
                }
                else if (status == EAnalyzeStageStatus.Complete)
                {
                    return(EAnalyzeStageStatus.Complete);
                }
                CurrentIndex++;
                index++;
            }

            return(CurrentIndex == Amount ? EAnalyzeStageStatus.Finish : EAnalyzeStageStatus.Success);
        }
Exemplo n.º 3
0
        private void executeNext()
        {
            if (m_CurrentStage != null)
            {
                m_CurrentStage.Clear();
            }

            m_CurrentStageType = m_CurrentStageType + 1;

            if (m_CurrentStageType > EAnalyzeStageType.EndAnalyze)
            {
                m_AnalyzeFinish?.Invoke(m_AnalyzeWrap.AnalyzedData);
                Clear();
                return;
            }

            EditorUtility.DisplayProgressBar(m_CurrentStageType.ToString(), m_CurrentStageType.ToString(), (float)m_CurrentStageType / (float)EAnalyzeStageType.EndAnalyze);

            m_CurrentStage = getAnalyzeStage(m_CurrentStageType, m_Params.Vendor);
            if (m_CurrentStage == null)
            {
                Debug.LogErrorFormat("未能找到{0}阶段", m_CurrentStageType.ToString());
                Clear();
                return;
            }
            EAnalyzeStageStatus status = m_CurrentStage.Init(m_AnalyzeWrap, m_Params);

            handleStageStatus(status);
        }
        protected override EAnalyzeStageStatus execute(int index)
        {
            EAnalyzeStageStatus status = EAnalyzeStageStatus.Success;

            switch (m_BridgeResult)
            {
            case EBridgeResult.CantFoundBridgeError:
                status = EAnalyzeStageStatus.Error;
                break;

            case EBridgeResult.Finish:
                status = EAnalyzeStageStatus.Finish;
                break;
            }

            return(status);
        }
Exemplo n.º 5
0
        private void handleStageStatus(EAnalyzeStageStatus status)
        {
            switch (status)
            {
            case EAnalyzeStageStatus.Error:
                //TODO 处理错误
                break;

            case EAnalyzeStageStatus.Finish:
                executeNext();
                break;

            case EAnalyzeStageStatus.Complete:
                m_CurrentStageType = EAnalyzeStageType.EndAnalyze;
                executeNext();
                break;
            }
        }
Exemplo n.º 6
0
        private void update()
        {
            EAnalyzeStageStatus status = m_CurrentStage.Execute();

            handleStageStatus(status);
        }