public void Initialize(ePopupState _state, string _title, string _content, string _YesText, UnityAction _YesEvent, string _NoText, UnityAction _NoEvent) { Txt_Tile.text = _title; Txt_Contents.text = _content; Txt_Yes.text = _YesText; Btn_Yes.OnClick.AddListener(_YesEvent); // Btn_Yes 위치, 크기 조절 //Btn_Yes.GetComponent<RectTransform>().sizeDelta = new Vector2( // Txt_Yes.GetComponent<RectTransform>().rect.width, Btn_Yes.GetComponent<RectTransform>().rect.height); //Btn_Yes.transform.position = new Vector2( // Btn_Yes.GetComponent<RectTransform>().rect.width / 2, Btn_Yes.transform.position.y); Txt_No.text = _NoText; Btn_No.OnClick.AddListener(_NoEvent); //Btn_No 위치, 크기 조절 //Btn_No.GetComponent<RectTransform>().sizeDelta = new Vector2( // Txt_No.GetComponent<RectTransform>().rect.width, Btn_No.GetComponent<RectTransform>().rect.height); //Btn_No.transform.position = new Vector2( // -Btn_No.GetComponent<RectTransform>().rect.width / 2, Btn_No.transform.position.y); switch (_state) { case ePopupState.YesOrNo: Btn_Yes.gameObject.SetActive(true); Btn_No.gameObject.SetActive(true); break; case ePopupState.OnlyYes: Btn_Yes.gameObject.SetActive(true); Btn_Yes.gameObject.transform.localPosition = new Vector3(0, Btn_Yes.gameObject.transform.localPosition.y, 0); Btn_No.gameObject.SetActive(false); break; } }
public void ShowPopup_BossOrField(ePopupState _state, string _title, string _content, string _YesText, UnityAction _YesFunc, string _NoText, UnityAction _NoFunc) { GameObject popupObj = ResourceManager.GetOBJCreatePrefab("PrefabYesOrNoPopup", Obj_Position.transform); PrefabYesOrNoPopup popup = popupObj.GetComponent <PrefabYesOrNoPopup>(); // 추후 DB 또는 관리를 하나 만들어서 출력할 것 popup.Initialize(_state, _title, _content, _YesText, _YesFunc, _NoText, _NoFunc); }
public void ClearBossPopup(ePopupState _state, string _title, string _content, UnityAction _func) { GameObject popupObj = ResourceManager.GetOBJCreatePrefab("PrefabYesOrNoPopup", Obj_Position.transform); PrefabYesOrNoPopup popup = popupObj.GetComponent <PrefabYesOrNoPopup>(); // 추후 DB 또는 관리를 하나 만들어서 출력할 것 popup.Initialize(_state, _title, _content, _func); }
public void Initialize(ePopupState _state, string _title, string _content, UnityAction _YesEvent, UnityAction _NoEvent) { Txt_Tile.text = _title; Txt_Contents.text = _content; Btn_Yes.OnClick.AddListener(_YesEvent); Btn_No.OnClick.AddListener(_NoEvent); switch (_state) { case ePopupState.YesOrNo: Btn_Yes.gameObject.SetActive(true); Btn_No.gameObject.SetActive(true); break; case ePopupState.OnlyYes: Btn_Yes.gameObject.SetActive(true); Btn_Yes.gameObject.transform.localPosition = new Vector3(0, Btn_Yes.gameObject.transform.localPosition.y, 0); Btn_No.gameObject.SetActive(false); break; } }