// *********************************************************************** // Assembly : Game // Author : Kimch // Created : 2020-12-14 // Description : // Last Modified By : // Last Modified On : // *********************************************************************** // // // *********************************************************************** using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; namespace G.UI { /// /// /// 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 raycastResults = new List(); EventSystem.current.RaycastAll(new PointerEventData(EventSystem.current) { position = screenPoint, }, raycastResults); var rect = _goTarget.GetComponent(); foreach (var item in raycastResults) { //Debug.Log("Raycast" + item.gameObject.name); var tR = item.gameObject.GetComponent(); if (tR) { rect.position = tR.position; rect.sizeDelta = tR.sizeDelta; break; } } } #endregion #region Unity /// /// /// public override void Awake() { InitView(); } /// /// /// public override void OnEnable() { RefreshView(); } /// /// /// public override void Update() { UpdateView(); } #endregion } }