public SingleplayerScreen()
 {
     WidgetsManager.LoadWidgetContents((Widget)this.ScreenWidget, (object)this, ContentManager.Get <XElement>("Screens/SingleplayerScreen"));
     this.m_worldsListWidget = this.ScreenWidget.Children.Find <ListPanelWidget>("WorldsList", true);
     this.m_worldsListWidget.ItemWidgetFactory += (Func <object, Widget>)(item =>
     {
         WorldInfo worldInfo             = (WorldInfo)item;
         ContainerWidget containerWidget = (ContainerWidget)WidgetsManager.LoadWidget((object)this, ContentManager.Get <XElement>("Widgets/SavedWorldItem"), null);
         LabelWidget labelWidget1        = containerWidget.Children.Find <LabelWidget>("WorldItem.Name", true);
         LabelWidget labelWidget2        = containerWidget.Children.Find <LabelWidget>("WorldItem.Size", true);
         LabelWidget labelWidget3        = containerWidget.Children.Find <LabelWidget>("WorldItem.Date", true);
         LabelWidget labelWidget4        = containerWidget.Children.Find <LabelWidget>("WorldItem.GameMode", true);
         LabelWidget labelWidget5        = containerWidget.Children.Find <LabelWidget>("WorldItem.EnvironmentBehaviorMode", true);
         LabelWidget labelWidget6        = containerWidget.Children.Find <LabelWidget>("WorldItem.Version", true);
         containerWidget.Tag = (object)worldInfo;
         labelWidget1.Text   = worldInfo.Name;
         labelWidget2.Text   = string.Format("{0:0.00MB}", new object[1]
         {
             (object)(float)((double)worldInfo.Size / 1024.0 / 1024.0)
         });
         labelWidget3.Text = string.Format("{0:dd MMM yyyy HH:mm}", new object[1]
         {
             (object)worldInfo.LastSaveTime
         });
         labelWidget4.Text = worldInfo.GameMode.ToString();
         labelWidget5.Text = worldInfo.EnvironmentBehaviorMode.ToString();
         labelWidget6.Text = !(worldInfo.SerializationVersion != VersionsManager.SerializationVersion) ? string.Empty : (string.IsNullOrEmpty(worldInfo.SerializationVersion) ? "(unknown)" : "(" + worldInfo.SerializationVersion + ")");
         return((Widget)containerWidget);
     });
 }
예제 #2
0
        public override void Update()
        {
            try
            {
                this.blockIconWidget.Value = int.Parse(blockID.Text);
            }
            catch
            {
                this.blockIconWidget.Value = 0;
            }



            if (this.cancelButton.IsClicked)
            {
                DialogsManager.HideDialog(this);
            }
            if (this.SelectBlockButton.IsClicked)
            {
                int[] items = new int[] { 0, 2, 8, 7, 3, 67, 66, 4, 5, 26, 73, 21, 46, 47, 15, 62, 68, 126, 71, 1, 92, 18 };
                DialogsManager.ShowDialog(null, new ListSelectionDialog("Select Block", items, 72f, delegate(object index)
                {
                    XElement node = ContentManager.Get <XElement>("Widgets/SelectBlockItem");
                    ContainerWidget containerWidget = (ContainerWidget)WidgetsManager.LoadWidget(null, node, null);
                    containerWidget.Children.Find <BlockIconWidget>("SelectBlockItem.Block", true).Contents = (int)index;
                    containerWidget.Children.Find <LabelWidget>("SelectBlockItem.Text", true).Text          = BlocksManager.Blocks[(int)index].GetDisplayName(null, Terrain.MakeBlockValue((int)index));
                    return(containerWidget);
                }, delegate(object index)
                {
                    this.blockID.Text = ((int)index).ToString();
                }));
            }
        }
