public override void OnInspectorGUI()
    {
        Script_SpriteStudio_DrawManagerView Data = (Script_SpriteStudio_DrawManagerView)target;

        EditorGUILayout.LabelField("[SpriteStudio DrawManager]");
        int LevelIndent = 0;

        EditorGUILayout.Space();
        FoldOutDrawSetting = EditorGUILayout.Foldout(FoldOutDrawSetting, "Rendering Setting");
        if (true == FoldOutDrawSetting)
        {
            EditorGUI.indentLevel = LevelIndent + 1;

            int   CountKindQueue = (int)Library_SpriteStudio.DrawManager.KindDrawQueue.OVERLAY + 1;
            int[] IndexDrawKind  = new int[CountKindQueue];
            for (int i = 0; i < CountKindQueue; i++)
            {
                IndexDrawKind[i] = i;
            }
            int KindRenderQueueBaseNo = (int)Data.KindRenderQueueBase;
            KindRenderQueueBaseNo    = EditorGUILayout.IntPopup("Render-Queue Base", KindRenderQueueBaseNo, NameDrawKind, IndexDrawKind);
            Data.KindRenderQueueBase = (Library_SpriteStudio.DrawManager.KindDrawQueue)KindRenderQueueBaseNo;
            EditorGUI.indentLevel    = LevelIndent + 2;
            EditorGUILayout.LabelField("Details [" + NameDrawKind[KindRenderQueueBaseNo] + "]");
            switch ((Library_SpriteStudio.DrawManager.KindDrawQueue)KindRenderQueueBaseNo)
            {
            case Library_SpriteStudio.DrawManager.KindDrawQueue.SHADER_SETTING:
                EditorGUILayout.LabelField("- Value Base: Defined Tag\"Queue\" in Shader (Default: Transparent)");
                EditorGUILayout.LabelField("- Offset Range: Depend on Tag\"Queue\"(Default: 0-999)");
                break;

            case Library_SpriteStudio.DrawManager.KindDrawQueue.USER_SETTING:
                EditorGUILayout.LabelField("- Value Base: 0");
                EditorGUILayout.LabelField("- Offset Range: 1000-4999");
                break;

            default:
                EditorGUILayout.LabelField("- Value Base: " + Library_SpriteStudio.DrawManager.ValueKindDrawQueue[KindRenderQueueBaseNo]);
                EditorGUILayout.LabelField("- Offset Range: 0-" + (Library_SpriteStudio.DrawManager.ValueKindDrawQueue[KindRenderQueueBaseNo + 1] - Library_SpriteStudio.DrawManager.ValueKindDrawQueue[KindRenderQueueBaseNo] - 1));
                break;
            }
            EditorGUI.indentLevel = LevelIndent + 1;

            EditorGUILayout.Space();
            Data.OffsetDrawQueue = EditorGUILayout.IntField("Render-Queue Offset", Data.OffsetDrawQueue);

            EditorGUI.indentLevel = LevelIndent;
        }
        EditorGUILayout.Space();

        if (true == GUI.changed)
        {
            Library_SpriteStudio.DrawManager.ArrayListMeshDraw ArrayListMeshDraw = Data.ArrayListMeshDraw;
            ArrayListMeshDraw.RenderQueueSet(Data.KindRenderQueueBase, Data.OffsetDrawQueue);
            EditorUtility.SetDirty(target);
        }
    }
Esempio n. 2
0
    /* Functions */
    void Start()
    {
        InstanceCameraDraw = Library_SpriteStudio.Utility.CameraGetParent(gameObject);

        DrawEntryPartsRoot = new ArrayList();
        DrawEntryPartsRoot.Clear();

        arrayListMeshDraw = new Library_SpriteStudio.DrawManager.ArrayListMeshDraw();
        arrayListMeshDraw.BootUp();
        arrayListMeshDraw.RenderQueueSet(KindRenderQueueBase, OffsetDrawQueue);
    }
