Я уже мог отображать всплывающую подсказку на каждой кнопке всякий раз, когда кнопка мыши наводит эту кнопку. Однако функция кнопки не выполнялась, но показана всплывающая подсказка.Показать функцию кнопки подсказки всплывающей подсказки не будет работать C#
Вот код:
public static float textHeight = 25;
public static float textWidth = 1350;
public static float buttonHeight = 25;
public static float buttonWidth = 100;
public static float screenTextHeight = 745;
public virtual void TurnOnGUI()
{
Rect buttonRect = new Rect(0, Screen.height - buttonHeight * 3, buttonWidth, buttonHeight);
Rect tooltipRect = new Rect(100 + 10, Screen.height - buttonHeight * 3 + 5, buttonWidth, buttonHeight);
Rect textRect = new Rect(10, Screen.height - screenTextHeight, textWidth, textHeight);
Rect _buttonRect = new Rect(0, Screen.height - buttonHeight * 2, buttonWidth, buttonHeight);
Rect _buttonRect_ = new Rect(0, Screen.height - buttonHeight * 1, buttonWidth, buttonHeight);
Rect _tooltipRect = new Rect(100 + 10, Screen.height - buttonHeight * 2 + 5, buttonWidth, buttonHeight);
Rect _tooltipRect_ = new Rect(100 + 10, Screen.height - buttonHeight * 1 + 5, buttonWidth, buttonHeight);
label1.normal.textColor = Color.red;
//Text Field
if (GUI.Button(textRect, ""))
{
}
//ToolTip Text
//GUI.Button(buttonRect, new GUIContent("Move", "Move the Player"));
//GUI.Label(tooltipRect, GUI.tooltip, label1);
GUI.tooltip = null;
//Move Button
if (GUI.Button(buttonRect, "Move"))
{
if (!moving)
{
GameManager.instance.RemoveTileHighlights();
moving = true;
attacking = false;
GameManager.instance.HighlightTilesAt(gridPosition, Color.blue, movementPerActionPoint);
}
else
{
moving = false;
attacking = false;
GameManager.instance.RemoveTileHighlights();
}
}
//ToolTip Text
//GUI.Button(_buttonRect, new GUIContent("Attack", "Attack the Player"));
//GUI.Label(_tooltipRect, GUI.tooltip, label1);
GUI.tooltip = null;
//Attack Button
if (GUI.Button(_buttonRect, "Attack"))
{
if (!attacking)
{
GameManager.instance.RemoveTileHighlights();
moving = false;
attacking = true;
GameManager.instance.HighlightTilesAt(gridPosition, Color.red, attackRange);
}
else
{
moving = false;
attacking = false;
GameManager.instance.RemoveTileHighlights();
}
}
//ToolTip Text
//GUI.Button(_buttonRect_, new GUIContent("End Turn", "End Turn the Player"));
//GUI.Label(_tooltipRect_, GUI.tooltip, label1);
GUI.tooltip = null;
//End Turn Button
if (GUI.Button(_buttonRect_, "End Turn"))
{
GameManager.instance.RemoveTileHighlights();
actionPoints = 2;
moving = false;
attacking = false;
GameManager.instance.NextTurn();
}
}
Вот скриншот (парения мыши на кнопку «Переместить» и сделать красный цвет всплывающей подсказки), подсказка отображается, но когда я нажмите кнопку «Переместить», это не будет работать (не будет отображаться синяя сетка для движения):
Но когда я удалить текст подсказки, «Переместить» функция кнопки запуска отлично:
Как я могу это решить? Благодаря
Спасибо, сэр, его работал сейчас ура – Kaoru