Example #1
0
 public override void Update()
 {
     if (this.OKButton.IsClicked)
     {
         Point3 Start, End;
         Start = creatorAPI.Position[0];
         End   = creatorAPI.Position[1];
         CreatorMain.Math.StartEnd(ref Start, ref End);
         for (int x = End.X; x <= Start.X; x++)
         {
             for (int z = End.Z; z <= Start.Z; z++)
             {
                 subsystemTerrain.Terrain.SetTemperature(x, z, (int)TemperatureSlider.Value);
                 subsystemTerrain.Terrain.SetHumidity(x, z, (int)HumiditySlider.Value);
                 subsystemTerrain.Terrain.SetTopHeight(x, z, (int)TopHeightSlider.Value);
                 subsystemTerrain.Terrain.GetChunkAtCoords(x >> 4, z >> 4).State = TerrainChunkState.Valid;
                 subsystemTerrain.Terrain.GetChunkAtCoords(x >> 4, z >> 4).State = TerrainChunkState.InvalidLight;
             }
         }
         this.player.ComponentGui.DisplaySmallMessage("修改成功", true, true);
         DialogsManager.HideDialog(this);
     }
     if (this.cancelButton.IsClicked)
     {
         DialogsManager.HideDialog(this);
     }
     SliderData.Text = $"温度 :{(int)TemperatureSlider.Value} 湿度 :{(int)HumiditySlider.Value} 高度 :{(int)TopHeightSlider.Value}";
 }
Example #2
0
 public override void Update()
 {
     if (bevelledButtonWidget.IsClicked)
     {
         DialogsManager.HideDialog(this);
     }
 }
Example #3
0
 public override void Update()
 {
     base.Update();
     if (this.OKButton.IsClicked)
     {
         Task.Run(() =>
         {
             int num               = 0;
             ChunkData chunkData   = new ChunkData(this.creatorAPI);
             creatorAPI.revokeData = new ChunkData(this.creatorAPI);
             foreach (Point3 point3 in creatorAPI.creatorGenerationAlgorithm.TwoPointLineGeneration2(creatorAPI.Position[0], creatorAPI.Position[1]))
             {
                 creatorAPI.CreateBlock(point3, this.blockIconWidget.Value, chunkData);
                 num++;
                 if (!creatorAPI.launch)
                 {
                     return;
                 }
             }
             chunkData.Render();
             player.ComponentGui.DisplaySmallMessage($"操作成功,共生成{num}个方块", true, true);
         });
         DialogsManager.HideDialog(this);
     }
 }
Example #4
0
        public override void Update()
        {
            if (plusButton.IsClicked)
            {
                m_speed.Value = MathUtils.Min(m_speed.Value + 1f, (int)m_speed.MaxValue);
            }

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

            Speed = (int)m_speed.Value;


            if (this.m_okButton.IsClicked)
            {
                ComponentWE5.speed = Speed;


                DialogsManager.HideDialog(this);
            }

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

            UpdateControls();
        }
Example #5
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();
                }));
            }
        }
Example #6
0
 public override void Update()
 {
     if (this.cancelButton.IsClicked)
     {
         DialogsManager.HideDialog(this);
     }
     if (this.OK.IsClicked)
     {
         string dir = CreatorMain.Export_OnekeyFile_Directory;
         string name;
         if (TextBox.Text.Length <= 0)
         {
             name = $"{DateTime.Now.ToString("yyyy-MM-dd")}_{DateTime.Now.ToLongTimeString().ToString()}";
         }
         else
         {
             name = TextBox.Text;
         }
         if (!FileOperation.IsFileInUse(CreatorMain.OneKeyFile))
         {
             try
             {
                 FileStream fileStream = new FileStream(CreatorMain.OneKeyFile, FileMode.Open);
                 if (!Directory.Exists(dir))
                 {
                     Directory.CreateDirectory(dir);
                 }
                 FileStream files = new FileStream($"{dir}/{name}.o", FileMode.OpenOrCreate);
                 fileStream.CopyTo(files);
                 files.Dispose();
                 fileStream.Dispose();
                 this.player.ComponentGui.DisplaySmallMessage($"导出成功!文件所在位置:\n{dir}/{name}.o", true, false);
                 DialogsManager.HideDialog(this);
                 this.listView.ClearItems();
                 if (!Directory.Exists(CreatorMain.Export_OnekeyFile_Directory))
                 {
                     Directory.CreateDirectory(CreatorMain.Export_OnekeyFile_Directory);
                 }
                 foreach (string file in Directory.GetFiles(CreatorMain.Export_OnekeyFile_Directory))
                 {
                     if (Path.GetExtension(file) == ".o")
                     {
                         this.listView.AddItem(Path.GetFileName(file));
                     }
                 }
             }
             catch (Exception e)
             {
                 this.player.ComponentGui.DisplaySmallMessage($"发生了一个很严重的错误,\n 错误提示 :{e.Message}\n{dir}", true, false);
                 DialogsManager.HideDialog(this);
                 DialogsManager.HideDialog(this.dialog);
             }
         }
         else
         {
             this.player.ComponentGui.DisplaySmallMessage("操作失败!", true, false);
         }
         DialogsManager.HideDialog(this);
     }
 }
Example #7
0
 public override void Update()
 {
     if (slider.IsSliding)
     {
         slider.Value = (int)slider.Value;
     }
     this.slider.Text = "大小:" + (int)slider.Value;
     if (this.OKButton.IsClicked)
     {
         Point3 Start = creatorAPI.Position[0];
         Point3 End   = creatorAPI.Position[1];
         CreatorMain.Math.StartEnd(ref Start, ref End);
         try
         {
             List <int> BlockIDs = new List <int>();
             foreach (string BlockIDString in TextBox.Text.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries))
             {
                 BlockIDs.Add(int.Parse(BlockIDString));
             }
             Task.Run(delegate
             {
                 ChunkData chunkData   = new ChunkData(this.creatorAPI);
                 creatorAPI.revokeData = new ChunkData(this.creatorAPI);
                 int num = 0;
                 for (int x = End.X; x <= Start.X; x++)
                 {
                     for (int y = End.Y; y <= Start.Y; y++)
                     {
                         for (int z = End.Z; z <= Start.Z; z++)
                         {
                             if (!creatorAPI.launch)
                             {
                                 return;
                             }
                             int mx      = (x - End.X) / (int)slider.Value;
                             int my      = (y - End.Y) / (int)slider.Value;
                             int mz      = (z - End.Z) / (int)slider.Value;
                             int blockID = BlockIDs[(mx + my + mz) % (int)BlockIDs.Count];
                             creatorAPI.CreateBlock(x, y, z, blockID, chunkData);
                             num++;
                         }
                     }
                 }
                 chunkData.Render();
                 this.player.ComponentGui.DisplaySmallMessage($"操作成功,共生成{num}个方块", true, true);
             });
         }
         catch
         {
             this.player.ComponentGui.DisplaySmallMessage("操作失败", true, true);
         }
         DialogsManager.HideDialog(this);
     }
     if (this.cancelButton.IsClicked)
     {
         DialogsManager.HideDialog(this);
     }
 }
Example #8
0
 public override void Update()
 {
     base.Update();
     if (this.pillingButton.IsClicked)
     {
         FillingBlock();
         DialogsManager.HideDialog(this);
     }
     if (this.pilling2Button.IsClicked)
     {
         FillingBlock(true);
         DialogsManager.HideDialog(this);
     }
     upDataButton();
 }
