Ejemplo n.º 1
0
    public bool AnimEnd(Script_SpriteStudio_Root InstanceRoot, GameObject ObjectControl)
    {
        switch (motion)
        {
        case AnimationType.respair:
            GimmickManager.Instance.roboAnima = false;
            if (this.transform.position.x < PlayerMove_C.Instance.transform.position.x)
            {
                this.transform.rotation = Quaternion.Euler(0, 90, 0);
            }
            else if (this.transform.position.x > PlayerMove_C.Instance.transform.position.x)
            {
                this.transform.rotation = Quaternion.Euler(0, -90, 0);
            }
            motion = AnimationType.idle;
            ScriptRoot.AnimationPlay((int)AnimationType.idle, 0, 0, 1.0f);
            isBreak  = false;
            moveFlag = true;
            break;

        case AnimationType.break_:
            GimmickManager.Instance.roboAnima = false;
            motion = AnimationType.break_idle;
            ScriptRoot.AnimationPlay((int)AnimationType.break_idle, 0, 0, 1.0f);
            isBreak = true;
            break;

        default:
            break;
        }
        return(true);
    }
Ejemplo n.º 2
0
    //アニメーションの終了コールバック
    public bool AnimEnd(Script_SpriteStudio_Root InstanceRoot, GameObject ObjectControl)
    {
        //モーションが終了したら次のモーションを遷移させる.
        switch (motion)
        {
        case AnimationType.STANCE:
            motion = AnimationType.STANCE;
            ScriptRoot.AnimationPlay((int)AnimationType.STANCE, 1, 0, 1.0f);
            break;

        case AnimationType.ATTACK1:
            motion = AnimationType.STANCE;
            ScriptRoot.AnimationPlay((int)AnimationType.STANCE, 1, 0, 1.0f);
            break;

        case AnimationType.ATTACK2:
            motion = AnimationType.STANCE;
            ScriptRoot.AnimationPlay((int)AnimationType.STANCE, 1, 0, 1.0f);
            break;

        default:
            break;
        }
        return(true);
    }
Ejemplo n.º 3
0
            /* ******************************************************** */
            //! Get Root-Parts

            /*!
             * @param	InstanceGameObject
             *      GameObject to start the search
             * @retval	Return-Value
             *      Instance of "Script_SpriteStudio_Root"<br>
             *      null == Not-Found / Failure
             *
             * Get "Script_SpriteStudio_Root" by examining "InstanceGameObject" and direct children.
             */
            public static Script_SpriteStudio_Root RootGetChild(GameObject InstanceGameObject)
            {
                Script_SpriteStudio_Root ScriptRoot = null;

                /* Check Origin */
                ScriptRoot = InstanceGameObject.GetComponent <Script_SpriteStudio_Root>();
                if (null != ScriptRoot)
                {                       /* Has Root-Parts */
                    return(ScriptRoot);
                }

                /* Check Children */
                int       CountChild             = InstanceGameObject.transform.childCount;
                Transform InstanceTransformChild = null;

                for (int i = 0; i < CountChild; i++)
                {
                    InstanceTransformChild = InstanceGameObject.transform.GetChild(i);
                    ScriptRoot             = InstanceTransformChild.gameObject.GetComponent <Script_SpriteStudio_Root>();
                    if (null != ScriptRoot)
                    {                           /* Has Root-Parts */
                        return(ScriptRoot);
                    }
                }

                return(null);
            }
    public void SetBtn(Button btn, bool isExtra = false)
    {
        if (btn == null)
        {
            return;
        }

        reloadColor = RELOAD_GAGE_COLOR;
        normalColor = NORMAL_GAGE_COLOR;
        if (isExtra)
        {
            normalColor = EXTRA_GAGE_COLOR;
        }

        myBtn = btn;
        Transform imgGageTran = myBtn.transform.FindChild("ImgGage");

        if (imgGageTran != null)
        {
            imgGage            = imgGageTran.GetComponent <Image>();
            imgGage.fillAmount = 1;
            imgGage.color      = normalColor;
        }
        spriteStudioCtrl = GameObject.Find("SpriteStudioController").GetComponent <SpriteStudioController>();
        if (spriteStudioCtrl != null)
        {
            scriptRoot = spriteStudioCtrl.CreateButtonFlash(myBtn.gameObject);
        }
    }
    protected new void EvStateEnter(PlayerStateContext context)
    {
        base.EvStateEnter(context);
        this.context     = context;
        itsOwnDisposable = new CompositeDisposable();

        sprite = context.Sprite.GetComponent <Script_SpriteStudio_Root>();
        SetAnimation("Damage");
        WaitForTransitToNeutral(context);
    }
Ejemplo n.º 6
0
 public void Play(Script_SpriteStudio_Root scriptRoot, int timesPlay = 1, bool isHideEnd = false)
 {
     scriptRoot.FlagHideForce = false;
     scriptRoot.AnimationPlay(-1, timesPlay);
     if (isHideEnd)
     {
         //ループ終了チェック
         StartCoroutine(CheckAnimationEnd(scriptRoot));
     }
 }
