// Token: 0x060025AA RID: 9642 RVA: 0x000A3E44 File Offset: 0x000A2044
 public static void RemoveTooltip(MPEventSystem eventSystem, TooltipProvider tooltipProvider)
 {
     if (eventSystem.currentTooltipProvider == tooltipProvider)
     {
         TooltipController.SetTooltip(eventSystem, null, Vector3.zero);
     }
 }
Beispiel #2
0
        // Token: 0x060024D1 RID: 9425 RVA: 0x000A0938 File Offset: 0x0009EB38
        private void LateUpdate()
        {
            MPEventSystem eventSystem = this.eventSystemLocator.eventSystem;
            string        text;

            if (eventSystem == null)
            {
                text = null;
            }
            else
            {
                LocalUser localUser = eventSystem.localUser;
                text = ((localUser != null) ? localUser.userProfile.name : null);
            }
            string a = text ?? string.Empty;

            if (a != this.currentUserName)
            {
                this.currentUserName = a;
                this.label.text      = Language.GetStringFormatted(this.token, new object[]
                {
                    this.currentUserName
                });
            }
        }
Beispiel #3
0
 // Token: 0x060020EA RID: 8426 RVA: 0x0009A924 File Offset: 0x00098B24
 private void SetEventSystem(MPEventSystem newEventSystem)
 {
     if (newEventSystem == this.eventSystem)
     {
         return;
     }
     this.eventSystem = newEventSystem;
     this.localUser   = LocalUserManager.FindLocalUser(newEventSystem.player);
 }
Beispiel #4
0
        // Token: 0x060025B4 RID: 9652 RVA: 0x000A4170 File Offset: 0x000A2370
        void IPointerExitHandler.OnPointerExit(PointerEventData eventData)
        {
            MPEventSystem mpeventSystem = EventSystem.current as MPEventSystem;

            if (mpeventSystem != null && this.tooltipIsAvailable)
            {
                TooltipController.RemoveTooltip(mpeventSystem, this);
            }
        }
Beispiel #5
0
        // Token: 0x060025B3 RID: 9651 RVA: 0x000A4138 File Offset: 0x000A2338
        void IPointerEnterHandler.OnPointerEnter(PointerEventData eventData)
        {
            MPEventSystem mpeventSystem = EventSystem.current as MPEventSystem;

            if (mpeventSystem != null && this.tooltipIsAvailable)
            {
                TooltipController.SetTooltip(mpeventSystem, this, eventData.position);
            }
        }
        // Token: 0x06002234 RID: 8756 RVA: 0x00094064 File Offset: 0x00092264
        private void UnfocusInputField()
        {
            MPEventSystem eventSystem = this.eventSystemLocator.eventSystem;

            if (eventSystem && eventSystem.currentSelectedGameObject == this.inputField.gameObject)
            {
                eventSystem.SetSelectedGameObject(null);
            }
            this.inputField.DeactivateInputField();
        }
        // Token: 0x06002233 RID: 8755 RVA: 0x00094014 File Offset: 0x00092214
        private void FocusInputField()
        {
            MPEventSystem eventSystem = this.eventSystemLocator.eventSystem;

            if (eventSystem)
            {
                eventSystem.SetSelectedGameObject(this.inputField.gameObject);
            }
            this.inputField.ActivateInputField();
            this.inputField.text = "";
        }
 // Token: 0x060025A5 RID: 9637 RVA: 0x000A3D38 File Offset: 0x000A1F38
 private static UICamera FindUICamera(MPEventSystem mpEventSystem)
 {
     foreach (UICamera uicamera in UICamera.readOnlyInstancesList)
     {
         if (uicamera.GetAssociatedEventSystem() as MPEventSystem == mpEventSystem)
         {
             return(uicamera);
         }
     }
     return(null);
 }
        // Token: 0x06002557 RID: 9559 RVA: 0x000A27AC File Offset: 0x000A09AC
        public static SimpleDialogBox Create(MPEventSystem owner = null)
        {
            GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/UI/SimpleDialogRoot"));

            if (owner)
            {
                MPEventSystemProvider component = gameObject.GetComponent <MPEventSystemProvider>();
                component.eventSystem = owner;
                component.fallBackToMainEventSystem = false;
                component.eventSystem.SetSelectedGameObject(null);
            }
            return(gameObject.transform.GetComponentInChildren <SimpleDialogBox>());
        }
