private void SetProbingRadiusUI(int radius)
        {
            if ((UnityEngine.Object) this.target == (UnityEngine.Object)null || (UnityEngine.Object) this.configurator == (UnityEngine.Object)null)
            {
                return;
            }

            PSliderSingle.SetCurrentValue(this.ProbingRadiusSlider, radius);

            StationaryChoreRangeVisualizer choreRangeVisualizer = this.target.GetComponent <StationaryChoreRangeVisualizer>();

            if ((UnityEngine.Object)choreRangeVisualizer == (UnityEngine.Object)null)
            {
                return;
            }

            choreRangeVisualizer.x     = -radius;
            choreRangeVisualizer.width = 2 + 2 * radius;
            Traverse.Create(choreRangeVisualizer).Method("UpdateVisualizers").GetValue();

            if ((UnityEngine.Object) this.ProbingRadiusText == (UnityEngine.Object)null)
            {
                return;
            }

            PUIElements.SetText(this.ProbingRadiusText, radius.ToString("0"));
        }
        private void SetButtonStates(bool enabled)
        {
            if (this.FindSweepyButton != null)
            {
                PButton.SetButtonEnabled(this.FindSweepyButton, enabled);
            }

            if (this.ResetSweepyButton != null)
            {
                PButton.SetButtonEnabled(this.ResetSweepyButton, enabled);
            }

            if (!enabled)
            {
                if ((UnityEngine.Object) this.MoveSpeedText != (UnityEngine.Object)null)
                {
                    PUIElements.SetText(this.MoveSpeedText, "N/A");
                }

                StationaryChoreRangeVisualizer choreRangeVisualizer = this.target.GetComponent <StationaryChoreRangeVisualizer>();

                if ((UnityEngine.Object)choreRangeVisualizer != (UnityEngine.Object)null)
                {
                    choreRangeVisualizer.x     = 0;
                    choreRangeVisualizer.width = 0;
                    Traverse.Create(choreRangeVisualizer).Method("UpdateVisualizers").GetValue();
                }

                if ((UnityEngine.Object) this.ProbingRadiusText != (UnityEngine.Object)null)
                {
                    PUIElements.SetText(this.ProbingRadiusText, "N/A");
                }
            }
        }
示例#3
0
        public static void Postfix(GameObject go)
        {
            StationaryChoreRangeVisualizer choreRangeVisualizer = go.AddOrGet <StationaryChoreRangeVisualizer>();

            choreRangeVisualizer.x      = -RANGE;
            choreRangeVisualizer.y      = -RANGE;
            choreRangeVisualizer.width  = (RANGE * 2) + 1;
            choreRangeVisualizer.height = (RANGE * 2) + 1;
        }
示例#4
0
        private static void AddVisualizer(GameObject prefab, bool movable)
        {
            StationaryChoreRangeVisualizer choreRangeVisualizer = prefab.AddOrGet <StationaryChoreRangeVisualizer>();

            choreRangeVisualizer.x       = -23;
            choreRangeVisualizer.y       = -23;
            choreRangeVisualizer.width   = 47;
            choreRangeVisualizer.height  = 47;
            choreRangeVisualizer.movable = movable;
        }
示例#5
0
        private static void AddVisualizer(GameObject go, bool movable)
        {
            StationaryChoreRangeVisualizer stationaryChoreRangeVisualizer = go.AddOrGet <StationaryChoreRangeVisualizer>();
            Rotatable  rotatable = go.AddOrGet <Rotatable>();
            CellOffset offset    = Rotatable.GetRotatedCellOffset(new CellOffset(0, 1), rotatable.GetOrientation());

            stationaryChoreRangeVisualizer.x       = offset.x;
            stationaryChoreRangeVisualizer.y       = offset.y;
            stationaryChoreRangeVisualizer.width   = 1;
            stationaryChoreRangeVisualizer.height  = 1;
            stationaryChoreRangeVisualizer.movable = movable;
        }
示例#6
0
        private static bool Prefix(GameObject prefab, bool movable)
        {
            int range = CustomizeBuildingsState.StateManager.State.AutoSweeperRange;
            StationaryChoreRangeVisualizer choreRangeVisualizer = prefab.AddOrGet <StationaryChoreRangeVisualizer>();

            choreRangeVisualizer.x       = -range;
            choreRangeVisualizer.y       = -range;
            choreRangeVisualizer.width   = range * 2 + 1;
            choreRangeVisualizer.height  = range * 2 + 1;
            choreRangeVisualizer.movable = movable;
            return(false);
        }
