Пример #1
0
 public EmoteReactable(GameObject gameObject, HashedString id, ChoreType chore_type, HashedString animset, int range_width = 15, int range_height = 8, float min_reactable_time = 0f, float min_reactor_time = 20f, float max_trigger_time = float.PositiveInfinity)
     : base(gameObject, id, chore_type, range_width, range_height, true, min_reactable_time, min_reactor_time, max_trigger_time)
 {
     this.animset = Assets.GetAnim(animset);
 }
Пример #2
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();
        }
    }
Пример #3
0
 private void DoCallBack(HashedString name)
 {
     controller.onAnimComplete -= DoCallBack;
     readyForSaveCallback();
     readyForSaveCallback = null;
 }
Пример #4
0
 private static ProxiesByNameRecord _MakeProxiesByName(HashedString key, MemberReference mr)
 {
     return(new ProxiesByNameRecord());
 }
Пример #5
0
 public void OnOverlayChange(HashedString mode)
 {
     base.GetComponent <KBatchedAnimController>().TintColour = color;
 }
    public override void UpdateHoverElements(List <KSelectable> hoverObjects)
    {
        HoverTextScreen instance        = HoverTextScreen.Instance;
        HoverTextDrawer hoverTextDrawer = instance.BeginDrawing();

        hoverTextDrawer.BeginShadowBar(false);
        ActionName = ((!((UnityEngine.Object)currentDef != (UnityEngine.Object)null) || !currentDef.DragBuild) ? UI.TOOLS.BUILD.TOOLACTION : UI.TOOLS.BUILD.TOOLACTION_DRAG);
        if ((UnityEngine.Object)currentDef != (UnityEngine.Object)null && currentDef.Name != null)
        {
            ToolName = string.Format(UI.TOOLS.BUILD.NAME, currentDef.Name);
        }
        DrawTitle(instance, hoverTextDrawer);
        DrawInstructions(instance, hoverTextDrawer);
        int cell       = Grid.PosToCell(Camera.main.ScreenToWorldPoint(KInputManager.GetMousePos()));
        int min_height = 26;
        int width      = 8;

        if ((UnityEngine.Object)currentDef != (UnityEngine.Object)null)
        {
            Orientation orientation = Orientation.Neutral;
            if ((UnityEngine.Object)PlayerController.Instance.ActiveTool != (UnityEngine.Object)null)
            {
                Type type = PlayerController.Instance.ActiveTool.GetType();
                if (typeof(BuildTool).IsAssignableFrom(type) || typeof(BaseUtilityBuildTool).IsAssignableFrom(type))
                {
                    if ((UnityEngine.Object)currentDef.BuildingComplete.GetComponent <Rotatable>() != (UnityEngine.Object)null)
                    {
                        hoverTextDrawer.NewLine(min_height);
                        hoverTextDrawer.AddIndent(width);
                        string text = UI.TOOLTIPS.HELP_ROTATE_KEY.ToString();
                        text = text.Replace("{Key}", GameUtil.GetActionString(Action.RotateBuilding));
                        hoverTextDrawer.DrawText(text, Styles_Instruction.Standard);
                    }
                    orientation = BuildTool.Instance.GetBuildingOrientation;
                    string  fail_reason = "Unknown reason";
                    Vector3 pos         = Grid.CellToPosCCC(cell, Grid.SceneLayer.Building);
                    if (!currentDef.IsValidPlaceLocation(BuildTool.Instance.visualizer, pos, orientation, out fail_reason))
                    {
                        hoverTextDrawer.NewLine(min_height);
                        hoverTextDrawer.AddIndent(width);
                        hoverTextDrawer.DrawText(fail_reason, HoverTextStyleSettings[1]);
                    }
                    RoomTracker component = currentDef.BuildingComplete.GetComponent <RoomTracker>();
                    if ((UnityEngine.Object)component != (UnityEngine.Object)null && !component.SufficientBuildLocation(cell))
                    {
                        hoverTextDrawer.NewLine(min_height);
                        hoverTextDrawer.AddIndent(width);
                        hoverTextDrawer.DrawText(UI.TOOLTIPS.HELP_REQUIRES_ROOM, HoverTextStyleSettings[1]);
                    }
                }
            }
            hoverTextDrawer.NewLine(min_height);
            hoverTextDrawer.AddIndent(width);
            hoverTextDrawer.DrawText(ResourceRemainingDisplayScreen.instance.GetString(), Styles_BodyText.Standard);
            hoverTextDrawer.EndShadowBar();
            HashedString mode = SimDebugView.Instance.GetMode();
            if (mode == OverlayModes.Logic.ID && hoverObjects != null)
            {
                SelectToolHoverTextCard component2 = SelectTool.Instance.GetComponent <SelectToolHoverTextCard>();
                foreach (KSelectable hoverObject in hoverObjects)
                {
                    LogicPorts component3 = hoverObject.GetComponent <LogicPorts>();
                    if ((UnityEngine.Object)component3 != (UnityEngine.Object)null && component3.TryGetPortAtCell(cell, out LogicPorts.Port port, out bool isInput))
                    {
                        bool flag = component3.IsPortConnected(port.id);
                        hoverTextDrawer.BeginShadowBar(false);
                        int num;
                        if (isInput)
                        {
                            string replacement = (!port.displayCustomName) ? UI.LOGIC_PORTS.PORT_INPUT_DEFAULT_NAME.text : port.description;
                            num = component3.GetInputValue(port.id);
                            hoverTextDrawer.DrawText(UI.TOOLS.GENERIC.LOGIC_INPUT_HOVER_FMT.Replace("{Port}", replacement).Replace("{Name}", hoverObject.GetProperName().ToUpper()), component2.Styles_Title.Standard);
                        }
                        else
                        {
                            string replacement2 = (!port.displayCustomName) ? UI.LOGIC_PORTS.PORT_OUTPUT_DEFAULT_NAME.text : port.description;
                            num = component3.GetOutputValue(port.id);
                            hoverTextDrawer.DrawText(UI.TOOLS.GENERIC.LOGIC_OUTPUT_HOVER_FMT.Replace("{Port}", replacement2).Replace("{Name}", hoverObject.GetProperName().ToUpper()), component2.Styles_Title.Standard);
                        }
                        hoverTextDrawer.NewLine(26);
                        TextStyleSetting textStyleSetting = (!flag) ? component2.Styles_LogicActive.Standard : ((num != 1) ? component2.Styles_LogicSignalInactive : component2.Styles_LogicActive.Selected);
                        hoverTextDrawer.DrawIcon((num != 1 || !flag) ? component2.iconDash : component2.iconActiveAutomationPort, textStyleSetting.textColor, 18, 2);
                        hoverTextDrawer.DrawText(port.activeDescription, textStyleSetting);
                        hoverTextDrawer.NewLine(26);
                        TextStyleSetting textStyleSetting2 = (!flag) ? component2.Styles_LogicStandby.Standard : ((num != 0) ? component2.Styles_LogicSignalInactive : component2.Styles_LogicStandby.Selected);
                        hoverTextDrawer.DrawIcon((num != 0 || !flag) ? component2.iconDash : component2.iconActiveAutomationPort, textStyleSetting2.textColor, 18, 2);
                        hoverTextDrawer.DrawText(port.inactiveDescription, textStyleSetting2);
                        hoverTextDrawer.EndShadowBar();
                    }
                    LogicGate component4 = hoverObject.GetComponent <LogicGate>();
                    if ((UnityEngine.Object)component4 != (UnityEngine.Object)null && component4.TryGetPortAtCell(cell, out LogicGateBase.PortId port2))
                    {
                        int  portValue     = component4.GetPortValue(port2);
                        bool portConnected = component4.GetPortConnected(port2);
                        LogicGate.LogicGateDescriptions.Description portDescription = component4.GetPortDescription(port2);
                        hoverTextDrawer.BeginShadowBar(false);
                        if (port2 == LogicGateBase.PortId.Output)
                        {
                            hoverTextDrawer.DrawText(UI.TOOLS.GENERIC.LOGIC_MULTI_OUTPUT_HOVER_FMT.Replace("{Port}", portDescription.name).Replace("{Name}", hoverObject.GetProperName().ToUpper()), component2.Styles_Title.Standard);
                        }
                        else
                        {
                            hoverTextDrawer.DrawText(UI.TOOLS.GENERIC.LOGIC_MULTI_INPUT_HOVER_FMT.Replace("{Port}", portDescription.name).Replace("{Name}", hoverObject.GetProperName().ToUpper()), component2.Styles_Title.Standard);
                        }
                        hoverTextDrawer.NewLine(26);
                        TextStyleSetting textStyleSetting3 = (!portConnected) ? component2.Styles_LogicActive.Standard : ((portValue != 1) ? component2.Styles_LogicSignalInactive : component2.Styles_LogicActive.Selected);
                        hoverTextDrawer.DrawIcon((portValue != 1 || !portConnected) ? component2.iconDash : component2.iconActiveAutomationPort, textStyleSetting3.textColor, 18, 2);
                        hoverTextDrawer.DrawText(portDescription.active, textStyleSetting3);
                        hoverTextDrawer.NewLine(26);
                        TextStyleSetting textStyleSetting4 = (!portConnected) ? component2.Styles_LogicStandby.Standard : ((portValue != 0) ? component2.Styles_LogicSignalInactive : component2.Styles_LogicStandby.Selected);
                        hoverTextDrawer.DrawIcon((portValue != 0 || !portConnected) ? component2.iconDash : component2.iconActiveAutomationPort, textStyleSetting4.textColor, 18, 2);
                        hoverTextDrawer.DrawText(portDescription.inactive, textStyleSetting4);
                        hoverTextDrawer.EndShadowBar();
                    }
                }
            }
            else if (mode == OverlayModes.Power.ID)
            {
                CircuitManager circuitManager = Game.Instance.circuitManager;
                ushort         circuitID      = circuitManager.GetCircuitID(cell);
                if (circuitID != 65535)
                {
                    hoverTextDrawer.BeginShadowBar(false);
                    float wattsNeededWhenActive = circuitManager.GetWattsNeededWhenActive(circuitID);
                    wattsNeededWhenActive += currentDef.EnergyConsumptionWhenActive;
                    float maxSafeWattageForCircuit = circuitManager.GetMaxSafeWattageForCircuit(circuitID);
                    Color color = (!(wattsNeededWhenActive >= maxSafeWattageForCircuit)) ? Color.white : Color.red;
                    hoverTextDrawer.AddIndent(width);
                    hoverTextDrawer.DrawText(string.Format(UI.DETAILTABS.ENERGYGENERATOR.POTENTIAL_WATTAGE_CONSUMED, GameUtil.GetFormattedWattage(wattsNeededWhenActive, GameUtil.WattageFormatterUnit.Automatic)), Styles_BodyText.Standard, color, true);
                    hoverTextDrawer.EndShadowBar();
                }
            }
        }
        hoverTextDrawer.EndDrawing();
    }
 public Accessory Lookup(HashedString full_id)
 {
     return(accessories.Find((Accessory a) => a.IdHash == full_id));
 }
 public Event(string name)
 {
     Name = name;
 }
