// ----------------------------------------------------------------------------------- // Show // @Client // ----------------------------------------------------------------------------------- public void Show(int _instanceCategory) { Player player = Player.localPlayer; if (!player) { return; } instanceCategory = _instanceCategory; if (!sharedInstanceManager) { sharedInstanceManager = FindObjectOfType <UCE_LimitedZonesManager>(); } List <UCE_LimitedZonesEntry> instancesAvailable = sharedInstanceManager.getAvailableSharedInstances(player, instanceCategory); if (instancesAvailable.Count == 0) { return; } UIUtils.BalancePrefabs(slotPrefab.gameObject, instancesAvailable.Count, content); for (int i = 0; i < instancesAvailable.Count; ++i) { UCE_Slot_LimitedZones slot = content.GetChild(i).GetComponent <UCE_Slot_LimitedZones>(); int index = i; slot.image.sprite = instancesAvailable[i].image; slot.titleText.text = instancesAvailable[i].title; slot.descriptionText.text = instancesAvailable[i].description; slot.groupText.text = instancesAvailable[i].getGroupType(); if (instancesAvailable[i].entranceCost.honorCurrency != null) { slot.costImage.sprite = instancesAvailable[i].entranceCost.honorCurrency.image; slot.costText.text = instancesAvailable[i].entranceCost.amount.ToString(); } slot.groupCountText.text = instancesAvailable[i].getGroupCountText(); slot.countText.text = instancesAvailable[i].getPlayerCountText(); slot.actionButton.interactable = instancesAvailable[i].canPlayerEnter(player); slot.actionButton.onClick.SetListener(() => { instancesAvailable[index].teleportPlayerToInstance(player, instanceCategory, index); panel.SetActive(false); }); } panel.SetActive(true); }
// ----------------------------------------------------------------------------------- // Start // ----------------------------------------------------------------------------------- private void Start() { if (!sharedInstanceManager) { sharedInstanceManager = FindObjectOfType <UCE_LimitedZonesManager>(); } players = new List <Player>(); players.Clear(); }
public void Cmd_UCE_teleportPlayerToInstance(int index, int instanceCategory, int instanceIndex) { if (!sharedInstanceManager) { sharedInstanceManager = FindObjectOfType <UCE_LimitedZonesManager>(); } List <UCE_LimitedZonesEntry> instancesAvailable = sharedInstanceManager.getAvailableSharedInstances(this, instanceCategory); instancesAvailable[instanceIndex].payEntranceCost(this); UCE_PlayerGroupLocations locations = instancesAvailable[instanceIndex].targetArea.playerGroupLocation[index]; if (locations.teleportPosition.Length == 0) { return; } index = UnityEngine.Random.Range(0, locations.teleportPosition.Length - 1); agent.Warp(locations.teleportPosition[index].position); }