示例#7
0
        private static void AddVisualizer(GameObject prefab, bool movable)
        {
            StationaryChoreRangeVisualizer choreRangeVisualizer = prefab.AddOrGet <StationaryChoreRangeVisualizer>();

            choreRangeVisualizer.x                     = X;
            choreRangeVisualizer.y                     = Y;
            choreRangeVisualizer.width                 = WIDTH;
            choreRangeVisualizer.height                = HEIGHT;
            choreRangeVisualizer.vision_offset         = new CellOffset(0, 1);
            choreRangeVisualizer.movable               = movable;
            choreRangeVisualizer.blocking_tile_visible = false;
            KPrefabID component = prefab.GetComponent <KPrefabID>();
        }
示例#8
0
        public static void Postfix(GameObject go)
        {
            go.AddOrGet <SolidTransferArm>().pickupRange = RANGE;
            StationaryChoreRangeVisualizer choreRangeVisualizer = go.AddOrGet <StationaryChoreRangeVisualizer>();

            choreRangeVisualizer.x      = -RANGE;
            choreRangeVisualizer.y      = -RANGE;
            choreRangeVisualizer.width  = (RANGE * 2) + 1;
            choreRangeVisualizer.height = (RANGE * 2) + 1;
            //configfile._streamwriter.Write("Load autosweeper");
            //Debug.Log("Autosweepermod");
            //configfile.moddebuglog("Autosweeper Loaded");
        }
示例#9
0
        private static void AddVisualizer(GameObject prefab, bool movable)
        {
            StationaryChoreRangeVisualizer stationaryChoreRangeVisualizer = prefab.AddOrGet <StationaryChoreRangeVisualizer>();

            stationaryChoreRangeVisualizer.x                     = -RANGE;
            stationaryChoreRangeVisualizer.y                     = 0;
            stationaryChoreRangeVisualizer.width                 = RANGE * 2;
            stationaryChoreRangeVisualizer.height                = RANGE;
            stationaryChoreRangeVisualizer.vision_offset         = new CellOffset(0, 1);
            stationaryChoreRangeVisualizer.movable               = movable;
            stationaryChoreRangeVisualizer.blocking_tile_visible = false;
            KPrefabID component = prefab.GetComponent <KPrefabID>();

            component.instantiateFn += delegate(GameObject go) { go.GetComponent <StationaryChoreRangeVisualizer>().blocking_cb = (int cell) => Grid.VisibleBlockingCB(cell) || (Vector2.Distance(go.transform.position, Grid.CellToPosCCC(cell, Grid.SceneLayer.NoLayer)) > RANGE); };
        }
示例#10
0
    private static void AddVisualizer(GameObject prefab, bool movable)
    {
        StationaryChoreRangeVisualizer choreRangeVisualizer = prefab.AddOrGet <StationaryChoreRangeVisualizer>();

        choreRangeVisualizer.x      = -RANGE / 2;
        choreRangeVisualizer.y      = 0;
        choreRangeVisualizer.width  = RANGE;
        choreRangeVisualizer.height = RANGE;

        /*choreRangeVisualizer.x = -2;
         * choreRangeVisualizer.y = 0;
         * choreRangeVisualizer.width = 5;
         * choreRangeVisualizer.height = 5; */
        choreRangeVisualizer.movable = movable;
    }
        private static void AddVisualizer(GameObject prefab, bool movable)
        {
            StationaryChoreRangeVisualizer stationaryChoreRangeVisualizer = prefab.AddOrGet <StationaryChoreRangeVisualizer>();

            stationaryChoreRangeVisualizer.x       = UV_LEFT;
            stationaryChoreRangeVisualizer.y       = UV_BOTTOM;
            stationaryChoreRangeVisualizer.width   = UV_WIDTH;
            stationaryChoreRangeVisualizer.height  = UV_HEIGHT;
            stationaryChoreRangeVisualizer.movable = movable;
            stationaryChoreRangeVisualizer.blocking_tile_visible = true;
            prefab.GetComponent <KPrefabID>().instantiateFn     += delegate(GameObject go)
            {
                go.GetComponent <StationaryChoreRangeVisualizer>().blocking_cb = (cell) =>
                {
                    return(Grid.VisibleBlockingCB(cell));
                };
            };
        }
    private static void AddVisualizer(GameObject prefab, bool movable)
    {
        StationaryChoreRangeVisualizer stationaryChoreRangeVisualizer = prefab.AddOrGet <StationaryChoreRangeVisualizer>();

        stationaryChoreRangeVisualizer.x                     = -7;
        stationaryChoreRangeVisualizer.y                     = 0;
        stationaryChoreRangeVisualizer.width                 = 16;
        stationaryChoreRangeVisualizer.height                = 9;
        stationaryChoreRangeVisualizer.vision_offset         = new CellOffset(0, 1);
        stationaryChoreRangeVisualizer.movable               = movable;
        stationaryChoreRangeVisualizer.blocking_tile_visible = false;
        KPrefabID component = prefab.GetComponent <KPrefabID>();

        component.instantiateFn += delegate(GameObject go)
        {
            go.GetComponent <StationaryChoreRangeVisualizer>().blocking_cb = AutoMiner.DigBlockingCB;
        };
    }