Example #9
0
 public override void Update()
 {
     base.Update();
     this.delayLabel.Text = $"大小{(int)this.Radius.Value}块";
     this.upDataButton();
     if (this.SoildButton.IsClicked)
     {
         Task.Run(() =>
         {
             ChunkData chunkData   = new ChunkData(this.creatorAPI);
             creatorAPI.revokeData = new ChunkData(this.creatorAPI);
             int num = 0;
             foreach (Point3 point3 in creatorAPI.creatorGenerationAlgorithm.Prism(creatorAPI.Position[0], (int)Radius.Value, this.creatorType))
             {
                 creatorAPI.CreateBlock(point3, this.blockIconWidget.Value, chunkData);
                 num++;
                 if (!creatorAPI.launch)
                 {
                     return;
                 }
             }
             chunkData.Render();
             player.ComponentGui.DisplaySmallMessage($"操作成功,共生成{num}个方块", true, true);
         });
         DialogsManager.HideDialog(this);
     }
     if (this.HollowButton.IsClicked)
     {
         Task.Run(() =>
         {
             ChunkData chunkData   = new ChunkData(this.creatorAPI);
             creatorAPI.revokeData = new ChunkData(this.creatorAPI);
             int num = 0;
             foreach (Point3 point3 in creatorAPI.creatorGenerationAlgorithm.Prism(creatorAPI.Position[0], (int)Radius.Value, this.creatorType, true))
             {
                 creatorAPI.CreateBlock(point3, this.blockIconWidget.Value, chunkData);
                 num++;
                 if (!creatorAPI.launch)
                 {
                     return;
                 }
             }
             chunkData.Render();
             player.ComponentGui.DisplaySmallMessage($"操作成功,共生成{num}个方块", true, true);
         });
         DialogsManager.HideDialog(this);
     }
 }
Example #10
0
 public override void upClickButton(int id)
 {
     if (this.SoildButton.IsClicked)
     {
         Task.Run(() =>
         {
             int num               = 0;
             ChunkData chunkData   = new ChunkData(this.creatorAPI);
             creatorAPI.revokeData = new ChunkData(this.creatorAPI);
             foreach (Point3 point3 in creatorAPI.creatorGenerationAlgorithm.Circle(creatorAPI.Position[0], (int)Height.Value, (int)Radius.Value, this.creatorType))
             {
                 creatorAPI.CreateBlock(point3, id, chunkData);
                 num++;
                 if (!creatorAPI.launch)
                 {
                     return;
                 }
             }
             chunkData.Render();
             player.ComponentGui.DisplaySmallMessage($"操作成功,共生成{num}个方块", true, true);
         });
         DialogsManager.HideDialog(this);
     }
     if (this.HollowButton.IsClicked)
     {
         Task.Run(() =>
         {
             int num               = 0;
             ChunkData chunkData   = new ChunkData(this.creatorAPI);
             creatorAPI.revokeData = new ChunkData(this.creatorAPI);
             foreach (Point3 point3 in creatorAPI.creatorGenerationAlgorithm.Circle(creatorAPI.Position[0], (int)Height.Value, (int)Radius.Value, this.creatorType, true))
             {
                 creatorAPI.CreateBlock(point3, id, chunkData);
                 num++;
                 if (!creatorAPI.launch)
                 {
                     return;
                 }
             }
             chunkData.Render();
             player.ComponentGui.DisplaySmallMessage($"操作成功,共生成{num}个方块", true, true);
         });
         DialogsManager.HideDialog(this);
     }
 }
 public override void Update()
 {
     if (this.cancelButton.IsClicked)
     {
         DialogsManager.HideDialog(this);
     }
     if (this.OK.IsClicked)
     {
         if (this.TextBox.Text == CreatorMain.password)
         {
             CreatorMain.canUse = true;
             this.player.ComponentGui.DisplaySmallMessage($"创世神{CreatorMain.version}功能开启", true, false);
         }
         else
         {
             this.player.ComponentGui.DisplaySmallMessage($"创世神{CreatorMain.version}功能开启失败", true, false);
         }
         DialogsManager.HideDialog(this);
     }
 }
Example #12
0
 public override void Update()
 {
     if (this.cancelButton.IsClicked)
     {
         DialogsManager.HideDialog(this);
     }
     if (this.OK.IsClicked)
     {
         if (this.TextBox.Text == "HelloWorld")
         {
             CreatorMain.professional = true;
             this.player.ComponentGui.DisplaySmallMessage($"创世神{CreatorMain.version}专业模式开启", true, false);
         }
         else
         {
             this.player.ComponentGui.DisplaySmallMessage($"创世神{CreatorMain.version}专业模式开启失败", true, false);
         }
         DialogsManager.HideDialog(this);
     }
 }
Example #13
0
 public override void Update()
 {
     if (this.cancelButton.IsClicked)
     {
         DialogsManager.HideDialog(this);
     }
     if (this.Transfer.IsClicked)
     {
         Point3 p;
         if (!int.TryParse(this.X.Text, out p.X) || !int.TryParse(this.Y.Text, out p.Y) || !int.TryParse(this.Z.Text, out p.Z))
         {
             this.player.ComponentGui.DisplaySmallMessage("请输入正当的做标", true, true);
         }
         else
         {
             Vector3 v = new Vector3(p.X, p.Y, p.Z);
             this.player.ComponentBody.Position = v;
             this.player.ComponentGui.DisplaySmallMessage($"成功传送到:\nX:{(int)v.X} , Y:{(int)v.Y} , Z:{(int)v.Z}", true, true);
         }
         DialogsManager.HideDialog(this);
     }
 }
Example #14
0
 public override void Update()
 {
     if (this.Cancel.IsClicked)
     {
         DialogsManager.HideDialog(this);
     }
     if (this.OK.IsClicked)
     {
         player.PlayerData.Level = Radius.Value;
         this.player.ComponentGui.DisplaySmallMessage($"操作成功,等级设置成:{(int)Radius.Value}级", true, true);
         DialogsManager.HideDialog(this);
     }
     if (this.minusButton.IsClicked)
     {
         this.Radius.Value = MathUtils.Max(this.Radius.Value - 1f, (float)((int)this.Radius.MinValue));
     }
     if (this.plusButton.IsClicked)
     {
         this.Radius.Value = MathUtils.Min(this.Radius.Value + 1f, (float)((int)this.Radius.MaxValue));
     }
     this.UpdateControls();
 }
Example #15
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();
        }