Ejemplo n.º 7
0
 IEnumerator CheckAnimationEnd(Script_SpriteStudio_Root scriptRoot)
 {
     for (;;)
     {
         if (!scriptRoot.AnimationCheckPlay())
         {
             //終了
             scriptRoot.FlagHideForce = true;
             break;
         }
         yield return(null);
     }
 }
    IEnumerator Reload(float addReloadTime = 0)
    {
        if (noReloadRate > 0)
        {
            leftReloadTime = addReloadTime;
            if (Random.Range(0, 100) >= noReloadRate)
            {
                leftReloadTime += reloadTime;
            }
        }
        else
        {
            leftReloadTime = reloadTime + addReloadTime;
        }
        for (;;)
        {
            yield return(null);

            leftReloadTime -= Time.deltaTime;
            if (imgGage != null)
            {
                imgGage.fillAmount = (reloadTime - leftReloadTime) / reloadTime;
            }
            if (leftReloadTime <= 0)
            {
                break;
            }
        }
        if (imgGage != null)
        {
            imgGage.fillAmount = 1;
            imgGage.color      = NORMAL_GAGE_COLOR;
        }
        if (spriteStudioCtrl != null && myBtn.gameObject.GetActive())
        {
            Vector3 pos = spriteStudioCtrl.GetObjPos(myBtn.gameObject);
            if (scriptRoot == null)
            {
                scriptRoot = spriteStudioCtrl.CreateButtonFlash(myBtn.gameObject);
            }
            if (scriptRoot != null)
            {
                scriptRoot.transform.position = pos;
                spriteStudioCtrl.Play(scriptRoot);
            }
        }

        SetEnable(true);
    }
Ejemplo n.º 9
0
 // Update is called once per frame
 void Update()
 {
     //spritestudioルートクラスの取得.
     //spriteStudioRootを使用してアニメーションの制御を行います.
     if (null == ScriptRoot)
     {
         //初期化.
         ScriptRoot = Library_SpriteStudio.Utility.Parts.RootGetChild(gameObject);
         //アニメーション終了コールバックを設定.
         ScriptRoot.FunctionPlayEnd = AnimEnd;
         //アニメーション再生
         ScriptRoot.AnimationPlay((int)AnimationType.STANCE, 1, 0, 1.0f);
     }
     //入力によってモーションを変更する
     if (Input.GetKey("z"))
     {
         if (press == false)
         {
             motion = AnimationType.ATTACK1;
             ScriptRoot.AnimationPlay((int)AnimationType.ATTACK1, 1, 0, 1.0f);
         }
         press = true;
     }
     else if (Input.GetKey("x"))
     {
         if (press == false)
         {
             motion = AnimationType.ATTACK2;
             ScriptRoot.AnimationPlay((int)AnimationType.ATTACK2, 1, 0, 1.0f);
         }
         press = true;
     }
     else if (Input.GetKey("c"))
     {
         if (press == false)
         {
             GameObject go = null;
             go = Instantiate(Resources.Load("Prefabs/hiteffect/effect_comipo/effect_comipo01_Control"), new Vector3(-400, 0, 0), Quaternion.identity) as GameObject;
             go.transform.localScale = new Vector3(2.5f, 2.5f, 1.0f);
         }
         press = true;
     }
     else
     {
         press = false;
     }
 }
Ejemplo n.º 10
0
    // Update is called once per frame
    void Update()
    {
        //spritestudioルートクラスの取得.
        //spriteStudioRootを使用してアニメーションの制御を行います.
        if (null == ScriptRoot)
        {
            //初期化.
            ScriptRoot = Library_SpriteStudio.Utility.Parts.RootGetChild(gameObject);
            //アニメーション再生
            ScriptRoot.AnimationPlay(0);
            //名前からインスタンスパーツのIDを取得する
            IDParts = ScriptRoot.IDGetParts("face_base");
        }

        count++;
        if ((count % 180) == 0)
        {
            string NameAnimation = "";

            //インスタンスパーツが参照しているアニメーションを変更します
            //参照アニメーション(ssae)内でモーションを切り替えます。
            switch (type)
            {
            case 0:
                NameAnimation = "face2";
                type++;
                break;

            case 1:
                NameAnimation = "face3";
                type++;
                break;

            case 2:
                NameAnimation = "face1";
                type          = 0;
                break;

            default:
                break;
            }
            //参照アニメの切り替えはアニメーションを停止して行ってください。
            ScriptRoot.AnimationStop();
            ScriptRoot.InstanceChange(IDParts, null, NameAnimation);
            ScriptRoot.AnimationPlay();
        }
    }
Ejemplo n.º 11
0
    // Update is called once per frame
    void Update()
    {
        //spritestudioルートクラスの取得
        //spriteStudioRootを使用してアニメーションの制御を行います。
        if (null == ScriptRoot)
        {
            //初期化.
            ScriptRoot = Library_SpriteStudio.Utility.Parts.RootGetChild(gameObject);
            //配置されているviweを取得し設定する.
            var go = GameObject.Find("View (Manager-Draw)");
            ScriptRoot.InstanceManagerDraw = go.GetComponent <Script_SpriteStudio_ManagerDraw>();

            //アニメーション終了コールバックを設定.
            ScriptRoot.FunctionPlayEnd = AnimEnd;
            //アニメーション再生
            ScriptRoot.AnimationPlay(0, 1, 0, 1.0f);
        }
    }
