using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace PortableSignalTranslator;
public class PortableSignalTranslatorMod : MonoBehaviour
{
private static PortableSignalTranslatorMod instance;
public static PortableSignalTranslatorMod Instance
{
get
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
if ((Object)(object)instance == (Object)null)
{
instance = Object.FindObjectOfType<PortableSignalTranslatorMod>();
if ((Object)(object)instance == (Object)null)
{
GameObject val = new GameObject("PortableSignalTranslatorMod");
instance = val.AddComponent<PortableSignalTranslatorMod>();
Object.DontDestroyOnLoad((Object)(object)val);
}
}
return instance;
}
}
private void Awake()
{
if ((Object)(object)instance == (Object)null)
{
instance = this;
Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
}
else if ((Object)(object)instance != (Object)(object)this)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
private void Start()
{
((MonoBehaviour)this).StartCoroutine(InitializeMod());
}
private IEnumerator InitializeMod()
{
yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)StartOfRound.Instance != (Object)null));
yield return (object)new WaitForSeconds(2f);
AddPortableSignalTranslatorToStore();
}
private void AddPortableSignalTranslatorToStore()
{
try
{
Terminal val = Object.FindObjectOfType<Terminal>();
if ((Object)(object)val != (Object)null && val.buyableItemsList != null)
{
Item[] array = (Item[])(object)new Item[val.buyableItemsList.Length + 1];
Array.Copy(val.buyableItemsList, array, val.buyableItemsList.Length);
Item val2 = CreatePortableSignalTranslatorItem();
array[^1] = val2;
val.buyableItemsList = array;
Debug.Log((object)"Portable Signal Translator added to store successfully!");
}
else
{
Debug.LogError((object)"Terminal not found or buyableItemsList is null!");
}
}
catch (Exception arg)
{
Debug.LogError((object)$"Error adding Portable Signal Translator to store: {arg}");
}
}
private Item CreatePortableSignalTranslatorItem()
{
//IL_0107: 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_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
Item val = ScriptableObject.CreateInstance<Item>();
val.itemId = 999;
val.itemName = "Portable Signal Translator";
val.creditsWorth = 150;
val.weight = 1.5f;
val.twoHanded = false;
val.twoHandedAnimation = false;
val.disableHandsOnWall = false;
val.canBeGrabbedBeforeGameStart = false;
val.itemIsTrigger = false;
val.holdButtonUse = false;
val.itemSpawnsOnGround = true;
val.isConductiveMetal = false;
val.isScrap = false;
val.lockedInDemo = false;
val.highestSalePercentage = 80;
val.maxValue = 0;
val.minValue = 0;
val.requiresBattery = true;
val.batteryUsage = 20f;
val.automaticallySetUsingPower = true;
val.grabAnim = "Grab";
val.useAnim = "Use";
val.pocketAnim = "Pocket";
val.throwAnim = "Throw";
val.syncUseFunction = true;
val.syncDiscardFunction = true;
val.syncInteractLRFunction = true;
val.saveItemVariable = false;
val.allowDroppingAheadOfPlayer = true;
val.restingRotation = new Vector3(0f, 0f, 90f);
val.rotationOffset = Vector3.zero;
val.positionOffset = Vector3.zero;
val.meshOffset = true;
val.usableInSpecialAnimations = false;
val.canBeInspected = true;
val.spawnPrefab = CreatePortableSignalTranslatorPrefab();
return val;
}
private GameObject CreatePortableSignalTranslatorPrefab()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Expected O, but got Unknown
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("PortableSignalTranslatorPrefab");
PortableSignalTranslatorItem portableSignalTranslatorItem = val.AddComponent<PortableSignalTranslatorItem>();
GameObject val2 = new GameObject("Visual");
val2.transform.SetParent(val.transform);
MeshFilter val3 = val2.AddComponent<MeshFilter>();
MeshRenderer val4 = val2.AddComponent<MeshRenderer>();
Mesh mesh = CreateCubeMesh();
val3.mesh = mesh;
Material val5 = new Material(Shader.Find("Standard"));
val5.color = new Color(0.2f, 0.8f, 0.2f);
((Renderer)val4).material = val5;
BoxCollider val6 = val2.AddComponent<BoxCollider>();
val6.size = new Vector3(0.3f, 0.1f, 0.2f);
NetworkObject val7 = val.AddComponent<NetworkObject>();
((GrabbableObject)portableSignalTranslatorItem).itemProperties = CreatePortableSignalTranslatorItemProperties();
return val;
}
private Mesh CreateCubeMesh()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: 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_0059: 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_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
Mesh val = new Mesh();
Vector3[] vertices = (Vector3[])(object)new Vector3[8]
{
new Vector3(-0.5f, -0.5f, -0.5f),
new Vector3(0.5f, -0.5f, -0.5f),
new Vector3(0.5f, 0.5f, -0.5f),
new Vector3(-0.5f, 0.5f, -0.5f),
new Vector3(-0.5f, -0.5f, 0.5f),
new Vector3(0.5f, -0.5f, 0.5f),
new Vector3(0.5f, 0.5f, 0.5f),
new Vector3(-0.5f, 0.5f, 0.5f)
};
int[] triangles = new int[36]
{
0, 2, 1, 0, 3, 2, 2, 3, 4, 2,
4, 5, 1, 2, 5, 1, 5, 6, 0, 7,
4, 0, 4, 1, 0, 6, 7, 0, 1, 6,
7, 6, 5, 7, 5, 4
};
val.vertices = vertices;
val.triangles = triangles;
val.RecalculateNormals();
return val;
}
private Item CreatePortableSignalTranslatorItemProperties()
{
Item val = ScriptableObject.CreateInstance<Item>();
val.itemName = "Portable Signal Translator";
val.creditsWorth = 150;
val.weight = 1.5f;
val.requiresBattery = true;
val.batteryUsage = 20f;
val.toolTips = new string[5] { "Portable Signal Translator", "[LMB] Open Message UI", "[E] Use (same as LMB)", "[ESC] Close UI", "[Enter] Send Message" };
return val;
}
}
public class PortableSignalTranslatorItem : GrabbableObject
{
[Header("Portable Signal Translator")]
public bool isActive = false;
public float batteryDrainRate = 2f;
[Header("Audio")]
public AudioSource audioSource;
public AudioClip activateSound;
public AudioClip deactivateSound;
public AudioClip transmitSound;
[Header("Visual Effects")]
public Light indicatorLight;
public Material activeMaterial;
public Material inactiveMaterial;
public MeshRenderer mainRenderer;
[Header("UI")]
public GameObject messageUIPrefab;
private GameObject messageUIInstance;
private TMP_InputField messageInput;
private TextMeshProUGUI characterCountText;
private bool wasActiveLastFrame = false;
private float lastBatteryCheck = 0f;
private bool isUIOpen = false;
private const int MAX_MESSAGE_LENGTH = 9;
public override void Start()
{
((GrabbableObject)this).Start();
if ((Object)(object)audioSource == (Object)null)
{
audioSource = ((Component)this).GetComponent<AudioSource>();
if ((Object)(object)audioSource == (Object)null)
{
audioSource = ((Component)this).gameObject.AddComponent<AudioSource>();
}
}
if ((Object)(object)indicatorLight == (Object)null)
{
indicatorLight = ((Component)this).GetComponentInChildren<Light>();
}
if ((Object)(object)mainRenderer == (Object)null)
{
mainRenderer = ((Component)this).GetComponentInChildren<MeshRenderer>();
}
InitializeItem();
}
private void InitializeItem()
{
isActive = false;
UpdateVisuals();
if ((Object)(object)base.itemProperties == (Object)null)
{
Debug.LogWarning((object)"PortableSignalTranslatorItem: itemProperties is null!");
}
}
public override void Update()
{
((GrabbableObject)this).Update();
if (isActive && base.insertedBattery != null)
{
HandleBatteryDrain();
}
if (wasActiveLastFrame != isActive)
{
UpdateVisuals();
wasActiveLastFrame = isActive;
}
if (isUIOpen && (Object)(object)messageInput != (Object)null)
{
HandleUIInput();
}
}
private void HandleBatteryDrain()
{
if (Time.time - lastBatteryCheck >= 1f)
{
lastBatteryCheck = Time.time;
if (base.insertedBattery != null)
{
base.insertedBattery.charge = base.insertedBattery.charge * 0.25f;
if (base.insertedBattery.charge <= 0f)
{
base.insertedBattery.charge = 0f;
isActive = false;
((GrabbableObject)this).UseUpBatteries();
}
}
}
else
{
lastBatteryCheck = Time.time;
}
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
if (used && buttonDown)
{
if (base.insertedBattery == null || base.insertedBattery.charge <= 0f)
{
Debug.Log((object)"Portable Signal Translator: No battery or battery is dead!");
}
else if (isUIOpen)
{
CloseMessageUI();
}
else
{
OpenMessageUI();
}
}
}
private void OpenMessageUI()
{
if (isUIOpen)
{
return;
}
if ((Object)(object)messageUIInstance == (Object)null)
{
CreateMessageUI();
}
if ((Object)(object)messageUIInstance != (Object)null)
{
messageUIInstance.SetActive(true);
isUIOpen = true;
if ((Object)(object)messageInput != (Object)null)
{
messageInput.text = "";
((Selectable)messageInput).Select();
messageInput.ActivateInputField();
}
UpdateCharacterCount("");
if ((Object)(object)audioSource != (Object)null && (Object)(object)activateSound != (Object)null)
{
audioSource.PlayOneShot(activateSound);
}
Debug.Log((object)"Portable Signal Translator UI opened!");
}
}
private void CloseMessageUI()
{
if (isUIOpen && (Object)(object)messageUIInstance != (Object)null)
{
messageUIInstance.SetActive(false);
isUIOpen = false;
if ((Object)(object)messageInput != (Object)null)
{
messageInput.text = "";
messageInput.DeactivateInputField(false);
}
if ((Object)(object)audioSource != (Object)null && (Object)(object)deactivateSound != (Object)null)
{
audioSource.PlayOneShot(deactivateSound);
}
Debug.Log((object)"Portable Signal Translator UI closed!");
}
}
private void CreateMessageUI()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0049: 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_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Expected O, but got Unknown
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Expected O, but got Unknown
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Expected O, but got Unknown
//IL_020f: Unknown result type (might be due to invalid IL or missing references)
//IL_0226: Unknown result type (might be due to invalid IL or missing references)
//IL_0233: Unknown result type (might be due to invalid IL or missing references)
//IL_0243: Unknown result type (might be due to invalid IL or missing references)
//IL_024a: Expected O, but got Unknown
//IL_026a: Unknown result type (might be due to invalid IL or missing references)
//IL_0277: Unknown result type (might be due to invalid IL or missing references)
//IL_0284: Unknown result type (might be due to invalid IL or missing references)
//IL_029a: Unknown result type (might be due to invalid IL or missing references)
//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
//IL_031a: Unknown result type (might be due to invalid IL or missing references)
//IL_0321: Expected O, but got Unknown
//IL_034f: Unknown result type (might be due to invalid IL or missing references)
//IL_0366: Unknown result type (might be due to invalid IL or missing references)
//IL_0373: Unknown result type (might be due to invalid IL or missing references)
//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
//IL_03ca: Expected O, but got Unknown
//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
//IL_040f: Unknown result type (might be due to invalid IL or missing references)
//IL_041c: Unknown result type (might be due to invalid IL or missing references)
//IL_042c: Unknown result type (might be due to invalid IL or missing references)
//IL_0433: Expected O, but got Unknown
//IL_0453: Unknown result type (might be due to invalid IL or missing references)
//IL_0460: Unknown result type (might be due to invalid IL or missing references)
//IL_046d: Unknown result type (might be due to invalid IL or missing references)
//IL_0492: Unknown result type (might be due to invalid IL or missing references)
//IL_04a2: Unknown result type (might be due to invalid IL or missing references)
//IL_04a9: Expected O, but got Unknown
//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
//IL_04d6: Unknown result type (might be due to invalid IL or missing references)
//IL_04e3: Unknown result type (might be due to invalid IL or missing references)
//IL_0513: Unknown result type (might be due to invalid IL or missing references)
//IL_0542: Unknown result type (might be due to invalid IL or missing references)
//IL_054c: Expected O, but got Unknown
messageUIInstance = new GameObject("PortableSignalTranslatorUI");
messageUIInstance.transform.SetParent(GameObject.Find("Canvas").transform, false);
RectTransform val = messageUIInstance.AddComponent<RectTransform>();
val.anchorMin = new Vector2(0.5f, 0.5f);
val.anchorMax = new Vector2(0.5f, 0.5f);
val.anchoredPosition = Vector2.zero;
val.sizeDelta = new Vector2(400f, 200f);
GameObject val2 = new GameObject("Background");
val2.transform.SetParent(messageUIInstance.transform, false);
RectTransform val3 = val2.AddComponent<RectTransform>();
val3.anchorMin = Vector2.zero;
val3.anchorMax = Vector2.one;
val3.sizeDelta = Vector2.zero;
Image val4 = val2.AddComponent<Image>();
((Graphic)val4).color = new Color(0f, 0f, 0f, 0.8f);
GameObject val5 = new GameObject("Title");
val5.transform.SetParent(messageUIInstance.transform, false);
RectTransform val6 = val5.AddComponent<RectTransform>();
val6.anchorMin = new Vector2(0f, 0.8f);
val6.anchorMax = new Vector2(1f, 1f);
val6.sizeDelta = Vector2.zero;
val6.offsetMin = new Vector2(10f, 0f);
val6.offsetMax = new Vector2(-10f, 0f);
TextMeshProUGUI val7 = val5.AddComponent<TextMeshProUGUI>();
((TMP_Text)val7).text = "PORTABLE SIGNAL TRANSLATOR";
((TMP_Text)val7).fontSize = 16f;
((Graphic)val7).color = Color.white;
((TMP_Text)val7).alignment = (TextAlignmentOptions)514;
GameObject val8 = new GameObject("InputField");
val8.transform.SetParent(messageUIInstance.transform, false);
RectTransform val9 = val8.AddComponent<RectTransform>();
val9.anchorMin = new Vector2(0.1f, 0.4f);
val9.anchorMax = new Vector2(0.9f, 0.6f);
val9.sizeDelta = Vector2.zero;
GameObject val10 = new GameObject("InputBackground");
val10.transform.SetParent(val8.transform, false);
RectTransform val11 = val10.AddComponent<RectTransform>();
val11.anchorMin = Vector2.zero;
val11.anchorMax = Vector2.one;
val11.sizeDelta = Vector2.zero;
Image val12 = val10.AddComponent<Image>();
((Graphic)val12).color = Color.white;
messageInput = val8.AddComponent<TMP_InputField>();
messageInput.textComponent = (TMP_Text)(object)val8.AddComponent<TextMeshProUGUI>();
messageInput.textComponent.fontSize = 14f;
((Graphic)messageInput.textComponent).color = Color.black;
messageInput.textComponent.alignment = (TextAlignmentOptions)514;
messageInput.characterLimit = 9;
GameObject val13 = new GameObject("CharacterCount");
val13.transform.SetParent(messageUIInstance.transform, false);
RectTransform val14 = val13.AddComponent<RectTransform>();
val14.anchorMin = new Vector2(0.1f, 0.25f);
val14.anchorMax = new Vector2(0.9f, 0.35f);
val14.sizeDelta = Vector2.zero;
characterCountText = val13.AddComponent<TextMeshProUGUI>();
((TMP_Text)characterCountText).fontSize = 12f;
((Graphic)characterCountText).color = Color.white;
((TMP_Text)characterCountText).alignment = (TextAlignmentOptions)514;
GameObject val15 = new GameObject("SendButton");
val15.transform.SetParent(messageUIInstance.transform, false);
RectTransform val16 = val15.AddComponent<RectTransform>();
val16.anchorMin = new Vector2(0.3f, 0.1f);
val16.anchorMax = new Vector2(0.7f, 0.2f);
val16.sizeDelta = Vector2.zero;
GameObject val17 = new GameObject("SendBackground");
val17.transform.SetParent(val15.transform, false);
RectTransform val18 = val17.AddComponent<RectTransform>();
val18.anchorMin = Vector2.zero;
val18.anchorMax = Vector2.one;
val18.sizeDelta = Vector2.zero;
Image val19 = val17.AddComponent<Image>();
((Graphic)val19).color = new Color(0.2f, 0.6f, 1f);
GameObject val20 = new GameObject("SendText");
val20.transform.SetParent(val15.transform, false);
RectTransform val21 = val20.AddComponent<RectTransform>();
val21.anchorMin = Vector2.zero;
val21.anchorMax = Vector2.one;
val21.sizeDelta = Vector2.zero;
TextMeshProUGUI val22 = val20.AddComponent<TextMeshProUGUI>();
((TMP_Text)val22).text = "TRANSMIT";
((TMP_Text)val22).fontSize = 14f;
((Graphic)val22).color = Color.white;
((TMP_Text)val22).alignment = (TextAlignmentOptions)514;
Button val23 = val15.AddComponent<Button>();
((UnityEvent)val23.onClick).AddListener((UnityAction)delegate
{
SendMessage();
});
((UnityEvent<string>)(object)messageInput.onValueChanged).AddListener((UnityAction<string>)OnMessageChanged);
((UnityEvent<string>)(object)messageInput.onSubmit).AddListener((UnityAction<string>)delegate
{
SendMessage();
});
messageUIInstance.SetActive(false);
}
private void OnMessageChanged(string newText)
{
UpdateCharacterCount(newText);
}
private void UpdateCharacterCount(string text)
{
//IL_0055: 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_007f: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)characterCountText != (Object)null)
{
((TMP_Text)characterCountText).text = $"{text.Length}/{9}";
if (text.Length >= 9)
{
((Graphic)characterCountText).color = Color.red;
}
else if ((float)text.Length >= 7.2000003f)
{
((Graphic)characterCountText).color = Color.yellow;
}
else
{
((Graphic)characterCountText).color = Color.white;
}
}
}
private void HandleUIInput()
{
if (Input.GetKeyDown((KeyCode)13) || Input.GetKeyDown((KeyCode)271))
{
SendMessage();
}
if (Input.GetKeyDown((KeyCode)27))
{
CloseMessageUI();
}
}
private void SendMessage()
{
if ((Object)(object)messageInput == (Object)null || string.IsNullOrEmpty(messageInput.text))
{
return;
}
string text = messageInput.text.Trim();
if (text.Length > 9)
{
text = text.Substring(0, 9);
}
if (base.insertedBattery == null || base.insertedBattery.charge <= 0f)
{
Debug.Log((object)"Portable Signal Translator: No battery or battery is dead!");
}
else if ((Object)(object)HUDManager.Instance != (Object)null)
{
if (base.insertedBattery != null)
{
Battery insertedBattery = base.insertedBattery;
insertedBattery.charge -= 5f;
if (base.insertedBattery.charge <= 0f)
{
base.insertedBattery.charge = 0f;
((GrabbableObject)this).UseUpBatteries();
}
}
if ((Object)(object)audioSource != (Object)null && (Object)(object)transmitSound != (Object)null)
{
audioSource.PlayOneShot(transmitSound);
}
HUDManager.Instance.UseSignalTranslatorServerRpc(text);
Debug.Log((object)("Portable Signal Translator transmitted: " + text));
CloseMessageUI();
}
else
{
Debug.LogError((object)"Portable Signal Translator: HUDManager.Instance is null!");
}
}
private void UpdateVisuals()
{
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)indicatorLight != (Object)null)
{
((Behaviour)indicatorLight).enabled = isActive;
if (isActive)
{
indicatorLight.color = Color.blue;
indicatorLight.intensity = 1f;
}
}
if ((Object)(object)mainRenderer != (Object)null)
{
if (isActive && (Object)(object)activeMaterial != (Object)null)
{
((Renderer)mainRenderer).material = activeMaterial;
}
else if (!isActive && (Object)(object)inactiveMaterial != (Object)null)
{
((Renderer)mainRenderer).material = inactiveMaterial;
}
}
}
public override void UseUpBatteries()
{
((GrabbableObject)this).UseUpBatteries();
if (isUIOpen)
{
CloseMessageUI();
}
}
public override void EquipItem()
{
((GrabbableObject)this).EquipItem();
((GrabbableObject)this).SetControlTipsForItem();
}
public override void SetControlTipsForItem()
{
((GrabbableObject)this).SetControlTipsForItem();
}
public override void DiscardItem()
{
if (isUIOpen)
{
CloseMessageUI();
}
((GrabbableObject)this).DiscardItem();
}
public override void PocketItem()
{
if (isUIOpen)
{
CloseMessageUI();
}
((GrabbableObject)this).PocketItem();
}
[ServerRpc(RequireOwnership = false)]
public void SetActiveStateServerRpc(bool active)
{
if (((NetworkBehaviour)this).IsServer)
{
SetActiveStateClientRpc(active);
}
}
[ClientRpc]
public void SetActiveStateClientRpc(bool active)
{
if (active != isActive)
{
if (active)
{
isActive = true;
}
else
{
isActive = false;
}
UpdateVisuals();
}
}
private void OnDestroy()
{
if ((Object)(object)messageUIInstance != (Object)null)
{
Object.Destroy((Object)(object)messageUIInstance);
}
}
}