Пример #1
0
        protected void OnProcedureUpdate(ProcedureUpdateData updateData)
        {
            switch (updateData.Type)
            {
            case ProcedureUpdateData.Add:
            {
                CreateProcedureCallerView(updateData.ProcedureInfo, ProcedureDB.HasReturn(updateData.ProcedureDefinitionBlock));
                break;
            }

            case ProcedureUpdateData.Remove:
            {
                DeleteProcedureCallerView(updateData.ProcedureInfo);
                break;
            }

            case ProcedureUpdateData.Mutate:
            {
                //mutate the caller prototype view
                BlockView view = mProcedureCallerViews[updateData.ProcedureInfo.Name];
                if (!updateData.ProcedureInfo.Name.Equals(updateData.NewProcedureInfo.Name))
                {
                    mProcedureCallerViews.Remove(updateData.ProcedureInfo.Name);
                    mProcedureCallerViews[updateData.NewProcedureInfo.Name] = view;
                }

                ((ProcedureMutator)view.Block.Mutator).Mutate(updateData.NewProcedureInfo);
                break;
            }
            }
        }
Пример #2
0
        protected void BuildProcedureBlocks()
        {
            Transform     parent     = mRootList[Define.PROCEDURE_CATEGORY_NAME].transform;
            List <string> blockTypes = mConfig.GetBlockCategory(Define.PROCEDURE_CATEGORY_NAME).BlockList;

            foreach (string blockType in blockTypes)
            {
                if (!blockType.Equals(Define.CALL_NO_RETURN_BLOCK_TYPE) &&
                    !blockType.Equals(Define.CALL_WITH_RETURN_BLOCK_TYPE))
                {
                    NewBlockView(blockType, parent);
                }
            }

            // list all caller views
            foreach (Block block in mWorkspace.ProcedureDB.GetDefinitionBlocks())
            {
                CreateProcedureCallerView(((ProcedureDefinitionMutator)block.Mutator).ProcedureInfo, ProcedureDB.HasReturn(block));
            }
        }