Example #16
0
        public override void Update()
        {
            //list_build.ClearItems();


            // list_build.SelectionChanged += delegate
            // {

            selected_item = list_build.SelectedItem as string;
            //  };


            if (Cancel.IsClicked)
            {
                DialogsManager.HideDialog(this);
            }
            if (MoreButton.IsClicked)
            {
                if (ComponentWE5.m_componentPlayer != null)
                {
                    DialogsManager.ShowDialog(ComponentWE5.m_componentPlayer.View.GameWidget, new ListSelectionDialog(string.Empty, m_categories, 56f, c =>
                    {
                        LabelWidget labelWidget = new LabelWidget();
                        labelWidget.Text        = ((Category)c).Name;
                        labelWidget.Color       = Color.White;
                        int num1 = 1;
                        labelWidget.HorizontalAlignment = (WidgetAlignment)num1;
                        int num2 = 1;
                        labelWidget.VerticalAlignment = (WidgetAlignment)num2;
                        return(labelWidget);
                    }, c =>
                    {
                        if (c == null)
                        {
                            return;
                        }
                        int d     = m_categories.IndexOf((Category)c);
                        string ds = names_item[d];

                        if (ds == "Delete")
                        {
                            DialogsManager.ShowDialog((ContainerWidget)player.View.GameWidget, (Dialog) new MessageDialog("Warning", "Bild will deleted ", "Delete", "Cancel", (Action <MessageDialogButton>)(b =>
                            {
                                if (b != MessageDialogButton.Button1)
                                {
                                    return;
                                }
                                File.Delete(Path.Combine(Path_mod, selected_item));
                                update_builds();
                            })));
                        }

                        if (ds == "Rename")
                        {
                            this.Input.EnterText("Furniture Set Name", selected_item, 20, s =>
                            {
                                if (s == null)
                                {
                                    return;
                                }

                                //File.Replace();
                                //using (Stream fs2 = File.Open(Path.Combine(Path_mod, selected_item), FileMode.))
                                // {
                                // rename(fs2, Path.Combine(Path_mod,s));
                                //  fs2.Dispose();
                                //}



                                //Storage.DeleteFile(Path.Combine(Path_mod, selected_item));
                            });
                        }

                        if (ds == "Create")
                        {
                            if (Point3 == null)
                            {
                                DialogsManager.HideDialog(this);
                                player.ComponentGui.DisplaySmallMessage("You have not selected point 3", false, false);
                            }

                            else
                            {
                                Engine.Point3 Start;

                                Start.X = Point3.Value.CellFace.X;
                                Start.Y = Point3.Value.CellFace.Y;
                                Start.Z = Point3.Value.CellFace.Z;



                                API_WE.Paste_zone(Start, subsystemTerrain, player, Path.Combine(Path_mod, selected_item));

                                DialogsManager.HideDialog(this);
                            }
                            //player.ComponentGui.DisplaySmallMessage(path, true, true);
                            //bool flag = true;
                        }


                        //Mode.Text = ds;
                        // player.ComponentGui.DisplaySmallMessage(ds, false, true);
                    }));
                }
            }



            if (list_build.SelectedItem != null)
            {
                MoreButton.IsEnabled = true;
            }
            else
            {
                MoreButton.IsEnabled = false;
            }


            if (AddButton.IsClicked)
            {
                //Storage.OpenFile(Path_mod + name_file + ".scbuild", OpenFileMode.Create);
                //string path = Path.Combine(Path_mod,name_file, ".scbuild");
                if (Point1 == null && Point2 == null)
                {
                    player.ComponentGui.DisplaySmallMessage("You have not selected points 1,2", false, false);
                    DialogsManager.HideDialog(this);
                }

                else
                {
                    this.Input.EnterText("Name build", "New build", 20, s =>
                    {
                        if (s == null)
                        {
                            return;
                        }

                        name_file = s;

                        //  using (Stream stream = File.Open(Path.Combine(Path_mod, name_file + ".scbuild"), FileMode.Create))
                        // {
                        // }



                        Engine.Point3 PointStart;

                        PointStart.X = Point1.Value.CellFace.X;
                        PointStart.Y = Point1.Value.CellFace.Y;
                        PointStart.Z = Point1.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.Coppy_zone(Path.Combine(Path_mod, name_file + ".scbuild"), PointStart, PointEnd, subsystemTerrain, player);
                        update_builds();
                    });
                }
            }
        }
Example #17
0
        public override void Update()
        {
            base.Update();
            AdvancedButton.Color           = advanced ? Color.Yellow : Color.White;
            DoublePositionButton.Color     = DoublePosition ? Color.Yellow : Color.White;
            AdvancedGenerate.IsVisible     = advanced;
            DoublePositionButton.IsVisible = advanced;
            this.XdelayLabel.Text          = advanced ? $"X半径大小{(int)this.XRadius.Value}块" : $"半径大小{(int)this.XRadius.Value}块";
            this.YdelayLabel.Text          = $"Y半径大小{(int)this.YRadius.Value}块";
            this.ZdelayLabel.Text          = $"Z半径大小{(int)this.ZRadius.Value}块";
            int id = this.blockIconWidget.Value;

            if (DoublePositionButton.IsClicked)
            {
                DoublePosition = !DoublePosition;
            }
            if (AdvancedButton.IsClicked)
            {
                advanced = !advanced;
            }
            if (SoildButton.IsClicked)
            {
                if (advanced)
                {
                    if (!DoublePosition)
                    {
                        Task.Run(() =>
                        {
                            ChunkData chunkData   = new ChunkData(this.creatorAPI);
                            creatorAPI.revokeData = new ChunkData(this.creatorAPI);
                            int num = 0;
                            foreach (Point3 point3 in creatorAPI.creatorGenerationAlgorithm.Sphere(new Vector3(creatorAPI.Position[0]), (int)XRadius.Value, (int)YRadius.Value, (int)ZRadius.Value))
                            {
                                if (!creatorAPI.launch)
                                {
                                    return;
                                }
                                creatorAPI.CreateBlock(point3, id, chunkData);
                                num++;
                            }
                            chunkData.Render();
                            player.ComponentGui.DisplaySmallMessage($"操作成功,共生成{num}个方块", true, true);
                        });
                    }
                    else
                    {
                        if (creatorAPI.Position[1].Y != -1)
                        {
                            Point3 Start = creatorAPI.Position[0];
                            Point3 End   = creatorAPI.Position[1];
                            CreatorMain.Math.StartEnd(ref Start, ref End);
                            float x = Math.Abs((float)Start.X - End.X) / 2f;
                            float y = Math.Abs((float)Start.Y - End.Y) / 2f;
                            float z = Math.Abs((float)Start.Z - End.Z) / 2f;
                            Task.Run(() =>
                            {
                                ChunkData chunkData   = new ChunkData(this.creatorAPI);
                                creatorAPI.revokeData = new ChunkData(this.creatorAPI);
                                int num = 0;
                                foreach (Point3 point3 in creatorAPI.creatorGenerationAlgorithm.Sphere(new Vector3(End.X + x, End.Y + y, End.Z + z), (int)x, (int)y, (int)z))
                                {
                                    if (!creatorAPI.launch)
                                    {
                                        return;
                                    }
                                    creatorAPI.CreateBlock(point3, id, chunkData);
                                    num++;
                                }
                                chunkData.Render();
                                player.ComponentGui.DisplaySmallMessage($"操作成功,共生成{num}个方块", true, true);
                            });
                        }
                    }
                }
                else
                {
                    Task.Run(() =>
                    {
                        ChunkData chunkData   = new ChunkData(this.creatorAPI);
                        creatorAPI.revokeData = new ChunkData(this.creatorAPI);
                        int num = 0;
                        foreach (Point3 point3 in creatorAPI.creatorGenerationAlgorithm.Sphere(new Vector3(creatorAPI.Position[0]), (int)XRadius.Value, (int)XRadius.Value, (int)XRadius.Value))
                        {
                            if (!creatorAPI.launch)
                            {
                                return;
                            }
                            creatorAPI.CreateBlock(point3, id, chunkData);
                            num++;
                        }
                        chunkData.Render();
                        player.ComponentGui.DisplaySmallMessage($"操作成功,共生成{num}个方块", true, true);
                    });
                }
                DialogsManager.HideDialog(this);
            }

            if (HollowButton.IsClicked)
            {
                if (advanced)
                {
                    if (!DoublePosition)
                    {
                        Task.Run(() =>
                        {
                            int num               = 0;
                            ChunkData chunkData   = new ChunkData(this.creatorAPI);
                            creatorAPI.revokeData = new ChunkData(this.creatorAPI);
                            foreach (Point3 point3 in creatorAPI.creatorGenerationAlgorithm.Sphere(new Vector3(creatorAPI.Position[0]), (int)XRadius.Value, (int)YRadius.Value, (int)ZRadius.Value, true))
                            {
                                if (!creatorAPI.launch)
                                {
                                    return;
                                }
                                creatorAPI.CreateBlock(point3, id, chunkData);
                                num++;
                            }
                            chunkData.Render();
                            player.ComponentGui.DisplaySmallMessage($"操作成功,共生成{num}个方块", true, true);
                        });
                    }
                    else
                    {
                        if (creatorAPI.Position[1].Y != -1)
                        {
                            Point3 Start = creatorAPI.Position[0];
                            Point3 End   = creatorAPI.Position[1];
                            CreatorMain.Math.StartEnd(ref Start, ref End);
                            float x = Math.Abs((float)Start.X - End.X) / 2f;
                            float y = Math.Abs((float)Start.Y - End.Y) / 2f;
                            float z = Math.Abs((float)Start.Z - End.Z) / 2f;
                            Task.Run(() =>
                            {
                                ChunkData chunkData   = new ChunkData(this.creatorAPI);
                                creatorAPI.revokeData = new ChunkData(this.creatorAPI);
                                int num = 0;
                                foreach (Point3 point3 in creatorAPI.creatorGenerationAlgorithm.Sphere(new Vector3(End.X + x, End.Y + y, End.Z + z), (int)x, (int)y, (int)z, true))
                                {
                                    if (!creatorAPI.launch)
                                    {
                                        return;
                                    }
                                    creatorAPI.CreateBlock(point3, id, chunkData);
                                    num++;
                                }
                                chunkData.Render();
                                player.ComponentGui.DisplaySmallMessage($"操作成功,共生成{num}个方块", true, true);
                            });
                        }
                    }
                }
                else
                {
                    Task.Run(() =>
                    {
                        ChunkData chunkData   = new ChunkData(this.creatorAPI);
                        creatorAPI.revokeData = new ChunkData(this.creatorAPI);
                        int num = 0;
                        foreach (Point3 point3 in creatorAPI.creatorGenerationAlgorithm.Sphere(new Vector3(creatorAPI.Position[0]), (int)XRadius.Value, (int)XRadius.Value, (int)XRadius.Value, true))
                        {
                            if (!creatorAPI.launch)
                            {
                                return;
                            }
                            creatorAPI.CreateBlock(point3, id, chunkData);
                            num++;
                        }
                        chunkData.Render();
                        player.ComponentGui.DisplaySmallMessage($"操作成功,共生成{num}个方块", true, true);
                    });
                }
                DialogsManager.HideDialog(this);
            }
        }
        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();
        }