Ejemplo n.º 12
0
    public Script_SpriteStudio_Root CreateAnimation(GameObject animation, string key, Vector3 worldPos)
    {
        if (scriptRoots.ContainsKey(key))
        {
            if (scriptRoots[key] != null)
            {
                return(scriptRoots[key]);
            }
        }

        GameObject ob = (GameObject)Instantiate(animation, worldPos, Camera.main.transform.rotation);

        StartCoroutine(SetView3D(ob.transform));
        Script_SpriteStudio_Root scriptRoot = Library_SpriteStudio.Utility.Parts.RootGetChild(ob);

        Stop(scriptRoot);

        scriptRoots[key] = scriptRoot;
        return(scriptRoot);
    }
//	void Awake()
//	{
//	}

    void Start()
    {
        if (null != PrefabUnderControl)
        {
            GameObject InstanceGameObjectChild = Library_SpriteStudio.Miscellaneousness.Asset.PrefabInstantiateChild(gameObject, (GameObject)PrefabUnderControl, null, false);
            if (null != InstanceGameObjectChild)
            {
                /* Instantiate Under-Control Prefab */
                Script_SpriteStudio_Root InstanceRootChild = InstanceGameObjectChild.GetComponent <Script_SpriteStudio_Root>();
                if (null != InstanceRootChild)
                {
                    InstanceRootChild.InstanceGameObjectControl = gameObject;

                    if (null == InstanceRootChild.InstanceManagerDraw)
                    {
                        InstanceRootChild.InstanceManagerDraw = InstanceManagerDraw;
                    }
                }
            }
        }
    }
Ejemplo n.º 14
0
    void Update()
    {
        if (null == ScriptRoot)
        {
            //初期化.
            ScriptRoot = Library_SpriteStudio.Utility.Parts.RootGetChild(animePlayer);
            //アニメーション終了コールバックを設定.
            ScriptRoot.FunctionPlayEnd = AnimEnd;
            motion = AnimationType.break_idle;
            //アニメーション再生
            ScriptRoot.AnimationPlay((int)AnimationType.break_idle, 0, 0, 1.0f);
        }

        if (isBreak)
        {
            moveFlag = false;
            if (GimmickManager.Instance.roboGo &&
                GimmickManager.Instance.tapPositionUP == 1)
            {
                GimmickManager.Instance.roboAnima = true;
                motion = AnimationType.respair;
                ScriptRoot.AnimationPlay((int)AnimationType.respair, 1, 0, 1.0f);
            }
        }
        else if (isBreak == false)
        {
            if (GimmickManager.Instance.roboGo == false)
            {
                moveFlag = true;
            }

            if (GimmickManager.Instance.roboGo &&
                GimmickManager.Instance.tapPositionDown == 1)
            {
                GimmickManager.Instance.roboAnima = true;
                moveFlag = false;
                motion   = AnimationType.break_;
                ScriptRoot.AnimationPlay((int)AnimationType.break_, 1, 0, 1.0f);
            }
        }

        if (moveFlag)
        {
            if (isPlayerBack == false)
            {
                this.transform.position += transform.TransformDirection(Vector3.forward) * 0.1f;
            }
            if (PlayerMove_C.Instance.playerDirectionRight)
            {
                if (this.transform.position.x <= (PlayerMove_C.Instance.transform.position.x - 1.0f) &&
                    this.transform.position.x >= (PlayerMove_C.Instance.transform.position.x - 2.0f))
                {
                    isPlayerBack            = true;
                    this.transform.rotation = Quaternion.Euler(0, 90, 0);
                    isLeft  = false;
                    isRight = true;
                }
                else
                {
                    isPlayerBack = false;
                }
            }
            else if (PlayerMove_C.Instance.playerDirectionLeft)
            {
                if (this.transform.position.x >= (PlayerMove_C.Instance.transform.position.x + 1.0f) &&
                    this.transform.position.x <= (PlayerMove_C.Instance.transform.position.x + 2.0f))
                {
                    isPlayerBack            = true;
                    this.transform.rotation = Quaternion.Euler(0, -90, 0);
                    isRight = false;
                    isLeft  = true;
                }
                else
                {
                    isPlayerBack = false;
                }
            }
            if (GimmickManager.Instance.roboGo)
            {
                moveFlag = false;
            }
        }
    }
Ejemplo n.º 15
0
 public void Stop(Script_SpriteStudio_Root scriptRoot)
 {
     scriptRoot.FlagHideForce = true;
     scriptRoot.AnimationStop();
 }