Пример #9
0
 public Face(string id)
     : base(id, null, null)
 {
     hash = new HashedString(id);
 }
 public virtual Matrix4x4 GetSymbolTransform(HashedString symbol, out bool symbolVisible)
 {
     symbolVisible = false;
     return(Matrix4x4.identity);
 }
 public bool HasAnimation(HashedString anim_name)
 {
     return(anims.ContainsKey(anim_name));
 }
 public abstract Matrix2x3 GetSymbolLocalTransform(HashedString symbol, out bool symbolVisible);
Пример #13
0
        private static ArraySegment <string> _MakeProxiesByFullName(HashedString key, MemberReference mr)
        {
            var icap = mr.DeclaringType as Mono.Cecil.ICustomAttributeProvider;

            if (icap == null)
            {
                return(ImmutableArrayPool <string> .Empty);
            }

            CustomAttribute proxyAttribute = null;

            for (int i = 0, c = icap.CustomAttributes.Count; i < c; i++)
            {
                var ca = icap.CustomAttributes[i];
                if ((ca.AttributeType.Name == "JSProxy") && (ca.AttributeType.Namespace == "JSIL.Proxy"))
                {
                    proxyAttribute = ca;
                    break;
                }
            }

            if (proxyAttribute == null)
            {
                return(ImmutableArrayPool <string> .Empty);
            }

            ArraySegment <string> proxyTargets = ImmutableArrayPool <string> .Empty;
            var args = proxyAttribute.ConstructorArguments;

            foreach (var arg in args)
            {
                switch (arg.Type.FullName)
                {
                case "System.Type": {
                    proxyTargets = new ArraySegment <string>(new string[] {
                            ((TypeReference)arg.Value).FullName
                        });

                    break;
                }

                case "System.Type[]": {
                    var values = (CustomAttributeArgument[])arg.Value;
                    proxyTargets = new ArraySegment <string>((from v in values select((TypeReference)v.Value).FullName)
                                                             .ToArray());

                    break;
                }

                case "System.String": {
                    proxyTargets = new ArraySegment <string>(new string[] {
                            (string)arg.Value
                        });

                    break;
                }

                case "System.String[]": {
                    var values = (CustomAttributeArgument[])arg.Value;
                    proxyTargets = new ArraySegment <string>((from v in values select(string) v.Value)
                                                             .ToArray());

                    break;
                }
                }
            }

            return(proxyTargets);
        }
