示例#1
0
 private void OnScheme()
 {
     if (this.target != null)
     {
         UICamera.ControlScheme currentScheme = UICamera.currentScheme;
         if (currentScheme == UICamera.ControlScheme.Mouse)
         {
             this.target.SetActive(this.mouse);
         }
         else
         {
             if (currentScheme == UICamera.ControlScheme.Touch)
             {
                 this.target.SetActive(this.touch);
             }
             else
             {
                 if (currentScheme == UICamera.ControlScheme.Controller)
                 {
                     this.target.SetActive(this.controller);
                 }
             }
         }
     }
 }
示例#2
0
 void OnScheme()
 {
     if (target != null)
     {
         UICamera.ControlScheme scheme = UICamera.currentScheme;
         if (scheme == UICamera.ControlScheme.Mouse)
         {
             target.SetActive(mouse);
         }
         else if (scheme == UICamera.ControlScheme.Touch)
         {
             target.SetActive(touch);
         }
         else if (scheme == UICamera.ControlScheme.Controller)
         {
             target.SetActive(controller);
         }
     }
 }
示例#3
0
 protected static void SetSelection(GameObject go, UICamera.ControlScheme scheme)
 {
     if (UICamera.mNextSelection != null)
     {
         UICamera.mNextSelection = go;
     }
     else if (UICamera.mCurrentSelection != go)
     {
         UICamera.mNextSelection = go;
         UICamera.mNextScheme    = scheme;
         if (UICamera.list.size > 0)
         {
             UICamera uICamera = (!(UICamera.mNextSelection != null)) ? UICamera.list[0] : UICamera.FindCameraForLayer(UICamera.mNextSelection.layer);
             if (uICamera != null)
             {
                 uICamera.StartCoroutine(uICamera.ChangeSelection());
             }
         }
     }
 }
示例#4
0
    /// <summary>
    /// Localize the specified value.
    /// </summary>

    static public string Get(string key)
    {
        // Ensure we have a language to work with
        if (!localizationHasBeenSet)
        {
            LoadDictionary(PlayerPrefs.GetString("Language", "English"));
        }

        if (mLanguages == null)
        {
            Debug.LogError("No localization data present");
            return(null);
        }

        string lang = language;

        if (mLanguageIndex == -1)
        {
            for (int i = 0; i < mLanguages.Length; ++i)
            {
                if (mLanguages[i] == lang)
                {
                    mLanguageIndex = i;
                    break;
                }
            }
        }

        if (mLanguageIndex == -1)
        {
            mLanguageIndex = 0;
            mLanguage      = mLanguages[0];
            Debug.LogWarning("Language not found: " + lang);
        }

        string val;

        string[] vals;

        UICamera.ControlScheme scheme = UICamera.currentScheme;


        if (scheme == UICamera.ControlScheme.Touch)
        {
            string altKey = key + " Mobile";
            if (mReplacement.TryGetValue(altKey, out val))
            {
                return(val);
            }

            if (mLanguageIndex != -1 && mDictionary.TryGetValue(altKey, out vals))
            {
                if (mLanguageIndex < vals.Length)
                {
                    return(vals[mLanguageIndex]);
                }
            }
            if (mOldDictionary.TryGetValue(altKey, out val))
            {
                return(val);
            }
        }
        else if (scheme == UICamera.ControlScheme.Controller)
        {
            string altKey = key + " Controller";
            if (mReplacement.TryGetValue(altKey, out val))
            {
                return(val);
            }

            if (mLanguageIndex != -1 && mDictionary.TryGetValue(altKey, out vals))
            {
                if (mLanguageIndex < vals.Length)
                {
                    return(vals[mLanguageIndex]);
                }
            }
            if (mOldDictionary.TryGetValue(altKey, out val))
            {
                return(val);
            }
        }

        if (mReplacement.TryGetValue(key, out val))
        {
            return(val);
        }

        if (mLanguageIndex != -1 && mDictionary.TryGetValue(key, out vals))
        {
            if (mLanguageIndex < vals.Length)
            {
                string s = vals[mLanguageIndex];
                if (string.IsNullOrEmpty(s))
                {
                    s = vals[0];
                }
                return(s);
            }
            return(vals[0]);
        }
        if (mOldDictionary.TryGetValue(key, out val))
        {
            return(val);
        }

#if UNITY_EDITOR && !DLL_TYPE
        Debug.LogWarning("Localization key not found: '" + key + "' for language " + lang);
#endif
        return(key);
    }