예제 #3
0
        public HelpScreen()
        {
            WidgetsManager.LoadWidgetContents(this, this, ContentManager.Get <XElement>("Screens/HelpScreen"));
            m_topicsList       = Children.Find <ListPanelWidget>("TopicsList", true);
            m_recipaediaButton = Children.Find <ButtonWidget>("RecipaediaButton", true);
            m_bestiaryButton   = Children.Find <ButtonWidget>("BestiaryButton", true);

            m_topicsList.ItemWidgetFactory = delegate(object item)
            {
                var      helpTopic3 = (HelpTopic)item;
                XElement node2      = ContentManager.Get <XElement>("Widgets/HelpTopicItem");
                var      obj        = (ContainerWidget)WidgetsManager.LoadWidget(this, node2, null);
                obj.Children.Find <LabelWidget>("HelpTopicItem.Title", true).Text = helpTopic3.Title;
                return(obj);
            };
            m_topicsList.ItemClicked += delegate(object item)
            {
                if (item is HelpTopic helpTopic2)
                {
                    ShowTopic(helpTopic2);
                }
            };
            for (var i = ContentManager.CombineXml(ContentManager.Get <XElement>("Help"), ModsManager.GetEntries(".hlp"), "Title", "Name", "Topic").Elements().GetEnumerator(); i.MoveNext();)
            {
                var element  = i.Current;
                var strArray = XmlUtils.GetAttributeValue(element, "DisabledPlatforms", string.Empty).Split(',');
                if (strArray.FirstOrDefault(Match) == null)
                {
                    var attributeValue1 = XmlUtils.GetAttributeValue(element, "Name", string.Empty);
                    var attributeValue2 = XmlUtils.GetAttributeValue <string>(element, "Title");
                    var str1            = string.Empty;
                    strArray = element.Value.Split('\n');
                    for (int i1 = 0; i1 < strArray.Length; i1++)
                    {
                        str1 = str1 + strArray[i1].Trim() + " ";
                    }
                    var helpTopic = new HelpTopic {
                        Name = attributeValue1, Title = attributeValue2, Text = str1.Replace("\r", "").Replace("’", "'").Replace("\\n", "\n")
                    };
                    if (!string.IsNullOrEmpty(helpTopic.Name))
                    {
                        m_topics.Add(helpTopic.Name, helpTopic);
                    }
                    m_topicsList.AddItem(helpTopic);
                }
            }
        }
        public override void Update()
        {
            m_blockIconWidget.Value = id1;


            if (mselect_pos.IsClicked)
            {
                Select_pos(m_categories_pos, names_pos);
            }

            if (Icon_select.IsClicked)
            {
                DialogsManager.ShowDialog(null, new ListSelectionDialog("Select Block", new int[21]
                {
                    18,
                    92,
                    8,
                    2,
                    7,
                    3,
                    67,
                    66,
                    4,
                    5,
                    26,
                    73,
                    21,
                    46,
                    47,
                    15,
                    62,
                    68,
                    126,
                    71,
                    1
                }, 72f, index =>
                {
                    ContainerWidget containerWidget = (ContainerWidget)WidgetsManager.LoadWidget((object)null, ContentManager.Get <XElement>("Widgets/SelectBlockItem"), null);
                    containerWidget.Children.Find <BlockIconWidget>("SelectBlockItem.Block", true).Contents = (int)index;
                    containerWidget.Children.Find <LabelWidget>("SelectBlockItem.Text", true).Text          = BlocksManager.Blocks[(int)index].GetDisplayName(null, Terrain.MakeBlockValue((int)index));

                    return(containerWidget);
                }, index => id1 = (int)index));
                ;
            }



            if (this.m_okButton.IsClicked)
            {
                if (mPosition.Text == "Frame")
                {
                    pos1 = 2;
                }
                if (mPosition.Text == "Hollow Box")
                {
                    pos1 = 1;
                }

                if (mPosition.Text == "Soild Box")
                {
                    pos1 = 0;
                }

                Engine.Point3 PointStart;

                PointStart.X = Point.Value.CellFace.X;
                PointStart.Y = Point.Value.CellFace.Y;
                PointStart.Z = Point.Value.CellFace.Z;

                Engine.Point3 PointEnd;

                PointEnd.X = Point2.Value.CellFace.X;
                PointEnd.Y = Point2.Value.CellFace.Y;
                PointEnd.Z = Point2.Value.CellFace.Z;

                // API_WE.Pillar(s, lenght + 1, radius + 1, (Position)pos1, id1, PointStart, m_subsystemTerrain, player);
                API_WE.Rectangle(pos1, id1, PointStart, PointEnd, player, m_subsystemTerrain);
                DialogsManager.HideDialog(this);
                //player.ComponentGui.DisplaySmallMessage(Convert.ToString(radius),false,true);
            }

            if (this.Input.Cancel || this.m_cancelButton.IsClicked)
            {
                DialogsManager.HideDialog(this);
            }

            UpdateControls();
        }
