Ejemplo n.º 1
0
    // -----------------------------------------------------------------------------------
    // 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);
    }
Ejemplo n.º 2
0
    // -----------------------------------------------------------------------------------
    // Start
    // -----------------------------------------------------------------------------------
    private void Start()
    {
        if (!sharedInstanceManager)
        {
            sharedInstanceManager = FindObjectOfType <UCE_LimitedZonesManager>();
        }

        players = new List <Player>();
        players.Clear();
    }
Ejemplo n.º 3
0
    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);
    }