112 lines
3.2 KiB
C#
112 lines
3.2 KiB
C#
using System;
|
|
using HK.Keyboard;
|
|
using Runtime;
|
|
using UnityEngine.UI;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.Serialization;
|
|
using ZGame;
|
|
|
|
namespace HK
|
|
{
|
|
public class Product3TextItem : UIItemBase
|
|
{
|
|
[SerializeField] private Button btnPositionUp;
|
|
[SerializeField] private Button btnPositionMiddle;
|
|
[SerializeField] private Button btnPositionDown;
|
|
[SerializeField] private TMP_InputField_Register tmpInputFieldRegister;
|
|
Book_M book;
|
|
|
|
public Action ClickAction;
|
|
// public Action<Vector2, Vector3, TextAlignmentOptions> ChangeTextAction;
|
|
|
|
public Vector2[] pos;
|
|
public Vector3[] angle;
|
|
public TextAlignmentOptions[] alignmentOptions;
|
|
|
|
public override void OnInit()
|
|
{
|
|
base.OnInit();
|
|
|
|
#region AutoGen_Init
|
|
|
|
btnPositionUp = GetValue<Button>("btnPositionUp");
|
|
btnPositionMiddle = GetValue<Button>("btnPositionMiddle");
|
|
btnPositionDown = GetValue<Button>("btnPositionDown");
|
|
tmpInputFieldRegister = GetValue<TMP_InputField_Register>("inpContent");
|
|
|
|
btnPositionUp.onClick.AddListener(OnClickbtnPositionUp);
|
|
btnPositionMiddle.onClick.AddListener(OnClickbtnPositionMiddle);
|
|
btnPositionDown.onClick.AddListener(OnClickbtnPositionDown);
|
|
|
|
#endregion
|
|
|
|
tmpInputFieldRegister.OKAction += ClickOK;
|
|
OnClickbtnPositionUp();
|
|
}
|
|
|
|
private void ClickOK()
|
|
{
|
|
ClickAction?.Invoke();
|
|
}
|
|
|
|
public void SetBook(Book_M book)
|
|
{
|
|
this.book = book;
|
|
}
|
|
|
|
public override void OnShow()
|
|
{
|
|
base.OnShow();
|
|
book.SetIndex(2);
|
|
EventManager.Instance.FireNow(this, new Product_DesignCover_SetShowEventArgs(false, true));
|
|
|
|
EventManager.Instance.FireNow(this, new Product2SetDesignCoverPositionEventArgs(2));
|
|
}
|
|
|
|
public override void OnHide()
|
|
{
|
|
base.OnHide();
|
|
}
|
|
|
|
#region AutoGen_Method
|
|
|
|
private void OnClickbtnPositionUp()
|
|
{
|
|
EventManager.Instance.FireNow(this,
|
|
new Product3SetTextPositionEventArgs(pos[0], angle[0], alignmentOptions[0]));
|
|
}
|
|
|
|
private void OnClickbtnPositionMiddle()
|
|
{
|
|
EventManager.Instance.FireNow(this,
|
|
new Product3SetTextPositionEventArgs(pos[1], angle[1], alignmentOptions[1]));
|
|
}
|
|
|
|
private void OnClickbtnPositionDown()
|
|
{
|
|
EventManager.Instance.FireNow(this,
|
|
new Product3SetTextPositionEventArgs(pos[2], angle[2], alignmentOptions[2]));
|
|
}
|
|
|
|
#endregion
|
|
|
|
public override void OnDispose()
|
|
{
|
|
base.OnDispose();
|
|
|
|
#region AutoGen_Dispose
|
|
|
|
btnPositionUp.onClick.RemoveListener(OnClickbtnPositionUp);
|
|
btnPositionMiddle.onClick.RemoveListener(OnClickbtnPositionMiddle);
|
|
btnPositionDown.onClick.RemoveListener(OnClickbtnPositionDown);
|
|
|
|
btnPositionUp = null;
|
|
btnPositionMiddle = null;
|
|
btnPositionDown = null;
|
|
// inpContent = null;
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
} |