public void SetPermittedByUser(ChoreGroup chore_group, bool is_allowed) { if (is_allowed) { if (userDisabledChoreGroups.Remove(chore_group.IdHash)) { choreRulesChanged.Signal(); } } else if (!userDisabledChoreGroups.Contains(chore_group.IdHash)) { userDisabledChoreGroups.Add(chore_group.IdHash); choreRulesChanged.Signal(); } }
public void SetPermitted(string consumable_id, bool is_allowed) { Tag item = new Tag(consumable_id); List <Tag> list = new List <Tag>(forbiddenTags); if (is_allowed) { list.Remove(item); } else if (!list.Contains(item)) { list.Add(item); } forbiddenTags = list.ToArray(); consumableRulesChanged.Signal(); }
public void DestroySelf(System.Action onComplete) { callDestroy = false; for (int i = 0; i < building.PlacementCells.Length; i++) { int num = building.PlacementCells[i]; Game.Instance.RemoveSolidChangedFilter(num); Sim.Cell.Properties simCellProperties = GetSimCellProperties(); SimMessages.ClearCellProperties(num, (byte)simCellProperties); if (doReplaceElement && Grid.Element[num].id == primaryElement.ElementID) { HandleVector <int> .Handle handle = GameComps.DiseaseContainers.GetHandle(base.gameObject); if (handle.IsValid()) { DiseaseHeader header = GameComps.DiseaseContainers.GetHeader(handle); header.diseaseIdx = Grid.DiseaseIdx[num]; header.diseaseCount = Grid.DiseaseCount[num]; GameComps.DiseaseContainers.SetHeader(handle, header); } if (onComplete != null) { HandleVector <Game.CallbackInfo> .Handle handle2 = Game.Instance.callbackManager.Add(new Game.CallbackInfo(onComplete, false)); int gameCell = num; SimHashes new_element = SimHashes.Vacuum; CellElementEvent simCellOccupierDestroySelf = CellEventLogger.Instance.SimCellOccupierDestroySelf; float mass = 0f; float temperature = -1f; int index = handle2.index; SimMessages.ReplaceElement(gameCell, new_element, simCellOccupierDestroySelf, mass, temperature, byte.MaxValue, 0, index); } else { SimMessages.ReplaceElement(num, SimHashes.Vacuum, CellEventLogger.Instance.SimCellOccupierDestroySelf, 0f, -1f, byte.MaxValue, 0, -1); } SimMessages.SetStrength(num, 1, 1f); } else { Grid.SetSolid(num, false, CellEventLogger.Instance.SimCellOccupierDestroy); onComplete.Signal(); World.Instance.OnSolidChanged(num); GameScenePartitioner.Instance.TriggerEvent(num, GameScenePartitioner.Instance.solidChangedLayer, null); } } }
private void ActivateAppropriateTool(BuildingDef def) { Debug.Assert((UnityEngine.Object)def != (UnityEngine.Object)null, "def was null"); if (materialSelectionPanel.AllSelectorsSelected() && BuildRequirementsMet(def)) { onElementsFullySelected.Signal(); } else if (!MaterialSelector.AllowInsufficientMaterialBuild() && !DebugHandler.InstantBuildMode) { if ((UnityEngine.Object)PlayerController.Instance.ActiveTool == (UnityEngine.Object)BuildTool.Instance) { BuildTool.Instance.Deactivate(); } if ((UnityEngine.Object)PlanScreen.Instance != (UnityEngine.Object)null) { PrebuildTool.Instance.Activate(def, PlanScreen.Instance.BuildableState(def)); } if ((UnityEngine.Object)BuildMenu.Instance != (UnityEngine.Object)null) { PrebuildTool.Instance.Activate(def, BuildMenu.Instance.BuildableState(def)); } } }
public virtual void RefreshButtons() { if (buttonObjects != null) { for (int i = 0; i < buttonObjects.Length; i++) { UnityEngine.Object.Destroy(buttonObjects[i]); } buttonObjects = null; } if (buttons != null && buttons.Count != 0) { buttonObjects = new GameObject[buttons.Count]; for (int j = 0; j < buttons.Count; j++) { ButtonInfo buttonInfo = buttons[j]; if (buttonInfo != null) { GameObject binstance = UnityEngine.Object.Instantiate(buttonPrefab, Vector3.zero, Quaternion.identity); buttonInfo.buttonGo = binstance; buttonObjects[j] = binstance; Transform transform = null; transform = ((!((UnityEngine.Object)buttonParent != (UnityEngine.Object)null)) ? base.transform : buttonParent); binstance.transform.SetParent(transform, false); binstance.SetActive(true); binstance.name = buttonInfo.text + "Button"; KButton component = binstance.GetComponent <KButton>(); if ((UnityEngine.Object)component != (UnityEngine.Object)null && buttonInfo.onClick != null) { component.onClick += buttonInfo.onClick; } Image image = null; if ((bool)component) { image = component.fgImage; } if ((UnityEngine.Object)image != (UnityEngine.Object)null) { image.gameObject.SetActive(false); Sprite[] array = icons; foreach (Sprite sprite in array) { if ((UnityEngine.Object)sprite != (UnityEngine.Object)null && sprite.name == buttonInfo.iconName) { image.sprite = sprite; image.gameObject.SetActive(true); break; } } } if ((UnityEngine.Object)buttonInfo.texture != (UnityEngine.Object)null) { RawImage componentInChildren = binstance.GetComponentInChildren <RawImage>(); if ((UnityEngine.Object)componentInChildren != (UnityEngine.Object)null) { componentInChildren.gameObject.SetActive(true); componentInChildren.texture = buttonInfo.texture; } } ToolTip componentInChildren2 = binstance.GetComponentInChildren <ToolTip>(); if (buttonInfo.text != null && buttonInfo.text != string.Empty && (UnityEngine.Object)componentInChildren2 != (UnityEngine.Object)null) { componentInChildren2.toolTip = buttonInfo.GetTooltipText(); LocText componentInChildren3 = binstance.GetComponentInChildren <LocText>(); if ((UnityEngine.Object)componentInChildren3 != (UnityEngine.Object)null) { componentInChildren3.text = buttonInfo.text; } } if (buttonInfo.onToolTip != null) { componentInChildren2.OnToolTip = buttonInfo.onToolTip; } System.Action onClick = buttonInfo.onClick; System.Action value = delegate { onClick.Signal(); if (!keepMenuOpen && (UnityEngine.Object) this != (UnityEngine.Object)null) { Deactivate(); } if ((UnityEngine.Object)binstance != (UnityEngine.Object)null) { KToggle component3 = binstance.GetComponent <KToggle>(); if ((UnityEngine.Object)component3 != (UnityEngine.Object)null) { SelectToggle(component3); } } }; KToggle componentInChildren4 = binstance.GetComponentInChildren <KToggle>(); if ((UnityEngine.Object)componentInChildren4 != (UnityEngine.Object)null) { componentInChildren4.onRefresh += buttonInfo.onRefresh; ToggleGroup component2 = GetComponent <ToggleGroup>(); if ((UnityEngine.Object)component2 == (UnityEngine.Object)null) { component2 = externalToggleGroup; } componentInChildren4.group = component2; componentInChildren4.onClick += value; Navigation navigation = componentInChildren4.navigation; navigation.mode = (automaticNavigation ? Navigation.Mode.Automatic : Navigation.Mode.None); componentInChildren4.navigation = navigation; } else { KBasicToggle componentInChildren5 = binstance.GetComponentInChildren <KBasicToggle>(); if ((UnityEngine.Object)componentInChildren5 != (UnityEngine.Object)null) { componentInChildren5.onClick += value; } } if ((UnityEngine.Object)component != (UnityEngine.Object)null) { component.isInteractable = buttonInfo.isInteractable; } buttonInfo.onCreate.Signal(buttonInfo); } } Update(); } }