示例#5
0
    void OnGUI()
    {
        Rect rect = new Rect(5f, 5f, 1000f, 22f);

        if (mRayDebug)
        {
            UICamera.ControlScheme scheme = UICamera.currentScheme;
            string text = "Scheme: " + scheme;
            GUI.color = Color.black;
            GUI.Label(rect, text);
            rect.y   -= 1f;
            rect.x   -= 1f;
            GUI.color = Color.white;
            GUI.Label(rect, text);
            rect.y += 18f;
            rect.x += 1f;

            text      = "Hover: " + NGUITools.GetHierarchy(UICamera.hoveredObject).Replace("\"", "");
            GUI.color = Color.black;
            GUI.Label(rect, text);
            rect.y   -= 1f;
            rect.x   -= 1f;
            GUI.color = Color.white;
            GUI.Label(rect, text);
            rect.y += 18f;
            rect.x += 1f;

            text      = "Selection: " + NGUITools.GetHierarchy(UICamera.selectedObject).Replace("\"", "");
            GUI.color = Color.black;
            GUI.Label(rect, text);
            rect.y   -= 1f;
            rect.x   -= 1f;
            GUI.color = Color.white;
            GUI.Label(rect, text);
            rect.y += 18f;
            rect.x += 1f;

            text      = "Controller: " + NGUITools.GetHierarchy(UICamera.controllerNavigationObject).Replace("\"", "");
            GUI.color = Color.black;
            GUI.Label(rect, text);
            rect.y   -= 1f;
            rect.x   -= 1f;
            GUI.color = Color.white;
            GUI.Label(rect, text);
            rect.y += 18f;
            rect.x += 1f;

            text = "Active events: " + UICamera.CountInputSources();
            if (UICamera.disableController)
            {
                text += ", disabled controller";
            }
            if (UICamera.ignoreControllerInput)
            {
                text += ", ignore controller";
            }
            if (UICamera.inputHasFocus)
            {
                text += ", input focus";
            }
            GUI.color = Color.black;
            GUI.Label(rect, text);
            rect.y   -= 1f;
            rect.x   -= 1f;
            GUI.color = Color.white;
            GUI.Label(rect, text);
            rect.y += 18f;
            rect.x += 1f;
        }

        for (int i = 0, imax = mLines.Count; i < imax; ++i)
        {
            GUI.color = Color.black;
            GUI.Label(rect, mLines[i]);
            rect.y   -= 1f;
            rect.x   -= 1f;
            GUI.color = Color.white;
            GUI.Label(rect, mLines[i]);
            rect.y += 18f;
            rect.x += 1f;
        }
    }
示例#6
0
    public static string Get(string key, bool warnIfMissing = true)
    {
        if (string.IsNullOrEmpty(key))
        {
            return(null);
        }
        if (!Localization.localizationHasBeenSet)
        {
            Localization.LoadDictionary(PlayerPrefs.GetString("Language", "English"), false);
        }
        if (Localization.mLanguages == null)
        {
            Debug.LogError("No localization data present");
            return(null);
        }
        string language = Localization.language;

        if (Localization.mLanguageIndex == -1)
        {
            for (int i = 0; i < Localization.mLanguages.Length; i++)
            {
                if (Localization.mLanguages[i] == language)
                {
                    Localization.mLanguageIndex = i;
                    break;
                }
            }
        }
        if (Localization.mLanguageIndex == -1)
        {
            Localization.mLanguageIndex = 0;
            Localization.mLanguage      = Localization.mLanguages[0];
            Debug.LogWarning("Language not found: " + language);
        }
        UICamera.ControlScheme currentScheme = UICamera.currentScheme;
        string result;

        string[] array;
        if (currentScheme == UICamera.ControlScheme.Touch)
        {
            string key2 = key + " Mobile";
            if (Localization.mReplacement.TryGetValue(key2, out result))
            {
                return(result);
            }
            if (Localization.mLanguageIndex != -1 && Localization.mDictionary.TryGetValue(key2, out array) && Localization.mLanguageIndex < array.Length)
            {
                return(array[Localization.mLanguageIndex]);
            }
            if (Localization.mOldDictionary.TryGetValue(key2, out result))
            {
                return(result);
            }
        }
        else if (currentScheme == UICamera.ControlScheme.Controller)
        {
            string key3 = key + " Controller";
            if (Localization.mReplacement.TryGetValue(key3, out result))
            {
                return(result);
            }
            if (Localization.mLanguageIndex != -1 && Localization.mDictionary.TryGetValue(key3, out array) && Localization.mLanguageIndex < array.Length)
            {
                return(array[Localization.mLanguageIndex]);
            }
            if (Localization.mOldDictionary.TryGetValue(key3, out result))
            {
                return(result);
            }
        }
        if (Localization.mReplacement.TryGetValue(key, out result))
        {
            return(result);
        }
        if (Localization.mLanguageIndex != -1 && Localization.mDictionary.TryGetValue(key, out array))
        {
            if (Localization.mLanguageIndex < array.Length)
            {
                string text = array[Localization.mLanguageIndex];
                if (string.IsNullOrEmpty(text))
                {
                    text = array[0];
                }
                return(text);
            }
            return(array[0]);
        }
        else
        {
            if (Localization.mOldDictionary.TryGetValue(key, out result))
            {
                return(result);
            }
            return(key);
        }
    }
示例#7
0
    // Token: 0x060003B7 RID: 951 RVA: 0x000224E4 File Offset: 0x000206E4
    public static bool Has(string key)
    {
        if (string.IsNullOrEmpty(key))
        {
            return(false);
        }
        if (!Localization.localizationHasBeenSet)
        {
            Localization.LoadDictionary(PlayerPrefs.GetString("Language", "English"), false);
        }
        if (Localization.mLanguages == null)
        {
            return(false);
        }
        string language = Localization.language;

        if (Localization.mLanguageIndex == -1)
        {
            for (int i = 0; i < Localization.mLanguages.Length; i++)
            {
                if (Localization.mLanguages[i] == language)
                {
                    Localization.mLanguageIndex = i;
                    break;
                }
            }
        }
        if (Localization.mLanguageIndex == -1)
        {
            Localization.mLanguageIndex = 0;
            Localization.mLanguage      = Localization.mLanguages[0];
        }
        UICamera.ControlScheme currentScheme = UICamera.currentScheme;
        if (currentScheme == UICamera.ControlScheme.Touch)
        {
            string key2 = key + " Mobile";
            if (Localization.mReplacement.ContainsKey(key2))
            {
                return(true);
            }
            if (Localization.mLanguageIndex != -1 && Localization.mDictionary.ContainsKey(key2))
            {
                return(true);
            }
            if (Localization.mOldDictionary.ContainsKey(key2))
            {
                return(true);
            }
        }
        else if (currentScheme == UICamera.ControlScheme.Controller)
        {
            string key3 = key + " Controller";
            if (Localization.mReplacement.ContainsKey(key3))
            {
                return(true);
            }
            if (Localization.mLanguageIndex != -1 && Localization.mDictionary.ContainsKey(key3))
            {
                return(true);
            }
            if (Localization.mOldDictionary.ContainsKey(key3))
            {
                return(true);
            }
        }
        return(Localization.mReplacement.ContainsKey(key) || (Localization.mLanguageIndex != -1 && Localization.mDictionary.ContainsKey(key)) || Localization.mOldDictionary.ContainsKey(key));
    }
