/// <summary>
        /// The Initialize.
        /// </summary>
        /// <param name="station">The station<see cref="VehicleStation"/>.</param>
        /// <param name="building">The building<see cref="Building"/>.</param>
        /// <param name="recipe">The recipe<see cref="Recipe"/>.</param>
        /// <param name="count">The count<see cref="float"/>.</param>
        /// <param name="item">The item<see cref="Item"/>.</param>
        public void Initialize(VehicleStation station, Building building, Recipe recipe, float count, Item item = null)
        {
            this._station  = station;
            this._building = building;
            this._count    = Mathf.Ceil(count * 10) / 10;
            this._recipe   = recipe;
            this._item     = item;
            base.transform.Find <Image>("Thumb").sprite = this.GetThumbIcon();
            Image image = base.transform.Find <Image>("ItemImage");

            if (this._recipe != null)
            {
                _item = this._recipe.OutputItems[0].Item;
            }
            if (_item != null)
            {
                image.sprite = GetItemIcon();
                image.gameObject.SetActive(true);
            }
            else
            {
                image.gameObject.SetActive(false);
            }
            this._settingsCog    = base.transform.Find <Button>("ConnectionCog");
            this._valueText      = base.transform.Find <Text>("ValueContainer/Value");
            this._valueText.text = _count.ToString("N1");
            this._valueText.transform.parent.gameObject.SetActive(true);
            //			VoxelTycoon.UI.ContextMenu.For(this._settingsCog, PickerBehavior.OverlayToRight, new Action<VoxelTycoon.UI.ContextMenu>(this.SetupContextMenu));
            this.SetSettingsCogVisibility(false);
            Tooltip.For(this, null, BuildingHelper.GetBuildingName(_building), GetTooltipText, 0);
        }
Esempio n. 2
0
 public void Initialize(VehicleStation station, VehicleStation connectedStation)
 {
     this._station          = station;
     this._connectedStation = connectedStation;
     base.transform.Find <Image>("Thumb").sprite = this.GetThumbIcon();
     base.transform.GetComponent <Button>().onClick.AddListener(delegate()
     {
         GameCameraViewHelper.TryGoTo(this._connectedStation, 70f);
     });
     this._settingsCog = base.transform.Find <Button>("ConnectionCog");
     VoxelTycoon.UI.ContextMenu.For(this._settingsCog, PickerBehavior.OverlayToRight, new Action <VoxelTycoon.UI.ContextMenu>(this.SetupContextMenu));
     this.SetSettingsCogVisibility(true);
     Tooltip.For(this, null, BuildingHelper.GetBuildingName(connectedStation), "", 0);
 }
 /// <summary>
 /// The GetTooltipText.
 /// </summary>
 /// <returns>The <see cref="string"/>.</returns>
 private string GetTooltipText()
 {
     return((_recipe != null ? _recipe.DisplayName : BuildingHelper.GetBuildingName(_building)) + " (" + _count.ToString("N1") + ")");
 }