Esempio n. 3
0
    /* ******************************************************** */
    //! Set "Render-Queue"

    /*!
     * @param	Kind
     *      "Render-Queue Base"<br>
     *      Library_SpriteStudio.DrawManager.KindDrawQueue.NON == use the settings in the Inspector.
     * @param	Offset
     *      "Render-Queue Offset"<br>
     *      -1 == use the settings in the Inspector.
     * @retval	Return-Value
     *      (None)
     *
     * Set to own "Render-Queue".<br>
     * You must set "-1" to "Offset", when you set "Library_SpriteStudio.DrawManager.KindDrawQueue.NON" to "Kind".
     */
    public void RenderQueueSet(Library_SpriteStudio.DrawManager.KindDrawQueue Kind = Library_SpriteStudio.DrawManager.KindDrawQueue.NON, int Offset = -1)
    {
        if (Library_SpriteStudio.DrawManager.KindDrawQueue.NON == Kind)
        {
            Kind   = KindRenderQueueBase;
            Offset = OffsetDrawQueue;
        }
        if (-1 == OffsetDrawQueue)
        {               /* Error */
            Offset = OffsetDrawQueue;
        }
        if (null != arrayListMeshDraw)
        {
            arrayListMeshDraw.RenderQueueSet(Kind, Offset);
        }
    }
Esempio n. 4
0
    /* Functions */
    void Start()
    {
        InstanceCameraDraw = Library_SpriteStudio.Utility.CameraGetParent(gameObject);

#if false
        /* MEMO: Non-Generic List-Class */
        DrawEntryPartsRoot = new ArrayList();
        DrawEntryPartsRoot.Clear();
#else
        DrawEntryPartsRoot = new List <InformationDrawObject>();
        DrawEntryPartsRoot.Clear();
#endif

        arrayListMeshDraw = new Library_SpriteStudio.DrawManager.ArrayListMeshDraw();
        arrayListMeshDraw.BootUp();
        arrayListMeshDraw.RenderQueueSet(KindRenderQueueBase, OffsetDrawQueue);
    }
