Example #1
0
 protected override void OnPrefabInit()
 {
     base.OnPrefabInit();
     filterable  = GetComponent <Filterable>();
     accumulator = Game.Instance.accumulators.Add("Source", this);
     InitializeStatusItems();
 }
    private void SetFilterElement(Element element)
    {
        Filterable component = DetailsScreen.Instance.target.GetComponent <Filterable>();

        if (!((Object)component == (Object)null))
        {
            LocString loc_string = (component.filterElementState != Filterable.ElementState.Gas) ? UI.UISIDESCREENS.FILTERSIDESCREEN.FILTEREDELEMENT.LIQUID : UI.UISIDESCREENS.FILTERSIDESCREEN.FILTEREDELEMENT.GAS;
            currentSelectionLabel.text = string.Format(loc_string, UI.UISIDESCREENS.FILTERSIDESCREEN.NOELEMENTSELECTED);
            if (element != null)
            {
                component.SelectedTag = element.tag;
                foreach (KeyValuePair <Element, FilterSideScreenRow> item in filterRowMap)
                {
                    bool flag = item.Key == element;
                    item.Value.SetSelected(flag);
                    if (flag)
                    {
                        if (element.id != SimHashes.Void && element.id != SimHashes.Vacuum)
                        {
                            currentSelectionLabel.text = string.Format(loc_string, element.name);
                        }
                        else
                        {
                            currentSelectionLabel.text = UI.UISIDESCREENS.FILTERSIDESCREEN.NO_SELECTION;
                        }
                    }
                }
            }
        }
    }
    protected override void OnPrefabInit()
    {
        base.OnPrefabInit();
        Filterable component = GetComponent <Filterable>();

        component.onFilterChanged += OnElementSelected;
    }