Ejemplo n.º 16
0
    public bool AnimEnd(Script_SpriteStudio_Root InstanceRoot, GameObject ObjectControl)
    {
        //アニメーション制御
        switch (motion)
        {
        case AnimationType.run:
            motion = AnimationType.idle;
            ScriptRoot.AnimationPlay((int)AnimationType.idle, 0, 0, 0.5f);
            break;

        //	--------------------------------------------------------------------------------------
        //	ジャンプアニメーションの制御
        case AnimationType.jump_1:
            jumpCount++;
            motion = AnimationType.jump_2;
            ScriptRoot.AnimationPlay((int)AnimationType.jump_2, 1, 0, 0.6f);
            if (jumpCount == 1)
            {
                if (playerDirectionRight)
                {
                    //	もし地面に設置していたらプレイヤーの向きにジャンプする
                    transform.GetComponent <Rigidbody> ().AddForce(jumpFront, jumpUp, 0);
                }
                else
                {
                    //	もし地面に設置していたらプレイヤーの向きにジャンプする
                    transform.GetComponent <Rigidbody> ().AddForce(jumpFront * -1, jumpUp, 0);
                }
                standFlag = false;
            }
            //----------------------------------------
            //ジャンプのSEを再生する
            if (seCount == 0)
            {
                seCount++;
                audioSource.mute = false;
                audioSource.PlayOneShot(jumpSe);
            }
            //----------------------------------------
            break;

        case AnimationType.jump_2:
            jumpFlag  = 0;
            jumpCount = 0;
            seCount   = 0;
            motion    = AnimationType.jump_3;
            ScriptRoot.AnimationPlay((int)AnimationType.jump_3, 1, 0, 1.0f);
            break;

        case AnimationType.jump_3:
            motion = AnimationType.idle;
            ScriptRoot.AnimationPlay((int)AnimationType.idle, 0, 0, 1.0f);
            break;
        //	--------------------------------------------------------------------------------------

        //	--------------------------------------------------------------------------------------
        //	ギミックを発動させた時のアニメーション
        case AnimationType.up_1:
            seCount = 0;
            motion  = AnimationType.up_2;
            ScriptRoot.AnimationPlay((int)AnimationType.up_2, 0, 0, 1.0f);
            break;

        case AnimationType.up_2:
            motion = AnimationType.up_3;
            ScriptRoot.AnimationPlay((int)AnimationType.up_3, 1, 0, 1.0f);
            break;

        case AnimationType.up_3:
            motion = AnimationType.idle;
            ScriptRoot.AnimationPlay((int)AnimationType.idle, 0, 0, 1.0f);
            break;
        //	--------------------------------------------------------------------------------------

        //	--------------------------------------------------------------------------------------
        //	アイドルのアニメーション
        case AnimationType.idle_Q_L:
            motion = AnimationType.idle;
            ScriptRoot.AnimationPlay((int)AnimationType.idle, 0, 0, 1.0f);
            idleCount = 0;
            break;

        case AnimationType.idle_Q_R:
            motion = AnimationType.idle;
            ScriptRoot.AnimationPlay((int)AnimationType.idle, 0, 0, 1.0f);
            idleCount = 0;
            break;

        //	--------------------------------------------------------------------------------------
        default:
            break;
        }
        return(true);
    }
