public UI3DFrame(Rect rect, Vector3 pos) { m_UIMove = new UIMove(); m_UIMove.Rect = rect; m_Pos = pos; this.Add(m_UIMove); this.SetUIHandler(this); }
public LSAnimation CreatMove(GameObject go, Transform targetPos, float time) { UIMove ani = new UIMove(); ani.gameObject = go; ani.targetTrans = targetPos; ani.gap = time; return(ani); }
protected override void Awake() { base.Awake(); if (ui == null) { ui = UIMove.instance; } score = forward ? 15 : 10; }
// Use this for initialization void Awake() { Input.backButtonLeavesApp = true; self = this; colorMap[0] = Color.green; colorMap[1] = Color.blue; colorMap[2] = new Color(0f, 1f, 1f); colorMap[3] = Color.black; colorMap[4] = Color.red; colorMap[5] = new Color(1f, 0f, 1f); colorMap[6] = new Color(1f, 1f, 0f); Mesh tileMesh = TilePrefab.GetComponent <MeshFilter>().sharedMesh; baseMainVerts = tileMesh.vertices; convertToSides(tileMesh, baseMainVerts, ref sideVerts); tileMesh.vertices = baseMainVerts; sideView = false; inventory = new Inventory(GameObject.FindGameObjectWithTag("inventory"), false); equipment = new Inventory(GameObject.FindGameObjectWithTag("equipS"), true); myCam = GameObject.FindGameObjectWithTag("Cam2").GetComponent <Camera> (); mainCam = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera> (); soundUI = myCam.transform.GetChild(1).GetComponent <AudioSource> (); soundEquip = myCam.transform.GetChild(2).GetComponent <AudioSource> (); playerLocation = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform> (); //playerAnim = playerLocation.GetComponent<Animator> (); //playerFollowL = GameObject.FindGameObjectWithTag ("PlayerFollow").GetComponent<Transform> (); UIInventory.SetActive(false); UINormal.SetActive(false); UIEdit.SetActive(false); UIMove.SetActive(false); UIChat.SetActive(false); UIStats.SetActive(false); UIHaS.SetActive(false); UICompass.SetActive(false); UIOptions.SetActive(false); chCam = chatCam.GetComponent <Camera> (); chCam.enabled = false; //chatCam.SetActive (false); selBox = GameObject.FindGameObjectWithTag("selectBox"); selCirc = GameObject.FindGameObjectWithTag("selectCircle"); selBox.SetActive(false); selCirc.SetActive(false); selectBox = selBox; foreach (EnemyType type in Enum.GetValues(EnemyType.archer.GetType())) { GameObject prefab = Resources.Load <GameObject>("Prefabs/enemy/" + type.ToString()); enemyPrefabs.Add(type, prefab); } }
static int __CreateInstance(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); if (LuaAPI.lua_gettop(L) == 1) { UIMove gen_ret = new UIMove(); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to UIMove constructor!")); }
public void HandleEvent(UIControl control, int command, float wparam, float lparam) { for (int i = 0; i < m_dragIcons.Count; i++) { UIMove uiMove = m_dragIcons[i].m_UIMove; UIImage uiImage = m_dragIcons[i].m_Image; if (control == uiMove) { if (command == (int)(UIMove.Command.MovePos)) { uiImage.Rect = new Rect(wparam - 0.5f * m_IconRect.width, lparam - 0.5f * m_IconRect.height, m_IconRect.width, m_IconRect.height); //m_Parent.SendEvent(this, (int)Command.DragMove, wparam, lparam); } else if (command == (int)(UIMove.Command.End)) { uiImage.Rect = uiMove.Rect; int inGrid = -1; for (int j = 0; j < m_dragIcons.Count; j++) { if (m_dragIcons[j].m_UIMove.Rect.Contains(new Vector2(wparam, lparam))) { inGrid = j; } } if (inGrid == -1) { uiImage.Rect = new Rect(-1000, -1000, 200, 200); m_Parent.SendEvent(this, (int)Command.DragOutSide, i, 0); } else { uiImage.Rect = m_dragIcons[inGrid].m_UIMove.Rect; m_Parent.SendEvent(this, (int)Command.DragExchange, i, inGrid); } } else if (command == (int)(UIMove.Command.Begin)) { //m_Parent.SendEvent(this, (int)Command.DragBegin, wparam, lparam); } } } }
static int _m_OnDrag(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UIMove gen_to_be_invoked = (UIMove)translator.FastGetCSObj(L, 1); { UnityEngine.EventSystems.PointerEventData _eventData = (UnityEngine.EventSystems.PointerEventData)translator.GetObject(L, 2, typeof(UnityEngine.EventSystems.PointerEventData)); gen_to_be_invoked.OnDrag(_eventData); return(0); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
/// <summary>Begins a new window! This will push a pose onto the transform stack, and all UI /// elements will be relative to that new pose. The pose is actually the top-center /// of the window. Must be finished with a call to UI.WindowEnd().</summary> /// <param name="text">Text to display on the window title, should be unique as it /// will be used as the window's id.</param> /// <param name="pose">The pose state for the window! If showHeader is true, the user /// will be able to grab this header and move it around.</param> /// <param name="size">Physical size of the window! Should be set to a non-zero value, otherwise /// it'll default to 32mm. If y is zero, it'll expand to contain all elements within it.</param> /// <param name="showHeader">Should the window show a header bar? Header bar includes a title, /// and is grabbable when it's visible.</param> /// <param name="moveType">Describes how the affordance will move when dragged around.</param> public static void WindowBegin(string text, ref Pose pose, Vec2 size, bool showHeader = true, UIMove moveType = UIMove.FaceUser) => NativeAPI.ui_window_begin(text, ref pose, size, showHeader, moveType);
/// <summary>This begins a new UI group with its own layout! Much like a window, except /// with a more flexible handle, and no header. You can draw the handle, but it will have /// no text on it.</summary> /// <param name="id">Id of the affordance group.</param> /// <param name="pose">The pose state for the affordance! The user will be able to grab /// this affordance and move it around.</param> /// <param name="handle">Size and location of the affordance handle, relative to the pose.</param> /// <param name="drawHandle">Should this function draw the handle for you, or will you /// draw that yourself?</param> /// <param name="moveType">Describes how the affordance will move when dragged around.</param> /// <returns>Returns true for every frame the user is grabbing the handle.</returns> public static bool AffordanceBegin(string id, ref Pose pose, Bounds handle, bool drawHandle = false, UIMove moveType = UIMove.Exact) => NativeAPI.ui_affordance_begin(id, ref pose, handle, drawHandle, moveType);
/// <summary>Begins a new window! This will push a pose onto the /// transform stack, and all UI elements will be relative to that new /// pose. The pose is actually the top-center of the window. Must be /// finished with a call to UI.WindowEnd(). This override omits the /// size value, so the size will be auto-calculated based on the /// content provided during the previous frame.</summary> /// <param name="text">Text to display on the window title, should be /// unique as it will be used as the window's id.</param> /// <param name="pose">The pose state for the window! If showHeader /// is true, the user will be able to grab this header and move it /// around.</param> /// <param name="windowType">Describes how the window should be drawn, /// use a header, a body, neither, or both?</param> /// <param name="moveType">Describes how the window will move when /// dragged around.</param> public static void WindowBegin(string text, ref Pose pose, UIWin windowType = UIWin.Normal, UIMove moveType = UIMove.FaceUser) => NativeAPI.ui_window_begin(text, ref pose, Vec2.Zero, windowType, moveType);
/// <summary>This begins and ends a handle so you can just use its /// grabbable/moveable functionality! Behaves much like a window, /// except with a more flexible handle, and no header. You can draw /// the handle, but it will have no text on it. Returns true for /// every frame the user is grabbing the handle.</summary> /// <param name="id">Id of the handle group.</param> /// <param name="pose">The pose state for the handle! The user will /// be able to grab this handle and move it around.</param> /// <param name="handle">Size and location of the handle, relative to /// the pose.</param> /// <param name="drawHandle">Should this function draw the handle for /// you, or will you draw that yourself?</param> /// <param name="moveType">Describes how the handle will move when /// dragged around.</param> /// <returns>Returns true for every frame the user is grabbing the /// handle.</returns> public static bool Handle(string id, ref Pose pose, Bounds handle, bool drawHandle = false, UIMove moveType = UIMove.Exact) { bool result = NativeAPI.ui_handle_begin(id, ref pose, handle, drawHandle, moveType); NativeAPI.ui_handle_end(); return(result); }
private void Start() { uiMove = GetComponent <UIMove>(); }