Пример #14
0
 public void SetMode(HashedString mode)
 {
     this.mode = mode;
     Game.Instance.gameObject.Trigger(1798162660, mode);
 }
 public OverlayToggleInfo(string text, string icon_name, HashedString sim_view, string required_tech_item = "", Action hotKey = Action.NumActions, string tooltip = "", string tooltip_header = "")
     : base(text, icon_name, null, hotKey, tooltip, tooltip_header)
 {
     simView          = sim_view;
     requiredTechItem = required_tech_item;
 }
Пример #16
0
 public static Port OutputPort(HashedString id, CellOffset cell_offset, string description, string activeDescription, string inactiveDescription, bool show_wire_missing_icon = false, bool display_custom_name = false)
 {
     return(new Port(id, cell_offset, description, activeDescription, inactiveDescription, show_wire_missing_icon, LogicPortSpriteType.Output, display_custom_name));
 }
Пример #17
0
 public PeriodicEmoteSickness(HashedString kanim, HashedString[] anims, float cooldown)
 {
     this.anims    = anims;
     this.cooldown = cooldown;
 }
        public Frame GetFrame(HashedString batchTag, int idx)
        {
            KBatchGroupData batchGroupData = KAnimBatchManager.Instance().GetBatchGroupData(batchTag);

            return(batchGroupData.GetFrame(idx + firstFrameIdx));
        }