示例#13
0
        private static void Postfix(GameObject prefab, bool movable)
        {
            int width  = CustomizeBuildingsState.StateManager.State.RoboMinerWidth;
            int height = CustomizeBuildingsState.StateManager.State.RoboMinerHeight;
            int offset = CustomizeBuildingsState.StateManager.State.RoboMinerOffset;

            StationaryChoreRangeVisualizer choreRangeVisualizer = prefab.GetComponent <StationaryChoreRangeVisualizer>();

            if (choreRangeVisualizer != null)
            {
                choreRangeVisualizer.x      = 1 - (width / 2);
                choreRangeVisualizer.y      = offset;
                choreRangeVisualizer.width  = width;
                choreRangeVisualizer.height = height;
                //choreRangeVisualizer.vision_offset = new CellOffset(0, 1);
                //choreRangeVisualizer.movable = movable;
                //choreRangeVisualizer.blocking_tile_visible = false;
            }
        }
示例#14
0
        private static void AddVisualizer(GameObject go, bool movable)
        {
            StationaryChoreRangeVisualizer choreRangeVisualizer = go.AddOrGet <StationaryChoreRangeVisualizer>();

            choreRangeVisualizer.width                 = ShaftRoboMiner.Range.width;
            choreRangeVisualizer.height                = ShaftRoboMiner.Range.height;
            choreRangeVisualizer.x                     = ShaftRoboMiner.Range.xOffset;
            choreRangeVisualizer.y                     = ShaftRoboMiner.Range.yOffset;
            choreRangeVisualizer.vision_offset         = ShaftRoboMiner.Range.VisionOffset;
            choreRangeVisualizer.movable               = movable;
            choreRangeVisualizer.blocking_tile_visible = false;

            go.GetComponent <KPrefabID>().instantiateFn += (prefab =>
            {
                StationaryChoreRangeVisualizer component = prefab.GetComponent <StationaryChoreRangeVisualizer>();
                Func <int, bool> callback = AutoMiner.DigBlockingCB;
                component.blocking_cb = callback;
            });
        }
示例#15
0
            public static void Postfix(GameObject go)
            {
                StationaryChoreRangeVisualizer choreRangeVisualizer = go.AddOrGet <StationaryChoreRangeVisualizer>();

                choreRangeVisualizer.x       = -SweepyConfigChecker.BaseProbingRadius;
                choreRangeVisualizer.y       = 0;
                choreRangeVisualizer.width   = (2 * SweepyConfigChecker.BaseProbingRadius) + 2;
                choreRangeVisualizer.height  = 1;
                choreRangeVisualizer.movable = false;

                Storage stationStorage = go.GetComponents <Storage>()[1];

                stationStorage.capacityKg = SweepyConfigChecker.StationStorageCapacity;
                stationStorage.showInUI   = true;

                if (SweepyConfigChecker.StationHasConveyorOutput)
                {
                    SolidConduitSweepStationDispenser dispenser = go.AddOrGet <SolidConduitSweepStationDispenser>();
                    dispenser.storage = stationStorage;
                }
            }
示例#16
0
 protected override void OnCleanUp()
 {
     visualizer  = null;
     transferArm = null;
     base.OnCleanUp();
 }