Example #19
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();
        }
Example #20
0
        public override void Update()
        {
            if (creatorAPI.AirIdentify)
            {
                AirIdentifyButton.Color = Color.Yellow;
            }
            else
            {
                AirIdentifyButton.Color = Color.Red;
            }
            if (creatorAPI.launch)
            {
                generatingSet.Color = Color.Yellow;
            }
            else
            {
                generatingSet.Color = Color.Red;
            }
            if (creatorAPI.UnLimitedOfCreate)
            {
                this.unLimited.Color = Color.Yellow;
            }
            else
            {
                this.unLimited.Color = Color.Red;
            }
            if (this.creatorAPI.RevokeSwitch)
            {
                this.RevokeButton.Color = Color.Yellow;
            }
            else
            {
                this.RevokeButton.Color = Color.Red;
            }
            if (this.creatorAPI.oldMainWidget)
            {
                this.setMainWidgetButton.Color = Color.Yellow;
            }
            else
            {
                this.setMainWidgetButton.Color = Color.Red;
            }
            if (this.professionButton.IsClicked)
            {
                DialogsManager.ShowDialog(this.creatorAPI.componentMiner.ComponentPlayer.View.GameWidget, new PasswordDialog(this.creatorAPI.componentMiner.ComponentPlayer));
            }
            this.professionButton.IsEnabled = !CreatorMain.professional;
            this.unLimited.IsEnabled        = CreatorMain.professional;
            //this.RevokeButton.IsEnabled = CreatorMain.professional;
            switch (creatorAPI.amountPoint)
            {
            case CreatorAPI.NumberPoint.One:
                SetPositionMode.Text = "1点模式";
                break;

            case CreatorAPI.NumberPoint.Two:
                SetPositionMode.Text = "2点模式";
                break;

            case CreatorAPI.NumberPoint.Three:
                SetPositionMode.Text = "3点模式";
                break;

            case CreatorAPI.NumberPoint.Four:
                SetPositionMode.Text = "4点模式";
                break;
            }
            if (SetPositionMode.IsClicked)
            {
                int[] p = new int[4] {
                    1, 2, 3, 4
                };
                DialogsManager.ShowDialog(null, new ListSelectionDialog("选择设置点模式", p, 56f, (object e) => $"{(int)e}点模式", delegate(object e)
                {
                    creatorAPI.amountPoint = (CreatorAPI.NumberPoint)((int)e - 1);
                }));
            }
            if (this.unLimited.IsClicked)
            {
                this.creatorAPI.componentMiner.ComponentPlayer.ComponentGui.DisplaySmallMessage("超距模式建议在性能强劲的设备上使用,而且请不要空间过大,不然可能造成内存溢出而导致毁图", true, false);
                this.creatorAPI.UnLimitedOfCreate = !this.creatorAPI.UnLimitedOfCreate;
            }
            if (this.AirIdentifyButton.IsClicked)
            {
                this.creatorAPI.AirIdentify = !this.creatorAPI.AirIdentify;
            }
            if (this.RevokeButton.IsClicked)
            {
                this.creatorAPI.componentMiner.ComponentPlayer.ComponentGui.DisplaySmallMessage("超距模式下尽量不要使用撤回功能", true, false);
                this.creatorAPI.RevokeSwitch = !this.creatorAPI.RevokeSwitch;
            }
            switch (creatorAPI.CreateBlockType)
            {
            case CreateBlockType.Normal:
                this.generatingMod.Text = "正常生成";
                break;

            case CreateBlockType.Fast:
                this.generatingMod.Text = "快速生成";
                break;

            case CreateBlockType.Catch:
                this.generatingMod.Text = "缓存生成";
                break;
            }
            if (this.resettingButton.IsClicked)
            {
                creatorAPI.launch          = true;
                creatorAPI.CreateBlockType = CreateBlockType.Fast;
                generatingSet.Color        = Color.Yellow;
                creatorAPI.amountPoint     = CreatorAPI.NumberPoint.Two;
            }
            if (generatingMod.IsClicked)
            {
                IList <int> enumValues     = EnumUtils.GetEnumValues(typeof(CreateBlockType));
                string[]    createZhString = new string[3] {
                    "正常生成", "快速生成", "缓存生成"
                };
                DialogsManager.ShowDialog(null, new ListSelectionDialog("选择生成类型", enumValues, 56f, (object e) => createZhString[(int)e], delegate(object e)
                {
                    this.creatorAPI.CreateBlockType = (CreateBlockType)e;
                }));
            }
            if (generatingSet.IsClicked)
            {
                creatorAPI.launch = !creatorAPI.launch;
            }
            if (this.OK.IsClicked)
            {
                DialogsManager.HideDialog(this);
            }
            if (this.setMainWidgetButton.IsClicked)
            {
                this.creatorAPI.oldMainWidget = !this.creatorAPI.oldMainWidget;
            }
        }
Example #21
0
 public override void Update()
 {
     this.TypeButton.IsEnabled = false;
     if (this.OKButton.IsClicked)
     {
         DialogsManager.HideDialog(this);
     }
     if (this.ImportButton.IsClicked)
     {
         if (!Directory.Exists(CreatorMain.CacheDirectory))
         {
             Directory.CreateDirectory(CreatorMain.CacheDirectory);
         }
         string sdFile  = CreatorMain.OneKeyFile;
         string _sdFile = CreatorMain.Export_OnekeyFile_Directory + "/" + (string)this.ListView.SelectedItem;
         if (!FileOperation.IsFileInUse(_sdFile) && (!File.Exists(sdFile) || !FileOperation.IsFileInUse(sdFile)))
         {
             FileStream fileStream = new FileStream(_sdFile, FileMode.Open);
             FileStream file       = new FileStream(sdFile, FileMode.Create);
             fileStream.CopyTo(file);
             file.Dispose();
             fileStream.Dispose();
             player.ComponentGui.DisplaySmallMessage("导入成功!", true, false);
         }
         else
         {
             player.ComponentGui.DisplaySmallMessage("操作失败!", true, false);
         }
         DialogsManager.HideDialog(this);
     }
     if (DeleteButton.IsClicked)
     {
         string sdFile = CreatorMain.Export_OnekeyFile_Directory + "/" + (string)this.ListView.SelectedItem;
         if (FileOperation.Delete(sdFile))
         {
             player.ComponentGui.DisplaySmallMessage("删除成功!", true, false);
             UpList();
         }
         else
         {
             player.ComponentGui.DisplaySmallMessage("操作失败!", true, false);
         }
     }
     this.DerivedButton.IsEnabled = File.Exists(CreatorMain.OneKeyFile);
     if (this.DerivedButton.IsClicked)
     {
         DialogsManager.ShowDialog(player.View.GameWidget, new DerivedDialog(player, this, this.ListView));
     }
     if (this.CreateButton.IsClicked)
     {
         if (creatorAPI.Position[2] == new Point3(0, -1, 0))
         {
             player.ComponentGui.DisplaySmallMessage("请设置点3!", true, false);
         }
         else
         {
             Task.Run(() =>
             {
                 try
                 {
                     if (!Directory.Exists(CreatorMain.CacheDirectory))
                     {
                         Directory.CreateDirectory(CreatorMain.CacheDirectory);
                     }
                     OnekeyGeneration.CreateOnekey(creatorAPI, CreatorMain.CacheDirectory + "/", "CacheFile.od", creatorAPI.Position[0], creatorAPI.Position[1], creatorAPI.Position[2]);
                 }
                 catch (Exception e)
                 {
                     player.ComponentGui.DisplaySmallMessage(e.Message, true, false);
                 }
             });
         }
         DialogsManager.HideDialog(this);
     }
     if (ListView.SelectedIndex == null)
     {
         this.ImportButton.IsEnabled = false;
         this.DeleteButton.IsEnabled = false;
     }
     else
     {
         this.ImportButton.IsEnabled = true;
         this.DeleteButton.IsEnabled = true;
     }
     if (creatorAPI.oneKeyGeneration)
     {
         OnAndOffButton.Color = Color.Yellow;
     }
     else
     {
         OnAndOffButton.Color = Color.Red;
     }
     if (OnAndOffButton.IsClicked)
     {
         if (creatorAPI.oneKeyGeneration)
         {
             creatorAPI.oneKeyGeneration = false;
         }
         else
         {
             creatorAPI.oneKeyGeneration = true;
         }
     }
 }
