コード例 #1
0
 public static void Postfix(BuildingDef __result)
 {
     __result.ThermalConductivity /= 2;
 }
    private void BuildPath()
    {
        ApplyPathToConduitSystem();
        int num = 0;

        for (int i = 0; i < path.Count; i++)
        {
            PathNode           pathNode           = path[i];
            Vector3            vector             = Grid.CellToPosCBC(pathNode.cell, Grid.SceneLayer.Building);
            UtilityConnections utilityConnections = (UtilityConnections)0;
            GameObject         gameObject         = Grid.Objects[pathNode.cell, (int)def.TileLayer];
            if ((Object)gameObject == (Object)null)
            {
                utilityConnections = conduitMgr.GetConnections(pathNode.cell, false);
                if ((DebugHandler.InstantBuildMode || (Game.Instance.SandboxModeActive && SandboxToolParameterMenu.instance.settings.InstantBuild)) && def.IsValidBuildLocation(visualizer, vector, Orientation.Neutral) && def.IsValidPlaceLocation(visualizer, vector, Orientation.Neutral, out string _))
                {
                    BuildingDef buildingDef       = def;
                    int         cell              = pathNode.cell;
                    Orientation orientation       = Orientation.Neutral;
                    Storage     resource_storage  = null;
                    IList <Tag> selected_elements = selectedElements;
                    float       temperature       = 293.15f;
                    float       time              = GameClock.Instance.GetTime();
                    gameObject = buildingDef.Build(cell, orientation, resource_storage, selected_elements, temperature, true, time);
                }
                else
                {
                    gameObject = def.TryPlace(null, vector, Orientation.Neutral, selectedElements, 0);
                    if ((Object)gameObject != (Object)null)
                    {
                        if (!def.MaterialsAvailable(selectedElements) && !DebugHandler.InstantBuildMode)
                        {
                            PopFXManager.Instance.SpawnFX(PopFXManager.Instance.sprite_Resource, UI.TOOLTIPS.NOMATERIAL, null, vector, 1.5f, false, false);
                        }
                        Constructable component = gameObject.GetComponent <Constructable>();
                        if (component.IconConnectionAnimation(0.1f * (float)num, num, "Wire", "OutletConnected_release") || component.IconConnectionAnimation(0.1f * (float)num, num, "Pipe", "OutletConnected_release"))
                        {
                            num++;
                        }
                        Prioritizable component2 = gameObject.GetComponent <Prioritizable>();
                        if ((Object)component2 != (Object)null)
                        {
                            if ((Object)BuildMenu.Instance != (Object)null)
                            {
                                component2.SetMasterPriority(BuildMenu.Instance.GetBuildingPriority());
                            }
                            if ((Object)PlanScreen.Instance != (Object)null)
                            {
                                component2.SetMasterPriority(PlanScreen.Instance.GetBuildingPriority());
                            }
                        }
                    }
                }
            }
            else
            {
                IUtilityItem component3 = gameObject.GetComponent <KAnimGraphTileVisualizer>();
                if (component3 != null)
                {
                    utilityConnections = component3.Connections;
                }
                utilityConnections |= conduitMgr.GetConnections(pathNode.cell, false);
                if ((Object)gameObject.GetComponent <BuildingComplete>() != (Object)null)
                {
                    component3.UpdateConnections(utilityConnections);
                }
            }
            if (def.ReplacementLayer != ObjectLayer.NumLayers && !DebugHandler.InstantBuildMode && (!Game.Instance.SandboxModeActive || !SandboxToolParameterMenu.instance.settings.InstantBuild) && def.IsValidBuildLocation(null, vector, Orientation.Neutral))
            {
                GameObject gameObject2 = Grid.Objects[pathNode.cell, (int)def.TileLayer];
                GameObject x           = Grid.Objects[pathNode.cell, (int)def.ReplacementLayer];
                if ((Object)gameObject2 != (Object)null && (Object)x == (Object)null)
                {
                    BuildingComplete component4 = gameObject2.GetComponent <BuildingComplete>();
                    if ((Object)component4 != (Object)null && (Object)component4.Def != (Object)def)
                    {
                        Constructable component5 = def.BuildingUnderConstruction.GetComponent <Constructable>();
                        component5.IsReplacementTile = true;
                        gameObject = def.Instantiate(vector, Orientation.Neutral, selectedElements, 0);
                        component5.IsReplacementTile = false;
                        if (!def.MaterialsAvailable(selectedElements) && !DebugHandler.InstantBuildMode)
                        {
                            PopFXManager.Instance.SpawnFX(PopFXManager.Instance.sprite_Resource, UI.TOOLTIPS.NOMATERIAL, null, vector, 1.5f, false, false);
                        }
                        Grid.Objects[pathNode.cell, (int)def.ReplacementLayer] = gameObject;
                        IUtilityItem component6 = gameObject.GetComponent <KAnimGraphTileVisualizer>();
                        if (component6 != null)
                        {
                            utilityConnections = component6.Connections;
                        }
                        utilityConnections |= conduitMgr.GetConnections(pathNode.cell, false);
                        if ((Object)gameObject.GetComponent <BuildingComplete>() != (Object)null)
                        {
                            component6.UpdateConnections(utilityConnections);
                        }
                        string visualizerString = conduitMgr.GetVisualizerString(utilityConnections);
                        string text             = visualizerString;
                        if (gameObject.GetComponent <KBatchedAnimController>().HasAnimation(visualizerString + "_place"))
                        {
                            text += "_place";
                        }
                        Play(gameObject, text);
                    }
                }
            }
            if ((Object)gameObject != (Object)null)
            {
                IUtilityItem component7 = gameObject.GetComponent <KAnimGraphTileVisualizer>();
                if (component7 != null)
                {
                    component7.Connections = utilityConnections;
                }
            }
            TileVisualizer.RefreshCell(pathNode.cell, def.TileLayer, def.ReplacementLayer);
        }
        ResourceRemainingDisplayScreen.instance.SetNumberOfPendingConstructions(0);
    }
