Пример #1
0
        // Token: 0x0600042F RID: 1071 RVA: 0x00015110 File Offset: 0x00013310
        protected override void OnStart()
        {
            base.OnStart();
            base.transform.SetParent(this._Target, false);
            global::UnityEngine.Canvas canvas = new global::UnityEngine.GameObject().AddComponent <global::UnityEngine.Canvas>();
            canvas.transform.SetParent(base.transform, false);
            canvas.renderMode = 2;
            canvas.GetComponent <global::UnityEngine.RectTransform>().SetSizeWithCurrentAnchors(0, 300f);
            canvas.GetComponent <global::UnityEngine.RectTransform>().SetSizeWithCurrentAnchors(1, 70f);
            base.transform.rotation        = this._Target.parent.rotation;
            canvas.transform.localScale    = new global::UnityEngine.Vector3(0.0001549628f, 0.0001549627f, 0f);
            canvas.transform.localPosition = this._TextOffset;
            canvas.transform.localRotation = global::UnityEngine.Quaternion.Euler(90f, 180f, 180f);
            global::UnityEngine.UI.Text text = new global::UnityEngine.GameObject().AddComponent <global::UnityEngine.UI.Text>();
            text.transform.SetParent(canvas.transform, false);
            text.GetComponent <global::UnityEngine.RectTransform>().anchorMin = global::UnityEngine.Vector2.zero;
            text.GetComponent <global::UnityEngine.RectTransform>().anchorMax = global::UnityEngine.Vector2.one;
            text.resizeTextForBestFit = true;
            text.resizeTextMaxSize    = 40;
            text.resizeTextMinSize    = 1;
            text.color = global::UnityEngine.Color.black;
            text.font  = global::UnityEngine.Resources.GetBuiltinResource <global::UnityEngine.Font>("Arial.ttf");
            text.horizontalOverflow = 0;
            text.verticalOverflow   = 0;
            text.alignment          = 4;
            text.text           = this._Text;
            this._Line          = base.gameObject.AddComponent <global::UnityEngine.LineRenderer>();
            this._Line.material = global::UnityEngine.Resources.GetBuiltinResource <global::UnityEngine.Material>("Sprites-Default.mat");
            this._Line.SetColors(global::UnityEngine.Color.cyan, global::UnityEngine.Color.cyan);
            this._Line.useWorldSpace = false;
            this._Line.SetVertexCount(4);
            this._Line.SetWidth(0.001f, 0.001f);
            global::UnityEngine.Quaternion quaternion = global::UnityEngine.Quaternion.Inverse(this._Target.localRotation);
            this._Line.SetPosition(0, this._LineOffset + this._HeightVector * 0.1f);
            this._Line.SetPosition(1, this._LineOffset + this._HeightVector * 0.5f + this._MovementVector * 0.2f);
            this._Line.SetPosition(2, this._TextOffset - this._HeightVector * 0.5f - this._MovementVector * 0.2f);
            this._Line.SetPosition(3, this._TextOffset - this._HeightVector * 0.1f);
            global::UnityEngine.GameObject gameObject = global::UnityEngine.GameObject.CreatePrimitive(5);
            gameObject.transform.SetParent(base.transform, false);
            gameObject.transform.localPosition = this._TextOffset - global::UnityEngine.Vector3.up * 0.001f;
            gameObject.transform.localRotation = global::UnityEngine.Quaternion.Euler(90f, 0f, 0f);
            gameObject.transform.localScale    = new global::UnityEngine.Vector3(0.05539737f, 0.009849964f, 0f);
            bool flag = !global::VRGIN.Controls.HelpText.S_Material;

            if (flag)
            {
                global::VRGIN.Controls.HelpText.S_Material       = global::VRGIN.Core.VRManager.Instance.Context.Materials.Unlit;
                global::VRGIN.Controls.HelpText.S_Material.color = global::UnityEngine.Color.white;
            }
            gameObject.transform.GetComponent <global::UnityEngine.Renderer>().sharedMaterial = global::VRGIN.Controls.HelpText.S_Material;
            gameObject.GetComponent <global::UnityEngine.Collider>().enabled = false;
        }