Example #22
0
        public override void Update()
        {
            this.num_1.Text = $"参数1 :{(int)num1.Value}";
            this.num_2.Text = $"参数2 :{(int)num2.Value}";
            this.num_3.Text = $"参数3 :{(int)num3.Value}";
            if (this.restting.IsClicked)
            {
                this.num1.Value   = 0f;
                this.num2.Value   = 0f;
                this.num3.Value   = 100f;
                this.TextBox.Text = "3:2:8";
            }
            if (this.cancelButton.IsClicked)
            {
                DialogsManager.HideDialog(this);
            }
            if (this.OK.IsClicked)
            {
                int      BlockID_1;
                int?     BlockID_2 = null, BlockID_3 = null;
                string[] texts = TextBox.Text.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
                if (texts.Length == 2)
                {
                    if (!int.TryParse(texts[0], out BlockID_1))
                    {
                        BlockID_1 = 0;
                    }
                    int id;
                    if (int.TryParse(texts[1], out id))
                    {
                        BlockID_2 = id;
                    }
                }
                else if (texts.Length >= 3)
                {
                    if (!int.TryParse(texts[0], out BlockID_1))
                    {
                        BlockID_1 = 0;
                    }
                    int id;
                    if (int.TryParse(texts[1], out id))
                    {
                        BlockID_2 = id;
                    }
                    if (int.TryParse(texts[2], out id))
                    {
                        BlockID_3 = id;
                    }
                }
                else
                {
                    if (!int.TryParse(TextBox.Text, out BlockID_1))
                    {
                        BlockID_1 = 0;
                    }
                }
                Vector3 vector = new Vector3
                {
                    X = num1.Value,
                    Y = num2.Value,
                    Z = num3.Value
                };

                Point3 Start = creatorAPI.Position[0];
                Point3 End   = creatorAPI.Position[1];
                CreatorMain.Math.StartEnd(ref Start, ref End);
                float X_Radius = (Start.X - End.X) / 2f;
                float Z_Radius = (Start.Z - End.Z) / 2f;
                float Radius   = X_Radius > Z_Radius ? X_Radius : Z_Radius;
                float radius   = X_Radius > Z_Radius ? Z_Radius : X_Radius;
                Radius = Math.Abs(Math.Abs(Radius) - 2f + vector.X);
                if (BlockID_2 == null)
                {
                    BlockID_2 = BlockID_1;
                }
                if (BlockID_3 == null)
                {
                    BlockID_3 = BlockID_2;
                }
                Task.Run(() =>
                {
                    ChunkData chunkData   = new ChunkData(this.creatorAPI);
                    creatorAPI.revokeData = new ChunkData(this.creatorAPI);
                    Game.Random random    = new Game.Random();
                    double pi             = Math.PI * 0.5f;
                    int number            = 0;
                    float num             = 1.25f + (vector.Y / 99f);
                    float rand            = random.UniformFloat(18f, 25f + (vector.Z / 10f));
                    for (int x = (int)-X_Radius; x <= (int)X_Radius; x++)
                    {
                        for (int z = (int)-Z_Radius; z <= Z_Radius; z++)
                        {
                            var a  = (Math.Cos(pi * x / Radius) * Math.Cos(pi * z / radius)) * (Start.Y - End.Y);
                            var b  = (Math.Sin(pi * x * num / radius + 2f) * Math.Cos(pi * z * num / Radius + 7f)) * (Start.Y - End.Y) * 0.35f;
                            var c  = (Math.Sin(pi * x * num * 2f / Radius + 2f * rand) * Math.Sin(pi * z * num * 2f / radius + 8f * rand)) * (Start.Y - End.Y) * 0.2f;
                            var e  = (Math.Sin(pi * x * num * 3.5f / radius + 2f * rand * 1.5f) * Math.Sin(pi * z * num * 3.5f / Radius + 12f * rand * 1.5f)) * (Start.Y - End.Y) * 0.15f;
                            var ls = a - b + c - e;
                            if (ls > 0f)
                            {
                                for (var i = 0; i <= ls; i++)
                                {
                                    Point3 point3 = new Point3((Start.X + End.X) / 2 + x, End.Y + (int)ls - i, (Start.Z + End.Z) / 2 + z);
                                    if (i > 5)
                                    {
                                        creatorAPI.CreateBlock(point3, BlockID_1, chunkData);
                                    }
                                    else if (i > 0)
                                    {
                                        creatorAPI.CreateBlock(point3, (int)BlockID_2, chunkData);
                                    }
                                    else if (i == 0)
                                    {
                                        creatorAPI.CreateBlock(point3, (int)BlockID_3, chunkData);
                                    }
                                    number++;
                                    if (!creatorAPI.launch)
                                    {
                                        return;
                                    }
                                }
                            }
                        }
                    }
                    chunkData.Render();
                    this.player.ComponentGui.DisplaySmallMessage($"操作成功,共生成{number}个方块", true, true);
                });
                DialogsManager.HideDialog(this);
            }
        }
        public override void Update()
        {
            selected_item = list_build.SelectedItem as string;



            if (Cancel.IsClicked)
            {
                DialogsManager.HideDialog(this);
            }
            if (MoreButton.IsClicked)
            {
                if (ComponentWE5.m_componentPlayer != null)
                {
                    DialogsManager.ShowDialog(ComponentWE5.m_componentPlayer.View.GameWidget, new ListSelectionDialog(string.Empty, m_categories, 56f, c =>
                    {
                        LabelWidget labelWidget = new LabelWidget();
                        labelWidget.Text        = ((Category)c).Name;
                        labelWidget.Color       = Color.White;
                        int num1 = 1;
                        labelWidget.HorizontalAlignment = (WidgetAlignment)num1;
                        int num2 = 1;
                        labelWidget.VerticalAlignment = (WidgetAlignment)num2;
                        return(labelWidget);
                    }, c =>
                    {
                        if (c == null)
                        {
                            return;
                        }
                        int d     = m_categories.IndexOf((Category)c);
                        string ds = names_item[d];

                        if (ds == "Delete")
                        {
                            DialogsManager.ShowDialog((ContainerWidget)player.View.GameWidget, (Dialog) new MessageDialog("Warning", "Image will deleted ", "Delete", "Cancel", (Action <MessageDialogButton>)(b =>
                            {
                                if (b != MessageDialogButton.Button1)
                                {
                                    return;
                                }
                                File.Delete(Path.Combine(Path_img, selected_item));
                                update_builds();
                            })));
                        }



                        if (ds == "Create")
                        {
                            if (Point3 == null)
                            {
                                DialogsManager.HideDialog(this);
                                player.ComponentGui.DisplaySmallMessage("You have not selected point 3", false, false);
                            }

                            else
                            {
                                Engine.Point3 Start;

                                Start.X = Point3.Value.CellFace.X;
                                Start.Y = Point3.Value.CellFace.Y;
                                Start.Z = Point3.Value.CellFace.Z;

                                SettingsManager.GuiSize = GuiSize.Smallest;

                                DialogsManager.ShowDialog(player.View.GameWidget, new Img(player, Path.Combine(Path_img, selected_item), Point3, subsystemTerrain));



                                DialogsManager.HideDialog(this);
                            }
                        }
                    }));
                }
            }



            if (list_build.SelectedItem != null)
            {
                MoreButton.IsEnabled = true;
            }
            else
            {
                MoreButton.IsEnabled = false;
            }


            if (AddButton.IsClicked)
            {
                this.Input.EnterText("URL image", " ", 100, s =>
                {
                    if (s == null)
                    {
                        return;
                    }


                    WEB_manager.Dowland(Path_img, s, c =>
                    {
                        DialogsManager.ShowDialog((ContainerWidget)player.View.GameWidget, (Dialog) new MessageDialog("Error download image", c, null, "OK", null));
                    }, null);



                    update_builds();
                });
            }
        }
