首次提交
This commit is contained in:
30
Assets/Plugins/FairyGUI/Examples/Model/ModelMain.cs
Normal file
30
Assets/Plugins/FairyGUI/Examples/Model/ModelMain.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
|
||||
public class ModelMain : MonoBehaviour
|
||||
{
|
||||
GComponent _mainView;
|
||||
|
||||
void Start()
|
||||
{
|
||||
Application.targetFrameRate = 60;
|
||||
Stage.inst.onKeyDown.Add(OnKeyDown);
|
||||
|
||||
_mainView = this.GetComponent<UIPanel>().ui;
|
||||
|
||||
Object prefab = Resources.Load("Role/npc");
|
||||
GameObject go = (GameObject)Object.Instantiate(prefab);
|
||||
go.transform.localPosition = new Vector3(61, -89, 1000); //set z to far from UICamera is important!
|
||||
go.transform.localScale = new Vector3(180, 180, 180);
|
||||
go.transform.localEulerAngles = new Vector3(0, 100, 0);
|
||||
_mainView.GetChild("holder").asGraph.SetNativeObject(new GoWrapper(go));
|
||||
}
|
||||
|
||||
void OnKeyDown(EventContext context)
|
||||
{
|
||||
if (context.inputEvent.keyCode == KeyCode.Escape)
|
||||
{
|
||||
Application.Quit();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user