Exemplo n.º 1
0
    private bool ListGetSequencePack(out string[] tableNameSequence,
                                     out int indexSequencePack,
                                     Script_SpriteStudio6_DataProject dataProject,
                                     string nameSequencePack
                                     )
    {
        int  countSequence   = dataProject.DataSequence.Length;                   /* InstanceSequence.CountGetPack(); */
        bool flagNameIsValid = (false == string.IsNullOrEmpty(nameSequencePack)); /* ? true : false */

        tableNameSequence = new string[countSequence];
        indexSequencePack = 0;
        for (int i = 0; i < countSequence; i++)
        {
            tableNameSequence[i] = dataProject.DataSequence[i].Name;
            if (true == string.IsNullOrEmpty(tableNameSequence[i]))
            {
                tableNameSequence[i] = NameMissing;
            }
            if ((true == flagNameIsValid) && (tableNameSequence[i] == nameSequencePack))
            {
                indexSequencePack = i;
            }
        }

        return(true);
    }
Exemplo n.º 2
0
    /* ********************************************************* */
    //! Replace Material

    /*!
     * @param	indexCellMap
     *      CellMap's index
     * @param	operationBlend
     *      Blend Operation for the target
     * @param	masking
     *      masking for the target
     * @param	nameShadcer
     *      Shader's name in animation-data
     *      null == Default(Standard) shader's name
     * @param	material
     *      New material<br>
     *      null == Remove material (however can't be removed that Project has)
     * @param	flagGlobal
     *      true == Replace material that Project(DataProject) has.<br>
     *      false == Replace material that only this Animation-Object has.
     * @retval	Return-Value
     *      Originally set material<br>
     *      null == Not exist or Error
     *
     * Search and replace material with the specified content among materials currently held.<br>
     * Material to be replaced is identified by "indexCellMap", "operationBlend", "masking", and "shader".<br>
     * If the material cannot be found, this function will return error.<br>
     * <br>
     * Note that changes the material to "material" for drawing, which is determined by "indexCellMap", "operationBlend", "masking", and "nameShader".<br>
     * "indexCellMap", "operationBlend", "masking", and "nameShader" are not parameters of the material to be changed, but keys to identify the material used in the original animation.<br>
     */
    public UnityEngine.Material MaterialReplace(int indexCellMap,
                                                Library_SpriteStudio6.KindOperationBlendEffect operationBlend,
                                                Library_SpriteStudio6.KindMasking masking,
                                                string nameShader,
                                                UnityEngine.Material material,
                                                bool flagGlobal = false
                                                )
    {
        if (null == DataEffect)
        {
            return(null);
        }
        if (0 > indexCellMap)
        {
            return(null);
        }

        if (false == flagGlobal)
        {
            if (true == TextureCheckOverride(indexCellMap))
            {                   /* Texture Overrided */
                return(CacheMaterial.MaterialReplaceEffect(indexCellMap,
                                                           operationBlend,
                                                           masking,
                                                           nameShader,
                                                           material
                                                           )
                       );
            }

            return(null);
        }

        if (null == material)
        {
            /* MEMO: Prohibited to remove material that Project has. */
            return(null);
        }
        if (TableCellMap.Length <= indexCellMap)
        {
            return(null);
        }
        Script_SpriteStudio6_DataProject dataProject = DataEffect.DataProject;

        if (null == dataProject)
        {
            return(null);
        }

        /* MEMO: The texture used in calculating hashcode to identify  material must be it stored in the project. */
        return(dataProject.MaterialReplaceEffect(indexCellMap,
                                                 operationBlend,
                                                 masking,
                                                 nameShader,
                                                 material
                                                 )
               );
    }
