private void Awake()
    {
        Application.targetFrameRate = 60;

        // Title 지정
        title        = "수퍼연락처";
        isSelectCell = true;

        //편집버튼 생성 및 토글
        leftNavgationViewButton = Instantiate(buttonPrefab).GetComponent <SCButton>();
        leftNavgationViewButton.SetTitle((deleteMode) ? "완료" : "편집");
        leftNavgationViewButton.SetOnClickAction(() =>
        {
            deleteMode = !deleteMode;

            if (deleteMode)
            {
                isSelectCell = false;
                rightNavgationViewButton.SetInterlectable(false);
                leftNavgationViewButton.SetTitle("완료");
                foreach (Cell cell in cellList)
                {
                    cell.ActiveDelete = true;
                }
            }
            else
            {
                isSelectCell = true;
                rightNavgationViewButton.SetInterlectable(true);
                leftNavgationViewButton.SetTitle("편집");
                foreach (Cell cell in cellList)
                {
                    cell.ActiveDelete = false;
                }
            }
        });
        // Add 버튼 지정
        rightNavgationViewButton = Instantiate(buttonPrefab).GetComponent <SCButton>();
        rightNavgationViewButton.SetTitle(" + ");
        rightNavgationViewButton.SetOnClickAction(() =>
        {
            // AddPopupViewManager를 표시하는 동작 구현
            AddPopupViewManager addPopupViewManager =
                Instantiate(addPopupViewPrefab, mainManager.transform.parent.parent).GetComponent <AddPopupViewManager>();

            // 새로운 연락처를 추가했을때 할 일
            addPopupViewManager.addContactCallback = (contact) =>
            {
                AddContact(contact);
                ClearCell();
                LoadData();
            };
            // AddPopupViewManager 열기
            addPopupViewManager.Open();
        });
        //디폴트 이미지 지정
        defaultSprite = Resources.Load <Sprite>(Constant.kDefaultUserImage);
    }
Пример #2
0
    private void Awake()
    {
        // Title 지정
        title = "수퍼연락처";

        // Add 버튼 지정
        rightNavgationViewButton = Instantiate(buttonPrefab).GetComponent <SCButton>();
        rightNavgationViewButton.SetTitle("추가");
        rightNavgationViewButton.SetOnClickAction(() =>
        {
            // AddPopupViewManager를 표시하는 동작 구현
            AddPopupViewManager addPopupViewManager =
                Instantiate(addPopupViewPrefab, mainManager.transform).GetComponent <AddPopupViewManager>();

            // 새로운 연락처를 추가했을때 할 일
            addPopupViewManager.addContactCallback = (contact) =>
            {
                AddContact(contact);

                // AddCell(contact, contacts.Value.contactList.Count - 1);

                ClearCell();
                LoadData();
            };

            // AddPopupViewManager 열기
            addPopupViewManager.Open();
        });

        // 왼쪽 버튼 (Edit: 셀을 삭제할 수 있는 기능)
        leftNavgationViewButton = Instantiate(buttonPrefab).GetComponent <SCButton>();
        leftNavgationViewButton.SetTitle((isEditable) ? "완료" : "편집");
        leftNavgationViewButton.SetOnClickAction(() =>
        {
            isEditable = !isEditable;

            if (isEditable)
            {
                leftNavgationViewButton.SetTitle("완료");
                foreach (Cell cell in cellList)
                {
                    cell.ActiveDelete = true;
                }
                rightNavgationViewButton.SetInteractable(false);
            }
            else
            {
                leftNavgationViewButton.SetTitle("편집");
                foreach (Cell cell in cellList)
                {
                    cell.ActiveDelete = false;
                }

                rightNavgationViewButton.SetInteractable(true);
            }
        });
    }