コード例 #1
0
    void OnGUI()
    {
        GUI.Button(new Rect(0, 0, 100, 30), "Euipments 1");
        GUI.Button(new Rect(100, 0, 100, 30), "Euipments 2");
        GUI.Button(new Rect(200, 0, 100, 30), "Euipments 3");

        for (int i = 0; i < weapon_list.Length; i++)
        {
            if (GUI.Button(new Rect(i * 100, 30, 100, 50), "Weapon" + (weapon_list[i] ? "(√)" : "")))
            {
                if (!weapon_list [i])
                {
                    for (int j = 0; j < weapon_list.Length; j++)
                    {
                        weapon_list [j] = false;
                    }
                    weapon_list [i] = true;

                    character.ChangeWeapon("ch_we_one_hou_" + index[i]);
                }
            }
        }

        for (int i = 0; i < head_list.Length; i++)
        {
            if (GUI.Button(new Rect(i * 100, 80, 100, 50), "Head" + (head_list[i] ? "(√)" : "")))
            {
                if (!head_list [i])
                {
                    for (int j = 0; j < head_list.Length; j++)
                    {
                        head_list [j] = false;
                    }
                    head_list [i] = true;

                    character.ChangeHeadEquipment("ch_pc_hou_" + index[i] + "_tou", combine);
                }
            }
        }

        for (int i = 0; i < chest_list.Length; i++)
        {
            if (GUI.Button(new Rect(i * 100, 130, 100, 50), "Chest" + (chest_list[i] ? "(√)" : "")))
            {
                if (!chest_list [i])
                {
                    for (int j = 0; j < chest_list.Length; j++)
                    {
                        chest_list [j] = false;
                    }
                    chest_list [i] = true;

                    character.ChangeChestEquipment("ch_pc_hou_" + index[i] + "_shen", combine);
                }
            }
        }

        for (int i = 0; i < hand_list.Length; i++)
        {
            if (GUI.Button(new Rect(i * 100, 180, 100, 50), "Hand" + (hand_list[i] ? "(√)" : "")))
            {
                if (!hand_list [i])
                {
                    for (int j = 0; j < hand_list.Length; j++)
                    {
                        hand_list [j] = false;
                    }
                    hand_list [i] = true;

                    character.ChangeHandEquipment("ch_pc_hou_" + index[i] + "_shou", combine);
                }
            }
        }

        for (int i = 0; i < feet_list.Length; i++)
        {
            if (GUI.Button(new Rect(i * 100, 230, 100, 50), "Feet" + (feet_list[i] ? "(√)" : "")))
            {
                if (!feet_list [i])
                {
                    for (int j = 0; j < feet_list.Length; j++)
                    {
                        feet_list [j] = false;
                    }
                    feet_list [i] = true;

                    character.ChangeFeetEquipment("ch_pc_hou_" + index[i] + "_jiao", combine);
                }
            }
        }

        if (GUI.Button(new Rect(Screen.width - 100, 0, 100, 50), character.animationState == 0 ? "Attack" : "Stand"))
        {
            if (character.animationState == 0)
            {
                character.PlayAttack();
            }
            else
            {
                character.PlayStand();
            }
        }

        if (GUI.Button(new Rect(Screen.width - 100, 50, 100, 50), character.rotate ? "Static" : "Rotate"))
        {
            if (character.rotate)
            {
                character.rotate = false;
            }
            else
            {
                character.rotate = true;
            }
        }

        if (GUI.Button(new Rect(Screen.width - 150, 100, 150, 50), combine ? "Merge materials(√)" : "Merge materials"))
        {
            combine = !combine;
        }
    }