/// <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);
        }
Beispiel #2
0
        public void Initialize(VehicleScheduleData data, Settings settings)
        {
            Transform timeIndicator = transform.Find("TimeIndicator");

            if (settings.ShowScheduleTotalTime)
            {
                _text = timeIndicator.Find("TotalTimeText").GetComponent <Text>();
                Locale locale = LazyManager <LocaleManager> .Current.Locale;
                Tooltip.For(timeIndicator,
                            GetTotalTimeTooltipText,
                            0);
            }
            else
            {
                timeIndicator.SetActive(false);
            }

            if (settings.ShowTotalTransferCapacity)
            {
                _capacityIndicator = transform.GetComponentInChildren <CargoCapacityIndicator>();
                _capacityIndicator.Initialize(null, null);
                Tooltip.For(
                    _capacityIndicator,
                    () => GetCapacityTooltipText(),
                    0
                    );
            }
            _scheduleData = data;
            UpdateValues(data, null);
        }
        private static void VehicleWindowScheduleTabSeparatorView_Initialize_pof(VehicleWindowDetailsTabBodyItem __instance, int index, VehicleUnit vehicleUnit)
        {
            VehicleScheduleData scheduleData = Manager <VehicleScheduleDataManager> .Current[vehicleUnit.Vehicle];

            if (scheduleData != null)
            {
                Tooltip.For(__instance, () => GetToolTipText(vehicleUnit.Vehicle, index), 0);
            }
        }
