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();
        }
示例#2
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();
                    });
                }
            }
        }
        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));
                    }
                }));
            }
        }
示例#4
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();
        }
示例#5
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();
        }
示例#6
0
        public override void Update()
        {
            resize       = (int)m_resizeSlider.Value;
            furnit_resol = (int)m_furniture_resolutionSlider.Value;
            deep_color   = (int)m_deep_colorSlider.Value;
            ofst_color   = (int)m_color_ofsetSlider.Value;


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

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


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


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

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



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

            UpdateControls();
        }
示例#7
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();
        }