Example #1
0
 public void StopButton()
 {
     if (observingPlace != null && observingPlace.IsWorksite())
     {
         var ow = observingPlace as Worksite;
         ow.StopWork(true);
         observingPlace = null;
         SelfShutOff();
     }
 }
Example #2
0
 override public void ShutOff()
 {
     isObserving = false;
     if (observingPlace != null)
     {
         observingPlace.DisabledOnGUI();
         observingPlace = null;
     }
     Building.buildingObserver?.ShutOff();
     gameObject.SetActive(false);
 }
Example #3
0
    public void SetObservingPlace(ILabourable wb)
    {
        if (wb == null)
        {
            SelfShutOff();
            return;
        }
        if (!wb.IsWorksite())
        {
            UIBuildingObserver ub = Building.buildingObserver;
            if (ub == null)
            {
                ub = UIBuildingObserver.InitializeBuildingObserverScript();
            }
            else
            {
                ub.gameObject.SetActive(true);
            }
            ub.SetObservingBuilding(wb as WorkBuilding);
        }
        observingPlace         = wb; isObserving = true;
        showingWorkersCount    = wb.GetWorkersCount();
        showingWorkersMaxCount = wb.GetMaxWorkersCount();

        ignoreWorkersSlider = true;// иначе будет вызывать ивент
        slider.minValue     = 0;
        slider.maxValue     = showingWorkersMaxCount;
        slider.value        = showingWorkersCount;
        ignoreWorkersSlider = false;

        workersCountField.text = showingWorkersCount.ToString() + '/' + showingWorkersMaxCount.ToString();
        workSpeedField.text    = observingPlace.UI_GetInfo();

        workspeedStringEnabled = observingPlace.ShowUIInfo();
        workSpeedField.enabled = workspeedStringEnabled;
        if (observingPlace.IsWorksite())
        {
            actionLabel.enabled = true;
            actionLabel.text    = (observingPlace as Worksite).actionLabel;
            stopButton.SetActive(true);
        }
        else
        {
            actionLabel.enabled = false;
            stopButton.SetActive(false);
        }
        StatusUpdate();
    }