예제 #5
0
        public override void Update()
        {
            radius = (int)m_radius.Value - 1;
            lenght = (int)m_lenght.Value - 1;

            m_blockIconWidget.Value  = id1;
            m_blockIconWidget1.Value = id2;
            m_blockIconWidget2.Value = id3;

            if (plusButton.IsClicked)
            {
                m_radius.Value = MathUtils.Min(m_radius.Value + 1f, (int)m_radius.MaxValue);
            }

            if (minusButton.IsClicked)
            {
                m_radius.Value = MathUtils.Max(m_radius.Value - 1f, (int)m_radius.MinValue);
            }



            if (lenght_plusButton.IsClicked)
            {
                m_lenght.Value = MathUtils.Min(m_lenght.Value + 1f, (int)m_lenght.MaxValue);
            }

            if (lenght_minusButton.IsClicked)
            {
                m_lenght.Value = MathUtils.Max(m_lenght.Value - 1f, (int)m_lenght.MinValue);
            }



            if (Icon_select.IsClicked)
            {
                DialogsManager.ShowDialog(null, new ListSelectionDialog("Select Block", new int[3]
                {
                    8,
                    2,
                    7
                }, 72f, index =>
                {
                    ContainerWidget containerWidget = (ContainerWidget)WidgetsManager.LoadWidget((object)null, ContentManager.Get <XElement>("Widgets/SelectBlockItem"), null);
                    containerWidget.Children.Find <BlockIconWidget>("SelectBlockItem.Block", true).Contents = (int)index;
                    containerWidget.Children.Find <LabelWidget>("SelectBlockItem.Text", true).Text          = BlocksManager.Blocks[(int)index].GetDisplayName(null, Terrain.MakeBlockValue((int)index));

                    return(containerWidget);
                }, index => id1 = (int)index));
            }

            if (Icon_select1.IsClicked)
            {
                DialogsManager.ShowDialog(null, new ListSelectionDialog("Select Block", new int[3]
                {
                    8,
                    2,
                    7
                }, 72f, index =>
                {
                    ContainerWidget containerWidget = (ContainerWidget)WidgetsManager.LoadWidget((object)null, ContentManager.Get <XElement>("Widgets/SelectBlockItem"), null);
                    containerWidget.Children.Find <BlockIconWidget>("SelectBlockItem.Block", true).Contents = (int)index;
                    containerWidget.Children.Find <LabelWidget>("SelectBlockItem.Text", true).Text          = BlocksManager.Blocks[(int)index].GetDisplayName(null, Terrain.MakeBlockValue((int)index));

                    return(containerWidget);
                }, index => id2 = (int)index));
            }

            if (Icon_select2.IsClicked)
            {
                DialogsManager.ShowDialog(null, new ListSelectionDialog("Select Block", new int[3]
                {
                    8,
                    2,
                    7
                }, 72f, index =>
                {
                    ContainerWidget containerWidget = (ContainerWidget)WidgetsManager.LoadWidget((object)null, ContentManager.Get <XElement>("Widgets/SelectBlockItem"), null);
                    containerWidget.Children.Find <BlockIconWidget>("SelectBlockItem.Block", true).Contents = (int)index;
                    containerWidget.Children.Find <LabelWidget>("SelectBlockItem.Text", true).Text          = BlocksManager.Blocks[(int)index].GetDisplayName(null, Terrain.MakeBlockValue((int)index));

                    return(containerWidget);
                }, index => id3 = (int)index));
            }



            if (this.m_okButton.IsClicked)
            {
                Engine.Point3 PointStart;

                PointStart.X = Point.Value.CellFace.X;
                PointStart.Y = Point.Value.CellFace.Y;
                PointStart.Z = Point.Value.CellFace.Z;



                //API_WE.Round(s, radius + 1, lenght + 1, (Position)pos1, id1, Point, m_subsystemTerrain);
                API_WE.Mountain(PointStart, radius, lenght, m_subsystemTerrain, id1, id2, id3, player);
                DialogsManager.HideDialog(this);
                //player.ComponentGui.DisplaySmallMessage(Convert.ToString(radius),false,true);
            }

            if (this.Input.Cancel || this.m_cancelButton.IsClicked)
            {
                DialogsManager.HideDialog(this);
            }

            UpdateControls();
        }
