Reviewed-on: #4 Reviewed-by: Sehyeon <sehyeon1837@gmail.com> Reviewed-by: fiore <cjsdlf44@gmail.com>
This commit is contained in:
commit
03ce0ce347
File diff suppressed because one or more lines are too long
BIN
Assets/LYM/Scenes/MainUI.unity
(Stored with Git LFS)
BIN
Assets/LYM/Scenes/MainUI.unity
(Stored with Git LFS)
Binary file not shown.
@ -5,14 +5,18 @@ using UnityEngine.UI;
|
|||||||
|
|
||||||
public class MainUIPanelController : MonoBehaviour
|
public class MainUIPanelController : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
[SerializeField] private GameObject settingsPanelPrefab;
|
||||||
|
[SerializeField] private GameObject popupPanelPrefab;
|
||||||
|
|
||||||
public void OnClickStartButton()
|
public void OnClickStartButton()
|
||||||
{
|
{
|
||||||
|
var popupPanel = Instantiate(popupPanelPrefab, transform);
|
||||||
|
popupPanel.GetComponent<PopupPanelController>().Show("This is PopupPanel!!", () => {Debug.Log("Confirmed");});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnClickSettingsButton()
|
public void OnClickSettingsButton()
|
||||||
{
|
{
|
||||||
|
var settingsPanel = Instantiate(settingsPanelPrefab, transform);
|
||||||
|
settingsPanel.GetComponent<SettingsPanelController>().Show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,5 +26,6 @@ public class PanelController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (_canvasGroup == null) return;
|
if (_canvasGroup == null) return;
|
||||||
_canvasGroup.alpha = 0;
|
_canvasGroup.alpha = 0;
|
||||||
|
Destroy(gameObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
@ -8,26 +9,18 @@ public class PopupPanelController : PanelController
|
|||||||
{
|
{
|
||||||
[SerializeField] private GameObject confirmButton;
|
[SerializeField] private GameObject confirmButton;
|
||||||
[SerializeField] private GameObject contradictButton;
|
[SerializeField] private GameObject contradictButton;
|
||||||
|
[SerializeField] private TMP_Text popupText;
|
||||||
|
|
||||||
public delegate void OnConfirmDelegate();
|
public delegate void OnConfirmDelegate();
|
||||||
private OnConfirmDelegate _onConfirmDelegate;
|
private OnConfirmDelegate _onConfirmDelegate;
|
||||||
public delegate void OnContradictDelegate();
|
public delegate void OnContradictDelegate();
|
||||||
private OnContradictDelegate _onContradictDelegate;
|
private OnContradictDelegate _onContradictDelegate;
|
||||||
private void Start()
|
|
||||||
{
|
|
||||||
Show(false, "", () => {});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Show(bool isNeed2Contradict, string message, OnConfirmDelegate onConfirm)
|
public void Show(string message, OnConfirmDelegate onConfirm, OnContradictDelegate onContradict = null)
|
||||||
{
|
{
|
||||||
confirmButton.SetActive(isNeed2Contradict);
|
bool isNeed2Contradict = onContradict != null;
|
||||||
_onConfirmDelegate = onConfirm;
|
contradictButton.SetActive(isNeed2Contradict);
|
||||||
base.Show();
|
popupText.text = message;
|
||||||
}
|
|
||||||
|
|
||||||
public void Show(bool isNeed2Contradict, string message, OnConfirmDelegate onConfirm, OnContradictDelegate onContradict)
|
|
||||||
{
|
|
||||||
confirmButton.SetActive(isNeed2Contradict);
|
|
||||||
_onConfirmDelegate = onConfirm;
|
_onConfirmDelegate = onConfirm;
|
||||||
_onContradictDelegate = onContradict;
|
_onContradictDelegate = onContradict;
|
||||||
base.Show();
|
base.Show();
|
||||||
|
66
Assets/LYM/Scripts/SettingsPanelController.cs
Normal file
66
Assets/LYM/Scripts/SettingsPanelController.cs
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class SettingsPanelController : PanelController
|
||||||
|
{
|
||||||
|
|
||||||
|
[SerializeField] private SliderButton sfxSliderButton;
|
||||||
|
[SerializeField] private SliderButton bgmSliderButton;
|
||||||
|
[SerializeField] private Slider sfxSlider;
|
||||||
|
[SerializeField] private Slider bgmSlider;
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
InitSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitSettings()
|
||||||
|
{
|
||||||
|
//todo:저장된 데이터를 가져오게 해야함
|
||||||
|
var sfxIsActive = true;
|
||||||
|
var bgmIsActive = true;
|
||||||
|
sfxSliderButton.Init(sfxIsActive);
|
||||||
|
bgmSliderButton.Init(bgmIsActive);
|
||||||
|
//todo:저장된 데이터를 가져오게 해야함
|
||||||
|
var sfxSliderValue = 1f;
|
||||||
|
var bgmSliderValue = 1f;
|
||||||
|
sfxSlider.value = sfxSliderValue;
|
||||||
|
bgmSlider.value = bgmSliderValue;
|
||||||
|
Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
//버튼 클릭 시 마다 호출
|
||||||
|
public void SFXSliderButtonClicked()
|
||||||
|
{
|
||||||
|
sfxSliderButton.OnClicked();
|
||||||
|
//todo: sfxSliderButton.IsActive를 기준으로 뮤트 여부 확인 및 뮤트 적용
|
||||||
|
}
|
||||||
|
|
||||||
|
public void BGMSliderButtonClicked()
|
||||||
|
{
|
||||||
|
bgmSliderButton.OnClicked();
|
||||||
|
//todo: sfxSliderButton.IsActive를 기준으로 뮤트 여부 확인 및 뮤트 적용
|
||||||
|
}
|
||||||
|
|
||||||
|
//슬라이더 변경 시 마다 호출
|
||||||
|
public void OnSFXSliderValueChanged(float value)
|
||||||
|
{
|
||||||
|
//todo: 소리 볼륨 조절
|
||||||
|
Debug.Log("sfx changed value" + value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnBGMSliderValueChanged(float value)
|
||||||
|
{
|
||||||
|
//todo: 소리 볼륨 조절
|
||||||
|
Debug.Log("bgm changed value" + value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnCloseButtonClicked()
|
||||||
|
{
|
||||||
|
//todo: 설정 저장 필요
|
||||||
|
Hide();
|
||||||
|
}
|
||||||
|
}
|
11
Assets/LYM/Scripts/SettingsPanelController.cs.meta
Normal file
11
Assets/LYM/Scripts/SettingsPanelController.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3b8049d4c0267dd4481865a0eb1d5c3e
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
42
Assets/LYM/Scripts/SliderButton.cs
Normal file
42
Assets/LYM/Scripts/SliderButton.cs
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
using DG.Tweening;
|
||||||
|
|
||||||
|
public class SliderButton : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField] private Image backgroundImage;
|
||||||
|
[SerializeField] private GameObject handle;
|
||||||
|
|
||||||
|
public bool IsActive { get; private set; }
|
||||||
|
private int _offXLocation = -15;
|
||||||
|
private int _onXLocation = 15;
|
||||||
|
private Color32 _offColor = new Color32(125, 125, 125, 255);
|
||||||
|
private Color32 _onColor = new Color32(70, 255, 90, 255);
|
||||||
|
|
||||||
|
public void Init(bool isActive)
|
||||||
|
{
|
||||||
|
IsActive = isActive;
|
||||||
|
var xLocation = IsActive ? _onXLocation : _offXLocation;
|
||||||
|
var color = IsActive ? _onColor : _offColor;
|
||||||
|
handle.transform.localPosition = new Vector3(xLocation, handle.transform.localPosition.y, 0);
|
||||||
|
backgroundImage.color = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnClicked()
|
||||||
|
{
|
||||||
|
if (IsActive)
|
||||||
|
{
|
||||||
|
handle.transform.DOLocalMoveX(_offXLocation, 0.2f);
|
||||||
|
backgroundImage.DOColor(_offColor, 0.2f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
handle.transform.DOLocalMoveX(_onXLocation, 0.2f);
|
||||||
|
backgroundImage.DOColor(_onColor, 0.2f);
|
||||||
|
}
|
||||||
|
IsActive = !IsActive;
|
||||||
|
}
|
||||||
|
}
|
11
Assets/LYM/Scripts/SliderButton.cs.meta
Normal file
11
Assets/LYM/Scripts/SliderButton.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0da16f0ed11a3b14b9cf497a46f7abba
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
BIN
Assets/LYM/UIPrefabs/MainUIPanel.prefab
(Stored with Git LFS)
BIN
Assets/LYM/UIPrefabs/MainUIPanel.prefab
(Stored with Git LFS)
Binary file not shown.
BIN
Assets/LYM/UIPrefabs/PopupPanel.prefab
(Stored with Git LFS)
BIN
Assets/LYM/UIPrefabs/PopupPanel.prefab
(Stored with Git LFS)
Binary file not shown.
BIN
Assets/LYM/UIPrefabs/SettingsPanel.prefab
(Stored with Git LFS)
Normal file
BIN
Assets/LYM/UIPrefabs/SettingsPanel.prefab
(Stored with Git LFS)
Normal file
Binary file not shown.
7
Assets/LYM/UIPrefabs/SettingsPanel.prefab.meta
Normal file
7
Assets/LYM/UIPrefabs/SettingsPanel.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9fe584d3180d4924e97a2084be3b454e
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
x
Reference in New Issue
Block a user