Example #24
0
        public override void Update()
        {
            resize       = (int)m_resizeSlider.Value;
            furnit_resol = (int)m_furniture_resolutionSlider.Value;
            deep_color   = (int)m_deep_colorSlider.Value;
            ofst_color   = (int)m_color_ofsetSlider.Value;


            if (m_type_creatingButton.IsClicked)
            {
                Select_type_creating();
            }

            if (m_posButton.IsClicked)
            {
                Select_pos();
            }
            if (m_rotButton.IsClicked)
            {
                Select_rot();
            }


            if (m_okButton.IsClicked)
            {
                if (t_c_txt == "Furniture")
                {
                    type_cr = true;
                }
                else
                {
                    type_cr = false;
                }


                if (pos_txt == "Vertical")
                {
                    pos = false;
                }
                else
                {
                    pos = true;
                }

                if (rot_txt == "Front")
                {
                    rot = true;
                }
                else
                {
                    rot = false;
                }
                //  player.ComponentGui.DisplaySmallMessage(string.Format(type_cr.ToString()), true, true);
                API_WE.draw_img(m_mirrorBox.IsChecked, ofst_color, m_color_saveBox.IsChecked, m_colors_useBox.IsChecked, deep_color, type_cr, resize, furnit_resol, pos, rot, path_img, Point, m_subsystemTerrain, player);
                DialogsManager.HideDialog((Dialog)this);
            }



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

            UpdateControls();
        }
Example #25
0
 public override void Update()
 {
     base.Update();
     if (this.SoildButton.IsClicked)
     {
         Task.Run(() =>
         {
             ChunkData chunkData   = new ChunkData(creatorAPI);
             creatorAPI.revokeData = new ChunkData(creatorAPI);
             int num = 0;
             foreach (Point3 point3 in creatorAPI.creatorGenerationAlgorithm.Rectangular(creatorAPI.Position[0], creatorAPI.Position[1]))
             {
                 if (!creatorAPI.launch)
                 {
                     return;
                 }
                 creatorAPI.CreateBlock(point3, this.blockIconWidget.Value, chunkData);
                 num++;
             }
             chunkData.Render();
             player.ComponentGui.DisplaySmallMessage($"操作成功,共生成{num}个方块", true, true);
         });
         DialogsManager.HideDialog(this);
     }
     if (this.HollowButton.IsClicked)
     {
         Task.Run(() =>
         {
             ChunkData chunkData   = new ChunkData(creatorAPI);
             creatorAPI.revokeData = new ChunkData(creatorAPI);
             int num = 0;
             foreach (Point3 point3 in creatorAPI.creatorGenerationAlgorithm.Rectangular(creatorAPI.Position[0], creatorAPI.Position[1], true))
             {
                 if (!creatorAPI.launch)
                 {
                     return;
                 }
                 creatorAPI.CreateBlock(point3, this.blockIconWidget.Value, chunkData);
                 num++;
             }
             chunkData.Render();
             player.ComponentGui.DisplaySmallMessage($"操作成功,共生成{num}个方块", true, true);
         });
         DialogsManager.HideDialog(this);
     }
     if (this.FrameworkButton.IsClicked)
     {
         Task.Run(() =>
         {
             ChunkData chunkData   = new ChunkData(creatorAPI);
             creatorAPI.revokeData = new ChunkData(creatorAPI);
             int num = 0;
             foreach (Point3 point3 in creatorAPI.creatorGenerationAlgorithm.Rectangular(creatorAPI.Position[0], creatorAPI.Position[1], false))
             {
                 if (!creatorAPI.launch)
                 {
                     return;
                 }
                 creatorAPI.CreateBlock(point3, this.blockIconWidget.Value, chunkData);
                 num++;
             }
             chunkData.Render();
             player.ComponentGui.DisplaySmallMessage($"操作成功,共生成{num}个方块", true, true);
         });
         DialogsManager.HideDialog(this);
     }
 }
Example #26
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();
        }
Example #27
0
        public override void Update()
        {
            if (this.cancelButton.IsClicked)
            {
                DialogsManager.HideDialog(this);
            }
            if (this.roughReplaceButton.IsClicked)
            {
                Regex regex = new Regex("^[0-9]+$");
                if (Blockid2.Text == "")
                {
                    Blockid2.Text = "0";
                }
                Match match  = regex.Match(this.Blockid.Text);
                Match match2 = regex.Match(this.Blockid2.Text);
                if (match.Success && match2.Success)
                {
                    Point3 Start = creatorAPI.Position[0];
                    Point3 End   = creatorAPI.Position[1];
                    CreatorMain.Math.StartEnd(ref Start, ref End);
                    Task.Run(() =>
                    {
                        int num               = 0;
                        ChunkData chunkData   = new ChunkData(this.creatorAPI);
                        creatorAPI.revokeData = new ChunkData(this.creatorAPI);
                        for (int x = 0; x <= Start.X - End.X; x++)
                        {
                            for (int y = 0; y <= Start.Y - End.Y; y++)
                            {
                                for (int z = 0; z <= Start.Z - End.Z; z++)
                                {
                                    int id = this.subsystemTerrain.Terrain.GetCellValueFast(End.X + x, End.Y + y, End.Z + z);
                                    if (!creatorAPI.AirIdentify && Terrain.ExtractContents(id) == 0)
                                    {
                                        continue;
                                    }
                                    if (id == int.Parse(this.Blockid.Text) || Terrain.ExtractContents(id) == int.Parse(this.Blockid.Text))
                                    {
                                        if (!creatorAPI.launch)
                                        {
                                            return;
                                        }
                                        creatorAPI.CreateBlock(End.X + x, End.Y + y, End.Z + z, int.Parse(this.Blockid2.Text), chunkData);
                                        num++;
                                    }
                                }
                            }
                        }
                        chunkData.Render();
                        this.player.ComponentGui.DisplaySmallMessage($"操作成功,共替换{num}个方块", true, true);
                    });
                }
                else
                {
                    this.player.ComponentGui.DisplaySmallMessage("操作失败", true, true);
                }
                DialogsManager.HideDialog(this);
            }



            if (this.replaceButton.IsClicked || this.retainReplaceButton.IsClicked)
            {
                bool  type  = replaceButton.IsClicked;
                Regex regex = new Regex("^[0-9]+$");
                if (Blockid2.Text == "")
                {
                    Blockid2.Text = "0";
                }
                Match match  = regex.Match(this.Blockid.Text);
                Match match2 = regex.Match(this.Blockid2.Text);
                if (match.Success && match2.Success)
                {
                    Point3 Start = creatorAPI.Position[0];
                    Point3 End   = creatorAPI.Position[1];
                    CreatorMain.Math.StartEnd(ref Start, ref End);
                    Task.Run(() =>
                    {
                        ChunkData chunkData   = new ChunkData(this.creatorAPI);
                        creatorAPI.revokeData = new ChunkData(this.creatorAPI);
                        int num = 0;
                        for (int x = 0; x <= Start.X - End.X; x++)
                        {
                            for (int y = 0; y <= Start.Y - End.Y; y++)
                            {
                                for (int z = 0; z <= Start.Z - End.Z; z++)
                                {
                                    int id = this.subsystemTerrain.Terrain.GetCellValueFast(End.X + x, End.Y + y, End.Z + z);
                                    if (!creatorAPI.AirIdentify && Terrain.ExtractContents(id) == 0)
                                    {
                                        continue;
                                    }
                                    if (type)
                                    {
                                        if (id == int.Parse(this.Blockid.Text))
                                        {
                                            if (!creatorAPI.launch)
                                            {
                                                return;
                                            }
                                            creatorAPI.CreateBlock(End.X + x, End.Y + y, End.Z + z, int.Parse(this.Blockid2.Text), chunkData);
                                            num++;
                                        }
                                    }
                                    else
                                    {
                                        if (id != int.Parse(this.Blockid.Text))
                                        {
                                            if (!creatorAPI.launch)
                                            {
                                                return;
                                            }
                                            creatorAPI.CreateBlock(End.X + x, End.Y + y, End.Z + z, int.Parse(this.Blockid2.Text), chunkData);
                                            num++;
                                        }
                                    }
                                }
                            }
                        }
                        chunkData.Render();
                        this.player.ComponentGui.DisplaySmallMessage($"操作成功,共替换{num}个方块", true, true);
                    });
                }
                else
                {
                    this.player.ComponentGui.DisplaySmallMessage("操作失败", true, true);
                }
                DialogsManager.HideDialog(this);
            }
        }