示例#8
0
    private void OnGUI()
    {
        Rect position = new Rect(5f, 5f, 1000f, 18f);

        if (NGUIDebug.mRayDebug)
        {
            UICamera.ControlScheme currentScheme = UICamera.currentScheme;
            string text = "Scheme: " + currentScheme;
            GUI.color = Color.black;
            GUI.Label(position, text);
            position.y -= 1f;
            position.x -= 1f;
            GUI.color   = Color.white;
            GUI.Label(position, text);
            position.y += 18f;
            position.x += 1f;
            text        = "Hover: " + NGUITools.GetHierarchy(UICamera.hoveredObject).Replace("\"", string.Empty);
            GUI.color   = Color.black;
            GUI.Label(position, text);
            position.y -= 1f;
            position.x -= 1f;
            GUI.color   = Color.white;
            GUI.Label(position, text);
            position.y += 18f;
            position.x += 1f;
            text        = "Selection: " + NGUITools.GetHierarchy(UICamera.selectedObject).Replace("\"", string.Empty);
            GUI.color   = Color.black;
            GUI.Label(position, text);
            position.y -= 1f;
            position.x -= 1f;
            GUI.color   = Color.white;
            GUI.Label(position, text);
            position.y += 18f;
            position.x += 1f;
            text        = "Controller: " + NGUITools.GetHierarchy(UICamera.controllerNavigationObject).Replace("\"", string.Empty);
            GUI.color   = Color.black;
            GUI.Label(position, text);
            position.y -= 1f;
            position.x -= 1f;
            GUI.color   = Color.white;
            GUI.Label(position, text);
            position.y += 18f;
            position.x += 1f;
            text        = "Active events: " + UICamera.CountInputSources();
            if (UICamera.disableController)
            {
                text += ", disabled controller";
            }
            if (UICamera.inputHasFocus)
            {
                text += ", input focus";
            }
            GUI.color = Color.black;
            GUI.Label(position, text);
            position.y -= 1f;
            position.x -= 1f;
            GUI.color   = Color.white;
            GUI.Label(position, text);
            position.y += 18f;
            position.x += 1f;
        }
        int i     = 0;
        int count = NGUIDebug.mLines.Count;

        while (i < count)
        {
            GUI.color = Color.black;
            GUI.Label(position, NGUIDebug.mLines[i]);
            position.y -= 1f;
            position.x -= 1f;
            GUI.color   = Color.white;
            GUI.Label(position, NGUIDebug.mLines[i]);
            position.y += 18f;
            position.x += 1f;
            i++;
        }
    }