Beispiel #10
0
        // Token: 0x06002171 RID: 8561 RVA: 0x00090E38 File Offset: 0x0008F038
        private UserProfile GetUserProfile()
        {
            MPEventSystem eventSystem = this.eventSystemLocator.eventSystem;

            if (eventSystem)
            {
                LocalUser localUser = LocalUserManager.FindLocalUser(eventSystem.player);
                if (localUser != null)
                {
                    return(localUser.userProfile);
                }
            }
            return(null);
        }
        // Token: 0x060022CF RID: 8911 RVA: 0x000A45D4 File Offset: 0x000A27D4
        private static void PushCursorsApart()
        {
            if (MPEventSystem.activeCount <= 1)
            {
                return;
            }
            int count = MPEventSystem.instancesList.Count;

            if (MPEventSystem.pushInfos.Length < MPEventSystem.activeCount)
            {
                MPEventSystem.pushInfos = new MPEventSystem.PushInfo[MPEventSystem.activeCount];
            }
            int num = 0;

            for (int i = 0; i < count; i++)
            {
                if (MPEventSystem.instancesList[i].enabled)
                {
                    Vector2 position;
                    MPEventSystem.instancesList[i].GetCursorPosition(out position);
                    MPEventSystem.pushInfos[num++] = new MPEventSystem.PushInfo
                    {
                        index    = i,
                        position = position
                    };
                }
            }
            for (int j = 0; j < MPEventSystem.activeCount; j++)
            {
                MPEventSystem.PushInfo pushInfo = MPEventSystem.pushInfos[j];
                for (int k = j + 1; k < MPEventSystem.activeCount; k++)
                {
                    MPEventSystem.PushInfo pushInfo2 = MPEventSystem.pushInfos[k];
                    Vector2 b = MPEventSystem.CalculateCursorPushVector(pushInfo.position, pushInfo2.position);
                    pushInfo.pushVector       += b;
                    pushInfo2.pushVector      -= b;
                    MPEventSystem.pushInfos[k] = pushInfo2;
                }
                MPEventSystem.pushInfos[j] = pushInfo;
            }
            for (int l = 0; l < MPEventSystem.activeCount; l++)
            {
                MPEventSystem.PushInfo pushInfo3     = MPEventSystem.pushInfos[l];
                MPEventSystem          mpeventSystem = MPEventSystem.instancesList[pushInfo3.index];
                if (mpeventSystem.allowCursorPush && mpeventSystem.currentInputModule)
                {
                    ((MPInput)mpeventSystem.currentInputModule.input).internalMousePosition += pushInfo3.pushVector;
                }
            }
        }
 // Token: 0x060025AB RID: 9643 RVA: 0x000A3E68 File Offset: 0x000A2068
 public static void SetTooltip(MPEventSystem eventSystem, TooltipProvider newTooltipProvider, Vector2 tooltipPosition)
 {
     if (eventSystem.currentTooltipProvider != newTooltipProvider)
     {
         if (eventSystem.currentTooltip)
         {
             UnityEngine.Object.Destroy(eventSystem.currentTooltip.gameObject);
             eventSystem.currentTooltip = null;
         }
         if (eventSystem.currentTooltipProvider)
         {
             eventSystem.currentTooltipProvider.userCount--;
         }
         eventSystem.currentTooltipProvider = newTooltipProvider;
         if (newTooltipProvider)
         {
             newTooltipProvider.userCount++;
             GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/UI/Tooltip"));
             eventSystem.currentTooltip          = gameObject.GetComponent <TooltipController>();
             eventSystem.currentTooltip.owner    = eventSystem;
             eventSystem.currentTooltip.uiCamera = TooltipController.FindUICamera(eventSystem);
             eventSystem.currentTooltip.SetTooltipProvider(eventSystem.currentTooltipProvider);
             Canvas   component = gameObject.GetComponent <Canvas>();
             UICamera uicamera  = eventSystem.currentTooltip.uiCamera;
             component.worldCamera = ((uicamera != null) ? uicamera.camera : null);
         }
     }
     if (eventSystem.currentTooltip)
     {
         Vector2  zero      = Vector2.zero;
         UICamera uicamera2 = eventSystem.currentTooltip.uiCamera;
         Camera   camera    = Camera.main;
         if (uicamera2)
         {
             camera = uicamera2.camera;
         }
         if (camera)
         {
             Vector3 vector = camera.ScreenToViewportPoint(new Vector3(tooltipPosition.x, tooltipPosition.y, 0f));
             zero = new Vector2(vector.x, vector.y);
         }
         Vector2 vector2 = new Vector2(0f, 0f);
         vector2.x = ((zero.x > 0.5f) ? 1f : 0f);
         vector2.y = ((zero.y > 0.5f) ? 1f : 0f);
         eventSystem.currentTooltip.tooltipFlipTransform.anchorMin = vector2;
         eventSystem.currentTooltip.tooltipFlipTransform.anchorMax = vector2;
         eventSystem.currentTooltip.tooltipFlipTransform.pivot     = vector2;
     }
 }
        // Token: 0x060020B1 RID: 8369 RVA: 0x00099CD4 File Offset: 0x00097ED4
        public UserProfile GetCurrentUserProfile()
        {
            MPEventSystem eventSystem = this.eventSystemLocator.eventSystem;

            if (eventSystem == null)
            {
                return(null);
            }
            LocalUser localUser = eventSystem.localUser;

            if (localUser == null)
            {
                return(null);
            }
            return(localUser.userProfile);
        }