Example #28
0
        public new void HandleInput()
        {
            WidgetInput    input          = m_componentPlayer.View.Input;
            PlayerInput    playerInput    = m_componentPlayer.ComponentInput.PlayerInput;
            ComponentRider componentRider = m_componentPlayer.ComponentRider;

            if (m_componentPlayer.View.ActiveCamera.IsEntityControlEnabled)
            {
                if (!m_keyboardHelpMessageShown && (m_componentPlayer.PlayerData.InputDevice & WidgetInputDevice.Keyboard) != 0 && Time.PeriodicEvent(7.0, 0.0))
                {
                    m_keyboardHelpMessageShown = true;
                    DisplaySmallMessage("按 H 键查看键盘控制帮助\n(或看帮助)", blinking: true, playNotificationSound: true);
                }
                else if (!m_gamepadHelpMessageShown && (m_componentPlayer.PlayerData.InputDevice & WidgetInputDevice.Gamepads) != 0 && Time.PeriodicEvent(7.0, 0.0))
                {
                    m_gamepadHelpMessageShown = true;
                    DisplaySmallMessage("按 START/PAUSE 键查看手柄控制帮助\n(或看帮助)", blinking: true, playNotificationSound: true);
                }
            }
            if (playerInput.KeyboardHelp)
            {
                if (m_keyboardHelpDialog == null)
                {
                    m_keyboardHelpDialog = new KeyboardHelpDialog();
                }
                if (m_keyboardHelpDialog.ParentWidget != null)
                {
                    DialogsManager.HideDialog(m_keyboardHelpDialog);
                }
                else
                {
                    DialogsManager.ShowDialog(m_componentPlayer.View.GameWidget, m_keyboardHelpDialog);
                }
            }
            if (playerInput.GamepadHelp)
            {
                if (m_gamepadHelpDialog == null)
                {
                    m_gamepadHelpDialog = new GamepadHelpDialog();
                }
                if (m_gamepadHelpDialog.ParentWidget != null)
                {
                    DialogsManager.HideDialog(m_gamepadHelpDialog);
                }
                else
                {
                    DialogsManager.ShowDialog(m_componentPlayer.View.GameWidget, m_gamepadHelpDialog);
                }
            }
            if (m_helpButtonWidget.IsClicked)
            {
                ScreensManager.SwitchScreen("Help");
            }
            if (playerInput.ToggleInventory || m_inventoryButtonWidget.IsClicked)
            {
                if (IsInventoryVisible())
                {
                    ModalPanelWidget = null;
                }
                else if (m_componentPlayer.ComponentMiner.Inventory is ComponentCreativeInventory)
                {
                    ModalPanelWidget = new CreativeInventoryWidget(m_componentPlayer.Entity);
                }
                else
                {
                    ModalPanelWidget = new FullInventoryWidget(m_componentPlayer.ComponentMiner.Inventory, m_componentPlayer.Entity.FindComponent <ComponentCraftingTable>(throwOnError: true));
                }
            }
            if (playerInput.ToggleClothing || m_clothingButtonWidget.IsClicked)
            {
                if (IsClothingVisible())
                {
                    ModalPanelWidget = null;
                }
                else
                {
                    ModalPanelWidget = new ClothingWidget(m_componentPlayer);
                }
            }
            if (m_sneakButtonWidget.IsClicked || playerInput.ToggleSneak)
            {
                bool isSneaking = m_componentPlayer.ComponentBody.IsSneaking;
                m_componentPlayer.ComponentBody.IsSneaking = !isSneaking;
                if (m_componentPlayer.ComponentBody.IsSneaking != isSneaking)
                {
                    if (m_componentPlayer.ComponentBody.IsSneaking)
                    {
                        DisplaySmallMessage("Sneak mode on", blinking: false, playNotificationSound: false);
                    }
                    else
                    {
                        DisplaySmallMessage("Sneak mode off", blinking: false, playNotificationSound: false);
                    }
                }
            }
            if (componentRider != null && (m_mountButtonWidget.IsClicked || playerInput.ToggleMount))
            {
                bool flag = componentRider.Mount != null;
                if (flag)
                {
                    componentRider.StartDismounting();
                }
                else
                {
                    ComponentMount componentMount = componentRider.FindNearestMount();
                    if (componentMount != null)
                    {
                        componentRider.StartMounting(componentMount);
                    }
                }
                if (componentRider.Mount != null != flag)
                {
                    if (componentRider.Mount != null)
                    {
                        DisplaySmallMessage("Mounted", blinking: false, playNotificationSound: false);
                    }
                    else
                    {
                        DisplaySmallMessage("Dismounted", blinking: false, playNotificationSound: false);
                    }
                }
            }
            if ((m_editItemButton.IsClicked || playerInput.EditItem) && m_nearbyEditableCell.HasValue)
            {
                int cellValue = m_subsystemTerrain.Terrain.GetCellValue(m_nearbyEditableCell.Value.X, m_nearbyEditableCell.Value.Y, m_nearbyEditableCell.Value.Z);
                int contents  = Terrain.ExtractContents(cellValue);
                SubsystemBlockBehavior[] blockBehaviors = m_subsystemBlockBehaviors.GetBlockBehaviors(contents);
                for (int i = 0; i < blockBehaviors.Length && !blockBehaviors[i].OnEditBlock(m_nearbyEditableCell.Value.X, m_nearbyEditableCell.Value.Y, m_nearbyEditableCell.Value.Z, cellValue, m_componentPlayer); i++)
                {
                }
            }
            else if ((m_editItemButton.IsClicked || playerInput.EditItem) && IsActiveSlotEditable())
            {
                IInventory inventory = m_componentPlayer.ComponentMiner.Inventory;
                if (inventory != null)
                {
                    int activeSlotIndex = inventory.ActiveSlotIndex;
                    int num             = Terrain.ExtractContents(inventory.GetSlotValue(activeSlotIndex));
                    if (BlocksManager.Blocks[num].IsEditable)
                    {
                        SubsystemBlockBehavior[] blockBehaviors2 = m_subsystemBlockBehaviors.GetBlockBehaviors(num);
                        for (int j = 0; j < blockBehaviors2.Length && !blockBehaviors2[j].OnEditInventoryItem(inventory, activeSlotIndex, m_componentPlayer); j++)
                        {
                        }
                    }
                }
            }
            if (m_subsystemGameInfo.WorldSettings.GameMode == GameMode.Creative && (m_creativeFlyButtonWidget.IsClicked || playerInput.ToggleCreativeFly) && componentRider.Mount == null)
            {
                bool isCreativeFlyEnabled = m_componentPlayer.ComponentLocomotion.IsCreativeFlyEnabled;
                m_componentPlayer.ComponentLocomotion.IsCreativeFlyEnabled = !isCreativeFlyEnabled;
                if (m_componentPlayer.ComponentLocomotion.IsCreativeFlyEnabled != isCreativeFlyEnabled)
                {
                    if (m_componentPlayer.ComponentLocomotion.IsCreativeFlyEnabled)
                    {
                        m_componentPlayer.ComponentLocomotion.JumpOrder = 1f;
                        DisplaySmallMessage("Fly mode on", blinking: false, playNotificationSound: false);
                    }
                    else
                    {
                        DisplaySmallMessage("Fly mode off", blinking: false, playNotificationSound: false);
                    }
                }
            }
            if (m_cameraButtonWidget.IsClicked || playerInput.SwitchCameraMode)
            {
                View view = m_componentPlayer.View;
                if (view.ActiveCamera.GetType() == typeof(FppCamera))
                {
                    view.ActiveCamera = view.FindCamera <TppCamera>();
                    DisplaySmallMessage("第三人称视角", blinking: false, playNotificationSound: false);
                }
                else if (view.ActiveCamera.GetType() == typeof(TppCamera))
                {
                    view.ActiveCamera = view.FindCamera <OrbitCamera>();
                    DisplaySmallMessage("滑轨视角", blinking: false, playNotificationSound: false);
                }
                else if (view.ActiveCamera.GetType() == typeof(OrbitCamera))
                {
                    view.ActiveCamera = view.FindCamera <FixedCamera>();
                    DisplaySmallMessage("固定视角", blinking: false, playNotificationSound: false);
                }
                else if (view.ActiveCamera.GetType() == typeof(FixedCamera))
                {
                    view.ActiveCamera = new DebugCamera(view);
                    DisplaySmallMessage("调试视角", blinking: false, playNotificationSound: false);
                }
                else
                {
                    view.ActiveCamera = view.FindCamera <FppCamera>();
                    DisplaySmallMessage("第一人称视角", blinking: false, playNotificationSound: false);
                }
            }
            if (m_photoButtonWidget.IsClicked || playerInput.TakeScreenshot)
            {
                ScreenCaptureManager.CapturePhoto();
                Time.QueueFrameCountDelayedExecution(Time.FrameIndex + 1, HandleInput_b__108_0);
            }
            if (m_subsystemGameInfo.WorldSettings.GameMode == GameMode.Creative && (m_lightningButtonWidget.IsClicked || playerInput.Lighting))
            {
                Matrix matrix = Matrix.CreateFromQuaternion(m_componentPlayer.ComponentCreatureModel.EyeRotation);
                base.Project.FindSubsystem <SubsystemWeather>(throwOnError: true).ManualLightingStrike(m_componentPlayer.ComponentCreatureModel.EyePosition, matrix.Forward);
            }
            if (m_subsystemGameInfo.WorldSettings.GameMode == GameMode.Creative && (m_timeOfDayButtonWidget.IsClicked || playerInput.TimeOfDay))
            {
                float num2  = MathUtils.Remainder(0.25f, 1f);
                float num3  = MathUtils.Remainder(0.5f, 1f);
                float num4  = MathUtils.Remainder(0.75f, 1f);
                float num5  = MathUtils.Remainder(1f, 1f);
                float num6  = MathUtils.Remainder(num2 - m_subsystemTimeOfDay.TimeOfDay, 1f);
                float num7  = MathUtils.Remainder(num3 - m_subsystemTimeOfDay.TimeOfDay, 1f);
                float num8  = MathUtils.Remainder(num4 - m_subsystemTimeOfDay.TimeOfDay, 1f);
                float num9  = MathUtils.Remainder(num5 - m_subsystemTimeOfDay.TimeOfDay, 1f);
                float num10 = MathUtils.Min(num6, num7, num8, num9);
                if (num6 == num10)
                {
                    m_subsystemTimeOfDay.TimeOfDayOffset += num6;
                    DisplaySmallMessage("Dawn", blinking: false, playNotificationSound: false);
                }
                else if (num7 == num10)
                {
                    m_subsystemTimeOfDay.TimeOfDayOffset += num7;
                    DisplaySmallMessage("Noon", blinking: false, playNotificationSound: false);
                }
                else if (num8 == num10)
                {
                    m_subsystemTimeOfDay.TimeOfDayOffset += num8;
                    DisplaySmallMessage("Dusk", blinking: false, playNotificationSound: false);
                }
                else if (num9 == num10)
                {
                    m_subsystemTimeOfDay.TimeOfDayOffset += num9;
                    DisplaySmallMessage("Midnight", blinking: false, playNotificationSound: false);
                }
            }
            if (ModalPanelWidget != null)
            {
                if (input.Cancel || input.Back || m_backButtonWidget.IsClicked)
                {
                    ModalPanelWidget = null;
                }
            }
            else if (input.Back || m_backButtonWidget.IsClicked)
            {
                DialogsManager.ShowDialog(m_componentPlayer.View.GameWidget, new GameMenuDialog(m_componentPlayer));
            }
        }
