120 lines
2.5 KiB
C#
120 lines
2.5 KiB
C#
// ***********************************************************************
|
|
// Assembly : Game
|
|
// Author : Kimch
|
|
// Created : 2020-12-14
|
|
// Description :
|
|
// Last Modified By :
|
|
// Last Modified On :
|
|
// ***********************************************************************
|
|
// <copyright file= "GuideWindow" company="Kunpo"></copyright>
|
|
// <summary></summary>
|
|
// ***********************************************************************
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
|
|
namespace G.UI
|
|
{
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public partial class GuideWindow : KUIWindow
|
|
{
|
|
public class GuideInfo
|
|
{
|
|
public GameObject target;
|
|
public string targetPath;
|
|
public string talking;
|
|
public Vector2 talkingPoint;
|
|
public Vector2 talkingAnchor;
|
|
public Vector2 handPoint;
|
|
public int handAnimId;
|
|
public string handTips;
|
|
public float delay;
|
|
}
|
|
|
|
private static readonly GuideInfo _Empty = new GuideInfo();
|
|
public static GuideInfo Empty
|
|
{
|
|
get
|
|
{
|
|
_Empty.target = null;
|
|
_Empty.targetPath = null;
|
|
_Empty.talking = null;
|
|
_Empty.talkingPoint = Vector2.zero;
|
|
_Empty.talkingAnchor = Vector2.one * 0.5f;
|
|
_Empty.handPoint = Vector2.zero;
|
|
_Empty.handAnimId = 0;
|
|
_Empty.handTips = null;
|
|
_Empty.delay = 0f;
|
|
return _Empty;
|
|
}
|
|
}
|
|
|
|
#region Constructor
|
|
|
|
public GuideWindow()
|
|
: base(UILayer.kGuide, UIMode.kNone)
|
|
{
|
|
uiPath = "ui_common/ui_w_guide.prefab";
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Method
|
|
|
|
public void SetMaskPosition(Vector3 position, string name)
|
|
{
|
|
var screenPoint = RectTransformUtility.WorldToScreenPoint(KUIRoot.RootCamera, position);
|
|
List<RaycastResult> raycastResults = new List<RaycastResult>();
|
|
EventSystem.current.RaycastAll(new PointerEventData(EventSystem.current)
|
|
{
|
|
position = screenPoint,
|
|
}, raycastResults);
|
|
|
|
var rect = _goTarget.GetComponent<RectTransform>();
|
|
foreach (var item in raycastResults)
|
|
{
|
|
//Debug.Log("Raycast" + item.gameObject.name);
|
|
var tR = item.gameObject.GetComponent<RectTransform>();
|
|
if (tR)
|
|
{
|
|
rect.position = tR.position;
|
|
rect.sizeDelta = tR.sizeDelta;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Unity
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public override void Awake()
|
|
{
|
|
InitView();
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public override void OnEnable()
|
|
{
|
|
RefreshView();
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public override void Update()
|
|
{
|
|
UpdateView();
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|