Example #4
0
 public static bool Prefix(Dictionary <Tag, HashSet <Tag> > __result, Filterable __instance)
 {
     if (__instance.filterElementState == Filterable.ElementState.None)
     {
     }
     return(true);
 }
    private void OnCopySettings(object data)
    {
        GameObject gameObject = (GameObject)data;
        Filterable component  = gameObject.GetComponent <Filterable>();

        if ((UnityEngine.Object)component != (UnityEngine.Object)null)
        {
            SelectedTag = component.SelectedTag;
        }
    }
    public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag)
    {
        go.GetComponent <KPrefabID>().AddTag(RoomConstraints.ConstraintTags.IndustrialMachinery, false);
        go.AddOrGet <Structure>();
        ElementFilter elementFilter = go.AddOrGet <ElementFilter>();

        elementFilter.portInfo = secondaryPort;
        Filterable filterable = go.AddOrGet <Filterable>();

        filterable.filterElementState = Filterable.ElementState.Gas;
    }
        public override void DoPostConfigureComplete(GameObject go)
        {
            GeneratedBuildings.RegisterLogicPorts(go, LogicElementSensorLiquidConfig.OUTPUT_PORT);
            Filterable filterable = go.AddOrGet <Filterable>();

            filterable.filterElementState = Filterable.ElementState.Liquid;
            LogicElementSensorColor logicElementSensor = go.AddOrGet <LogicElementSensorColor>();

            logicElementSensor.manuallyControlled = false;
            logicElementSensor.desiredState       = Element.State.Liquid;
        }
    private void Configure(Filterable filterable)
    {
        IList <Tag> tagOptions = filterable.GetTagOptions();

        foreach (KeyValuePair <Element, FilterSideScreenRow> item in filterRowMap)
        {
            Element key    = item.Key;
            bool    active = tagOptions.Contains(key.tag);
            item.Value.gameObject.SetActive(active);
        }
    }
        public override void DoPostConfigureComplete(GameObject go)
        {
            GeneratedBuildings.RegisterLogicPorts(go, OUTPUT_PORT);
            Filterable filterable = go.AddOrGet <Filterable>();

            filterable.filterElementState = Filterable.ElementState.Solid;

            SolidConduitElementSensor sensor = go.AddOrGet <SolidConduitElementSensor>();

            sensor.manuallyControlled = false;
            sensor.defaultState       = false;
        }
    public override void DoPostConfigureComplete(GameObject go)
    {
        base.DoPostConfigureComplete(go);
        GeneratedBuildings.RegisterLogicPorts(go, OUTPUT_PORT);
        Filterable filterable = go.AddOrGet <Filterable>();

        filterable.filterElementState = Filterable.ElementState.Gas;
        ConduitElementSensor conduitElementSensor = go.AddOrGet <ConduitElementSensor>();

        conduitElementSensor.manuallyControlled = false;
        conduitElementSensor.conduitType        = ConduitType;
        conduitElementSensor.defaultState       = false;
    }
    public override void SetTarget(GameObject target)
    {
        base.SetTarget(target);
        Filterable component = target.GetComponent <Filterable>();

        if (!((Object)component == (Object)null))
        {
            everythingElseHeaderLabel.text = ((component.filterElementState != Filterable.ElementState.Gas) ? UI.UISIDESCREENS.FILTERSIDESCREEN.UNFILTEREDELEMENTS.LIQUID : UI.UISIDESCREENS.FILTERSIDESCREEN.UNFILTEREDELEMENTS.GAS);
            Element filterElement = (!component.SelectedTag.IsValid) ? ElementLoader.FindElementByHash(SimHashes.Void) : ElementLoader.GetElement(component.SelectedTag);
            SetFilterElement(filterElement);
            Configure(component);
        }
    }
        public override int GetHashCode()
        {
            int hash = 1;

            if (ResourceName.Length != 0)
            {
                hash ^= ResourceName.GetHashCode();
            }
            if (name_ != null)
            {
                hash ^= Name.GetHashCode();
            }
            if (Category != global::Google.Ads.GoogleAds.V2.Enums.GoogleAdsFieldCategoryEnum.Types.GoogleAdsFieldCategory.Unspecified)
            {
                hash ^= Category.GetHashCode();
            }
            if (selectable_ != null)
            {
                hash ^= Selectable.GetHashCode();
            }
            if (filterable_ != null)
            {
                hash ^= Filterable.GetHashCode();
            }
            if (sortable_ != null)
            {
                hash ^= Sortable.GetHashCode();
            }
            hash ^= selectableWith_.GetHashCode();
            hash ^= attributeResources_.GetHashCode();
            hash ^= metrics_.GetHashCode();
            hash ^= segments_.GetHashCode();
            hash ^= enumValues_.GetHashCode();
            if (DataType != global::Google.Ads.GoogleAds.V2.Enums.GoogleAdsFieldDataTypeEnum.Types.GoogleAdsFieldDataType.Unspecified)
            {
                hash ^= DataType.GetHashCode();
            }
            if (typeUrl_ != null)
            {
                hash ^= TypeUrl.GetHashCode();
            }
            if (isRepeated_ != null)
            {
                hash ^= IsRepeated.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Example #13
0
        public override void WriteInitializationScript(TextWriter writer)
        {
            var options = new Dictionary <string, object>(Events);

            var autoBind = DataSource.Type != DataSourceType.Server && AutoBind.GetValueOrDefault(true);

            var columns = VisibleColumns.Select(c => c.ToJson());

            var idPrefix = "#";

            if (IsInClientTemplate)
            {
                idPrefix = "\\" + idPrefix;
            }

            if (columns.Any())
            {
                options["columns"] = columns;
            }

            if (Grouping.Enabled)
            {
                options["groupable"] = Grouping.ToJson();
            }

            if (Pageable.Enabled)
            {
                Pageable.AutoBind = autoBind;

                options["pageable"] = Pageable.ToJson();
            }

            if (Sortable.Enabled)
            {
                var sorting = Sortable.ToJson();
                options["sortable"] = sorting.Any() ? (object)sorting : true;
            }

            if (Selectable.Enabled)
            {
                options["selectable"] = String.Format("{0}, {1}", Selectable.Mode, Selectable.Type);
            }

            if (Filterable.Enabled)
            {
                var filtering = Filterable.ToJson();
                options["filterable"] = filtering.Any() ? (object)filtering : true;
            }

            if (ColumnMenu.Enabled)
            {
                var menu = ColumnMenu.ToJson();
                options["columnMenu"] = menu.Any() ? (object)menu : true;
            }

            if (Resizable.Enabled)
            {
                options["resizable"] = true;
            }

            if (ColumnResizeHandleWidth != defaultColumnResizeHandleWidth)
            {
                options["columnResizeHandleWidth"] = ColumnResizeHandleWidth;
            }

            if (Reorderable.Enabled)
            {
                options["reorderable"] = true;
            }

            if (!Scrollable.Enabled)
            {
                options["scrollable"] = false;
            }
            else
            {
                var scrolling = Scrollable.ToJson();
                if (scrolling.Any())
                {
                    options["scrollable"] = scrolling;
                }
            }

            if (Editable.Enabled)
            {
                options["editable"] = Editable.ToJson();
            }

            if (ToolBar.Enabled)
            {
                options["toolbar"] = ToolBar.ToJson();
            }

            if (autoBind == false)
            {
                options["autoBind"] = autoBind;
            }

            options["dataSource"] = DataSource.ToJson();

            if (!String.IsNullOrEmpty(ClientDetailTemplateId))
            {
                options["detailTemplate"] = new ClientHandlerDescriptor {
                    HandlerName = String.Format("kendo.template($('{0}{1}').html())", idPrefix, ClientDetailTemplateId)
                };
            }

            if (!String.IsNullOrEmpty(ClientRowTemplate))
            {
                options["rowTemplate"] = ClientRowTemplate;
            }

            if (!String.IsNullOrEmpty(ClientAltRowTemplate))
            {
                options["altRowTemplate"] = ClientAltRowTemplate;
            }

            if (Navigatable.Enabled)
            {
                options["navigatable"] = true;
            }

            if (Mobile != MobileMode.Disabled)
            {
                if (Mobile == MobileMode.Auto)
                {
                    options["mobile"] = true;
                }
                else
                {
                    options["mobile"] = Mobile.ToString().ToLowerInvariant();
                }
            }

            writer.Write(Initializer.Initialize(Selector, "Grid", options));

            base.WriteInitializationScript(writer);
        }
Example #14
0
 protected override void OnPrefabInit()
 {
     base.OnPrefabInit();
     filterable = GetComponent <Filterable>();
     InitializeStatusItems();
 }