示例#1
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();
                }));
            }
        }
        public override bool OnEditInventoryItem(IInventory inventory, int slotIndex, ComponentPlayer Player)
        {
/*            Run();*/
            if (Player.ComponentGui.ModalPanelWidget is CreatorWidget)
            {
                Player.ComponentGui.ModalPanelWidget = null;
            }
            else
            {
                CreatorAPI creatorAPI;
                if (!dictionaryPlayers.TryGetValue(Player, out creatorAPI))
                {
                    listPlayer.Add(Player);
                    creatorAPI = new CreatorAPI(Player.ComponentMiner);
                    dictionaryPlayers.Add(Player, creatorAPI);
                }
                if (CreatorMain.canUse)
                {
                    Player.ComponentGui.ModalPanelWidget = new CreatorWidget(creatorAPI);
                }
                else
                {
                    DialogsManager.ShowDialog(Player.View.GameWidget, new PasswordDialog(Player));
                }
            }
            return(true);
        }
 public void Select_pos(List <Category> m_categories, List <string> a)
 {
     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      = a[d];
             mPosition.Text = ds;
             // player.ComponentGui.DisplaySmallMessage(ds, false, true);
         }));
     }
 }
示例#4
0
        public void Select_rot()
        {
            List <string> names = new List <string>();

            names.Add("Front");
            names.Add("Side");

            if (ComponentWE5.m_componentPlayer != null)
            {
                DialogsManager.ShowDialog(ComponentWE5.m_componentPlayer.View.GameWidget, new ListSelectionDialog(string.Empty, names, 56f, c =>
                {
                    LabelWidget labelWidget = new LabelWidget();
                    labelWidget.Text        = c.ToString();
                    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     = names.IndexOf(c.ToString());
                    string ds = names[d];

                    rot_txt = ds;
                }));
            }
        }
 public static void onKeyboardDown(Key key)
 {
     if (key == Key.F12)
     {
         DialogsManager.HideAllDialogs();
         DialogsManager.ShowDialog(new ViewGameLogDialog());
     }
 }
    public override void Update()
    {
        ListItem selectedItem = (ListItem)m_contentList.SelectedItem;

        m_deleteButton.IsEnabled = (selectedItem != null && !selectedItem.IsBuiltIn);
        m_uploadButton.IsEnabled = (selectedItem != null && !selectedItem.IsBuiltIn);
        m_filterLabel.Text       = GetFilterDisplayName(m_filter);
        if (m_deleteButton.IsClicked)
        {
            string smallMessage = (selectedItem.UseCount <= 0) ? string.Format(LanguageControl.Get(fName, 5), selectedItem.DisplayName) : string.Format(LanguageControl.Get(fName, 6), selectedItem.DisplayName, selectedItem.UseCount);
            DialogsManager.ShowDialog(null, new MessageDialog(LanguageControl.Get(fName, 9), smallMessage, LanguageControl.Get("Usual", "yes"), LanguageControl.Get("Usual", "no"), delegate(MessageDialogButton button)
            {
                if (button == MessageDialogButton.Button1)
                {
                    ExternalContentManager.DeleteExternalContent(selectedItem.Type, selectedItem.Name);
                    UpdateList();
                }
            }));
        }
        if (m_uploadButton.IsClicked)
        {
            ExternalContentManager.ShowUploadUi(selectedItem.Type, selectedItem.Name);
        }
        if (m_changeFilterButton.IsClicked)
        {
            List <ExternalContentType> list = new List <ExternalContentType>();
            list.Add(ExternalContentType.Unknown);
            list.Add(ExternalContentType.BlocksTexture);
            list.Add(ExternalContentType.CharacterSkin);
            list.Add(ExternalContentType.FurniturePack);
            DialogsManager.ShowDialog(null, new ListSelectionDialog(LanguageControl.Get(fName, 7), list, 60f, (object item) => GetFilterDisplayName((ExternalContentType)item), delegate(object item)
            {
                if ((ExternalContentType)item != m_filter)
                {
                    m_filter = (ExternalContentType)item;
                    UpdateList();
                }
            }));
        }
        if (base.Input.Back || base.Input.Cancel || Children.Find <ButtonWidget>("TopBar.Back").IsClicked)
        {
            ScreensManager.SwitchScreen(ScreensManager.PreviousScreen);
        }
    }