示例#9
0
 public void ProcessTouch(bool pressed, bool unpressed)
 {
     bool flag = UICamera.currentScheme == UICamera.ControlScheme.Mouse;
     float num = (!flag) ? this.touchDragThreshold : this.mouseDragThreshold;
     float num2 = (!flag) ? this.touchClickThreshold : this.mouseClickThreshold;
     num *= num;
     num2 *= num2;
     if (pressed)
     {
         if (this.mTooltip != null)
         {
             this.ShowTooltip(false);
         }
         UICamera.currentTouch.pressStarted = true;
         if (UICamera.onPress != null && UICamera.currentTouch.pressed)
         {
             UICamera.onPress(UICamera.currentTouch.pressed, false);
         }
         UICamera.Notify(UICamera.currentTouch.pressed, "OnPress", false);
         UICamera.currentTouch.pressed = UICamera.currentTouch.current;
         UICamera.currentTouch.dragged = UICamera.currentTouch.current;
         UICamera.currentTouch.clickNotification = UICamera.ClickNotification.BasedOnDelta;
         UICamera.currentTouch.totalDelta = Vector2.zero;
         UICamera.currentTouch.dragStarted = false;
         if (UICamera.onPress != null && UICamera.currentTouch.pressed)
         {
             UICamera.onPress(UICamera.currentTouch.pressed, true);
         }
         UICamera.Notify(UICamera.currentTouch.pressed, "OnPress", true);
         if (UICamera.currentTouch.pressed != UICamera.mCurrentSelection)
         {
             if (this.mTooltip != null)
             {
                 this.ShowTooltip(false);
             }
             UICamera.currentScheme = UICamera.ControlScheme.Touch;
             UICamera.selectedObject = UICamera.currentTouch.pressed;
         }
     }
     else if (UICamera.currentTouch.pressed != null && (UICamera.currentTouch.delta.sqrMagnitude != 0f || UICamera.currentTouch.current != UICamera.currentTouch.last))
     {
         UICamera.currentTouch.totalDelta += UICamera.currentTouch.delta;
         float sqrMagnitude = UICamera.currentTouch.totalDelta.sqrMagnitude;
         bool flag2 = false;
         if (!UICamera.currentTouch.dragStarted && UICamera.currentTouch.last != UICamera.currentTouch.current)
         {
             UICamera.currentTouch.dragStarted = true;
             UICamera.currentTouch.delta = UICamera.currentTouch.totalDelta;
             UICamera.isDragging = true;
             if (UICamera.onDragStart != null)
             {
                 UICamera.onDragStart(UICamera.currentTouch.dragged);
             }
             UICamera.Notify(UICamera.currentTouch.dragged, "OnDragStart", null);
             if (UICamera.onDragOver != null)
             {
                 UICamera.onDragOver(UICamera.currentTouch.last, UICamera.currentTouch.dragged);
             }
             UICamera.Notify(UICamera.currentTouch.last, "OnDragOver", UICamera.currentTouch.dragged);
             UICamera.isDragging = false;
         }
         else if (!UICamera.currentTouch.dragStarted && num < sqrMagnitude)
         {
             flag2 = true;
             UICamera.currentTouch.dragStarted = true;
             UICamera.currentTouch.delta = UICamera.currentTouch.totalDelta;
         }
         if (UICamera.currentTouch.dragStarted)
         {
             if (this.mTooltip != null)
             {
                 this.ShowTooltip(false);
             }
             UICamera.isDragging = true;
             bool flag3 = UICamera.currentTouch.clickNotification == UICamera.ClickNotification.None;
             if (flag2)
             {
                 if (UICamera.onDragStart != null)
                 {
                     UICamera.onDragStart(UICamera.currentTouch.dragged);
                 }
                 UICamera.Notify(UICamera.currentTouch.dragged, "OnDragStart", null);
                 if (UICamera.onDragOver != null)
                 {
                     UICamera.onDragOver(UICamera.currentTouch.last, UICamera.currentTouch.dragged);
                 }
                 UICamera.Notify(UICamera.currentTouch.current, "OnDragOver", UICamera.currentTouch.dragged);
             }
             else if (UICamera.currentTouch.last != UICamera.currentTouch.current)
             {
                 if (UICamera.onDragStart != null)
                 {
                     UICamera.onDragStart(UICamera.currentTouch.dragged);
                 }
                 UICamera.Notify(UICamera.currentTouch.last, "OnDragOut", UICamera.currentTouch.dragged);
                 if (UICamera.onDragOver != null)
                 {
                     UICamera.onDragOver(UICamera.currentTouch.last, UICamera.currentTouch.dragged);
                 }
                 UICamera.Notify(UICamera.currentTouch.current, "OnDragOver", UICamera.currentTouch.dragged);
             }
             if (UICamera.onDrag != null)
             {
                 UICamera.onDrag(UICamera.currentTouch.dragged, UICamera.currentTouch.delta);
             }
             UICamera.Notify(UICamera.currentTouch.dragged, "OnDrag", UICamera.currentTouch.delta);
             UICamera.currentTouch.last = UICamera.currentTouch.current;
             UICamera.isDragging = false;
             if (flag3)
             {
                 UICamera.currentTouch.clickNotification = UICamera.ClickNotification.None;
             }
             else if (UICamera.currentTouch.clickNotification == UICamera.ClickNotification.BasedOnDelta && num2 < sqrMagnitude)
             {
                 UICamera.currentTouch.clickNotification = UICamera.ClickNotification.None;
             }
         }
     }
     if (unpressed)
     {
         UICamera.currentTouch.pressStarted = false;
         if (this.mTooltip != null)
         {
             this.ShowTooltip(false);
         }
         if (UICamera.currentTouch.pressed != null)
         {
             if (UICamera.currentTouch.dragStarted)
             {
                 if (UICamera.onDragOut != null)
                 {
                     UICamera.onDragOut(UICamera.currentTouch.last, UICamera.currentTouch.dragged);
                 }
                 UICamera.Notify(UICamera.currentTouch.last, "OnDragOut", UICamera.currentTouch.dragged);
                 if (UICamera.onDragEnd != null)
                 {
                     UICamera.onDragEnd(UICamera.currentTouch.dragged);
                 }
                 UICamera.Notify(UICamera.currentTouch.dragged, "OnDragEnd", null);
             }
             if (UICamera.onPress != null)
             {
                 UICamera.onPress(UICamera.currentTouch.pressed, false);
             }
             UICamera.Notify(UICamera.currentTouch.pressed, "OnPress", false);
             if (flag)
             {
                 if (UICamera.onHover != null)
                 {
                     UICamera.onHover(UICamera.currentTouch.current, true);
                 }
                 UICamera.Notify(UICamera.currentTouch.current, "OnHover", true);
             }
             UICamera.mHover = UICamera.currentTouch.current;
             if (UICamera.currentTouch.dragged == UICamera.currentTouch.current || (UICamera.currentScheme != UICamera.ControlScheme.Controller && UICamera.currentTouch.clickNotification != UICamera.ClickNotification.None && UICamera.currentTouch.totalDelta.sqrMagnitude < num))
             {
                 if (UICamera.currentTouch.pressed != UICamera.mCurrentSelection)
                 {
                     UICamera.mNextSelection = null;
                     UICamera.mCurrentSelection = UICamera.currentTouch.pressed;
                     if (UICamera.onSelect != null)
                     {
                         UICamera.onSelect(UICamera.currentTouch.pressed, true);
                     }
                     UICamera.Notify(UICamera.currentTouch.pressed, "OnSelect", true);
                 }
                 else
                 {
                     UICamera.mNextSelection = null;
                     UICamera.mCurrentSelection = UICamera.currentTouch.pressed;
                 }
                 if (UICamera.currentTouch.clickNotification != UICamera.ClickNotification.None && UICamera.currentTouch.pressed == UICamera.currentTouch.current)
                 {
                     float time = RealTime.time;
                     if (UICamera.onClick != null)
                     {
                         UICamera.onClick(UICamera.currentTouch.pressed);
                     }
                     UICamera.Notify(UICamera.currentTouch.pressed, "OnClick", null);
                     if (UICamera.currentTouch.clickTime + 0.35f > time)
                     {
                         if (UICamera.onDoubleClick != null)
                         {
                             UICamera.onDoubleClick(UICamera.currentTouch.pressed);
                         }
                         UICamera.Notify(UICamera.currentTouch.pressed, "OnDoubleClick", null);
                     }
                     UICamera.currentTouch.clickTime = time;
                 }
             }
             else if (UICamera.currentTouch.dragStarted)
             {
                 if (UICamera.onDrop != null)
                 {
                     UICamera.onDrop(UICamera.currentTouch.current, UICamera.currentTouch.dragged);
                 }
                 UICamera.Notify(UICamera.currentTouch.current, "OnDrop", UICamera.currentTouch.dragged);
             }
         }
         UICamera.currentTouch.dragStarted = false;
         UICamera.currentTouch.pressed = null;
         UICamera.currentTouch.dragged = null;
     }
 }