Esempio n. 5
0
    void LateUpdate()
    {
        /* Clear Finalize ListDrawMesh */
        if (null == arrayListMeshDraw)
        {
            arrayListMeshDraw = new Library_SpriteStudio.DrawManager.ArrayListMeshDraw();
            arrayListMeshDraw.BootUp();
            arrayListMeshDraw.RenderQueueSet(KindRenderQueueBase, OffsetDrawQueue);
        }
        arrayListMeshDraw.Clear();

        /* Collect Draw-Parts from Root-Parts */
        InformationDrawObject DrawObject = null;

        Library_SpriteStudio.DrawManager.ArrayListMeshDraw ArrayListMeshDrawObject = null;
        Library_SpriteStudio.DrawManager.ListMeshDraw      ListMeshDraw            = null;
        int Count = DrawEntryPartsRoot.Count;

        for (int i = 0; i < Count; i++)
        {
#if false
            /* MEMO: Non-Generic List-Class */
            DrawObject = DrawEntryPartsRoot[i] as InformationDrawObject;
#else
            DrawObject = DrawEntryPartsRoot[i];
#endif
            ArrayListMeshDrawObject = DrawObject.PartsRoot.ArrayListMeshDraw;
            int CountList = ArrayListMeshDrawObject.TableListMesh.Count;
            for (int j = 0; j < CountList; j++)
            {
                /* Add Mesh-List */
#if false
                /* MEMO: Non-Generic List-Class */
                ListMeshDraw = ArrayListMeshDrawObject.TableListMesh[j] as Library_SpriteStudio.DrawManager.ListMeshDraw;
#else
                ListMeshDraw = ArrayListMeshDrawObject.TableListMesh[j];
#endif
                arrayListMeshDraw.TableListMesh.Add(ListMeshDraw);
            }

            /* Clear Original Draw-List */
            DrawObject.PartsRoot.DrawListClear();
        }
        DrawEntryPartsRoot.Clear();

        /* Collect & Add Draw-Parts "Instance"-Object's Parts */
        Library_SpriteStudio.DrawManager.InformationMeshData InformationMeshData = null;
        Script_SpriteStudio_PartsRoot ScriptPartsRootSub = null;
        for (int i = 0; i < arrayListMeshDraw.TableListMesh.Count;)
        {
#if false
            /* MEMO: Non-Generic List-Class */
            ListMeshDraw = arrayListMeshDraw.TableListMesh[i] as Library_SpriteStudio.DrawManager.ListMeshDraw;
#else
            ListMeshDraw = arrayListMeshDraw.TableListMesh[i];
#endif
            if (null == ListMeshDraw)
            {
                arrayListMeshDraw.TableListMesh.RemoveAt(i);
                continue;
            }
            InformationMeshData = ListMeshDraw.MeshDataTop;
            if (null != InformationMeshData.PartsInstance)
            {
                Library_SpriteStudio.DrawManager.ListMeshDraw ListMeshDrawSub = null;
                ScriptPartsRootSub = InformationMeshData.PartsInstance.ScriptPartsRootSub;
                if (null != ScriptPartsRootSub)
                {                       /* Add Mesh-Table */
                                        /* Delete "Instance"-Data */
                    arrayListMeshDraw.TableListMesh.RemoveAt(i);

                    /* Insert "Instance"-Data's Draw-Mesh-List */
                    ArrayListMeshDrawObject = ScriptPartsRootSub.ArrayListMeshDraw;
                    for (int j = 0; j < ArrayListMeshDrawObject.TableListMesh.Count; j++)
                    {
#if false
                        /* MEMO: Non-Generic List-Class */
                        ListMeshDrawSub = ArrayListMeshDrawObject.TableListMesh[j] as Library_SpriteStudio.DrawManager.ListMeshDraw;
#else
                        ListMeshDrawSub = ArrayListMeshDrawObject.TableListMesh[j];
#endif
                        arrayListMeshDraw.TableListMesh.Insert((i + j), ListMeshDrawSub);
                    }

                    /* Clear Original Draw-List */
                    ScriptPartsRootSub.DrawListClear();
                    continue;
                }
            }
            i++;
        }

        /* Optimize Draw-Parts List */
        Library_SpriteStudio.DrawManager.ListMeshDraw ListMeshDrawNext = null;
#if false
        /* MEMO: Non-Generic List-Class */
        ArrayList TableListMesh = arrayListMeshDraw.TableListMesh;
#else
        List <Library_SpriteStudio.DrawManager.ListMeshDraw> TableListMesh = arrayListMeshDraw.TableListMesh;
#endif
        for (int i = 0; i < (TableListMesh.Count - 1);)
        {
            Count = i + 1;              /* "Count" is temporary */
#if false
            /* MEMO: Non-Generic List-Class */
            ListMeshDraw     = TableListMesh[i] as Library_SpriteStudio.DrawManager.ListMeshDraw;
            ListMeshDrawNext = TableListMesh[Count] as Library_SpriteStudio.DrawManager.ListMeshDraw;
#else
            ListMeshDraw     = TableListMesh[i];
            ListMeshDrawNext = TableListMesh[Count];
#endif
            if (ListMeshDraw.MaterialOriginal == ListMeshDrawNext.MaterialOriginal)
            {
                /* Mesh-List Merge */
                ListMeshDraw.ListMerge(ListMeshDrawNext);
                TableListMesh.RemoveAt(Count);

                /* Counter No-Incliment Continue */
                continue;
            }
            i++;
        }

        /* Counting Meshes */
        TableListMesh = arrayListMeshDraw.TableListMesh;
        Count         = TableListMesh.Count;
        int CountMesh = 0;
        for (int i = 0; i < Count; i++)
        {
#if false
            /* MEMO: Non-Generic List-Class */
            ListMeshDraw = TableListMesh[i] as Library_SpriteStudio.DrawManager.ListMeshDraw;
#else
            ListMeshDraw = TableListMesh[i];
#endif
            CountMesh += ListMeshDraw.Count;
        }

        /* Meshes Combine each Material & Set to MeshFilter/MeshRenderer */
        MeshFilter   InstanceMeshFilter   = GetComponent <MeshFilter>();
        MeshRenderer InstanceMeshRenderer = GetComponent <MeshRenderer>();
        arrayListMeshDraw.MeshSetCombine(InstanceMeshFilter, InstanceMeshRenderer, InstanceCameraDraw, transform);
    }