Beispiel #1
0
        private static void InitHandsAndHUDs(On.RoR2.CameraRigController.orig_Start orig, RoR2.CameraRigController self)
        {
            orig(self);

            if (!HandsReady)
            {
                SetupHands();
            }

            dominantHand.smallHud.Init(self);
            nonDominantHand.smallHud.Init(self);

            foreach (HUDQueueEntry queueEntry in wristHudQueue)
            {
                GetHandBySide(queueEntry.left).smallHud.AddHUDCluster(queueEntry.transform);
            }

            wristHudQueue.Clear();

            dominantHand.watchHud.Init(self);
            nonDominantHand.watchHud.Init(self);

            foreach (HUDQueueEntry queueEntry in watchHudQueue)
            {
                GetHandBySide(queueEntry.left).watchHud.AddHUDCluster(queueEntry.transform);
            }

            watchHudQueue.Clear();
        }
Beispiel #2
0
        // Token: 0x06001709 RID: 5897 RVA: 0x0006D988 File Offset: 0x0006BB88
        private static void UpdatePositions(UICamera uiCamera)
        {
            Camera  sceneCam  = uiCamera.cameraRigController.sceneCam;
            Camera  camera    = uiCamera.camera;
            Rect    pixelRect = camera.pixelRect;
            Vector2 center    = pixelRect.center;

            pixelRect.size  *= 0.95f;
            pixelRect.center = center;
            Vector2             center2             = pixelRect.center;
            float               num                 = 1f / (pixelRect.width * 0.5f);
            float               num2                = 1f / (pixelRect.height * 0.5f);
            Quaternion          rotation            = uiCamera.transform.rotation;
            CameraRigController cameraRigController = uiCamera.cameraRigController;
            Transform           y = null;

            if (cameraRigController && cameraRigController.target)
            {
                CharacterBody component = cameraRigController.target.GetComponent <CharacterBody>();
                if (component)
                {
                    y = component.coreTransform;
                }
                else
                {
                    y = cameraRigController.target.transform;
                }
            }
            for (int i = 0; i < PositionIndicator.instancesList.Count; i++)
            {
                PositionIndicator positionIndicator = PositionIndicator.instancesList[i];
                bool    flag   = false;
                bool    flag2  = false;
                bool    active = false;
                float   num3   = 0f;
                Vector3 a      = positionIndicator.targetTransform ? positionIndicator.targetTransform.position : positionIndicator.defaultPosition;
                if (!positionIndicator.targetTransform || (positionIndicator.targetTransform && positionIndicator.targetTransform != y))
                {
                    active = true;
                    Vector3 vector = sceneCam.WorldToScreenPoint(a + new Vector3(0f, positionIndicator.yOffset, 0f));
                    bool    flag3  = vector.z <= 0f;
                    bool    flag4  = !flag3 && pixelRect.Contains(vector);
                    if (!flag4)
                    {
                        Vector2 vector2 = vector - center2;
                        float   a2      = Mathf.Abs(vector2.x * num);
                        float   b       = Mathf.Abs(vector2.y * num2);
                        float   d       = Mathf.Max(a2, b);
                        vector2 /= d;
                        vector2 *= (flag3 ? -1f : 1f);
                        vector   = vector2 + center2;
                        if (positionIndicator.shouldRotateOutsideViewObject)
                        {
                            num3 = Mathf.Atan2(vector2.y, vector2.x) * 57.29578f;
                        }
                    }
                    flag     = flag4;
                    flag2    = !flag4;
                    vector.z = 1f;
                    positionIndicator.transform.position = camera.ScreenToWorldPoint(vector);
                    positionIndicator.transform.rotation = rotation;
                }
                if (positionIndicator.alwaysVisibleObject)
                {
                    positionIndicator.alwaysVisibleObject.SetActive(active);
                }
                if (positionIndicator.insideViewObject == positionIndicator.outsideViewObject)
                {
                    if (positionIndicator.insideViewObject)
                    {
                        positionIndicator.insideViewObject.SetActive(flag || flag2);
                    }
                }
                else
                {
                    if (positionIndicator.insideViewObject)
                    {
                        positionIndicator.insideViewObject.SetActive(flag);
                    }
                    if (positionIndicator.outsideViewObject)
                    {
                        positionIndicator.outsideViewObject.SetActive(flag2);
                        if (flag2 && positionIndicator.shouldRotateOutsideViewObject)
                        {
                            positionIndicator.outsideViewObject.transform.localEulerAngles = new Vector3(0f, 0f, num3 + positionIndicator.outsideViewRotationOffset);
                        }
                    }
                }
            }
        }