Example #29
0
 public override void Update()
 {
     this.CruelButton.IsEnabled = CreatorMain.professional;
     if (this.cancelButton.IsClicked)
     {
         DialogsManager.HideDialog(this);
     }
     if (CreativeButton.IsClicked)
     {
         gameInfo.WorldSettings.GameMode = GameMode.Creative;
         upDataWorld();
     }
     if (ChallengingButton.IsClicked)
     {
         if (gameInfo.WorldSettings.GameMode == GameMode.Creative)
         {
             gameInfo.WorldSettings.GameMode = GameMode.Challenging;
             upDataWorld();
         }
         else
         {
             gameInfo.WorldSettings.GameMode = GameMode.Challenging;
             player.ComponentGui.DisplaySmallMessage("模式改变为 : 挑战模式", true, true);
             DialogsManager.HideDialog(this);
         }
     }
     if (HarmlessButton.IsClicked)
     {
         if (gameInfo.WorldSettings.GameMode == GameMode.Creative)
         {
             gameInfo.WorldSettings.GameMode = GameMode.Harmless;
             upDataWorld();
         }
         else
         {
             gameInfo.WorldSettings.GameMode = GameMode.Harmless;
             player.ComponentGui.DisplaySmallMessage("模式改变为 : 无害模式", true, true);
             DialogsManager.HideDialog(this);
         }
     }
     if (AdventureButton.IsClicked)
     {
         if (gameInfo.WorldSettings.GameMode == GameMode.Creative)
         {
             gameInfo.WorldSettings.GameMode = GameMode.Adventure;
             upDataWorld();
         }
         else
         {
             gameInfo.WorldSettings.GameMode = GameMode.Adventure;
             player.ComponentGui.DisplaySmallMessage("模式改变为 : 闯关模式", true, true);
             DialogsManager.HideDialog(this);
         }
     }
     if (CruelButton.IsClicked)
     {
         //player.ComponentGui.DisplaySmallMessage("由于该功能被很多生存dalao反对,所以该功能只在专业版开启", true, true);
         //DialogsManager.HideDialog(this);
         if (gameInfo.WorldSettings.GameMode == GameMode.Creative)
         {
             gameInfo.WorldSettings.GameMode = GameMode.Cruel;
             upDataWorld();
         }
         else
         {
             gameInfo.WorldSettings.GameMode = GameMode.Cruel;
             player.ComponentGui.DisplaySmallMessage("模式改变为 : 残酷模式,虽然你这样做不太好", true, true);
             DialogsManager.HideDialog(this);
         }
     }
 }
Example #30
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();
        }