示例#7
0
        public override bool OnEditInventoryItem(IInventory inventory, int slotIndex, ComponentPlayer componentPlayer)
        {
            int value        = inventory.GetSlotValue(slotIndex);
            int count        = inventory.GetSlotCount(slotIndex);
            int data         = Terrain.ExtractData(value);
            int voltageLevel = BatteryBlock.GetVoltageLevel(data);

            DialogsManager.ShowDialog(componentPlayer.GuiWidget, new EditBatteryDialog(voltageLevel, delegate(int newVoltageLevel)
            {
                int data2 = BatteryBlock.SetVoltageLevel(data, newVoltageLevel);
                int num   = Terrain.ReplaceData(value, data2);
                if (num != value)
                {
                    inventory.RemoveSlotItems(slotIndex, count);
                    inventory.AddSlotItems(slotIndex, num, 1);
                }
            }));
            return(true);
        }
        public override bool OnEditInventoryItem(IInventory inventory, int slotIndex, ComponentPlayer componentPlayer)
        {
            int value = inventory.GetSlotValue(slotIndex);
            int count = inventory.GetSlotCount(slotIndex);
            int data  = Terrain.ExtractData(value);
            int delay = AdjustableDelayGateBlock.GetDelay(data);

            DialogsManager.ShowDialog(componentPlayer.GuiWidget, new EditAdjustableDelayGateDialog(delay, delegate(int newDelay)
            {
                int data2 = AdjustableDelayGateBlock.SetDelay(data, newDelay);
                int num   = Terrain.ReplaceData(value, data2);
                if (num != value)
                {
                    inventory.RemoveSlotItems(slotIndex, count);
                    inventory.AddSlotItems(slotIndex, num, 1);
                }
            }));
            return(true);
        }
示例#9
0
        public override bool OnEditBlock(int x, int y, int z, int value, ComponentPlayer componentPlayer)
        {
            int data         = Terrain.ExtractData(value);
            int voltageLevel = BatteryBlock.GetVoltageLevel(data);

            DialogsManager.ShowDialog(componentPlayer.GuiWidget, new EditBatteryDialog(voltageLevel, delegate(int newVoltageLevel)
            {
                int num = BatteryBlock.SetVoltageLevel(data, newVoltageLevel);
                if (num != data)
                {
                    int value2 = Terrain.ReplaceData(value, num);
                    base.SubsystemTerrain.ChangeCell(x, y, z, value2);
                    SubsystemElectricity subsystemElectricity = base.Project.FindSubsystem <SubsystemElectricity>(throwOnError: true);
                    ElectricElement electricElement           = subsystemElectricity.GetElectricElement(x, y, z, 4);
                    if (electricElement != null)
                    {
                        subsystemElectricity.QueueElectricElementConnectionsForSimulation(electricElement, subsystemElectricity.CircuitStep + 1);
                    }
                }
            }));
            return(true);
        }
        public override bool OnEditBlock(int x, int y, int z, int value, ComponentPlayer componentPlayer)
        {
            int data  = Terrain.ExtractData(value);
            int delay = AdjustableDelayGateBlock.GetDelay(data);

            DialogsManager.ShowDialog(componentPlayer.GuiWidget, new EditAdjustableDelayGateDialog(delay, delegate(int newDelay)
            {
                int num = AdjustableDelayGateBlock.SetDelay(data, newDelay);
                if (num != data)
                {
                    int value2 = Terrain.ReplaceData(value, num);
                    base.SubsystemTerrain.ChangeCell(x, y, z, value2);
                    int face = ((AdjustableDelayGateBlock)BlocksManager.Blocks[224]).GetFace(value);
                    SubsystemElectricity subsystemElectricity = base.Project.FindSubsystem <SubsystemElectricity>(throwOnError: true);
                    ElectricElement electricElement           = subsystemElectricity.GetElectricElement(x, y, z, face);
                    if (electricElement != null)
                    {
                        subsystemElectricity.QueueElectricElementForSimulation(electricElement, subsystemElectricity.CircuitStep + 1);
                    }
                }
            }));
            return(true);
        }
示例#11
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;
         }
     }
 }
示例#12
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();
                    });
                }
            }
        }