예제 #6
0
        public override void Update()
        {
            if (this.UpdataButton.IsClicked)
            {
                DialogsManager.HideDialog(this);
                SubsystemTerrain subsystemTerrain = GameManager.Project.FindSubsystem <SubsystemTerrain>();
                foreach (TerrainChunk terrainChunk in subsystemTerrain.Terrain.AllocatedChunks)
                {
                    foreach (SubsystemBlockBehavior subsystemBlockBehavior in GameManager.Project.FindSubsystem <SubsystemBlockBehaviors>().BlockBehaviors)
                    {
                        subsystemBlockBehavior.OnChunkDiscarding(terrainChunk);
                    }
                    int chunkX = terrainChunk.Coords.X;
                    int chunkY = terrainChunk.Coords.Y;
                    subsystemTerrain.Dispose();
                    subsystemTerrain.Load(new ValuesDictionary());
                    player.ComponentGui.DisplaySmallMessage("刷新完成!", true, false);
                }
            }
            if (this.OKButton.IsClicked)
            {
                DialogsManager.HideDialog(this);
            }
            if (this.UpdataWorldButton.IsClicked)
            {
                DialogsManager.HideDialog(this);
                WorldInfo world = GameManager.WorldInfo;
                GameManager.SaveProject(true, true);
                GameManager.DisposeProject();
                object[] expr_E9 = new object[2];
                expr_E9[0] = world;
                ScreensManager.SwitchScreen("GameLoading", expr_E9);
            }
            if (this.paletteButton.IsClicked)
            {
                DialogsManager.ShowDialog(null, new CreatorModAPIEditPaletteDialog(worldSettings.Palette));
            }

            Texture2D texture = this.blockTexturesCache.GetTexture(this.worldSettings.BlocksTextureName);

            this.blocksTextureIcon.Subtexture = new Subtexture(texture, Vector2.Zero, Vector2.One);
            this.blocksTextureLabel.Text      = BlocksTexturesManager.GetDisplayName(this.worldSettings.BlocksTextureName);
            this.blocksTextureDetails.Text    = string.Format("{0}x{1}", texture.Width, texture.Height);
            if (this.blocksTextureButton.IsClicked)
            {
                BlocksTexturesManager.UpdateBlocksTexturesList();
                ListSelectionDialog dialog = new ListSelectionDialog("Select Blocks Texture", BlocksTexturesManager.BlockTexturesNames, 64f, delegate(object item)
                {
                    XElement node = ContentManager.Get <XElement>("Widgets/BlocksTextureItem");
                    ContainerWidget containerWidget = (ContainerWidget)WidgetsManager.LoadWidget(this, node, null);
                    Texture2D texture2 = this.blockTexturesCache.GetTexture((string)item);
                    containerWidget.Children.Find <LabelWidget>("BlocksTextureItem.Text", true).Text           = BlocksTexturesManager.GetDisplayName((string)item);
                    containerWidget.Children.Find <LabelWidget>("BlocksTextureItem.Details", true).Text        = string.Format("{0}x{1}", texture2.Width, texture2.Height);
                    containerWidget.Children.Find <RectangleWidget>("BlocksTextureItem.Icon", true).Subtexture = new Subtexture(texture2, Vector2.Zero, Vector2.One);
                    return(containerWidget);
                }, delegate(object item)
                {
                    this.worldSettings.BlocksTextureName          = (string)item;
                    SubsystemBlocksTexture subsystemBlocksTexture = GameManager.Project.FindSubsystem <SubsystemBlocksTexture>();
                    subsystemBlocksTexture.Dispose();
                    subsystemBlocksTexture.Load(new ValuesDictionary());
                });
                DialogsManager.ShowDialog(null, dialog);
            }
            if (this.supernaturalCreaturesButton.IsClicked)
            {
                this.worldSettings.AreSupernaturalCreaturesEnabled = !this.worldSettings.AreSupernaturalCreaturesEnabled;
            }
            if (this.environmentBehaviorButton.IsClicked)
            {
                IList <int> enumValues2 = EnumUtils.GetEnumValues(typeof(EnvironmentBehaviorMode));
                this.worldSettings.EnvironmentBehaviorMode = (EnvironmentBehaviorMode)((enumValues2.IndexOf((int)this.worldSettings.EnvironmentBehaviorMode) + 1) % enumValues2.Count);
            }
            if (this.timeOfDayButton.IsClicked)
            {
                IList <int> enumValues3 = EnumUtils.GetEnumValues(typeof(TimeOfDayMode));
                this.worldSettings.TimeOfDayMode = (TimeOfDayMode)((enumValues3.IndexOf((int)this.worldSettings.TimeOfDayMode) + 1) % enumValues3.Count);
            }
            if (this.weatherEffectsButton.IsClicked)
            {
                this.worldSettings.AreWeatherEffectsEnabled = !this.worldSettings.AreWeatherEffectsEnabled;
            }
            if (this.adventureRespawnButton.IsClicked)
            {
                this.worldSettings.IsAdventureRespawnAllowed = !this.worldSettings.IsAdventureRespawnAllowed;
            }
            if (this.adventureSurvivalMechanicsButton.IsClicked)
            {
                this.worldSettings.AreAdventureSurvivalMechanicsEnabled = !this.worldSettings.AreAdventureSurvivalMechanicsEnabled;
            }
            if (this.terrainGenerationButton.IsClicked)
            {
                IList <int> enumValues = EnumUtils.GetEnumValues(typeof(TerrainGenerationMode));
                DialogsManager.ShowDialog(null, new ListSelectionDialog("Select World Type", enumValues, 56f, (object e) => ((TerrainGenerationMode)e).ToString(), delegate(object e)
                {
                    this.worldSettings.TerrainGenerationMode = (TerrainGenerationMode)e;
                    SubsystemTerrain subsystemTerrain        = GameManager.Project.FindSubsystem <SubsystemTerrain>();
                    if ((TerrainGenerationMode)e == TerrainGenerationMode.Flat)
                    {
                        subsystemTerrain.TerrainContentsGenerator = new TerrainContentsGeneratorFlat(subsystemTerrain);
                    }
                    else
                    {
                        subsystemTerrain.TerrainContentsGenerator = new TerrainContentsGenerator(subsystemTerrain);
                    }
                }));
            }
            if (this.seaLevelOffsetSlider.IsSliding)
            {
                this.worldSettings.SeaLevelOffset = (int)this.seaLevelOffsetSlider.Value;
            }
            if (this.temperatureOffsetSlider.IsSliding)
            {
                this.worldSettings.TemperatureOffset = this.temperatureOffsetSlider.Value;
            }
            if (this.humidityOffsetSlider.IsSliding)
            {
                this.worldSettings.HumidityOffset = this.humidityOffsetSlider.Value;
            }
            if (this.biomeSizeSlider.IsSliding)
            {
                this.worldSettings.BiomeSize = this.biomeSizes[MathUtils.Clamp((int)this.biomeSizeSlider.Value, 0, this.biomeSizes.Length - 1)];
            }
            if (this.islandSizeEW.IsSliding)
            {
                this.worldSettings.IslandSize.X = this.islandSizes[MathUtils.Clamp((int)this.islandSizeEW.Value, 0, this.islandSizes.Length - 1)];
            }
            if (this.islandSizeNS.IsSliding)
            {
                this.worldSettings.IslandSize.Y = this.islandSizes[MathUtils.Clamp((int)this.islandSizeNS.Value, 0, this.islandSizes.Length - 1)];
            }
            if (this.flatTerrainLevelSlider.IsSliding)
            {
                this.worldSettings.TerrainLevel = (int)this.flatTerrainLevelSlider.Value;
            }
            if (this.flatTerrainBlockButton.IsClicked)
            {
                int[] items = new int[]
                {
                    8,
                    2,
                    7,
                    3,
                    67,
                    66,
                    4,
                    5,
                    26,
                    73,
                    21,
                    46,
                    47,
                    15,
                    62,
                    68,
                    126,
                    71,
                    1
                };
                DialogsManager.ShowDialog(null, new ListSelectionDialog("Select Block", items, 72f, delegate(object index)
                {
                    XElement node = ContentManager.Get <XElement>("Widgets/SelectBlockItem");
                    ContainerWidget containerWidget = (ContainerWidget)WidgetsManager.LoadWidget(null, node, null);
                    containerWidget.Children.Find <BlockIconWidget>("SelectBlockItem.Block", true).Contents = (int)index;
                    containerWidget.Children.Find <LabelWidget>("SelectBlockItem.Text", true).Text          = BlocksManager.Blocks[(int)index].GetDisplayName(null, Terrain.MakeBlockValue((int)index));
                    return(containerWidget);
                }, delegate(object index)
                {
                    this.worldSettings.TerrainBlockIndex = (int)index;
                }));
            }
            if (this.flatTerrainMagmaOceanCheckbox.IsClicked)
            {
                this.worldSettings.TerrainOceanBlockIndex = ((this.worldSettings.TerrainOceanBlockIndex == 18) ? 92 : 18);
            }
            this.islandTerrainPanel.IsVisible            = (this.worldSettings.TerrainGenerationMode == TerrainGenerationMode.Island);
            this.flatTerrainPanel.IsVisible              = (this.worldSettings.TerrainGenerationMode == TerrainGenerationMode.Flat);
            this.continentTerrainPanel.IsVisible         = (this.worldSettings.TerrainGenerationMode == TerrainGenerationMode.Continent);
            this.flatTerrainLevelSlider.Value            = (float)this.worldSettings.TerrainLevel;
            this.flatTerrainLevelSlider.Text             = this.worldSettings.TerrainLevel.ToString();
            this.flatTerrainBlock.Contents               = this.worldSettings.TerrainBlockIndex;
            this.flatTerrainMagmaOceanCheckbox.IsChecked = (this.worldSettings.TerrainOceanBlockIndex == 92);
            this.seaLevelOffsetSlider.Value              = (float)this.worldSettings.SeaLevelOffset;
            this.seaLevelOffsetSlider.Text               = WorldOptionsScreen.FormatOffset((float)this.worldSettings.SeaLevelOffset);
            this.temperatureOffsetSlider.Value           = this.worldSettings.TemperatureOffset;
            this.temperatureOffsetSlider.Text            = WorldOptionsScreen.FormatOffset(this.worldSettings.TemperatureOffset);
            this.humidityOffsetSlider.Value              = this.worldSettings.HumidityOffset;
            this.humidityOffsetSlider.Text               = WorldOptionsScreen.FormatOffset(this.worldSettings.HumidityOffset);
            this.biomeSizeSlider.Value                 = (float)FindNearestIndex(this.biomeSizes, this.worldSettings.BiomeSize);
            this.biomeSizeSlider.Text                  = this.worldSettings.BiomeSize.ToString() + "x";
            this.islandSizeEW.Value                    = (float)FindNearestIndex(this.islandSizes, this.worldSettings.IslandSize.X);
            this.islandSizeEW.Text                     = this.worldSettings.IslandSize.X.ToString();
            this.islandSizeNS.Value                    = (float)FindNearestIndex(this.islandSizes, this.worldSettings.IslandSize.Y);
            this.islandSizeNS.Text                     = this.worldSettings.IslandSize.Y.ToString();
            this.supernaturalCreaturesButton.Text      = (this.worldSettings.AreSupernaturalCreaturesEnabled ? "Enabled" : "Disabled");
            this.environmentBehaviorButton.Text        = this.worldSettings.EnvironmentBehaviorMode.ToString();
            this.timeOfDayButton.Text                  = this.worldSettings.TimeOfDayMode.ToString();
            this.weatherEffectsButton.Text             = (this.worldSettings.AreWeatherEffectsEnabled ? "Enabled" : "Disabled");
            this.adventureRespawnButton.Text           = (this.worldSettings.IsAdventureRespawnAllowed ? "Allowed" : "Not Allowed");
            this.adventureSurvivalMechanicsButton.Text = (this.worldSettings.AreAdventureSurvivalMechanicsEnabled ? "Enabled" : "Disabled");
            this.terrainGenerationLabel.Text           = this.worldSettings.TerrainGenerationMode.ToString();
        }