Пример #19
0
 private static HashedString CustomIdleAnim(IdleStates.Instance smi, ref HashedString pre_anim)
 {
     pre_anim = "hover_swim";
     return("swim_idle_loop");
 }
Пример #20
0
        protected virtual void OnOverlayChanged(HashedString overlay)
        {
            if (OverlaySynced)
            {
                if (overlay == null)
                {
                    SetSynced(false);
                }

                else
                {
                    string filter = null;

                    if (overlay == OverlayModes.Power.ID)
                    {
                        filter = ToolParameterMenu.FILTERLAYERS.WIRES;
                    }

                    else if (overlay == OverlayModes.LiquidConduits.ID)
                    {
                        filter = ToolParameterMenu.FILTERLAYERS.LIQUIDCONDUIT;
                    }

                    else if (overlay == OverlayModes.GasConduits.ID)
                    {
                        filter = ToolParameterMenu.FILTERLAYERS.GASCONDUIT;
                    }

                    else if (overlay == OverlayModes.SolidConveyor.ID)
                    {
                        filter = ToolParameterMenu.FILTERLAYERS.SOLIDCONDUIT;
                    }

                    else if (overlay == OverlayModes.Logic.ID)
                    {
                        filter = ToolParameterMenu.FILTERLAYERS.LOGIC;
                    }

                    if (filter == null)
                    {
                        SetSynced(false);
                    }

                    else
                    {
                        Dictionary <string, ToolParameterMenu.ToggleState> parameters = new Dictionary <string, ToolParameterMenu.ToggleState>(DefaultParameters);
                        foreach (string parameter in parameters.Keys.ToArray())
                        {
                            parameters[parameter] = ToolParameterMenu.ToggleState.Disabled;

                            if (parameter == filter)
                            {
                                parameters[parameter] = ToolParameterMenu.ToggleState.On;
                            }
                        }

                        SetSynced(true);
                        MultiToolParameterMenu.Instance.PopulateMenu(parameters);
                    }
                }
            }
        }
