77 lines
2.3 KiB
C#
77 lines
2.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using Debug = UnityEngine.Debug;
|
|
|
|
public class UI_TestPanel : BasePanel
|
|
{
|
|
//public Button testBtn1;
|
|
//public Button testBtn2;
|
|
//public Button testBtn3;
|
|
public Image imageTest;
|
|
public Text textTest;
|
|
public int testInt;
|
|
public string testString;
|
|
public Color testColor = new Color();
|
|
|
|
protected override void Awake()
|
|
{
|
|
base.Awake();
|
|
//testBtn1 = GetControl<Button>("testBtn1");
|
|
//testBtn2 = GetControl<Button>("testBtn2");
|
|
//testBtn3 = GetControl<Button>("testBtn3");
|
|
imageTest = GetControl<Image>("imageTest");
|
|
textTest = GetControl<Text>("textTest");
|
|
Bootstrap.Instance.eventCenter.AddEventListener(Enum_EventType.TestEvent1, UI_TestPanelTestFunc1);
|
|
}
|
|
|
|
private void UI_TestPanelTestFunc1()
|
|
{
|
|
testInt++;
|
|
Debug.Log("UI_TestPanel=TestFunc1收到信息==" + testInt);
|
|
}
|
|
|
|
public void OnInit()
|
|
{
|
|
Debug.Log("我被初始化了OnInit");
|
|
}
|
|
|
|
public override void ShowMe()
|
|
{
|
|
base.ShowMe();
|
|
Debug.Log("我显示出来我要干什么,比如我要通知别人干啥吗");
|
|
}
|
|
|
|
public override void HideMe()
|
|
{
|
|
base.HideMe();
|
|
Debug.Log("我关闭了,关闭我要什么");
|
|
}
|
|
|
|
protected override void OnClick(string btnPath)
|
|
{
|
|
base.OnClick(btnPath);
|
|
switch (btnPath)
|
|
{
|
|
case "testBtn1":
|
|
Debug.Log(1);
|
|
textTest.text = (testInt++).ToString();
|
|
break;
|
|
case "testBtn2":
|
|
Debug.Log(2);
|
|
testColor = new Color(Random.Range(1, 255f) / 255f, Random.Range(1, 255f) / 255f, Random.Range(1, 255f) / 255f, 1f);
|
|
imageTest.color = testColor;
|
|
break;
|
|
case "testBtn3":
|
|
Bootstrap.Instance.eventCenter.EventTrigger(Enum_EventType.TestEvent1);
|
|
Bootstrap.Instance.eventCenter.EventTrigger(Enum_EventType.TestEvent2, testInt);
|
|
textTest.text = "testBtn3333";
|
|
testString = $"<color={testColor}>{textTest.text + testInt}</color>";
|
|
Bootstrap.Instance.eventCenter.EventTrigger(Enum_EventType.TestEvent3, testString);
|
|
break;
|
|
}
|
|
}
|
|
}
|