首次提交
This commit is contained in:
34
Assets/Plugins/FairyGUI/Examples/HeadBar/HeadBarMain.cs
Normal file
34
Assets/Plugins/FairyGUI/Examples/HeadBar/HeadBarMain.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
|
||||
public class HeadBarMain : MonoBehaviour
|
||||
{
|
||||
GComponent _mainView;
|
||||
|
||||
void Start()
|
||||
{
|
||||
Application.targetFrameRate = 60;
|
||||
|
||||
Stage.inst.onKeyDown.Add(OnKeyDown);
|
||||
|
||||
Transform npc = GameObject.Find("npc1").transform;
|
||||
UIPanel panel = npc.Find("HeadBar").GetComponent<UIPanel>();
|
||||
panel.ui.GetChild("name").text = "Long [color=#FFFFFF]Long[/color][img]ui://HeadBar/cool[/img] Name";
|
||||
panel.ui.GetChild("blood").asProgress.value = 75;
|
||||
panel.ui.GetChild("sign").asLoader.url = "ui://HeadBar/task";
|
||||
|
||||
npc = GameObject.Find("npc2").transform;
|
||||
panel = npc.Find("HeadBar").GetComponent<UIPanel>();
|
||||
panel.ui.GetChild("name").text = "Man2";
|
||||
panel.ui.GetChild("blood").asProgress.value = 25;
|
||||
panel.ui.GetChild("sign").asLoader.url = "ui://HeadBar/fighting";
|
||||
}
|
||||
|
||||
void OnKeyDown(EventContext context)
|
||||
{
|
||||
if (context.inputEvent.keyCode == KeyCode.Escape)
|
||||
{
|
||||
Application.Quit();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user