Ejemplo n.º 17
0
    void Update()
    {
        if (null == ScriptRoot)
        {
            //初期化.
            ScriptRoot = Library_SpriteStudio.Utility.Parts.RootGetChild(animePlayer);
            //アニメーション終了コールバックを設定.
            ScriptRoot.FunctionPlayEnd = AnimEnd;
            motion = AnimationType.idle;
            //アニメーション再生
            ScriptRoot.AnimationPlay((int)AnimationType.idle, 0, 0, 1.0f);
        }


        CheckGroundeed();

        //----------------------------------------------------------------------

        //----------------------------------------------------------------------
        //	画面をタップしてる間
        if (Input.GetMouseButton(0))
        {
            tapPosition = Input.mousePosition;                                                //	タップいている場所を代入
            worldPos    = Camera.main.ScreenToWorldPoint(tapPosition) + new Vector3(0, 0, 1); //	ワールド座標に変化
            popUpTapEffect.transform.position = worldPos;                                     //	タップフェクトをタップしているところに常に表示
        }
        //----------------------------------------------------------------------

        //----------------------------------------------------------------------
        //	画面から指を話したら
        if (Input.GetMouseButtonUp(0))
        {
            tapFlag = 0;                        //	タップが離れたらフラグを折る
            DestroyTapEffects();                //	タップエフェクトを消去
            tapCount = 0;

            //	ギミックをタップするのを離れたら動けるようにする
            if (obj.tag == "Gimmick")
            {
                gimmickFlag = 0;
                moveFlag    = true;
            }

            obj = nullObj;

            //	指を話した時にアニメーションがrunならアニメーションをidleに変える
            if (motion == AnimationType.run)
            {
                motion = AnimationType.idle;
                ScriptRoot.AnimationPlay((int)AnimationType.idle, 0, 0, 1.0f);
            }
        }

        if (motion == AnimationType.idle)
        {
            idleCount += 0.01f;
        }
        else
        {
            idleCount = 0;
        }

        if (motion == AnimationType.idle && idleCount > 3.0f)
        {
            if (playerDirectionLeft)
            {
                motion = AnimationType.idle_Q_L;
                ScriptRoot.AnimationPlay((int)AnimationType.idle_Q_L, 1, 0, 1.0f);
            }
            else if (playerDirectionRight)
            {
                motion = AnimationType.idle_Q_R;
                ScriptRoot.AnimationPlay((int)AnimationType.idle_Q_R, 1, 0, 1.0f);
            }
        }
        //----------------------------------------------------------------------
        if (tapFlag == 1)
        {
            if (moveFlag)
            {
                //	アニメーションをrunに切り替え
                if (motion != AnimationType.run)
                {
                    motion = AnimationType.run;
                    ScriptRoot.AnimationPlay((int)AnimationType.run, 0, 0, 1f);
                }

                //-----------------------------------------------------------------------------------------------
                //	タップした時の移動処理
                //	画面中央より左を押した時
                if (0 < tapPosition.x && tapPosition.x < middle)
                {
                    rotateCountLeft      = 0;                           //	左の回転カウントを初期化
                    playerDirectionRight = false;                       //	右向きフラグを折る
                    playerDirectionLeft  = true;                        //	左向きフラグを立てる
                    //	向いてる方向に動く
                    transform.position += transform.TransformDirection(Vector3.forward) * moveSpeed;
                }
                //	画面中央より右を押した時
                else if (middle < tapPosition.x)
                {
                    rotateCountRight     = 0;                                   //	右の回転カウントを初期化
                    playerDirectionLeft  = false;                               //	左向きフラグを折る
                    playerDirectionRight = true;                                //	右向きフラグを立てる
                    //	向いてる方向に動く
                    transform.position += transform.TransformDirection(Vector3.forward) * moveSpeed;
                }
                // 中央部分かつプレイヤーを押した時
                if (installationFlag && obj.tag == "Player")
                {
                    jumpFlag = 1;                               //	ジャンプフラグを立て
                }
                //-----------------------------------------------------------------------------------------------
            }

            //--------------------------------------------------------------------------------------
            //	プレイヤーのジャンプ処理
            if (jumpFlag == 1)
            {
                motion = AnimationType.jump_1;
                ScriptRoot.AnimationPlay((int)AnimationType.jump_1, 1, 0, 1f);
                moveFlag         = false;               //	ムーブフラグを折る
                installationFlag = false;               //	地面から離れたら設置フラグを折る
            }

            //--------------------------------------------------------------------------------------
        }

        //--------------------------------------------------------------------
        //	プレイヤーの方向転換処理
        if (playerDirectionRight)
        {
            if (rotateCountLeft < 1)
            {
                transform.Rotate(new Vector3(0, 180, 0));
                rotateCountLeft++;                              //	回った後にカウントアップ
            }
        }
        else if (playerDirectionLeft)
        {
            if (rotateCountRight < 1)
            {
                transform.Rotate(new Vector3(0, 180, 0));
                rotateCountRight++;                             //	回った後にカウントアップ
            }
        }
        //--------------------------------------------------------------------

        //-------------------------------------------------------------------------
        //	それぞれのギミックを発動させたらそれ用のアニメーションを再生させるフラグを立てる

        if (GimmickManager_D.Instance.houseAnima)
        {
            gimmickAnimationFlag = true;
        }
        else
        {
            gimmickAnimationFlag = false;
        }

        //	ギミッキを発動させた時のアニメーション切り替え
        if (gimmickAnimationFlag)
        {
            switch (motion)
            {
            case AnimationType.idle:
            case AnimationType.idle_Q_R:
            case AnimationType.idle_Q_L:
            case AnimationType.run:
                motion = AnimationType.up_1;
                ScriptRoot.AnimationPlay((int)AnimationType.up_1, 1, 0, 1f);
                if (seCount == 0)
                {
                    seCount++;
                    audioSource.mute = false;
                    audioSource.PlayOneShot(gimmickSe);
                }
                break;

            default:
                break;
            }
        }

        if (gimmickAnimationFlag)
        {
            moveFlag = false;
        }

        if (gimmickAnimationFlag == false)
        {
            switch (motion)
            {
            case AnimationType.up_2:
                moveFlag = true;
                motion   = AnimationType.up_3;
                ScriptRoot.AnimationPlay((int)AnimationType.up_3, 1, 0, 1.0f);
                break;

            default:
                break;
            }
        }
    }
Ejemplo n.º 18
0
 // Use this for initialization
 void Start()
 {
     parent = transform.parent.gameObject.GetComponent<Ghost>();
     script_SpriteStudio_Root = GetComponent<Script_SpriteStudio_Root>();
 }