示例#10
0
 public void ProcessMouse()
 {
     UICamera.lastTouchPosition = Input.mousePosition;
     UICamera.mMouse[0].delta = UICamera.lastTouchPosition - UICamera.mMouse[0].pos;
     UICamera.mMouse[0].pos = UICamera.lastTouchPosition;
     bool flag = UICamera.mMouse[0].delta.sqrMagnitude > 0.001f;
     for (int i = 1; i < 3; i++)
     {
         UICamera.mMouse[i].pos = UICamera.mMouse[0].pos;
         UICamera.mMouse[i].delta = UICamera.mMouse[0].delta;
     }
     bool flag2 = false;
     bool flag3 = false;
     for (int j = 0; j < 3; j++)
     {
         if (Input.GetMouseButtonDown(j))
         {
             UICamera.currentScheme = UICamera.ControlScheme.Mouse;
             flag3 = true;
             flag2 = true;
         }
         else if (Input.GetMouseButton(j))
         {
             UICamera.currentScheme = UICamera.ControlScheme.Mouse;
             flag2 = true;
         }
     }
     if (flag2 || flag || this.mNextRaycast < RealTime.time)
     {
         this.mNextRaycast = RealTime.time + 0.02f;
         if (!UICamera.Raycast(Input.mousePosition))
         {
             UICamera.hoveredObject = UICamera.fallThrough;
         }
         if (UICamera.hoveredObject == null)
         {
             UICamera.hoveredObject = UICamera.mGenericHandler;
         }
         for (int k = 0; k < 3; k++)
         {
             UICamera.mMouse[k].current = UICamera.hoveredObject;
         }
     }
     bool flag4 = UICamera.mMouse[0].last != UICamera.mMouse[0].current;
     if (flag4)
     {
         UICamera.currentScheme = UICamera.ControlScheme.Mouse;
     }
     if (flag2)
     {
         this.mTooltipTime = 0f;
     }
     else if (flag && (!this.stickyTooltip || flag4))
     {
         if (this.mTooltipTime != 0f)
         {
             this.mTooltipTime = RealTime.time + this.tooltipDelay;
         }
         else if (this.mTooltip != null)
         {
             this.ShowTooltip(false);
         }
     }
     if (flag && UICamera.onMouseMove != null)
     {
         UICamera.currentTouch = UICamera.mMouse[0];
         UICamera.onMouseMove(UICamera.currentTouch.delta);
         UICamera.currentTouch = null;
     }
     if ((flag3 || !flag2) && UICamera.mHover != null && flag4)
     {
         UICamera.currentScheme = UICamera.ControlScheme.Mouse;
         UICamera.currentTouch = UICamera.mMouse[0];
         if (this.mTooltip != null)
         {
             this.ShowTooltip(false);
         }
         if (UICamera.onHover != null)
         {
             UICamera.onHover(UICamera.mHover, false);
         }
         UICamera.Notify(UICamera.mHover, "OnHover", false);
         UICamera.mHover = null;
     }
     for (int l = 0; l < 3; l++)
     {
         bool mouseButtonDown = Input.GetMouseButtonDown(l);
         bool mouseButtonUp = Input.GetMouseButtonUp(l);
         if (mouseButtonDown || mouseButtonUp)
         {
             UICamera.currentScheme = UICamera.ControlScheme.Mouse;
         }
         UICamera.currentTouch = UICamera.mMouse[l];
         UICamera.currentTouchID = -1 - l;
         UICamera.currentKey = KeyCode.Mouse0 + l;
         if (mouseButtonDown)
         {
             UICamera.currentTouch.pressedCam = UICamera.currentCamera;
         }
         else if (UICamera.currentTouch.pressed != null)
         {
             UICamera.currentCamera = UICamera.currentTouch.pressedCam;
         }
         this.ProcessTouch(mouseButtonDown, mouseButtonUp);
         UICamera.currentKey = KeyCode.None;
     }
     if (!flag2 && flag4)
     {
         UICamera.currentScheme = UICamera.ControlScheme.Mouse;
         this.mTooltipTime = RealTime.time + this.tooltipDelay;
         UICamera.mHover = UICamera.mMouse[0].current;
         UICamera.currentTouch = UICamera.mMouse[0];
         if (UICamera.onHover != null)
         {
             UICamera.onHover(UICamera.mHover, true);
         }
         UICamera.Notify(UICamera.mHover, "OnHover", true);
     }
     UICamera.currentTouch = null;
     UICamera.mMouse[0].last = UICamera.mMouse[0].current;
     for (int m = 1; m < 3; m++)
     {
         UICamera.mMouse[m].last = UICamera.mMouse[0].last;
     }
 }
