Beispiel #1
0
    public void Show(PlanetEntity entity)
    {
        if (inst == null)
        {
            inst = PanelInstance.CreateInstance <PanelInstanceObject>(PanelName.PANEL_OBJECT_INFO).GetComponent();
        }

        inst.title.SetText(entity.entityData.name);
        inst.description.SetText(entity.entityData.description);

        if (entity.entityData.canSell)
        {
            this.inst.sellAmount.gameObject.SetActive(true);
            this.inst.sellButton.gameObject.SetActive(true);

            inst.sellAmount.SetText("$ " + (entity.entityData.cost * ConstMultiplier.MONEY).ToString());
            inst.sellButton.ClearEvents();
            inst.sellButton.RegisterOnClickEvent(() =>
            {
                if (entity.gameObject == null)
                {
                    return;
                }

                Player.Instance.money += entity.entityData.cost * ConstMultiplier.MONEY;
                Object.Destroy(entity.gameObject);
                this.inst.gameObject.SetActive(false);
            });
        }
        else
        {
            this.inst.sellAmount.gameObject.SetActive(false);
            this.inst.sellButton.gameObject.SetActive(false);
        }

        ShowEntityInfo(entity);
        inst.closer.SetUIVisible(true);
    }