| | 1 | | using DCL.Interface; |
| | 2 | | using UnityEngine; |
| | 3 | |
|
| | 4 | | [RequireComponent(typeof(ButtonComponentView))] |
| | 5 | | public class JumpInAction : MonoBehaviour |
| | 6 | | { |
| | 7 | | public Vector2Int coords; |
| | 8 | | public string serverName; |
| | 9 | | public string layerName; |
| | 10 | |
|
| | 11 | | private ButtonComponentView button; |
| | 12 | |
|
| | 13 | | private void Start() |
| | 14 | | { |
| 15 | 15 | | button = GetComponent<ButtonComponentView>(); |
| 15 | 16 | | button.onClick.AddListener(JumpIn); |
| 15 | 17 | | } |
| | 18 | |
|
| | 19 | | private void OnDestroy() |
| | 20 | | { |
| 37 | 21 | | if (button != null) |
| 15 | 22 | | button.onClick.RemoveAllListeners(); |
| 37 | 23 | | } |
| | 24 | |
|
| | 25 | | internal void JumpIn() |
| | 26 | | { |
| 0 | 27 | | if (string.IsNullOrEmpty(serverName)) |
| 0 | 28 | | WebInterface.GoTo(coords.x, coords.y); |
| | 29 | | else |
| 0 | 30 | | WebInterface.JumpIn(coords.x, coords.y, serverName, layerName); |
| 0 | 31 | | } |
| | 32 | | } |