Esempio n. 1
0
    public string getDescription()
    {
        string txt = "";

        GameObject tree = layers[0].getFirstObject();

        if (tree != null)
        {
            txt += "<b>" + tree.name + "</b>\n";
            AssignedPlant ap = tree.GetComponent <AssignedPlant>();
            if (ap != null)
            {
                txt += "<i>" + ap.get().description + "</i>\n";
            }

            Datable dat = tree.GetComponent <Datable>();
            if (dat != null)
            {
                txt += "Âge : " + dat.getAge() + " ans\n";
            }

            Cuttable cut = tree.GetComponent <Cuttable>();
            if (cut != null)
            {
                txt += "Coupe : " + cut.getCutPrice() + "$\n";
            }

            Uprootable up = tree.GetComponent <Uprootable>();
            if (up != null)
            {
                txt += "Déracinement : " + up.getUprootCost() + "$\n";
            }

            txt += "\n";
        }

        txt += "Humidité : " + getHumidite() + "\n";
        txt += "Luminosité : " + getLuminosite() + "\n";
        txt += "Fertilité : " + getFertilite() + "\n\n";

        txt += "Contient :\n";
        for (int i = 1; i < (int)Layers.NbLayers; ++i)
        {
            txt += layers[i].getTxt();
        }
        return(txt);
    }
Esempio n. 2
0
 public bool uproot()
 {
     for (int i = 0; i < 4; ++i)
     {
         if (objs[i] != null)
         {
             Uprootable u = objs[i].GetComponent <Uprootable>();
             if (u != null)
             {
                 if (u.uproot())
                 {
                     GameObject.Destroy(objs [i]);
                     return(true);
                 }
                 else
                 {
                     return(false);
                 }
             }
         }
     }
     return(false);
 }
Esempio n. 3
0
    private void SetPanels(GameObject target)
    {
        MinionIdentity            component  = target.GetComponent <MinionIdentity>();
        Amounts                   amounts    = target.GetAmounts();
        PrimaryElement            component2 = target.GetComponent <PrimaryElement>();
        BuildingComplete          component3 = target.GetComponent <BuildingComplete>();
        BuildingUnderConstruction component4 = target.GetComponent <BuildingUnderConstruction>();
        CellSelectionObject       component5 = target.GetComponent <CellSelectionObject>();
        InfoDescription           component6 = target.GetComponent <InfoDescription>();
        Edible component7 = target.GetComponent <Edible>();

        attributeLabels.ForEach(delegate(LocText x)
        {
            UnityEngine.Object.Destroy(x.gameObject);
        });
        attributeLabels.Clear();
        vitalsPanel.gameObject.SetActive(amounts != null);
        string text  = string.Empty;
        string text2 = string.Empty;

        if (amounts != null)
        {
            vitalsContainer.selectedEntity = selectedTarget;
            Uprootable component8 = selectedTarget.gameObject.GetComponent <Uprootable>();
            if ((UnityEngine.Object)component8 != (UnityEngine.Object)null)
            {
                vitalsPanel.gameObject.SetActive((UnityEngine.Object)component8.GetPlanterStorage != (UnityEngine.Object)null);
            }
            WiltCondition component9 = selectedTarget.gameObject.GetComponent <WiltCondition>();
            if ((UnityEngine.Object)component9 != (UnityEngine.Object)null)
            {
                vitalsPanel.gameObject.SetActive(true);
            }
        }
        if ((bool)component)
        {
            text = string.Empty;
        }
        else if ((bool)component6)
        {
            text = component6.description;
        }
        else if ((UnityEngine.Object)component3 != (UnityEngine.Object)null)
        {
            text  = component3.Def.Effect;
            text2 = component3.Def.Desc;
        }
        else if ((UnityEngine.Object)component4 != (UnityEngine.Object)null)
        {
            text  = component4.Def.Effect;
            text2 = component4.Def.Desc;
        }
        else if ((UnityEngine.Object)component7 != (UnityEngine.Object)null)
        {
            EdiblesManager.FoodInfo foodInfo = component7.FoodInfo;
            text += string.Format(UI.GAMEOBJECTEFFECTS.CALORIES, GameUtil.GetFormattedCalories(foodInfo.CaloriesPerUnit, GameUtil.TimeSlice.None, true));
        }
        else if ((UnityEngine.Object)component5 != (UnityEngine.Object)null)
        {
            text = component5.element.FullDescription(false);
        }
        else if ((UnityEngine.Object)component2 != (UnityEngine.Object)null)
        {
            Element element = ElementLoader.FindElementByHash(component2.ElementID);
            text = ((element == null) ? string.Empty : element.FullDescription(false));
        }
        List <Descriptor> gameObjectEffects = GameUtil.GetGameObjectEffects(target, true);
        bool flag = gameObjectEffects.Count > 0;

        descriptionContainer.gameObject.SetActive(flag);
        descriptionContainer.descriptors.gameObject.SetActive(flag);
        if (flag)
        {
            descriptionContainer.descriptors.SetDescriptors(gameObjectEffects);
        }
        descriptionContainer.description.text = text;
        descriptionContainer.flavour.text     = text2;
        infoPanel.gameObject.SetActive((UnityEngine.Object)component == (UnityEngine.Object)null);
        descriptionContainer.gameObject.SetActive(infoPanel.activeSelf);
        descriptionContainer.flavour.gameObject.SetActive(text2 != string.Empty && text2 != "\n");
        if (vitalsPanel.gameObject.activeSelf && amounts.Count == 0)
        {
            vitalsPanel.gameObject.SetActive(false);
        }
    }
