Ejemplo n.º 1
0
    /// <summary>
    /// OnClickイベントの作成
    /// </summary>
    /// <param name="fishUI">UI単位をまとめるオブジェクト。</param>
    /// <param name="data">作成する魚のデータ</param>
    private void ClickEvent(GameObject fishUI, BioData data)
    {
        BiologicalManager _manager     = GetComponent <BiologicalManager>();
        FishManager       fish         = _manager.GetFishManager();
        Button            createButton = GetButtonComponent(fishUI, "CreateButton");

        createButton.onClick.AddListener(() =>
        {
            fish.FishCreate(data.GetBioType(), data.GetNameEn());
        });

        Button deleteButton = GetButtonComponent(fishUI, "DeleteButton");

        if (BioType.FISH == data.GetBioType())
        {
            deleteButton.onClick.AddListener(() => fish.ObjectDelete(data.GetNameEn()));
            return;
        }
        // 魚以外はDeleteButtonは使わないので削除
        Destroy(deleteButton.gameObject);
    }