Ejemplo n.º 19
0
    public override void OnInspectorGUI()
    {
        Script_SpriteStudio_Root Data = (Script_SpriteStudio_Root)target;

        EditorGUILayout.LabelField("[SpriteStudio (Parts-)Root]");
        int LevelIndent = 0;

        EditorGUILayout.Space();
        Data.InstanceManagerDraw = (Script_SpriteStudio_ManagerDraw)(EditorGUILayout.ObjectField("View (Manager-Draw)", Data.InstanceManagerDraw, typeof(Script_SpriteStudio_ManagerDraw), true));

        EditorGUILayout.Space();
        FoldOutStaticDatas = EditorGUILayout.Foldout(FoldOutStaticDatas, "Static Datas");
        if (true == FoldOutStaticDatas)
        {
            EditorGUI.indentLevel = LevelIndent + 1;
            Data.DataCellMap      = (Script_SpriteStudio_DataCell)(EditorGUILayout.ObjectField("Data:CellMap", Data.DataCellMap, typeof(Script_SpriteStudio_DataCell), true));
            Data.DataAnimation    = (Script_SpriteStudio_DataAnimation)(EditorGUILayout.ObjectField("Data:Animation", Data.DataAnimation, typeof(Script_SpriteStudio_DataAnimation), true));
            EditorGUI.indentLevel = LevelIndent;
        }

        EditorGUILayout.Space();
        FoldOutMaterialTable = EditorGUILayout.Foldout(FoldOutMaterialTable, "Based-Material Table");
        if (true == FoldOutMaterialTable)
        {
            EditorGUI.indentLevel = LevelIndent + 1;
            if (null != Data.TableMaterial)
            {
                int CountShader   = (int)(Library_SpriteStudio.KindColorOperation.TERMINATOR - 1);
                int Count         = Data.TableMaterial.Length / CountShader;
                int MaterialNoTop = 0;
                Library_SpriteStudio.KindColorOperation MaterialTableNo = 0;
                string NameField = "";
                for (int i = 0; i < Count; i++)
                {
                    MaterialNoTop = i * (int)(Library_SpriteStudio.KindColorOperation.TERMINATOR - 1);
                    EditorGUILayout.LabelField("Material No ["
                                               + MaterialNoTop
                                               + "-"
                                               + ((MaterialNoTop + CountShader) - 1)
                                               + "]: Texture-"
                                               + i
                                               );

                    EditorGUI.indentLevel = LevelIndent + 2;
                    for (int j = 0; j < CountShader; j++)
                    {
                        MaterialTableNo = (Library_SpriteStudio.KindColorOperation)(j + 1);
                        NameField       = "Shader [" + MaterialTableNo.ToString() + "]";
                        Data.TableMaterial[MaterialNoTop + j] = (Material)(EditorGUILayout.ObjectField(NameField, Data.TableMaterial[MaterialNoTop + j], typeof(Material), false));
                    }
                    EditorGUILayout.Space();
                    EditorGUI.indentLevel = LevelIndent + 1;
                }
            }
            EditorGUI.indentLevel = LevelIndent;
        }
        EditorGUILayout.Space();

        FoldOutPlayInformation = EditorGUILayout.Foldout(FoldOutPlayInformation, "Initial/Preview Play Setting");
        if (true == FoldOutPlayInformation)
        {
            EditorGUI.indentLevel = LevelIndent + 1;

//			if((null != Data.DataAnimation) && (null != Data.DataCellMap))
            if (null != Data.DataAnimation)
            {
                bool FlagUpdate = false;

                Data.FlagHideForce = EditorGUILayout.Toggle("Hide Force", Data.FlagHideForce);
                EditorGUILayout.Space();

                Data.FlagAnimationStopInitial = EditorGUILayout.Toggle("Initial Stopping Animation", Data.FlagAnimationStopInitial);
                EditorGUILayout.Space();

                /* "Animation" Select */
                Library_SpriteStudio.Data.Animation DataAnimationBody = null;
                int      CountAnimation    = Data.DataAnimation.CountGetAnimation();
                string[] ListNameAnimation = new string[CountAnimation];
                for (int i = 0; i < CountAnimation; i++)
                {
                    DataAnimationBody = Data.DataAnimation.DataGetAnimation(i);
                    if (null != DataAnimationBody)
                    {
                        ListNameAnimation[i] = DataAnimationBody.Name;
                    }
                    else
                    {
                        ListNameAnimation[i] = "(Data Missing)";
                    }
                }
                int IndexAnimationCursor = Data.IndexAnimation;
                if ((0 > IndexAnimationCursor) || (Data.DataAnimation.ListDataAnimation.Length <= IndexAnimationCursor))
                {
                    IndexAnimationCursor = 0;
                    FlagUpdate          |= true;
                }
                int IndexNow = EditorGUILayout.Popup("Animation Name", IndexAnimationCursor, ListNameAnimation);
                if (IndexNow != IndexAnimationCursor)
                {
                    IndexAnimationCursor = IndexNow;
                    Data.IndexAnimation  = IndexAnimationCursor;
                    FlagUpdate          |= true;
                }

                DataAnimationBody = Data.DataAnimation.DataGetAnimation(IndexAnimationCursor);
                int FrameNoLast = DataAnimationBody.CountFrame - 1;
                int CountLabel  = DataAnimationBody.CountGetLabel();

                EditorGUILayout.LabelField("- Frame Count: [" + DataAnimationBody.CountFrame.ToString() + "] (0 - " + FrameNoLast.ToString() + ")");
                EditorGUILayout.Space();

                /* "Label" Selector Create (for Start-Label / End-Label) */
                string[] ListNameLabel    = null;
                int[]    ListIndexLabel   = null;
                int[]    ListFrameNoLabel = null;
                if (0 < CountLabel)
                {                         /* Has Labels */
                    CountLabel      += 2; /* +2 ... "_start" and "_end" (Reserved-Labels) */
                    ListNameLabel    = new string[CountLabel];
                    ListIndexLabel   = new int[CountLabel];
                    ListFrameNoLabel = new int[CountLabel];

                    Library_SpriteStudio.Data.Label DataLabelBody = null;
                    for (int j = 1; j < (CountLabel - 1); j++)
                    {
                        DataLabelBody = DataAnimationBody.DataGetLabel(j - 1);

                        ListNameLabel[j]    = DataLabelBody.Name;
                        ListIndexLabel[j]   = (j - 1);
                        ListFrameNoLabel[j] = DataLabelBody.FrameNo;
                    }
                }
                else
                {                       /* Has No-Labels */
                    CountLabel = 2;

                    ListNameLabel    = new string[CountLabel];
                    ListIndexLabel   = new int[CountLabel];
                    ListFrameNoLabel = new int[CountLabel];
                }
                ListNameLabel[0]    = Library_SpriteStudio.ListNameLabelAnimationReserved[(int)Library_SpriteStudio.KindLabelAnimationReserved.START];
                ListIndexLabel[0]   = (int)(Library_SpriteStudio.KindLabelAnimationReserved.START | Library_SpriteStudio.KindLabelAnimationReserved.INDEX_RESERVED);
                ListFrameNoLabel[0] = 0;

                ListNameLabel[CountLabel - 1]    = Library_SpriteStudio.ListNameLabelAnimationReserved[(int)Library_SpriteStudio.KindLabelAnimationReserved.END];
                ListIndexLabel[CountLabel - 1]   = (int)(Library_SpriteStudio.KindLabelAnimationReserved.END | Library_SpriteStudio.KindLabelAnimationReserved.INDEX_RESERVED);
                ListFrameNoLabel[CountLabel - 1] = FrameNoLast;

                int IndexListLabelStart = -1;
                int IndexListLabelEnd   = -1;
                for (int i = 0; i < CountLabel; i++)
                {
                    if (ListIndexLabel[i] == Data.IndexLabelStart)
                    {
                        IndexListLabelStart = i;
                    }
                    if (ListIndexLabel[i] == Data.IndexLabelEnd)
                    {
                        IndexListLabelEnd = i;
                    }
                }
                if (0 > IndexListLabelStart)
                {
                    IndexListLabelStart = 0;
                }
                if (0 > IndexListLabelEnd)
                {
                    IndexListLabelEnd = CountLabel - 1;
                }

                int OffsetStart  = Data.FrameOffsetStart;
                int OffsetEnd    = Data.FrameOffsetEnd;
                int FrameNoStart = ListFrameNoLabel[IndexListLabelStart];
                int FrameNoEnd   = ListFrameNoLabel[IndexListLabelEnd];
                int IndexListLabelNow;
                int FrameNoLimit;

                /* Range "Start" */
                EditorGUILayout.LabelField("Range Start: (" + FrameNoStart.ToString()
                                           + " + "
                                           + OffsetStart.ToString()
                                           + ") = "
                                           + (FrameNoStart + OffsetStart).ToString()
                                           );

                /* Start-Label Select */
                IndexListLabelNow = EditorGUILayout.Popup("Range Start Label", IndexListLabelStart, ListNameLabel);
                if (IndexListLabelNow != IndexListLabelStart)
                {                       /* Data is valid & Changed Animation */
                    IndexListLabelStart = IndexListLabelNow;
                    FlagUpdate         |= true;
                }
                Data.IndexLabelStart = ListIndexLabel[IndexListLabelStart];
                FrameNoStart         = ListFrameNoLabel[IndexListLabelStart];

                /* Start-Offset */
                FrameNoLimit = FrameNoEnd + OffsetEnd;
                OffsetStart  = EditorGUILayout.IntField("Range Start Offset", Data.FrameOffsetStart);
                EditorGUILayout.LabelField("- Valid Value Range: Min[" + (-FrameNoStart).ToString() +
                                           "] to Max[" + ((FrameNoLimit - FrameNoStart) - 1).ToString() + "] "
                                           );

                OffsetStart = (FrameNoLimit <= (FrameNoStart + OffsetStart)) ? ((FrameNoLimit - FrameNoStart) - 1) : OffsetStart;
                OffsetStart = (0 > (FrameNoStart + OffsetStart)) ? (0 - FrameNoStart) : OffsetStart;
                OffsetStart = (FrameNoLast < (FrameNoStart + OffsetStart)) ? (FrameNoLast - FrameNoStart) : OffsetStart;
                if (Data.FrameOffsetStart != OffsetStart)
                {
                    Data.FrameOffsetStart = OffsetStart;
                    FlagUpdate           |= true;
                }
                EditorGUILayout.Space();

                /* Range "End" */
                EditorGUILayout.LabelField("Range End: (" + FrameNoEnd.ToString()
                                           + " + "
                                           + OffsetEnd.ToString()
                                           + ") = "
                                           + (FrameNoEnd + OffsetEnd).ToString()
                                           );

                /* End-Label Select */
                IndexListLabelNow = EditorGUILayout.Popup("Range End Label", IndexListLabelEnd, ListNameLabel);
                if (IndexListLabelNow != IndexListLabelEnd)
                {                       /* Data is valid & Changed Animation */
                    IndexListLabelEnd = IndexListLabelNow;
                    FlagUpdate       |= true;
                }
                Data.IndexLabelEnd = ListIndexLabel[IndexListLabelEnd];
                FrameNoEnd         = ListFrameNoLabel[IndexListLabelEnd];

                /* End-Offset */
                FrameNoLimit = FrameNoStart + OffsetStart;
                OffsetEnd    = EditorGUILayout.IntField("Range End Offset", Data.FrameOffsetEnd);
                EditorGUILayout.LabelField("- Valid Value Range: Min[" + ((FrameNoLimit - FrameNoEnd) + 1).ToString() +
                                           "] to Max[" + (FrameNoLast - FrameNoEnd).ToString() + "] "
                                           );

                OffsetEnd = (FrameNoLimit >= (FrameNoEnd + OffsetEnd)) ? ((FrameNoLimit - FrameNoEnd) + 1) : OffsetEnd;
                OffsetEnd = (0 > (FrameNoEnd + OffsetEnd)) ? (0 - FrameNoEnd) : OffsetEnd;
                OffsetEnd = (FrameNoLast < (FrameNoEnd + OffsetEnd)) ? (FrameNoLast - FrameNoEnd) : OffsetEnd;
                if (Data.FrameOffsetEnd != OffsetEnd)
                {
                    Data.FrameOffsetEnd = OffsetEnd;
                    FlagUpdate         |= true;
                }
                EditorGUILayout.Space();

                int FrameNoRangeStart = FrameNoStart + OffsetStart;
                int FrameNoRangeEnd   = FrameNoEnd + OffsetEnd;
                int CountFrameRange   = FrameNoRangeEnd - FrameNoRangeStart;
                int FrameNoOffset     = EditorGUILayout.IntField("Initial Start Offset", Data.FrameOffsetInitial);
                EditorGUILayout.LabelField("- Valid Value Range: Min[0] to Max[" + CountFrameRange.ToString() + "]");
                FrameNoOffset = (0 > FrameNoOffset) ? 0 : FrameNoOffset;
                FrameNoOffset = (CountFrameRange <= FrameNoOffset) ? CountFrameRange : FrameNoOffset;
                if (FrameNoOffset != Data.FrameOffsetInitial)
                {
                    Data.FrameOffsetInitial = FrameNoOffset;
                    FlagUpdate |= true;
                }

                EditorGUILayout.Space();
                bool FlagPingpongNow = EditorGUILayout.Toggle("Play-Pingpong", Data.FlagPingpong);
                if (FlagPingpongNow != Data.FlagPingpong)
                {
                    Data.FlagPingpong = FlagPingpongNow;
                    FlagUpdate       |= true;
                }

                EditorGUILayout.Space();
                if (0.0f == Data.RateSpeedInitial)
                {
                    Data.RateSpeedInitial = 1.0f;
                }
                float RateSpeedNow = EditorGUILayout.FloatField("Rate Time-Progress", Data.RateSpeedInitial);
                EditorGUILayout.LabelField("(set Negative-Value, Play Backwards.)");
                if (RateSpeedNow != Data.RateSpeedInitial)
                {
                    Data.RateSpeedInitial = RateSpeedNow;
                    FlagUpdate           |= true;
                }

                EditorGUILayout.Space();
                int TimesPlayNow = EditorGUILayout.IntField("Number of Plays", Data.TimesPlay);
                EditorGUILayout.LabelField("(1: No Loop / 0: Infinite Loop)");
                if (TimesPlayNow != Data.TimesPlay)
                {
                    Data.TimesPlay = TimesPlayNow;
                    FlagUpdate    |= true;
                }

                EditorGUILayout.Space();
                if (true == GUILayout.Button("Reset (Reinitialize)"))
                {
                    Data.IndexAnimation           = 0;
                    Data.FrameOffsetInitial       = 0;
                    Data.RateSpeedInitial         = 1.0f;
                    Data.TimesPlay                = 0;
                    Data.FlagPingpong             = false;
                    Data.IndexLabelStart          = (int)(Library_SpriteStudio.KindLabelAnimationReserved.START | Library_SpriteStudio.KindLabelAnimationReserved.INDEX_RESERVED);
                    Data.FrameOffsetStart         = 0;
                    Data.IndexLabelEnd            = (int)(Library_SpriteStudio.KindLabelAnimationReserved.END | Library_SpriteStudio.KindLabelAnimationReserved.INDEX_RESERVED);
                    Data.FrameOffsetEnd           = 0;
                    Data.FlagAnimationStopInitial = false;
                    FlagUpdate = true;                          /* Force */
                }

                /* Re-Play Animation */
                if (true == FlagUpdate)
                {
                    Data.AnimationPlay();
                    if (true == Data.FlagAnimationStopInitial)
                    {
                        Data.AnimationStop();
                    }
                }
            }
            else
            {
                EditorGUILayout.LabelField("Error[Datas Missing! (Fatal)]");
            }
        }
        EditorGUI.indentLevel = LevelIndent;
        EditorGUILayout.Space();

//		Data.FlagHideForce = EditorGUILayout.Toggle("Force-Hide", Data.FlagHideForce);
//		if(true == GUILayout.Button("Apply \"Force-Hide\" to Children"))
//		{
//			LibraryEditor_SpriteStudio.Utility.HideSetForce(Data.gameObject, Data.FlagHideForce, true, false);
//		}
//		EditorGUILayout.Space();

//		EditorGUILayout.Space();
//		if(true == GUILayout.Button("Reset Parent-\"View\""))
//		{
//			Data.ViewSet();
//		}

        if (true == GUI.changed)
        {
            EditorUtility.SetDirty(target);
        }
    }
Ejemplo n.º 20
0
 //アニメーションの終了コールバック
 public bool AnimEnd(Script_SpriteStudio_Root InstanceRoot, GameObject ObjectControl)
 {
     return(false);          //アニメ削除
 }