示例#13
0
 public override void Update()
 {
     if (this.DirectionSetButton.IsClicked)
     {
         if (creatorAPI.pasteRotate)
         {
             creatorAPI.pasteRotate        = false;
             this.DirectionSetButton.Color = Color.Red;
         }
         else
         {
             creatorAPI.pasteRotate        = true;
             this.DirectionSetButton.Color = Color.Yellow;
         }
     }
     if (this.LimitButton.IsClicked)
     {
         if (creatorAPI.pasteLimit)
         {
             creatorAPI.pasteLimit  = false;
             this.LimitButton.Color = Color.Red;
         }
         else
         {
             creatorAPI.pasteLimit  = true;
             this.LimitButton.Color = Color.Yellow;
         }
     }
     if (this.cancelButton.IsClicked)
     {
         DialogsManager.HideDialog(this);
     }
     if (this.PasteButton.IsClicked)
     {
         if (!FileOperation.IsFileInUse(CreatorMain.CopyFile))
         {
             Task.Run(() =>
             {
                 try
                 {
                     CopyAndPaste.PasetData(creatorAPI, CreatorMain.CopyFile, creatorAPI.Position[0], creatorAPI.Position[1]);
                 }catch (Exception e)
                 {
                     player.ComponentGui.DisplaySmallMessage(e.Message, true, false);
                 }
             });
         }
         else
         {
             player.ComponentGui.DisplaySmallMessage("操作失败!", true, false);
         }
         DialogsManager.HideDialog(this);
     }
     if (this.MirrorButton.IsClicked)
     {
         if (!FileOperation.IsFileInUse(CreatorMain.CopyFile))
         {
             Task.Run(() =>
             {
                 try
                 {
                     CopyAndPaste.MirrorData(creatorAPI, CreatorMain.CopyFile, creatorAPI.Position[0], creatorAPI.Position[1]);
                 }
                 catch (Exception e)
                 {
                     player.ComponentGui.DisplaySmallMessage(e.Message, true, false);
                 }
             });
         }
         else
         {
             player.ComponentGui.DisplaySmallMessage("操作失败!", true, false);
         }
         DialogsManager.HideDialog(this);
     }
     if (this.ImportButton.IsClicked)
     {
         if (!Directory.Exists(CreatorMain.CacheDirectory))
         {
             Directory.CreateDirectory(CreatorMain.CacheDirectory);
         }
         string sdFile  = CreatorMain.CopyFile;
         string _sdFile = CreatorMain.Export_CopyFile_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_CopyFile_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.CopyFile);
     if (this.DerivedButton.IsClicked)
     {
         DialogsManager.ShowDialog(player.View.GameWidget, new DerivedDialog(player, this, this.ListView));
     }
     if (this.CopyButton.IsClicked)
     {
         Task.Run(() =>
         {
             try
             {
                 if (!Directory.Exists(CreatorMain.CacheDirectory))
                 {
                     Directory.CreateDirectory(CreatorMain.CacheDirectory);
                 }
                 CopyAndPaste.CreateCopy(creatorAPI, CreatorMain.CacheDirectory, "CacheFile.cd", creatorAPI.Position[0], creatorAPI.Position[1]);
             }
             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;
     }
     this.specialCopyButton.IsEnabled  = CreatorMain.professional;
     this.specialPasteButton.IsEnabled = CreatorMain.professional;
     if (this.specialCopyButton.IsClicked)
     {
         Task.Run(() =>
         {
             try
             {
                 if (!Directory.Exists(CreatorMain.CacheDirectory))
                 {
                     Directory.CreateDirectory(CreatorMain.CacheDirectory);
                 }
                 CopyAndPaste.CreateSpecialCopy(creatorAPI, CreatorMain.SpecialCopyFile, creatorAPI.Position[0], creatorAPI.Position[1]);
             }
             catch (Exception e)
             {
                 player.ComponentGui.DisplaySmallMessage(e.Message, true, false);
             }
         });
         DialogsManager.HideDialog(this);
     }
     this.specialPasteButton.IsEnabled = File.Exists(CreatorMain.SpecialCopyFile);
     if (this.specialPasteButton.IsClicked)
     {
         Task.Run(() =>
         {
             try
             {
                 CopyAndPaste.SpecialPasetData(creatorAPI, CreatorMain.SpecialCopyFile, creatorAPI.Position[0], creatorAPI.Position[1]);
             }
             catch (Exception e)
             {
                 player.ComponentGui.DisplaySmallMessage(e.Message, true, false);
             }
         });
         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();
        }
        public void Select_mode(List <Category> m_categories, List <string> a)
        {
            if (m_componentPlayer != null)
            {
                DialogsManager.ShowDialog(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 = a[d];

                    if (ds == "Round")
                    {
                        if (Point1 == null)
                        {
                            m_componentPlayer.ComponentGui.DisplaySmallMessage("You have not selected point 1", false, false);
                        }
                        else
                        {
                            DialogsManager.ShowDialog(m_componentPlayer.View.GameWidget, new Round(m_componentPlayer, SelectedBlock, Point1, m_subsystemTerrain));
                        }
                    }

                    if (ds == "Sphere")
                    {
                        if (Point1 == null)
                        {
                            m_componentPlayer.ComponentGui.DisplaySmallMessage("You have not selected point 1", false, false);
                        }
                        else
                        {
                            DialogsManager.ShowDialog(m_componentPlayer.View.GameWidget, new Sphere(m_componentPlayer, SelectedBlock, Point1, m_subsystemTerrain));
                        }
                    }
                    if (ds == "Prism")
                    {
                        if (Point1 == null)
                        {
                            m_componentPlayer.ComponentGui.DisplaySmallMessage("You have not selected point 1", false, false);
                        }
                        else
                        {
                            DialogsManager.ShowDialog(m_componentPlayer.View.GameWidget, new Prism(m_componentPlayer, SelectedBlock, Point1, m_subsystemTerrain));
                        }
                    }

                    if (ds == "Square")
                    {
                        if (Point1 == null)
                        {
                            m_componentPlayer.ComponentGui.DisplaySmallMessage("You have not selected point 1", false, false);
                        }
                        else
                        {
                            DialogsManager.ShowDialog(m_componentPlayer.View.GameWidget, new Square(m_componentPlayer, SelectedBlock, Point1, m_subsystemTerrain));
                        }
                    }

                    if (ds == "Frame or box")
                    {
                        if (Point1 == null && Point2 == null)
                        {
                            m_componentPlayer.ComponentGui.DisplaySmallMessage("You have not selected points 1,2", false, false);
                        }
                        else
                        {
                            DialogsManager.ShowDialog(m_componentPlayer.View.GameWidget, new API_WE_Mod.Rectangle(m_componentPlayer, SelectedBlock, Point1, Point2, m_subsystemTerrain));
                        }
                    }

                    if (ds == "Maze")
                    {
                        Engine.Point3 PointStart;
                        Engine.Point3 PointEnd;

                        if (Point1 == null && Point2 == null)
                        {
                            m_componentPlayer.ComponentGui.DisplaySmallMessage("You have not selected points 1,2", false, false);
                        }

                        else
                        {
                            PointStart.X = Point1.Value.CellFace.X;
                            PointStart.Y = Point1.Value.CellFace.Y;
                            PointStart.Z = Point1.Value.CellFace.Z;

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

                            API_WE.CreativeMaze(PointStart, PointEnd, SelectedBlock, m_subsystemTerrain, m_componentPlayer);
                        }
                    }

                    if (ds == "Mountain")
                    {
                        if (Point1 == null)
                        {
                            m_componentPlayer.ComponentGui.DisplaySmallMessage("You have not selected point 1", false, false);
                        }
                        else
                        {
                            DialogsManager.ShowDialog(m_componentPlayer.View.GameWidget, new Mountain(m_componentPlayer, Point1, m_subsystemTerrain));
                        }
                    }

                    if (ds == "Coppy/Paste zone in file")
                    {
                        /*
                         * Engine.Point3 PointStart;
                         *
                         * PointStart.X = Point3.Value.CellFace.X;
                         * PointStart.Y = Point3.Value.CellFace.Y;
                         * PointStart.Z = Point3.Value.CellFace.Z;
                         */

                        //m_componentPlayer.ComponentGui.ModalPanelWidget = new ZoneWidget();


                        DialogsManager.ShowDialog(m_componentPlayer.View.GameWidget, new ZoneDialog(m_componentPlayer, Point1, Point2, Point3, m_subsystemTerrain));


                        //string o =  API_WE.s(names);
                    }


                    if (ds == "Line")
                    {
                        Engine.Point3 PointStart = new Engine.Point3();
                        Engine.Point3 PointEnd   = new Engine.Point3();

                        if (Point1 == null && Point2 == null)
                        {
                            m_componentPlayer.ComponentGui.DisplaySmallMessage("You have not selected points 1,2", false, false);
                        }

                        else
                        {
                            PointStart.X = Point1.Value.CellFace.X;
                            PointStart.Y = Point1.Value.CellFace.Y;
                            PointStart.Z = Point1.Value.CellFace.Z;

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

                            API_WE.LinePoint(PointStart, PointEnd, SelectedBlock, m_subsystemTerrain);
                        }
                    }

                    if (ds == "Fast Run")
                    {
                        DialogsManager.ShowDialog(m_componentPlayer.View.GameWidget, new FastRun(m_componentPlayer));
                    }
                }));
            }
        }
示例#16
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();
        }
