| using System; |
| using System; |
| using System.Collections; |
| using System.Collections; |
| using System.Collections.Generic; |
| using System.Collections.Generic; |
| using System.Diagnostics; |
| using System.Diagnostics; |
| using System.IO; |
| using System.IO; |
| using GUIFramework; |
| using GUIFramework; |
| using PlatformTools.Core; |
| using PlatformTools.Core; |
| using TMPro; |
| using TMPro; |
| using UnityEngine; |
| using UnityEngine; |
| using UnityEngine.Rendering; |
| using UnityEngine.Rendering; |
| using UnityEngine.UI; |
| using UnityEngine.UI; |
| |
| |
| public class Minimap : MonoBehaviour |
| public class Minimap : MonoBehaviour |
| { |
| { |
| public static Minimap instance |
| public static Minimap instance |
| { |
| { |
| get |
| get |
| { |
| { |
| return Minimap.m_instance; |
| return Minimap.m_instance; |
| } |
| } |
| } |
| } |
| |
| |
| private void Awake() |
| private void Awake() |
| { |
| { |
| Minimap.m_instance = this; |
| Minimap.m_instance = this; |
| this.m_largeRoot.SetActive(false); |
| this.m_largeRoot.SetActive(false); |
| this.m_smallRoot.SetActive(false); |
| this.m_smallRoot.SetActive(false); |
| Localization.OnLanguageChange = (Action)Delegate.Combine(Localization.OnLanguageChange, new Action(this.OnLanguageChange)); |
| Localization.OnLanguageChange = (Action)Delegate.Combine(Localization.OnLanguageChange, new Action(this.OnLanguageChange)); |
| PlatformManager.Instance.SuspendAndConstrainManager.OnConstrainedModeActivated += this.OnConstrainedModeActivated; |
| PlatformManager.Instance.SuspendAndConstrainManager.OnConstrainedModeActivated += this.OnConstrainedModeActivated; |
| } |
| } |
| |
| |
| private void OnDestroy() |
| private void OnDestroy() |
| { |
| { |
| Localization.OnLanguageChange = (Action)Delegate.Remove(Localization.OnLanguageChange, new Action(this.OnLanguageChange)); |
| Localization.OnLanguageChange = (Action)Delegate.Remove(Localization.OnLanguageChange, new Action(this.OnLanguageChange)); |
| GuiInputField nameInput = this.m_nameInput; |
| GuiInputField nameInput = this.m_nameInput; |
| nameInput.VirtualKeyboardStateChange = (Action<VirtualKeyboardState>)Delegate.Remove(nameInput.VirtualKeyboardStateChange, new Action<VirtualKeyboardState>(this.VirtualKeyboardStateChange)); |
| nameInput.VirtualKeyboardStateChange = (Action<VirtualKeyboardState>)Delegate.Remove(nameInput.VirtualKeyboardStateChange, new Action<VirtualKeyboardState>(this.VirtualKeyboardStateChange)); |
| PlatformManager.Instance.SuspendAndConstrainManager.OnConstrainedModeActivated -= this.OnConstrainedModeActivated; |
| PlatformManager.Instance.SuspendAndConstrainManager.OnConstrainedModeActivated -= this.OnConstrainedModeActivated; |
| Minimap.m_instance = null; |
| Minimap.m_instance = null; |
| } |
| } |
| |
| |
| private void OnConstrainedModeActivated(bool active) |
| private void OnConstrainedModeActivated(bool active) |
| { |
| { |
| this.m_pauseUpdate = 0.1f; |
| this.m_pauseUpdate = 0.1f; |
| } |
| } |
| |
| |
| public static bool IsOpen() |
| public static bool IsOpen() |
| { |
| { |
| return Minimap.m_instance && (Minimap.m_instance.m_largeRoot.activeSelf || Minimap.m_instance.m_hiddenFrames <= 2); |
| return Minimap.m_instance && (Minimap.m_instance.m_largeRoot.activeSelf || Minimap.m_instance.m_hiddenFrames <= 2); |
| } |
| } |
| |
| |
| public static bool InTextInput() |
| public static bool InTextInput() |
| { |
| { |
| return Minimap.m_instance && Minimap.m_instance.m_mode == Minimap.MapMode.Large && Minimap.m_instance.m_wasFocused; |
| return Minimap.m_instance && Minimap.m_instance.m_mode == Minimap.MapMode.Large && Minimap.m_instance.m_wasFocused; |
| } |
| } |
| |
| |
| private void OnLanguageChange() |
| private void OnLanguageChange() |
| { |
| { |
| Player localPlayer = Player.m_localPlayer; |
| Player localPlayer = Player.m_localPlayer; |
| if (localPlayer == null) |
| if (localPlayer == null) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| this.m_biomeNameSmall.text = Localization.instance.Localize("$biome_" + localPlayer.GetCurrentBiome().ToString().ToLower()); |
| this.m_biomeNameSmall.text = Localization.instance.Localize("$biome_" + localPlayer.GetCurrentBiome().ToString().ToLower()); |
| } |
| } |
| |
| |
| private void Start() |
| private void Start() |
| { |
| { |
| this.m_mapTexture = new Texture2D(this.m_textureSize, this.m_textureSize, TextureFormat.RGB24, false); |
| this.m_mapTexture = new Texture2D(this.m_textureSize, this.m_textureSize, TextureFormat.RGB24, false); |
| this.m_mapTexture.name = "_Minimap m_mapTexture"; |
| this.m_mapTexture.name = "_Minimap m_mapTexture"; |
| this.m_mapTexture.wrapMode = TextureWrapMode.Clamp; |
| this.m_mapTexture.wrapMode = TextureWrapMode.Clamp; |
| this.m_forestMaskTexture = new Texture2D(this.m_textureSize, this.m_textureSize, TextureFormat.RGBA32, false); |
| this.m_forestMaskTexture = new Texture2D(this.m_textureSize, this.m_textureSize, TextureFormat.RGBA32, false); |
| this.m_forestMaskTexture.name = "_Minimap m_forestMaskTexture"; |
| this.m_forestMaskTexture.name = "_Minimap m_forestMaskTexture"; |
| this.m_forestMaskTexture.wrapMode = TextureWrapMode.Clamp; |
| this.m_forestMaskTexture.wrapMode = TextureWrapMode.Clamp; |
| this.m_heightTexture = new Texture2D(this.m_textureSize, this.m_textureSize, TextureFormat.RFloat, false); |
| this.m_heightTexture = new Texture2D(this.m_textureSize, this.m_textureSize, TextureFormat.RFloat, false); |
| this.m_heightTexture.name = "_Minimap m_heightTexture"; |
| this.m_heightTexture.name = "_Minimap m_heightTexture"; |
| this.m_heightTexture.wrapMode = TextureWrapMode.Clamp; |
| this.m_heightTexture.wrapMode = TextureWrapMode.Clamp; |
| this.m_fogTexture = new Texture2D(this.m_textureSize, this.m_textureSize, TextureFormat.RGBA32, false); |
| this.m_fogTexture = new Texture2D(this.m_textureSize, this.m_textureSize, TextureFormat.RGBA32, false); |
| this.m_fogTexture.name = "_Minimap m_fogTexture"; |
| this.m_fogTexture.name = "_Minimap m_fogTexture"; |
| this.m_fogTexture.wrapMode = TextureWrapMode.Clamp; |
| this.m_fogTexture.wrapMode = TextureWrapMode.Clamp; |
| this.m_explored = new bool[this.m_textureSize * this.m_textureSize]; |
| this.m_explored = new bool[this.m_textureSize * this.m_textureSize]; |
| this.m_exploredOthers = new bool[this.m_textureSize * this.m_textureSize]; |
| this.m_exploredOthers = new bool[this.m_textureSize * this.m_textureSize]; |
| this.m_mapImageLarge.material = UnityEngine.Object.Instantiate<Material>(this.m_mapImageLarge.material); |
| this.m_mapImageLarge.material = UnityEngine.Object.Instantiate<Material>(this.m_mapImageLarge.material); |
| this.m_mapImageSmall.material = UnityEngine.Object.Instantiate<Material>(this.m_mapImageSmall.material); |
| this.m_mapImageSmall.material = UnityEngine.Object.Instantiate<Material>(this.m_mapImageSmall.material); |
| this.m_mapSmallShader = this.m_mapImageSmall.material; |
| this.m_mapSmallShader = this.m_mapImageSmall.material; |
| this.m_mapLargeShader = this.m_mapImageLarge.material; |
| this.m_mapLargeShader = this.m_mapImageLarge.material; |
| this.m_mapLargeShader.SetTexture("_MainTex", this.m_mapTexture); |
| this.m_mapLargeShader.SetTexture("_MainTex", this.m_mapTexture); |
| this.m_mapLargeShader.SetTexture("_MaskTex", this.m_forestMaskTexture); |
| this.m_mapLargeShader.SetTexture("_MaskTex", this.m_forestMaskTexture); |
| this.m_mapLargeShader.SetTexture("_HeightTex", this.m_heightTexture); |
| this.m_mapLargeShader.SetTexture("_HeightTex", this.m_heightTexture); |
| this.m_mapLargeShader.SetTexture("_FogTex", this.m_fogTexture); |
| this.m_mapLargeShader.SetTexture("_FogTex", this.m_fogTexture); |
| this.m_mapSmallShader.SetTexture("_MainTex", this.m_mapTexture); |
| this.m_mapSmallShader.SetTexture("_MainTex", this.m_mapTexture); |
| this.m_mapSmallShader.SetTexture("_MaskTex", this.m_forestMaskTexture); |
| this.m_mapSmallShader.SetTexture("_MaskTex", this.m_forestMaskTexture); |
| this.m_mapSmallShader.SetTexture("_HeightTex", this.m_heightTexture); |
| this.m_mapSmallShader.SetTexture("_HeightTex", this.m_heightTexture); |
| this.m_mapSmallShader.SetTexture("_FogTex", this.m_fogTexture); |
| this.m_mapSmallShader.SetTexture("_FogTex", this.m_fogTexture); |
| this.m_nameInput.gameObject.SetActive(false); |
| this.m_nameInput.gameObject.SetActive(false); |
| UIInputHandler component = this.m_mapImageLarge.GetComponent<UIInputHandler>(); |
| UIInputHandler component = this.m_mapImageLarge.GetComponent<UIInputHandler>(); |
| component.m_onRightClick = (Action<UIInputHandler>)Delegate.Combine(component.m_onRightClick, new Action<UIInputHandler>(this.OnMapRightClick)); |
| component.m_onRightClick = (Action<UIInputHandler>)Delegate.Combine(component.m_onRightClick, new Action<UIInputHandler>(this.OnMapRightClick)); |
| component.m_onMiddleClick = (Action<UIInputHandler>)Delegate.Combine(component.m_onMiddleClick, new Action<UIInputHandler>(this.OnMapMiddleClick)); |
| component.m_onMiddleClick = (Action<UIInputHandler>)Delegate.Combine(component.m_onMiddleClick, new Action<UIInputHandler>(this.OnMapMiddleClick)); |
| component.m_onLeftDown = (Action<UIInputHandler>)Delegate.Combine(component.m_onLeftDown, new Action<UIInputHandler>(this.OnMapLeftDown)); |
| component.m_onLeftDown = (Action<UIInputHandler>)Delegate.Combine(component.m_onLeftDown, new Action<UIInputHandler>(this.OnMapLeftDown)); |
| component.m_onLeftUp = (Action<UIInputHandler>)Delegate.Combine(component.m_onLeftUp, new Action<UIInputHandler>(this.OnMapLeftUp)); |
| component.m_onLeftUp = (Action<UIInputHandler>)Delegate.Combine(component.m_onLeftUp, new Action<UIInputHandler>(this.OnMapLeftUp)); |
| this.m_visibleIconTypes = new bool[Enum.GetValues(typeof(Minimap.PinType)).Length]; |
| this.m_visibleIconTypes = new bool[Enum.GetValues(typeof(Minimap.PinType)).Length]; |
| for (int i = 0; i < this.m_visibleIconTypes.Length; i++) |
| for (int i = 0; i < this.m_visibleIconTypes.Length; i++) |
| { |
| { |
| this.m_visibleIconTypes[i] = true; |
| this.m_visibleIconTypes[i] = true; |
| } |
| } |
| this.m_selectedIcons[Minimap.PinType.Death] = this.m_selectedIconDeath; |
| this.m_selectedIcons[Minimap.PinType.Death] = this.m_selectedIconDeath; |
| this.m_selectedIcons[Minimap.PinType.Boss] = this.m_selectedIconBoss; |
| this.m_selectedIcons[Minimap.PinType.Boss] = this.m_selectedIconBoss; |
| this.m_selectedIcons[Minimap.PinType.Icon0] = this.m_selectedIcon0; |
| this.m_selectedIcons[Minimap.PinType.Icon0] = this.m_selectedIcon0; |
| this.m_selectedIcons[Minimap.PinType.Icon1] = this.m_selectedIcon1; |
| this.m_selectedIcons[Minimap.PinType.Icon1] = this.m_selectedIcon1; |
| this.m_selectedIcons[Minimap.PinType.Icon2] = this.m_selectedIcon2; |
| this.m_selectedIcons[Minimap.PinType.Icon2] = this.m_selectedIcon2; |
| this.m_selectedIcons[Minimap.PinType.Icon3] = this.m_selectedIcon3; |
| this.m_selectedIcons[Minimap.PinType.Icon3] = this.m_selectedIcon3; |
| this.m_selectedIcons[Minimap.PinType.Icon4] = this.m_selectedIcon4; |
| this.m_selectedIcons[Minimap.PinType.Icon4] = this.m_selectedIcon4; |
| this.SelectIcon(Minimap.PinType.Icon0); |
| this.SelectIcon(Minimap.PinType.Icon0); |
| this.Reset(); |
| this.Reset(); |
| if (ZNet.World == null) |
| if (ZNet.World == null) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| World world = ZNet.World; |
| World world = ZNet.World; |
| string rootPath = ZNet.World.GetRootPath(FileHelpers.FileSource.Local); |
| string rootPath = ZNet.World.GetRootPath(FileHelpers.FileSource.Local); |
| Directory.CreateDirectory(World.GetWorldSavePath(FileHelpers.FileSource.Local)); |
| Directory.CreateDirectory(World.GetWorldSavePath(FileHelpers.FileSource.Local)); |
| this.m_forestMaskTexturePath = Minimap.GetCompleteTexturePath(rootPath, "forestMaskTexCache"); |
| this.m_forestMaskTexturePath = Minimap.GetCompleteTexturePath(rootPath, "forestMaskTexCache"); |
| this.m_mapTexturePath = Minimap.GetCompleteTexturePath(rootPath, "mapTexCache"); |
| this.m_mapTexturePath = Minimap.GetCompleteTexturePath(rootPath, "mapTexCache"); |
| this.m_heightTexturePath = Minimap.GetCompleteTexturePath(rootPath, "heightTexCache"); |
| this.m_heightTexturePath = Minimap.GetCompleteTexturePath(rootPath, "heightTexCache"); |
| } |
| } |
| |
| |
| public void Reset() |
| public void Reset() |
| { |
| { |
| Color32[] array = new Color32[this.m_textureSize * this.m_textureSize]; |
| Color32[] array = new Color32[this.m_textureSize * this.m_textureSize]; |
| for (int i = 0; i < array.Length; i++) |
| for (int i = 0; i < array.Length; i++) |
| { |
| { |
| array[i] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue); |
| array[i] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue); |
| } |
| } |
| this.m_fogTexture.SetPixels32(array); |
| this.m_fogTexture.SetPixels32(array); |
| this.m_fogTexture.Apply(); |
| this.m_fogTexture.Apply(); |
| for (int j = 0; j < this.m_explored.Length; j++) |
| for (int j = 0; j < this.m_explored.Length; j++) |
| { |
| { |
| this.m_explored[j] = false; |
| this.m_explored[j] = false; |
| this.m_exploredOthers[j] = false; |
| this.m_exploredOthers[j] = false; |
| } |
| } |
| this.m_sharedMapHint.gameObject.SetActive(false); |
| this.m_sharedMapHint.gameObject.SetActive(false); |
| } |
| } |
| |
| |
| public void ResetSharedMapData() |
| public void ResetSharedMapData() |
| { |
| { |
| Color[] pixels = this.m_fogTexture.GetPixels(); |
| Color[] pixels = this.m_fogTexture.GetPixels(); |
| for (int i = 0; i < pixels.Length; i++) |
| for (int i = 0; i < pixels.Length; i++) |
| { |
| { |
| pixels[i].g = 255f; |
| pixels[i].g = 255f; |
| } |
| } |
| this.m_fogTexture.SetPixels(pixels); |
| this.m_fogTexture.SetPixels(pixels); |
| this.m_fogTexture.Apply(); |
| this.m_fogTexture.Apply(); |
| for (int j = 0; j < this.m_exploredOthers.Length; j++) |
| for (int j = 0; j < this.m_exploredOthers.Length; j++) |
| { |
| { |
| this.m_exploredOthers[j] = false; |
| this.m_exploredOthers[j] = false; |
| } |
| } |
| for (int k = this.m_pins.Count - 1; k >= 0; k--) |
| for (int k = this.m_pins.Count - 1; k >= 0; k--) |
| { |
| { |
| Minimap.PinData pinData = this.m_pins[k]; |
| Minimap.PinData pinData = this.m_pins[k]; |
| if (pinData.m_ownerID != 0L) |
| if (pinData.m_ownerID != 0L) |
| { |
| { |
| this.DestroyPinMarker(pinData); |
| this.DestroyPinMarker(pinData); |
| this.m_pins.RemoveAt(k); |
| this.m_pins.RemoveAt(k); |
| } |
| } |
| } |
| } |
| this.m_sharedMapHint.gameObject.SetActive(false); |
| this.m_sharedMapHint.gameObject.SetActive(false); |
| } |
| } |
| |
| |
| public void ForceRegen() |
| public void ForceRegen() |
| { |
| { |
| if (WorldGenerator.instance != null) |
| if (WorldGenerator.instance != null) |
| { |
| { |
| this.GenerateWorldMap(); |
| this.GenerateWorldMap(); |
| } |
| } |
| } |
| } |
| |
| |
| private void Update() |
| private void Update() |
| { |
| { |
| if (ZInput.VirtualKeyboardOpen) |
| if (ZInput.VirtualKeyboardOpen) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| if (this.m_pauseUpdate > 0f) |
| if (this.m_pauseUpdate > 0f) |
| { |
| { |
| this.m_pauseUpdate -= Time.deltaTime; |
| this.m_pauseUpdate -= Time.deltaTime; |
| return; |
| return; |
| } |
| } |
| this.inputDelay = Mathf.Max(0f, this.inputDelay - Time.deltaTime); |
| this.inputDelay = Mathf.Max(0f, this.inputDelay - Time.deltaTime); |
| if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Null) |
| if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Null) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| if (Utils.GetMainCamera() == null) |
| if (Utils.GetMainCamera() == null) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| if (!this.m_hasGenerated) |
| if (!this.m_hasGenerated) |
| { |
| { |
| if (WorldGenerator.instance == null) |
| if (WorldGenerator.instance == null) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| if (!this.TryLoadMinimapTextureData()) |
| if (!this.TryLoadMinimapTextureData()) |
| { |
| { |
| this.GenerateWorldMap(); |
| this.GenerateWorldMap(); |
| } |
| } |
| this.LoadMapData(); |
| this.LoadMapData(); |
| this.m_hasGenerated = true; |
| this.m_hasGenerated = true; |
| } |
| } |
| Player localPlayer = Player.m_localPlayer; |
| Player localPlayer = Player.m_localPlayer; |
| if (localPlayer == null) |
| if (localPlayer == null) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| float deltaTime = Time.deltaTime; |
| float deltaTime = Time.deltaTime; |
| this.UpdateExplore(deltaTime, localPlayer); |
| this.UpdateExplore(deltaTime, localPlayer); |
| if (localPlayer.IsDead()) |
| if (localPlayer.IsDead()) |
| { |
| { |
| this.SetMapMode(Minimap.MapMode.None); |
| this.SetMapMode(Minimap.MapMode.None); |
| return; |
| return; |
| } |
| } |
| if (this.m_mode == Minimap.MapMode.None) |
| if (this.m_mode == Minimap.MapMode.None) |
| { |
| { |
| this.SetMapMode(Minimap.MapMode.Small); |
| this.SetMapMode(Minimap.MapMode.Small); |
| } |
| } |
| if (this.m_mode == Minimap.MapMode.Large) |
| if (this.m_mode == Minimap.MapMode.Large) |
| { |
| { |
| this.m_hiddenFrames = 0; |
| this.m_hiddenFrames = 0; |
| } |
| } |
| else |
| else |
| { |
| { |
| this.m_hiddenFrames++; |
| this.m_hiddenFrames++; |
| } |
| } |
| bool flag = (Chat.instance == null || !Chat.instance.HasFocus()) && !global::Console.IsVisible() && !TextInput.IsVisible() && !Menu.IsActive() && !InventoryGui.IsVisible(); |
| bool flag = (Chat.instance == null || !Chat.instance.HasFocus()) && !global::Console.IsVisible() && !TextInput.IsVisible() && !Menu.IsActive() && !InventoryGui.IsVisible(); |
| if (flag) |
| if (flag) |
| { |
| { |
| if (Minimap.InTextInput()) |
| if (Minimap.InTextInput()) |
| { |
| { |
| if ((ZInput.GetKeyDown(KeyCode.Escape, true) || ZInput.GetButton("JoyButtonB")) && this.m_namePin != null) |
| if ((ZInput.GetKeyDown(KeyCode.Escape, true) || ZInput.GetButton("JoyButtonB")) && this.m_namePin != null) |
| { |
| { |
| this.m_nameInput.text = ""; |
| this.m_nameInput.text = ""; |
| this.OnPinTextEntered(""); |
| this.OnPinTextEntered(""); |
| } |
| } |
| } |
| } |
| else if (ZInput.GetButtonDown("Map") || (ZInput.GetButtonDown("JoyMap") && (!ZInput.GetButton("JoyLTrigger") || !ZInput.GetButton("JoyLBumper")) && !ZInput.GetButton("JoyAltKeys")) || (this.m_mode == Minimap.MapMode.Large && (ZInput.GetKeyDown(KeyCode.Escape, true) || (ZInput.GetButtonDown("JoyMap") && (!ZInput.GetButton("JoyLTrigger") || !ZInput.GetButton("JoyLBumper"))) || ZInput.GetButtonDown("JoyButtonB")))) |
| else if (ZInput.GetButtonDown("Map") || (ZInput.GetButtonDown("JoyMap") && (!ZInput.GetButton("JoyLTrigger") || !ZInput.GetButton("JoyLBumper")) && !ZInput.GetButton("JoyAltKeys")) || (this.m_mode == Minimap.MapMode.Large && (ZInput.GetKeyDown(KeyCode.Escape, true) || (ZInput.GetButtonDown("JoyMap") && (!ZInput.GetButton("JoyLTrigger") || !ZInput.GetButton("JoyLBumper"))) || ZInput.GetButtonDown("JoyButtonB")))) |
| { |
| { |
| switch (this.m_mode) |
| switch (this.m_mode) |
| { |
| { |
| case Minimap.MapMode.None: |
| case Minimap.MapMode.None: |
| this.SetMapMode(Minimap.MapMode.Small); |
| this.SetMapMode(Minimap.MapMode.Small); |
| break; |
| break; |
| case Minimap.MapMode.Small: |
| case Minimap.MapMode.Small: |
| this.SetMapMode(Minimap.MapMode.Large); |
| this.SetMapMode(Minimap.MapMode.Large); |
| break; |
| break; |
| case Minimap.MapMode.Large: |
| case Minimap.MapMode.Large: |
| this.SetMapMode(Minimap.MapMode.Small); |
| this.SetMapMode(Minimap.MapMode.Small); |
| break; |
| break; |
| } |
| } |
| } |
| } |
| } |
| } |
| if (this.m_mode == Minimap.MapMode.Large) |
| if (this.m_mode == Minimap.MapMode.Large) |
| { |
| { |
| this.m_publicPosition.isOn = ZNet.instance.IsReferencePositionPublic(); |
| this.m_publicPosition.isOn = ZNet.instance.IsReferencePositionPublic(); |
| this.m_gamepadCrosshair.gameObject.SetActive(ZInput.IsGamepadActive()); |
| this.m_gamepadCrosshair.gameObject.SetActive(ZInput.IsGamepadActive()); |
| } |
| } |
| if (this.m_showSharedMapData && this.m_sharedMapDataFade < 1f) |
| if (this.m_showSharedMapData && this.m_sharedMapDataFade < 1f) |
| { |
| { |
| this.m_sharedMapDataFade = Mathf.Min(1f, this.m_sharedMapDataFade + this.m_sharedMapDataFadeRate * deltaTime); |
| this.m_sharedMapDataFade = Mathf.Min(1f, this.m_sharedMapDataFade + this.m_sharedMapDataFadeRate * deltaTime); |
| this.m_mapSmallShader.SetFloat("_SharedFade", this.m_sharedMapDataFade); |
| this.m_mapSmallShader.SetFloat("_SharedFade", this.m_sharedMapDataFade); |
| this.m_mapLargeShader.SetFloat("_SharedFade", this.m_sharedMapDataFade); |
| this.m_mapLargeShader.SetFloat("_SharedFade", this.m_sharedMapDataFade); |
| if (this.m_sharedMapDataFade == 1f) |
| if (this.m_sharedMapDataFade == 1f) |
| { |
| { |
| this.m_pinUpdateRequired = true; |
| this.m_pinUpdateRequired = true; |
| } |
| } |
| } |
| } |
| else if (!this.m_showSharedMapData && this.m_sharedMapDataFade > 0f) |
| else if (!this.m_showSharedMapData && this.m_sharedMapDataFade > 0f) |
| { |
| { |
| this.m_sharedMapDataFade = Mathf.Max(0f, this.m_sharedMapDataFade - this.m_sharedMapDataFadeRate * deltaTime); |
| this.m_sharedMapDataFade = Mathf.Max(0f, this.m_sharedMapDataFade - this.m_sharedMapDataFadeRate * deltaTime); |
| this.m_mapSmallShader.SetFloat("_SharedFade", this.m_sharedMapDataFade); |
| this.m_mapSmallShader.SetFloat("_SharedFade", this.m_sharedMapDataFade); |
| this.m_mapLargeShader.SetFloat("_SharedFade", this.m_sharedMapDataFade); |
| this.m_mapLargeShader.SetFloat("_SharedFade", this.m_sharedMapDataFade); |
| if (this.m_sharedMapDataFade == 0f) |
| if (this.m_sharedMapDataFade == 0f) |
| { |
| { |
| this.m_pinUpdateRequired = true; |
| this.m_pinUpdateRequired = true; |
| } |
| } |
| } |
| } |
| this.UpdateMap(localPlayer, deltaTime, flag); |
| this.UpdateMap(localPlayer, deltaTime, flag); |
| this.UpdateDynamicPins(deltaTime); |
| this.UpdateDynamicPins(deltaTime); |
| if (this.m_pinUpdateRequired) |
| if (this.m_pinUpdateRequired) |
| { |
| { |
| this.m_pinUpdateRequired = false; |
| this.m_pinUpdateRequired = false; |
| this.UpdatePins(); |
| this.UpdatePins(); |
| } |
| } |
| this.UpdateBiome(localPlayer); |
| this.UpdateBiome(localPlayer); |
| this.UpdateNameInput(); |
| this.UpdateNameInput(); |
| } |
| } |
| |
| |
| private bool TryLoadMinimapTextureData() |
| private bool TryLoadMinimapTextureData() |
| { |
| { |
| . | if (string.IsNullOrEmpty(this.m_forestMaskTexturePath) || !File.Exists(this.m_forestMaskTexturePath) || !File.Exists(this.m_mapTexturePath) || !File.Exists(this.m_heightTexturePath) || 33 != ZNet.World.m_worldVersion) |
| if (string.IsNullOrEmpty(this.m_forestMaskTexturePath) || !File.Exists(this.m_forestMaskTexturePath) || !File.Exists(this.m_mapTexturePath) || !File.Exists(this.m_heightTexturePath) || 34 != ZNet.World.m_worldVersion) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| Stopwatch stopwatch = Stopwatch.StartNew(); |
| Stopwatch stopwatch = Stopwatch.StartNew(); |
| Texture2D texture2D = new Texture2D(this.m_forestMaskTexture.width, this.m_forestMaskTexture.height, TextureFormat.ARGB32, false); |
| Texture2D texture2D = new Texture2D(this.m_forestMaskTexture.width, this.m_forestMaskTexture.height, TextureFormat.ARGB32, false); |
| if (!texture2D.LoadImage(File.ReadAllBytes(this.m_forestMaskTexturePath))) |
| if (!texture2D.LoadImage(File.ReadAllBytes(this.m_forestMaskTexturePath))) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| this.m_forestMaskTexture.SetPixels(texture2D.GetPixels()); |
| this.m_forestMaskTexture.SetPixels(texture2D.GetPixels()); |
| this.m_forestMaskTexture.Apply(); |
| this.m_forestMaskTexture.Apply(); |
| if (!texture2D.LoadImage(File.ReadAllBytes(this.m_mapTexturePath))) |
| if (!texture2D.LoadImage(File.ReadAllBytes(this.m_mapTexturePath))) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| this.m_mapTexture.SetPixels(texture2D.GetPixels()); |
| this.m_mapTexture.SetPixels(texture2D.GetPixels()); |
| this.m_mapTexture.Apply(); |
| this.m_mapTexture.Apply(); |
| if (!texture2D.LoadImage(File.ReadAllBytes(this.m_heightTexturePath))) |
| if (!texture2D.LoadImage(File.ReadAllBytes(this.m_heightTexturePath))) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| Color[] pixels = texture2D.GetPixels(); |
| Color[] pixels = texture2D.GetPixels(); |
| for (int i = 0; i < this.m_textureSize; i++) |
| for (int i = 0; i < this.m_textureSize; i++) |
| { |
| { |
| for (int j = 0; j < this.m_textureSize; j++) |
| for (int j = 0; j < this.m_textureSize; j++) |
| { |
| { |
| int num = i * this.m_textureSize + j; |
| int num = i * this.m_textureSize + j; |
| int num2 = (int)(pixels[num].r * 255f); |
| int num2 = (int)(pixels[num].r * 255f); |
| int num3 = (int)(pixels[num].g * 255f); |
| int num3 = (int)(pixels[num].g * 255f); |
| int num4 = (num2 << 8) + num3; |
| int num4 = (num2 << 8) + num3; |
| float num5 = 127.5f; |
| float num5 = 127.5f; |
| pixels[num].r = (float)num4 / num5; |
| pixels[num].r = (float)num4 / num5; |
| } |
| } |
| } |
| } |
| this.m_heightTexture.SetPixels(pixels); |
| this.m_heightTexture.SetPixels(pixels); |
| this.m_heightTexture.Apply(); |
| this.m_heightTexture.Apply(); |
| ZLog.Log("Loading minimap textures done [" + stopwatch.ElapsedMilliseconds.ToString() + "ms]"); |
| ZLog.Log("Loading minimap textures done [" + stopwatch.ElapsedMilliseconds.ToString() + "ms]"); |
| return true; |
| return true; |
| } |
| } |
| |
| |
| private void ShowPinNameInput(Vector3 pos) |
| private void ShowPinNameInput(Vector3 pos) |
| { |
| { |
| this.m_namePin = this.AddPin(pos, this.m_selectedType, "", true, false, 0L, ""); |
| this.m_namePin = this.AddPin(pos, this.m_selectedType, "", true, false, 0L, ""); |
| this.m_nameInput.text = ""; |
| this.m_nameInput.text = ""; |
| this.m_nameInput.gameObject.SetActive(true); |
| this.m_nameInput.gameObject.SetActive(true); |
| if (ZInput.IsGamepadActive()) |
| if (ZInput.IsGamepadActive()) |
| { |
| { |
| this.m_nameInput.gameObject.transform.localPosition = new Vector3(0f, -30f, 0f); |
| this.m_nameInput.gameObject.transform.localPosition = new Vector3(0f, -30f, 0f); |
| } |
| } |
| else |
| else |
| { |
| { |
| Vector2 vector; |
| Vector2 vector; |
| RectTransformUtility.ScreenPointToLocalPointInRectangle(this.m_nameInput.gameObject.transform.parent.GetComponent<RectTransform>(), ZInput.mousePosition, null, out vector); |
| RectTransformUtility.ScreenPointToLocalPointInRectangle(this.m_nameInput.gameObject.transform.parent.GetComponent<RectTransform>(), ZInput.mousePosition, null, out vector); |
| this.m_nameInput.gameObject.transform.localPosition = new Vector3(vector.x, vector.y - 30f); |
| this.m_nameInput.gameObject.transform.localPosition = new Vector3(vector.x, vector.y - 30f); |
| } |
| } |
| if (Application.isConsolePlatform && ZInput.IsGamepadActive()) |
| if (Application.isConsolePlatform && ZInput.IsGamepadActive()) |
| { |
| { |
| this.m_nameInput.Select(); |
| this.m_nameInput.Select(); |
| } |
| } |
| else |
| else |
| { |
| { |
| this.m_nameInput.ActivateInputField(); |
| this.m_nameInput.ActivateInputField(); |
| } |
| } |
| GuiInputField nameInput = this.m_nameInput; |
| GuiInputField nameInput = this.m_nameInput; |
| nameInput.VirtualKeyboardStateChange = (Action<VirtualKeyboardState>)Delegate.Remove(nameInput.VirtualKeyboardStateChange, new Action<VirtualKeyboardState>(this.VirtualKeyboardStateChange)); |
| nameInput.VirtualKeyboardStateChange = (Action<VirtualKeyboardState>)Delegate.Remove(nameInput.VirtualKeyboardStateChange, new Action<VirtualKeyboardState>(this.VirtualKeyboardStateChange)); |
| GuiInputField nameInput2 = this.m_nameInput; |
| GuiInputField nameInput2 = this.m_nameInput; |
| nameInput2.VirtualKeyboardStateChange = (Action<VirtualKeyboardState>)Delegate.Combine(nameInput2.VirtualKeyboardStateChange, new Action<VirtualKeyboardState>(this.VirtualKeyboardStateChange)); |
| nameInput2.VirtualKeyboardStateChange = (Action<VirtualKeyboardState>)Delegate.Combine(nameInput2.VirtualKeyboardStateChange, new Action<VirtualKeyboardState>(this.VirtualKeyboardStateChange)); |
| this.m_wasFocused = true; |
| this.m_wasFocused = true; |
| } |
| } |
| |
| |
| private void UpdateNameInput() |
| private void UpdateNameInput() |
| { |
| { |
| if (this.m_delayTextInput < 0f) |
| if (this.m_delayTextInput < 0f) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| this.m_delayTextInput -= Time.deltaTime; |
| this.m_delayTextInput -= Time.deltaTime; |
| this.m_wasFocused = this.m_delayTextInput > 0f; |
| this.m_wasFocused = this.m_delayTextInput > 0f; |
| } |
| } |
| |
| |
| private void VirtualKeyboardStateChange(VirtualKeyboardState state) |
| private void VirtualKeyboardStateChange(VirtualKeyboardState state) |
| { |
| { |
| if (state != VirtualKeyboardState.Cancel) |
| if (state != VirtualKeyboardState.Cancel) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| this.HidePinTextInput(true); |
| this.HidePinTextInput(true); |
| } |
| } |
| |
| |
| private void CreateMapNamePin(Minimap.PinData namePin, RectTransform root) |
| private void CreateMapNamePin(Minimap.PinData namePin, RectTransform root) |
| { |
| { |
| GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.m_pinNamePrefab, root); |
| GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.m_pinNamePrefab, root); |
| namePin.m_NamePinData.SetTextAndGameObject(gameObject); |
| namePin.m_NamePinData.SetTextAndGameObject(gameObject); |
| namePin.m_NamePinData.PinNameRectTransform.SetParent(root); |
| namePin.m_NamePinData.PinNameRectTransform.SetParent(root); |
| this.m_pinUpdateRequired = true; |
| this.m_pinUpdateRequired = true; |
| base.StartCoroutine(this.DelayActivation(gameObject, 1f)); |
| base.StartCoroutine(this.DelayActivation(gameObject, 1f)); |
| } |
| } |
| |
| |
| private IEnumerator DelayActivation(GameObject go, float delay) |
| private IEnumerator DelayActivation(GameObject go, float delay) |
| { |
| { |
| go.SetActive(false); |
| go.SetActive(false); |
| yield return new WaitForSeconds(delay); |
| yield return new WaitForSeconds(delay); |
| if (this == null || go == null || this.m_mode != Minimap.MapMode.Large) |
| if (this == null || go == null || this.m_mode != Minimap.MapMode.Large) |
| { |
| { |
| yield break; |
| yield break; |
| } |
| } |
| go.SetActive(true); |
| go.SetActive(true); |
| yield break; |
| yield break; |
| } |
| } |
| |
| |
| public void OnPinTextEntered(string t) |
| public void OnPinTextEntered(string t) |
| { |
| { |
| string text = this.m_nameInput.text; |
| string text = this.m_nameInput.text; |
| if (text.Length > 0 && this.m_namePin != null) |
| if (text.Length > 0 && this.m_namePin != null) |
| { |
| { |
| text = text.Replace('$', ' '); |
| text = text.Replace('$', ' '); |
| text = text.Replace('<', ' '); |
| text = text.Replace('<', ' '); |
| text = text.Replace('>', ' '); |
| text = text.Replace('>', ' '); |
| this.m_namePin.m_name = text; |
| this.m_namePin.m_name = text; |
| if (!string.IsNullOrEmpty(text) && this.m_namePin.m_NamePinData == null) |
| if (!string.IsNullOrEmpty(text) && this.m_namePin.m_NamePinData == null) |
| { |
| { |
| this.m_namePin.m_NamePinData = new Minimap.PinNameData(this.m_namePin); |
| this.m_namePin.m_NamePinData = new Minimap.PinNameData(this.m_namePin); |
| if (this.m_namePin.m_NamePinData.PinNameGameObject == null) |
| if (this.m_namePin.m_NamePinData.PinNameGameObject == null) |
| { |
| { |
| this.CreateMapNamePin(this.m_namePin, this.m_pinNameRootLarge); |
| this.CreateMapNamePin(this.m_namePin, this.m_pinNameRootLarge); |
| } |
| } |
| } |
| } |
| } |
| } |
| this.HidePinTextInput(true); |
| this.HidePinTextInput(true); |
| } |
| } |
| |
| |
| private void HidePinTextInput(bool delayTextInput = false) |
| private void HidePinTextInput(bool delayTextInput = false) |
| { |
| { |
| GuiInputField nameInput = this.m_nameInput; |
| GuiInputField nameInput = this.m_nameInput; |
| nameInput.VirtualKeyboardStateChange = (Action<VirtualKeyboardState>)Delegate.Remove(nameInput.VirtualKeyboardStateChange, new Action<VirtualKeyboardState>(this.VirtualKeyboardStateChange)); |
| nameInput.VirtualKeyboardStateChange = (Action<VirtualKeyboardState>)Delegate.Remove(nameInput.VirtualKeyboardStateChange, new Action<VirtualKeyboardState>(this.VirtualKeyboardStateChange)); |
| this.m_namePin = null; |
| this.m_namePin = null; |
| this.m_nameInput.text = ""; |
| this.m_nameInput.text = ""; |
| this.m_nameInput.gameObject.SetActive(false); |
| this.m_nameInput.gameObject.SetActive(false); |
| if (delayTextInput) |
| if (delayTextInput) |
| { |
| { |
| this.m_delayTextInput = 0.1f; |
| this.m_delayTextInput = 0.1f; |
| this.m_wasFocused = true; |
| this.m_wasFocused = true; |
| return; |
| return; |
| } |
| } |
| this.m_wasFocused = false; |
| this.m_wasFocused = false; |
| } |
| } |
| |
| |
| private void UpdateMap(Player player, float dt, bool takeInput) |
| private void UpdateMap(Player player, float dt, bool takeInput) |
| { |
| { |
| if (takeInput) |
| if (takeInput) |
| { |
| { |
| if (this.m_mode == Minimap.MapMode.Large) |
| if (this.m_mode == Minimap.MapMode.Large) |
| { |
| { |
| float num = 0f; |
| float num = 0f; |
| num += ZInput.GetMouseScrollWheel() * this.m_largeZoom * 2f; |
| num += ZInput.GetMouseScrollWheel() * this.m_largeZoom * 2f; |
| if (ZInput.GetButton("JoyButtonX") && this.inputDelay <= 0f) |
| if (ZInput.GetButton("JoyButtonX") && this.inputDelay <= 0f) |
| { |
| { |
| Vector3 viewCenterWorldPoint = this.GetViewCenterWorldPoint(); |
| Vector3 viewCenterWorldPoint = this.GetViewCenterWorldPoint(); |
| Chat.instance.SendPing(viewCenterWorldPoint); |
| Chat.instance.SendPing(viewCenterWorldPoint); |
| } |
| } |
| if (ZInput.GetButton("JoyLTrigger") && !this.m_nameInput.gameObject.activeSelf) |
| if (ZInput.GetButton("JoyLTrigger") && !this.m_nameInput.gameObject.activeSelf) |
| { |
| { |
| num -= this.m_largeZoom * dt * 2f; |
| num -= this.m_largeZoom * dt * 2f; |
| } |
| } |
| if (ZInput.GetButton("JoyRTrigger") && !this.m_nameInput.gameObject.activeSelf) |
| if (ZInput.GetButton("JoyRTrigger") && !this.m_nameInput.gameObject.activeSelf) |
| { |
| { |
| num += this.m_largeZoom * dt * 2f; |
| num += this.m_largeZoom * dt * 2f; |
| } |
| } |
| if (ZInput.GetButtonDown("JoyDPadUp")) |
| if (ZInput.GetButtonDown("JoyDPadUp")) |
| { |
| { |
| Minimap.PinType pinType = Minimap.PinType.None; |
| Minimap.PinType pinType = Minimap.PinType.None; |
| using (Dictionary<Minimap.PinType, Image>.Enumerator enumerator = this.m_selectedIcons.GetEnumerator()) |
| using (Dictionary<Minimap.PinType, Image>.Enumerator enumerator = this.m_selectedIcons.GetEnumerator()) |
| { |
| { |
| while (enumerator.MoveNext()) |
| while (enumerator.MoveNext()) |
| { |
| { |
| KeyValuePair<Minimap.PinType, Image> keyValuePair = enumerator.Current; |
| KeyValuePair<Minimap.PinType, Image> keyValuePair = enumerator.Current; |
| if (keyValuePair.Key == this.m_selectedType && pinType != Minimap.PinType.None) |
| if (keyValuePair.Key == this.m_selectedType && pinType != Minimap.PinType.None) |
| { |
| { |
| this.SelectIcon(pinType); |
| this.SelectIcon(pinType); |
| break; |
| break; |
| } |
| } |
| pinType = keyValuePair.Key; |
| pinType = keyValuePair.Key; |
| } |
| } |
| goto IL_17F; |
| goto IL_17F; |
| } |
| } |
| } |
| } |
| if (ZInput.GetButtonDown("JoyDPadDown")) |
| if (ZInput.GetButtonDown("JoyDPadDown")) |
| { |
| { |
| bool flag = false; |
| bool flag = false; |
| foreach (KeyValuePair<Minimap.PinType, Image> keyValuePair2 in this.m_selectedIcons) |
| foreach (KeyValuePair<Minimap.PinType, Image> keyValuePair2 in this.m_selectedIcons) |
| { |
| { |
| if (flag) |
| if (flag) |
| { |
| { |
| this.SelectIcon(keyValuePair2.Key); |
| this.SelectIcon(keyValuePair2.Key); |
| break; |
| break; |
| } |
| } |
| if (keyValuePair2.Key == this.m_selectedType) |
| if (keyValuePair2.Key == this.m_selectedType) |
| { |
| { |
| flag = true; |
| flag = true; |
| } |
| } |
| } |
| } |
| } |
| } |
| IL_17F: |
| IL_17F: |
| if (ZInput.GetButtonDown("JoyDPadRight")) |
| if (ZInput.GetButtonDown("JoyDPadRight")) |
| { |
| { |
| this.ToggleIconFilter(this.m_selectedType); |
| this.ToggleIconFilter(this.m_selectedType); |
| } |
| } |
| if (ZInput.GetButtonUp("JoyButtonA") && !Minimap.InTextInput() && this.inputDelay <= 0f) |
| if (ZInput.GetButtonUp("JoyButtonA") && !Minimap.InTextInput() && this.inputDelay <= 0f) |
| { |
| { |
| this.ShowPinNameInput(this.ScreenToWorldPoint(new Vector3((float)(Screen.width / 2), (float)(Screen.height / 2)))); |
| this.ShowPinNameInput(this.ScreenToWorldPoint(new Vector3((float)(Screen.width / 2), (float)(Screen.height / 2)))); |
| } |
| } |
| if (ZInput.GetButtonDown("JoyTabRight")) |
| if (ZInput.GetButtonDown("JoyTabRight")) |
| { |
| { |
| Vector3 vector = this.ScreenToWorldPoint(new Vector3((float)(Screen.width / 2), (float)(Screen.height / 2))); |
| Vector3 vector = this.ScreenToWorldPoint(new Vector3((float)(Screen.width / 2), (float)(Screen.height / 2))); |
| this.RemovePin(vector, this.m_removeRadius * (this.m_largeZoom * 2f)); |
| this.RemovePin(vector, this.m_removeRadius * (this.m_largeZoom * 2f)); |
| this.HidePinTextInput(false); |
| this.HidePinTextInput(false); |
| } |
| } |
| if (ZInput.GetButtonDown("JoyTabLeft")) |
| if (ZInput.GetButtonDown("JoyTabLeft")) |
| { |
| { |
| Vector3 vector2 = this.ScreenToWorldPoint(new Vector3((float)(Screen.width / 2), (float)(Screen.height / 2))); |
| Vector3 vector2 = this.ScreenToWorldPoint(new Vector3((float)(Screen.width / 2), (float)(Screen.height / 2))); |
| Minimap.PinData closestPin = this.GetClosestPin(vector2, this.m_removeRadius * (this.m_largeZoom * 2f), true); |
| Minimap.PinData closestPin = this.GetClosestPin(vector2, this.m_removeRadius * (this.m_largeZoom * 2f), true); |
| if (closestPin != null) |
| if (closestPin != null) |
| { |
| { |
| if (closestPin.m_ownerID != 0L) |
| if (closestPin.m_ownerID != 0L) |
| { |
| { |
| closestPin.m_ownerID = 0L; |
| closestPin.m_ownerID = 0L; |
| } |
| } |
| else |
| else |
| { |
| { |
| closestPin.m_checked = !closestPin.m_checked; |
| closestPin.m_checked = !closestPin.m_checked; |
| } |
| } |
| } |
| } |
| this.HidePinTextInput(false); |
| this.HidePinTextInput(false); |
| } |
| } |
| if (ZInput.GetButtonDown("MapZoomOut") && !Minimap.InTextInput() && !this.m_nameInput.gameObject.activeSelf) |
| if (ZInput.GetButtonDown("MapZoomOut") && !Minimap.InTextInput() && !this.m_nameInput.gameObject.activeSelf) |
| { |
| { |
| num -= this.m_largeZoom * 0.5f; |
| num -= this.m_largeZoom * 0.5f; |
| } |
| } |
| if (ZInput.GetButtonDown("MapZoomIn") && !Minimap.InTextInput() && !this.m_nameInput.gameObject.activeSelf) |
| if (ZInput.GetButtonDown("MapZoomIn") && !Minimap.InTextInput() && !this.m_nameInput.gameObject.activeSelf) |
| { |
| { |
| num += this.m_largeZoom * 0.5f; |
| num += this.m_largeZoom * 0.5f; |
| } |
| } |
| if (!Minimap.InTextInput()) |
| if (!Minimap.InTextInput()) |
| { |
| { |
| this.m_largeZoom = Mathf.Clamp(this.m_largeZoom - num, this.m_minZoom, this.m_maxZoom); |
| this.m_largeZoom = Mathf.Clamp(this.m_largeZoom - num, this.m_minZoom, this.m_maxZoom); |
| } |
| } |
| } |
| } |
| else |
| else |
| { |
| { |
| float num2 = 0f; |
| float num2 = 0f; |
| if (ZInput.GetButtonDown("MapZoomOut") && !this.m_nameInput.gameObject.activeSelf) |
| if (ZInput.GetButtonDown("MapZoomOut") && !this.m_nameInput.gameObject.activeSelf) |
| { |
| { |
| num2 -= this.m_smallZoom * 0.5f; |
| num2 -= this.m_smallZoom * 0.5f; |
| } |
| } |
| if (ZInput.GetButtonDown("MapZoomIn") && !this.m_nameInput.gameObject.activeSelf) |
| if (ZInput.GetButtonDown("MapZoomIn") && !this.m_nameInput.gameObject.activeSelf) |
| { |
| { |
| num2 += this.m_smallZoom * 0.5f; |
| num2 += this.m_smallZoom * 0.5f; |
| } |
| } |
| . | if (ZInput.GetButton("JoyAltKeys") && ZInput.GetButtonDown("JoyMapZoom") && !this.m_nameInput.gameObject.activeSelf) |
| if (ZInput.GetButton("JoyAltKeys") && ZInput.GetButtonDown("JoyMapZoomOut") && !this.m_nameInput.gameObject.activeSelf) |
| { |
| { |
| . | num2 += this.m_smallZoom * 0.5f * (float)(this.m_mapZoomToggle ? 1 : (-1)); |
| num2 -= this.m_smallZoom * 0.5f; |
| } |
| } |
| . | if (ZInput.GetButtonUp("JoyAltKeys") && !this.m_nameInput.gameObject.activeSelf) |
| if (ZInput.GetButton("JoyAltKeys") && ZInput.GetButtonDown("JoyMapZoomIn") && !this.m_nameInput.gameObject.activeSelf) |
| { |
| { |
| . | this.m_mapZoomToggle = !this.m_mapZoomToggle; |
| num2 += this.m_smallZoom * 0.5f; |
| } |
| } |
| if (!Minimap.InTextInput()) |
| if (!Minimap.InTextInput()) |
| { |
| { |
| this.m_smallZoom = Mathf.Clamp(this.m_smallZoom - num2, this.m_minZoom, this.m_maxZoom); |
| this.m_smallZoom = Mathf.Clamp(this.m_smallZoom - num2, this.m_minZoom, this.m_maxZoom); |
| } |
| } |
| } |
| } |
| } |
| } |
| if (this.m_mode == Minimap.MapMode.Large) |
| if (this.m_mode == Minimap.MapMode.Large) |
| { |
| { |
| if (this.m_leftDownTime != 0f && this.m_leftDownTime > this.m_clickDuration && !this.m_dragView) |
| if (this.m_leftDownTime != 0f && this.m_leftDownTime > this.m_clickDuration && !this.m_dragView) |
| { |
| { |
| this.m_dragWorldPos = this.ScreenToWorldPoint(ZInput.mousePosition); |
| this.m_dragWorldPos = this.ScreenToWorldPoint(ZInput.mousePosition); |
| this.m_dragView = true; |
| this.m_dragView = true; |
| this.HidePinTextInput(false); |
| this.HidePinTextInput(false); |
| } |
| } |
| if (!this.m_nameInput.gameObject.activeSelf) |
| if (!this.m_nameInput.gameObject.activeSelf) |
| { |
| { |
| this.m_mapOffset.x = this.m_mapOffset.x + ZInput.GetJoyLeftStickX(true) * dt * 50000f * this.m_largeZoom * this.m_gamepadMoveSpeed; |
| this.m_mapOffset.x = this.m_mapOffset.x + ZInput.GetJoyLeftStickX(true) * dt * 50000f * this.m_largeZoom * this.m_gamepadMoveSpeed; |
| this.m_mapOffset.z = this.m_mapOffset.z - ZInput.GetJoyLeftStickY(true) * dt * 50000f * this.m_largeZoom * this.m_gamepadMoveSpeed; |
| this.m_mapOffset.z = this.m_mapOffset.z - ZInput.GetJoyLeftStickY(true) * dt * 50000f * this.m_largeZoom * this.m_gamepadMoveSpeed; |
| } |
| } |
| if (this.m_dragView) |
| if (this.m_dragView) |
| { |
| { |
| Vector3 vector3 = this.ScreenToWorldPoint(ZInput.mousePosition) - this.m_dragWorldPos; |
| Vector3 vector3 = this.ScreenToWorldPoint(ZInput.mousePosition) - this.m_dragWorldPos; |
| this.m_mapOffset -= vector3; |
| this.m_mapOffset -= vector3; |
| this.m_pinUpdateRequired = true; |
| this.m_pinUpdateRequired = true; |
| this.CenterMap(player.transform.position + this.m_mapOffset); |
| this.CenterMap(player.transform.position + this.m_mapOffset); |
| this.m_dragWorldPos = this.ScreenToWorldPoint(ZInput.mousePosition); |
| this.m_dragWorldPos = this.ScreenToWorldPoint(ZInput.mousePosition); |
| } |
| } |
| else |
| else |
| { |
| { |
| this.CenterMap(player.transform.position + this.m_mapOffset); |
| this.CenterMap(player.transform.position + this.m_mapOffset); |
| } |
| } |
| } |
| } |
| else |
| else |
| { |
| { |
| this.CenterMap(player.transform.position); |
| this.CenterMap(player.transform.position); |
| } |
| } |
| this.UpdateWindMarker(); |
| this.UpdateWindMarker(); |
| this.UpdatePlayerMarker(player, Utils.GetMainCamera().transform.rotation); |
| this.UpdatePlayerMarker(player, Utils.GetMainCamera().transform.rotation); |
| } |
| } |
| |
| |
| public void SetMapMode(Minimap.MapMode mode) |
| public void SetMapMode(Minimap.MapMode mode) |
| { |
| { |
| if (Game.m_noMap) |
| if (Game.m_noMap) |
| { |
| { |
| mode = Minimap.MapMode.None; |
| mode = Minimap.MapMode.None; |
| } |
| } |
| if (mode == this.m_mode) |
| if (mode == this.m_mode) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| this.m_pinUpdateRequired = true; |
| this.m_pinUpdateRequired = true; |
| this.m_mode = mode; |
| this.m_mode = mode; |
| switch (mode) |
| switch (mode) |
| { |
| { |
| case Minimap.MapMode.None: |
| case Minimap.MapMode.None: |
| this.m_largeRoot.SetActive(false); |
| this.m_largeRoot.SetActive(false); |
| this.m_smallRoot.SetActive(false); |
| this.m_smallRoot.SetActive(false); |
| this.HidePinTextInput(false); |
| this.HidePinTextInput(false); |
| return; |
| return; |
| case Minimap.MapMode.Small: |
| case Minimap.MapMode.Small: |
| this.m_largeRoot.SetActive(false); |
| this.m_largeRoot.SetActive(false); |
| this.m_smallRoot.SetActive(true); |
| this.m_smallRoot.SetActive(true); |
| this.HidePinTextInput(false); |
| this.HidePinTextInput(false); |
| return; |
| return; |
| case Minimap.MapMode.Large: |
| case Minimap.MapMode.Large: |
| { |
| { |
| this.m_largeRoot.SetActive(true); |
| this.m_largeRoot.SetActive(true); |
| this.m_smallRoot.SetActive(false); |
| this.m_smallRoot.SetActive(false); |
| bool flag = PlayerPrefs.GetInt("KeyHints", 1) == 1; |
| bool flag = PlayerPrefs.GetInt("KeyHints", 1) == 1; |
| foreach (GameObject gameObject in this.m_hints) |
| foreach (GameObject gameObject in this.m_hints) |
| { |
| { |
| gameObject.SetActive(flag); |
| gameObject.SetActive(flag); |
| } |
| } |
| this.m_dragView = false; |
| this.m_dragView = false; |
| this.m_mapOffset = Vector3.zero; |
| this.m_mapOffset = Vector3.zero; |
| this.m_namePin = null; |
| this.m_namePin = null; |
| return; |
| return; |
| } |
| } |
| default: |
| default: |
| return; |
| return; |
| } |
| } |
| } |
| } |
| |
| |
| private void CenterMap(Vector3 centerPoint) |
| private void CenterMap(Vector3 centerPoint) |
| { |
| { |
| float num; |
| float num; |
| float num2; |
| float num2; |
| this.WorldToMapPoint(centerPoint, out num, out num2); |
| this.WorldToMapPoint(centerPoint, out num, out num2); |
| Rect uvRect = this.m_mapImageSmall.uvRect; |
| Rect uvRect = this.m_mapImageSmall.uvRect; |
| uvRect.width = this.m_smallZoom; |
| uvRect.width = this.m_smallZoom; |
| uvRect.height = this.m_smallZoom; |
| uvRect.height = this.m_smallZoom; |
| uvRect.center = new Vector2(num, num2); |
| uvRect.center = new Vector2(num, num2); |
| this.m_mapImageSmall.uvRect = uvRect; |
| this.m_mapImageSmall.uvRect = uvRect; |
| RectTransform rectTransform = this.m_mapImageLarge.transform as RectTransform; |
| RectTransform rectTransform = this.m_mapImageLarge.transform as RectTransform; |
| float num3 = rectTransform.rect.width / rectTransform.rect.height; |
| float num3 = rectTransform.rect.width / rectTransform.rect.height; |
| Rect uvRect2 = this.m_mapImageSmall.uvRect; |
| Rect uvRect2 = this.m_mapImageSmall.uvRect; |
| uvRect2.width = this.m_largeZoom * num3; |
| uvRect2.width = this.m_largeZoom * num3; |
| uvRect2.height = this.m_largeZoom; |
| uvRect2.height = this.m_largeZoom; |
| uvRect2.center = new Vector2(num, num2); |
| uvRect2.center = new Vector2(num, num2); |
| this.m_mapImageLarge.uvRect = uvRect2; |
| this.m_mapImageLarge.uvRect = uvRect2; |
| if (this.m_mode == Minimap.MapMode.Large) |
| if (this.m_mode == Minimap.MapMode.Large) |
| { |
| { |
| this.m_mapLargeShader.SetFloat("_zoom", this.m_largeZoom); |
| this.m_mapLargeShader.SetFloat("_zoom", this.m_largeZoom); |
| this.m_mapLargeShader.SetFloat("_pixelSize", 200f / this.m_largeZoom); |
| this.m_mapLargeShader.SetFloat("_pixelSize", 200f / this.m_largeZoom); |
| this.m_mapLargeShader.SetVector("_mapCenter", centerPoint); |
| this.m_mapLargeShader.SetVector("_mapCenter", centerPoint); |
| } |
| } |
| else |
| else |
| { |
| { |
| this.m_mapSmallShader.SetFloat("_zoom", this.m_smallZoom); |
| this.m_mapSmallShader.SetFloat("_zoom", this.m_smallZoom); |
| this.m_mapSmallShader.SetFloat("_pixelSize", 200f / this.m_smallZoom); |
| this.m_mapSmallShader.SetFloat("_pixelSize", 200f / this.m_smallZoom); |
| this.m_mapSmallShader.SetVector("_mapCenter", centerPoint); |
| this.m_mapSmallShader.SetVector("_mapCenter", centerPoint); |
| } |
| } |
| if (this.UpdatedMap(centerPoint)) |
| if (this.UpdatedMap(centerPoint)) |
| { |
| { |
| this.m_pinUpdateRequired = true; |
| this.m_pinUpdateRequired = true; |
| } |
| } |
| } |
| } |
| |
| |
| private bool UpdatedMap(Vector3 centerPoint) |
| private bool UpdatedMap(Vector3 centerPoint) |
| { |
| { |
| float num = this.m_previousMapCenter.magnitude - centerPoint.magnitude; |
| float num = this.m_previousMapCenter.magnitude - centerPoint.magnitude; |
| if (num > 0.01f || num < -0.01f) |
| if (num > 0.01f || num < -0.01f) |
| { |
| { |
| this.m_previousMapCenter = centerPoint; |
| this.m_previousMapCenter = centerPoint; |
| return true; |
| return true; |
| } |
| } |
| if (this.m_mode == Minimap.MapMode.Large) |
| if (this.m_mode == Minimap.MapMode.Large) |
| { |
| { |
| if (this.m_previousLargeZoom != this.m_largeZoom) |
| if (this.m_previousLargeZoom != this.m_largeZoom) |
| { |
| { |
| this.m_previousLargeZoom = this.m_largeZoom; |
| this.m_previousLargeZoom = this.m_largeZoom; |
| return true; |
| return true; |
| } |
| } |
| } |
| } |
| else if (this.m_previousSmallZoom != this.m_smallZoom) |
| else if (this.m_previousSmallZoom != this.m_smallZoom) |
| { |
| { |
| this.m_previousSmallZoom = this.m_smallZoom; |
| this.m_previousSmallZoom = this.m_smallZoom; |
| return true; |
| return true; |
| } |
| } |
| return false; |
| return false; |
| } |
| } |
| |
| |
| private void UpdateDynamicPins(float dt) |
| private void UpdateDynamicPins(float dt) |
| { |
| { |
| this.UpdateProfilePins(); |
| this.UpdateProfilePins(); |
| this.UpdateShoutPins(); |
| this.UpdateShoutPins(); |
| this.UpdatePingPins(); |
| this.UpdatePingPins(); |
| this.UpdatePlayerPins(dt); |
| this.UpdatePlayerPins(dt); |
| this.UpdateLocationPins(dt); |
| this.UpdateLocationPins(dt); |
| this.UpdateEventPin(dt); |
| this.UpdateEventPin(dt); |
| } |
| } |
| |
| |
| private void UpdateProfilePins() |
| private void UpdateProfilePins() |
| { |
| { |
| PlayerProfile playerProfile = Game.instance.GetPlayerProfile(); |
| PlayerProfile playerProfile = Game.instance.GetPlayerProfile(); |
| playerProfile.HaveDeathPoint(); |
| playerProfile.HaveDeathPoint(); |
| if (this.m_deathPin != null) |
| if (this.m_deathPin != null) |
| { |
| { |
| this.RemovePin(this.m_deathPin); |
| this.RemovePin(this.m_deathPin); |
| this.m_deathPin = null; |
| this.m_deathPin = null; |
| } |
| } |
| if (playerProfile.HaveCustomSpawnPoint()) |
| if (playerProfile.HaveCustomSpawnPoint()) |
| { |
| { |
| if (this.m_spawnPointPin == null) |
| if (this.m_spawnPointPin == null) |
| { |
| { |
| this.m_spawnPointPin = this.AddPin(playerProfile.GetCustomSpawnPoint(), Minimap.PinType.Bed, "", false, false, 0L, ""); |
| this.m_spawnPointPin = this.AddPin(playerProfile.GetCustomSpawnPoint(), Minimap.PinType.Bed, "", false, false, 0L, ""); |
| } |
| } |
| this.m_spawnPointPin.m_pos = playerProfile.GetCustomSpawnPoint(); |
| this.m_spawnPointPin.m_pos = playerProfile.GetCustomSpawnPoint(); |
| return; |
| return; |
| } |
| } |
| if (this.m_spawnPointPin != null) |
| if (this.m_spawnPointPin != null) |
| { |
| { |
| this.RemovePin(this.m_spawnPointPin); |
| this.RemovePin(this.m_spawnPointPin); |
| this.m_spawnPointPin = null; |
| this.m_spawnPointPin = null; |
| } |
| } |
| } |
| } |
| |
| |
| private void UpdateEventPin(float dt) |
| private void UpdateEventPin(float dt) |
| { |
| { |
| if (Time.time - this.m_updateEventTime < 1f) |
| if (Time.time - this.m_updateEventTime < 1f) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| this.m_updateEventTime = Time.time; |
| this.m_updateEventTime = Time.time; |
| RandomEvent currentRandomEvent = RandEventSystem.instance.GetCurrentRandomEvent(); |
| RandomEvent currentRandomEvent = RandEventSystem.instance.GetCurrentRandomEvent(); |
| if (currentRandomEvent != null) |
| if (currentRandomEvent != null) |
| { |
| { |
| if (this.m_randEventAreaPin == null) |
| if (this.m_randEventAreaPin == null) |
| { |
| { |
| this.m_randEventAreaPin = this.AddPin(currentRandomEvent.m_pos, Minimap.PinType.EventArea, "", false, false, 0L, ""); |
| this.m_randEventAreaPin = this.AddPin(currentRandomEvent.m_pos, Minimap.PinType.EventArea, "", false, false, 0L, ""); |
| . | this.m_randEventAreaPin.m_worldSize = RandEventSystem.instance.m_randomEventRange * 2f; |
| this.m_randEventAreaPin.m_worldSize = currentRandomEvent.m_eventRange * 2f; |
| this.m_randEventAreaPin.m_worldSize *= 0.9f; |
| this.m_randEventAreaPin.m_worldSize *= 0.9f; |
| } |
| } |
| if (this.m_randEventPin == null) |
| if (this.m_randEventPin == null) |
| { |
| { |
| this.m_randEventPin = this.AddPin(currentRandomEvent.m_pos, Minimap.PinType.RandomEvent, "", false, false, 0L, ""); |
| this.m_randEventPin = this.AddPin(currentRandomEvent.m_pos, Minimap.PinType.RandomEvent, "", false, false, 0L, ""); |
| this.m_randEventPin.m_animate = true; |
| this.m_randEventPin.m_animate = true; |
| this.m_randEventPin.m_doubleSize = true; |
| this.m_randEventPin.m_doubleSize = true; |
| } |
| } |
| this.m_randEventAreaPin.m_pos = currentRandomEvent.m_pos; |
| this.m_randEventAreaPin.m_pos = currentRandomEvent.m_pos; |
| this.m_randEventPin.m_pos = currentRandomEvent.m_pos; |
| this.m_randEventPin.m_pos = currentRandomEvent.m_pos; |
| this.m_randEventPin.m_name = Localization.instance.Localize(currentRandomEvent.GetHudText()); |
| this.m_randEventPin.m_name = Localization.instance.Localize(currentRandomEvent.GetHudText()); |
| return; |
| return; |
| } |
| } |
| if (this.m_randEventPin != null) |
| if (this.m_randEventPin != null) |
| { |
| { |
| this.RemovePin(this.m_randEventPin); |
| this.RemovePin(this.m_randEventPin); |
| this.m_randEventPin = null; |
| this.m_randEventPin = null; |
| } |
| } |
| if (this.m_randEventAreaPin != null) |
| if (this.m_randEventAreaPin != null) |
| { |
| { |
| this.RemovePin(this.m_randEventAreaPin); |
| this.RemovePin(this.m_randEventAreaPin); |
| this.m_randEventAreaPin = null; |
| this.m_randEventAreaPin = null; |
| } |
| } |
| } |
| } |
| |
| |
| private void UpdateLocationPins(float dt) |
| private void UpdateLocationPins(float dt) |
| { |
| { |
| this.m_updateLocationsTimer -= dt; |
| this.m_updateLocationsTimer -= dt; |
| if (this.m_updateLocationsTimer <= 0f) |
| if (this.m_updateLocationsTimer <= 0f) |
| { |
| { |
| this.m_updateLocationsTimer = 5f; |
| this.m_updateLocationsTimer = 5f; |
| Dictionary<Vector3, string> dictionary = new Dictionary<Vector3, string>(); |
| Dictionary<Vector3, string> dictionary = new Dictionary<Vector3, string>(); |
| ZoneSystem.instance.GetLocationIcons(dictionary); |
| ZoneSystem.instance.GetLocationIcons(dictionary); |
| bool flag = false; |
| bool flag = false; |
| while (!flag) |
| while (!flag) |
| { |
| { |
| flag = true; |
| flag = true; |
| foreach (KeyValuePair<Vector3, Minimap.PinData> keyValuePair in this.m_locationPins) |
| foreach (KeyValuePair<Vector3, Minimap.PinData> keyValuePair in this.m_locationPins) |
| { |
| { |
| if (!dictionary.ContainsKey(keyValuePair.Key)) |
| if (!dictionary.ContainsKey(keyValuePair.Key)) |
| { |
| { |
| ZLog.DevLog("Minimap: Removing location " + keyValuePair.Value.m_name); |
| ZLog.DevLog("Minimap: Removing location " + keyValuePair.Value.m_name); |
| this.RemovePin(keyValuePair.Value); |
| this.RemovePin(keyValuePair.Value); |
| this.m_locationPins.Remove(keyValuePair.Key); |
| this.m_locationPins.Remove(keyValuePair.Key); |
| flag = false; |
| flag = false; |
| break; |
| break; |
| } |
| } |
| } |
| } |
| } |
| } |
| foreach (KeyValuePair<Vector3, string> keyValuePair2 in dictionary) |
| foreach (KeyValuePair<Vector3, string> keyValuePair2 in dictionary) |
| { |
| { |
| if (!this.m_locationPins.ContainsKey(keyValuePair2.Key)) |
| if (!this.m_locationPins.ContainsKey(keyValuePair2.Key)) |
| { |
| { |
| Sprite locationIcon = this.GetLocationIcon(keyValuePair2.Value); |
| Sprite locationIcon = this.GetLocationIcon(keyValuePair2.Value); |
| if (locationIcon) |
| if (locationIcon) |
| { |
| { |
| Minimap.PinData pinData = this.AddPin(keyValuePair2.Key, Minimap.PinType.None, "", false, false, 0L, ""); |
| Minimap.PinData pinData = this.AddPin(keyValuePair2.Key, Minimap.PinType.None, "", false, false, 0L, ""); |
| pinData.m_icon = locationIcon; |
| pinData.m_icon = locationIcon; |
| pinData.m_doubleSize = true; |
| pinData.m_doubleSize = true; |
| this.m_locationPins.Add(keyValuePair2.Key, pinData); |
| this.m_locationPins.Add(keyValuePair2.Key, pinData); |
| ZLog.Log("Minimap: Adding unique location " + keyValuePair2.Key.ToString()); |
| ZLog.Log("Minimap: Adding unique location " + keyValuePair2.Key.ToString()); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| |
| private Sprite GetLocationIcon(string name) |
| private Sprite GetLocationIcon(string name) |
| { |
| { |
| foreach (Minimap.LocationSpriteData locationSpriteData in this.m_locationIcons) |
| foreach (Minimap.LocationSpriteData locationSpriteData in this.m_locationIcons) |
| { |
| { |
| if (locationSpriteData.m_name == name) |
| if (locationSpriteData.m_name == name) |
| { |
| { |
| return locationSpriteData.m_icon; |
| return locationSpriteData.m_icon; |
| } |
| } |
| } |
| } |
| return null; |
| return null; |
| } |
| } |
| |
| |
| private void UpdatePlayerPins(float dt) |
| private void UpdatePlayerPins(float dt) |
| { |
| { |
| this.m_tempPlayerInfo.Clear(); |
| this.m_tempPlayerInfo.Clear(); |
| ZNet.instance.GetOtherPublicPlayers(this.m_tempPlayerInfo); |
| ZNet.instance.GetOtherPublicPlayers(this.m_tempPlayerInfo); |
| if (this.m_playerPins.Count != this.m_tempPlayerInfo.Count) |
| if (this.m_playerPins.Count != this.m_tempPlayerInfo.Count) |
| { |
| { |
| foreach (Minimap.PinData pinData in this.m_playerPins) |
| foreach (Minimap.PinData pinData in this.m_playerPins) |
| { |
| { |
| this.RemovePin(pinData); |
| this.RemovePin(pinData); |
| } |
| } |
| this.m_playerPins.Clear(); |
| this.m_playerPins.Clear(); |
| foreach (ZNet.PlayerInfo playerInfo in this.m_tempPlayerInfo) |
| foreach (ZNet.PlayerInfo playerInfo in this.m_tempPlayerInfo) |
| { |
| { |
| Minimap.PinData pinData2 = this.AddPin(Vector3.zero, Minimap.PinType.Player, "", false, false, 0L, ""); |
| Minimap.PinData pinData2 = this.AddPin(Vector3.zero, Minimap.PinType.Player, "", false, false, 0L, ""); |
| this.m_playerPins.Add(pinData2); |
| this.m_playerPins.Add(pinData2); |
| } |
| } |
| } |
| } |
| for (int i = 0; i < this.m_tempPlayerInfo.Count; i++) |
| for (int i = 0; i < this.m_tempPlayerInfo.Count; i++) |
| { |
| { |
| Minimap.PinData pinData3 = this.m_playerPins[i]; |
| Minimap.PinData pinData3 = this.m_playerPins[i]; |
| ZNet.PlayerInfo playerInfo2 = this.m_tempPlayerInfo[i]; |
| ZNet.PlayerInfo playerInfo2 = this.m_tempPlayerInfo[i]; |
| if (pinData3.m_name == playerInfo2.m_name) |
| if (pinData3.m_name == playerInfo2.m_name) |
| { |
| { |
| Vector3 vector = Vector3.MoveTowards(pinData3.m_pos, playerInfo2.m_position, 200f * dt); |
| Vector3 vector = Vector3.MoveTowards(pinData3.m_pos, playerInfo2.m_position, 200f * dt); |
| if (vector != pinData3.m_pos) |
| if (vector != pinData3.m_pos) |
| { |
| { |
| this.m_pinUpdateRequired = true; |
| this.m_pinUpdateRequired = true; |
| } |
| } |
| pinData3.m_pos = vector; |
| pinData3.m_pos = vector; |
| } |
| } |
| else |
| else |
| { |
| { |
| pinData3.m_name = CensorShittyWords.FilterUGC(playerInfo2.m_name, UGCType.CharacterName, null, playerInfo2.m_characterID.UserID); |
| pinData3.m_name = CensorShittyWords.FilterUGC(playerInfo2.m_name, UGCType.CharacterName, null, playerInfo2.m_characterID.UserID); |
| if (playerInfo2.m_position != pinData3.m_pos) |
| if (playerInfo2.m_position != pinData3.m_pos) |
| { |
| { |
| this.m_pinUpdateRequired = true; |
| this.m_pinUpdateRequired = true; |
| } |
| } |
| pinData3.m_pos = playerInfo2.m_position; |
| pinData3.m_pos = playerInfo2.m_position; |
| if (pinData3.m_NamePinData == null) |
| if (pinData3.m_NamePinData == null) |
| { |
| { |
| pinData3.m_NamePinData = new Minimap.PinNameData(pinData3); |
| pinData3.m_NamePinData = new Minimap.PinNameData(pinData3); |
| this.CreateMapNamePin(pinData3, this.m_pinNameRootLarge); |
| this.CreateMapNamePin(pinData3, this.m_pinNameRootLarge); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| |
| private void UpdatePingPins() |
| private void UpdatePingPins() |
| { |
| { |
| this.m_tempShouts.Clear(); |
| this.m_tempShouts.Clear(); |
| Chat.instance.GetPingWorldTexts(this.m_tempShouts); |
| Chat.instance.GetPingWorldTexts(this.m_tempShouts); |
| if (this.m_pingPins.Count != this.m_tempShouts.Count) |
| if (this.m_pingPins.Count != this.m_tempShouts.Count) |
| { |
| { |
| foreach (Minimap.PinData pinData in this.m_pingPins) |
| foreach (Minimap.PinData pinData in this.m_pingPins) |
| { |
| { |
| this.RemovePin(pinData); |
| this.RemovePin(pinData); |
| } |
| } |
| this.m_pingPins.Clear(); |
| this.m_pingPins.Clear(); |
| foreach (Chat.WorldTextInstance worldTextInstance in this.m_tempShouts) |
| foreach (Chat.WorldTextInstance worldTextInstance in this.m_tempShouts) |
| { |
| { |
| Minimap.PinData pinData2 = this.AddPin(Vector3.zero, Minimap.PinType.Ping, worldTextInstance.m_name + ": " + worldTextInstance.m_text, false, false, 0L, ""); |
| Minimap.PinData pinData2 = this.AddPin(Vector3.zero, Minimap.PinType.Ping, worldTextInstance.m_name + ": " + worldTextInstance.m_text, false, false, 0L, ""); |
| pinData2.m_doubleSize = true; |
| pinData2.m_doubleSize = true; |
| pinData2.m_animate = true; |
| pinData2.m_animate = true; |
| this.m_pingPins.Add(pinData2); |
| this.m_pingPins.Add(pinData2); |
| } |
| } |
| } |
| } |
| if (this.m_pingPins.Count > 0) |
| if (this.m_pingPins.Count > 0) |
| { |
| { |
| this.m_pinUpdateRequired = true; |
| this.m_pinUpdateRequired = true; |
| } |
| } |
| for (int i = 0; i < this.m_tempShouts.Count; i++) |
| for (int i = 0; i < this.m_tempShouts.Count; i++) |
| { |
| { |
| Minimap.PinData pinData3 = this.m_pingPins[i]; |
| Minimap.PinData pinData3 = this.m_pingPins[i]; |
| Chat.WorldTextInstance worldTextInstance2 = this.m_tempShouts[i]; |
| Chat.WorldTextInstance worldTextInstance2 = this.m_tempShouts[i]; |
| pinData3.m_pos = worldTextInstance2.m_position; |
| pinData3.m_pos = worldTextInstance2.m_position; |
| pinData3.m_name = worldTextInstance2.m_name + ": " + worldTextInstance2.m_text; |
| pinData3.m_name = worldTextInstance2.m_name + ": " + worldTextInstance2.m_text; |
| } |
| } |
| } |
| } |
| |
| |
| private void UpdateShoutPins() |
| private void UpdateShoutPins() |
| { |
| { |
| this.m_tempShouts.Clear(); |
| this.m_tempShouts.Clear(); |
| Chat.instance.GetShoutWorldTexts(this.m_tempShouts); |
| Chat.instance.GetShoutWorldTexts(this.m_tempShouts); |
| if (this.m_shoutPins.Count != this.m_tempShouts.Count) |
| if (this.m_shoutPins.Count != this.m_tempShouts.Count) |
| { |
| { |
| foreach (Minimap.PinData pinData in this.m_shoutPins) |
| foreach (Minimap.PinData pinData in this.m_shoutPins) |
| { |
| { |
| this.RemovePin(pinData); |
| this.RemovePin(pinData); |
| } |
| } |
| this.m_shoutPins.Clear(); |
| this.m_shoutPins.Clear(); |
| foreach (Chat.WorldTextInstance worldTextInstance in this.m_tempShouts) |
| foreach (Chat.WorldTextInstance worldTextInstance in this.m_tempShouts) |
| { |
| { |
| Minimap.PinData pinData2 = this.AddPin(Vector3.zero, Minimap.PinType.Shout, worldTextInstance.m_name + ": " + worldTextInstance.m_text, false, false, 0L, ""); |
| Minimap.PinData pinData2 = this.AddPin(Vector3.zero, Minimap.PinType.Shout, worldTextInstance.m_name + ": " + worldTextInstance.m_text, false, false, 0L, ""); |
| pinData2.m_doubleSize = true; |
| pinData2.m_doubleSize = true; |
| pinData2.m_animate = true; |
| pinData2.m_animate = true; |
| this.m_shoutPins.Add(pinData2); |
| this.m_shoutPins.Add(pinData2); |
| } |
| } |
| } |
| } |
| if (this.m_shoutPins.Count > 0) |
| if (this.m_shoutPins.Count > 0) |
| { |
| { |
| this.m_pinUpdateRequired = true; |
| this.m_pinUpdateRequired = true; |
| } |
| } |
| for (int i = 0; i < this.m_tempShouts.Count; i++) |
| for (int i = 0; i < this.m_tempShouts.Count; i++) |
| { |
| { |
| Minimap.PinData pinData3 = this.m_shoutPins[i]; |
| Minimap.PinData pinData3 = this.m_shoutPins[i]; |
| Chat.WorldTextInstance worldTextInstance2 = this.m_tempShouts[i]; |
| Chat.WorldTextInstance worldTextInstance2 = this.m_tempShouts[i]; |
| pinData3.m_pos = worldTextInstance2.m_position; |
| pinData3.m_pos = worldTextInstance2.m_position; |
| pinData3.m_name = worldTextInstance2.m_name + ": " + worldTextInstance2.m_text; |
| pinData3.m_name = worldTextInstance2.m_name + ": " + worldTextInstance2.m_text; |
| } |
| } |
| } |
| } |
| |
| |
| private void UpdatePins() |
| private void UpdatePins() |
| { |
| { |
| RawImage rawImage = ((this.m_mode == Minimap.MapMode.Large) ? this.m_mapImageLarge : this.m_mapImageSmall); |
| RawImage rawImage = ((this.m_mode == Minimap.MapMode.Large) ? this.m_mapImageLarge : this.m_mapImageSmall); |
| Rect uvRect = rawImage.uvRect; |
| Rect uvRect = rawImage.uvRect; |
| Rect rect = rawImage.rectTransform.rect; |
| Rect rect = rawImage.rectTransform.rect; |
| float num = ((this.m_mode == Minimap.MapMode.Large) ? this.m_pinSizeLarge : this.m_pinSizeSmall); |
| float num = ((this.m_mode == Minimap.MapMode.Large) ? this.m_pinSizeLarge : this.m_pinSizeSmall); |
| if (this.m_mode != Minimap.MapMode.Large) |
| if (this.m_mode != Minimap.MapMode.Large) |
| { |
| { |
| float smallZoom = this.m_smallZoom; |
| float smallZoom = this.m_smallZoom; |
| } |
| } |
| else |
| else |
| { |
| { |
| float largeZoom = this.m_largeZoom; |
| float largeZoom = this.m_largeZoom; |
| } |
| } |
| Color color = new Color(0.7f, 0.7f, 0.7f, 0.8f * this.m_sharedMapDataFade); |
| Color color = new Color(0.7f, 0.7f, 0.7f, 0.8f * this.m_sharedMapDataFade); |
| foreach (Minimap.PinData pinData in this.m_pins) |
| foreach (Minimap.PinData pinData in this.m_pins) |
| { |
| { |
| RectTransform rectTransform = ((this.m_mode == Minimap.MapMode.Large) ? this.m_pinRootLarge : this.m_pinRootSmall); |
| RectTransform rectTransform = ((this.m_mode == Minimap.MapMode.Large) ? this.m_pinRootLarge : this.m_pinRootSmall); |
| RectTransform rectTransform2 = ((this.m_mode == Minimap.MapMode.Large) ? this.m_pinNameRootLarge : this.m_pinNameRootSmall); |
| RectTransform rectTransform2 = ((this.m_mode == Minimap.MapMode.Large) ? this.m_pinNameRootLarge : this.m_pinNameRootSmall); |
| if (!this.IsPointVisible(pinData.m_pos, rawImage) || !this.m_visibleIconTypes[(int)pinData.m_type] || (this.m_sharedMapDataFade <= 0f && pinData.m_ownerID != 0L)) |
| if (!this.IsPointVisible(pinData.m_pos, rawImage) || !this.m_visibleIconTypes[(int)pinData.m_type] || (this.m_sharedMapDataFade <= 0f && pinData.m_ownerID != 0L)) |
| { |
| { |
| this.DestroyPinMarker(pinData); |
| this.DestroyPinMarker(pinData); |
| } |
| } |
| else |
| else |
| { |
| { |
| if (pinData.m_uiElement == null || pinData.m_uiElement.parent != rectTransform) |
| if (pinData.m_uiElement == null || pinData.m_uiElement.parent != rectTransform) |
| { |
| { |
| this.DestroyPinMarker(pinData); |
| this.DestroyPinMarker(pinData); |
| GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.m_pinPrefab, rectTransform); |
| GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.m_pinPrefab, rectTransform); |
| pinData.m_iconElement = gameObject.GetComponent<Image>(); |
| pinData.m_iconElement = gameObject.GetComponent<Image>(); |
| pinData.m_iconElement.sprite = pinData.m_icon; |
| pinData.m_iconElement.sprite = pinData.m_icon; |
| pinData.m_uiElement = gameObject.transform as RectTransform; |
| pinData.m_uiElement = gameObject.transform as RectTransform; |
| float num2 = (pinData.m_doubleSize ? (num * 2f) : num); |
| float num2 = (pinData.m_doubleSize ? (num * 2f) : num); |
| pinData.m_uiElement.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, num2); |
| pinData.m_uiElement.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, num2); |
| pinData.m_uiElement.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, num2); |
| pinData.m_uiElement.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, num2); |
| pinData.m_checkedElement = gameObject.transform.Find("Checked").gameObject; |
| pinData.m_checkedElement = gameObject.transform.Find("Checked").gameObject; |
| } |
| } |
| if (pinData.m_NamePinData != null && pinData.m_NamePinData.PinNameGameObject == null) |
| if (pinData.m_NamePinData != null && pinData.m_NamePinData.PinNameGameObject == null) |
| { |
| { |
| this.CreateMapNamePin(pinData, rectTransform2); |
| this.CreateMapNamePin(pinData, rectTransform2); |
| } |
| } |
| if (pinData.m_ownerID != 0L && this.m_sharedMapHint != null) |
| if (pinData.m_ownerID != 0L && this.m_sharedMapHint != null) |
| { |
| { |
| this.m_sharedMapHint.gameObject.SetActive(true); |
| this.m_sharedMapHint.gameObject.SetActive(true); |
| } |
| } |
| Color color2 = ((pinData.m_ownerID != 0L) ? color : Color.white); |
| Color color2 = ((pinData.m_ownerID != 0L) ? color : Color.white); |
| pinData.m_iconElement.color = color2; |
| pinData.m_iconElement.color = color2; |
| if (pinData.m_NamePinData != null && pinData.m_NamePinData.PinNameText.color != color2) |
| if (pinData.m_NamePinData != null && pinData.m_NamePinData.PinNameText.color != color2) |
| { |
| { |
| pinData.m_NamePinData.PinNameText.color = color2; |
| pinData.m_NamePinData.PinNameText.color = color2; |
| } |
| } |
| float num3; |
| float num3; |
| float num4; |
| float num4; |
| this.WorldToMapPoint(pinData.m_pos, out num3, out num4); |
| this.WorldToMapPoint(pinData.m_pos, out num3, out num4); |
| Vector2 vector = this.MapPointToLocalGuiPos(num3, num4, uvRect, rect); |
| Vector2 vector = this.MapPointToLocalGuiPos(num3, num4, uvRect, rect); |
| pinData.m_uiElement.anchoredPosition = vector; |
| pinData.m_uiElement.anchoredPosition = vector; |
| if (pinData.m_NamePinData != null) |
| if (pinData.m_NamePinData != null) |
| { |
| { |
| pinData.m_NamePinData.PinNameRectTransform.anchoredPosition = vector; |
| pinData.m_NamePinData.PinNameRectTransform.anchoredPosition = vector; |
| } |
| } |
| if (pinData.m_animate) |
| if (pinData.m_animate) |
| { |
| { |
| float num5 = (pinData.m_doubleSize ? (num * 2f) : num); |
| float num5 = (pinData.m_doubleSize ? (num * 2f) : num); |
| num5 *= 0.8f + Mathf.Sin(Time.time * 5f) * 0.2f; |
| num5 *= 0.8f + Mathf.Sin(Time.time * 5f) * 0.2f; |
| pinData.m_uiElement.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, num5); |
| pinData.m_uiElement.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, num5); |
| pinData.m_uiElement.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, num5); |
| pinData.m_uiElement.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, num5); |
| } |
| } |
| if (pinData.m_worldSize > 0f) |
| if (pinData.m_worldSize > 0f) |
| { |
| { |
| Vector2 vector2 = new Vector2(pinData.m_worldSize / this.m_pixelSize / (float)this.m_textureSize, pinData.m_worldSize / this.m_pixelSize / (float)this.m_textureSize); |
| Vector2 vector2 = new Vector2(pinData.m_worldSize / this.m_pixelSize / (float)this.m_textureSize, pinData.m_worldSize / this.m_pixelSize / (float)this.m_textureSize); |
| Vector2 vector3 = this.MapSizeToLocalGuiSize(vector2, rawImage); |
| Vector2 vector3 = this.MapSizeToLocalGuiSize(vector2, rawImage); |
| pinData.m_uiElement.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, vector3.x); |
| pinData.m_uiElement.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, vector3.x); |
| pinData.m_uiElement.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, vector3.y); |
| pinData.m_uiElement.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, vector3.y); |
| } |
| } |
| if (pinData.m_checkedElement.activeInHierarchy != pinData.m_checked) |
| if (pinData.m_checkedElement.activeInHierarchy != pinData.m_checked) |
| { |
| { |
| pinData.m_checkedElement.SetActive(pinData.m_checked); |
| pinData.m_checkedElement.SetActive(pinData.m_checked); |
| } |
| } |
| if (pinData.m_name.Length > 0 && this.m_mode == Minimap.MapMode.Large && this.m_largeZoom < this.m_showNamesZoom && pinData.m_NamePinData != null) |
| if (pinData.m_name.Length > 0 && this.m_mode == Minimap.MapMode.Large && this.m_largeZoom < this.m_showNamesZoom && pinData.m_NamePinData != null) |
| { |
| { |
| pinData.m_NamePinData.PinNameGameObject.SetActive(true); |
| pinData.m_NamePinData.PinNameGameObject.SetActive(true); |
| } |
| } |
| else if (pinData.m_NamePinData != null) |
| else if (pinData.m_NamePinData != null) |
| { |
| { |
| pinData.m_NamePinData.PinNameGameObject.SetActive(false); |
| pinData.m_NamePinData.PinNameGameObject.SetActive(false); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| |
| private void DestroyPinMarker(Minimap.PinData pin) |
| private void DestroyPinMarker(Minimap.PinData pin) |
| { |
| { |
| if (pin.m_uiElement != null) |
| if (pin.m_uiElement != null) |
| { |
| { |
| UnityEngine.Object.Destroy(pin.m_uiElement.gameObject); |
| UnityEngine.Object.Destroy(pin.m_uiElement.gameObject); |
| pin.m_uiElement = null; |
| pin.m_uiElement = null; |
| } |
| } |
| if (pin.m_NamePinData != null) |
| if (pin.m_NamePinData != null) |
| { |
| { |
| pin.m_NamePinData.DestroyMapMarker(); |
| pin.m_NamePinData.DestroyMapMarker(); |
| } |
| } |
| } |
| } |
| |
| |
| private void UpdateWindMarker() |
| private void UpdateWindMarker() |
| { |
| { |
| Quaternion quaternion = Quaternion.LookRotation(EnvMan.instance.GetWindDir()); |
| Quaternion quaternion = Quaternion.LookRotation(EnvMan.instance.GetWindDir()); |
| this.m_windMarker.rotation = Quaternion.Euler(0f, 0f, -quaternion.eulerAngles.y); |
| this.m_windMarker.rotation = Quaternion.Euler(0f, 0f, -quaternion.eulerAngles.y); |
| } |
| } |
| |
| |
| private void UpdatePlayerMarker(Player player, Quaternion playerRot) |
| private void UpdatePlayerMarker(Player player, Quaternion playerRot) |
| { |
| { |
| Vector3 position = player.transform.position; |
| Vector3 position = player.transform.position; |
| Vector3 eulerAngles = playerRot.eulerAngles; |
| Vector3 eulerAngles = playerRot.eulerAngles; |
| this.m_smallMarker.rotation = Quaternion.Euler(0f, 0f, -eulerAngles.y); |
| this.m_smallMarker.rotation = Quaternion.Euler(0f, 0f, -eulerAngles.y); |
| if (this.m_mode == Minimap.MapMode.Large && this.IsPointVisible(position, this.m_mapImageLarge)) |
| if (this.m_mode == Minimap.MapMode.Large && this.IsPointVisible(position, this.m_mapImageLarge)) |
| { |
| { |
| this.m_largeMarker.gameObject.SetActive(true); |
| this.m_largeMarker.gameObject.SetActive(true); |
| this.m_largeMarker.rotation = this.m_smallMarker.rotation; |
| this.m_largeMarker.rotation = this.m_smallMarker.rotation; |
| float num; |
| float num; |
| float num2; |
| float num2; |
| this.WorldToMapPoint(position, out num, out num2); |
| this.WorldToMapPoint(position, out num, out num2); |
| Vector2 vector = this.MapPointToLocalGuiPos(num, num2, this.m_mapImageLarge); |
| Vector2 vector = this.MapPointToLocalGuiPos(num, num2, this.m_mapImageLarge); |
| this.m_largeMarker.anchoredPosition = vector; |
| this.m_largeMarker.anchoredPosition = vector; |
| } |
| } |
| else |
| else |
| { |
| { |
| this.m_largeMarker.gameObject.SetActive(false); |
| this.m_largeMarker.gameObject.SetActive(false); |
| } |
| } |
| Ship controlledShip = player.GetControlledShip(); |
| Ship controlledShip = player.GetControlledShip(); |
| if (controlledShip) |
| if (controlledShip) |
| { |
| { |
| this.m_smallShipMarker.gameObject.SetActive(true); |
| this.m_smallShipMarker.gameObject.SetActive(true); |
| Vector3 eulerAngles2 = controlledShip.transform.rotation.eulerAngles; |
| Vector3 eulerAngles2 = controlledShip.transform.rotation.eulerAngles; |
| this.m_smallShipMarker.rotation = Quaternion.Euler(0f, 0f, -eulerAngles2.y); |
| this.m_smallShipMarker.rotation = Quaternion.Euler(0f, 0f, -eulerAngles2.y); |
| if (this.m_mode == Minimap.MapMode.Large) |
| if (this.m_mode == Minimap.MapMode.Large) |
| { |
| { |
| this.m_largeShipMarker.gameObject.SetActive(true); |
| this.m_largeShipMarker.gameObject.SetActive(true); |
| Vector3 position2 = controlledShip.transform.position; |
| Vector3 position2 = controlledShip.transform.position; |
| float num3; |
| float num3; |
| float num4; |
| float num4; |
| this.WorldToMapPoint(position2, out num3, out num4); |
| this.WorldToMapPoint(position2, out num3, out num4); |
| Vector2 vector2 = this.MapPointToLocalGuiPos(num3, num4, this.m_mapImageLarge); |
| Vector2 vector2 = this.MapPointToLocalGuiPos(num3, num4, this.m_mapImageLarge); |
| this.m_largeShipMarker.anchoredPosition = vector2; |
| this.m_largeShipMarker.anchoredPosition = vector2; |
| this.m_largeShipMarker.rotation = this.m_smallShipMarker.rotation; |
| this.m_largeShipMarker.rotation = this.m_smallShipMarker.rotation; |
| return; |
| return; |
| } |
| } |
| } |
| } |
| else |
| else |
| { |
| { |
| this.m_smallShipMarker.gameObject.SetActive(false); |
| this.m_smallShipMarker.gameObject.SetActive(false); |
| this.m_largeShipMarker.gameObject.SetActive(false); |
| this.m_largeShipMarker.gameObject.SetActive(false); |
| } |
| } |
| } |
| } |
| |
| |
| private Vector2 MapPointToLocalGuiPos(float mx, float my, RawImage img) |
| private Vector2 MapPointToLocalGuiPos(float mx, float my, RawImage img) |
| { |
| { |
| return this.MapPointToLocalGuiPos(mx, my, img.uvRect, img.rectTransform.rect); |
| return this.MapPointToLocalGuiPos(mx, my, img.uvRect, img.rectTransform.rect); |
| } |
| } |
| |
| |
| private Vector2 MapPointToLocalGuiPos(float mx, float my, Rect uvRect, Rect transformRect) |
| private Vector2 MapPointToLocalGuiPos(float mx, float my, Rect uvRect, Rect transformRect) |
| { |
| { |
| Vector2 vector = default(Vector2); |
| Vector2 vector = default(Vector2); |
| vector.x = (mx - uvRect.xMin) / uvRect.width; |
| vector.x = (mx - uvRect.xMin) / uvRect.width; |
| vector.y = (my - uvRect.yMin) / uvRect.height; |
| vector.y = (my - uvRect.yMin) / uvRect.height; |
| vector.x *= transformRect.width; |
| vector.x *= transformRect.width; |
| vector.y *= transformRect.height; |
| vector.y *= transformRect.height; |
| return vector; |
| return vector; |
| } |
| } |
| |
| |
| private Vector2 MapSizeToLocalGuiSize(Vector2 size, RawImage img) |
| private Vector2 MapSizeToLocalGuiSize(Vector2 size, RawImage img) |
| { |
| { |
| size.x /= img.uvRect.width; |
| size.x /= img.uvRect.width; |
| size.y /= img.uvRect.height; |
| size.y /= img.uvRect.height; |
| return new Vector2(size.x * img.rectTransform.rect.width, size.y * img.rectTransform.rect.height); |
| return new Vector2(size.x * img.rectTransform.rect.width, size.y * img.rectTransform.rect.height); |
| } |
| } |
| |
| |
| private bool IsPointVisible(Vector3 p, RawImage map) |
| private bool IsPointVisible(Vector3 p, RawImage map) |
| { |
| { |
| float num; |
| float num; |
| float num2; |
| float num2; |
| this.WorldToMapPoint(p, out num, out num2); |
| this.WorldToMapPoint(p, out num, out num2); |
| return num > map.uvRect.xMin && num < map.uvRect.xMax && num2 > map.uvRect.yMin && num2 < map.uvRect.yMax; |
| return num > map.uvRect.xMin && num < map.uvRect.xMax && num2 > map.uvRect.yMin && num2 < map.uvRect.yMax; |
| } |
| } |
| |
| |
| public void ExploreAll() |
| public void ExploreAll() |
| { |
| { |
| for (int i = 0; i < this.m_textureSize; i++) |
| for (int i = 0; i < this.m_textureSize; i++) |
| { |
| { |
| for (int j = 0; j < this.m_textureSize; j++) |
| for (int j = 0; j < this.m_textureSize; j++) |
| { |
| { |
| this.Explore(j, i); |
| this.Explore(j, i); |
| } |
| } |
| } |
| } |
| this.m_fogTexture.Apply(); |
| this.m_fogTexture.Apply(); |
| } |
| } |
| |
| |
| private void WorldToMapPoint(Vector3 p, out float mx, out float my) |
| private void WorldToMapPoint(Vector3 p, out float mx, out float my) |
| { |
| { |
| int num = this.m_textureSize / 2; |
| int num = this.m_textureSize / 2; |
| mx = p.x / this.m_pixelSize + (float)num; |
| mx = p.x / this.m_pixelSize + (float)num; |
| my = p.z / this.m_pixelSize + (float)num; |
| my = p.z / this.m_pixelSize + (float)num; |
| mx /= (float)this.m_textureSize; |
| mx /= (float)this.m_textureSize; |
| my /= (float)this.m_textureSize; |
| my /= (float)this.m_textureSize; |
| } |
| } |
| |
| |
| private Vector3 MapPointToWorld(float mx, float my) |
| private Vector3 MapPointToWorld(float mx, float my) |
| { |
| { |
| int num = this.m_textureSize / 2; |
| int num = this.m_textureSize / 2; |
| mx *= (float)this.m_textureSize; |
| mx *= (float)this.m_textureSize; |
| my *= (float)this.m_textureSize; |
| my *= (float)this.m_textureSize; |
| mx -= (float)num; |
| mx -= (float)num; |
| my -= (float)num; |
| my -= (float)num; |
| mx *= this.m_pixelSize; |
| mx *= this.m_pixelSize; |
| my *= this.m_pixelSize; |
| my *= this.m_pixelSize; |
| return new Vector3(mx, 0f, my); |
| return new Vector3(mx, 0f, my); |
| } |
| } |
| |
| |
| private void WorldToPixel(Vector3 p, out int px, out int py) |
| private void WorldToPixel(Vector3 p, out int px, out int py) |
| { |
| { |
| int num = this.m_textureSize / 2; |
| int num = this.m_textureSize / 2; |
| px = Mathf.RoundToInt(p.x / this.m_pixelSize + (float)num); |
| px = Mathf.RoundToInt(p.x / this.m_pixelSize + (float)num); |
| py = Mathf.RoundToInt(p.z / this.m_pixelSize + (float)num); |
| py = Mathf.RoundToInt(p.z / this.m_pixelSize + (float)num); |
| } |
| } |
| |
| |
| private void UpdateExplore(float dt, Player player) |
| private void UpdateExplore(float dt, Player player) |
| { |
| { |
| this.m_exploreTimer += Time.deltaTime; |
| this.m_exploreTimer += Time.deltaTime; |
| if (this.m_exploreTimer > this.m_exploreInterval) |
| if (this.m_exploreTimer > this.m_exploreInterval) |
| { |
| { |
| this.m_exploreTimer = 0f; |
| this.m_exploreTimer = 0f; |
| this.Explore(player.transform.position, this.m_exploreRadius); |
| this.Explore(player.transform.position, this.m_exploreRadius); |
| } |
| } |
| } |
| } |
| |
| |
| private void Explore(Vector3 p, float radius) |
| private void Explore(Vector3 p, float radius) |
| { |
| { |
| int num = (int)Mathf.Ceil(radius / this.m_pixelSize); |
| int num = (int)Mathf.Ceil(radius / this.m_pixelSize); |
| bool flag = false; |
| bool flag = false; |
| int num2; |
| int num2; |
| int num3; |
| int num3; |
| this.WorldToPixel(p, out num2, out num3); |
| this.WorldToPixel(p, out num2, out num3); |
| for (int i = num3 - num; i <= num3 + num; i++) |
| for (int i = num3 - num; i <= num3 + num; i++) |
| { |
| { |
| for (int j = num2 - num; j <= num2 + num; j++) |
| for (int j = num2 - num; j <= num2 + num; j++) |
| { |
| { |
| if (j >= 0 && i >= 0 && j < this.m_textureSize && i < this.m_textureSize && new Vector2((float)(j - num2), (float)(i - num3)).magnitude <= (float)num && this.Explore(j, i)) |
| if (j >= 0 && i >= 0 && j < this.m_textureSize && i < this.m_textureSize && new Vector2((float)(j - num2), (float)(i - num3)).magnitude <= (float)num && this.Explore(j, i)) |
| { |
| { |
| flag = true; |
| flag = true; |
| } |
| } |
| } |
| } |
| } |
| } |
| if (flag) |
| if (flag) |
| { |
| { |
| this.m_fogTexture.Apply(); |
| this.m_fogTexture.Apply(); |
| } |
| } |
| } |
| } |
| |
| |
| private bool Explore(int x, int y) |
| private bool Explore(int x, int y) |
| { |
| { |
| if (this.m_explored[y * this.m_textureSize + x]) |
| if (this.m_explored[y * this.m_textureSize + x]) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| Color pixel = this.m_fogTexture.GetPixel(x, y); |
| Color pixel = this.m_fogTexture.GetPixel(x, y); |
| pixel.r = 0f; |
| pixel.r = 0f; |
| this.m_fogTexture.SetPixel(x, y, pixel); |
| this.m_fogTexture.SetPixel(x, y, pixel); |
| this.m_explored[y * this.m_textureSize + x] = true; |
| this.m_explored[y * this.m_textureSize + x] = true; |
| return true; |
| return true; |
| } |
| } |
| |
| |
| private void ResetAndExplore(byte[] explored, byte[] exploredOthers) |
| private void ResetAndExplore(byte[] explored, byte[] exploredOthers) |
| { |
| { |
| this.m_sharedMapHint.gameObject.SetActive(false); |
| this.m_sharedMapHint.gameObject.SetActive(false); |
| int num = explored.Length; |
| int num = explored.Length; |
| Color[] pixels = this.m_fogTexture.GetPixels(); |
| Color[] pixels = this.m_fogTexture.GetPixels(); |
| if (num != pixels.Length || num != exploredOthers.Length) |
| if (num != pixels.Length || num != exploredOthers.Length) |
| { |
| { |
| ZLog.LogError("Dimension mismatch for exploring mipmap"); |
| ZLog.LogError("Dimension mismatch for exploring mipmap"); |
| return; |
| return; |
| } |
| } |
| for (int i = 0; i < num; i++) |
| for (int i = 0; i < num; i++) |
| { |
| { |
| pixels[i] = Color.white; |
| pixels[i] = Color.white; |
| if (explored[i] != 0) |
| if (explored[i] != 0) |
| { |
| { |
| pixels[i].r = 0f; |
| pixels[i].r = 0f; |
| this.m_explored[i] = true; |
| this.m_explored[i] = true; |
| } |
| } |
| else |
| else |
| { |
| { |
| this.m_explored[i] = false; |
| this.m_explored[i] = false; |
| } |
| } |
| if (exploredOthers[i] != 0) |
| if (exploredOthers[i] != 0) |
| { |
| { |
| pixels[i].g = 0f; |
| pixels[i].g = 0f; |
| this.m_exploredOthers[i] = true; |
| this.m_exploredOthers[i] = true; |
| } |
| } |
| else |
| else |
| { |
| { |
| this.m_exploredOthers[i] = false; |
| this.m_exploredOthers[i] = false; |
| } |
| } |
| } |
| } |
| this.m_fogTexture.SetPixels(pixels); |
| this.m_fogTexture.SetPixels(pixels); |
| } |
| } |
| |
| |
| private bool ExploreOthers(int x, int y) |
| private bool ExploreOthers(int x, int y) |
| { |
| { |
| if (this.m_exploredOthers[y * this.m_textureSize + x]) |
| if (this.m_exploredOthers[y * this.m_textureSize + x]) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| Color pixel = this.m_fogTexture.GetPixel(x, y); |
| Color pixel = this.m_fogTexture.GetPixel(x, y); |
| pixel.g = 0f; |
| pixel.g = 0f; |
| this.m_fogTexture.SetPixel(x, y, pixel); |
| this.m_fogTexture.SetPixel(x, y, pixel); |
| this.m_exploredOthers[y * this.m_textureSize + x] = true; |
| this.m_exploredOthers[y * this.m_textureSize + x] = true; |
| if (this.m_sharedMapHint != null) |
| if (this.m_sharedMapHint != null) |
| { |
| { |
| this.m_sharedMapHint.gameObject.SetActive(true); |
| this.m_sharedMapHint.gameObject.SetActive(true); |
| } |
| } |
| return true; |
| return true; |
| } |
| } |
| |
| |
| private bool IsExplored(Vector3 worldPos) |
| private bool IsExplored(Vector3 worldPos) |
| { |
| { |
| int num; |
| int num; |
| int num2; |
| int num2; |
| this.WorldToPixel(worldPos, out num, out num2); |
| this.WorldToPixel(worldPos, out num, out num2); |
| return num >= 0 && num < this.m_textureSize && num2 >= 0 && num2 < this.m_textureSize && (this.m_explored[num2 * this.m_textureSize + num] || this.m_exploredOthers[num2 * this.m_textureSize + num]); |
| return num >= 0 && num < this.m_textureSize && num2 >= 0 && num2 < this.m_textureSize && (this.m_explored[num2 * this.m_textureSize + num] || this.m_exploredOthers[num2 * this.m_textureSize + num]); |
| } |
| } |
| |
| |
| private float GetHeight(int x, int y) |
| private float GetHeight(int x, int y) |
| { |
| { |
| return this.m_heightTexture.GetPixel(x, y).r; |
| return this.m_heightTexture.GetPixel(x, y).r; |
| } |
| } |
| |
| |
| private void GenerateWorldMap() |
| private void GenerateWorldMap() |
| { |
| { |
| Stopwatch stopwatch = Stopwatch.StartNew(); |
| Stopwatch stopwatch = Stopwatch.StartNew(); |
| Minimap.DeleteMapTextureData(ZNet.World.m_name); |
| Minimap.DeleteMapTextureData(ZNet.World.m_name); |
| int num = this.m_textureSize / 2; |
| int num = this.m_textureSize / 2; |
| float num2 = this.m_pixelSize / 2f; |
| float num2 = this.m_pixelSize / 2f; |
| Color32[] array = new Color32[this.m_textureSize * this.m_textureSize]; |
| Color32[] array = new Color32[this.m_textureSize * this.m_textureSize]; |
| Color32[] array2 = new Color32[this.m_textureSize * this.m_textureSize]; |
| Color32[] array2 = new Color32[this.m_textureSize * this.m_textureSize]; |
| Color[] array3 = new Color[this.m_textureSize * this.m_textureSize]; |
| Color[] array3 = new Color[this.m_textureSize * this.m_textureSize]; |
| Color32[] array4 = new Color32[this.m_textureSize * this.m_textureSize]; |
| Color32[] array4 = new Color32[this.m_textureSize * this.m_textureSize]; |
| float num3 = 127.5f; |
| float num3 = 127.5f; |
| for (int i = 0; i < this.m_textureSize; i++) |
| for (int i = 0; i < this.m_textureSize; i++) |
| { |
| { |
| for (int j = 0; j < this.m_textureSize; j++) |
| for (int j = 0; j < this.m_textureSize; j++) |
| { |
| { |
| float num4 = (float)(j - num) * this.m_pixelSize + num2; |
| float num4 = (float)(j - num) * this.m_pixelSize + num2; |
| float num5 = (float)(i - num) * this.m_pixelSize + num2; |
| float num5 = (float)(i - num) * this.m_pixelSize + num2; |
| . | Heightmap.Biome biome = WorldGenerator.instance.GetBiome(num4, num5); |
| Heightmap.Biome biome = WorldGenerator.instance.GetBiome(num4, num5, 0.02f, false); |
| Color color; |
| Color color; |
| float biomeHeight = WorldGenerator.instance.GetBiomeHeight(biome, num4, num5, out color, false); |
| float biomeHeight = WorldGenerator.instance.GetBiomeHeight(biome, num4, num5, out color, false); |
| array[i * this.m_textureSize + j] = this.GetPixelColor(biome); |
| array[i * this.m_textureSize + j] = this.GetPixelColor(biome); |
| array2[i * this.m_textureSize + j] = this.GetMaskColor(num4, num5, biomeHeight, biome); |
| array2[i * this.m_textureSize + j] = this.GetMaskColor(num4, num5, biomeHeight, biome); |
| array3[i * this.m_textureSize + j].r = biomeHeight; |
| array3[i * this.m_textureSize + j].r = biomeHeight; |
| int num6 = Mathf.Clamp((int)(biomeHeight * num3), 0, 65025); |
| int num6 = Mathf.Clamp((int)(biomeHeight * num3), 0, 65025); |
| byte b = (byte)(num6 >> 8); |
| byte b = (byte)(num6 >> 8); |
| byte b2 = (byte)(num6 & 255); |
| byte b2 = (byte)(num6 & 255); |
| array4[i * this.m_textureSize + j] = new Color32(b, b2, 0, byte.MaxValue); |
| array4[i * this.m_textureSize + j] = new Color32(b, b2, 0, byte.MaxValue); |
| } |
| } |
| } |
| } |
| this.m_forestMaskTexture.SetPixels32(array2); |
| this.m_forestMaskTexture.SetPixels32(array2); |
| this.m_forestMaskTexture.Apply(); |
| this.m_forestMaskTexture.Apply(); |
| this.m_mapTexture.SetPixels32(array); |
| this.m_mapTexture.SetPixels32(array); |
| this.m_mapTexture.Apply(); |
| this.m_mapTexture.Apply(); |
| this.m_heightTexture.SetPixels(array3); |
| this.m_heightTexture.SetPixels(array3); |
| this.m_heightTexture.Apply(); |
| this.m_heightTexture.Apply(); |
| Texture2D texture2D = new Texture2D(this.m_textureSize, this.m_textureSize); |
| Texture2D texture2D = new Texture2D(this.m_textureSize, this.m_textureSize); |
| texture2D.SetPixels32(array4); |
| texture2D.SetPixels32(array4); |
| texture2D.Apply(); |
| texture2D.Apply(); |
| ZLog.Log("Generating new world minimap done [" + stopwatch.ElapsedMilliseconds.ToString() + "ms]"); |
| ZLog.Log("Generating new world minimap done [" + stopwatch.ElapsedMilliseconds.ToString() + "ms]"); |
| this.SaveMapTextureDataToDisk(this.m_forestMaskTexture, this.m_mapTexture, texture2D); |
| this.SaveMapTextureDataToDisk(this.m_forestMaskTexture, this.m_mapTexture, texture2D); |
| } |
| } |
| |
| |
| public static void DeleteMapTextureData(string worldName) |
| public static void DeleteMapTextureData(string worldName) |
| { |
| { |
| string text = World.GetWorldSavePath(FileHelpers.FileSource.Local) + "/" + worldName; |
| string text = World.GetWorldSavePath(FileHelpers.FileSource.Local) + "/" + worldName; |
| string completeTexturePath = Minimap.GetCompleteTexturePath(text, "forestMaskTexCache"); |
| string completeTexturePath = Minimap.GetCompleteTexturePath(text, "forestMaskTexCache"); |
| string completeTexturePath2 = Minimap.GetCompleteTexturePath(text, "mapTexCache"); |
| string completeTexturePath2 = Minimap.GetCompleteTexturePath(text, "mapTexCache"); |
| string completeTexturePath3 = Minimap.GetCompleteTexturePath(text, "heightTexCache"); |
| string completeTexturePath3 = Minimap.GetCompleteTexturePath(text, "heightTexCache"); |
| if (File.Exists(completeTexturePath)) |
| if (File.Exists(completeTexturePath)) |
| { |
| { |
| File.Delete(completeTexturePath); |
| File.Delete(completeTexturePath); |
| } |
| } |
| if (File.Exists(completeTexturePath2)) |
| if (File.Exists(completeTexturePath2)) |
| { |
| { |
| File.Delete(completeTexturePath2); |
| File.Delete(completeTexturePath2); |
| } |
| } |
| if (File.Exists(completeTexturePath3)) |
| if (File.Exists(completeTexturePath3)) |
| { |
| { |
| File.Delete(completeTexturePath3); |
| File.Delete(completeTexturePath3); |
| } |
| } |
| } |
| } |
| |
| |
| private static string GetCompleteTexturePath(string rootPath, string maskTextureName) |
| private static string GetCompleteTexturePath(string rootPath, string maskTextureName) |
| { |
| { |
| return rootPath + "_" + maskTextureName; |
| return rootPath + "_" + maskTextureName; |
| } |
| } |
| |
| |
| private void SaveMapTextureDataToDisk(Texture2D forestMaskTexture, Texture2D mapTexture, Texture2D heightTexture) |
| private void SaveMapTextureDataToDisk(Texture2D forestMaskTexture, Texture2D mapTexture, Texture2D heightTexture) |
| { |
| { |
| if (string.IsNullOrEmpty(this.m_forestMaskTexturePath)) |
| if (string.IsNullOrEmpty(this.m_forestMaskTexturePath)) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| File.WriteAllBytes(this.m_forestMaskTexturePath, forestMaskTexture.EncodeToPNG()); |
| File.WriteAllBytes(this.m_forestMaskTexturePath, forestMaskTexture.EncodeToPNG()); |
| File.WriteAllBytes(this.m_mapTexturePath, mapTexture.EncodeToPNG()); |
| File.WriteAllBytes(this.m_mapTexturePath, mapTexture.EncodeToPNG()); |
| File.WriteAllBytes(this.m_heightTexturePath, heightTexture.EncodeToPNG()); |
| File.WriteAllBytes(this.m_heightTexturePath, heightTexture.EncodeToPNG()); |
| } |
| } |
| |
| |
| private Color GetMaskColor(float wx, float wy, float height, Heightmap.Biome biome) |
| private Color GetMaskColor(float wx, float wy, float height, Heightmap.Biome biome) |
| { |
| { |
| . | if (height < ZoneSystem.instance.m_waterLevel) |
| Color color = new Color(0f, 0f, 0f, 0f); |
| |
| if (height < 30f) |
| { |
| { |
| . | return this.noForest; |
| color.b = Mathf.Clamp01(WorldGenerator.GetAshlandsOceanGradient(wx, wy)); |
| |
| return color; |
| } |
| } |
| if (biome == Heightmap.Biome.Meadows) |
| if (biome == Heightmap.Biome.Meadows) |
| { |
| { |
| . | if (!WorldGenerator.InForest(new Vector3(wx, 0f, wy))) |
| color.r = (float)(WorldGenerator.InForest(new Vector3(wx, 0f, wy)) ? 1 : 0); |
| { |
| |
| return this.noForest; |
| |
| } |
| |
| return this.forest; |
| |
| } |
| } |
| else if (biome == Heightmap.Biome.Plains) |
| else if (biome == Heightmap.Biome.Plains) |
| { |
| { |
| . | if (WorldGenerator.GetForestFactor(new Vector3(wx, 0f, wy)) >= 0.8f) |
| color.r = (float)((WorldGenerator.GetForestFactor(new Vector3(wx, 0f, wy)) < 0.8f) ? 1 : 0); |
| { |
| |
| return this.noForest; |
| |
| } |
| |
| return this.forest; |
| |
| } |
| } |
| . | else |
| else if (biome == Heightmap.Biome.BlackForest) |
| { |
| { |
| . | if (biome == Heightmap.Biome.BlackForest) |
| color.r = 1f; |
| { |
| } |
| return this.forest; |
| else if (biome == Heightmap.Biome.Mistlands) |
| } |
| { |
| if (biome == Heightmap.Biome.Mistlands) |
| float forestFactor = WorldGenerator.GetForestFactor(new Vector3(wx, 0f, wy)); |
| { |
| color.g = 1f - Utils.SmoothStep(1.1f, 1.3f, forestFactor); |
| float forestFactor = WorldGenerator.GetForestFactor(new Vector3(wx, 0f, wy)); |
| } |
| return new Color(0f, 1f - Utils.SmoothStep(1.1f, 1.3f, forestFactor), 0f, 0f); |
| else if (biome == Heightmap.Biome.AshLands) |
| } |
| { |
| return this.noForest; |
| Color color2; |
| |
| WorldGenerator.instance.GetAshlandsHeight(wx, wy, out color2, true); |
| |
| color.b = color2.a; |
| } |
| } |
| . | |
| return color; |
| } |
| } |
| |
| |
| private Color GetPixelColor(Heightmap.Biome biome) |
| private Color GetPixelColor(Heightmap.Biome biome) |
| { |
| { |
| if (biome <= Heightmap.Biome.Plains) |
| if (biome <= Heightmap.Biome.Plains) |
| { |
| { |
| switch (biome) |
| switch (biome) |
| { |
| { |
| case Heightmap.Biome.Meadows: |
| case Heightmap.Biome.Meadows: |
| return this.m_meadowsColor; |
| return this.m_meadowsColor; |
| case Heightmap.Biome.Swamp: |
| case Heightmap.Biome.Swamp: |
| return this.m_swampColor; |
| return this.m_swampColor; |
| case Heightmap.Biome.Meadows | Heightmap.Biome.Swamp: |
| case Heightmap.Biome.Meadows | Heightmap.Biome.Swamp: |
| break; |
| break; |
| case Heightmap.Biome.Mountain: |
| case Heightmap.Biome.Mountain: |
| return this.m_mountainColor; |
| return this.m_mountainColor; |
| default: |
| default: |
| if (biome == Heightmap.Biome.BlackForest) |
| if (biome == Heightmap.Biome.BlackForest) |
| { |
| { |
| return this.m_blackforestColor; |
| return this.m_blackforestColor; |
| } |
| } |
| if (biome == Heightmap.Biome.Plains) |
| if (biome == Heightmap.Biome.Plains) |
| { |
| { |
| return this.m_heathColor; |
| return this.m_heathColor; |
| } |
| } |
| break; |
| break; |
| } |
| } |
| } |
| } |
| else if (biome <= Heightmap.Biome.DeepNorth) |
| else if (biome <= Heightmap.Biome.DeepNorth) |
| { |
| { |
| if (biome == Heightmap.Biome.AshLands) |
| if (biome == Heightmap.Biome.AshLands) |
| { |
| { |
| return this.m_ashlandsColor; |
| return this.m_ashlandsColor; |
| } |
| } |
| if (biome == Heightmap.Biome.DeepNorth) |
| if (biome == Heightmap.Biome.DeepNorth) |
| { |
| { |
| return this.m_deepnorthColor; |
| return this.m_deepnorthColor; |
| } |
| } |
| } |
| } |
| else |
| else |
| { |
| { |
| if (biome == Heightmap.Biome.Ocean) |
| if (biome == Heightmap.Biome.Ocean) |
| { |
| { |
| return Color.white; |
| return Color.white; |
| } |
| } |
| if (biome == Heightmap.Biome.Mistlands) |
| if (biome == Heightmap.Biome.Mistlands) |
| { |
| { |
| return this.m_mistlandsColor; |
| return this.m_mistlandsColor; |
| } |
| } |
| } |
| } |
| return Color.white; |
| return Color.white; |
| } |
| } |
| |
| |
| private void LoadMapData() |
| private void LoadMapData() |
| { |
| { |
| PlayerProfile playerProfile = Game.instance.GetPlayerProfile(); |
| PlayerProfile playerProfile = Game.instance.GetPlayerProfile(); |
| if (playerProfile.GetMapData() != null) |
| if (playerProfile.GetMapData() != null) |
| { |
| { |
| this.SetMapData(playerProfile.GetMapData()); |
| this.SetMapData(playerProfile.GetMapData()); |
| } |
| } |
| } |
| } |
| |
| |
| public void SaveMapData() |
| public void SaveMapData() |
| { |
| { |
| Game.instance.GetPlayerProfile().SetMapData(this.GetMapData()); |
| Game.instance.GetPlayerProfile().SetMapData(this.GetMapData()); |
| } |
| } |
| |
| |
| private byte[] GetMapData() |
| private byte[] GetMapData() |
| { |
| { |
| ZPackage zpackage = new ZPackage(); |
| ZPackage zpackage = new ZPackage(); |
| zpackage.Write(Minimap.MAPVERSION); |
| zpackage.Write(Minimap.MAPVERSION); |
| ZPackage zpackage2 = new ZPackage(); |
| ZPackage zpackage2 = new ZPackage(); |
| zpackage2.Write(this.m_textureSize); |
| zpackage2.Write(this.m_textureSize); |
| for (int i = 0; i < this.m_explored.Length; i++) |
| for (int i = 0; i < this.m_explored.Length; i++) |
| { |
| { |
| zpackage2.Write(this.m_explored[i]); |
| zpackage2.Write(this.m_explored[i]); |
| } |
| } |
| for (int j = 0; j < this.m_explored.Length; j++) |
| for (int j = 0; j < this.m_explored.Length; j++) |
| { |
| { |
| zpackage2.Write(this.m_exploredOthers[j]); |
| zpackage2.Write(this.m_exploredOthers[j]); |
| } |
| } |
| int num = 0; |
| int num = 0; |
| using (List<Minimap.PinData>.Enumerator enumerator = this.m_pins.GetEnumerator()) |
| using (List<Minimap.PinData>.Enumerator enumerator = this.m_pins.GetEnumerator()) |
| { |
| { |
| while (enumerator.MoveNext()) |
| while (enumerator.MoveNext()) |
| { |
| { |
| if (enumerator.Current.m_save) |
| if (enumerator.Current.m_save) |
| { |
| { |
| num++; |
| num++; |
| } |
| } |
| } |
| } |
| } |
| } |
| zpackage2.Write(num); |
| zpackage2.Write(num); |
| foreach (Minimap.PinData pinData in this.m_pins) |
| foreach (Minimap.PinData pinData in this.m_pins) |
| { |
| { |
| if (pinData.m_save) |
| if (pinData.m_save) |
| { |
| { |
| zpackage2.Write(pinData.m_name); |
| zpackage2.Write(pinData.m_name); |
| zpackage2.Write(pinData.m_pos); |
| zpackage2.Write(pinData.m_pos); |
| zpackage2.Write((int)pinData.m_type); |
| zpackage2.Write((int)pinData.m_type); |
| zpackage2.Write(pinData.m_checked); |
| zpackage2.Write(pinData.m_checked); |
| zpackage2.Write(pinData.m_ownerID); |
| zpackage2.Write(pinData.m_ownerID); |
| zpackage2.Write(pinData.m_author); |
| zpackage2.Write(pinData.m_author); |
| } |
| } |
| } |
| } |
| zpackage2.Write(ZNet.instance.IsReferencePositionPublic()); |
| zpackage2.Write(ZNet.instance.IsReferencePositionPublic()); |
| int num2 = zpackage2.Size(); |
| int num2 = zpackage2.Size(); |
| zpackage.WriteCompressed(zpackage2); |
| zpackage.WriteCompressed(zpackage2); |
| ZLog.Log(string.Concat(new string[] |
| ZLog.Log(string.Concat(new string[] |
| { |
| { |
| "Minimap: compressed mapData ", |
| "Minimap: compressed mapData ", |
| num2.ToString(), |
| num2.ToString(), |
| " => ", |
| " => ", |
| zpackage.Size().ToString(), |
| zpackage.Size().ToString(), |
| " bytes" |
| " bytes" |
| })); |
| })); |
| return zpackage.GetArray(); |
| return zpackage.GetArray(); |
| } |
| } |
| |
| |
| private void SetMapData(byte[] data) |
| private void SetMapData(byte[] data) |
| { |
| { |
| ZPackage zpackage = new ZPackage(data); |
| ZPackage zpackage = new ZPackage(data); |
| int num = zpackage.ReadInt(); |
| int num = zpackage.ReadInt(); |
| if (num >= 7) |
| if (num >= 7) |
| { |
| { |
| int num2 = zpackage.Size(); |
| int num2 = zpackage.Size(); |
| zpackage = zpackage.ReadCompressedPackage(); |
| zpackage = zpackage.ReadCompressedPackage(); |
| ZLog.Log(string.Concat(new string[] |
| ZLog.Log(string.Concat(new string[] |
| { |
| { |
| "Minimap: unpacking compressed mapData ", |
| "Minimap: unpacking compressed mapData ", |
| num2.ToString(), |
| num2.ToString(), |
| " => ", |
| " => ", |
| zpackage.Size().ToString(), |
| zpackage.Size().ToString(), |
| " bytes" |
| " bytes" |
| })); |
| })); |
| } |
| } |
| int num3 = zpackage.ReadInt(); |
| int num3 = zpackage.ReadInt(); |
| if (this.m_textureSize != num3) |
| if (this.m_textureSize != num3) |
| { |
| { |
| string text = "Missmatching mapsize "; |
| string text = "Missmatching mapsize "; |
| Texture2D mapTexture = this.m_mapTexture; |
| Texture2D mapTexture = this.m_mapTexture; |
| ZLog.LogWarning(text + ((mapTexture != null) ? mapTexture.ToString() : null) + " vs " + num3.ToString()); |
| ZLog.LogWarning(text + ((mapTexture != null) ? mapTexture.ToString() : null) + " vs " + num3.ToString()); |
| return; |
| return; |
| } |
| } |
| if (num >= 5) |
| if (num >= 5) |
| { |
| { |
| byte[] array = zpackage.ReadByteArray(this.m_explored.Length); |
| byte[] array = zpackage.ReadByteArray(this.m_explored.Length); |
| byte[] array2 = zpackage.ReadByteArray(this.m_exploredOthers.Length); |
| byte[] array2 = zpackage.ReadByteArray(this.m_exploredOthers.Length); |
| this.ResetAndExplore(array, array2); |
| this.ResetAndExplore(array, array2); |
| } |
| } |
| else |
| else |
| { |
| { |
| this.Reset(); |
| this.Reset(); |
| for (int i = 0; i < this.m_explored.Length; i++) |
| for (int i = 0; i < this.m_explored.Length; i++) |
| { |
| { |
| if (zpackage.ReadBool()) |
| if (zpackage.ReadBool()) |
| { |
| { |
| int num4 = i % num3; |
| int num4 = i % num3; |
| int num5 = i / num3; |
| int num5 = i / num3; |
| this.Explore(num4, num5); |
| this.Explore(num4, num5); |
| } |
| } |
| } |
| } |
| } |
| } |
| if (num >= 2) |
| if (num >= 2) |
| { |
| { |
| int num6 = zpackage.ReadInt(); |
| int num6 = zpackage.ReadInt(); |
| this.ClearPins(); |
| this.ClearPins(); |
| for (int j = 0; j < num6; j++) |
| for (int j = 0; j < num6; j++) |
| { |
| { |
| string text2 = zpackage.ReadString(); |
| string text2 = zpackage.ReadString(); |
| Vector3 vector = zpackage.ReadVector3(); |
| Vector3 vector = zpackage.ReadVector3(); |
| Minimap.PinType pinType = (Minimap.PinType)zpackage.ReadInt(); |
| Minimap.PinType pinType = (Minimap.PinType)zpackage.ReadInt(); |
| bool flag = num >= 3 && zpackage.ReadBool(); |
| bool flag = num >= 3 && zpackage.ReadBool(); |
| long num7 = ((num >= 6) ? zpackage.ReadLong() : 0L); |
| long num7 = ((num >= 6) ? zpackage.ReadLong() : 0L); |
| string text3 = ((num >= 8) ? zpackage.ReadString() : ""); |
| string text3 = ((num >= 8) ? zpackage.ReadString() : ""); |
| this.AddPin(vector, pinType, text2, true, flag, num7, text3); |
| this.AddPin(vector, pinType, text2, true, flag, num7, text3); |
| } |
| } |
| } |
| } |
| if (num >= 4) |
| if (num >= 4) |
| { |
| { |
| bool flag2 = zpackage.ReadBool(); |
| bool flag2 = zpackage.ReadBool(); |
| ZNet.instance.SetPublicReferencePosition(flag2); |
| ZNet.instance.SetPublicReferencePosition(flag2); |
| } |
| } |
| this.m_fogTexture.Apply(); |
| this.m_fogTexture.Apply(); |
| } |
| } |
| |
| |
| public bool RemovePin(Vector3 pos, float radius) |
| public bool RemovePin(Vector3 pos, float radius) |
| { |
| { |
| Minimap.PinData closestPin = this.GetClosestPin(pos, radius, true); |
| Minimap.PinData closestPin = this.GetClosestPin(pos, radius, true); |
| if (closestPin != null) |
| if (closestPin != null) |
| { |
| { |
| this.RemovePin(closestPin); |
| this.RemovePin(closestPin); |
| return true; |
| return true; |
| } |
| } |
| return false; |
| return false; |
| } |
| } |
| |
| |
| private bool HavePinInRange(Vector3 pos, float radius) |
| private bool HavePinInRange(Vector3 pos, float radius) |
| { |
| { |
| foreach (Minimap.PinData pinData in this.m_pins) |
| foreach (Minimap.PinData pinData in this.m_pins) |
| { |
| { |
| if (pinData.m_save && Utils.DistanceXZ(pos, pinData.m_pos) < radius) |
| if (pinData.m_save && Utils.DistanceXZ(pos, pinData.m_pos) < radius) |
| { |
| { |
| return true; |
| return true; |
| } |
| } |
| } |
| } |
| return false; |
| return false; |
| } |
| } |
| |
| |
| private Minimap.PinData GetClosestPin(Vector3 pos, float radius, bool mustBeVisible = true) |
| private Minimap.PinData GetClosestPin(Vector3 pos, float radius, bool mustBeVisible = true) |
| { |
| { |
| Minimap.PinData pinData = null; |
| Minimap.PinData pinData = null; |
| float num = 999999f; |
| float num = 999999f; |
| foreach (Minimap.PinData pinData2 in this.m_pins) |
| foreach (Minimap.PinData pinData2 in this.m_pins) |
| { |
| { |
| if (pinData2.m_save && ((pinData2.m_uiElement && pinData2.m_uiElement.gameObject.activeInHierarchy) || !mustBeVisible)) |
| if (pinData2.m_save && ((pinData2.m_uiElement && pinData2.m_uiElement.gameObject.activeInHierarchy) || !mustBeVisible)) |
| { |
| { |
| float num2 = Utils.DistanceXZ(pos, pinData2.m_pos); |
| float num2 = Utils.DistanceXZ(pos, pinData2.m_pos); |
| if (num2 < radius && (num2 < num || pinData == null)) |
| if (num2 < radius && (num2 < num || pinData == null)) |
| { |
| { |
| pinData = pinData2; |
| pinData = pinData2; |
| num = num2; |
| num = num2; |
| } |
| } |
| } |
| } |
| } |
| } |
| return pinData; |
| return pinData; |
| } |
| } |
| |
| |
| public void RemovePin(Minimap.PinData pin) |
| public void RemovePin(Minimap.PinData pin) |
| { |
| { |
| this.m_pinUpdateRequired = true; |
| this.m_pinUpdateRequired = true; |
| this.DestroyPinMarker(pin); |
| this.DestroyPinMarker(pin); |
| this.m_pins.Remove(pin); |
| this.m_pins.Remove(pin); |
| } |
| } |
| |
| |
| public void ShowPointOnMap(Vector3 point) |
| public void ShowPointOnMap(Vector3 point) |
| { |
| { |
| this.inputDelay = 0.5f; |
| this.inputDelay = 0.5f; |
| if (Player.m_localPlayer == null) |
| if (Player.m_localPlayer == null) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| this.SetMapMode(Minimap.MapMode.Large); |
| this.SetMapMode(Minimap.MapMode.Large); |
| this.m_mapOffset = point - Player.m_localPlayer.transform.position; |
| this.m_mapOffset = point - Player.m_localPlayer.transform.position; |
| } |
| } |
| |
| |
| public bool DiscoverLocation(Vector3 pos, Minimap.PinType type, string name, bool showMap) |
| public bool DiscoverLocation(Vector3 pos, Minimap.PinType type, string name, bool showMap) |
| { |
| { |
| if (Player.m_localPlayer == null) |
| if (Player.m_localPlayer == null) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| if (this.HaveSimilarPin(pos, type, name, true)) |
| if (this.HaveSimilarPin(pos, type, name, true)) |
| { |
| { |
| if (showMap) |
| if (showMap) |
| { |
| { |
| Player.m_localPlayer.Message(MessageHud.MessageType.Center, "$msg_pin_exist", 0, null); |
| Player.m_localPlayer.Message(MessageHud.MessageType.Center, "$msg_pin_exist", 0, null); |
| this.ShowPointOnMap(pos); |
| this.ShowPointOnMap(pos); |
| } |
| } |
| return false; |
| return false; |
| } |
| } |
| Sprite sprite = this.GetSprite(type); |
| Sprite sprite = this.GetSprite(type); |
| this.AddPin(pos, type, name, true, false, 0L, ""); |
| this.AddPin(pos, type, name, true, false, 0L, ""); |
| if (showMap) |
| if (showMap) |
| { |
| { |
| Player.m_localPlayer.Message(MessageHud.MessageType.TopLeft, "$msg_pin_added: " + name, 0, sprite); |
| Player.m_localPlayer.Message(MessageHud.MessageType.TopLeft, "$msg_pin_added: " + name, 0, sprite); |
| this.ShowPointOnMap(pos); |
| this.ShowPointOnMap(pos); |
| } |
| } |
| else |
| else |
| { |
| { |
| Player.m_localPlayer.Message(MessageHud.MessageType.TopLeft, "$msg_pin_added: " + name, 0, sprite); |
| Player.m_localPlayer.Message(MessageHud.MessageType.TopLeft, "$msg_pin_added: " + name, 0, sprite); |
| } |
| } |
| return true; |
| return true; |
| } |
| } |
| |
| |
| private bool HaveSimilarPin(Vector3 pos, Minimap.PinType type, string name, bool save) |
| private bool HaveSimilarPin(Vector3 pos, Minimap.PinType type, string name, bool save) |
| { |
| { |
| foreach (Minimap.PinData pinData in this.m_pins) |
| foreach (Minimap.PinData pinData in this.m_pins) |
| { |
| { |
| if (pinData.m_name == name && pinData.m_type == type && pinData.m_save == save && Utils.DistanceXZ(pos, pinData.m_pos) < 1f) |
| if (pinData.m_name == name && pinData.m_type == type && pinData.m_save == save && Utils.DistanceXZ(pos, pinData.m_pos) < 1f) |
| { |
| { |
| return true; |
| return true; |
| } |
| } |
| } |
| } |
| return false; |
| return false; |
| } |
| } |
| |
| |
| public Minimap.PinData AddPin(Vector3 pos, Minimap.PinType type, string name, bool save, bool isChecked, long ownerID = 0L, string author = "") |
| public Minimap.PinData AddPin(Vector3 pos, Minimap.PinType type, string name, bool save, bool isChecked, long ownerID = 0L, string author = "") |
| { |
| { |
| if (type >= (Minimap.PinType)this.m_visibleIconTypes.Length || type < Minimap.PinType.Icon0) |
| if (type >= (Minimap.PinType)this.m_visibleIconTypes.Length || type < Minimap.PinType.Icon0) |
| { |
| { |
| ZLog.LogWarning(string.Format("Trying to add invalid pin type: {0}", type)); |
| ZLog.LogWarning(string.Format("Trying to add invalid pin type: {0}", type)); |
| type = Minimap.PinType.Icon3; |
| type = Minimap.PinType.Icon3; |
| } |
| } |
| if (name == null) |
| if (name == null) |
| { |
| { |
| name = ""; |
| name = ""; |
| } |
| } |
| Minimap.PinData pinData = new Minimap.PinData(); |
| Minimap.PinData pinData = new Minimap.PinData(); |
| pinData.m_type = type; |
| pinData.m_type = type; |
| pinData.m_name = name; |
| pinData.m_name = name; |
| pinData.m_pos = pos; |
| pinData.m_pos = pos; |
| pinData.m_icon = this.GetSprite(type); |
| pinData.m_icon = this.GetSprite(type); |
| pinData.m_save = save; |
| pinData.m_save = save; |
| pinData.m_checked = isChecked; |
| pinData.m_checked = isChecked; |
| pinData.m_ownerID = ownerID; |
| pinData.m_ownerID = ownerID; |
| pinData.m_author = author; |
| pinData.m_author = author; |
| if (!string.IsNullOrEmpty(pinData.m_name)) |
| if (!string.IsNullOrEmpty(pinData.m_name)) |
| { |
| { |
| pinData.m_NamePinData = new Minimap.PinNameData(pinData); |
| pinData.m_NamePinData = new Minimap.PinNameData(pinData); |
| } |
| } |
| this.m_pins.Add(pinData); |
| this.m_pins.Add(pinData); |
| if (type < (Minimap.PinType)this.m_visibleIconTypes.Length && !this.m_visibleIconTypes[(int)type]) |
| if (type < (Minimap.PinType)this.m_visibleIconTypes.Length && !this.m_visibleIconTypes[(int)type]) |
| { |
| { |
| this.ToggleIconFilter(type); |
| this.ToggleIconFilter(type); |
| } |
| } |
| this.m_pinUpdateRequired = true; |
| this.m_pinUpdateRequired = true; |
| return pinData; |
| return pinData; |
| } |
| } |
| |
| |
| private Sprite GetSprite(Minimap.PinType type) |
| private Sprite GetSprite(Minimap.PinType type) |
| { |
| { |
| if (type == Minimap.PinType.None) |
| if (type == Minimap.PinType.None) |
| { |
| { |
| return null; |
| return null; |
| } |
| } |
| return this.m_icons.Find((Minimap.SpriteData x) => x.m_name == type).m_icon; |
| return this.m_icons.Find((Minimap.SpriteData x) => x.m_name == type).m_icon; |
| } |
| } |
| |
| |
| private Vector3 GetViewCenterWorldPoint() |
| private Vector3 GetViewCenterWorldPoint() |
| { |
| { |
| Rect uvRect = this.m_mapImageLarge.uvRect; |
| Rect uvRect = this.m_mapImageLarge.uvRect; |
| float num = uvRect.xMin + 0.5f * uvRect.width; |
| float num = uvRect.xMin + 0.5f * uvRect.width; |
| float num2 = uvRect.yMin + 0.5f * uvRect.height; |
| float num2 = uvRect.yMin + 0.5f * uvRect.height; |
| return this.MapPointToWorld(num, num2); |
| return this.MapPointToWorld(num, num2); |
| } |
| } |
| |
| |
| private Vector3 ScreenToWorldPoint(Vector3 mousePos) |
| private Vector3 ScreenToWorldPoint(Vector3 mousePos) |
| { |
| { |
| Vector2 vector = mousePos; |
| Vector2 vector = mousePos; |
| RectTransform rectTransform = this.m_mapImageLarge.transform as RectTransform; |
| RectTransform rectTransform = this.m_mapImageLarge.transform as RectTransform; |
| Vector2 vector2; |
| Vector2 vector2; |
| if (RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform, vector, null, out vector2)) |
| if (RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform, vector, null, out vector2)) |
| { |
| { |
| Vector2 vector3 = Rect.PointToNormalized(rectTransform.rect, vector2); |
| Vector2 vector3 = Rect.PointToNormalized(rectTransform.rect, vector2); |
| Rect uvRect = this.m_mapImageLarge.uvRect; |
| Rect uvRect = this.m_mapImageLarge.uvRect; |
| float num = uvRect.xMin + vector3.x * uvRect.width; |
| float num = uvRect.xMin + vector3.x * uvRect.width; |
| float num2 = uvRect.yMin + vector3.y * uvRect.height; |
| float num2 = uvRect.yMin + vector3.y * uvRect.height; |
| return this.MapPointToWorld(num, num2); |
| return this.MapPointToWorld(num, num2); |
| } |
| } |
| return Vector3.zero; |
| return Vector3.zero; |
| } |
| } |
| |
| |
| private void OnMapLeftDown(UIInputHandler handler) |
| private void OnMapLeftDown(UIInputHandler handler) |
| { |
| { |
| if (Time.time - this.m_leftClickTime < 0.3f) |
| if (Time.time - this.m_leftClickTime < 0.3f) |
| { |
| { |
| this.OnMapDblClick(); |
| this.OnMapDblClick(); |
| this.m_leftClickTime = 0f; |
| this.m_leftClickTime = 0f; |
| this.m_leftDownTime = 0f; |
| this.m_leftDownTime = 0f; |
| return; |
| return; |
| } |
| } |
| this.m_leftClickTime = Time.time; |
| this.m_leftClickTime = Time.time; |
| this.m_leftDownTime = Time.time; |
| this.m_leftDownTime = Time.time; |
| } |
| } |
| |
| |
| private void OnMapLeftUp(UIInputHandler handler) |
| private void OnMapLeftUp(UIInputHandler handler) |
| { |
| { |
| if (this.m_leftDownTime != 0f) |
| if (this.m_leftDownTime != 0f) |
| { |
| { |
| if (Time.time - this.m_leftDownTime < this.m_clickDuration) |
| if (Time.time - this.m_leftDownTime < this.m_clickDuration) |
| { |
| { |
| this.OnMapLeftClick(); |
| this.OnMapLeftClick(); |
| } |
| } |
| this.m_leftDownTime = 0f; |
| this.m_leftDownTime = 0f; |
| } |
| } |
| this.m_dragView = false; |
| this.m_dragView = false; |
| } |
| } |
| |
| |
| public void OnMapDblClick() |
| public void OnMapDblClick() |
| { |
| { |
| if (this.m_selectedType == Minimap.PinType.Death) |
| if (this.m_selectedType == Minimap.PinType.Death) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| this.ShowPinNameInput(this.ScreenToWorldPoint(ZInput.mousePosition)); |
| this.ShowPinNameInput(this.ScreenToWorldPoint(ZInput.mousePosition)); |
| } |
| } |
| |
| |
| public void OnMapLeftClick() |
| public void OnMapLeftClick() |
| { |
| { |
| ZLog.Log("Left click"); |
| ZLog.Log("Left click"); |
| this.HidePinTextInput(false); |
| this.HidePinTextInput(false); |
| Vector3 vector = this.ScreenToWorldPoint(ZInput.mousePosition); |
| Vector3 vector = this.ScreenToWorldPoint(ZInput.mousePosition); |
| Minimap.PinData closestPin = this.GetClosestPin(vector, this.m_removeRadius * (this.m_largeZoom * 2f), true); |
| Minimap.PinData closestPin = this.GetClosestPin(vector, this.m_removeRadius * (this.m_largeZoom * 2f), true); |
| if (closestPin != null) |
| if (closestPin != null) |
| { |
| { |
| if (closestPin.m_ownerID != 0L) |
| if (closestPin.m_ownerID != 0L) |
| { |
| { |
| closestPin.m_ownerID = 0L; |
| closestPin.m_ownerID = 0L; |
| } |
| } |
| else |
| else |
| { |
| { |
| closestPin.m_checked = !closestPin.m_checked; |
| closestPin.m_checked = !closestPin.m_checked; |
| } |
| } |
| } |
| } |
| this.m_pinUpdateRequired = true; |
| this.m_pinUpdateRequired = true; |
| } |
| } |
| |
| |
| public void OnMapMiddleClick(UIInputHandler handler) |
| public void OnMapMiddleClick(UIInputHandler handler) |
| { |
| { |
| this.HidePinTextInput(false); |
| this.HidePinTextInput(false); |
| Vector3 vector = this.ScreenToWorldPoint(ZInput.mousePosition); |
| Vector3 vector = this.ScreenToWorldPoint(ZInput.mousePosition); |
| Chat.instance.SendPing(vector); |
| Chat.instance.SendPing(vector); |
| if (Player.m_debugMode && global::Console.instance != null && global::Console.instance.IsCheatsEnabled() && ZInput.GetKey(KeyCode.LeftControl, true)) |
| if (Player.m_debugMode && global::Console.instance != null && global::Console.instance.IsCheatsEnabled() && ZInput.GetKey(KeyCode.LeftControl, true)) |
| { |
| { |
| Vector3 vector2 = new Vector3(vector.x, Player.m_localPlayer.transform.position.y, vector.z); |
| Vector3 vector2 = new Vector3(vector.x, Player.m_localPlayer.transform.position.y, vector.z); |
| float num; |
| float num; |
| Heightmap.GetHeight(vector2, out num); |
| Heightmap.GetHeight(vector2, out num); |
| vector2.y = Math.Max(0f, num); |
| vector2.y = Math.Max(0f, num); |
| Player.m_localPlayer.TeleportTo(vector2, Player.m_localPlayer.transform.rotation, true); |
| Player.m_localPlayer.TeleportTo(vector2, Player.m_localPlayer.transform.rotation, true); |
| . | |
| Minimap.instance.SetMapMode(Minimap.MapMode.Small); |
| } |
| } |
| } |
| } |
| |
| |
| public void OnMapRightClick(UIInputHandler handler) |
| public void OnMapRightClick(UIInputHandler handler) |
| { |
| { |
| ZLog.Log("Right click"); |
| ZLog.Log("Right click"); |
| this.HidePinTextInput(false); |
| this.HidePinTextInput(false); |
| Vector3 vector = this.ScreenToWorldPoint(ZInput.mousePosition); |
| Vector3 vector = this.ScreenToWorldPoint(ZInput.mousePosition); |
| this.RemovePin(vector, this.m_removeRadius * (this.m_largeZoom * 2f)); |
| this.RemovePin(vector, this.m_removeRadius * (this.m_largeZoom * 2f)); |
| this.m_namePin = null; |
| this.m_namePin = null; |
| } |
| } |
| |
| |
| public void OnPressedIcon0() |
| public void OnPressedIcon0() |
| { |
| { |
| this.SelectIcon(Minimap.PinType.Icon0); |
| this.SelectIcon(Minimap.PinType.Icon0); |
| } |
| } |
| |
| |
| public void OnPressedIcon1() |
| public void OnPressedIcon1() |
| { |
| { |
| this.SelectIcon(Minimap.PinType.Icon1); |
| this.SelectIcon(Minimap.PinType.Icon1); |
| } |
| } |
| |
| |
| public void OnPressedIcon2() |
| public void OnPressedIcon2() |
| { |
| { |
| this.SelectIcon(Minimap.PinType.Icon2); |
| this.SelectIcon(Minimap.PinType.Icon2); |
| } |
| } |
| |
| |
| public void OnPressedIcon3() |
| public void OnPressedIcon3() |
| { |
| { |
| this.SelectIcon(Minimap.PinType.Icon3); |
| this.SelectIcon(Minimap.PinType.Icon3); |
| } |
| } |
| |
| |
| public void OnPressedIcon4() |
| public void OnPressedIcon4() |
| { |
| { |
| this.SelectIcon(Minimap.PinType.Icon4); |
| this.SelectIcon(Minimap.PinType.Icon4); |
| } |
| } |
| |
| |
| public void OnPressedIconDeath() |
| public void OnPressedIconDeath() |
| { |
| { |
| } |
| } |
| |
| |
| public void OnPressedIconBoss() |
| public void OnPressedIconBoss() |
| { |
| { |
| } |
| } |
| |
| |
| public void OnAltPressedIcon0() |
| public void OnAltPressedIcon0() |
| { |
| { |
| this.ToggleIconFilter(Minimap.PinType.Icon0); |
| this.ToggleIconFilter(Minimap.PinType.Icon0); |
| } |
| } |
| |
| |
| public void OnAltPressedIcon1() |
| public void OnAltPressedIcon1() |
| { |
| { |
| this.ToggleIconFilter(Minimap.PinType.Icon1); |
| this.ToggleIconFilter(Minimap.PinType.Icon1); |
| } |
| } |
| |
| |
| public void OnAltPressedIcon2() |
| public void OnAltPressedIcon2() |
| { |
| { |
| this.ToggleIconFilter(Minimap.PinType.Icon2); |
| this.ToggleIconFilter(Minimap.PinType.Icon2); |
| } |
| } |
| |
| |
| public void OnAltPressedIcon3() |
| public void OnAltPressedIcon3() |
| { |
| { |
| this.ToggleIconFilter(Minimap.PinType.Icon3); |
| this.ToggleIconFilter(Minimap.PinType.Icon3); |
| } |
| } |
| |
| |
| public void OnAltPressedIcon4() |
| public void OnAltPressedIcon4() |
| { |
| { |
| this.ToggleIconFilter(Minimap.PinType.Icon4); |
| this.ToggleIconFilter(Minimap.PinType.Icon4); |
| } |
| } |
| |
| |
| public void OnAltPressedIconDeath() |
| public void OnAltPressedIconDeath() |
| { |
| { |
| this.ToggleIconFilter(Minimap.PinType.Death); |
| this.ToggleIconFilter(Minimap.PinType.Death); |
| } |
| } |
| |
| |
| public void OnAltPressedIconBoss() |
| public void OnAltPressedIconBoss() |
| { |
| { |
| this.ToggleIconFilter(Minimap.PinType.Boss); |
| this.ToggleIconFilter(Minimap.PinType.Boss); |
| } |
| } |
| |
| |
| public void OnTogglePublicPosition() |
| public void OnTogglePublicPosition() |
| { |
| { |
| if (ZNet.instance) |
| if (ZNet.instance) |
| { |
| { |
| ZNet.instance.SetPublicReferencePosition(this.m_publicPosition.isOn); |
| ZNet.instance.SetPublicReferencePosition(this.m_publicPosition.isOn); |
| } |
| } |
| } |
| } |
| |
| |
| public void OnToggleSharedMapData() |
| public void OnToggleSharedMapData() |
| { |
| { |
| this.m_showSharedMapData = !this.m_showSharedMapData; |
| this.m_showSharedMapData = !this.m_showSharedMapData; |
| } |
| } |
| |
| |
| private void SelectIcon(Minimap.PinType type) |
| private void SelectIcon(Minimap.PinType type) |
| { |
| { |
| this.m_selectedType = type; |
| this.m_selectedType = type; |
| this.m_pinUpdateRequired = true; |
| this.m_pinUpdateRequired = true; |
| foreach (KeyValuePair<Minimap.PinType, Image> keyValuePair in this.m_selectedIcons) |
| foreach (KeyValuePair<Minimap.PinType, Image> keyValuePair in this.m_selectedIcons) |
| { |
| { |
| keyValuePair.Value.enabled = keyValuePair.Key == type; |
| keyValuePair.Value.enabled = keyValuePair.Key == type; |
| } |
| } |
| } |
| } |
| |
| |
| private void ToggleIconFilter(Minimap.PinType type) |
| private void ToggleIconFilter(Minimap.PinType type) |
| { |
| { |
| this.m_visibleIconTypes[(int)type] = !this.m_visibleIconTypes[(int)type]; |
| this.m_visibleIconTypes[(int)type] = !this.m_visibleIconTypes[(int)type]; |
| this.m_pinUpdateRequired = true; |
| this.m_pinUpdateRequired = true; |
| foreach (KeyValuePair<Minimap.PinType, Image> keyValuePair in this.m_selectedIcons) |
| foreach (KeyValuePair<Minimap.PinType, Image> keyValuePair in this.m_selectedIcons) |
| { |
| { |
| keyValuePair.Value.transform.parent.GetComponent<Image>().color = (this.m_visibleIconTypes[(int)keyValuePair.Key] ? Color.white : Color.gray); |
| keyValuePair.Value.transform.parent.GetComponent<Image>().color = (this.m_visibleIconTypes[(int)keyValuePair.Key] ? Color.white : Color.gray); |
| } |
| } |
| } |
| } |
| |
| |
| private void ClearPins() |
| private void ClearPins() |
| { |
| { |
| foreach (Minimap.PinData pinData in this.m_pins) |
| foreach (Minimap.PinData pinData in this.m_pins) |
| { |
| { |
| this.DestroyPinMarker(pinData); |
| this.DestroyPinMarker(pinData); |
| } |
| } |
| this.m_pins.Clear(); |
| this.m_pins.Clear(); |
| this.m_deathPin = null; |
| this.m_deathPin = null; |
| } |
| } |
| |
| |
| private void UpdateBiome(Player player) |
| private void UpdateBiome(Player player) |
| { |
| { |
| if (this.m_mode != Minimap.MapMode.Large) |
| if (this.m_mode != Minimap.MapMode.Large) |
| { |
| { |
| Heightmap.Biome currentBiome = player.GetCurrentBiome(); |
| Heightmap.Biome currentBiome = player.GetCurrentBiome(); |
| if (currentBiome != this.m_biome) |
| if (currentBiome != this.m_biome) |
| { |
| { |
| this.m_biome = currentBiome; |
| this.m_biome = currentBiome; |
| string text = Localization.instance.Localize("$biome_" + currentBiome.ToString().ToLower()); |
| string text = Localization.instance.Localize("$biome_" + currentBiome.ToString().ToLower()); |
| this.m_biomeNameSmall.text = text; |
| this.m_biomeNameSmall.text = text; |
| this.m_biomeNameLarge.text = text; |
| this.m_biomeNameLarge.text = text; |
| this.m_biomeNameSmall.GetComponent<Animator>().SetTrigger("pulse"); |
| this.m_biomeNameSmall.GetComponent<Animator>().SetTrigger("pulse"); |
| } |
| } |
| return; |
| return; |
| } |
| } |
| Vector3 vector = this.ScreenToWorldPoint(ZInput.IsMouseActive() ? ZInput.mousePosition : new Vector3((float)(Screen.width / 2), (float)(Screen.height / 2))); |
| Vector3 vector = this.ScreenToWorldPoint(ZInput.IsMouseActive() ? ZInput.mousePosition : new Vector3((float)(Screen.width / 2), (float)(Screen.height / 2))); |
| if (this.IsExplored(vector)) |
| if (this.IsExplored(vector)) |
| { |
| { |
| Heightmap.Biome biome = WorldGenerator.instance.GetBiome(vector); |
| Heightmap.Biome biome = WorldGenerator.instance.GetBiome(vector); |
| string text2 = Localization.instance.Localize("$biome_" + biome.ToString().ToLower()); |
| string text2 = Localization.instance.Localize("$biome_" + biome.ToString().ToLower()); |
| this.m_biomeNameLarge.text = text2; |
| this.m_biomeNameLarge.text = text2; |
| return; |
| return; |
| } |
| } |
| this.m_biomeNameLarge.text = ""; |
| this.m_biomeNameLarge.text = ""; |
| } |
| } |
| |
| |
| public byte[] GetSharedMapData(byte[] oldMapData) |
| public byte[] GetSharedMapData(byte[] oldMapData) |
| { |
| { |
| List<bool> list = null; |
| List<bool> list = null; |
| if (oldMapData != null) |
| if (oldMapData != null) |
| { |
| { |
| ZPackage zpackage = new ZPackage(oldMapData); |
| ZPackage zpackage = new ZPackage(oldMapData); |
| int num = zpackage.ReadInt(); |
| int num = zpackage.ReadInt(); |
| list = this.ReadExploredArray(zpackage, num); |
| list = this.ReadExploredArray(zpackage, num); |
| } |
| } |
| ZPackage zpackage2 = new ZPackage(); |
| ZPackage zpackage2 = new ZPackage(); |
| zpackage2.Write(3); |
| zpackage2.Write(3); |
| zpackage2.Write(this.m_explored.Length); |
| zpackage2.Write(this.m_explored.Length); |
| for (int i = 0; i < this.m_explored.Length; i++) |
| for (int i = 0; i < this.m_explored.Length; i++) |
| { |
| { |
| bool flag = this.m_exploredOthers[i] || this.m_explored[i]; |
| bool flag = this.m_exploredOthers[i] || this.m_explored[i]; |
| if (list != null) |
| if (list != null) |
| { |
| { |
| flag |= list[i]; |
| flag |= list[i]; |
| } |
| } |
| zpackage2.Write(flag); |
| zpackage2.Write(flag); |
| } |
| } |
| int num2 = 0; |
| int num2 = 0; |
| foreach (Minimap.PinData pinData in this.m_pins) |
| foreach (Minimap.PinData pinData in this.m_pins) |
| { |
| { |
| if (pinData.m_save && pinData.m_type != Minimap.PinType.Death) |
| if (pinData.m_save && pinData.m_type != Minimap.PinType.Death) |
| { |
| { |
| num2++; |
| num2++; |
| } |
| } |
| } |
| } |
| long playerID = Player.m_localPlayer.GetPlayerID(); |
| long playerID = Player.m_localPlayer.GetPlayerID(); |
| string networkUserId = PrivilegeManager.GetNetworkUserId(); |
| string networkUserId = PrivilegeManager.GetNetworkUserId(); |
| zpackage2.Write(num2); |
| zpackage2.Write(num2); |
| foreach (Minimap.PinData pinData2 in this.m_pins) |
| foreach (Minimap.PinData pinData2 in this.m_pins) |
| { |
| { |
| if (pinData2.m_save && pinData2.m_type != Minimap.PinType.Death) |
| if (pinData2.m_save && pinData2.m_type != Minimap.PinType.Death) |
| { |
| { |
| long num3 = ((pinData2.m_ownerID != 0L) ? pinData2.m_ownerID : playerID); |
| long num3 = ((pinData2.m_ownerID != 0L) ? pinData2.m_ownerID : playerID); |
| string text = ((string.IsNullOrEmpty(pinData2.m_author) && num3 == playerID) ? networkUserId : pinData2.m_author); |
| string text = ((string.IsNullOrEmpty(pinData2.m_author) && num3 == playerID) ? networkUserId : pinData2.m_author); |
| zpackage2.Write(num3); |
| zpackage2.Write(num3); |
| zpackage2.Write(pinData2.m_name); |
| zpackage2.Write(pinData2.m_name); |
| zpackage2.Write(pinData2.m_pos); |
| zpackage2.Write(pinData2.m_pos); |
| zpackage2.Write((int)pinData2.m_type); |
| zpackage2.Write((int)pinData2.m_type); |
| zpackage2.Write(pinData2.m_checked); |
| zpackage2.Write(pinData2.m_checked); |
| zpackage2.Write(text); |
| zpackage2.Write(text); |
| } |
| } |
| } |
| } |
| return zpackage2.GetArray(); |
| return zpackage2.GetArray(); |
| } |
| } |
| |
| |
| private List<bool> ReadExploredArray(ZPackage pkg, int version) |
| private List<bool> ReadExploredArray(ZPackage pkg, int version) |
| { |
| { |
| int num = pkg.ReadInt(); |
| int num = pkg.ReadInt(); |
| if (num != this.m_explored.Length) |
| if (num != this.m_explored.Length) |
| { |
| { |
| ZLog.LogWarning("Map exploration array size missmatch:" + num.ToString() + " VS " + this.m_explored.Length.ToString()); |
| ZLog.LogWarning("Map exploration array size missmatch:" + num.ToString() + " VS " + this.m_explored.Length.ToString()); |
| return null; |
| return null; |
| } |
| } |
| List<bool> list = new List<bool>(); |
| List<bool> list = new List<bool>(); |
| for (int i = 0; i < this.m_textureSize; i++) |
| for (int i = 0; i < this.m_textureSize; i++) |
| { |
| { |
| for (int j = 0; j < this.m_textureSize; j++) |
| for (int j = 0; j < this.m_textureSize; j++) |
| { |
| { |
| bool flag = pkg.ReadBool(); |
| bool flag = pkg.ReadBool(); |
| list.Add(flag); |
| list.Add(flag); |
| } |
| } |
| } |
| } |
| return list; |
| return list; |
| } |
| } |
| |
| |
| public bool AddSharedMapData(byte[] dataArray) |
| public bool AddSharedMapData(byte[] dataArray) |
| { |
| { |
| ZPackage zpackage = new ZPackage(dataArray); |
| ZPackage zpackage = new ZPackage(dataArray); |
| int num = zpackage.ReadInt(); |
| int num = zpackage.ReadInt(); |
| List<bool> list = this.ReadExploredArray(zpackage, num); |
| List<bool> list = this.ReadExploredArray(zpackage, num); |
| if (list == null) |
| if (list == null) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| bool flag = false; |
| bool flag = false; |
| for (int i = 0; i < this.m_textureSize; i++) |
| for (int i = 0; i < this.m_textureSize; i++) |
| { |
| { |
| for (int j = 0; j < this.m_textureSize; j++) |
| for (int j = 0; j < this.m_textureSize; j++) |
| { |
| { |
| int num2 = i * this.m_textureSize + j; |
| int num2 = i * this.m_textureSize + j; |
| bool flag2 = list[num2]; |
| bool flag2 = list[num2]; |
| bool flag3 = this.m_exploredOthers[num2] || this.m_explored[num2]; |
| bool flag3 = this.m_exploredOthers[num2] || this.m_explored[num2]; |
| if (flag2 != flag3 && flag2 && this.ExploreOthers(j, i)) |
| if (flag2 != flag3 && flag2 && this.ExploreOthers(j, i)) |
| { |
| { |
| flag = true; |
| flag = true; |
| } |
| } |
| } |
| } |
| } |
| } |
| if (flag) |
| if (flag) |
| { |
| { |
| this.m_fogTexture.Apply(); |
| this.m_fogTexture.Apply(); |
| } |
| } |
| bool flag4 = false; |
| bool flag4 = false; |
| if (num >= 2) |
| if (num >= 2) |
| { |
| { |
| long playerID = Player.m_localPlayer.GetPlayerID(); |
| long playerID = Player.m_localPlayer.GetPlayerID(); |
| bool flag5 = false; |
| bool flag5 = false; |
| for (int k = this.m_pins.Count - 1; k >= 0; k--) |
| for (int k = this.m_pins.Count - 1; k >= 0; k--) |
| { |
| { |
| Minimap.PinData pinData = this.m_pins[k]; |
| Minimap.PinData pinData = this.m_pins[k]; |
| if (pinData.m_ownerID != 0L && pinData.m_ownerID != playerID) |
| if (pinData.m_ownerID != 0L && pinData.m_ownerID != playerID) |
| { |
| { |
| pinData.m_shouldDelete = true; |
| pinData.m_shouldDelete = true; |
| flag5 = true; |
| flag5 = true; |
| } |
| } |
| } |
| } |
| int num3 = zpackage.ReadInt(); |
| int num3 = zpackage.ReadInt(); |
| for (int l = 0; l < num3; l++) |
| for (int l = 0; l < num3; l++) |
| { |
| { |
| long num4 = zpackage.ReadLong(); |
| long num4 = zpackage.ReadLong(); |
| string text = zpackage.ReadString(); |
| string text = zpackage.ReadString(); |
| Vector3 vector = zpackage.ReadVector3(); |
| Vector3 vector = zpackage.ReadVector3(); |
| Minimap.PinType pinType = (Minimap.PinType)zpackage.ReadInt(); |
| Minimap.PinType pinType = (Minimap.PinType)zpackage.ReadInt(); |
| bool flag6 = zpackage.ReadBool(); |
| bool flag6 = zpackage.ReadBool(); |
| string text2 = ((num >= 3) ? zpackage.ReadString() : ""); |
| string text2 = ((num >= 3) ? zpackage.ReadString() : ""); |
| if (this.HavePinInRange(vector, 1f)) |
| if (this.HavePinInRange(vector, 1f)) |
| { |
| { |
| this.GetClosestPin(vector, 1f, false).m_shouldDelete = false; |
| this.GetClosestPin(vector, 1f, false).m_shouldDelete = false; |
| } |
| } |
| else if (num4 != playerID) |
| else if (num4 != playerID) |
| { |
| { |
| if (num4 == playerID) |
| if (num4 == playerID) |
| { |
| { |
| num4 = 0L; |
| num4 = 0L; |
| } |
| } |
| this.AddPin(vector, pinType, text, true, flag6, num4, text2); |
| this.AddPin(vector, pinType, text, true, flag6, num4, text2); |
| flag4 = true; |
| flag4 = true; |
| } |
| } |
| } |
| } |
| if (flag5) |
| if (flag5) |
| { |
| { |
| for (int m = this.m_pins.Count - 1; m >= 0; m--) |
| for (int m = this.m_pins.Count - 1; m >= 0; m--) |
| { |
| { |
| Minimap.PinData pinData2 = this.m_pins[m]; |
| Minimap.PinData pinData2 = this.m_pins[m]; |
| if (pinData2.m_ownerID != 0L && pinData2.m_ownerID != playerID && pinData2.m_shouldDelete) |
| if (pinData2.m_ownerID != 0L && pinData2.m_ownerID != playerID && pinData2.m_shouldDelete) |
| { |
| { |
| this.RemovePin(pinData2); |
| this.RemovePin(pinData2); |
| flag4 = true; |
| flag4 = true; |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| return flag || flag4; |
| return flag || flag4; |
| } |
| } |
| |
| |
| private Color forest = new Color(1f, 0f, 0f, 0f); |
| private Color forest = new Color(1f, 0f, 0f, 0f); |
| |
| |
| private Color noForest = new Color(0f, 0f, 0f, 0f); |
| private Color noForest = new Color(0f, 0f, 0f, 0f); |
| |
| |
| private static int MAPVERSION = 8; |
| private static int MAPVERSION = 8; |
| |
| |
| private float inputDelay; |
| private float inputDelay; |
| |
| |
| private const int sharedMapDataVersion = 3; |
| private const int sharedMapDataVersion = 3; |
| |
| |
| private static Minimap m_instance; |
| private static Minimap m_instance; |
| |
| |
| public GameObject m_smallRoot; |
| public GameObject m_smallRoot; |
| |
| |
| public GameObject m_largeRoot; |
| public GameObject m_largeRoot; |
| |
| |
| public RawImage m_mapImageSmall; |
| public RawImage m_mapImageSmall; |
| |
| |
| public RawImage m_mapImageLarge; |
| public RawImage m_mapImageLarge; |
| |
| |
| public RectTransform m_pinRootSmall; |
| public RectTransform m_pinRootSmall; |
| |
| |
| public RectTransform m_pinRootLarge; |
| public RectTransform m_pinRootLarge; |
| |
| |
| public RectTransform m_pinNameRootSmall; |
| public RectTransform m_pinNameRootSmall; |
| |
| |
| public RectTransform m_pinNameRootLarge; |
| public RectTransform m_pinNameRootLarge; |
| |
| |
| public TMP_Text m_biomeNameSmall; |
| public TMP_Text m_biomeNameSmall; |
| |
| |
| public TMP_Text m_biomeNameLarge; |
| public TMP_Text m_biomeNameLarge; |
| |
| |
| public RectTransform m_smallShipMarker; |
| public RectTransform m_smallShipMarker; |
| |
| |
| public RectTransform m_largeShipMarker; |
| public RectTransform m_largeShipMarker; |
| |
| |
| public RectTransform m_smallMarker; |
| public RectTransform m_smallMarker; |
| |
| |
| public RectTransform m_largeMarker; |
| public RectTransform m_largeMarker; |
| |
| |
| public RectTransform m_windMarker; |
| public RectTransform m_windMarker; |
| |
| |
| public RectTransform m_gamepadCrosshair; |
| public RectTransform m_gamepadCrosshair; |
| |
| |
| public Toggle m_publicPosition; |
| public Toggle m_publicPosition; |
| |
| |
| public Image m_selectedIcon0; |
| public Image m_selectedIcon0; |
| |
| |
| public Image m_selectedIcon1; |
| public Image m_selectedIcon1; |
| |
| |
| public Image m_selectedIcon2; |
| public Image m_selectedIcon2; |
| |
| |
| public Image m_selectedIcon3; |
| public Image m_selectedIcon3; |
| |
| |
| public Image m_selectedIcon4; |
| public Image m_selectedIcon4; |
| |
| |
| public Image m_selectedIconDeath; |
| public Image m_selectedIconDeath; |
| |
| |
| public Image m_selectedIconBoss; |
| public Image m_selectedIconBoss; |
| |
| |
| private Dictionary<Minimap.PinType, Image> m_selectedIcons = new Dictionary<Minimap.PinType, Image>(); |
| private Dictionary<Minimap.PinType, Image> m_selectedIcons = new Dictionary<Minimap.PinType, Image>(); |
| |
| |
| private bool[] m_visibleIconTypes; |
| private bool[] m_visibleIconTypes; |
| |
| |
| private bool m_showSharedMapData = true; |
| private bool m_showSharedMapData = true; |
| |
| |
| public float m_sharedMapDataFadeRate = 2f; |
| public float m_sharedMapDataFadeRate = 2f; |
| |
| |
| private float m_sharedMapDataFade; |
| private float m_sharedMapDataFade; |
| |
| |
| public GameObject m_mapSmall; |
| public GameObject m_mapSmall; |
| |
| |
| public GameObject m_mapLarge; |
| public GameObject m_mapLarge; |
| |
| |
| private Material m_mapSmallShader; |
| private Material m_mapSmallShader; |
| |
| |
| private Material m_mapLargeShader; |
| private Material m_mapLargeShader; |
| |
| |
| public GameObject m_pinPrefab; |
| public GameObject m_pinPrefab; |
| |
| |
| [SerializeField] |
| [SerializeField] |
| private GameObject m_pinNamePrefab; |
| private GameObject m_pinNamePrefab; |
| |
| |
| public GuiInputField m_nameInput; |
| public GuiInputField m_nameInput; |
| |
| |
| public int m_textureSize = 256; |
| public int m_textureSize = 256; |
| |
| |
| public float m_pixelSize = 64f; |
| public float m_pixelSize = 64f; |
| |
| |
| public float m_minZoom = 0.01f; |
| public float m_minZoom = 0.01f; |
| |
| |
| public float m_maxZoom = 1f; |
| public float m_maxZoom = 1f; |
| |
| |
| public float m_showNamesZoom = 0.5f; |
| public float m_showNamesZoom = 0.5f; |
| |
| |
| public float m_exploreInterval = 2f; |
| public float m_exploreInterval = 2f; |
| |
| |
| public float m_exploreRadius = 100f; |
| public float m_exploreRadius = 100f; |
| |
| |
| public float m_removeRadius = 128f; |
| public float m_removeRadius = 128f; |
| |
| |
| public float m_pinSizeSmall = 32f; |
| public float m_pinSizeSmall = 32f; |
| |
| |
| public float m_pinSizeLarge = 48f; |
| public float m_pinSizeLarge = 48f; |
| |
| |
| public float m_clickDuration = 0.25f; |
| public float m_clickDuration = 0.25f; |
| |
| |
| public List<Minimap.SpriteData> m_icons = new List<Minimap.SpriteData>(); |
| public List<Minimap.SpriteData> m_icons = new List<Minimap.SpriteData>(); |
| |
| |
| public List<Minimap.LocationSpriteData> m_locationIcons = new List<Minimap.LocationSpriteData>(); |
| public List<Minimap.LocationSpriteData> m_locationIcons = new List<Minimap.LocationSpriteData>(); |
| |
| |
| public Color m_meadowsColor = new Color(0.45f, 1f, 0.43f); |
| public Color m_meadowsColor = new Color(0.45f, 1f, 0.43f); |
| |
| |
| public Color m_ashlandsColor = new Color(1f, 0.2f, 0.2f); |
| public Color m_ashlandsColor = new Color(1f, 0.2f, 0.2f); |
| |
| |
| public Color m_blackforestColor = new Color(0f, 0.7f, 0f); |
| public Color m_blackforestColor = new Color(0f, 0.7f, 0f); |
| |
| |
| public Color m_deepnorthColor = new Color(1f, 1f, 1f); |
| public Color m_deepnorthColor = new Color(1f, 1f, 1f); |
| |
| |
| public Color m_heathColor = new Color(1f, 1f, 0.2f); |
| public Color m_heathColor = new Color(1f, 1f, 0.2f); |
| |
| |
| public Color m_swampColor = new Color(0.6f, 0.5f, 0.5f); |
| public Color m_swampColor = new Color(0.6f, 0.5f, 0.5f); |
| |
| |
| public Color m_mountainColor = new Color(1f, 1f, 1f); |
| public Color m_mountainColor = new Color(1f, 1f, 1f); |
| |
| |
| private Color m_mistlandsColor = new Color(0.2f, 0.2f, 0.2f); |
| private Color m_mistlandsColor = new Color(0.2f, 0.2f, 0.2f); |
| |
| |
| private Minimap.PinData m_namePin; |
| private Minimap.PinData m_namePin; |
| |
| |
| private Minimap.PinType m_selectedType; |
| private Minimap.PinType m_selectedType; |
| |
| |
| private Minimap.PinData m_deathPin; |
| private Minimap.PinData m_deathPin; |
| |
| |
| private Minimap.PinData m_spawnPointPin; |
| private Minimap.PinData m_spawnPointPin; |
| |
| |
| private Dictionary<Vector3, Minimap.PinData> m_locationPins = new Dictionary<Vector3, Minimap.PinData>(); |
| private Dictionary<Vector3, Minimap.PinData> m_locationPins = new Dictionary<Vector3, Minimap.PinData>(); |
| |
| |
| private float m_updateLocationsTimer; |
| private float m_updateLocationsTimer; |
| |
| |
| private List<Minimap.PinData> m_pingPins = new List<Minimap.PinData>(); |
| private List<Minimap.PinData> m_pingPins = new List<Minimap.PinData>(); |
| |
| |
| private List<Minimap.PinData> m_shoutPins = new List<Minimap.PinData>(); |
| private List<Minimap.PinData> m_shoutPins = new List<Minimap.PinData>(); |
| |
| |
| private List<Chat.WorldTextInstance> m_tempShouts = new List<Chat.WorldTextInstance>(); |
| private List<Chat.WorldTextInstance> m_tempShouts = new List<Chat.WorldTextInstance>(); |
| |
| |
| private List<Minimap.PinData> m_playerPins = new List<Minimap.PinData>(); |
| private List<Minimap.PinData> m_playerPins = new List<Minimap.PinData>(); |
| |
| |
| private List<ZNet.PlayerInfo> m_tempPlayerInfo = new List<ZNet.PlayerInfo>(); |
| private List<ZNet.PlayerInfo> m_tempPlayerInfo = new List<ZNet.PlayerInfo>(); |
| |
| |
| private Minimap.PinData m_randEventPin; |
| private Minimap.PinData m_randEventPin; |
| |
| |
| private Minimap.PinData m_randEventAreaPin; |
| private Minimap.PinData m_randEventAreaPin; |
| |
| |
| private float m_updateEventTime; |
| private float m_updateEventTime; |
| |
| |
| private bool[] m_explored; |
| private bool[] m_explored; |
| |
| |
| private bool[] m_exploredOthers; |
| private bool[] m_exploredOthers; |
| |
| |
| public GameObject m_sharedMapHint; |
| public GameObject m_sharedMapHint; |
| |
| |
| public List<GameObject> m_hints; |
| public List<GameObject> m_hints; |
| |
| |
| private List<Minimap.PinData> m_pins = new List<Minimap.PinData>(); |
| private List<Minimap.PinData> m_pins = new List<Minimap.PinData>(); |
| |
| |
| private bool m_pinUpdateRequired; |
| private bool m_pinUpdateRequired; |
| |
| |
| private Vector3 m_previousMapCenter = Vector3.zero; |
| private Vector3 m_previousMapCenter = Vector3.zero; |
| |
| |
| private float m_previousLargeZoom = 0.1f; |
| private float m_previousLargeZoom = 0.1f; |
| |
| |
| private float m_previousSmallZoom = 0.01f; |
| private float m_previousSmallZoom = 0.01f; |
| |
| |
| private Texture2D m_forestMaskTexture; |
| private Texture2D m_forestMaskTexture; |
| |
| |
| private Texture2D m_mapTexture; |
| private Texture2D m_mapTexture; |
| |
| |
| private Texture2D m_heightTexture; |
| private Texture2D m_heightTexture; |
| |
| |
| private Texture2D m_fogTexture; |
| private Texture2D m_fogTexture; |
| |
| |
| private float m_largeZoom = 0.1f; |
| private float m_largeZoom = 0.1f; |
| |
| |
| private float m_smallZoom = 0.01f; |
| private float m_smallZoom = 0.01f; |
| |
| |
| private Heightmap.Biome m_biome; |
| private Heightmap.Biome m_biome; |
| |
| |
| [HideInInspector] |
| [HideInInspector] |
| public Minimap.MapMode m_mode; |
| public Minimap.MapMode m_mode; |
| |
| |
| public float m_nomapPingDistance = 50f; |
| public float m_nomapPingDistance = 50f; |
| |
| |
| private float m_exploreTimer; |
| private float m_exploreTimer; |
| |
| |
| private bool m_hasGenerated; |
| private bool m_hasGenerated; |
| |
| |
| private bool m_dragView = true; |
| private bool m_dragView = true; |
| |
| |
| private Vector3 m_mapOffset = Vector3.zero; |
| private Vector3 m_mapOffset = Vector3.zero; |
| |
| |
| private float m_leftDownTime; |
| private float m_leftDownTime; |
| |
| |
| private float m_leftClickTime; |
| private float m_leftClickTime; |
| |
| |
| private Vector3 m_dragWorldPos = Vector3.zero; |
| private Vector3 m_dragWorldPos = Vector3.zero; |
| |
| |
| private bool m_wasFocused; |
| private bool m_wasFocused; |
| |
| |
| private float m_delayTextInput; |
| private float m_delayTextInput; |
| |
| |
| private float m_pauseUpdate; |
| private float m_pauseUpdate; |
| |
| |
| private const bool m_enableLastDeathAutoPin = false; |
| private const bool m_enableLastDeathAutoPin = false; |
| |
| |
| private int m_hiddenFrames; |
| private int m_hiddenFrames; |
| |
| |
| [SerializeField] |
| [SerializeField] |
| private float m_gamepadMoveSpeed = 0.33f; |
| private float m_gamepadMoveSpeed = 0.33f; |
| . | |
| |
| private bool m_mapZoomToggle; |
| |
| |
| |
| private string m_forestMaskTexturePath; |
| private string m_forestMaskTexturePath; |
| |
| |
| private const string c_forestMaskTextureName = "forestMaskTexCache"; |
| private const string c_forestMaskTextureName = "forestMaskTexCache"; |
| |
| |
| private string m_mapTexturePath; |
| private string m_mapTexturePath; |
| |
| |
| private const string c_mapTextureName = "mapTexCache"; |
| private const string c_mapTextureName = "mapTexCache"; |
| |
| |
| private string m_heightTexturePath; |
| private string m_heightTexturePath; |
| |
| |
| private const string c_heightTextureName = "heightTexCache"; |
| private const string c_heightTextureName = "heightTexCache"; |
| |
| |
| public enum MapMode |
| public enum MapMode |
| { |
| { |
| None, |
| None, |
| Small, |
| Small, |
| Large |
| Large |
| } |
| } |
| |
| |
| public enum PinType |
| public enum PinType |
| { |
| { |
| Icon0, |
| Icon0, |
| Icon1, |
| Icon1, |
| Icon2, |
| Icon2, |
| Icon3, |
| Icon3, |
| Death, |
| Death, |
| Bed, |
| Bed, |
| Icon4, |
| Icon4, |
| Shout, |
| Shout, |
| None, |
| None, |
| Boss, |
| Boss, |
| Player, |
| Player, |
| RandomEvent, |
| RandomEvent, |
| Ping, |
| Ping, |
| EventArea, |
| EventArea, |
| Hildir1, |
| Hildir1, |
| Hildir2, |
| Hildir2, |
| Hildir3 |
| Hildir3 |
| } |
| } |
| |
| |
| public class PinData |
| public class PinData |
| { |
| { |
| public string m_name; |
| public string m_name; |
| |
| |
| public Minimap.PinType m_type; |
| public Minimap.PinType m_type; |
| |
| |
| public Sprite m_icon; |
| public Sprite m_icon; |
| |
| |
| public Vector3 m_pos; |
| public Vector3 m_pos; |
| |
| |
| public bool m_save; |
| public bool m_save; |
| |
| |
| public long m_ownerID; |
| public long m_ownerID; |
| |
| |
| public string m_author = ""; |
| public string m_author = ""; |
| |
| |
| public bool m_shouldDelete; |
| public bool m_shouldDelete; |
| |
| |
| public bool m_checked; |
| public bool m_checked; |
| |
| |
| public bool m_doubleSize; |
| public bool m_doubleSize; |
| |
| |
| public bool m_animate; |
| public bool m_animate; |
| |
| |
| public float m_worldSize; |
| public float m_worldSize; |
| |
| |
| public RectTransform m_uiElement; |
| public RectTransform m_uiElement; |
| |
| |
| public GameObject m_checkedElement; |
| public GameObject m_checkedElement; |
| |
| |
| public Image m_iconElement; |
| public Image m_iconElement; |
| |
| |
| public Minimap.PinNameData m_NamePinData; |
| public Minimap.PinNameData m_NamePinData; |
| } |
| } |
| |
| |
| public class PinNameData |
| public class PinNameData |
| { |
| { |
| public TMP_Text PinNameText { get; private set; } |
| public TMP_Text PinNameText { get; private set; } |
| |
| |
| public GameObject PinNameGameObject { get; private set; } |
| public GameObject PinNameGameObject { get; private set; } |
| |
| |
| public RectTransform PinNameRectTransform { get; private set; } |
| public RectTransform PinNameRectTransform { get; private set; } |
| |
| |
| public PinNameData(Minimap.PinData pin) |
| public PinNameData(Minimap.PinData pin) |
| { |
| { |
| this.ParentPin = pin; |
| this.ParentPin = pin; |
| } |
| } |
| |
| |
| internal void SetTextAndGameObject(GameObject text) |
| internal void SetTextAndGameObject(GameObject text) |
| { |
| { |
| this.PinNameGameObject = text; |
| this.PinNameGameObject = text; |
| this.PinNameText = this.PinNameGameObject.GetComponentInChildren<TMP_Text>(); |
| this.PinNameText = this.PinNameGameObject.GetComponentInChildren<TMP_Text>(); |
| if (string.IsNullOrEmpty(this.ParentPin.m_author) || this.ParentPin.m_author == PrivilegeManager.GetNetworkUserId()) |
| if (string.IsNullOrEmpty(this.ParentPin.m_author) || this.ParentPin.m_author == PrivilegeManager.GetNetworkUserId()) |
| { |
| { |
| this.PinNameText.text = Localization.instance.Localize(this.ParentPin.m_name); |
| this.PinNameText.text = Localization.instance.Localize(this.ParentPin.m_name); |
| } |
| } |
| else |
| else |
| { |
| { |
| this.PinNameText.text = CensorShittyWords.FilterUGC(Localization.instance.Localize(this.ParentPin.m_name), UGCType.Text, this.ParentPin.m_author, 0L); |
| this.PinNameText.text = CensorShittyWords.FilterUGC(Localization.instance.Localize(this.ParentPin.m_name), UGCType.Text, this.ParentPin.m_author, 0L); |
| } |
| } |
| this.PinNameRectTransform = text.GetComponent<RectTransform>(); |
| this.PinNameRectTransform = text.GetComponent<RectTransform>(); |
| } |
| } |
| |
| |
| internal void DestroyMapMarker() |
| internal void DestroyMapMarker() |
| { |
| { |
| UnityEngine.Object.Destroy(this.PinNameGameObject); |
| UnityEngine.Object.Destroy(this.PinNameGameObject); |
| this.PinNameGameObject = null; |
| this.PinNameGameObject = null; |
| } |
| } |
| |
| |
| public readonly Minimap.PinData ParentPin; |
| public readonly Minimap.PinData ParentPin; |
| } |
| } |
| |
| |
| [Serializable] |
| [Serializable] |
| public struct SpriteData |
| public struct SpriteData |
| { |
| { |
| public Minimap.PinType m_name; |
| public Minimap.PinType m_name; |
| |
| |
| public Sprite m_icon; |
| public Sprite m_icon; |
| } |
| } |
| |
| |
| [Serializable] |
| [Serializable] |
| public struct LocationSpriteData |
| public struct LocationSpriteData |
| { |
| { |
| public string m_name; |
| public string m_name; |
| |
| |
| public Sprite m_icon; |
| public Sprite m_icon; |
| } |
| } |
| } |
| } |
| |
| |