Пример #2
0
 // Token: 0x0600042B RID: 1067 RVA: 0x00014F24 File Offset: 0x00013124
 private void CreateToolCanvas(global::VRGIN.Controls.Tools.Tool tool)
 {
     global::UnityEngine.UI.Image image = new global::UnityEngine.GameObject().AddComponent <global::UnityEngine.UI.Image>();
     image.transform.SetParent(this._Canvas.transform, false);
     global::UnityEngine.Texture2D image2 = tool.Image;
     image.sprite = global::UnityEngine.Sprite.Create(image2, new global::UnityEngine.Rect(0f, 0f, (float)image2.width, (float)image2.height), new global::UnityEngine.Vector2(0.5f, 0.5f));
     image.GetComponent <global::UnityEngine.RectTransform>().anchorMin = new global::UnityEngine.Vector2(0f, 0f);
     image.GetComponent <global::UnityEngine.RectTransform>().anchorMax = new global::UnityEngine.Vector2(1f, 1f);
     image.color = global::UnityEngine.Color.cyan;
     tool.Icon   = image.gameObject;
     tool.Icon.SetActive(false);
     tool.Icon.layer = 0;
 }
Пример #3
0
    // Token: 0x06000065 RID: 101 RVA: 0x0000472C File Offset: 0x0000292C
    public void AttachToCamera(global::SteamVR_Camera vrcam)
    {
        bool flag = this.target == vrcam.head;

        if (!flag)
        {
            this.target = vrcam.head;
            global::UnityEngine.Transform parent  = base.transform.parent;
            global::UnityEngine.Transform parent2 = vrcam.head.parent;
            parent.parent        = parent2;
            parent.localPosition = global::UnityEngine.Vector3.zero;
            parent.localRotation = global::UnityEngine.Quaternion.identity;
            parent.localScale    = global::UnityEngine.Vector3.one;
            vrcam.enabled        = false;
            global::UnityEngine.GameObject gameObject = global::UnityEngine.Object.Instantiate <global::UnityEngine.GameObject>(vrcam.gameObject);
            vrcam.enabled   = true;
            gameObject.name = "camera";
            global::UnityEngine.Object.DestroyImmediate(gameObject.GetComponent <global::SteamVR_Camera>());
            global::UnityEngine.Object.DestroyImmediate(gameObject.GetComponent <global::SteamVR_CameraFlip>());
            this.cam                     = gameObject.GetComponent <global::UnityEngine.Camera>();
            this.cam.fieldOfView         = this.config.fov;
            this.cam.useOcclusionCulling = false;
            this.cam.enabled             = false;
            this.colorMat                = new global::UnityEngine.Material(global::EscalationVR.UnityHelper.GetShader("Custom/SteamVR_ColorOut"));
            this.alphaMat                = new global::UnityEngine.Material(global::EscalationVR.UnityHelper.GetShader("Custom/SteamVR_AlphaOut"));
            this.clipMaterial            = new global::UnityEngine.Material(global::EscalationVR.UnityHelper.GetShader("Custom/SteamVR_ClearAll"));
            global::UnityEngine.Transform transform = gameObject.transform;
            transform.parent        = base.transform;
            transform.localPosition = new global::UnityEngine.Vector3(this.config.x, this.config.y, this.config.z);
            transform.localRotation = global::UnityEngine.Quaternion.Euler(this.config.rx, this.config.ry, this.config.rz);
            transform.localScale    = global::UnityEngine.Vector3.one;
            while (transform.childCount > 0)
            {
                global::UnityEngine.Object.DestroyImmediate(transform.GetChild(0).gameObject);
            }
            this.clipQuad      = global::UnityEngine.GameObject.CreatePrimitive(5);
            this.clipQuad.name = "ClipQuad";
            global::UnityEngine.Object.DestroyImmediate(this.clipQuad.GetComponent <global::UnityEngine.MeshCollider>());
            global::UnityEngine.MeshRenderer component = this.clipQuad.GetComponent <global::UnityEngine.MeshRenderer>();
            component.material             = this.clipMaterial;
            component.shadowCastingMode    = 0;
            component.receiveShadows       = false;
            component.useLightProbes       = false;
            component.reflectionProbeUsage = 0;
            global::UnityEngine.Transform transform2 = this.clipQuad.transform;
            transform2.parent        = transform;
            transform2.localScale    = new global::UnityEngine.Vector3(1000f, 1000f, 1f);
            transform2.localRotation = global::UnityEngine.Quaternion.identity;
            this.clipQuad.SetActive(false);
        }
    }
Пример #4
0
    // Token: 0x060000CC RID: 204 RVA: 0x000092A8 File Offset: 0x000074A8
    private void StripMesh(global::UnityEngine.GameObject go)
    {
        global::UnityEngine.MeshRenderer component = go.GetComponent <global::UnityEngine.MeshRenderer>();
        bool flag = component != null;

        if (flag)
        {
            global::UnityEngine.Object.DestroyImmediate(component);
        }
        global::UnityEngine.MeshFilter component2 = go.GetComponent <global::UnityEngine.MeshFilter>();
        bool flag2 = component2 != null;

        if (flag2)
        {
            global::UnityEngine.Object.DestroyImmediate(component2);
        }
    }