示例#17
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));
            }
        }
示例#18
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();
        }
示例#19
0
 public override void Update()
 {
     if (ListView.SelectedIndex == null)
     {
         this.ImportButton.IsEnabled = false;
         this.DeleteButton.IsEnabled = false;
     }
     else
     {
         this.ImportButton.IsEnabled = true;
         this.DeleteButton.IsEnabled = true;
     }
     if (this.OK.IsClicked)
     {
         DialogsManager.HideDialog(this);
     }
     if (DeleteButton.IsClicked)
     {
         string sdFile = CreatorMain.Export_ModFile_Directory + "/" + (string)this.ListView.SelectedItem;
         if (FileOperation.Delete(sdFile))
         {
             player.ComponentGui.DisplaySmallMessage("删除成功!", true, false);
             UpList();
         }
         else
         {
             player.ComponentGui.DisplaySmallMessage("操作失败!", true, false);
         }
     }
     this.ExportOnekeyButton.IsEnabled    = File.Exists(CreatorMain.OneKeyFile);
     this.ExportCopyButton.IsEnabled      = File.Exists(CreatorMain.CopyFile);
     this.ExportOldCopyButton.IsEnabled   = File.Exists(CreatorMain.CopyFile);
     this.ExportOldOnekeyButton.IsEnabled = File.Exists(CreatorMain.OneKeyFile);
     this.DerivedSpecialButton.IsEnabled  = File.Exists(CreatorMain.SpecialCopyFile);
     if (this.ExportOnekeyButton.IsClicked)
     {
         DialogsManager.ShowDialog(player.View.GameWidget, new DerivedDialog(player, this, this.ListView, DataType.OneKey));
     }
     if (this.ExportCopyButton.IsClicked)
     {
         DialogsManager.ShowDialog(player.View.GameWidget, new DerivedDialog(player, this, this.ListView));
     }
     if (this.ExportOldCopyButton.IsClicked)
     {
         DialogsManager.ShowDialog(player.View.GameWidget, new DerivedDialog(player, this, this.ListView, DataType.OldCopy));
     }
     if (this.ExportOldOnekeyButton.IsClicked)
     {
         DialogsManager.ShowDialog(player.View.GameWidget, new DerivedDialog(player, this, this.ListView, DataType.OldOneKey));
     }
     if (this.DerivedSpecialButton.IsClicked)
     {
         DialogsManager.ShowDialog(player.View.GameWidget, new DerivedDialog(player, this, this.ListView, DataType.SpecialCopy));
     }
     if (this.ImportButton.IsClicked)
     {
         Task.Run(() =>
         {
             if (!Directory.Exists(CreatorMain.CacheDirectory))
             {
                 Directory.CreateDirectory(CreatorMain.CacheDirectory);
             }
             string fileName = CreatorMain.Export_ModFile_Directory + "/" + (string)this.ListView.SelectedItem;
             if (FileOperation.IsFileInUse(fileName))
             {
                 player.ComponentGui.DisplaySmallMessage($"操作失败...\n{fileName}", true, false);
                 DialogsManager.HideDialog(this);
                 return;
             }
             if (Path.GetExtension(fileName) == ".oMod2")
             {
                 OnekeyGeneration.ImportOnekeyoMod2(CreatorMain.OneKeyFile, fileName);
                 player.ComponentGui.DisplaySmallMessage("导入一键生成MOD配置文件成功!", true, false);
             }
             else if (Path.GetExtension(fileName) == ".wMod2")
             {
                 CopyAndPaste.ImportCopywMod2(CreatorMain.CopyFile, fileName);
                 player.ComponentGui.DisplaySmallMessage("导入复制MOD配置文件成功!", true, false);
             }
             else if (Path.GetExtension(fileName) == ".wMod")
             {
                 CopyAndPaste.ImportCopywMod(CreatorMain.CopyFile, fileName);
                 player.ComponentGui.DisplaySmallMessage("导入复制MOD配置文件成功!", true, false);
             }
             else if (Path.GetExtension(fileName) == ".oMod")
             {
                 player.ComponentGui.DisplaySmallMessage("抱歉,一键生成的旧文件数据无法导入!", true, false);
             }
             else if (Path.GetExtension(fileName) == ".sMod")
             {
                 if (!Directory.Exists(CreatorMain.CacheDirectory))
                 {
                     Directory.CreateDirectory(CreatorMain.CacheDirectory);
                 }
                 string sdFile = CreatorMain.SpecialCopyFile;
                 if (!FileOperation.IsFileInUse(fileName) && (!File.Exists(sdFile) || !FileOperation.IsFileInUse(sdFile)))
                 {
                     FileStream fileStream = new FileStream(fileName, 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);
                 }
             }
             else
             {
                 player.ComponentGui.DisplaySmallMessage($"操作失败...\n{fileName}", true, false);
             }
         });
         DialogsManager.HideDialog(this);
     }
 }