Esempio n. 4
0
 /// <summary>
 /// Applied before OnCompleteWork runs.
 /// </summary>
 internal static void Prefix(Uprootable __instance, Worker worker)
 {
     MarkDirection(__instance, worker);
 }
 private void UpdateState(object data)
 {
     requestSelectedEntityBtn.ClearOnClick();
     if (!((Object)targetReceptacle == (Object)null))
     {
         if (CheckReceptacleOccupied())
         {
             Uprootable uprootable = targetReceptacle.Occupant.GetComponent <Uprootable>();
             if ((Object)uprootable != (Object)null && uprootable.IsMarkedForUproot)
             {
                 requestSelectedEntityBtn.onClick += delegate
                 {
                     uprootable.ForceCancelUproot(null);
                     UpdateState(null);
                 };
                 requestSelectedEntityBtn.GetComponentInChildren <LocText>().text = Strings.Get(requestStringCancelRemove).ToString();
                 requestSelectedEntityBtn.isInteractable = true;
                 subtitleLabel.SetText(string.Format(Strings.Get(subtitleStringAwaitingRemoval).ToString(), targetReceptacle.Occupant.GetProperName()));
             }
             else
             {
                 requestSelectedEntityBtn.onClick += delegate
                 {
                     targetReceptacle.OrderRemoveOccupant();
                     UpdateState(null);
                 };
                 requestSelectedEntityBtn.GetComponentInChildren <LocText>().text = Strings.Get(requestStringRemove).ToString();
                 requestSelectedEntityBtn.isInteractable = true;
                 subtitleLabel.SetText(string.Format(Strings.Get(subtitleStringEntityDeposited).ToString(), targetReceptacle.Occupant.GetProperName()));
             }
             ToggleObjectPicker(false);
             Tag tag = targetReceptacle.Occupant.GetComponent <KSelectable>().PrefabID();
             ConfigureActiveEntity(tag);
             SetResultDescriptions(targetReceptacle.Occupant);
         }
         else if (targetReceptacle.GetActiveRequest != null)
         {
             requestSelectedEntityBtn.onClick += delegate
             {
                 targetReceptacle.CancelActiveRequest();
                 ClearSelection();
                 UpdateAvailableAmounts(null);
                 UpdateState(null);
             };
             requestSelectedEntityBtn.GetComponentInChildren <LocText>().text = Strings.Get(requestStringCancelDeposit).ToString();
             requestSelectedEntityBtn.isInteractable = true;
             ToggleObjectPicker(false);
             ConfigureActiveEntity(targetReceptacle.GetActiveRequest.tags[0]);
             GameObject prefab = Assets.GetPrefab(targetReceptacle.GetActiveRequest.tags[0]);
             if ((Object)prefab != (Object)null)
             {
                 subtitleLabel.SetText(string.Format(Strings.Get(subtitleStringAwaitingDelivery).ToString(), prefab.GetProperName()));
                 SetResultDescriptions(prefab);
             }
         }
         else if ((Object)selectedEntityToggle != (Object)null)
         {
             requestSelectedEntityBtn.onClick += delegate
             {
                 targetReceptacle.CreateOrder(selectedDepositObjectTag);
                 UpdateAvailableAmounts(null);
                 UpdateState(null);
             };
             requestSelectedEntityBtn.GetComponentInChildren <LocText>().text = Strings.Get(requestStringDeposit).ToString();
             targetReceptacle.SetPreview(depositObjectMap[selectedEntityToggle].tag, false);
             bool flag = CanDepositEntity(depositObjectMap[selectedEntityToggle]);
             requestSelectedEntityBtn.isInteractable = flag;
             SetImageToggleState(selectedEntityToggle.toggle, (!flag) ? ImageToggleState.State.DisabledActive : ImageToggleState.State.Active);
             ToggleObjectPicker(true);
             GameObject prefab2 = Assets.GetPrefab(selectedDepositObjectTag);
             if ((Object)prefab2 != (Object)null)
             {
                 subtitleLabel.SetText(string.Format(Strings.Get(subtitleStringAwaitingSelection).ToString(), prefab2.GetProperName()));
                 SetResultDescriptions(prefab2);
             }
         }
         else
         {
             requestSelectedEntityBtn.GetComponentInChildren <LocText>().text = Strings.Get(requestStringDeposit).ToString();
             requestSelectedEntityBtn.isInteractable = false;
             ToggleObjectPicker(true);
         }
         UpdateAvailableAmounts(null);
         UpdateListeners();
     }
 }