예제 #7
0
        public override void Update()
        {
            radius = (int)m_radius.Value - 1;

            m_blockIconWidget.Value = id1;


            if (plusButton.IsClicked)
            {
                m_radius.Value = MathUtils.Min(m_radius.Value + 1f, (int)m_radius.MaxValue);
            }

            if (minusButton.IsClicked)
            {
                m_radius.Value = MathUtils.Max(m_radius.Value - 1f, (int)m_radius.MinValue);
            }



            if (mSelect_mode.IsClicked)
            {
                Select_mode(m_categories, names);
            }



            if (Icon_select.IsClicked)
            {
                DialogsManager.ShowDialog(null, new ListSelectionDialog("Select Block", new int[20]
                {
                    18,
                    92,
                    2,
                    7,
                    3,
                    67,
                    66,
                    4,
                    5,
                    26,
                    73,
                    21,
                    46,
                    47,
                    15,
                    62,
                    68,
                    126,
                    71,
                    1
                }, 72f, index =>
                {
                    ContainerWidget containerWidget = (ContainerWidget)WidgetsManager.LoadWidget((object)null, ContentManager.Get <XElement>("Widgets/SelectBlockItem"), null);
                    containerWidget.Children.Find <BlockIconWidget>("SelectBlockItem.Block", true).Contents = (int)index;
                    containerWidget.Children.Find <LabelWidget>("SelectBlockItem.Text", true).Text          = BlocksManager.Blocks[(int)index].GetDisplayName(null, Terrain.MakeBlockValue((int)index));

                    return(containerWidget);
                }, index => id1 = (int)index));
            }



            if (this.m_okButton.IsClicked)
            {
                bool s;

                if (Mode.Text == "Hollow")
                {
                    s = true;
                }
                else
                {
                    s = false;
                }



                API_WE.Prism(s, radius, id1, Point, m_subsystemTerrain);

                DialogsManager.HideDialog(this);
            }

            if (this.Input.Cancel || this.m_cancelButton.IsClicked)
            {
                DialogsManager.HideDialog((Dialog)this);
            }

            UpdateControls();
        }