コード例 #3
0
        private static bool RegisterBuilding(BuildingConfigManager __instance, IBuildingConfig config, BuildingDef buildingDef)
        {
            //Debug.Log(config.CreateBuildingDef().PrefabID);
            if (!Helper.Config.Enabled)
            {
                return(true);
            }

            Helper.Log(" === [BuildingModifier] BuildingModifierMod_BuildingConfigManager_RegisterBuilding Prefix === ");

            //CreateBuildingDef
            //BuildingDef buildingDef = config.CreateBuildingDef();
            // Check if there is a config for the current building
            if (!Helper.Config.Modifiers.ContainsKey(buildingDef.PrefabID))
            {
                Helper.Log(" === [BuildingModifier] Ignoring: " + buildingDef.PrefabID);
                return(true);
            }

            Debug.Log(" === [BuildingModifier] Processing: " + buildingDef.PrefabID);

            Helper.Process("CreateBuildingDef", buildingDef, null);
            buildingDef.GenerateOffsets();  // Remake the offsets after modification


            // Create gameobject
            //configTable[config] = buildingDef;
            ((Dictionary <IBuildingConfig, BuildingDef>)configTableF.GetValue(__instance))[config] = buildingDef;
            //GameObject gameObject = Object.Instantiate(baseTemplate);
            GameObject gameObject = UnityEngine.Object.Instantiate((GameObject)baseTemplateF.GetValue(__instance));

            UnityEngine.Object.DontDestroyOnLoad(gameObject);
            gameObject.GetComponent <KPrefabID>().PrefabTag = buildingDef.Tag;
            gameObject.name = buildingDef.PrefabID + "Template";
            gameObject.GetComponent <Building>().Def = buildingDef;
            gameObject.GetComponent <OccupyArea>().OccupiedCellsOffsets = buildingDef.PlacementOffsets;
            if (buildingDef.Deprecated)
            {
                gameObject.GetComponent <KPrefabID>().AddTag(GameTags.DeprecatedContent);
            }

            //ConfigureBuildingTemplate
            config.ConfigureBuildingTemplate(gameObject, buildingDef.Tag);
            Helper.Process("ConfigureBuildingTemplate", buildingDef, gameObject, Helper.BuildingType.Building);

            //ConfigureBuildingTemplate
            buildingDef.BuildingComplete = BuildingLoader.Instance.CreateBuildingComplete(gameObject, buildingDef);
            Helper.Process("CreateBuildingComplete", buildingDef, gameObject, Helper.BuildingType.Building);

            bool flag = true;

            //for (int i = 0; i < NonBuildableBuildings.Length; i++)
            for (int i = 0; i < ((string[])NonBuildableBuildingsF.GetValue(__instance)).Length; i++)
            {
                //if (buildingDef.PrefabID == NonBuildableBuildings[i])
                if (buildingDef.PrefabID == ((string[])NonBuildableBuildingsF.GetValue(__instance))[i])
                {
                    flag = false;
                    break;
                }
            }

            // Previews
            if (flag)
            {
                buildingDef.BuildingUnderConstruction      = BuildingLoader.Instance.CreateBuildingUnderConstruction(buildingDef);
                buildingDef.BuildingUnderConstruction.name = BuildingConfigManager.GetUnderConstructionName(buildingDef.BuildingUnderConstruction.name);
                buildingDef.BuildingPreview       = BuildingLoader.Instance.CreateBuildingPreview(buildingDef);
                buildingDef.BuildingPreview.name += "Preview";
            }

            buildingDef.PostProcess();

            // Try to avoid errors if the gameobject doesn't have RequiereInputs

            /*
             * if (gameObject.GetComponent<RequireInputs>() == null)
             *  gameObject.AddOrGet<RequireInputs>();
             */

            //DoPostConfigureComplete
            config.DoPostConfigureComplete(buildingDef.BuildingComplete);
            Helper.Process("DoPostConfigureComplete", buildingDef, gameObject, Helper.BuildingType.BuildingComplete);

            // Previews
            if (flag)
            {
                config.DoPostConfigurePreview(buildingDef, buildingDef.BuildingPreview);
                Helper.Process("DoPostConfigurePreview", buildingDef, gameObject, Helper.BuildingType.BuildingPreview);


                config.DoPostConfigureUnderConstruction(buildingDef.BuildingUnderConstruction);
                Helper.Process("DoPostConfigureUnderConstruction", buildingDef, gameObject, Helper.BuildingType.BuildingUnderConstruction);
            }

            Assets.AddBuildingDef(buildingDef);

            return(false);
        }