Beispiel #14
0
    void Start()
    {
        selected = gameObjects[0];
        events   = input.GetFieldValue <RoR2.UI.MPEventSystem>("eventSystem");

        emoteButton = ModSettingsManager.GetOption("Emote Wheel", "Controls").GetValue <KeyCode>();
        leftClick   = ModSettingsManager.GetOption("left", "Controls").GetValue <KeyCode>();
        rightClick  = ModSettingsManager.GetOption("right", "Controls").GetValue <KeyCode>();

        for (int i = 0; i < gameObjects.Count; i++)
        {
            rightPage[i]  = CustomEmotesAPI.allClipNames[UnityEngine.Random.Range(0, CustomEmotesAPI.allClipNames.Count)];
            leftPage[i]   = CustomEmotesAPI.allClipNames[UnityEngine.Random.Range(0, CustomEmotesAPI.allClipNames.Count)];
            middlePage[i] = gameObjects[i].GetComponentInChildren <TextMeshProUGUI>().text;
        }
    }
Beispiel #15
0
        // Token: 0x06002348 RID: 9032 RVA: 0x0009A2C4 File Offset: 0x000984C4
        public void StartListening()
        {
            this.inputMapperHelper.Stop();
            MPEventSystem eventSystem = this.eventSystemLocator.eventSystem;
            Player        player;

            if (eventSystem == null)
            {
                player = null;
            }
            else
            {
                LocalUser localUser = eventSystem.localUser;
                player = ((localUser != null) ? localUser.inputPlayer : null);
            }
            this.currentPlayer = player;
            if (this.currentPlayer == null)
            {
                return;
            }
            IList <Controller> controllers = null;

            MPEventSystem.InputSource inputSource = this.inputSource;
            if (inputSource != MPEventSystem.InputSource.Keyboard)
            {
                if (inputSource == MPEventSystem.InputSource.Gamepad)
                {
                    controllers = this.currentPlayer.controllers.Joysticks.ToArray <Joystick>();
                }
            }
            else
            {
                controllers = new Controller[]
                {
                    this.currentPlayer.controllers.Keyboard,
                    this.currentPlayer.controllers.Mouse
                };
            }
            this.inputMapperHelper.Start(this.currentPlayer, controllers, this.action, this.axisRange);
            if (this.button)
            {
                this.button.interactable = false;
            }
        }
        // Token: 0x060022CE RID: 8910 RVA: 0x000A455C File Offset: 0x000A275C
        private static Vector2 CalculateCursorPushVector(Vector2 positionA, Vector2 positionB)
        {
            Vector2 vector = positionA - positionB;

            if (vector == Vector2.zero)
            {
                vector = MPEventSystem.RandomOnCircle();
            }
            float sqrMagnitude = vector.sqrMagnitude;

            if (sqrMagnitude >= 576f)
            {
                return(Vector2.zero);
            }
            float num  = Mathf.Sqrt(sqrMagnitude);
            float num2 = num * 0.041666668f;
            float d    = 1f - num2;

            return(vector / num * d * 10f * 0.5f);
        }
Beispiel #17
0
        // Token: 0x0600239A RID: 9114 RVA: 0x0009B680 File Offset: 0x00099880
        private void Update()
        {
            MPEventSystem eventSystem = this.eventSystemLocator.eventSystem;
            UserProfile   userProfile;

            if (eventSystem == null)
            {
                userProfile = null;
            }
            else
            {
                LocalUser localUser = eventSystem.localUser;
                userProfile = ((localUser != null) ? localUser.userProfile : null);
            }
            UserProfile   userProfile2 = userProfile;
            MPEventSystem eventSystem2 = this.eventSystemLocator.eventSystem;
            NetworkUser   networkUser;

            if (eventSystem2 == null)
            {
                networkUser = null;
            }
            else
            {
                LocalUser localUser2 = eventSystem2.localUser;
                networkUser = ((localUser2 != null) ? localUser2.currentNetworkUser : null);
            }
            NetworkUser networkUser2 = networkUser;
            int         bodyIndex    = networkUser2 ? networkUser2.bodyIndexPreference : -1;

            this.SetDisplayData(new LoadoutPanelController.DisplayData
            {
                userProfile = userProfile2,
                bodyIndex   = bodyIndex
            });
        }
        // Token: 0x06002232 RID: 8754 RVA: 0x00093F54 File Offset: 0x00092154
        private void Update()
        {
            this.UpdateFade(Time.deltaTime);
            MPEventSystem eventSystem = this.eventSystemLocator.eventSystem;
            GameObject    gameObject  = eventSystem ? eventSystem.currentSelectedGameObject : null;
            bool          flag        = Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter);

            if (!this.showInput && flag && !(ConsoleWindow.instance != null))
            {
                this.showInput = true;
                return;
            }
            if (gameObject == this.inputField.gameObject)
            {
                if (flag)
                {
                    if (this.showInput)
                    {
                        this.SubmitChat();
                    }
                    else if (!gameObject)
                    {
                        this.showInput = true;
                    }
                }
                if (Input.GetKeyDown(KeyCode.Escape))
                {
                    this.showInput = false;
                    return;
                }
            }
            else
            {
                this.showInput = false;
            }
        }
 // Token: 0x060022BF RID: 8895 RVA: 0x000A41CA File Offset: 0x000A23CA
 private static void OnActiveSceneChanged(Scene scene1, Scene scene2)
 {
     MPEventSystem.RecenterCursors();
 }