示例#11
0
 public void ProcessOthers()
 {
     UICamera.currentTouchID = -100;
     UICamera.currentTouch = UICamera.controller;
     bool flag = false;
     bool flag2 = false;
     if (this.submitKey0 != KeyCode.None && UICamera.GetKeyDown(this.submitKey0))
     {
         UICamera.currentKey = this.submitKey0;
         flag = true;
     }
     if (this.submitKey1 != KeyCode.None && UICamera.GetKeyDown(this.submitKey1))
     {
         UICamera.currentKey = this.submitKey1;
         flag = true;
     }
     if (this.submitKey0 != KeyCode.None && UICamera.GetKeyUp(this.submitKey0))
     {
         UICamera.currentKey = this.submitKey0;
         flag2 = true;
     }
     if (this.submitKey1 != KeyCode.None && UICamera.GetKeyUp(this.submitKey1))
     {
         UICamera.currentKey = this.submitKey1;
         flag2 = true;
     }
     if (flag || flag2)
     {
         UICamera.currentScheme = UICamera.ControlScheme.Controller;
         UICamera.currentTouch.last = UICamera.currentTouch.current;
         UICamera.currentTouch.current = UICamera.mCurrentSelection;
         this.ProcessTouch(flag, flag2);
         UICamera.currentTouch.last = null;
     }
     int num = 0;
     int num2 = 0;
     if (this.useKeyboard)
     {
         if (UICamera.inputHasFocus)
         {
             num += UICamera.GetDirection(KeyCode.UpArrow, KeyCode.DownArrow);
             num2 += UICamera.GetDirection(KeyCode.RightArrow, KeyCode.LeftArrow);
         }
         else
         {
             num += UICamera.GetDirection(KeyCode.W, KeyCode.UpArrow, KeyCode.S, KeyCode.DownArrow);
             num2 += UICamera.GetDirection(KeyCode.D, KeyCode.RightArrow, KeyCode.A, KeyCode.LeftArrow);
         }
     }
     if (this.useController)
     {
         if (!string.IsNullOrEmpty(this.verticalAxisName))
         {
             num += UICamera.GetDirection(this.verticalAxisName);
         }
         if (!string.IsNullOrEmpty(this.horizontalAxisName))
         {
             num2 += UICamera.GetDirection(this.horizontalAxisName);
         }
     }
     if (num != 0)
     {
         UICamera.currentScheme = UICamera.ControlScheme.Controller;
         KeyCode keyCode = (num <= 0) ? KeyCode.DownArrow : KeyCode.UpArrow;
         if (UICamera.onKey != null)
         {
             UICamera.onKey(UICamera.mCurrentSelection, keyCode);
         }
         UICamera.Notify(UICamera.mCurrentSelection, "OnKey", keyCode);
     }
     if (num2 != 0)
     {
         UICamera.currentScheme = UICamera.ControlScheme.Controller;
         KeyCode keyCode2 = (num2 <= 0) ? KeyCode.LeftArrow : KeyCode.RightArrow;
         if (UICamera.onKey != null)
         {
             UICamera.onKey(UICamera.mCurrentSelection, keyCode2);
         }
         UICamera.Notify(UICamera.mCurrentSelection, "OnKey", keyCode2);
     }
     if (this.useKeyboard && UICamera.GetKeyDown(KeyCode.Tab))
     {
         UICamera.currentKey = KeyCode.Tab;
         UICamera.currentScheme = UICamera.ControlScheme.Controller;
         if (UICamera.onKey != null)
         {
             UICamera.onKey(UICamera.mCurrentSelection, KeyCode.Tab);
         }
         UICamera.Notify(UICamera.mCurrentSelection, "OnKey", KeyCode.Tab);
     }
     if (this.cancelKey0 != KeyCode.None && UICamera.GetKeyDown(this.cancelKey0))
     {
         UICamera.currentKey = this.cancelKey0;
         UICamera.currentScheme = UICamera.ControlScheme.Controller;
         if (UICamera.onKey != null)
         {
             UICamera.onKey(UICamera.mCurrentSelection, KeyCode.Escape);
         }
         UICamera.Notify(UICamera.mCurrentSelection, "OnKey", KeyCode.Escape);
     }
     if (this.cancelKey1 != KeyCode.None && UICamera.GetKeyDown(this.cancelKey1))
     {
         UICamera.currentKey = this.cancelKey1;
         UICamera.currentScheme = UICamera.ControlScheme.Controller;
         if (UICamera.onKey != null)
         {
             UICamera.onKey(UICamera.mCurrentSelection, KeyCode.Escape);
         }
         UICamera.Notify(UICamera.mCurrentSelection, "OnKey", KeyCode.Escape);
     }
     UICamera.currentTouch = null;
     UICamera.currentKey = KeyCode.None;
 }