示例#20
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();
        }
        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();
                });
            }
        }
示例#22
0
        public override void Update()
        {
            if (this.SphereButton.IsClicked)
            {
                DialogsManager.ShowDialog(player.View.GameWidget, new SphereDialog(creatorAPI));
            }
            if (this.PrismButton.IsClicked)
            {
                DialogsManager.ShowDialog(player.View.GameWidget, new PrismDialog(creatorAPI));
            }
            if (this.PyramidButton.IsClicked)
            {
                DialogsManager.ShowDialog(player.View.GameWidget, new PyramidDialog(creatorAPI));
            }
            if (this.CylindricalButton.IsClicked)
            {
                DialogsManager.ShowDialog(player.View.GameWidget, new CylindricalDialog(creatorAPI));
            }
            if (this.PrismColumnButton.IsClicked)
            {
                DialogsManager.ShowDialog(player.View.GameWidget, new PrismColumnDialog(creatorAPI));
            }
            if (this.PillarsButton.IsClicked)
            {
                DialogsManager.ShowDialog(player.View.GameWidget, new PillarsDialog(creatorAPI));
            }
            if (this.RectangularButton.IsClicked)
            {
                DialogsManager.ShowDialog(player.View.GameWidget, new RectangularDialog(creatorAPI));
            }
            if (this.CircleButton.IsClicked)
            {
                DialogsManager.ShowDialog(player.View.GameWidget, new CircleDialog(creatorAPI));
            }
            if (this.MazeButton.IsClicked)
            {
                DialogsManager.ShowDialog(player.View.GameWidget, new MazeDialog(creatorAPI));
            }
            if (this.PavageButton.IsClicked)
            {
                DialogsManager.ShowDialog(player.View.GameWidget, new PavageDialog(creatorAPI));
            }
            if (this.FillingButton.IsClicked)
            {
                DialogsManager.ShowDialog(player.View.GameWidget, new FillingDialog(creatorAPI));
            }
            if (this.MountainButton.IsClicked)
            {
                DialogsManager.ShowDialog(player.View.GameWidget, new MountainDialog(creatorAPI));
            }
            if (this.TransferButton.IsClicked)
            {
                DialogsManager.ShowDialog(player.View.GameWidget, new TransferDialog(creatorAPI));
            }
            if (this.LevelSetButton.IsClicked)
            {
                DialogsManager.ShowDialog(player.View.GameWidget, new LevelSetDialog(creatorAPI));
            }
            if (this.SetButton.IsClicked)
            {
                DialogsManager.ShowDialog(player.View.GameWidget, new SetDialog(creatorAPI));
            }
            if (this.SpiralButton.IsClicked)
            {
                DialogsManager.ShowDialog(player.View.GameWidget, new SpiralDialog(creatorAPI));
            }
            if (this.PenetrateButton.IsClicked)
            {
                if (CreatorMain.Penetrate)
                {
                    foreach (int blockID in CreatorMain.PenetrateBlocksID)
                    {
                        BlocksManager.Blocks[blockID].IsCollidable = true;
                    }
                    CreatorMain.PenetrateBlocksID.Clear();
                }
                else
                {
                    this.worldSettings.EnvironmentBehaviorMode = EnvironmentBehaviorMode.Static;
                    foreach (Block block in BlocksManager.Blocks)
                    {
                        if (block.IsCollidable)
                        {
                            block.IsCollidable = false;
                            CreatorMain.PenetrateBlocksID.Add(block.BlockIndex);
                        }
                    }
                }
                CreatorMain.Penetrate = !CreatorMain.Penetrate;
            }
            if (this.LightWorldButton.IsClicked)
            {
                if (CreatorMain.LightWorld)
                {
                    foreach (int blockID in CreatorMain.LightWorldBlockID)
                    {
                        BlocksManager.Blocks[blockID].EmittedLightAmount = 0;
                    }
                    CreatorMain.LightWorldBlockID.Clear();
                }
                else
                {
                    foreach (Block block in BlocksManager.Blocks)
                    {
                        if (block.EmittedLightAmount == 0)
                        {
                            block.EmittedLightAmount = 15;
                            CreatorMain.LightWorldBlockID.Add(block.BlockIndex);
                        }
                    }
                }
                CreatorMain.LightWorld = !CreatorMain.LightWorld;
            }
            if (CreatorMain.LightWorld)
            {
                this.LightWorldButton.Color = Color.Yellow;
            }
            else
            {
                this.LightWorldButton.Color = Color.White;
            }

            if (CreatorMain.Penetrate)
            {
                this.PenetrateButton.Color = Color.Yellow;
            }
            else
            {
                this.PenetrateButton.Color = Color.White;
            }
            if (this.EditRegionButton.IsClicked)
            {
                DialogsManager.ShowDialog(player.View.GameWidget, new EditRegionDialog(creatorAPI));
            }
            if (this.EditWorldButton.IsClicked)
            {
                DialogsManager.ShowDialog(player.View.GameWidget, new EditWorldDialog(creatorAPI));
            }
            if (this.ClearBlockButton.IsClicked)
            {
                this.player.ComponentGui.DisplaySmallMessage("可在设置中关闭生成在来停止正在清理的进程,在超距模式下谨慎使用清理方块", true, false);
                this.creatorAPI.ClearBlock = !this.creatorAPI.ClearBlock;
            }
            if (this.creatorAPI.ClearBlock)
            {
                this.ClearBlockButton.Color = Color.Yellow;
            }
            else
            {
                this.ClearBlockButton.Color = Color.White;
            }
            if (this.SetLinkButton.IsClicked)
            {
                DialogsManager.ShowDialog(player.View.GameWidget, new TwoPointLineDialog(creatorAPI));
            }

            /*            if (this.SetLinkButton.IsClicked)
             *          {
             *              if (this.creatorAPI.twoPointsOfAttachment)
             *                  this.creatorAPI.twoPointsOfAttachment = false;
             *              else
             *                  this.creatorAPI.twoPointsOfAttachment = true;
             *          }
             *          if (this.creatorAPI.twoPointsOfAttachment) this.SetLinkButton.Color = Color.Yellow; else this.SetLinkButton.Color = Color.White;*/


            if (this.SetPositionButton.IsClicked)
            {
                Vector3 position = player.ComponentBody.Position;
                Point3  point3   = new Point3((int)position.X, (int)position.Y, (int)position.Z);
                int[]   p        = new int[4] {
                    1, 2, 3, 4
                };
                DialogsManager.ShowDialog(null, new ListSelectionDialog("选择设置的点", p, 56f, (object e) => $"设置点{(int)e}", delegate(object e)
                {
                    creatorAPI.Position[(int)e - 1] = point3;
                    this.player.ComponentGui.DisplaySmallMessage($"成功设置点{(int)e}:\nX:{point3.X} , Y:{point3.Y} , Z:{point3.Z}", true, true);
                }));
            }
            if (this.creatorAPI.RevokeSwitch)
            {
                if (creatorAPI.revokeData == null)
                {
                    this.RevokeButton.IsEnabled = false;
                }
                else
                {
                    this.RevokeButton.IsEnabled = true;
                }
            }
            else
            {
                this.RevokeButton.IsEnabled = false;
            }
            if (this.RevokeButton.IsClicked)
            {
                this.creatorAPI.revokeData.Render();
                this.player.ComponentGui.DisplaySmallMessage($"撤回成功", true, true);
            }
            if (this.SetSpawn.IsClicked)
            {
                Vector3 position = this.player.ComponentBody.Position;
                this.player.PlayerData.SpawnPosition = position + new Vector3(0f, 0.1f, 0f);
                this.player.ComponentGui.DisplaySmallMessage(string.Format("玩家重生点位置设置\n X: {0} Y : {1} Z : {2}", (int)position.X, (int)position.Y, (int)position.Z), true, true);
            }
            if (this.ModButton.IsClicked)
            {
                DialogsManager.ShowDialog(player.View.GameWidget, new ModDialog(creatorAPI));
            }
            if (this.ReplaceButton.IsClicked)
            {
                DialogsManager.ShowDialog(player.View.GameWidget, new ReplaceDialog(creatorAPI));
            }
            if (this.SetModeButton.IsClicked)
            {
                DialogsManager.ShowDialog(player.View.GameWidget, new SetModeDialog(creatorAPI));
            }
            if (this.OnekeyButton.IsClicked)
            {
                DialogsManager.ShowDialog(player.View.GameWidget, new OnekeyGenerationDialog(creatorAPI));
            }
            if (this.CopyPasteButton.IsClicked)
            {
                DialogsManager.ShowDialog(player.View.GameWidget, new CopyPasteDialog(creatorAPI));
            }
            this.ClearCacheButton.IsEnabled = Directory.Exists(CreatorMain.CacheDirectory);
            if (this.ClearCacheButton.IsClicked)
            {
                if (FileOperation.Delete(CreatorMain.CacheDirectory))
                {
                    this.player.ComponentGui.DisplaySmallMessage("清除成功", true, true);
                }
                else
                {
                    this.player.ComponentGui.DisplaySmallMessage("清除失败", true, true);
                }
            }
            if (this.RemoveAnimalButton.IsClicked)
            {
                int num = 0;
                foreach (ComponentCreature current in player.Project.FindSubsystem <SubsystemCreatureSpawn>(true).Creatures)
                {
                    if (!(current is ComponentPlayer))
                    {
                        current.ComponentSpawn.Despawn();
                        num++;
                    }
                }
                this.player.ComponentGui.DisplaySmallMessage(string.Format("清除成功,共清除{0}只动物", num), true, false);
            }
            if (this.RemoveItemButton.IsClicked)
            {
                int num = 0;
                foreach (Pickable item in GameManager.Project.FindSubsystem <SubsystemPickables>(true).Pickables)
                {
                    item.Count    = 0;
                    item.ToRemove = true;
                    num++;
                }
                this.player.ComponentGui.DisplaySmallMessage(string.Format("清除成功,共清除{0}个掉落物", num), true, false);
            }
            if (this.TerrainTestButton.IsClicked)
            {
                IList <int>      enumValues       = EnumUtils.GetEnumValues(typeof(CreatorTerrainType));
                SubsystemTerrain subsystemTerrain = GameManager.Project.FindSubsystem <SubsystemTerrain>();
                DialogsManager.ShowDialog(null, new ListSelectionDialog("选择地形类型", enumValues, 56f, (object e) => ((TerrainGenerationMode)e).ToString(), delegate(object e)
                {
                    ITerrainContentsGenerator myTerrain;
                    if ((CreatorTerrainType)e == CreatorTerrainType.Flat)
                    {
                        myTerrain = new CreatorNormalTerrain(subsystemTerrain);
                    }
                    else
                    {
                        myTerrain = new CreatorNormalTerrain(subsystemTerrain);
                    }
                    subsystemTerrain.Dispose();
                    subsystemTerrain.Load(new ValuesDictionary());
                    subsystemTerrain.TerrainContentsGenerator = myTerrain;
                }));
            }
            if (this.SetPositionCarefulButton.IsClicked)
            {
            }
            if (this.AdjustPositionButton.IsClicked)
            {
            }
            if (this.ThreePointPlaneButton.IsClicked)
            {
                DialogsManager.ShowDialog(player.View.GameWidget, new ThreePointToPlaneDialog(creatorAPI));
            }
            if (this.FourPointSpaceButton.IsClicked)
            {
                DialogsManager.ShowDialog(player.View.GameWidget, new FourPointSpaceDialog(creatorAPI));
            }
            //.........



            if (this.SetDifficultyButton.IsClicked)
            {
                Vector3 position = player.ComponentBody.Position;
                Point3  point3   = new Point3((int)position.X, (int)position.Y, (int)position.Z);
                int[]   p        = new int[4] {
                    0, 1, 2, 3
                };
                string[] difference = new string[4] {
                    "容易", "一般", "困难", "地狱"
                };
                DialogsManager.ShowDialog(null, new ListSelectionDialog("选择难度", p, 56f, (object e) => difference[(int)e], delegate(object e)
                {
                    this.player.ComponentGui.DisplaySmallMessage($"成功设置难度位: {difference[(int)e]}", true, true);
                }));
            }
        }
示例#23
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;
            }
        }
示例#24
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();
        }