示例#1
0
        public override bool OnEditBlock(int x, int y, int z, int value, ComponentPlayer componentPlayer)
        {
            CommandData commandBlockData = GetBlockData(new Point3(x, y, z)) ?? new CommandData();

            DialogsManager.ShowDialog(componentPlayer.View.GameWidget, new TextBoxDialog("enter one-line command", commandBlockData.Command, 300, delegate(string result)
            {
                commandBlockData.Command = result;
                SetBlockData(new Point3(x, y, z), commandBlockData);
                var electricElement = subsystemElectricity.GetElectricElement(x, y, z, 0);
                if (electricElement != null)
                {
                    subsystemElectricity.QueueElectricElementForSimulation(electricElement, subsystemElectricity.CircuitStep + 1);
                }
            }));
            return(true);
        }
示例#2
0
        public override bool OnEditBlock(int x, int y, int z, int value, ComponentPlayer componentPlayer)
        {
            MemoryBankData memoryBankData = GetBlockData(new Point3(x, y, z)) ?? new MemoryBankData();

            DialogsManager.ShowDialog(componentPlayer.GuiWidget, new EditMemeryDialogB(memoryBankData, delegate() {
                SetBlockData(new Point3(x, y, z), memoryBankData);
                int face = ((MemoryBankBlock)BlocksManager.Blocks[186]).GetFace(value);
                SubsystemElectricity subsystemElectricity = base.SubsystemTerrain.Project.FindSubsystem <SubsystemElectricity>(throwOnError: true);
                ElectricElement electricElement           = subsystemElectricity.GetElectricElement(x, y, z, face);
                if (electricElement != null)
                {
                    subsystemElectricity.QueueElectricElementForSimulation(electricElement, subsystemElectricity.CircuitStep + 1);
                }
            }));
            return(true);
        }
示例#3
0
        public override bool OnEditBlock(int x, int y, int z, int value, ComponentPlayer componentPlayer)
        {
            int contents = Terrain.ExtractContents(value);
            int data     = Terrain.ExtractData(value);

            DialogsManager.ShowDialog(componentPlayer.GuiWidget, new EditPistonDialog(data, delegate(int newData)
            {
                if (newData != data && base.SubsystemTerrain.Terrain.GetCellContents(x, y, z) == contents)
                {
                    int value2 = Terrain.ReplaceData(value, newData);
                    base.SubsystemTerrain.ChangeCell(x, y, z, value2);
                    SubsystemElectricity subsystemElectricity = base.Project.FindSubsystem <SubsystemElectricity>(throwOnError: true);
                    ElectricElement electricElement           = subsystemElectricity.GetElectricElement(x, y, z, 0);
                    if (electricElement != null)
                    {
                        subsystemElectricity.QueueElectricElementForSimulation(electricElement, subsystemElectricity.CircuitStep + 1);
                    }
                }
            }));
            return(true);
        }