コード例 #4
0
ファイル: FestiveSculptures.cs プロジェクト: romen-h/ONI-Mods
 public static void Postfix(BuildingDef __result)
 {
     Util.ReplaceAnim(__result, "sculpture_marble");
 }
コード例 #5
0
 public static void Postfix([NotNull] ref BuildingDef __result)
 {
     __result.OverheatTemperature = OVERHEAT_TEMP;
 }
コード例 #6
0
 public void RefreshBuildingButton(BuildingDef def, KToggle toggle, HashedString buildingCategory)
 {
     if (!((UnityEngine.Object)toggle == (UnityEngine.Object)null))
     {
         if (GetToggleEntryForCategory(buildingCategory, out ToggleEntry toggleEntry) && toggleEntry.pendingResearchAttentions.Contains(def.Tag))
         {
             toggle.GetComponent <PlanCategoryNotifications>().ToggleAttention(true);
         }
         TechItem techItem = Db.Get().TechItems.TryGet(def.PrefabID);
         bool     flag     = TechRequirementsMet(techItem);
         bool     flag2    = TechRequirementsUpcoming(techItem);
         if (toggle.gameObject.activeSelf != flag2)
         {
             toggle.gameObject.SetActive(flag2);
             ConfigurePanelSize();
             SetScrollPoint(0f);
         }
         if (toggle.gameObject.activeInHierarchy && !((UnityEngine.Object)toggle.bgImage == (UnityEngine.Object)null))
         {
             Image  image    = toggle.bgImage.GetComponentsInChildren <Image>()[1];
             Sprite uISprite = def.GetUISprite("ui", false);
             if ((UnityEngine.Object)uISprite == (UnityEngine.Object)null)
             {
                 uISprite = defaultBuildingIconSprite;
             }
             image.sprite = uISprite;
             image.SetNativeSize();
             image.rectTransform().sizeDelta /= 4f;
             ToolTip component = toggle.gameObject.GetComponent <ToolTip>();
             PositionTooltip(toggle, component);
             component.ClearMultiStringTooltip();
             string name   = def.Name;
             string effect = def.Effect;
             component.AddMultiStringTooltip(name, buildingToolTipSettings.BuildButtonName);
             component.AddMultiStringTooltip(effect, buildingToolTipSettings.BuildButtonDescription);
             LocText componentInChildren = toggle.GetComponentInChildren <LocText>();
             if ((UnityEngine.Object)componentInChildren != (UnityEngine.Object)null)
             {
                 componentInChildren.text = def.Name;
             }
             ImageToggleState.State state = (BuildableState(def) == RequirementsState.Complete) ? ImageToggleState.State.Inactive : ImageToggleState.State.Disabled;
             state = ((!((UnityEngine.Object)toggle.gameObject == (UnityEngine.Object)selectedBuildingGameObject) || (BuildableState(def) != RequirementsState.Complete && !DebugHandler.InstantBuildMode && !Game.Instance.SandboxModeActive)) ? ((BuildableState(def) == RequirementsState.Complete || DebugHandler.InstantBuildMode || Game.Instance.SandboxModeActive) ? ImageToggleState.State.Inactive : ImageToggleState.State.Disabled) : ImageToggleState.State.Active);
             if ((UnityEngine.Object)toggle.gameObject == (UnityEngine.Object)selectedBuildingGameObject && state == ImageToggleState.State.Disabled)
             {
                 state = ImageToggleState.State.DisabledActive;
             }
             else if (state == ImageToggleState.State.Disabled)
             {
                 state = ImageToggleState.State.Disabled;
             }
             toggle.GetComponent <ImageToggleState>().SetState(state);
             Material material = (BuildableState(def) != RequirementsState.Complete && !DebugHandler.InstantBuildMode && !Game.Instance.SandboxModeActive) ? desaturatedUIMaterial : defaultUIMaterial;
             if ((UnityEngine.Object)image.material != (UnityEngine.Object)material)
             {
                 image.material = material;
                 if ((UnityEngine.Object)material == (UnityEngine.Object)desaturatedUIMaterial)
                 {
                     if (flag)
                     {
                         image.color = new Color(1f, 1f, 1f, 0.6f);
                     }
                     else
                     {
                         image.color = new Color(1f, 1f, 1f, 0.15f);
                     }
                 }
                 else
                 {
                     image.color = Color.white;
                 }
             }
             Image fgImage = toggle.gameObject.GetComponent <KToggle>().fgImage;
             fgImage.gameObject.SetActive(false);
             if (!flag)
             {
                 fgImage.sprite = Overlay_NeedTech;
                 fgImage.gameObject.SetActive(true);
                 string newString = string.Format(UI.PRODUCTINFO_REQUIRESRESEARCHDESC, techItem.parentTech.Name);
                 component.AddMultiStringTooltip("\n", buildingToolTipSettings.ResearchRequirement);
                 component.AddMultiStringTooltip(newString, buildingToolTipSettings.ResearchRequirement);
             }
             else if (BuildableState(def) != RequirementsState.Complete)
             {
                 fgImage.gameObject.SetActive(false);
                 component.AddMultiStringTooltip("\n", buildingToolTipSettings.ResearchRequirement);
                 string newString2 = UI.PRODUCTINFO_MISSINGRESOURCES_HOVER;
                 component.AddMultiStringTooltip(newString2, buildingToolTipSettings.ResearchRequirement);
                 foreach (Recipe.Ingredient ingredient in def.CraftRecipe.Ingredients)
                 {
                     string newString3 = string.Format("{0}{1}: {2}", "• ", ingredient.tag.ProperName(), GameUtil.GetFormattedMass(ingredient.amount, GameUtil.TimeSlice.None, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.#}"));
                     component.AddMultiStringTooltip(newString3, buildingToolTipSettings.ResearchRequirement);
                 }
                 component.AddMultiStringTooltip(string.Empty, buildingToolTipSettings.ResearchRequirement);
             }
         }
     }
 }
コード例 #7
0
 public override void DoPostConfigurePreview(BuildingDef def, GameObject go)
 {
     GeneratedBuildings.RegisterLogicPorts(go, null, OUTPUT_PORTS);
 }
コード例 #8
0
 public List <Descriptor> GetDescriptors(BuildingDef def)
 {
     return(GetDescriptors(def.BuildingComplete));
 }
コード例 #9
0
 public override void DoPostConfigurePreview(BuildingDef def, GameObject go)
 {
     GeneratedBuildings.RegisterLogicPorts(go, TileTemperatureSensorConfig.OUTPUT_PORT);
 }
コード例 #10
0
ファイル: FestiveLights.cs プロジェクト: romen-h/ONI-Mods
 public static void Postfix(BuildingDef __result)
 {
     Util.ReplaceAnim(__result, "ceilinglight");
 }
コード例 #11
0
ファイル: FestiveLights.cs プロジェクト: romen-h/ONI-Mods
 public static void Postfix(BuildingDef __result)
 {
     Util.ReplaceAnim(__result, "floorlamp");
 }
コード例 #12
0
 /// <summary>
 /// Removes the cached building def so it can be garbage collected if needed.
 /// </summary>
 public void ClearDef()
 {
     Def = null;
 }
コード例 #13
0
 public BuildThermalTooltip()
 {
     Def = null;
 }
コード例 #14
0
 public static void Postfix(BuildingDef __result)
 {
     __result.EnergyConsumptionWhenActive = 240f;
 }
コード例 #15
0
 public override void DoPostConfigurePreview(BuildingDef def, GameObject go)
 {
     VacuumPump?.CreateLogicPorts(go);
 }
コード例 #16
0
 static void Postfix(BuildingDef __result)
 {
     GenericPatch.CreateBuildingDef(__result, Options.Opts.GasPermeableMembrane);
 }
コード例 #17
0
    private void GetBuildableStates(bool force_update)
    {
        if (Assets.BuildingDefs != null && Assets.BuildingDefs.Count != 0)
        {
            if (timeSinceNotificationPing < specialNotificationEmbellishDelay)
            {
                timeSinceNotificationPing += Time.unscaledDeltaTime;
            }
            if (timeSinceNotificationPing >= notificationPingExpire)
            {
                notificationPingCount = 0;
            }
            int num = 10;
            if (force_update)
            {
                num = Assets.BuildingDefs.Count;
                buildable_state_update_idx = 0;
            }
            ListPool <HashedString, PlanScreen> .PooledList pooledList = ListPool <HashedString, PlanScreen> .Allocate();

            for (int i = 0; i < num; i++)
            {
                buildable_state_update_idx = (buildable_state_update_idx + 1) % Assets.BuildingDefs.Count;
                BuildingDef buildingDef = Assets.BuildingDefs[buildable_state_update_idx];
                if (!buildingDef.Deprecated && tagCategoryMap.TryGetValue(buildingDef.Tag, out HashedString value))
                {
                    RequirementsState requirementsState = RequirementsState.Complete;
                    if (!DebugHandler.InstantBuildMode && !Game.Instance.SandboxModeActive)
                    {
                        if (!Db.Get().TechItems.IsTechItemComplete(buildingDef.PrefabID))
                        {
                            requirementsState = RequirementsState.Tech;
                        }
                        else if (!ProductInfoScreen.MaterialsMet(buildingDef.CraftRecipe))
                        {
                            requirementsState = RequirementsState.Materials;
                        }
                    }
                    if (!buildableDefs.ContainsKey(buildingDef))
                    {
                        buildableDefs.Add(buildingDef, requirementsState);
                    }
                    else if (buildableDefs[buildingDef] != requirementsState)
                    {
                        buildableDefs[buildingDef] = requirementsState;
                        if ((UnityEngine.Object)productInfoScreen.currentDef == (UnityEngine.Object)buildingDef)
                        {
                            ignoreToolChangeMessages++;
                            productInfoScreen.ClearProduct(false);
                            productInfoScreen.Show(true);
                            productInfoScreen.ConfigureScreen(buildingDef);
                            ignoreToolChangeMessages--;
                        }
                        if (requirementsState == RequirementsState.Complete)
                        {
                            foreach (ToggleInfo item in toggleInfo)
                            {
                                HashedString x = (HashedString)item.userData;
                                if (x == value)
                                {
                                    string   text      = "NotificationPing";
                                    Animator component = item.toggle.GetComponent <Animator>();
                                    if (!component.GetCurrentAnimatorStateInfo(0).IsTag(text) && !pooledList.Contains(value))
                                    {
                                        pooledList.Add(value);
                                        item.toggle.gameObject.GetComponent <Animator>().Play(text);
                                        if (KTime.Instance.UnscaledGameTime - initTime > 1.5f)
                                        {
                                            if (timeSinceNotificationPing >= specialNotificationEmbellishDelay)
                                            {
                                                string sound = GlobalAssets.GetSound("NewBuildable_Embellishment", false);
                                                if (sound != null)
                                                {
                                                    EventInstance instance = SoundEvent.BeginOneShot(sound, SoundListenerController.Instance.transform.GetPosition());
                                                    SoundEvent.EndOneShot(instance);
                                                }
                                            }
                                            string sound2 = GlobalAssets.GetSound("NewBuildable", false);
                                            if (sound2 != null)
                                            {
                                                EventInstance instance2 = SoundEvent.BeginOneShot(sound2, SoundListenerController.Instance.transform.GetPosition());
                                                instance2.setParameterValue("playCount", (float)notificationPingCount);
                                                SoundEvent.EndOneShot(instance2);
                                            }
                                        }
                                        timeSinceNotificationPing = 0f;
                                        notificationPingCount++;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            pooledList.Recycle();
        }
    }
コード例 #18
0
 static void Postfix(BuildingDef __result)
 {
     GenericPatch.CreateBuildingDef(__result, Options.Opts.GlassTile);
 }
コード例 #19
0
 public override void DoPostConfigurePreview(BuildingDef def, GameObject go)
 {
     AddVisualizer(go, true);
 }
 public override void DoPostConfigurePreview(BuildingDef def, GameObject go)
 {
     this.AttachPort(go);
 }
コード例 #21
0
 public static void Postfix([NotNull] ref BuildingDef __result)
 {
     __result.BuildLocationRule           = BuildLocationRule.Tile;
     __result.ContinuouslyCheckFoundation = false;
 }
コード例 #22
0
    public void CreateDropdown(Vector3 localPosition, float w, float h, string surfaceType)
    {
        // Create the button
        actionDropdown               = UIElementFunctions.Dropdown(panel, null, "Surface Actions", localPosition, new Vector2(w, h));
        actionDropdown.childHeight   = 30;
        actionDropdown.childFontSize = 16;

        // Demolish
        actionDropdown.AddChild();
        actionDropdown.children[0].textGo.text = "Demolish";
        actionDropdown.children[0].buttonGo.onClick.AddListener(() => demolishCallback("Demolish"));
        actionDropdown.children[0].CloseButton();

        // Upgrades
        int menuInd = actionDropdown.children.Count;

        actionDropdown.AddChild();
        actionDropdown.children[menuInd].textGo.text = "Upgrade";
        //actionDropdown.children[upgradeInd].buttonGo.interactable = false;
        actionDropdown.children[menuInd].CloseButton();

        //Debug.Log(surfaceType);
        IEnumerable <BuildingDef> upgrades = BuildingQueries.ByParent(ManagerBase.buildingDefinitions, surfaceType);
        int ind = 0;

        foreach (BuildingDef def in upgrades)
        {
            actionDropdown.children[menuInd].AddChild();
            actionDropdown.children[menuInd].children[ind].textGo.text = def.name + " (Tier " + def.tier + ")";
            Debug.Log(actionDropdown.children[menuInd].children[ind].textGo.text);
            actionDropdown.children[menuInd].children[ind].buttonGo.onClick.AddListener(() => buildCallback(def.name));
            actionDropdown.children[menuInd].children[ind].CloseButton();
            ind++;
        }

        // Jobs
        if (ManagerBase.buildingIndexOf.ContainsKey(surfaceType))
        {
            menuInd++;

            BuildingDef bldgDef = ManagerBase.buildingDefinitions[ManagerBase.buildingIndexOf[surfaceType]];

            List <JobDef> jobs = new List <JobDef>();

            for (int jeInd = 0; jeInd < bldgDef.jobsEnabled.Count; jeInd++)
            {
                jobs.AddRange(JobQueries.ByNameAndMaxTier(ManagerBase.jobDefinitions, bldgDef.jobsEnabled[jeInd], bldgDef.jobMaxTier[bldgDef.jobsEnabled[jeInd]]));
            }

            Debug.Log(jobs.Count());

            if (jobs.Count() > 0)
            {
                actionDropdown.AddChild();
                actionDropdown.children[menuInd].textGo.text           = "Start Job";
                actionDropdown.children[menuInd].buttonGo.interactable = false;
                actionDropdown.children[menuInd].CloseButton();
                actionDropdown.children[menuInd].Init();

                ind = 0;
                foreach (JobDef job in jobs)
                {
                    string jobString = job.name + " (" + job.outputName[0] + ")";
                    actionDropdown.children[menuInd].AddChild();
                    actionDropdown.children[menuInd].children[ind].textGo.text = jobString;
                    actionDropdown.children[menuInd].children[ind].buttonGo.onClick.AddListener(() => newJobCallback(job.guid));
                    actionDropdown.children[menuInd].children[ind].CloseButton();
                    ind++;
                }
            }
        }
    }
コード例 #23
0
 public override void DoPostConfigurePreview(BuildingDef def, GameObject go)
 {
     GeneratedBuildings.RegisterLogicPorts(go, OutputPort);
 }
コード例 #24
0
 public override void DoPostConfigurePreview(BuildingDef def, GameObject go)
 {
 }
コード例 #25
0
 public override void DoPostConfigurePreview(BuildingDef def, GameObject go)
 {
     base.DoPostConfigurePreview(def, go);
     AddNetworkLink(go).visualizeOnly = true;
     go.AddOrGet <BuildingCellVisualizer>();
 }
コード例 #26
0
ファイル: Patches.cs プロジェクト: v-limc/oni-mods
 public static void Postfix(BuildingDef __result)
 {
     __result.PermittedRotations = PermittedRotations.R360;
     __result.BuildLocationRule  = BuildLocationRule.OnFloorOrBuildingAttachPoint;
 }
コード例 #27
0
 public override void DoPostConfigurePreview(BuildingDef def, GameObject go)
 {
     GeneratedBuildings.RegisterLogicPorts(go, LogicOperationalController.INPUT_PORTS_0_1);
 }
コード例 #28
0
 private void SetDescription(BuildingDef def)
 {
     if (!((UnityEngine.Object)def == (UnityEngine.Object)null) && !((UnityEngine.Object)productFlavourText == (UnityEngine.Object)null))
     {
         string text = def.Desc;
         Dictionary <Klei.AI.Attribute, float> dictionary  = new Dictionary <Klei.AI.Attribute, float>();
         Dictionary <Klei.AI.Attribute, float> dictionary2 = new Dictionary <Klei.AI.Attribute, float>();
         foreach (Klei.AI.Attribute attribute in def.attributes)
         {
             if (!dictionary.ContainsKey(attribute))
             {
                 dictionary[attribute] = 0f;
             }
         }
         foreach (AttributeModifier attributeModifier in def.attributeModifiers)
         {
             float             value = 0f;
             Klei.AI.Attribute key   = Db.Get().BuildingAttributes.Get(attributeModifier.AttributeId);
             dictionary.TryGetValue(key, out value);
             value = (dictionary[key] = value + attributeModifier.Value);
         }
         if (materialSelectionPanel.CurrentSelectedElement != (Tag)null)
         {
             Element element = ElementLoader.GetElement(materialSelectionPanel.CurrentSelectedElement);
             if (element != null)
             {
                 foreach (AttributeModifier attributeModifier2 in element.attributeModifiers)
                 {
                     float             value2 = 0f;
                     Klei.AI.Attribute key2   = Db.Get().BuildingAttributes.Get(attributeModifier2.AttributeId);
                     dictionary2.TryGetValue(key2, out value2);
                     value2 = (dictionary2[key2] = value2 + attributeModifier2.Value);
                 }
             }
             else
             {
                 GameObject gameObject = Assets.TryGetPrefab(materialSelectionPanel.CurrentSelectedElement);
                 PrefabAttributeModifiers component = gameObject.GetComponent <PrefabAttributeModifiers>();
                 if ((UnityEngine.Object)component != (UnityEngine.Object)null)
                 {
                     foreach (AttributeModifier descriptor in component.descriptors)
                     {
                         float             value3 = 0f;
                         Klei.AI.Attribute key3   = Db.Get().BuildingAttributes.Get(descriptor.AttributeId);
                         dictionary2.TryGetValue(key3, out value3);
                         value3 = (dictionary2[key3] = value3 + descriptor.Value);
                     }
                 }
             }
         }
         if (dictionary.Count > 0)
         {
             text += "\n\n";
             foreach (KeyValuePair <Klei.AI.Attribute, float> item in dictionary)
             {
                 float value4 = 0f;
                 dictionary.TryGetValue(item.Key, out value4);
                 float  value5 = 0f;
                 string text2  = string.Empty;
                 if (dictionary2.TryGetValue(item.Key, out value5))
                 {
                     value5 = Mathf.Abs(value4 * value5);
                     text2  = "(+" + value5 + ")";
                 }
                 string text3 = text;
                 text = text3 + "\n" + item.Key.Name + ": " + (value4 + value5) + text2;
             }
         }
         productFlavourText.text = text;
     }
 }
 public static void Postfix(ref BuildingDef __result)
 {
     AddLogicPort(ref __result);
 }
コード例 #30
0
 public override void DoPostConfigurePreview(BuildingDef def, GameObject go)
 {
     GeneratedBuildings.RegisterLogicPorts(go, InverseElectrolyzerAltConfig.INPUT_PORTS);
     this.AttachPort(go);
 }