using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using FistVR;
using OtherLoader;
using Sodalite.Api;
using UnityEditor;
using UnityEngine;
using UnityEngine.UI;
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[RequireComponent(typeof(ParticleSystem))]
public class CFX_AutoStopLoopedEffect : MonoBehaviour
{
public float effectDuration = 2.5f;
private float d;
private void OnEnable()
{
d = effectDuration;
}
private void Update()
{
if (!(d > 0f))
{
return;
}
d -= Time.deltaTime;
if (d <= 0f)
{
((Component)this).GetComponent<ParticleSystem>().Stop(true);
CFX_Demo_Translate component = ((Component)this).gameObject.GetComponent<CFX_Demo_Translate>();
if ((Object)(object)component != (Object)null)
{
((Behaviour)component).enabled = false;
}
}
}
}
public class CFX_Demo_RandomDir : MonoBehaviour
{
public Vector3 min = new Vector3(0f, 0f, 0f);
public Vector3 max = new Vector3(0f, 360f, 0f);
private void Awake()
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
((Component)this).transform.eulerAngles = new Vector3(Random.Range(min.x, max.x), Random.Range(min.y, max.y), Random.Range(min.z, max.z));
}
}
public class CFX_Demo_RotateCamera : MonoBehaviour
{
public static bool rotating = true;
public float speed = 30f;
public Transform rotationCenter;
private void Update()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
if (rotating)
{
((Component)this).transform.RotateAround(rotationCenter.position, Vector3.up, speed * Time.deltaTime);
}
}
}
public class CFX_Demo_Translate : MonoBehaviour
{
public float speed = 30f;
public Vector3 rotation = Vector3.forward;
public Vector3 axis = Vector3.forward;
public bool gravity;
private Vector3 dir;
private void Start()
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
dir = new Vector3(Random.Range(0f, 360f), Random.Range(0f, 360f), Random.Range(0f, 360f));
((Vector3)(ref dir)).Scale(rotation);
((Component)this).transform.localEulerAngles = dir;
}
private void Update()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
((Component)this).transform.Translate(axis * speed * Time.deltaTime, (Space)1);
}
}
public class WFX_Demo : MonoBehaviour
{
public float cameraSpeed = 10f;
public bool orderedSpawns = true;
public float step = 1f;
public float range = 5f;
private float order = -5f;
public GameObject walls;
public GameObject bulletholes;
public GameObject[] ParticleExamples;
private int exampleIndex;
private string randomSpawnsDelay = "0.5";
private bool randomSpawns;
private bool slowMo;
private bool rotateCam = true;
public Material wood;
public Material concrete;
public Material metal;
public Material checker;
public Material woodWall;
public Material concreteWall;
public Material metalWall;
public Material checkerWall;
private string groundTextureStr = "Checker";
private List<string> groundTextures = new List<string>(new string[4] { "Concrete", "Wood", "Metal", "Checker" });
public GameObject m4;
public GameObject m4fps;
private bool rotate_m4 = true;
private void OnMouseDown()
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
RaycastHit val = default(RaycastHit);
if (((Component)this).GetComponent<Collider>().Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), ref val, 9999f))
{
GameObject val2 = spawnParticle();
if (!((Object)val2).name.StartsWith("WFX_MF"))
{
val2.transform.position = ((RaycastHit)(ref val)).point + val2.transform.position;
}
}
}
public GameObject spawnParticle()
{
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate<GameObject>(ParticleExamples[exampleIndex]);
if (((Object)val).name.StartsWith("WFX_MF"))
{
val.transform.parent = ParticleExamples[exampleIndex].transform.parent;
val.transform.localPosition = ParticleExamples[exampleIndex].transform.localPosition;
val.transform.localRotation = ParticleExamples[exampleIndex].transform.localRotation;
}
else if (((Object)val).name.Contains("Hole"))
{
val.transform.parent = bulletholes.transform;
}
SetActiveCrossVersions(val, active: true);
return val;
}
private void SetActiveCrossVersions(GameObject obj, bool active)
{
obj.SetActive(active);
for (int i = 0; i < obj.transform.childCount; i++)
{
((Component)obj.transform.GetChild(i)).gameObject.SetActive(active);
}
}
private void OnGUI()
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0321: Unknown result type (might be due to invalid IL or missing references)
//IL_0326: Unknown result type (might be due to invalid IL or missing references)
//IL_033a: Unknown result type (might be due to invalid IL or missing references)
//IL_033f: Unknown result type (might be due to invalid IL or missing references)
//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
GUILayout.BeginArea(new Rect(5f, 20f, (float)(Screen.width - 10), 60f));
GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
GUILayout.Label("Effect: " + ((Object)ParticleExamples[exampleIndex]).name, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(280f) });
if (GUILayout.Button("<", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) }))
{
prevParticle();
}
if (GUILayout.Button(">", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) }))
{
nextParticle();
}
GUILayout.FlexibleSpace();
GUILayout.Label("Click on the ground to spawn the selected effect", (GUILayoutOption[])(object)new GUILayoutOption[0]);
GUILayout.FlexibleSpace();
if (GUILayout.Button((!rotateCam) ? "Rotate Camera" : "Pause Camera", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f) }))
{
rotateCam = !rotateCam;
}
if (GUILayout.Button((!((Component)this).GetComponent<Renderer>().enabled) ? "Show Ground" : "Hide Ground", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) }))
{
((Component)this).GetComponent<Renderer>().enabled = !((Component)this).GetComponent<Renderer>().enabled;
}
if (GUILayout.Button((!slowMo) ? "Slow Motion" : "Normal Speed", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }))
{
slowMo = !slowMo;
if (slowMo)
{
Time.timeScale = 0.33f;
}
else
{
Time.timeScale = 1f;
}
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
GUILayout.Label("Ground texture: " + groundTextureStr, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) });
if (GUILayout.Button("<", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) }))
{
prevTexture();
}
if (GUILayout.Button(">", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) }))
{
nextTexture();
}
GUILayout.EndHorizontal();
GUILayout.EndArea();
if (!m4.GetComponent<Renderer>().enabled)
{
return;
}
GUILayout.BeginArea(new Rect(5f, (float)(Screen.height - 100), (float)(Screen.width - 10), 90f));
rotate_m4 = GUILayout.Toggle(rotate_m4, "AutoRotate Weapon", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(250f) });
GUI.enabled = !rotate_m4;
float x = m4.transform.localEulerAngles.x;
x = ((!(x > 90f)) ? x : (x - 180f));
float y = m4.transform.localEulerAngles.y;
float z = m4.transform.localEulerAngles.z;
x = GUILayout.HorizontalSlider(x, 0f, 179f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(256f) });
y = GUILayout.HorizontalSlider(y, 0f, 359f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(256f) });
z = GUILayout.HorizontalSlider(z, 0f, 359f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(256f) });
if (GUI.changed)
{
if (x > 90f)
{
x += 180f;
}
m4.transform.localEulerAngles = new Vector3(x, y, z);
Debug.Log((object)x);
}
GUILayout.EndArea();
}
private IEnumerator RandomSpawnsCoroutine()
{
while (true)
{
GameObject particles = spawnParticle();
if (orderedSpawns)
{
particles.transform.position = ((Component)this).transform.position + new Vector3(order, particles.transform.position.y, 0f);
order -= step;
if (order < 0f - range)
{
order = range;
}
}
else
{
particles.transform.position = ((Component)this).transform.position + new Vector3(Random.Range(0f - range, range), 0f, Random.Range(0f - range, range)) + new Vector3(0f, particles.transform.position.y, 0f);
}
yield return (object)new WaitForSeconds(float.Parse(randomSpawnsDelay));
}
}
private void Update()
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
if (Input.GetKeyDown((KeyCode)276))
{
prevParticle();
}
else if (Input.GetKeyDown((KeyCode)275))
{
nextParticle();
}
if (rotateCam)
{
((Component)Camera.main).transform.RotateAround(Vector3.zero, Vector3.up, cameraSpeed * Time.deltaTime);
}
if (rotate_m4)
{
m4.transform.Rotate(new Vector3(0f, 40f, 0f) * Time.deltaTime, (Space)0);
}
}
private void prevTexture()
{
int num = groundTextures.IndexOf(groundTextureStr);
num--;
if (num < 0)
{
num = groundTextures.Count - 1;
}
groundTextureStr = groundTextures[num];
selectMaterial();
}
private void nextTexture()
{
int num = groundTextures.IndexOf(groundTextureStr);
num++;
if (num >= groundTextures.Count)
{
num = 0;
}
groundTextureStr = groundTextures[num];
selectMaterial();
}
private void selectMaterial()
{
switch (groundTextureStr)
{
case "Concrete":
((Component)this).GetComponent<Renderer>().material = concrete;
((Component)walls.transform.GetChild(0)).GetComponent<Renderer>().material = concreteWall;
((Component)walls.transform.GetChild(1)).GetComponent<Renderer>().material = concreteWall;
break;
case "Wood":
((Component)this).GetComponent<Renderer>().material = wood;
((Component)walls.transform.GetChild(0)).GetComponent<Renderer>().material = woodWall;
((Component)walls.transform.GetChild(1)).GetComponent<Renderer>().material = woodWall;
break;
case "Metal":
((Component)this).GetComponent<Renderer>().material = metal;
((Component)walls.transform.GetChild(0)).GetComponent<Renderer>().material = metalWall;
((Component)walls.transform.GetChild(1)).GetComponent<Renderer>().material = metalWall;
break;
case "Checker":
((Component)this).GetComponent<Renderer>().material = checker;
((Component)walls.transform.GetChild(0)).GetComponent<Renderer>().material = checkerWall;
((Component)walls.transform.GetChild(1)).GetComponent<Renderer>().material = checkerWall;
break;
}
}
private void prevParticle()
{
exampleIndex--;
if (exampleIndex < 0)
{
exampleIndex = ParticleExamples.Length - 1;
}
showHideStuff();
}
private void nextParticle()
{
exampleIndex++;
if (exampleIndex >= ParticleExamples.Length)
{
exampleIndex = 0;
}
showHideStuff();
}
private void showHideStuff()
{
if (((Object)ParticleExamples[exampleIndex]).name.StartsWith("WFX_MF Spr"))
{
m4.GetComponent<Renderer>().enabled = true;
}
else
{
m4.GetComponent<Renderer>().enabled = false;
}
if (((Object)ParticleExamples[exampleIndex]).name.StartsWith("WFX_MF FPS"))
{
m4fps.GetComponent<Renderer>().enabled = true;
}
else
{
m4fps.GetComponent<Renderer>().enabled = false;
}
if (((Object)ParticleExamples[exampleIndex]).name.StartsWith("WFX_BImpact"))
{
SetActiveCrossVersions(walls, active: true);
Renderer[] componentsInChildren = bulletholes.GetComponentsInChildren<Renderer>();
Renderer[] array = componentsInChildren;
foreach (Renderer val in array)
{
val.enabled = true;
}
}
else
{
SetActiveCrossVersions(walls, active: false);
Renderer[] componentsInChildren2 = bulletholes.GetComponentsInChildren<Renderer>();
Renderer[] array2 = componentsInChildren2;
foreach (Renderer val2 in array2)
{
val2.enabled = false;
}
}
if (((Object)ParticleExamples[exampleIndex]).name.Contains("Wood"))
{
groundTextureStr = "Wood";
selectMaterial();
}
else if (((Object)ParticleExamples[exampleIndex]).name.Contains("Concrete"))
{
groundTextureStr = "Concrete";
selectMaterial();
}
else if (((Object)ParticleExamples[exampleIndex]).name.Contains("Metal"))
{
groundTextureStr = "Metal";
selectMaterial();
}
else if (((Object)ParticleExamples[exampleIndex]).name.Contains("Dirt") || ((Object)ParticleExamples[exampleIndex]).name.Contains("Sand") || ((Object)ParticleExamples[exampleIndex]).name.Contains("SoftBody"))
{
groundTextureStr = "Checker";
selectMaterial();
}
else if (((Object)ParticleExamples[exampleIndex]).name == "WFX_Explosion")
{
groundTextureStr = "Checker";
selectMaterial();
}
}
}
public class WFX_Demo_DeleteAfterDelay : MonoBehaviour
{
public float delay = 1f;
private void Update()
{
delay -= Time.deltaTime;
if (delay < 0f)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
}
public class WFX_Demo_New : MonoBehaviour
{
public Renderer groundRenderer;
public Collider groundCollider;
[Space]
[Space]
public Image slowMoBtn;
public Text slowMoLabel;
public Image camRotBtn;
public Text camRotLabel;
public Image groundBtn;
public Text groundLabel;
[Space]
public Text EffectLabel;
public Text EffectIndexLabel;
public GameObject[] AdditionalEffects;
public GameObject ground;
public GameObject walls;
public GameObject bulletholes;
public GameObject m4;
public GameObject m4fps;
public Material wood;
public Material concrete;
public Material metal;
public Material checker;
public Material woodWall;
public Material concreteWall;
public Material metalWall;
public Material checkerWall;
private string groundTextureStr = "Checker";
private List<string> groundTextures = new List<string>(new string[4] { "Concrete", "Wood", "Metal", "Checker" });
private GameObject[] ParticleExamples;
private int exampleIndex;
private bool slowMo;
private Vector3 defaultCamPosition;
private Quaternion defaultCamRotation;
private List<GameObject> onScreenParticles = new List<GameObject>();
private void Awake()
{
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
List<GameObject> list = new List<GameObject>();
int childCount = ((Component)this).transform.childCount;
for (int i = 0; i < childCount; i++)
{
GameObject gameObject = ((Component)((Component)this).transform.GetChild(i)).gameObject;
list.Add(gameObject);
}
list.AddRange(AdditionalEffects);
ParticleExamples = list.ToArray();
defaultCamPosition = ((Component)Camera.main).transform.position;
defaultCamRotation = ((Component)Camera.main).transform.rotation;
((MonoBehaviour)this).StartCoroutine("CheckForDeletedParticles");
UpdateUI();
}
private void Update()
{
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
if (Input.GetKeyDown((KeyCode)276))
{
prevParticle();
}
else if (Input.GetKeyDown((KeyCode)275))
{
nextParticle();
}
else if (Input.GetKeyDown((KeyCode)127))
{
destroyParticles();
}
if (Input.GetMouseButtonDown(0))
{
RaycastHit val = default(RaycastHit);
if (groundCollider.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), ref val, 9999f))
{
GameObject val2 = spawnParticle();
if (!((Object)val2).name.StartsWith("WFX_MF"))
{
val2.transform.position = ((RaycastHit)(ref val)).point + val2.transform.position;
}
}
}
float axis = Input.GetAxis("Mouse ScrollWheel");
if (axis != 0f)
{
((Component)Camera.main).transform.Translate(Vector3.forward * ((!(axis < 0f)) ? 1f : (-1f)), (Space)1);
}
if (Input.GetMouseButtonDown(2))
{
((Component)Camera.main).transform.position = defaultCamPosition;
((Component)Camera.main).transform.rotation = defaultCamRotation;
}
}
public void OnToggleGround()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
Color white = Color.white;
groundRenderer.enabled = !groundRenderer.enabled;
white.a = ((!groundRenderer.enabled) ? 0.33f : 1f);
((Graphic)groundBtn).color = white;
((Graphic)groundLabel).color = white;
}
public void OnToggleCamera()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
Color white = Color.white;
CFX_Demo_RotateCamera.rotating = !CFX_Demo_RotateCamera.rotating;
white.a = ((!CFX_Demo_RotateCamera.rotating) ? 0.33f : 1f);
((Graphic)camRotBtn).color = white;
((Graphic)camRotLabel).color = white;
}
public void OnToggleSlowMo()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
Color white = Color.white;
slowMo = !slowMo;
if (slowMo)
{
Time.timeScale = 0.33f;
white.a = 1f;
}
else
{
Time.timeScale = 1f;
white.a = 0.33f;
}
((Graphic)slowMoBtn).color = white;
((Graphic)slowMoLabel).color = white;
}
public void OnPreviousEffect()
{
prevParticle();
}
public void OnNextEffect()
{
nextParticle();
}
private void UpdateUI()
{
EffectLabel.text = ((Object)ParticleExamples[exampleIndex]).name;
EffectIndexLabel.text = string.Format("{0}/{1}", (exampleIndex + 1).ToString("00"), ParticleExamples.Length.ToString("00"));
}
public GameObject spawnParticle()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate<GameObject>(ParticleExamples[exampleIndex]);
val.transform.position = new Vector3(0f, val.transform.position.y, 0f);
val.SetActive(true);
if (((Object)val).name.StartsWith("WFX_MF"))
{
val.transform.parent = ParticleExamples[exampleIndex].transform.parent;
val.transform.localPosition = ParticleExamples[exampleIndex].transform.localPosition;
val.transform.localRotation = ParticleExamples[exampleIndex].transform.localRotation;
}
else if (((Object)val).name.Contains("Hole"))
{
val.transform.parent = bulletholes.transform;
}
ParticleSystem component = val.GetComponent<ParticleSystem>();
if ((Object)(object)component != (Object)null)
{
MainModule main = component.main;
if (((MainModule)(ref main)).loop)
{
((Component)component).gameObject.AddComponent<CFX_AutoStopLoopedEffect>();
((Component)component).gameObject.AddComponent<CFX_AutoDestructShuriken>();
}
}
onScreenParticles.Add(val);
return val;
}
private IEnumerator CheckForDeletedParticles()
{
while (true)
{
yield return (object)new WaitForSeconds(5f);
for (int num = onScreenParticles.Count - 1; num >= 0; num--)
{
if ((Object)(object)onScreenParticles[num] == (Object)null)
{
onScreenParticles.RemoveAt(num);
}
}
}
}
private void prevParticle()
{
exampleIndex--;
if (exampleIndex < 0)
{
exampleIndex = ParticleExamples.Length - 1;
}
UpdateUI();
showHideStuff();
}
private void nextParticle()
{
exampleIndex++;
if (exampleIndex >= ParticleExamples.Length)
{
exampleIndex = 0;
}
UpdateUI();
showHideStuff();
}
private void destroyParticles()
{
for (int num = onScreenParticles.Count - 1; num >= 0; num--)
{
if ((Object)(object)onScreenParticles[num] != (Object)null)
{
Object.Destroy((Object)(object)onScreenParticles[num]);
}
onScreenParticles.RemoveAt(num);
}
}
private void prevTexture()
{
int num = groundTextures.IndexOf(groundTextureStr);
num--;
if (num < 0)
{
num = groundTextures.Count - 1;
}
groundTextureStr = groundTextures[num];
selectMaterial();
}
private void nextTexture()
{
int num = groundTextures.IndexOf(groundTextureStr);
num++;
if (num >= groundTextures.Count)
{
num = 0;
}
groundTextureStr = groundTextures[num];
selectMaterial();
}
private void selectMaterial()
{
switch (groundTextureStr)
{
case "Concrete":
ground.GetComponent<Renderer>().material = concrete;
((Component)walls.transform.GetChild(0)).GetComponent<Renderer>().material = concreteWall;
((Component)walls.transform.GetChild(1)).GetComponent<Renderer>().material = concreteWall;
break;
case "Wood":
ground.GetComponent<Renderer>().material = wood;
((Component)walls.transform.GetChild(0)).GetComponent<Renderer>().material = woodWall;
((Component)walls.transform.GetChild(1)).GetComponent<Renderer>().material = woodWall;
break;
case "Metal":
ground.GetComponent<Renderer>().material = metal;
((Component)walls.transform.GetChild(0)).GetComponent<Renderer>().material = metalWall;
((Component)walls.transform.GetChild(1)).GetComponent<Renderer>().material = metalWall;
break;
case "Checker":
ground.GetComponent<Renderer>().material = checker;
((Component)walls.transform.GetChild(0)).GetComponent<Renderer>().material = checkerWall;
((Component)walls.transform.GetChild(1)).GetComponent<Renderer>().material = checkerWall;
break;
}
}
private void showHideStuff()
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
if (((Object)ParticleExamples[exampleIndex]).name.StartsWith("WFX_MF Spr"))
{
m4.GetComponent<Renderer>().enabled = true;
((Component)Camera.main).transform.position = new Vector3(-2.482457f, 3.263842f, -0.004924395f);
((Component)Camera.main).transform.eulerAngles = new Vector3(20f, 90f, 0f);
}
else
{
m4.GetComponent<Renderer>().enabled = false;
}
if (((Object)ParticleExamples[exampleIndex]).name.StartsWith("WFX_MF FPS"))
{
m4fps.GetComponent<Renderer>().enabled = true;
}
else
{
m4fps.GetComponent<Renderer>().enabled = false;
}
if (((Object)ParticleExamples[exampleIndex]).name.StartsWith("WFX_BImpact"))
{
walls.SetActive(true);
Renderer[] componentsInChildren = bulletholes.GetComponentsInChildren<Renderer>();
Renderer[] array = componentsInChildren;
foreach (Renderer val in array)
{
val.enabled = true;
}
}
else
{
walls.SetActive(false);
Renderer[] componentsInChildren2 = bulletholes.GetComponentsInChildren<Renderer>();
Renderer[] array2 = componentsInChildren2;
foreach (Renderer val2 in array2)
{
val2.enabled = false;
}
}
if (((Object)ParticleExamples[exampleIndex]).name.Contains("Wood"))
{
groundTextureStr = "Wood";
selectMaterial();
}
else if (((Object)ParticleExamples[exampleIndex]).name.Contains("Concrete"))
{
groundTextureStr = "Concrete";
selectMaterial();
}
else if (((Object)ParticleExamples[exampleIndex]).name.Contains("Metal"))
{
groundTextureStr = "Metal";
selectMaterial();
}
else if (((Object)ParticleExamples[exampleIndex]).name.Contains("Dirt") || ((Object)ParticleExamples[exampleIndex]).name.Contains("Sand") || ((Object)ParticleExamples[exampleIndex]).name.Contains("SoftBody"))
{
groundTextureStr = "Checker";
selectMaterial();
}
else if (((Object)ParticleExamples[exampleIndex]).name == "WFX_Explosion")
{
groundTextureStr = "Checker";
selectMaterial();
}
}
}
public class WFX_Demo_RandomDir : MonoBehaviour
{
public Vector3 min = new Vector3(0f, 0f, 0f);
public Vector3 max = new Vector3(0f, 360f, 0f);
private void Awake()
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
((Component)this).transform.eulerAngles = new Vector3(Random.Range(min.x, max.x), Random.Range(min.y, max.y), Random.Range(min.z, max.z));
}
}
public class WFX_Demo_Wall : MonoBehaviour
{
public WFX_Demo_New demo;
private void OnMouseDown()
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
RaycastHit val = default(RaycastHit);
if (((Component)this).GetComponent<Collider>().Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), ref val, 9999f))
{
GameObject val2 = demo.spawnParticle();
val2.transform.position = ((RaycastHit)(ref val)).point;
val2.transform.rotation = Quaternion.FromToRotation(Vector3.forward, ((RaycastHit)(ref val)).normal);
}
}
}
[RequireComponent(typeof(ParticleSystem))]
public class CFX_AutoDestructShuriken : MonoBehaviour
{
public bool OnlyDeactivate;
private void OnEnable()
{
((MonoBehaviour)this).StartCoroutine("CheckIfAlive");
}
private IEnumerator CheckIfAlive()
{
do
{
yield return (object)new WaitForSeconds(0.5f);
}
while (((Component)this).GetComponent<ParticleSystem>().IsAlive(true));
if (OnlyDeactivate)
{
((Component)this).gameObject.SetActive(false);
}
else
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
}
[RequireComponent(typeof(Light))]
public class CFX_LightIntensityFade : MonoBehaviour
{
public float duration = 1f;
public float delay = 0f;
public float finalIntensity = 0f;
private float baseIntensity;
public bool autodestruct;
private float p_lifetime = 0f;
private float p_delay;
private void Start()
{
baseIntensity = ((Component)this).GetComponent<Light>().intensity;
}
private void OnEnable()
{
p_lifetime = 0f;
p_delay = delay;
if (delay > 0f)
{
((Behaviour)((Component)this).GetComponent<Light>()).enabled = false;
}
}
private void Update()
{
if (p_delay > 0f)
{
p_delay -= Time.deltaTime;
if (p_delay <= 0f)
{
((Behaviour)((Component)this).GetComponent<Light>()).enabled = true;
}
}
else if (p_lifetime / duration < 1f)
{
((Component)this).GetComponent<Light>().intensity = Mathf.Lerp(baseIntensity, finalIntensity, p_lifetime / duration);
p_lifetime += Time.deltaTime;
}
else if (autodestruct)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
}
[RequireComponent(typeof(MeshFilter))]
public class WFX_BulletHoleDecal : MonoBehaviour
{
private static Vector2[] quadUVs = (Vector2[])(object)new Vector2[4]
{
new Vector2(0f, 0f),
new Vector2(0f, 1f),
new Vector2(1f, 0f),
new Vector2(1f, 1f)
};
public float lifetime = 10f;
public float fadeoutpercent = 80f;
public Vector2 frames;
public bool randomRotation = false;
public bool deactivate = false;
private float life;
private float fadeout;
private Color color;
private float orgAlpha;
private void Awake()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
color = ((Component)this).GetComponent<Renderer>().material.GetColor("_TintColor");
orgAlpha = color.a;
}
private void OnEnable()
{
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
int num = Random.Range(0, (int)(frames.x * frames.y));
int num2 = (int)((float)num % frames.x);
int num3 = (int)((float)num / frames.y);
Vector2[] array = (Vector2[])(object)new Vector2[4];
for (int i = 0; i < 4; i++)
{
array[i].x = (quadUVs[i].x + (float)num2) * (1f / frames.x);
array[i].y = (quadUVs[i].y + (float)num3) * (1f / frames.y);
}
((Component)this).GetComponent<MeshFilter>().mesh.uv = array;
if (randomRotation)
{
((Component)this).transform.Rotate(0f, 0f, Random.Range(0f, 360f), (Space)1);
}
life = lifetime;
fadeout = life * (fadeoutpercent / 100f);
color.a = orgAlpha;
((Component)this).GetComponent<Renderer>().material.SetColor("_TintColor", color);
((MonoBehaviour)this).StopAllCoroutines();
((MonoBehaviour)this).StartCoroutine("holeUpdate");
}
private IEnumerator holeUpdate()
{
while (life > 0f)
{
life -= Time.deltaTime;
if (life <= fadeout)
{
color.a = Mathf.Lerp(0f, orgAlpha, life / fadeout);
((Component)this).GetComponent<Renderer>().material.SetColor("_TintColor", color);
}
yield return null;
}
}
}
[RequireComponent(typeof(Light))]
public class WFX_LightFlicker : MonoBehaviour
{
public float time = 0.05f;
private float timer;
private void Start()
{
timer = time;
((MonoBehaviour)this).StartCoroutine("Flicker");
}
private IEnumerator Flicker()
{
while (true)
{
((Behaviour)((Component)this).GetComponent<Light>()).enabled = !((Behaviour)((Component)this).GetComponent<Light>()).enabled;
do
{
timer -= Time.deltaTime;
yield return null;
}
while (timer > 0f);
timer = time;
}
}
}
public class MagazineHelper : EditorWindow
{
public FVRFireArmMagazine Magazine;
public GameObject firstCartridge;
public int numberOfCartridges = 1;
public bool mirrorX;
public float cartridgeOffsetY = 0f;
public float cartridgeOffsetZ = 0f;
public bool generateFollowerPoints;
public bool useFollowerOffsets = false;
public bool invertFollowerOffsets = false;
public GameObject follower;
public float followerOffsetY = 0f;
public float followerOffsetZ = 0f;
private GameObject cartridge_root;
private GameObject[] CartridgeObjectList;
private MeshFilter[] CartridgeMeshFilterList;
private MeshRenderer[] CartridgeMeshRendererList;
private float cartridge_currentX;
private float cartridge_currentY;
private float cartridge_currentZ;
private bool ready1 = true;
private bool ready2 = true;
private GameObject follower_root;
private GameObject[] FollowerObjectList;
private float follower_currentX;
private float follower_currentY;
private float follower_currentZ;
[MenuItem("Window/Magazine Helper")]
public static void ShowWindow()
{
EditorWindow.GetWindow(typeof(MagazineHelper));
}
private void OnGUI()
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Expected O, but got Unknown
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Expected O, but got Unknown
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Expected O, but got Unknown
GUILayout.Label("Cartridge Settings", EditorStyles.boldLabel, (GUILayoutOption[])(object)new GUILayoutOption[0]);
EditorGUIUtility.labelWidth = 300f;
Magazine = (FVRFireArmMagazine)EditorGUILayout.ObjectField("Magazine", (Object)(object)Magazine, typeof(FVRFireArmMagazine), true, (GUILayoutOption[])(object)new GUILayoutOption[0]);
if ((Object)(object)Magazine == (Object)null)
{
EditorGUILayout.HelpBox("Please add Magazine!", (MessageType)3);
ready1 = false;
}
firstCartridge = (GameObject)EditorGUILayout.ObjectField("First Cartridge", (Object)(object)firstCartridge, typeof(GameObject), true, (GUILayoutOption[])(object)new GUILayoutOption[0]);
if ((Object)(object)firstCartridge == (Object)null)
{
EditorGUILayout.HelpBox("Please add Reference Cartridge!", (MessageType)3);
ready1 = false;
}
numberOfCartridges = EditorGUILayout.IntField("Number of Cartridges", numberOfCartridges, (GUILayoutOption[])(object)new GUILayoutOption[0]);
if (numberOfCartridges <= 0)
{
numberOfCartridges = 1;
}
mirrorX = EditorGUILayout.Toggle("Is double stacked Magazine (mirror X axis)", mirrorX, (GUILayoutOption[])(object)new GUILayoutOption[0]);
cartridgeOffsetY = EditorGUILayout.Slider("Cartridge Offset Y", cartridgeOffsetY, -0.1f, 0.1f, (GUILayoutOption[])(object)new GUILayoutOption[0]);
cartridgeOffsetZ = EditorGUILayout.Slider("Cartridge Offset Z", cartridgeOffsetZ, -0.1f, 0.1f, (GUILayoutOption[])(object)new GUILayoutOption[0]);
generateFollowerPoints = EditorGUILayout.BeginToggleGroup("Generate Follower Points", generateFollowerPoints);
follower = (GameObject)EditorGUILayout.ObjectField("Follower", (Object)(object)follower, typeof(GameObject), true, (GUILayoutOption[])(object)new GUILayoutOption[0]);
if ((Object)(object)follower == (Object)null && generateFollowerPoints)
{
EditorGUILayout.HelpBox("Please add Follower!", (MessageType)3);
ready2 = false;
}
useFollowerOffsets = EditorGUILayout.Toggle("Use Follower Offsets", useFollowerOffsets, (GUILayoutOption[])(object)new GUILayoutOption[0]);
if (!useFollowerOffsets)
{
invertFollowerOffsets = EditorGUILayout.Toggle("Invert Follower Offsets", invertFollowerOffsets, (GUILayoutOption[])(object)new GUILayoutOption[0]);
}
else
{
invertFollowerOffsets = false;
}
if (useFollowerOffsets)
{
followerOffsetY = EditorGUILayout.Slider("Follower Offset Y", followerOffsetY, -0.1f, 0.1f, (GUILayoutOption[])(object)new GUILayoutOption[0]);
followerOffsetZ = EditorGUILayout.Slider("Follower Offset Z", followerOffsetZ, -0.1f, 0.1f, (GUILayoutOption[])(object)new GUILayoutOption[0]);
}
else if (invertFollowerOffsets)
{
followerOffsetY = 0f - cartridgeOffsetY;
followerOffsetZ = 0f - cartridgeOffsetZ;
}
else
{
followerOffsetY = cartridgeOffsetY;
followerOffsetZ = cartridgeOffsetZ;
}
EditorGUILayout.EndToggleGroup();
if (ready1 && !generateFollowerPoints)
{
if (GUILayout.Button("Add Cartridges", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }))
{
AddCartridges();
}
if (GUILayout.Button("Clear Cartridges", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }))
{
ClearCartridges(all: true);
}
}
else if (ready1 && ready2)
{
if (GUILayout.Button("Add Cartridges and FollowerPoints", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }))
{
AddCartridges();
AddFollowerPoints();
}
if (GUILayout.Button("Clear Cartridges and FollowerPoints", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }))
{
ClearCartridges(all: true);
ClearFollowerPoints(all: true);
}
if (GUILayout.Button("Remove FollowerPoint Visuals", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }))
{
RemoveFollowerPointVisuals();
}
}
ready1 = true;
ready2 = true;
}
private void AddCartridges()
{
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Expected O, but got Unknown
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_022f: Unknown result type (might be due to invalid IL or missing references)
//IL_0248: Unknown result type (might be due to invalid IL or missing references)
ClearCartridges();
CartridgeObjectList = (GameObject[])(object)new GameObject[numberOfCartridges];
CartridgeMeshFilterList = (MeshFilter[])(object)new MeshFilter[numberOfCartridges];
CartridgeMeshRendererList = (MeshRenderer[])(object)new MeshRenderer[numberOfCartridges];
CartridgeObjectList[0] = firstCartridge;
CartridgeMeshFilterList[0] = firstCartridge.GetComponent<MeshFilter>();
CartridgeMeshRendererList[0] = firstCartridge.GetComponent<MeshRenderer>();
cartridge_currentX = firstCartridge.transform.localPosition.x;
cartridge_currentY = firstCartridge.transform.localPosition.y;
cartridge_currentZ = firstCartridge.transform.localPosition.z;
if ((Object)(object)cartridge_root == (Object)null)
{
cartridge_root = new GameObject();
((Object)cartridge_root).name = "Cartridge Root";
cartridge_root.transform.parent = firstCartridge.transform.parent;
cartridge_root.transform.localPosition = new Vector3(0f, 0f, 0f);
cartridge_root.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
cartridge_root.transform.localScale = new Vector3(1f, 1f, 1f);
}
Vector3 localPosition = default(Vector3);
for (int i = 2; i <= numberOfCartridges; i++)
{
if (mirrorX)
{
cartridge_currentX = 0f - cartridge_currentX;
}
cartridge_currentY += cartridgeOffsetY;
cartridge_currentZ += cartridgeOffsetZ;
((Vector3)(ref localPosition))..ctor(cartridge_currentX, cartridge_currentY, cartridge_currentZ);
GameObject val = Object.Instantiate<GameObject>(firstCartridge, cartridge_root.transform);
((Object)val).name = ((Object)firstCartridge).name + " (" + i + ")";
val.transform.localPosition = localPosition;
val.transform.localRotation = firstCartridge.transform.localRotation;
CartridgeObjectList[i - 1] = val;
CartridgeMeshFilterList[i - 1] = val.GetComponent<MeshFilter>();
CartridgeMeshRendererList[i - 1] = val.GetComponent<MeshRenderer>();
}
Magazine.DisplayBullets = CartridgeObjectList;
Magazine.DisplayMeshFilters = CartridgeMeshFilterList;
Magazine.DisplayRenderers = (Renderer[])(object)CartridgeMeshRendererList;
}
private void ClearCartridges(bool all = false)
{
if ((Object)(object)cartridge_root != (Object)null)
{
int childCount = cartridge_root.transform.childCount;
for (int num = childCount - 1; num >= 0; num--)
{
Object.DestroyImmediate((Object)(object)((Component)cartridge_root.transform.GetChild(num)).gameObject);
}
if (all)
{
Object.DestroyImmediate((Object)(object)cartridge_root);
}
}
}
private void AddFollowerPoints()
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Expected O, but got Unknown
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
ClearFollowerPoints();
FollowerObjectList = (GameObject[])(object)new GameObject[numberOfCartridges];
FollowerObjectList[0] = follower;
follower_currentX = follower.transform.localPosition.x;
follower_currentY = follower.transform.localPosition.y;
follower_currentZ = follower.transform.localPosition.z;
if ((Object)(object)follower_root == (Object)null)
{
follower_root = new GameObject();
((Object)follower_root).name = "Follower Root";
follower_root.transform.parent = follower.transform.parent;
follower_root.transform.localPosition = new Vector3(0f, 0f, 0f);
follower_root.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
follower_root.transform.localScale = new Vector3(1f, 1f, 1f);
}
Vector3 localPosition = default(Vector3);
for (int i = 2; i <= numberOfCartridges; i++)
{
follower_currentY += followerOffsetY;
follower_currentZ += followerOffsetZ;
((Vector3)(ref localPosition))..ctor(follower_currentX, follower_currentY, follower_currentZ);
GameObject val = Object.Instantiate<GameObject>(follower, follower_root.transform);
((Object)val).name = ((Object)follower).name + " (" + i + ")";
val.transform.localPosition = localPosition;
val.transform.localRotation = follower.transform.localRotation;
FollowerObjectList[i - 1] = val;
}
}
private void ClearFollowerPoints(bool all = false)
{
if ((Object)(object)follower_root != (Object)null)
{
int childCount = follower_root.transform.childCount;
for (int num = childCount - 1; num >= 0; num--)
{
Object.DestroyImmediate((Object)(object)((Component)follower_root.transform.GetChild(num)).gameObject);
}
if (all)
{
Object.DestroyImmediate((Object)(object)follower_root);
}
}
}
private void RemoveFollowerPointVisuals()
{
if ((Object)(object)follower_root == (Object)null)
{
return;
}
GameObject[] followerObjectList = FollowerObjectList;
foreach (GameObject val in followerObjectList)
{
if ((Object)(object)val != (Object)(object)follower)
{
MeshRenderer component = val.GetComponent<MeshRenderer>();
Object.DestroyImmediate((Object)(object)component);
MeshFilter component2 = val.GetComponent<MeshFilter>();
}
}
}
}
[BepInPlugin("Muzzle.Modul_Ruger_GP100", "Modul_Ruger_GP100", "1.0.1")]
[BepInProcess("h3vr.exe")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
[BepInDependency("h3vr.cityrobo.ModularWorkshopManager", "1.0.0")]
[BepInDependency("nrgill28.Sodalite", "1.2.0")]
public class Modul_Ruger_GP100Plugin : BaseUnityPlugin
{
private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
private void Awake()
{
LoadAssets();
}
private void LoadAssets()
{
OtherLoader.RegisterDirectLoad(BasePath, "Muzzle.Modul_Ruger_GP100", "", "", "modulgp100", "");
GameAPI.PreloadAllAssets(Path.Combine(BasePath, "mw_modul_ruger_gp100"));
}
}
[RequireComponent(typeof(MeshFilter))]
[RequireComponent(typeof(MeshRenderer))]
public class MeshCombiner : MonoBehaviour
{
private const int Mesh16BitBufferVertexLimit = 65535;
[SerializeField]
private bool createMultiMaterialMesh = false;
[SerializeField]
private bool combineInactiveChildren = false;
[SerializeField]
private bool deactivateCombinedChildren = true;
[SerializeField]
private bool deactivateCombinedChildrenMeshRenderers = false;
[SerializeField]
private bool generateUVMap = false;
[SerializeField]
private bool destroyCombinedChildren = false;
[SerializeField]
private string folderPath = "Prefabs/CombinedMeshes";
[SerializeField]
[Tooltip("MeshFilters with Meshes which we don't want to combine into one Mesh.")]
private MeshFilter[] meshFiltersToSkip = (MeshFilter[])(object)new MeshFilter[0];
public bool CreateMultiMaterialMesh
{
get
{
return createMultiMaterialMesh;
}
set
{
createMultiMaterialMesh = value;
}
}
public bool CombineInactiveChildren
{
get
{
return combineInactiveChildren;
}
set
{
combineInactiveChildren = value;
}
}
public bool DeactivateCombinedChildren
{
get
{
return deactivateCombinedChildren;
}
set
{
deactivateCombinedChildren = value;
CheckDeactivateCombinedChildren();
}
}
public bool DeactivateCombinedChildrenMeshRenderers
{
get
{
return deactivateCombinedChildrenMeshRenderers;
}
set
{
deactivateCombinedChildrenMeshRenderers = value;
CheckDeactivateCombinedChildren();
}
}
public bool GenerateUVMap
{
get
{
return generateUVMap;
}
set
{
generateUVMap = value;
}
}
public bool DestroyCombinedChildren
{
get
{
return destroyCombinedChildren;
}
set
{
destroyCombinedChildren = value;
CheckDestroyCombinedChildren();
}
}
public string FolderPath
{
get
{
return folderPath;
}
set
{
folderPath = value;
}
}
private void CheckDeactivateCombinedChildren()
{
if (deactivateCombinedChildren || deactivateCombinedChildrenMeshRenderers)
{
destroyCombinedChildren = false;
}
}
private void CheckDestroyCombinedChildren()
{
if (destroyCombinedChildren)
{
deactivateCombinedChildren = false;
deactivateCombinedChildrenMeshRenderers = false;
}
}
public void CombineMeshes(bool showCreatedMeshInfo)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
Vector3 localScale = ((Component)this).transform.localScale;
int siblingIndex = ((Component)this).transform.GetSiblingIndex();
Transform parent = ((Component)this).transform.parent;
((Component)this).transform.parent = null;
Quaternion rotation = ((Component)this).transform.rotation;
Vector3 position = ((Component)this).transform.position;
Vector3 localScale2 = ((Component)this).transform.localScale;
((Component)this).transform.rotation = Quaternion.identity;
((Component)this).transform.position = Vector3.zero;
((Component)this).transform.localScale = Vector3.one;
if (!createMultiMaterialMesh)
{
CombineMeshesWithSingleMaterial(showCreatedMeshInfo);
}
else
{
CombineMeshesWithMutliMaterial(showCreatedMeshInfo);
}
((Component)this).transform.rotation = rotation;
((Component)this).transform.position = position;
((Component)this).transform.localScale = localScale2;
((Component)this).transform.parent = parent;
((Component)this).transform.SetSiblingIndex(siblingIndex);
((Component)this).transform.localScale = localScale;
}
private MeshFilter[] GetMeshFiltersToCombine()
{
MeshFilter[] meshFilters = ((Component)this).GetComponentsInChildren<MeshFilter>(combineInactiveChildren);
meshFiltersToSkip = meshFiltersToSkip.Where((MeshFilter meshFilter) => (Object)(object)meshFilter != (Object)(object)meshFilters[0]).ToArray();
meshFiltersToSkip = meshFiltersToSkip.Where((MeshFilter meshFilter) => (Object)(object)meshFilter != (Object)null).ToArray();
for (int i = 0; i < meshFiltersToSkip.Length; i++)
{
meshFilters = meshFilters.Where((MeshFilter meshFilter) => (Object)(object)meshFilter != (Object)(object)meshFiltersToSkip[i]).ToArray();
}
return meshFilters;
}
private void CombineMeshesWithSingleMaterial(bool showCreatedMeshInfo)
{
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Expected O, but got Unknown
MeshFilter[] meshFiltersToCombine = GetMeshFiltersToCombine();
CombineInstance[] array = (CombineInstance[])(object)new CombineInstance[meshFiltersToCombine.Length - 1];
long num = 0L;
for (int i = 0; i < meshFiltersToCombine.Length - 1; i++)
{
((CombineInstance)(ref array[i])).subMeshIndex = 0;
((CombineInstance)(ref array[i])).mesh = meshFiltersToCombine[i + 1].sharedMesh;
((CombineInstance)(ref array[i])).transform = ((Component)meshFiltersToCombine[i + 1]).transform.localToWorldMatrix;
num += ((CombineInstance)(ref array[i])).mesh.vertices.Length;
}
MeshRenderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<MeshRenderer>(combineInactiveChildren);
if (componentsInChildren.Length >= 2)
{
((Renderer)componentsInChildren[0]).sharedMaterials = (Material[])(object)new Material[1];
((Renderer)componentsInChildren[0]).sharedMaterial = ((Renderer)componentsInChildren[1]).sharedMaterial;
}
else
{
((Renderer)componentsInChildren[0]).sharedMaterials = (Material[])(object)new Material[0];
}
Mesh val = new Mesh();
((Object)val).name = ((Object)this).name;
if (num <= 65535)
{
val.CombineMeshes(array);
GenerateUV(val);
meshFiltersToCombine[0].sharedMesh = val;
DeactivateCombinedGameObjects(meshFiltersToCombine);
if (showCreatedMeshInfo)
{
Debug.Log((object)("<color=#00cc00><b>Mesh \"" + ((Object)this).name + "\" was created from " + array.Length + " children meshes and has " + num + " vertices.</b></color>"));
}
}
else if (showCreatedMeshInfo)
{
Debug.Log((object)("<color=red><b>The mesh vertex limit is 65535! The created mesh had " + num + " vertices. Upgrade Unity version to 2017.3 or higher to avoid this limit (some old devices, like Android with Mali-400 GPU, do not support over 65535 vertices).</b></color>"));
}
}
private void CombineMeshesWithMutliMaterial(bool showCreatedMeshInfo)
{
//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
//IL_01fb: Expected O, but got Unknown
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Expected O, but got Unknown
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
MeshFilter[] meshFiltersToCombine = GetMeshFiltersToCombine();
MeshRenderer[] array = (MeshRenderer[])(object)new MeshRenderer[meshFiltersToCombine.Length];
array[0] = ((Component)this).GetComponent<MeshRenderer>();
List<Material> list = new List<Material>();
for (int i = 0; i < meshFiltersToCombine.Length - 1; i++)
{
array[i + 1] = ((Component)meshFiltersToCombine[i + 1]).GetComponent<MeshRenderer>();
if (!((Object)(object)array[i + 1] != (Object)null))
{
continue;
}
Material[] sharedMaterials = ((Renderer)array[i + 1]).sharedMaterials;
for (int j = 0; j < sharedMaterials.Length; j++)
{
if (!list.Contains(sharedMaterials[j]))
{
list.Add(sharedMaterials[j]);
}
}
}
List<CombineInstance> list2 = new List<CombineInstance>();
long num = 0L;
for (int k = 0; k < list.Count; k++)
{
List<CombineInstance> list3 = new List<CombineInstance>();
for (int l = 0; l < meshFiltersToCombine.Length - 1; l++)
{
if (!((Object)(object)array[l + 1] != (Object)null))
{
continue;
}
Material[] sharedMaterials2 = ((Renderer)array[l + 1]).sharedMaterials;
for (int m = 0; m < sharedMaterials2.Length; m++)
{
if ((Object)(object)list[k] == (Object)(object)sharedMaterials2[m])
{
CombineInstance item = default(CombineInstance);
((CombineInstance)(ref item)).subMeshIndex = m;
((CombineInstance)(ref item)).mesh = meshFiltersToCombine[l + 1].sharedMesh;
((CombineInstance)(ref item)).transform = ((Component)meshFiltersToCombine[l + 1]).transform.localToWorldMatrix;
list3.Add(item);
num += ((CombineInstance)(ref item)).mesh.vertices.Length;
}
}
}
Mesh val = new Mesh();
if (num <= 65535)
{
val.CombineMeshes(list3.ToArray(), true);
}
CombineInstance item2 = default(CombineInstance);
((CombineInstance)(ref item2)).subMeshIndex = 0;
((CombineInstance)(ref item2)).mesh = val;
((CombineInstance)(ref item2)).transform = Matrix4x4.identity;
list2.Add(item2);
}
((Renderer)array[0]).sharedMaterials = list.ToArray();
Mesh val2 = new Mesh();
((Object)val2).name = ((Object)this).name;
if (num <= 65535)
{
val2.CombineMeshes(list2.ToArray(), false);
GenerateUV(val2);
meshFiltersToCombine[0].sharedMesh = val2;
DeactivateCombinedGameObjects(meshFiltersToCombine);
if (showCreatedMeshInfo)
{
Debug.Log((object)("<color=#00cc00><b>Mesh \"" + ((Object)this).name + "\" was created from " + (meshFiltersToCombine.Length - 1) + " children meshes and has " + list2.Count + " submeshes, and " + num + " vertices.</b></color>"));
}
}
else if (showCreatedMeshInfo)
{
Debug.Log((object)("<color=red><b>The mesh vertex limit is 65535! The created mesh had " + num + " vertices. Upgrade Unity version to 2017.3 or higher to avoid this limit (some old devices, like Android with Mali-400 GPU, do not support over 65535 vertices).</b></color>"));
}
}
private void DeactivateCombinedGameObjects(MeshFilter[] meshFilters)
{
for (int i = 0; i < meshFilters.Length - 1; i++)
{
if (!destroyCombinedChildren)
{
if (deactivateCombinedChildren)
{
((Component)meshFilters[i + 1]).gameObject.SetActive(false);
}
if (deactivateCombinedChildrenMeshRenderers)
{
MeshRenderer component = ((Component)meshFilters[i + 1]).gameObject.GetComponent<MeshRenderer>();
if ((Object)(object)component != (Object)null)
{
((Renderer)component).enabled = false;
}
}
}
else
{
Object.DestroyImmediate((Object)(object)((Component)meshFilters[i + 1]).gameObject);
}
}
}
private void GenerateUV(Mesh combinedMesh)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
if (generateUVMap)
{
UnwrapParam val = default(UnwrapParam);
UnwrapParam.SetDefaults(ref val);
Unwrapping.GenerateSecondaryUVSet(combinedMesh, val);
}
}
}
[ExecuteInEditMode]
public class PostEffectScript : MonoBehaviour
{
public Material mat;
private void OnRenderImage(RenderTexture src, RenderTexture dest)
{
Graphics.Blit((Texture)(object)src, dest, mat);
}
}
[ExecuteInEditMode]
public class NightVisionPostEffect : MonoBehaviour
{
public Material nightVisionMat;
public Material bloom;
public bool renderNightVision = true;
public bool renderBloom = true;
[Range(1f, 16f)]
public int iterations = 1;
private const int BoxDownPrefilterPass = 0;
private const int BoxDownPass = 1;
private const int BoxUpPass = 2;
private const int ApplyBloomPass = 3;
private RenderTexture[] textures = (RenderTexture[])(object)new RenderTexture[16];
private void OnRenderImage(RenderTexture src, RenderTexture dest)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
int num = ((Texture)src).width / 2;
int num2 = ((Texture)src).height / 2;
RenderTextureFormat format = src.format;
RenderTexture val = RenderTexture.GetTemporary(num, num2, 0, format);
if (renderNightVision)
{
Graphics.Blit((Texture)(object)src, val, nightVisionMat);
}
else
{
val = src;
}
if (!renderBloom)
{
Graphics.Blit((Texture)(object)val, dest);
RenderTexture.ReleaseTemporary(val);
return;
}
RenderTexture val2 = (textures[0] = RenderTexture.GetTemporary(num, num2, 0, format));
Graphics.Blit((Texture)(object)val, val2, bloom, 0);
RenderTexture val3 = val2;
for (int i = 1; i < iterations; i++)
{
num /= 2;
num2 /= 2;
if (num2 < 2)
{
break;
}
val2 = (textures[i] = RenderTexture.GetTemporary(num, num2, 0, format));
Graphics.Blit((Texture)(object)val3, val2, bloom, 1);
val3 = val2;
}
for (int num3 = iterations - 2; num3 >= 0; num3--)
{
val2 = textures[num3];
textures[num3] = null;
Graphics.Blit((Texture)(object)val3, val2, bloom, 2);
RenderTexture.ReleaseTemporary(val3);
val3 = val2;
}
bloom.SetTexture("_SourceTex", (Texture)(object)val);
Graphics.Blit((Texture)(object)val3, dest, bloom, 3);
RenderTexture.ReleaseTemporary(val3);
RenderTexture.ReleaseTemporary(val);
}
}