/* ******************************************************** */
    //! Registration of calling-back of "User-Data"

    /*!
     * @param	PartsName
     *      Name of animation-part
     * @param	AnimationDataParts
     *      control data for animation-part
     * @param	FrameNoData
     *      Frame-No, "User-Data" is arranged
     * @param	Data
     *      Instance "User-Data"
     * @retval	Return-Value
     *      (None)
     *
     * Don't use this function. <br>
     * (This function is for the animation-parts' scripts.)
     */
    public void CallBackExecUserData(string PartsName, Library_SpriteStudio.AnimationData AnimationDataParts, int FrameNoData, Library_SpriteStudio.KeyFrame.ValueUser Data)
    {
        if (null == ListCallBackUserData)
        {
            ListCallBackUserData = new ArrayList();
            ListCallBackUserData.Clear();
        }

        ParameterCallBackUserData Parameter = new ParameterCallBackUserData();

        Parameter.PartsName          = string.Copy(PartsName);
        Parameter.AnimationDataParts = AnimationDataParts;
        Parameter.FrameNo            = FrameNoData;
        Parameter.Data = Data;
        ListCallBackUserData.Add(Parameter);
    }
Exemplo n.º 2
0
    void LateUpdate()
    {
        /* Excute "UserData CallBack" */
        if ((null != ListCallBackUserData) && (null != functionUserData))
        {
            int Count = ListCallBackUserData.Count;
            ParameterCallBackUserData Parameter = null;
            for (int i = 0; i < Count; i++)
            {
                Parameter = ListCallBackUserData[i] as ParameterCallBackUserData;
                functionUserData(transform.parent.gameObject,
                                 Parameter.PartsName,
                                 Parameter.AnimationDataParts,
                                 AnimationNo,
                                 frameNoNow,
                                 Parameter.FrameNo,
                                 Parameter.Data,
                                 Parameter.FlagWayBack
                                 );
            }
            ListCallBackUserData.Clear();
        }

        /* Excute "Play-End CallBack" */
        if (0 != (Status & BitStatus.REQUEST_PLAYEND))
        {
            Status = BitStatus.CLEAR;
            if (null != functionPlayEnd)
            {
                if (null == InstanceGameObjectControl)
                {                       /* has no Control-Node */
                    if (false == functionPlayEnd(gameObject))
                    {
                        Object.Destroy(gameObject);
                    }
                }
                else
                {                       /* has Control-Node */
                    if (false == functionPlayEnd(InstanceGameObjectControl))
                    {
                        Object.Destroy(InstanceGameObjectControl);
                    }
                }
            }
        }
    }