示例#12
0
 private void Update()
 {
     if (!this.handlesEvents)
     {
         return;
     }
     UICamera.current = this;
     if (this.useTouch)
     {
         this.ProcessTouches();
     }
     else if (this.useMouse)
     {
         this.ProcessMouse();
     }
     if (UICamera.onCustomInput != null)
     {
         UICamera.onCustomInput();
     }
     if (this.useMouse && UICamera.mCurrentSelection != null)
     {
         if (this.cancelKey0 != KeyCode.None && UICamera.GetKeyDown(this.cancelKey0))
         {
             UICamera.currentScheme = UICamera.ControlScheme.Controller;
             UICamera.currentKey = this.cancelKey0;
             UICamera.selectedObject = null;
         }
         else if (this.cancelKey1 != KeyCode.None && UICamera.GetKeyDown(this.cancelKey1))
         {
             UICamera.currentScheme = UICamera.ControlScheme.Controller;
             UICamera.currentKey = this.cancelKey1;
             UICamera.selectedObject = null;
         }
     }
     if (UICamera.mCurrentSelection == null)
     {
         UICamera.inputHasFocus = false;
     }
     if (UICamera.mCurrentSelection != null)
     {
         this.ProcessOthers();
     }
     if (this.useMouse && UICamera.mHover != null)
     {
         float num = string.IsNullOrEmpty(this.scrollAxisName) ? 0f : UICamera.GetAxis(this.scrollAxisName);
         if (num != 0f)
         {
             if (UICamera.onScroll != null)
             {
                 UICamera.onScroll(UICamera.mHover, num);
             }
             UICamera.Notify(UICamera.mHover, "OnScroll", num);
         }
         if (UICamera.showTooltips && this.mTooltipTime != 0f && (this.mTooltipTime < RealTime.time || UICamera.GetKey(KeyCode.LeftShift) || UICamera.GetKey(KeyCode.RightShift)))
         {
             this.mTooltip = UICamera.mHover;
             this.ShowTooltip(true);
         }
     }
     UICamera.current = null;
     UICamera.currentTouchID = -100;
 }
示例#13
0
 private void OnApplicationPause()
 {
     UICamera.MouseOrTouch mouseOrTouch = UICamera.currentTouch;
     if (this.useTouch)
     {
         BetterList<int> betterList = new BetterList<int>();
         foreach (KeyValuePair<int, UICamera.MouseOrTouch> keyValuePair in UICamera.mTouches)
         {
             if (keyValuePair.Value != null && keyValuePair.Value.pressed)
             {
                 UICamera.currentTouch = keyValuePair.Value;
                 UICamera.currentTouchID = keyValuePair.Key;
                 UICamera.currentScheme = UICamera.ControlScheme.Touch;
                 UICamera.currentTouch.clickNotification = UICamera.ClickNotification.None;
                 this.ProcessTouch(false, true);
                 betterList.Add(UICamera.currentTouchID);
             }
         }
         for (int i = 0; i < betterList.size; i++)
         {
             UICamera.RemoveTouch(betterList[i]);
         }
     }
     if (this.useMouse)
     {
         for (int j = 0; j < 3; j++)
         {
             if (UICamera.mMouse[j].pressed)
             {
                 UICamera.currentTouch = UICamera.mMouse[j];
                 UICamera.currentTouchID = -1 - j;
                 UICamera.currentKey = KeyCode.Mouse0 + j;
                 UICamera.currentScheme = UICamera.ControlScheme.Mouse;
                 UICamera.currentTouch.clickNotification = UICamera.ClickNotification.None;
                 this.ProcessTouch(false, true);
             }
         }
     }
     if (this.useController && UICamera.controller.pressed)
     {
         UICamera.currentTouch = UICamera.controller;
         UICamera.currentTouchID = -100;
         UICamera.currentScheme = UICamera.ControlScheme.Controller;
         UICamera.currentTouch.last = UICamera.currentTouch.current;
         UICamera.currentTouch.current = UICamera.mCurrentSelection;
         UICamera.currentTouch.clickNotification = UICamera.ClickNotification.None;
         this.ProcessTouch(false, true);
         UICamera.currentTouch.last = null;
     }
     UICamera.currentTouch = mouseOrTouch;
 }
示例#14
0
 protected static void SetSelection(GameObject go, UICamera.ControlScheme scheme)
 {
     if (UICamera.mNextSelection != null)
     {
         UICamera.mNextSelection = go;
     }
     else if (UICamera.mCurrentSelection != go)
     {
         UICamera.mNextSelection = go;
         UICamera.mNextScheme = scheme;
         if (UICamera.list.size > 0)
         {
             UICamera uICamera = (!(UICamera.mNextSelection != null)) ? UICamera.list[0] : UICamera.FindCameraForLayer(UICamera.mNextSelection.layer);
             if (uICamera != null)
             {
                 uICamera.StartCoroutine(uICamera.ChangeSelection());
             }
         }
     }
 }
示例#15
0
 public void ProcessTouches()
 {
     UICamera.currentScheme = UICamera.ControlScheme.Touch;
     for (int i = 0; i < Input.touchCount; i++)
     {
         Touch touch = Input.GetTouch(i);
         UICamera.currentTouchID = ((!this.allowMultiTouch) ? 1 : touch.fingerId);
         UICamera.currentTouch = UICamera.GetTouch(UICamera.currentTouchID);
         bool flag = touch.phase == TouchPhase.Began || UICamera.currentTouch.touchBegan;
         bool flag2 = touch.phase == TouchPhase.Canceled || touch.phase == TouchPhase.Ended;
         UICamera.currentTouch.touchBegan = false;
         UICamera.currentTouch.delta = ((!flag) ? (touch.position - UICamera.currentTouch.pos) : Vector2.zero);
         UICamera.currentTouch.pos = touch.position;
         if (!UICamera.Raycast(UICamera.currentTouch.pos))
         {
             UICamera.hoveredObject = UICamera.fallThrough;
         }
         if (UICamera.hoveredObject == null)
         {
             UICamera.hoveredObject = UICamera.mGenericHandler;
         }
         UICamera.currentTouch.last = UICamera.currentTouch.current;
         UICamera.currentTouch.current = UICamera.hoveredObject;
         UICamera.lastTouchPosition = UICamera.currentTouch.pos;
         if (flag)
         {
             UICamera.currentTouch.pressedCam = UICamera.currentCamera;
         }
         else if (UICamera.currentTouch.pressed != null)
         {
             UICamera.currentCamera = UICamera.currentTouch.pressedCam;
         }
         if (touch.tapCount > 1)
         {
             UICamera.currentTouch.clickTime = RealTime.time;
         }
         this.ProcessTouch(flag, flag2);
         if (flag2)
         {
             UICamera.RemoveTouch(UICamera.currentTouchID);
         }
         UICamera.currentTouch.last = null;
         UICamera.currentTouch = null;
         if (!this.allowMultiTouch)
         {
             break;
         }
     }
     if (Input.touchCount == 0)
     {
         if (UICamera.mUsingTouchEvents)
         {
             UICamera.mUsingTouchEvents = false;
             return;
         }
         if (this.useMouse)
         {
             this.ProcessMouse();
         }
     }
     else
     {
         UICamera.mUsingTouchEvents = true;
     }
 }