Exemplo n.º 3
0
    /* ----------------------------------------------- Functions */
    #region Functions
    /* ********************************************************* */
    //! Get Material

    /*!
     * @param	indexCellMap
     *      CellMap's index
     * @param	operationBlend
     *      Blend Operation for the target
     * @param	masking
     *      masking for the target
     * @param	nameShadcer
     *      Shader's name in animation-data
     *      null == Default(Standard) shader's name
     * @param	shader
     *      Shader applied<br>
     *      null == Default(Standard) shader
     * @param	flagCreateNew
     *      true == If not exist, create.
     *      false == If not exist, return null.
     * @retval	Return-Value
     *      Instance of Material
     *      null == Not exist or Error
     *
     * Search material with the specified content among materials currently held.<br>
     * Materials (held by Animation-Object) are affected by currently playback state
     *      since materials are dynamically generated.<br>
     * Materials will not be created until Play-Cursor reachs actually using material,
     *      and once it is created, those will be retained until Animation-Object is destroyed.<br>
     */
    public UnityEngine.Material MaterialGet(int indexCellMap,
                                            Library_SpriteStudio6.KindOperationBlendEffect operationBlend,
                                            Library_SpriteStudio6.KindMasking masking,
                                            string nameShader,
                                            UnityEngine.Shader shader,
                                            bool flagCreateNew
                                            )
    {
        if (null == DataEffect)
        {
            return(null);
        }
        if (0 > indexCellMap)
        {
            return(null);
        }

        if (true == TextureCheckOverride(indexCellMap))
        {               /* Texture Overrided */
            return(CacheMaterial.MaterialGetEffect(indexCellMap,
                                                   operationBlend,
                                                   masking,
                                                   nameShader,
                                                   shader,
                                                   TableTexture,
                                                   flagCreateNew
                                                   )
                   );
        }

        if (TableCellMap.Length <= indexCellMap)
        {
            return(null);
        }

        Script_SpriteStudio6_DataProject dataProject = DataEffect.DataProject;

        if (null == dataProject)
        {
            return(null);
        }
        return(dataProject.MaterialGetEffect(indexCellMap,
                                             operationBlend,
                                             masking,
                                             nameShader,
                                             shader,
                                             flagCreateNew
                                             )
               );
    }
Exemplo n.º 4
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        EditorGUILayout.LabelField("[SpriteStudio6 Sequence]");
        int  levelIndent = 0;
        bool flagUpdate  = false;

        /* Static Datas */
        EditorGUILayout.Space();
        PropertyDataProject.isExpanded = EditorGUILayout.Foldout(PropertyDataProject.isExpanded, "Static Datas");
        if (true == PropertyDataProject.isExpanded)
        {
            EditorGUI.indentLevel = levelIndent + 1;

            UnityEngine.Object dataProjectNew = EditorGUILayout.ObjectField("Data:Project", PropertyDataProject.objectReferenceValue, typeof(Script_SpriteStudio6_DataProject), true);
            if (PropertyDataProject.objectReferenceValue != dataProjectNew)
            {
                PropertyDataProject.objectReferenceValue = dataProjectNew as Script_SpriteStudio6_DataProject;
                flagUpdate |= true;
            }
            EditorGUI.indentLevel = levelIndent;
        }

        Script_SpriteStudio6_DataProject dataProject = InstanceSequence.DataProject;

        /* Play Information */
        EditorGUILayout.Space();
        PropertyNameSequencePack.isExpanded = EditorGUILayout.Foldout(PropertyNameSequencePack.isExpanded, "Initial/Preview Play Setting");
        if (true == PropertyNameSequencePack.isExpanded)
        {
            /* Order-In-Layer (SortingOrder) */
            PropertyOrderInLayer.intValue = EditorGUILayout.IntField("Order In Layer", PropertyOrderInLayer.intValue);
            EditorGUILayout.LabelField("(0: Default)");
            EditorGUILayout.Space();

            /* Hide */
            PropertyHideForce.boolValue = EditorGUILayout.Toggle("Hide Force", PropertyHideForce.boolValue);
//			EditorGUILayout.Space();

            /* Collider Interlock Hide */
            PropertyColliderInterlockHideForce.boolValue = EditorGUILayout.Toggle("Collider Interlock Hide", PropertyColliderInterlockHideForce.boolValue);
//			EditorGUILayout.Space();

            /* Planarization (Cancellation Rotate Sprite) */
            PropertyFlagPlanarization.boolValue = EditorGUILayout.Toggle("Planarization", PropertyFlagPlanarization.boolValue);
            EditorGUILayout.Space();

            /* Sequence */
            if (null == dataProject)
            {
                EditorGUILayout.LabelField("(Project Data Missing)");
                PropertyNameSequencePack.stringValue = null;                    /* InstanceSequence.PackSetNoUse(); */
                PropertyNameDataSequence.stringValue = null;
                PropertyIndexStepInitial.intValue    = 0;
            }
            else
            {
                /* Creation Sequence name table */
                InformationPlay(ref flagUpdate, dataProject, InstanceSequence);
            }
        }

        serializedObject.ApplyModifiedProperties();
    }
Exemplo n.º 5
0
    private void InformationPlay(ref bool flagUpdate,
                                 Script_SpriteStudio6_DataProject dataProject,
                                 Script_SpriteStudio6_Sequence instanceSequence
                                 )
    {
        int indexCursor;

        /* "Sequence-Pack" Select */
        string nameSequencePack = PropertyNameSequencePack.stringValue;

        int indexSequencePack;

        string[] tableNameSequence;
        ListGetSequencePack(out tableNameSequence, out indexSequencePack, dataProject, nameSequencePack);
        indexCursor = EditorGUILayout.Popup("Sequence-Pack Name", indexSequencePack, tableNameSequence);
        if (indexCursor != indexSequencePack)
        {
            flagUpdate       |= true;
            indexSequencePack = indexCursor;
        }
        Script_SpriteStudio6_DataSequence dataSequencePack = dataProject.DataSequence[indexSequencePack];

        nameSequencePack = dataSequencePack.Name;

        /* "Sequence" Select */
        string nameSequenceData = PropertyNameDataSequence.stringValue;

        int indexSequenceData;

        string[] tableNameSequenceData;
        ListGetSequenceData(out tableNameSequenceData, out indexSequenceData, dataSequencePack, nameSequenceData);
        indexCursor = EditorGUILayout.Popup("Sequence-Data Name", indexSequenceData, tableNameSequenceData);
        if (indexCursor != indexSequenceData)
        {
            flagUpdate       |= true;
            indexSequenceData = indexCursor;
        }
        nameSequenceData = dataSequencePack.TableSequence[indexSequenceData].Name;

        /* Initial Step */
        int indexStepInitial = EditorGUILayout.IntField("Start Step", PropertyIndexStepInitial.intValue);

        if (PropertyIndexStepInitial.intValue != indexStepInitial)
        {
            flagUpdate |= true;

            int countStep = dataSequencePack.TableSequence[indexSequenceData].TableStep.Length;
            if (0 > indexStepInitial)
            {
                indexStepInitial = 0;
            }
            if (countStep <= indexStepInitial)
            {
                indexStepInitial = countStep - 1;
            }
        }

        /* Initial Stop */
        bool flagUpdateInitialStop = false;
        bool flagCheck             = EditorGUILayout.Toggle("Initial Stop", PropertyStopInitial.boolValue);

        if (flagCheck != PropertyStopInitial.boolValue)
        {
            flagUpdateInitialStop        |= true;
            PropertyStopInitial.boolValue = flagCheck;
        }

        /* Reset */
        EditorGUILayout.Space();
        if (true == GUILayout.Button("Reset (Reinitialize)"))
        {
            PropertyHideForce.boolValue = false;
            PropertyColliderInterlockHideForce.boolValue = false;
            PropertyFlagPlanarization.boolValue          = false;

            indexSequencePack = 0;
            dataSequencePack  = dataProject.DataSequence[indexSequencePack];
            nameSequencePack  = dataSequencePack.Name;

            indexSequenceData = 0;
            nameSequenceData  = dataSequencePack.TableSequence[indexSequenceData].Name;

            indexStepInitial = 0;

            flagUpdate = true;                  /* Force */
        }

        /* Check Update */
        if (true == flagUpdate)
        {
            /* Update Properties */
            PropertyNameSequencePack.stringValue = nameSequencePack;
            PropertyNameDataSequence.stringValue = nameSequenceData;
            PropertyIndexStepInitial.intValue    = indexStepInitial;

            /* Play Start */
            instanceSequence.Stop(false, false);
            if (true == instanceSequence.PackSet(indexSequencePack))
            {
                if (true == instanceSequence.SequenceSet(indexSequenceData))
                {
                    instanceSequence.Play(indexStepInitial);
                }
            }
        }
        flagUpdate |= flagUpdateInitialStop;
    }