Ejemplo n.º 1
0
 public override UIObserver ShowOnGUI()
 {
     if (buildingObserver == null)
     {
         buildingObserver = UIBuildingObserver.InitializeBuildingObserverScript();
     }
     else
     {
         buildingObserver.gameObject.SetActive(true);
     }
     buildingObserver.SetObservingBuilding(this);
     showOnGUI = true;
     return(buildingObserver);
 }
Ejemplo n.º 2
0
 public override UIObserver ShowOnGUI()
 {
     if (buildingObserver == null)
     {
         buildingObserver = UIBuildingObserver.InitializeBuildingObserverScript();
     }
     else
     {
         buildingObserver.gameObject.SetActive(true);
     }
     nextStageConditionMet = CheckUpgradeCondition();
     buildingObserver.SetObservingBuilding(this);
     showOnGUI = true;
     return(buildingObserver);
 }
Ejemplo n.º 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();
    }
Ejemplo n.º 4
0
    public void SetObservingWorkBuilding(WorkBuilding wb)
    {
        workbuildingMode = true;
        if (wb == null)
        {
            SelfShutOff();
            return;
        }
        UIBuildingObserver ub = Building.buildingObserver;

        if (ub == null)
        {
            ub = UIBuildingObserver.InitializeBuildingObserverScript();
        }
        else
        {
            ub.gameObject.SetActive(true);
        }
        observingWorkbuilding = wb; isObserving = true;
        ub.SetObservingBuilding(observingWorkbuilding);

        showingWorkersCount    = wb.workersCount;
        showingWorkersMaxCount = wb.maxWorkers;
        showingWorkspeed       = wb.GetWorkSpeed();

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

        workersCountField.text = showingWorkersCount.ToString() + '/' + showingWorkersMaxCount.ToString();
        workSpeedField.text    = string.Format("{0:0.00}", showingWorkspeed) + ' ' + Localization.GetPhrase(LocalizedPhrase.PointsSec);

        workspeedStringEnabled = (showingWorkspeed > 0 & observingWorkbuilding.ShowWorkspeed());
        workSpeedField.enabled = workspeedStringEnabled;
        actionLabel.enabled    = false;
        stopButton.SetActive(false);
    }
Ejemplo n.º 5
0
    public void SetObservingWorkBuilding(WorkBuilding wb)
    {
        workbuildingMode = true;
        if (wb == null)
        {
            SelfShutOff();
            return;
        }
        UIBuildingObserver ub = Building.buildingObserver;

        if (ub == null)
        {
            ub = UIBuildingObserver.InitializeBuildingObserverScript();
        }
        else
        {
            ub.gameObject.SetActive(true);
        }
        observingWorkbuilding = wb; isObserving = true;
        ub.SetObservingBuilding(observingWorkbuilding);

        showingWorkersCount    = wb.workersCount;
        showingWorkersMaxCount = wb.maxWorkers;
        showingWorkspeed       = wb.workSpeed;

        slider.minValue        = 0;
        slider.maxValue        = showingWorkersMaxCount;
        slider.value           = showingWorkersCount;
        workersCountField.text = showingWorkersCount.ToString() + '/' + showingWorkersMaxCount.ToString();
        workSpeedField.text    = string.Format("{0:0.00}", showingWorkspeed) + ' ' + Localization.GetPhrase(LocalizedPhrase.PointsSec);

        workSpeedField.enabled = (showingWorkspeed > 0);
        actionLabel.enabled    = false;
        stopButton.SetActive(false);

        STATUS_UPDATE_TIME = 0.5f; timer = STATUS_UPDATE_TIME;
    }
