public override void OnInspectorGUI() { UIFollow follow = target as UIFollow; EditorTools.DrawUpdateKeyTextField(follow); base.OnInspectorGUI(); }
void InitItemUI(GameObject go) { if (m_perfab == null) { m_perfab = Resources.Load <GameObject> (m_perfabName); } GameObject UIObject = Instantiate(m_perfab); UIObject.name = "UI" + go.name; UIFollow uiFollow = go.AddComponent <UIFollow> (); //Debug.Log (go); uiFollow.m_follow = go; uiFollow.m_rectTransform = UIObject.GetComponent <RectTransform> (); uiFollow.m_offsetPos = new Vector3(0, 0, 0); uiFollow.Show(); m_lightTransforms.Add(uiFollow); UIObject.transform.SetParent(m_ligthUIParent.transform); }
void InitItemUI(string aName) { string perfabName = "UI/Mark/InvestigableMark"; if (perfab == null) { perfab = Skyunion.AssetsManager.LoadPrefabs <GameObject> (perfabName); } GameObject UIObject = Instantiate(perfab); UIObject.name = "UI" + aName; UIFollow uiFollow = UIObject.AddComponent <UIFollow> (); m_observableScript.Add(aName, uiFollow); uiFollow.m_followName = aName; uiFollow.m_follow = GameObject.Find("Obs/" + aName); uiFollow.m_rectTransform = UIObject.GetComponent <RectTransform> (); uiFollow.m_offsetPos = new Vector3(0, 10, 0); UIObject.transform.SetParent(m_sceneUI.transform); }
// Use this for initialization void Start() { hpBar.setValue(1); this.uiFollow = this.gameObject.GetComponent <UIFollow>(); if (this.uiFollow == null) { this.uiFollow = this.gameObject.AddComponent <UIFollow>(); } this.uiFollow.targetTransform = this.role.transform; this.uiFollow.uiTransform = this.hpBar.transform; this.uiFollow.offset = new Vector2(-this.hpBar.GetComponent <RectTransform>().sizeDelta.x / 2, 40); }
static int ResetPosition(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); UIFollow obj = (UIFollow)ToLua.CheckObject(L, 1, typeof(UIFollow)); obj.ResetPosition(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
/// <summary> /// 跟随目标 /// </summary> /// <param name="target"></param> public void FollowTarget(Transform target) { if (target == null) { return; } UIFollow follow = this.GetComponent <UIFollow>(); if (follow == null) { follow = this.gameObject.AddComponent <UIFollow>(); } follow.target = target; follow.Follow(); }
void Start() { // 初始化触控事件 EasyTouch.On_TouchDown += OnTouchDownHandler; EasyTouch.On_TouchUp += OnTouchUpHandler; //EasyTouch.On_PinchIn += OnPinchIn; //EasyTouch.On_PinchOut += OnPinchOut; EasyTouch.On_TouchUp2Fingers += OnTouchUp2Fingers; //TODODO 关闭屏幕长按旋转摄像机 //EasyTouch.On_LongTap += OnLongTap; // EasyTouch.On_DoubleTap += (gesture) => { }; // 边界控制器 m_ScrollObject = GetComponent <BoxScrollObject>(); // 本地化数据层数据 var cameraData = SData_mapdata.Single.GetDataOfID(1); m_CameraTurnaroundTime = cameraData.Camera_ZhuanshenTime; m_TerrainCellBianchang = cameraData.terrain_cell_bianchang; m_CameraYAroundMin = cameraData.CameraY_XuanzhuanMin; m_CameraYAroundMax = cameraData.CameraY_XuanzhuanMax; m_Camera_YOffsetMax = cameraData.Camera_YOffsetMax; m_Camera_YOffsetMin = cameraData.Camera_YOffsetMin; m_Camera_RotationMax = cameraData.Camera_RotationMax; m_Camera_RotationMin = cameraData.Camera_RotationMin; m_Camera_ZOffsetMax = cameraData.Camera_ZOffsetMax; m_Camera_ZOffsetMin = cameraData.Camera_ZOffsetMin; m_Camera_XOffsetMax = cameraData.Camera_XOffsetMax; m_Camera_XOffsetMin = cameraData.Camera_XOffsetMin; m_CameraTrnaroundSpeed = cameraData.CameraY_XuanzhuanSpeed; m_FreeCamera_Scale_Speed = cameraData.FreeCamera_Scale_Speed; m_Camera_Overall_Zoffset = cameraData.Camera_Overall_Zoffset; m_Camera_Overall_Yoffset = cameraData.Camera_Overall_Yoffset; m_Camera_Overall_Yrotate = cameraData.Camera_Overall_Yrotate; m_Camera_Overall_Xrotate = cameraData.Camera_Overall_Xrotate; uf = GetComponent <UIFollow>(); // 设置相机初始位置 transform.position = new Vector3(transform.position.x, transform.position.y + m_Camera_Overall_Yoffset, transform.position.z + m_Camera_Overall_Zoffset); transform.Rotate(Vector3.up, m_Camera_Overall_Yrotate); transform.Rotate(Vector3.right, m_Camera_Overall_Xrotate); }
static int get_freazeY(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UIFollow obj = (UIFollow)o; bool ret = obj.freazeY; LuaDLL.lua_pushboolean(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index freazeY on a nil value" : e.Message)); } }
static int set_Target(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UIFollow obj = (UIFollow)o; UnityEngine.Transform arg0 = (UnityEngine.Transform)ToLua.CheckUnityObject(L, 2, typeof(UnityEngine.Transform)); obj.Target = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Target on a nil value" : e.Message)); } }
static int set_smoothTime(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UIFollow obj = (UIFollow)o; float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); obj.smoothTime = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index smoothTime on a nil value" : e.Message)); } }
static int set_freazeZ(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UIFollow obj = (UIFollow)o; bool arg0 = LuaDLL.luaL_checkboolean(L, 2); obj.freazeZ = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index freazeZ on a nil value" : e.Message)); } }
static int get_Target(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UIFollow obj = (UIFollow)o; UnityEngine.Transform ret = obj.Target; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Target on a nil value" : e.Message)); } }
static int get_smoothTime(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UIFollow obj = (UIFollow)o; float ret = obj.smoothTime; LuaDLL.lua_pushnumber(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index smoothTime on a nil value" : e.Message)); } }