Compare commits

..

No commits in common. "03ce0ce3471bffe19415ce3b8686ca38b839f01a" and "5dcde907a1aeaf3342b5f3dc5259ae37026fd176" have entirely different histories.

13 changed files with 72 additions and 318 deletions

File diff suppressed because one or more lines are too long

BIN
Assets/LYM/Scenes/MainUI.unity (Stored with Git LFS)

Binary file not shown.

View File

@ -5,18 +5,14 @@ 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();
} }
} }

View File

@ -26,6 +26,5 @@ public class PanelController : MonoBehaviour
{ {
if (_canvasGroup == null) return; if (_canvasGroup == null) return;
_canvasGroup.alpha = 0; _canvasGroup.alpha = 0;
Destroy(gameObject);
} }
} }

View File

@ -1,7 +1,6 @@
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;
@ -9,18 +8,26 @@ 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()
public void Show(string message, OnConfirmDelegate onConfirm, OnContradictDelegate onContradict = null)
{ {
bool isNeed2Contradict = onContradict != null; Show(false, "", () => {});
contradictButton.SetActive(isNeed2Contradict); }
popupText.text = message;
public void Show(bool isNeed2Contradict, string message, OnConfirmDelegate onConfirm)
{
confirmButton.SetActive(isNeed2Contradict);
_onConfirmDelegate = onConfirm;
base.Show();
}
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();

View File

@ -1,66 +0,0 @@
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();
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 3b8049d4c0267dd4481865a0eb1d5c3e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,42 +0,0 @@
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;
}
}

View File

@ -1,11 +0,0 @@
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)

Binary file not shown.

BIN
Assets/LYM/UIPrefabs/PopupPanel.prefab (Stored with Git LFS)

Binary file not shown.

BIN
Assets/LYM/UIPrefabs/SettingsPanel.prefab (Stored with Git LFS)

Binary file not shown.

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 9fe584d3180d4924e97a2084be3b454e
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: