/// Just an initialization to get the cursor from the prefab and set it to NIGUI void Awake() { NIGUICursor cursor = gameObject.GetComponent(typeof(NIGUICursor)) as NIGUICursor; NIGUI.SetCursor(cursor); NIGUI.ResetGroups(); // to make sure we don't have any baggages... }
/// Method to set the cursor /// @note before starting to use NIGUI one MUST set a cursor (the prefab does that by /// setting it in the "awake" method. /// @param newCursor the new cursor to add public static void AddCursor(NIGUICursor newCursor) { //m_cursor=newCursor; if (m_cursors == null) { m_cursors = new List<NIGUICursor>(); } m_cursors.Add(newCursor); }
/// Method to set the cursor /// @note before starting to use NIGUI one MUST set a cursor (the prefab does that by /// setting it in the "awake" method. /// @param newCursor the new cursor to add public static void SetCursor(NIGUICursor newCursor) { m_cursor=newCursor; }
private static bool TestClicked(NIGUICursor cursor, ref Rect where, out Vector2 lastClickPosition) { int lastClickFrame; float lastClickTime; lastClickTime=cursor.GetLastClickedTime(out lastClickFrame,out lastClickPosition); if(lastClickTime<=m_lastClickTimeUsed) return false; // we already used or ignored that click. if (lastClickFrame < Time.frameCount - 1) return false; // if we are two frames back then we sure didn't miss it... if (CorrectRectForGroups(ref where) == false) return false; // the entire control was clipped. if (m_doingSlider) { if (where.Contains(m_sliderStartPos) == false || where.Contains(m_sliderEndPos) == false) return false; // we are doing a slider but are looking at a different controller } else { if (where.Contains(lastClickPosition) == false) return false; // this is not us } m_lastClickTimeUsed=Time.time; // we clicked now return true; }
private static bool TestClicked(NIGUICursor cursor, ref Rect where) { Vector2 pos; return TestClicked(cursor, ref where, out pos); }