示例#16
0
    private void OnGUI()
    {
        //IL_003c: Unknown result type (might be due to invalid IL or missing references)
        //IL_0046: Unknown result type (might be due to invalid IL or missing references)
        //IL_0073: Unknown result type (might be due to invalid IL or missing references)
        //IL_007d: Unknown result type (might be due to invalid IL or missing references)
        //IL_00ce: Unknown result type (might be due to invalid IL or missing references)
        //IL_00d8: Unknown result type (might be due to invalid IL or missing references)
        //IL_0105: Unknown result type (might be due to invalid IL or missing references)
        //IL_010f: Unknown result type (might be due to invalid IL or missing references)
        //IL_0160: Unknown result type (might be due to invalid IL or missing references)
        //IL_016a: Unknown result type (might be due to invalid IL or missing references)
        //IL_0197: Unknown result type (might be due to invalid IL or missing references)
        //IL_01a1: Unknown result type (might be due to invalid IL or missing references)
        //IL_01f2: Unknown result type (might be due to invalid IL or missing references)
        //IL_01fc: Unknown result type (might be due to invalid IL or missing references)
        //IL_0229: Unknown result type (might be due to invalid IL or missing references)
        //IL_0233: Unknown result type (might be due to invalid IL or missing references)
        //IL_02a1: Unknown result type (might be due to invalid IL or missing references)
        //IL_02ab: Unknown result type (might be due to invalid IL or missing references)
        //IL_02d8: Unknown result type (might be due to invalid IL or missing references)
        //IL_02e2: Unknown result type (might be due to invalid IL or missing references)
        //IL_0322: Unknown result type (might be due to invalid IL or missing references)
        //IL_032c: Unknown result type (might be due to invalid IL or missing references)
        //IL_0363: Unknown result type (might be due to invalid IL or missing references)
        //IL_036d: Unknown result type (might be due to invalid IL or missing references)
        Rect val = default(Rect);

        val._002Ector(5f, 5f, 1000f, 18f);
        if (mRayDebug)
        {
            UICamera.ControlScheme currentScheme = UICamera.currentScheme;
            string text = "Scheme: " + currentScheme;
            GUI.set_color(Color.get_black());
            GUI.Label(val, text);
            val.set_y(val.get_y() - 1f);
            val.set_x(val.get_x() - 1f);
            GUI.set_color(Color.get_white());
            GUI.Label(val, text);
            val.set_y(val.get_y() + 18f);
            val.set_x(val.get_x() + 1f);
            text = "Hover: " + NGUITools.GetHierarchy(UICamera.hoveredObject).Replace("\"", string.Empty);
            GUI.set_color(Color.get_black());
            GUI.Label(val, text);
            val.set_y(val.get_y() - 1f);
            val.set_x(val.get_x() - 1f);
            GUI.set_color(Color.get_white());
            GUI.Label(val, text);
            val.set_y(val.get_y() + 18f);
            val.set_x(val.get_x() + 1f);
            text = "Selection: " + NGUITools.GetHierarchy(UICamera.selectedObject).Replace("\"", string.Empty);
            GUI.set_color(Color.get_black());
            GUI.Label(val, text);
            val.set_y(val.get_y() - 1f);
            val.set_x(val.get_x() - 1f);
            GUI.set_color(Color.get_white());
            GUI.Label(val, text);
            val.set_y(val.get_y() + 18f);
            val.set_x(val.get_x() + 1f);
            text = "Controller: " + NGUITools.GetHierarchy(UICamera.controllerNavigationObject).Replace("\"", string.Empty);
            GUI.set_color(Color.get_black());
            GUI.Label(val, text);
            val.set_y(val.get_y() - 1f);
            val.set_x(val.get_x() - 1f);
            GUI.set_color(Color.get_white());
            GUI.Label(val, text);
            val.set_y(val.get_y() + 18f);
            val.set_x(val.get_x() + 1f);
            text = "Active events: " + UICamera.CountInputSources();
            if (UICamera.disableController)
            {
                text += ", disabled controller";
            }
            if (UICamera.inputHasFocus)
            {
                text += ", input focus";
            }
            GUI.set_color(Color.get_black());
            GUI.Label(val, text);
            val.set_y(val.get_y() - 1f);
            val.set_x(val.get_x() - 1f);
            GUI.set_color(Color.get_white());
            GUI.Label(val, text);
            val.set_y(val.get_y() + 18f);
            val.set_x(val.get_x() + 1f);
        }
        int i = 0;

        for (int count = mLines.Count; i < count; i++)
        {
            GUI.set_color(Color.get_black());
            GUI.Label(val, mLines[i]);
            val.set_y(val.get_y() - 1f);
            val.set_x(val.get_x() - 1f);
            GUI.set_color(Color.get_white());
            GUI.Label(val, mLines[i]);
            val.set_y(val.get_y() + 18f);
            val.set_x(val.get_x() + 1f);
        }
    }