Ejemplo n.º 6
0
 override public UIObserver ShowOnGUI()
 {
     if (buildingObserver == null)
     {
         buildingObserver = UIBuildingObserver.InitializeBuildingObserverScript();
     }
     else
     {
         buildingObserver.gameObject.SetActive(true);
     }
     buildingObserver.SetObservingBuilding(this);
     showOnGUI = true;
     if (GameMaster.layerCutHeight != basement.pos.y)
     {
         if (UIController.current.showLayerCut)
         {
             UIController.current.LayerCutButton();
         }
         GameMaster.layerCutHeight = basement.pos.y;
         basement.myChunk.LayersCut();
         //UI.current.showLayerCutButtons = true;
     }
     return(buildingObserver);
 }
    //отключать слоты артефактов когда нет питания ?

    public void SetObservingMonument(Monument m)
    {
        if (m == null)
        {
            SelfShutOff();
            return;
        }
        else
        {
            if (m != observingMonument)
            {
                observingMonument = m;
                isObserving       = true;
                if (listHolder.activeSelf)
                {
                    listHolder.SetActive(false);
                }
            }
            else
            {
                if (listHolder.activeSelf)
                {
                    PrepareList();
                }
            }

            var bo = Building.buildingObserver;
            if (bo == null)
            {
                bo = UIBuildingObserver.InitializeBuildingObserverScript();
            }
            bo.SetObservingBuilding(m);

            var at = observingMonument.affectionPath;
            affectionIcon.uvRect = Artifact.GetAffectionIconRect(at);
            affectionText.text   = Localization.GetAffectionTitle(at);
            if (observingMonument.artifacts != null)
            {
                //0
                Transform t = slots[0];
                Artifact  a = observingMonument.artifacts[0];
                if (a == null)
                {
                    t.GetChild(SLOT_IMAGE_CHILD_INDEX).gameObject.SetActive(false);
                    t.GetChild(SLOT_TEXT_CHILD_INDEX).gameObject.SetActive(false);
                }
                else
                {
                    var t2 = t.GetChild(SLOT_IMAGE_CHILD_INDEX);
                    t2.GetComponent <RawImage>().texture = a.GetTexture();
                    t2.gameObject.SetActive(true);
                    t2 = t.GetChild(SLOT_TEXT_CHILD_INDEX);
                    t2.GetComponent <Text>().text = '"' + a.name + '"';
                    t2.gameObject.SetActive(true);
                }
                // 1
                t = slots[1]; a = observingMonument.artifacts[1];
                if (a == null)
                {
                    t.GetChild(SLOT_IMAGE_CHILD_INDEX).gameObject.SetActive(false);
                    t.GetChild(SLOT_TEXT_CHILD_INDEX).gameObject.SetActive(false);
                }
                else
                {
                    var t2 = t.GetChild(SLOT_IMAGE_CHILD_INDEX);
                    t2.GetComponent <RawImage>().texture = a.GetTexture();
                    t2.gameObject.SetActive(true);
                    t2 = t.GetChild(SLOT_TEXT_CHILD_INDEX);
                    t2.GetComponent <Text>().text = '"' + a.name + '"';
                    t2.gameObject.SetActive(true);
                }
                // 2
                t = slots[2]; a = observingMonument.artifacts[2];
                if (a == null)
                {
                    t.GetChild(SLOT_IMAGE_CHILD_INDEX).gameObject.SetActive(false);
                    t.GetChild(SLOT_TEXT_CHILD_INDEX).gameObject.SetActive(false);
                }
                else
                {
                    var t2 = t.GetChild(SLOT_IMAGE_CHILD_INDEX);
                    t2.GetComponent <RawImage>().texture = a.GetTexture();
                    t2.gameObject.SetActive(true);
                    t2 = t.GetChild(SLOT_TEXT_CHILD_INDEX);
                    t2.GetComponent <Text>().text = '"' + a.name + '"';
                    t2.gameObject.SetActive(true);
                }
                // 3
                t = slots[3]; a = observingMonument.artifacts[3];
                if (a == null)
                {
                    t.GetChild(SLOT_IMAGE_CHILD_INDEX).gameObject.SetActive(false);
                    t.GetChild(SLOT_TEXT_CHILD_INDEX).gameObject.SetActive(false);
                }
                else
                {
                    var t2 = t.GetChild(SLOT_IMAGE_CHILD_INDEX);
                    t2.GetComponent <RawImage>().texture = a.GetTexture();
                    t2.gameObject.SetActive(true);
                    t2 = t.GetChild(SLOT_TEXT_CHILD_INDEX);
                    t2.GetComponent <Text>().text = '"' + a.name + '"';
                    t2.gameObject.SetActive(true);
                }
            }
            else
            {
                //0
                Transform t = slots[0];
                Artifact  a = observingMonument.artifacts[0];
                t.GetChild(SLOT_IMAGE_CHILD_INDEX).gameObject.SetActive(false);
                t.GetChild(SLOT_TEXT_CHILD_INDEX).gameObject.SetActive(false);
                //1
                t = slots[1];
                a = observingMonument.artifacts[1];
                t.GetChild(SLOT_IMAGE_CHILD_INDEX).gameObject.SetActive(false);
                t.GetChild(SLOT_TEXT_CHILD_INDEX).gameObject.SetActive(false);
                //2
                t = slots[2];
                a = observingMonument.artifacts[2];
                t.GetChild(SLOT_IMAGE_CHILD_INDEX).gameObject.SetActive(false);
                t.GetChild(SLOT_TEXT_CHILD_INDEX).gameObject.SetActive(false);
                //3
                t = slots[3];
                a = observingMonument.artifacts[3];
                t.GetChild(SLOT_IMAGE_CHILD_INDEX).gameObject.SetActive(false);
                t.GetChild(SLOT_TEXT_CHILD_INDEX).gameObject.SetActive(false);
            }
            lastDrawnArtifactsHash = Artifact.listChangesMarkerValue;
        }
    }