Beispiel #4
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);
 }
        public void Initialize(VehicleStation station)
        {
            this._station = station;
            Locale locale = LazyManager <LocaleManager> .Current.Locale;

            this._demandBuildingNodesGrid = base.transform.Find <ScrollRect>("Head/DemandBuildingNodes/ScrollView").content;
            Transform buttonCont = Instantiate <Transform>(GetAddButtonTemplate(), this._demandBuildingNodesGrid);

            buttonCont.name  = "AddDemandButton";
            _addDemandButton = buttonCont.Find <Button>("Button");
            _addDemandButton.onClick.AddListener(delegate()
            {
                UIManager.Current.SetTool(new DemandPickerTool()
                {
                    OnBuildingPicked = OnDemandPicked,
                    DisabledNodes    = new HashSet <IStorageNetworkNode>(LazyManager <StationDemandManager> .Current.GetCombinedStationDemandNodesEnum(station, true))
                }, false);
            });
            Tooltip.For(_addDemandButton, locale.GetString("schedule_stopwatch/add_new_demand_tooltip"));

            this._connectedStationsGrid = base.transform.Find <ScrollRect>("Head/ConnectedStations/ScrollView").content;
            Transform stationButtonCont = Instantiate <Transform>(GetAddButtonTemplate(), this._connectedStationsGrid);

            stationButtonCont.name = "AddStationButton";
            _addStationButton      = stationButtonCont.Find <Button>("Button");
            _addStationButton.onClick.AddListener(delegate()
            {
                UIManager.Current.SetTool(new StationPickerTool()
                {
                    OnStationPicked  = OnStationPicked,
                    DisabledStations = LazyManager <StationDemandManager> .Current.GetConnectedStationsHashset(station, true)
                }, false);
            });
            Tooltip.For(_addStationButton, locale.GetString("schedule_stopwatch/connect_station_tooltip"));

            Transform bodyContent = base.transform.Find("Body/WindowScrollView").GetComponent <ScrollRect>().content;

            _demandedContainer = bodyContent.Find("DemandedItems");
            Tooltip.For(_demandedContainer.Find("Label"), locale.GetString("schedule_stopwatch/demanded_items_tooltip"));
            _demandedItemsContainer = _demandedContainer.Find("Content");

            _productionNeededContainer = bodyContent.Find("NeededItems");
            Tooltip.For(_productionNeededContainer.Find("Label"), locale.GetString("schedule_stopwatch/needed_items_tooltip"));
            _productionNeededItemsContainer = _productionNeededContainer.Find("Content");

            _factoriesContainer = bodyContent.Find("NeededFactories");
            Tooltip.For(_factoriesContainer.Find("Label"), locale.GetString("schedule_stopwatch/needed_factories_tooltip"));
            _factoriesItemsContainer = _factoriesContainer.Find <ScrollRect>("ScrollView").content;
        }
        public void Initialize(RootTask task, VehicleScheduleData data, Settings settings)
        {
            Task           = task;
            _scheduleData  = data;
            transform.name = "StopWatchDuration";
            Transform timeIndicator = transform.Find("TimeIndicator");

            if (settings.ShowIndividualTaskTimes)
            {
                _travelTimeText  = timeIndicator.Find("TravelTimeText").GetComponent <Text>();
                _loadingTimeText = timeIndicator.Find("LoadingTimeText").GetComponent <Text>();
                Tooltip.For(
                    timeIndicator,
                    LazyManager <LocaleManager> .Current.Locale.GetString("schedule_stopwatch/task_times_hint")
                    );
            }
            else
            {
                timeIndicator.gameObject.SetActive(false);
            }

            if (settings.ShowIndividualLoadingCapacity)
            {
                _loadingCapIcon        = transform.Find("LoadingCapacityIcon");
                _loadCapacityIndicator = transform.Find("CargoCapacityLoad").GetComponent <CargoCapacityIndicator>();
                _loadCapacityIndicator.Initialize(null, null);

                Tooltip.For(
                    _loadCapacityIndicator,
                    () => GetCapacityTooltipText(),
                    null
                    );
            }

            if (settings.ShowIndividualUnloadingCapacity)
            {
                _unloadCapacityIndicator = transform.Find("CargoCapacityUnload").GetComponent <CargoCapacityIndicator>();
                _unloadingCapIcon        = transform.Find("UnloadingCapacityIcon");
                _unloadCapacityIndicator.Initialize(null, null);

                Tooltip.For(
                    _unloadCapacityIndicator,
                    () => GetCapacityTooltipText(),
                    null
                    );
            }
            transform.gameObject.SetActive(true);
        }
        public void Initialize(StationWindow window)
        {
            Locale locale = LazyManager <LocaleManager> .Current.Locale;

            StationWindow = window;
            OverviewTab   = gameObject.GetComponent <StationWindowOverviewTab>();
            if (OverviewTab == null)
            {
                throw new NullReferenceException("Component StationWindowOverviewTab not found");
            }
            Transform content = base.transform.Find("Body/WindowScrollView").GetComponent <ScrollRect>().content;

            _unloadedContainer = LazyManager <StationWindowLogisticHelper> .Current.CreateItemsContainer(content, locale.GetString("schedule_stopwatch/monthly_unloaded_items").ToUpper(), "UnloadedItems");

            _unloadedContainer.SetSiblingIndex(2);
            _unloadedItemsContainer = _unloadedContainer.Find("Content");
            _unloadedContainerTitle = _unloadedContainer.Find("Label").gameObject.GetComponent <Text>();

            Tooltip.For(
                _unloadedContainerTitle.transform,
                () => LazyManager <StationWindowLogisticHelper> .Current.GetEstimatatedNeededItemsTooltipText(GetEstimatatedNeededItems(), LastTransfers),
                null
                );

            _loadedContainer = LazyManager <StationWindowLogisticHelper> .Current.CreateItemsContainer(content, locale.GetString("schedule_stopwatch/monthly_loaded_items").ToUpper(), "LoadedItems");

            _loadedContainer.SetSiblingIndex(3);
            _loadedItemsContainer = _loadedContainer.Find("Content");
            _loadedContainerTitle = _loadedContainer.Find("Label").gameObject.GetComponent <Text>();

            Tooltip.For(
                _loadedContainerTitle.transform,
                () => LazyManager <StationWindowLogisticHelper> .Current.GetEstimatatedNeededItemsTooltipText(GetEstimatatedNeededItems(), LastTransfers),
                null
                );
            this._offset = Time.unscaledTime;
        }