Пример #21
0
            public static void Prefix(HashedString newMode, ref OverlayScreen __instance, out bool __state)
            {
                var val = Traverse.Create(__instance).Field("currentModeInfo").Field("mode").Method("ViewMode").GetValue <HashedString>();

                __state = val == OverlayModes.Decor.ID && newMode != OverlayModes.Decor.ID;
            }
        public void OnOverlayChange(HashedString mode)
        {
            KBatchedAnimController component = base.GetComponent <KBatchedAnimController>();

            component.TintColour = ItemGermSensorConfig.BuildingColor();
        }
Пример #23
0
        private static string[] _MakeProxiesByFullName(HashedString key, MemberReference mr)
        {
            var icap = mr.DeclaringType as Mono.Cecil.ICustomAttributeProvider;

            if (icap == null)
            {
                return(null);
            }

            CustomAttribute proxyAttribute = null;

            for (int i = 0, c = icap.CustomAttributes.Count; i < c; i++)
            {
                var ca = icap.CustomAttributes[i];
                if ((ca.AttributeType.Name == "JSProxy") && (ca.AttributeType.Namespace == "JSIL.Proxy"))
                {
                    proxyAttribute = ca;
                    break;
                }
            }

            if (proxyAttribute == null)
            {
                return(null);
            }

            string[] proxyTargets = null;
            var      args         = proxyAttribute.ConstructorArguments;

            foreach (var arg in args)
            {
                switch (arg.Type.FullName)
                {
                case "System.Type":
                    proxyTargets = new string[] { ((TypeReference)arg.Value).FullName };

                    break;

                case "System.Type[]": {
                    var values = (CustomAttributeArgument[])arg.Value;
                    proxyTargets = new string[values.Length];
                    for (var i = 0; i < proxyTargets.Length; i++)
                    {
                        proxyTargets[i] = ((TypeReference)values[i].Value).FullName;
                    }

                    break;
                }

                case "System.String": {
                    proxyTargets = new string[] { (string)arg.Value };

                    break;
                }

                case "System.String[]": {
                    var values = (CustomAttributeArgument[])arg.Value;
                    proxyTargets = (from v in values select(string) v.Value).ToArray();

                    break;
                }
                }
            }

            return(proxyTargets);
        }
Пример #24
0
 new public byte GetIndex(HashedString id)
 {
     return(this.GetIndex(id.GetHashCode()));
 }
Пример #25
0
 public PlanInfo(HashedString category, bool hideIfNotResearched, object data)
 {
     this.category            = category;
     this.hideIfNotResearched = hideIfNotResearched;
     this.data = data;
 }
Пример #26
0
 public BatchGroupKey(HashedString group_id)
 {
     _groupID = group_id;
 }
Пример #27
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);
             }
         }
     }
 }
 public static HashedString CombineAuto(string name, Type[] parameters) =>
 HashedString.ConvertAll(name, parameters.FastConvertAll(TypeToString));
 public MaterialsStatusItem(string id, string prefix, string icon, IconType icon_type, NotificationType notification_type, bool allow_multiples, HashedString overlay)
     : base(id, prefix, icon, icon_type, notification_type, allow_multiples, overlay, true, 129022)
 {
 }
Пример #30
0
 public static SoundDescription GetSoundEventDescription(HashedString path)
 {
     return(soundDescriptions[path]);
 }