예제 #8
0
        public override void Update()
        {
            radius = (int)m_radius.Value - 1;
            lenght = (int)m_lenght.Value - 1;

            m_blockIconWidget.Value = id1;


            if (plusButton.IsClicked)
            {
                m_radius.Value = MathUtils.Min(m_radius.Value + 1f, (int)m_radius.MaxValue);
            }

            if (minusButton.IsClicked)
            {
                m_radius.Value = MathUtils.Max(m_radius.Value - 1f, (int)m_radius.MinValue);
            }



            if (lenght_plusButton.IsClicked)
            {
                m_lenght.Value = MathUtils.Min(m_lenght.Value + 1f, (int)m_lenght.MaxValue);
            }

            if (lenght_minusButton.IsClicked)
            {
                m_lenght.Value = MathUtils.Max(m_lenght.Value - 1f, (int)m_lenght.MinValue);
            }



            if (mSelect_mode.IsClicked)
            {
                Select_mode(m_categories, names);
            }

            if (mselect_pos.IsClicked)
            {
                Select_pos(m_categories_pos, names_pos);
            }

            if (Icon_select.IsClicked)
            {
                DialogsManager.ShowDialog(null, new ListSelectionDialog("Select Block", new int[21]
                {
                    18,
                    92,
                    8,
                    2,
                    7,
                    3,
                    67,
                    66,
                    4,
                    5,
                    26,
                    73,
                    21,
                    46,
                    47,
                    15,
                    62,
                    68,
                    126,
                    71,
                    1
                }, 72f, index =>
                {
                    ContainerWidget containerWidget = (ContainerWidget)WidgetsManager.LoadWidget((object)null, ContentManager.Get <XElement>("Widgets/SelectBlockItem"), null);
                    containerWidget.Children.Find <BlockIconWidget>("SelectBlockItem.Block", true).Contents = (int)index;
                    containerWidget.Children.Find <LabelWidget>("SelectBlockItem.Text", true).Text          = BlocksManager.Blocks[(int)index].GetDisplayName(null, Terrain.MakeBlockValue((int)index));

                    return(containerWidget);
                }, index => id1 = (int)index));
            }



            if (this.m_okButton.IsClicked)
            {
                bool s;

                if (Mode.Text == "Hollow")
                {
                    s = true;
                }
                else
                {
                    s = false;
                }
                int pos1 = 1;

                if (mPosition.Text == "Flat")
                {
                    pos1 = 1;
                }
                if (mPosition.Text == "Pos_X")
                {
                    pos1 = 0;
                }
                if (mPosition.Text == "Pos_Y")
                {
                    pos1 = 3;
                }



                API_WE.Square(s, radius + 1, lenght + 1, (Position)pos1, id1, Point, m_subsystemTerrain);

                DialogsManager.HideDialog(this);
                //player.ComponentGui.DisplaySmallMessage(Convert.ToString(radius),false,true);
            }

            if (this.Input.Cancel || this.m_cancelButton.IsClicked)
            {
                DialogsManager.HideDialog(this);
            }

            UpdateControls();
        }