Game Client Lee Hwanguk 2023. 4. 9. 16:08

#디파짓 시스템을 구현하는 UI를 만들고 있다. 유니티에서 화면 구상 하기전에 스케치를 먼저 해봤다.

 

#먼저 디파짓 시스템을 기획 할 필요가 있었다. 주요 시스템들을 시스템 기획서에 실었고, 디파짓 시스템기획 했다

#처음 기획에서 수정해야할 부분들을 수정하고 화면 구성을 먼저 해봤다

*구현해야할 시스템

1.UIDiposit (성기사 or 도적단) : 유저에게 디파짓 시스템에 대해 설명 해주는 text를 보여주고 수락 or 거절 버튼 배치.

 dim을 배치하여 dim 터치 시 UI창 비활성, X버튼을 누르더라도 비활성화 된다. 

 2.UIDipositPopup : 디파짓 UI에서 수락을 누르면 디파짓 할 금액을 보여주고 수락 or 거절 버튼 배치, UIDiposit과 똑같이 dim과 close버튼을 누르면 비활성화.

 

#Script

*UIDipositDirector

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class UIDipositDirector : MonoBehaviour
{
    public UIDiposit uiDiposit;
    public Button btnDeposit;
    public Action uiDeposit;
    private void Awake()
    {
        this.btnDeposit.onClick.AddListener(() => {
            this.uiDiposit.gameObject.SetActive(true);
        });
        this.uiDiposit.Init();
        
        this.uiDeposit = () => {
            Debug.Log("UIDiposit");    
        };
    }
}

 *UIDiposit

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class UIDiposit : MonoBehaviour
{
    //Close 창닫기
    public Button btnClose;
    public Button dim;

    //수락or거절 버튼
    public Button btnSelect;
    public Button btnCancel;

    //popup
    public UIDipositPopup uIDipositPopup;
    public void Init()
    {
        this.btnClose.onClick.AddListener(() => { 
            this.gameObject.SetActive(false);
        });

        this.dim.onClick.AddListener(() => {
            this.gameObject.SetActive(false);
        });

        this.btnSelect.onClick.AddListener(() => {
            this.uIDipositPopup.gameObject.SetActive(true);
        });

        this.btnCancel.onClick.AddListener(() => {
            this.gameObject.SetActive(false);
        });
        this.uIDipositPopup.Init();
    }
}

*UIDipositPopup

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class UIDipositPopup : MonoBehaviour
{
    public Button dim;
    public Button btnClose;

    public Button btnSelect;
    public Button btnCancel;

    public void Init()
    {
        this.dim.onClick.AddListener(() => { 
            this.gameObject.SetActive(false);
        });
        this.btnClose.onClick.AddListener(() => {
            this.gameObject.SetActive(false);

        });
        this.btnSelect.onClick.AddListener(() => {
            Debug.Log("Deposit 완료");
            this.gameObject.SetActive(false);
        });
        this.btnCancel.onClick.AddListener(() => {
            this.gameObject.SetActive(false);
        });
        this.gameObject.SetActive(false);
    }

}

 

#아직 수정하고 추가해야할 부분이 많다

 1. 디파짓 npc(기사단 or 도적단)이 서로 디파짓 유실율이 다르기 때문에 상황에 맞는 텍스트가 들어가야한다

    - 디파짓 시스템을 기획할때 유실율은 스테이지 진행에 따라 증가하는 쪽으로 만들어놓았다

 2. 디파짓 팝업에서 수락 버튼이 눌릴 시 액션을 정의하고 UI 총괄 디렉터에서 처리해줘야겠다