2023-12-13 07:14:31 +00:00
|
|
|
using System;
|
|
|
|
using Sirenix.OdinInspector;
|
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
// ReSharper disable once CheckNamespace
|
|
|
|
namespace BlueWaterProject
|
|
|
|
{
|
|
|
|
[Serializable]
|
|
|
|
public class ProcessBar
|
|
|
|
{
|
2023-12-14 17:45:54 +00:00
|
|
|
[field: SerializeField] public GameObject Obj { get; set; }
|
|
|
|
[field: SerializeField] public Image Fill { get; set; }
|
|
|
|
|
2023-12-13 07:14:31 +00:00
|
|
|
public ProcessBar(GameObject obj, Image fill)
|
|
|
|
{
|
|
|
|
Obj = obj;
|
|
|
|
Fill = fill;
|
2023-12-14 17:45:54 +00:00
|
|
|
|
|
|
|
SetFillAmount(0f);
|
2023-12-13 07:14:31 +00:00
|
|
|
}
|
|
|
|
|
2023-12-14 17:45:54 +00:00
|
|
|
public void SetActive(bool value) => Obj.SetActive(value);
|
|
|
|
public void SetPosition(Vector3 value) => Obj.transform.position = value;
|
|
|
|
public void SetFillAmount(float value) => Fill.fillAmount = value;
|
2023-12-13 07:14:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public class OceanUi : MonoBehaviour
|
|
|
|
{
|
|
|
|
[field: SerializeField] public ProcessBar ProcessBar { get; set; }
|
|
|
|
|
|
|
|
private Canvas canvas;
|
|
|
|
|
|
|
|
private void Awake()
|
|
|
|
{
|
|
|
|
UiManager.Inst.OceanUi = this;
|
2023-12-14 17:45:54 +00:00
|
|
|
ProcessBar.SetActive(false);
|
2023-12-13 07:14:31 +00:00
|
|
|
}
|
2023-12-14 17:45:54 +00:00
|
|
|
|
|
|
|
private void Update()
|
|
|
|
{
|
|
|
|
if (ProcessBar.Obj.activeSelf)
|
|
|
|
{
|
|
|
|
var mousePos = Input.mousePosition;
|
|
|
|
ProcessBar.SetPosition(mousePos);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-13 07:14:31 +00:00
|
|
|
[Button("셋팅 초기화")]
|
|
|
|
private void Init()
|
|
|
|
{
|
|
|
|
canvas = GetComponent<Canvas>();
|
|
|
|
if (!canvas)
|
|
|
|
{
|
|
|
|
Debug.LogError("canvas is null error");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var processBar = canvas.transform.Find("ProcessBar").gameObject;
|
|
|
|
var fill = processBar.transform.Find("Fill").GetComponent<Image>();
|
|
|
|
ProcessBar = new ProcessBar(processBar, fill);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|