/* ----------------------------------------------- Functions */
    #region Functions
    /* ******************************************************** */
    //! Get number of parts in animation

    /*!
     * @param
     *      (none)
     * @retval	Return-Value
     *      Number of parts in animation
     *      -1 == Error / "Name" is not-found.
     *
     * Get number of parts in animation.<br>
     * The range of Parts-ID is "0" to "ReturnValue-1".<br>
     */
    public int CountGetParts()
    {
        if (null == DataAnimation)
        {
            return(-1);
        }

        return(DataAnimation.CountGetParts());
    }
    /* ******************************************************** */
    //! Get part's index(Parts-ID) from the part's-name

    /*!
     * @param	Name
     *      Part's name
     * @retval	Return-Value
     *      Parts-ID
     *      -1 == Error / "Name" is not-found.
     *
     * Get the part's-Index(Parts-ID) from the name.<br>
     * The Index is the serial-number (0 origins) in the Animation-data.
     */
    public int IDGetParts(string name)
    {
        if (null == DataAnimation)
        {
            return(-1);
        }

        return(DataAnimation.IndexGetParts(name));
    }
Esempio n. 3
0
        protected override void OnAwake()
        {
            var dataAnimation = new DataAnimation();

            dataAnimation.UseAnimation = true;
            dataAnimation.CurrentState = ANIMATOR_STATE_NONE;
            dataAnimation.TargetState  = ANIMATOR_STATE_NONE;
            dataAnimation.Animator     = GetComponent <Animator>();

            var parametrs = new PageInitializationParams(dataAnimation);

            Initialize(parametrs);
        }
    /* ******************************************************** */
    //! Get part's ColorLabel-color

    /*!
     * @param	idParts
     *      Parts-ID
     * @retval	Return-Value
     *      ColorLabel's actual color<br>
     *      "A/R/G/B all 0" == Error
     *
     * Regardless (Color-Label's) form, this function returns actual color of the color label.<br>
     * Use to get color when form is "Custom Color".<br>
     */
    public Color ColorGetColorLabel(int idParts)
    {
        if (null == DataAnimation)
        {
            return(Library_SpriteStudio6.Data.Parts.Animation.ColorLabel.TableDefault[(int)Library_SpriteStudio6.Data.Parts.Animation.ColorLabel.KindForm.NON].Color);
        }

        if ((0 > idParts) || (DataAnimation.CountGetParts() <= idParts))
        {
            return(Library_SpriteStudio6.Data.Parts.Animation.ColorLabel.TableDefault[(int)Library_SpriteStudio6.Data.Parts.Animation.ColorLabel.KindForm.NON].Color);
        }

        return(DataAnimation.TableParts[idParts].LabelColor.Color);
    }
    /* ******************************************************** */
    //! Get part's ColorLabel-form

    /*!
     * @param	idParts
     *      Parts-ID
     * @retval	Return-Value
     *      ColorLabel's form<br>
     *      -1 == Error
     *
     * Get part's ColorLabel-form.<br>
     * When "ColorLabel" is set to "Custom Color" on "SpriteStudio6",
     * this function returns "Library_SpriteStudio6.Data.Parts.Animation.ColorLabel.KindForm.CUSTOM".(Irrespective of the actual color)<br>
     */
    public Library_SpriteStudio6.Data.Parts.Animation.ColorLabel.KindForm FormGetColorLabel(int idParts)
    {
        if (null == DataAnimation)
        {
            return((Library_SpriteStudio6.Data.Parts.Animation.ColorLabel.KindForm)(-1));
        }

        if ((0 > idParts) || (DataAnimation.CountGetParts() <= idParts))
        {
            return((Library_SpriteStudio6.Data.Parts.Animation.ColorLabel.KindForm)(-1));
        }

        return(DataAnimation.TableParts[idParts].LabelColor.Form);
    }
    /* ********************************************************* */
    //! Get animation index

    /*!
     * @param	name
     *      Animation name
     * @retval	Return-Value
     *      Animation's index<br>
     *      -1 == Error / "name" is not-found.
     *
     * Get animation index by name.<br>
     * <br>
     * Index is the serial-number (0 origins) in the animation data. <br>
     * Index is needed when you call "AnimationPlay" function.<br>
     * <br>
     * Since useless to search animation-index every time, recommend to cache frequently used indexes.
     */
    public int IndexGetAnimation(string name)
    {
        return((null == DataAnimation) ? -1 : DataAnimation.IndexGetAnimation(name));
    }
    /* ----------------------------------------------- Functions */
    #region Functions
    /* ********************************************************* */
    //! Get animation count

    /*!
     * @param
     *      (none)
     * @retval	Return-Value
     *      Count of animation<br>
     *      -1 == Failure (Error)
     *
     * Get count of animation.<br>
     */
    public int CountGetAnimation()
    {
        return((null == DataAnimation) ? -1 : DataAnimation.CountGetAnimation());
    }