Upload files to "/"
This commit is contained in:
1 parent
11529b4d99
commit
9cf85fa2b1
4 files changed
+318
No files matched your search
@@ -0,0 +1,10 @@
|
|||||||
|
namespace FortniteEmoteWheel
|
||||||
|
{
|
||||||
|
internal class Constants
|
||||||
|
{
|
||||||
|
public const string Guid = "com.deez.fortniteemotewheel";
|
||||||
|
public const string Name = "FortniteEmoteWheel";
|
||||||
|
public const string Version = "1.5.8";
|
||||||
|
public const string Hashkey = "github.com/DeezVrOfficial/FortniteEmoteWheel";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<GamePath>C:\Program Files (x86)\Steam\steamapps\common\Gorilla Tag</GamePath>
|
||||||
|
<GameAssemblyPath>$(GamePath)\Gorilla Tag_Data\Managed</GameAssemblyPath>
|
||||||
|
<BepInExAssemblyPath>$(GamePath)\BepInEx\core</BepInExAssemblyPath>
|
||||||
|
<PluginsPath>$(GamePath)\BepInEx\plugins</PluginsPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<Project>
|
||||||
|
<Target Name="CopyToPlugins" AfterTargets="Build" Condition="'$(CI)'!='TRUE'">
|
||||||
|
<Copy SourceFiles="$(TargetPath)" DestinationFiles="$(PluginsPath)\$(TargetFileName)" />
|
||||||
|
<Message Text="Copied to Plugins" Importance="high"/>
|
||||||
|
</Target>
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,292 @@
|
|||||||
|
using BepInEx;
|
||||||
|
using FortniteEmoteWheel.Classes;
|
||||||
|
using FortniteEmoteWheel.Classes.Admin;
|
||||||
|
using FortniteEmoteWheel.Classes.EzVersionChecking;
|
||||||
|
using FortniteEmoteWheel.Patches;
|
||||||
|
using Photon.Pun;
|
||||||
|
using Photon.Voice.Unity;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
using TMPro;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
using Debug = UnityEngine.Debug;
|
||||||
|
using Hashtable = ExitGames.Client.Photon.Hashtable;
|
||||||
|
|
||||||
|
namespace FortniteEmoteWheel
|
||||||
|
{
|
||||||
|
[BepInIncompatibility("org.hamburbur.menu")] // ZlothY told me himself it don't work.
|
||||||
|
[BepInPlugin(Constants.Guid, Constants.Name, Constants.Version)]
|
||||||
|
public class Plugin : BaseUnityPlugin
|
||||||
|
{
|
||||||
|
public static Plugin Instance;
|
||||||
|
|
||||||
|
public static Transform firstPersonCameraTransform;
|
||||||
|
public static Transform thirdPersonCameraTransform;
|
||||||
|
|
||||||
|
public void Awake() =>
|
||||||
|
Instance = this;
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
HarmonyPatches.ApplyHarmonyPatches();
|
||||||
|
GorillaTagger.OnPlayerSpawned(OnGameInitialized);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnGameInitialized()
|
||||||
|
{
|
||||||
|
gameObject.AddComponent<PromotionManager>();
|
||||||
|
gameObject.AddComponent<TrackerManager>();
|
||||||
|
|
||||||
|
GameObject hamburburDataContainer = new("FEWHamburburData");
|
||||||
|
hamburburDataContainer.AddComponent<HamburburData>();
|
||||||
|
|
||||||
|
firstPersonCameraTransform = GorillaTagger.Instance.mainCamera.transform;
|
||||||
|
thirdPersonCameraTransform = GorillaTagger.Instance.thirdPersonCamera.transform.GetChild(0);
|
||||||
|
|
||||||
|
VersionCheckingInitializer.StartVersionChecking();
|
||||||
|
|
||||||
|
VersionCheckingInitializer.VersionOutdatedDetected += () =>
|
||||||
|
{
|
||||||
|
if (PromotionManager.Instance != null && PromotionManager.Instance.TextObj != null)
|
||||||
|
PromotionManager.Instance.TextObj.text = VersionCheckingInitializer.OutdatedMessage;
|
||||||
|
|
||||||
|
emoteTime = -9999f;
|
||||||
|
|
||||||
|
if (audiomgr != null)
|
||||||
|
{
|
||||||
|
if (audiomgr.GetComponent<AudioSource>() != null)
|
||||||
|
audiomgr.GetComponent<AudioSource>().Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Wheel.instance != null)
|
||||||
|
{
|
||||||
|
Wheel.instance.SetVisible(false);
|
||||||
|
Wheel.instance.enabled = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Hashtable properties = new()
|
||||||
|
{
|
||||||
|
{
|
||||||
|
$"{Constants.Hashkey}",
|
||||||
|
$"Made by Deez! Version - {Constants.Version}"
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
PhotonNetwork.LocalPlayer.SetCustomProperties(properties);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static AssetBundle assetBundle;
|
||||||
|
public static GameObject LoadAsset(string assetName)
|
||||||
|
{
|
||||||
|
GameObject gameObject = null;
|
||||||
|
|
||||||
|
Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("FortniteEmoteWheel.Resources.fn");
|
||||||
|
if (stream != null)
|
||||||
|
{
|
||||||
|
if (assetBundle == null)
|
||||||
|
assetBundle = AssetBundle.LoadFromStream(stream);
|
||||||
|
gameObject = Instantiate<GameObject>(assetBundle.LoadAsset<GameObject>(assetName));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Debug.LogError("Failed to load asset from resource: " + assetName);
|
||||||
|
|
||||||
|
return gameObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GameObject audiomgr = null;
|
||||||
|
public static void Play2DAudio(AudioClip sound, float volume, bool looping = false)
|
||||||
|
{
|
||||||
|
if (audiomgr == null)
|
||||||
|
{
|
||||||
|
audiomgr = new GameObject("2DAudioMgr");
|
||||||
|
AudioSource temp = audiomgr.AddComponent<AudioSource>();
|
||||||
|
temp.spatialBlend = 0f;
|
||||||
|
}
|
||||||
|
AudioSource ausrc = audiomgr.GetComponent<AudioSource>();
|
||||||
|
ausrc.volume = volume;
|
||||||
|
ausrc.loop = looping;
|
||||||
|
if (!looping)
|
||||||
|
ausrc.PlayOneShot(sound);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ausrc.clip = sound;
|
||||||
|
ausrc.Play();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Dictionary<string, AudioClip> audioPool = new Dictionary<string, AudioClip> { };
|
||||||
|
public static AudioClip LoadSoundFromResource(string resourcePath)
|
||||||
|
{
|
||||||
|
AudioClip sound = null;
|
||||||
|
|
||||||
|
if (!audioPool.ContainsKey(resourcePath))
|
||||||
|
{
|
||||||
|
Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("FortniteEmoteWheel.Resources.fn");
|
||||||
|
if (stream != null)
|
||||||
|
{
|
||||||
|
if (assetBundle == null)
|
||||||
|
assetBundle = AssetBundle.LoadFromStream(stream);
|
||||||
|
|
||||||
|
sound = assetBundle.LoadAsset(resourcePath) as AudioClip;
|
||||||
|
audioPool.Add(resourcePath, sound);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError("Failed to load sound from resource: " + resourcePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sound = audioPool[resourcePath];
|
||||||
|
|
||||||
|
return sound;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static readonly List<GameObject> portedCosmetics = new List<GameObject> { };
|
||||||
|
public static void DisableCosmetics()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
VRRig.LocalRig.transform.Find("rig/head/gorillaface").gameObject.layer = LayerMask.NameToLayer("Default");
|
||||||
|
foreach (GameObject Cosmetic in VRRig.LocalRig.cosmetics)
|
||||||
|
{
|
||||||
|
if (Cosmetic.activeSelf && Cosmetic.transform.parent == VRRig.LocalRig.mainCamera.transform.Find("HeadCosmetics"))
|
||||||
|
{
|
||||||
|
portedCosmetics.Add(Cosmetic);
|
||||||
|
Cosmetic.transform.SetParent(VRRig.LocalRig.headMesh.transform, false);
|
||||||
|
Cosmetic.transform.localPosition += new Vector3(0f, 0.1333f, 0.1f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void EnableCosmetics()
|
||||||
|
{
|
||||||
|
VRRig.LocalRig.transform.Find("rig/head/gorillaface").gameObject.layer = LayerMask.NameToLayer("MirrorOnly");
|
||||||
|
foreach (GameObject Cosmetic in portedCosmetics)
|
||||||
|
{
|
||||||
|
Cosmetic.transform.SetParent(VRRig.LocalRig.mainCamera.transform.Find("HeadCosmetics"), false);
|
||||||
|
Cosmetic.transform.localPosition -= new Vector3(0f, 0.1333f, 0.1f);
|
||||||
|
}
|
||||||
|
portedCosmetics.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GameObject Kyle;
|
||||||
|
public static float emoteTime;
|
||||||
|
|
||||||
|
public static Vector3 archivePosition;
|
||||||
|
|
||||||
|
public static void Emote(string emoteName, string emoteSound, float animationTime = -1f, bool looping = false)
|
||||||
|
{
|
||||||
|
if (Kyle != null)
|
||||||
|
Destroy(Kyle);
|
||||||
|
|
||||||
|
VRRig.LocalRig.enabled = false;
|
||||||
|
DisableCosmetics();
|
||||||
|
|
||||||
|
Play2DAudio(LoadSoundFromResource("play"), 0.5f);
|
||||||
|
|
||||||
|
archivePosition = GorillaTagger.Instance.transform.position;
|
||||||
|
GorillaLocomotion.GTPlayer.Instance.GetControllerTransform(false).parent.rotation *= Quaternion.Euler(0f, 180f, 0f);
|
||||||
|
|
||||||
|
Kyle = LoadAsset("Rig");
|
||||||
|
Kyle.transform.position = VRRig.LocalRig.transform.Find("rig/body_pivot").position - new Vector3(0f, 1.15f, 0f);
|
||||||
|
Kyle.transform.rotation = VRRig.LocalRig.transform.Find("rig/body_pivot").rotation;
|
||||||
|
|
||||||
|
Kyle.transform.Find("KyleRobot/RobotKile").gameObject.GetComponent<Renderer>().renderingLayerMask = 0;
|
||||||
|
|
||||||
|
Animator KyleRobot = Kyle.transform.Find("KyleRobot").GetComponent<Animator>();
|
||||||
|
KyleRobot.enabled = true;
|
||||||
|
|
||||||
|
AnimationClip Animation = null;
|
||||||
|
foreach (AnimationClip Clip in KyleRobot.runtimeAnimatorController.animationClips)
|
||||||
|
{
|
||||||
|
if (Clip.name == emoteName)
|
||||||
|
{
|
||||||
|
Animation = Clip;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Animation.wrapMode = looping ? WrapMode.Loop : WrapMode.Default;
|
||||||
|
KyleRobot.Play(Animation.name);
|
||||||
|
|
||||||
|
AudioClip Sound = LoadSoundFromResource(emoteSound);
|
||||||
|
Play2DAudio(Sound, 0.5f, looping);
|
||||||
|
|
||||||
|
if (GorillaTagger.Instance.myRecorder != null)
|
||||||
|
{
|
||||||
|
GorillaTagger.Instance.myRecorder.SourceType = Recorder.InputSourceType.AudioClip;
|
||||||
|
GorillaTagger.Instance.myRecorder.AudioClip = Sound;
|
||||||
|
GorillaTagger.Instance.myRecorder.RestartRecording(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
emoteTime = Time.time + (animationTime > 0f ? animationTime : Animation.length) + (looping ? 999999999999999f : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vector3 World2Player(Vector3 world) => world - GorillaTagger.Instance.bodyCollider.transform.position + GorillaTagger.Instance.transform.position;
|
||||||
|
|
||||||
|
public void Update()
|
||||||
|
{
|
||||||
|
if (GorillaLocomotion.GTPlayer.Instance == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (Wheel.instance == null && VRRig.LocalRig != null)
|
||||||
|
{
|
||||||
|
GameObject Wheel = Plugin.LoadAsset("Wheel");
|
||||||
|
Wheel.transform.SetParent(VRRig.LocalRig.transform.Find("rig/hand.R"), false);
|
||||||
|
Wheel.AddComponent<Wheel>();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Time.time < emoteTime)
|
||||||
|
{
|
||||||
|
if (Kyle != null)
|
||||||
|
{
|
||||||
|
VRRig.LocalRig.enabled = false;
|
||||||
|
|
||||||
|
GorillaTagger.Instance.transform.position = World2Player(Kyle.transform.position + (Kyle.transform.forward * 1.5f) + new Vector3(0f, 1.15f, 0f)) + new Vector3(0f, 0.5f, 0f);
|
||||||
|
GorillaTagger.Instance.leftHandTransform.position = GorillaTagger.Instance.bodyCollider.transform.position;
|
||||||
|
GorillaTagger.Instance.rightHandTransform.position = GorillaTagger.Instance.bodyCollider.transform.position;
|
||||||
|
|
||||||
|
GorillaTagger.Instance.rigidbody.linearVelocity = Vector3.zero;
|
||||||
|
|
||||||
|
VRRig.LocalRig.transform.position = Kyle.transform.Find("KyleRobot/ROOT/Hips/Spine1/Spine2").transform.position - (Kyle.transform.Find("KyleRobot/ROOT/Hips/Spine1/Spine2").transform.right / 2.5f);
|
||||||
|
VRRig.LocalRig.transform.rotation = Quaternion.Euler(new Vector3(0f, Kyle.transform.Find("KyleRobot/ROOT/Hips/Spine1/Spine2").transform.rotation.eulerAngles.y, 0f));
|
||||||
|
|
||||||
|
VRRig.LocalRig.leftHand.rigTarget.transform.position = Kyle.transform.Find("KyleRobot/ROOT/Hips/Spine1/Spine2/LeftShoulder/LeftUpperArm/LeftArm/LeftHand").transform.position;
|
||||||
|
VRRig.LocalRig.rightHand.rigTarget.transform.position = Kyle.transform.Find("KyleRobot/ROOT/Hips/Spine1/Spine2/RightShoulder/RightUpperArm/RightArm/RightHand").transform.position;
|
||||||
|
|
||||||
|
VRRig.LocalRig.leftHand.rigTarget.transform.rotation = Kyle.transform.Find("KyleRobot/ROOT/Hips/Spine1/Spine2/LeftShoulder/LeftUpperArm/LeftArm/LeftHand").transform.rotation * Quaternion.Euler(0, 0, 75);
|
||||||
|
VRRig.LocalRig.rightHand.rigTarget.transform.rotation = Kyle.transform.Find("KyleRobot/ROOT/Hips/Spine1/Spine2/RightShoulder/RightUpperArm/RightArm/RightHand").transform.rotation * Quaternion.Euler(180, 0, -75);
|
||||||
|
|
||||||
|
VRRig.LocalRig.head.rigTarget.transform.rotation = Kyle.transform.Find("KyleRobot/ROOT/Hips/Spine1/Spine2/Neck/Head").transform.rotation * Quaternion.Euler(0f, 0f, 90f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Kyle != null)
|
||||||
|
{
|
||||||
|
VRRig.LocalRig.enabled = true;
|
||||||
|
EnableCosmetics();
|
||||||
|
|
||||||
|
Destroy(Kyle);
|
||||||
|
|
||||||
|
if (GorillaTagger.Instance.myRecorder != null)
|
||||||
|
{
|
||||||
|
GorillaTagger.Instance.myRecorder.SourceType = Recorder.InputSourceType.Microphone;
|
||||||
|
GorillaTagger.Instance.myRecorder.AudioClip = null;
|
||||||
|
GorillaTagger.Instance.myRecorder.RestartRecording(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
GorillaTagger.Instance.transform.position = archivePosition;
|
||||||
|
GorillaLocomotion.GTPlayer.Instance.GetControllerTransform(false).parent.rotation *= Quaternion.Euler(0f, 180f, 0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user