This commit is contained in:
2020-07-04 14:41:25 +08:00
parent 70c346d2c1
commit a8f02e4da5
3748 changed files with 587372 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
using UnityEngine;
using System.Collections;
public class HUDTest : UIEventListener {
public Transform hudAnchor;
public Camera mGameCamera;
public Camera mUICamera;
public HUDText prefHudtxt;
HUDText hudtxt;
// Use this for initialization
void Start () {
if(hudtxt == null) {
hudtxt = Object.Instantiate(prefHudtxt) as HUDText;
hudtxt.transform.parent = HUDRoot.go.transform;
hudtxt.transform.localScale = Vector3.one;
hudtxt.transform.localPosition = Vector3.zero;
UIFollowTarget ft = hudtxt.gameObject.AddComponent<UIFollowTarget>();
ft.target = hudAnchor;
ft.setCamera(mGameCamera, mUICamera);
hudtxt.Add("Please click the cube...", Color.white, -1); //最后一个参数:-1 表示常驻
}
}
void OnClick() {
if(hudtxt == null) {
Start ();
}
hudtxt.Add(1, Color.red, 1);
}
void OnDrag(Vector2 delta) {
Vector3 off = new Vector3(delta.x, delta.y, 0);
transform.localPosition += (off*0.01f);
}
}