[HOTFIX] UIManager Refactor
This commit is contained in:
parent
59244e8050
commit
962ccfbfe7
@ -12310,6 +12310,7 @@ GameObject:
|
|||||||
- component: {fileID: 957212529}
|
- component: {fileID: 957212529}
|
||||||
- component: {fileID: 957212528}
|
- component: {fileID: 957212528}
|
||||||
- component: {fileID: 957212527}
|
- component: {fileID: 957212527}
|
||||||
|
- component: {fileID: 957212531}
|
||||||
m_Layer: 5
|
m_Layer: 5
|
||||||
m_Name: Canvas
|
m_Name: Canvas
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@ -12400,6 +12401,19 @@ RectTransform:
|
|||||||
m_AnchoredPosition: {x: 0, y: 0}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 0, y: 0}
|
m_SizeDelta: {x: 0, y: 0}
|
||||||
m_Pivot: {x: 0, y: 0}
|
m_Pivot: {x: 0, y: 0}
|
||||||
|
--- !u!114 &957212531
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 957212526}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 06c19c0e062e84c169aca3af92060883, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
_persistent: 0
|
||||||
--- !u!1 &957702341
|
--- !u!1 &957702341
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -14151,7 +14165,7 @@ GameObject:
|
|||||||
- component: {fileID: 1072594281}
|
- component: {fileID: 1072594281}
|
||||||
- component: {fileID: 1072594284}
|
- component: {fileID: 1072594284}
|
||||||
m_Layer: 5
|
m_Layer: 5
|
||||||
m_Name: UIPopup
|
m_Name: BuildListPopup
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
|
@ -69,7 +69,16 @@ namespace BlueWaterProject
|
|||||||
|
|
||||||
private void OnBuildMode(InputValue value)
|
private void OnBuildMode(InputValue value)
|
||||||
{
|
{
|
||||||
|
var buildListPopup = UiManager.Inst.TycoonUi.BuildListPopup;
|
||||||
|
|
||||||
|
if (buildListPopup.gameObject.activeSelf)
|
||||||
|
{
|
||||||
|
buildListPopup.Hide();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buildListPopup.Show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnCancel(InputValue value)
|
private void OnCancel(InputValue value)
|
||||||
@ -140,62 +149,61 @@ namespace BlueWaterProject
|
|||||||
|
|
||||||
public void StartInteraction(Transform target)
|
public void StartInteraction(Transform target)
|
||||||
{
|
{
|
||||||
interactionTarget = target;
|
// interactionTarget = target;
|
||||||
interactionTarget.GetComponent<InShipNpc>()?.ChangeStateToInteraction();
|
// interactionTarget.GetComponent<InShipNpc>()?.ChangeStateToInteraction();
|
||||||
|
//
|
||||||
var targetPosition = interactionTarget.position;
|
// var targetPosition = interactionTarget.position;
|
||||||
var playerPosition = transform.position;
|
// var playerPosition = transform.position;
|
||||||
|
//
|
||||||
var directionToTarget = (targetPosition - playerPosition).normalized;
|
// var directionToTarget = (targetPosition - playerPosition).normalized;
|
||||||
|
//
|
||||||
// 캐릭터가 NPC의 왼쪽 또는 오른쪽에 있는지 확인
|
// // 캐릭터가 NPC의 왼쪽 또는 오른쪽에 있는지 확인
|
||||||
var crossProduct = Vector3.Cross(directionToTarget, transform.forward).y;
|
// var crossProduct = Vector3.Cross(directionToTarget, transform.forward).y;
|
||||||
|
//
|
||||||
Vector3 desiredPosition;
|
// Vector3 desiredPosition;
|
||||||
float desiredScaleX; // 캐릭터의 방
|
// float desiredScaleX; // 캐릭터의 방
|
||||||
|
//
|
||||||
if (crossProduct > 0) // 캐릭터가 NPC의 왼쪽에 있는 경우
|
// if (crossProduct > 0) // 캐릭터가 NPC의 왼쪽에 있는 경우
|
||||||
{
|
// {
|
||||||
desiredPosition = targetPosition + interactionTarget.right * 2f;
|
// desiredPosition = targetPosition + interactionTarget.right * 2f;
|
||||||
desiredScaleX = 1f; // 오른쪽을 바라봄
|
// desiredScaleX = 1f; // 오른쪽을 바라봄
|
||||||
}
|
// }
|
||||||
else // 캐릭터가 NPC의 오른쪽에 있는 경우
|
// else // 캐릭터가 NPC의 오른쪽에 있는 경우
|
||||||
{
|
// {
|
||||||
desiredPosition = targetPosition + interactionTarget.right * -2f;
|
// desiredPosition = targetPosition + interactionTarget.right * -2f;
|
||||||
desiredScaleX = -1f; // 왼쪽을 바라봄
|
// desiredScaleX = -1f; // 왼쪽을 바라봄
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// 장애물 감지
|
// // 장애물 감지
|
||||||
if (Physics.Raycast(playerPosition, (desiredPosition - playerPosition).normalized, Vector3.Distance(playerPosition, desiredPosition), LayerMask.GetMask("Obstacle")))
|
// if (Physics.Raycast(playerPosition, (desiredPosition - playerPosition).normalized, Vector3.Distance(playerPosition, desiredPosition), LayerMask.GetMask("Obstacle")))
|
||||||
{
|
// {
|
||||||
// 장애물이 감지되면, 반대쪽으로 이동
|
// // 장애물이 감지되면, 반대쪽으로 이동
|
||||||
desiredPosition = crossProduct > 0 ? targetPosition + interactionTarget.right * -2f : targetPosition + interactionTarget.right * 2f;
|
// desiredPosition = crossProduct > 0 ? targetPosition + interactionTarget.right * -2f : targetPosition + interactionTarget.right * 2f;
|
||||||
desiredScaleX = -desiredScaleX; // 방향을 반전
|
// desiredScaleX = -desiredScaleX; // 방향을 반전
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// 캐릭터를 원하는 위치와 방향으로 부드럽게 이동 및 회전
|
// // 캐릭터를 원하는 위치와 방향으로 부드럽게 이동 및 회전
|
||||||
StartCoroutine(MoveCharacterToPosition(desiredPosition, desiredScaleX));
|
// StartCoroutine(MoveCharacterToPosition(desiredPosition, desiredScaleX));
|
||||||
UiManager.Inst.InShipInteraction.gameObject.SetActive(true);
|
// UiManager.Inst.InShipInteraction.gameObject.SetActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartConversation()
|
public void StartConversation()
|
||||||
{
|
{
|
||||||
if (interactionTarget != null)
|
// if (interactionTarget != null)
|
||||||
{
|
// {
|
||||||
interactionTarget.GetComponent<DialogueSystemTrigger>().OnConversationStart(interactionTarget);
|
// interactionTarget.GetComponent<DialogueSystemTrigger>().OnConversationStart(interactionTarget);
|
||||||
UiManager.Inst.InShipInteraction.gameObject.SetActive(false);
|
// UiManager.Inst.InShipInteraction.gameObject.SetActive(false);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EndInteraction()
|
public void EndInteraction()
|
||||||
{
|
{
|
||||||
interactionTarget.GetComponent<InShipNpc>()?.RestoreState();
|
//interactionTarget.GetComponent<InShipNpc>()?.RestoreState();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EndConversation()
|
public void EndConversation()
|
||||||
{
|
{
|
||||||
UiManager.Inst.InShipInteraction.gameObject.SetActive(true);
|
//UiManager.Inst.InShipInteraction.gameObject.SetActive(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
22
BlueWater/Assets/02.Scripts/Tycoon/TycoonUi.cs
Normal file
22
BlueWater/Assets/02.Scripts/Tycoon/TycoonUi.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using BlueWaterProject;
|
||||||
|
using Doozy.Runtime.UIManager.Containers;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class TycoonUi : MonoBehaviour
|
||||||
|
{
|
||||||
|
public UIPopup BuildListPopup { get; set; }
|
||||||
|
|
||||||
|
private void Init()
|
||||||
|
{
|
||||||
|
UiManager.Inst.TycoonUi = this;
|
||||||
|
BuildListPopup = transform.Find("BuildListPopup").GetComponent<UIPopup>();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
Init();
|
||||||
|
}
|
||||||
|
}
|
11
BlueWater/Assets/02.Scripts/Tycoon/TycoonUi.cs.meta
Normal file
11
BlueWater/Assets/02.Scripts/Tycoon/TycoonUi.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 54648b16fa3ac47d9bc7543e261ac76e
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -1,3 +1,4 @@
|
|||||||
|
using Doozy.Runtime.UIManager.Containers;
|
||||||
using Sirenix.OdinInspector;
|
using Sirenix.OdinInspector;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@ -10,23 +11,11 @@ namespace BlueWaterProject
|
|||||||
[Title("Mouse")]
|
[Title("Mouse")]
|
||||||
private Texture2D cursorTexture;
|
private Texture2D cursorTexture;
|
||||||
|
|
||||||
[Title("InteractionUI")]
|
|
||||||
private Transform defaultInteraction;
|
|
||||||
public Transform InShipInteraction { get; set; }
|
|
||||||
|
|
||||||
public OceanUi OceanUi { get; set; }
|
public OceanUi OceanUi { get; set; }
|
||||||
|
|
||||||
|
[Title("Tycoon")]
|
||||||
|
public TycoonUi TycoonUi { get; set; }
|
||||||
|
|
||||||
private void Init()
|
|
||||||
{
|
|
||||||
defaultInteraction = transform.Find("DefaultInteraction");
|
|
||||||
InShipInteraction = transform.Find("InShipPlayerInteractionUI");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnAwake()
|
|
||||||
{
|
|
||||||
Init();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user