-
Notifications
You must be signed in to change notification settings - Fork 1
/
Plugin.cs
54 lines (47 loc) · 1.56 KB
/
Plugin.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using _IL2CPP;
using BSupport;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace FlipScreenPlugin
{
[BManager.Attributes.ModuleInfo("FlipScreen", "1.0", "BlazeBest")]
unsafe public class Plugin : BManager.VRModule
{
public static GameObject gameObject = null;
public static void Main()
{
gameObject = new GameObject("FlipScreen");
gameObject.RegisterCustomComponent<FlipScreen>();
UnityEngine.Object.DontDestroyOnLoad(gameObject);
}
}
public class FlipScreen: MonoBehaviour
{
public FlipScreen() : base(IntPtr.Zero) { }
public void Update()
{
if (!Input.GetKey(KeyCode.LeftControl)) return;
Camera camera = Camera.main;
if (camera == null) return;
float mouseWheel = Input.GetAxis("Mouse ScrollWheel");
if (mouseWheel > 0.1)
{
Quaternion quaternion = camera.transform.rotation;
Vector3 euler = quaternion.eulerAngles;
euler -= Vector3.forward;
camera.transform.rotation = Quaternion.Euler(euler);
}
else if (mouseWheel < -0.1)
{
Quaternion quaternion = camera.transform.rotation;
Vector3 euler = quaternion.eulerAngles;
euler += Vector3.forward;
camera.transform.rotation = Quaternion.Euler(euler);
}
}
}
}