Exemplo n.º 3
0
    /* ******************************************************** */
    //! Registration of calling-back of "User-Data"

    /*!
     * @param	PartsName
     *      Name of animation-part
     * @param	AnimationDataParts
     *      control data for animation-part
     * @param	FrameNoData
     *      Frame-No, "User-Data" is arranged
     * @param	Data
     *      Instance "User-Data"
     * @retval	Return-Value
     *      (None)
     *
     * Don't use this function. <br>
     * (This function is for the animation-parts' scripts.)
     */
    internal void CallBackExecUserData(string PartsName, Library_SpriteStudio.AnimationData AnimationDataParts, int FrameNoData, Library_SpriteStudio.KeyFrame.ValueUser.Data Data, bool FlagWayBack)
    {
        if (null == ListCallBackUserData)
        {
            ListCallBackUserData = new ArrayList();
            ListCallBackUserData.Clear();
        }

        ParameterCallBackUserData Parameter = new ParameterCallBackUserData();

        Parameter.PartsName          = string.Copy(PartsName);
        Parameter.AnimationDataParts = AnimationDataParts;
        Parameter.FrameNo            = FrameNoData;
        Parameter.FlagWayBack        = FlagWayBack;
        Parameter.Data = Data;
        ListCallBackUserData.Add(Parameter);

//		Debug.Log("SS5PU CallBack: FrameNo[" + frameNoPrevious + "-" + frameNoNow + "] (" + CountLoopThisTime + ") : " + Data.NumberInt + " ["+ FlagWayBack.ToString() + "]");
    }
    /* ******************************************************** */
    //! Registration of calling-back of "User-Data"
    /*!
    @param	PartsName
        Name of animation-part
    @param	AnimationDataParts
        control data for animation-part
    @param	FrameNoData
        Frame-No, "User-Data" is arranged
    @param	Data
        Instance "User-Data"
    @retval	Return-Value
        (None)

    Don't use this function. <br>
    (This function is for the animation-parts' scripts.)
    */
    public void CallBackExecUserData(string PartsName, Library_SpriteStudio.AnimationData AnimationDataParts, int FrameNoData, Library_SpriteStudio.KeyFrame.ValueUser Data)
    {
        if(null == ListCallBackUserData)
        {
            ListCallBackUserData = new ArrayList();
            ListCallBackUserData.Clear();
        }

        ParameterCallBackUserData Parameter = new ParameterCallBackUserData();
        Parameter.PartsName = string.Copy(PartsName);
        Parameter.AnimationDataParts = AnimationDataParts;
        Parameter.FrameNo = FrameNoData;
        Parameter.Data = Data;
        ListCallBackUserData.Add(Parameter);
    }
    protected void AppendExecLateUpdate()
    {
        /* Execute Simplified-SpriteDrawManager */
        int          Count = 0;
        MeshFilter   InstanceMeshFilter   = GetComponent <MeshFilter>();
        MeshRenderer InstanceMeshRenderer = GetComponent <MeshRenderer>();

        if (null != TableListMesh)
        {
            ListMeshDraw ListMesh = null;
            Count = TableListMesh.Count;

            int        CountMesh           = 0;
            Material[] MaterialTable       = new Material[Count];
            int        ValueRenderQueue    = ValueKindDrawQueue[(int)KindRenderQueueBase];
            int        MaterialRenderQueue = 0;

            if (null == InstanceCameraDraw)
            {                   /* Camera is lost ? */
                CameraGetRendering();
            }
            int ZOffset = 0;
            if (null != InstanceCameraDraw)
            {
                Vector3 PositionViewPort = (null != InstanceCameraDraw) ? InstanceCameraDraw.WorldToViewportPoint(transform.position) : Vector3.zero;
                float   RateLinerZ       = 1.0f - ((PositionViewPort.z - InstanceCameraDraw.nearClipPlane) / (InstanceCameraDraw.farClipPlane - InstanceCameraDraw.nearClipPlane));
                ZOffset = ((0.0f > RateLinerZ) || (1.0f < RateLinerZ)) ? -1 : (int)(RateLinerZ * RateDrawQueueEffectZ);
            }
            if (-1 == ZOffset)
            {                   /* out of sight (Clipping) */
                InstanceMeshRenderer.enabled = false;
            }
            else
            {                   /* in sight */
                InstanceMeshRenderer.enabled = true;
                for (int i = 0; i < Count; i++)
                {
                    ListMesh   = TableListMesh[i] as ListMeshDraw;
                    CountMesh += ListMesh.Count;

                    MaterialTable[i]             = new Material(TableMaterial[ListMesh.MaterialNo]);
                    MaterialRenderQueue          = (-1 == ValueRenderQueue) ? MaterialTable[i].shader.renderQueue : ValueRenderQueue;
                    MaterialRenderQueue         += (OffsetDrawQueue + ZOffset + i);
                    MaterialTable[i].renderQueue = MaterialRenderQueue;
                }

                Material[] TableMaterialOld = InstanceMeshRenderer.sharedMaterials;
                InstanceMeshRenderer.sharedMaterials = MaterialTable;
                for (int i = 0; i < TableMaterialOld.Length; i++)
                {
                    Object.DestroyImmediate(TableMaterialOld[i]);
                }

                int                 IndexVertexNow      = 0;
                int                 IndexTriangleNow    = 0;
                int[]               IndexVertex         = new int[Count];
                int[]               IndexTriangle       = new int[Count + 1];
                CombineInstance[]   CombineMesh         = new CombineInstance[CountMesh];
                InformationMeshData DataMeshInformation = null;
                CountMesh = 0;
                for (int i = 0; i < Count; i++)
                {
                    ListMesh            = TableListMesh[i] as ListMeshDraw;
                    IndexVertex[i]      = IndexVertexNow;
                    IndexTriangle[i]    = IndexTriangleNow;
                    DataMeshInformation = ListMesh.MeshDataTop;
                    Matrix4x4 MatrixCorrect = transform.localToWorldMatrix.inverse;
                    while (null != DataMeshInformation)
                    {
                        CombineMesh[CountMesh].mesh      = DataMeshInformation.DataMesh;
                        CombineMesh[CountMesh].transform = MatrixCorrect * DataMeshInformation.DataTransform.localToWorldMatrix;
                        CountMesh++;
                        IndexVertexNow     += DataMeshInformation.DataMesh.vertexCount;
                        IndexTriangleNow   += DataMeshInformation.DataMesh.triangles.Length / 3;
                        DataMeshInformation = DataMeshInformation.ChainNext;
                    }
                }
                IndexTriangle[Count] = IndexTriangleNow;
                Mesh MeshNew = new Mesh();
                MeshNew.CombineMeshes(CombineMesh);

                int[] TriangleBuffer   = MeshNew.triangles;
                int[] VertexNoTriangle = null;
                MeshNew.triangles    = null;
                MeshNew.subMeshCount = Count;
                for (int i = 0; i < Count; i++)
                {
                    CountMesh        = IndexTriangle[i + 1] - IndexTriangle[i];
                    VertexNoTriangle = new int[CountMesh * 3];
                    for (int j = 0; j < CountMesh; j++)
                    {
                        IndexTriangleNow = (j + IndexTriangle[i]) * 3;
                        IndexVertexNow   = j * 3;

                        VertexNoTriangle[IndexVertexNow]     = TriangleBuffer[IndexTriangleNow];
                        VertexNoTriangle[IndexVertexNow + 1] = TriangleBuffer[IndexTriangleNow + 1];
                        VertexNoTriangle[IndexVertexNow + 2] = TriangleBuffer[IndexTriangleNow + 2];
                    }
                    MeshNew.SetTriangles(VertexNoTriangle, i);
                }

                if (null != InstanceMeshFilter.sharedMesh)
                {
                    InstanceMeshFilter.sharedMesh.Clear();
                    Object.DestroyImmediate(InstanceMeshFilter.sharedMesh);
                }
                InstanceMeshFilter.sharedMesh = MeshNew;
            }
            TableListMesh.Clear();
        }

        /* Excute "UserData CallBack" */
        if ((null != ListCallBackUserData) && (null != functionUserData))
        {
            Count = ListCallBackUserData.Count;
            ParameterCallBackUserData Parameter = null;
            for (int i = 0; i < Count; i++)
            {
                Parameter = ListCallBackUserData[i] as ParameterCallBackUserData;
                functionUserData(transform.parent.gameObject,
                                 Parameter.PartsName,
                                 Parameter.AnimationDataParts,
                                 AnimationNo,
                                 frameNoNow,
                                 Parameter.FrameNo,
                                 Parameter.Data
                                 );
            }

            ListCallBackUserData.Clear();
        }

        /* Excute "Play-End CallBack" */
        if (0 != (Status & BitStatus.REQUEST_PLAYEND))
        {
            Status = BitStatus.CLEAR;
            if (null != functionPlayEnd)
            {
                if (false == (functionPlayEnd(transform.parent.gameObject)))
                {
                    InstanceMeshFilter.sharedMesh.Clear();
                    Object.DestroyImmediate(InstanceMeshFilter.sharedMesh);
                    InstanceMeshFilter.sharedMesh = null;

                    Destroy(transform.parent.gameObject);
                }
            }
        }
    }