Пример #1
0
        public Musket2Widget(IInventory inventory, int slotIndex)
        {
            m_inventory = inventory;
            m_slotIndex = slotIndex;
            WidgetsManager.LoadWidgetContents(this, this, ContentManager.Get <XElement>("Widgets/Musket2Widget"));
            m_inventoryGrid       = Children.Find <GridPanelWidget>("InventoryGrid");
            m_inventorySlotWidget = Children.Find <InventorySlotWidget>("InventorySlot");
            m_instructionsLabel   = Children.Find <LabelWidget>("InstructionsLabel");
            int i = 0, num;

            for (; i < m_inventoryGrid.RowsCount; i++)
            {
                for (num = 0; num < m_inventoryGrid.ColumnsCount; num++)
                {
                    var widget = new InventorySlotWidget();
                    m_inventoryGrid.Children.Add(widget);
                    m_inventoryGrid.SetWidgetCell(widget, new Point2(num, i));
                }
            }
            num = 6;
            i   = 0;
            for (int count = m_inventoryGrid.Children.Count; i < count; i++)
            {
                if (m_inventoryGrid.Children[i] is InventorySlotWidget inventorySlotWidget)
                {
                    inventorySlotWidget.AssignInventorySlot(inventory, num++);
                }
            }
            m_inventorySlotWidget.AssignInventorySlot(inventory, slotIndex);
            m_inventorySlotWidget.CustomViewMatrix = Matrix.CreateLookAt(new Vector3(1f, 0f, 0f), new Vector3(0f, 0f, 0f), -Vector3.UnitZ);
        }
Пример #2
0
        public SetModeDialog(CreatorAPI creatorAPI)
        {
            this.creatorAPI = creatorAPI;
            this.player     = creatorAPI.componentMiner.ComponentPlayer;
            XElement node = ContentManager.Get <XElement>("NewWidgets/Dialog/模式设置");

            WidgetsManager.LoadWidgetContents(this, this, node);
            this.CreativeButton    = Children.Find <ButtonWidget>("创造模式", true);
            this.ChallengingButton = Children.Find <ButtonWidget>("挑战模式", true);
            this.HarmlessButton    = Children.Find <ButtonWidget>("无害模式", true);
            this.AdventureButton   = Children.Find <ButtonWidget>("闯关模式", true);
            this.CruelButton       = Children.Find <ButtonWidget>("残酷模式", true);
            this.cancelButton      = Children.Find <ButtonWidget>("取消", true);
            gameInfo = player.Project.FindSubsystem <SubsystemGameInfo>(true);
            if (gameInfo.WorldSettings.GameMode == GameMode.Creative)
            {
                CreativeButton.IsEnabled = false;
            }
            else if (gameInfo.WorldSettings.GameMode == GameMode.Challenging)
            {
                ChallengingButton.IsEnabled = false;
            }
            else if (gameInfo.WorldSettings.GameMode == GameMode.Harmless)
            {
                HarmlessButton.IsEnabled = false;
            }
            else if (gameInfo.WorldSettings.GameMode == GameMode.Adventure)
            {
                AdventureButton.IsEnabled = false;
            }
            else if (gameInfo.WorldSettings.GameMode == GameMode.Cruel)
            {
                CruelButton.IsEnabled = false;
            }
        }
 public SingleplayerScreen()
 {
     WidgetsManager.LoadWidgetContents((Widget)this.ScreenWidget, (object)this, ContentManager.Get <XElement>("Screens/SingleplayerScreen"));
     this.m_worldsListWidget = this.ScreenWidget.Children.Find <ListPanelWidget>("WorldsList", true);
     this.m_worldsListWidget.ItemWidgetFactory += (Func <object, Widget>)(item =>
     {
         WorldInfo worldInfo             = (WorldInfo)item;
         ContainerWidget containerWidget = (ContainerWidget)WidgetsManager.LoadWidget((object)this, ContentManager.Get <XElement>("Widgets/SavedWorldItem"), null);
         LabelWidget labelWidget1        = containerWidget.Children.Find <LabelWidget>("WorldItem.Name", true);
         LabelWidget labelWidget2        = containerWidget.Children.Find <LabelWidget>("WorldItem.Size", true);
         LabelWidget labelWidget3        = containerWidget.Children.Find <LabelWidget>("WorldItem.Date", true);
         LabelWidget labelWidget4        = containerWidget.Children.Find <LabelWidget>("WorldItem.GameMode", true);
         LabelWidget labelWidget5        = containerWidget.Children.Find <LabelWidget>("WorldItem.EnvironmentBehaviorMode", true);
         LabelWidget labelWidget6        = containerWidget.Children.Find <LabelWidget>("WorldItem.Version", true);
         containerWidget.Tag = (object)worldInfo;
         labelWidget1.Text   = worldInfo.Name;
         labelWidget2.Text   = string.Format("{0:0.00MB}", new object[1]
         {
             (object)(float)((double)worldInfo.Size / 1024.0 / 1024.0)
         });
         labelWidget3.Text = string.Format("{0:dd MMM yyyy HH:mm}", new object[1]
         {
             (object)worldInfo.LastSaveTime
         });
         labelWidget4.Text = worldInfo.GameMode.ToString();
         labelWidget5.Text = worldInfo.EnvironmentBehaviorMode.ToString();
         labelWidget6.Text = !(worldInfo.SerializationVersion != VersionsManager.SerializationVersion) ? string.Empty : (string.IsNullOrEmpty(worldInfo.SerializationVersion) ? "(unknown)" : "(" + worldInfo.SerializationVersion + ")");
         return((Widget)containerWidget);
     });
 }
        public Sphere(ComponentPlayer player, int id, TerrainRaycastResult?Point1, SubsystemTerrain subsystemTerrain)
        {
            Point = null;
            Point = Point1;
            m_subsystemTerrain = subsystemTerrain;

            id1         = id;
            this.player = player;
            WidgetsManager.LoadWidgetContents(this, this, ContentManager.Get <XElement>("WE/DialogsWE/SphereDialog"));
            m_title = this.Children.Find <LabelWidget>("Sphere_Dialog.Title", true);

            Mode = this.Children.Find <LabelWidget>("Sphere_Dialog.Mode", true);


            Icon_select = this.Children.Find <ButtonWidget>("Sphere_Dialog.Icon_select", true);


            m_radius = this.Children.Find <SliderWidget>("Sphere_Dialog.Slider1", true);

            plusButton  = this.Children.Find <ButtonWidget>("Sphere_Dialog.Button4", true);
            minusButton = this.Children.Find <ButtonWidget>("Sphere_Dialog.Button3", true);



            mSelect_mode = this.Children.Find <ButtonWidget>("Sphere_Dialog.Select_mode", true);

            m_okButton     = this.Children.Find <ButtonWidget>("Sphere_Dialog.OK", true);
            m_cancelButton = this.Children.Find <ButtonWidget>("Sphere_Dialog.Cancel", true);

            this.m_blockIconWidget = this.Children.Find <BlockIconWidget>("Sphere_Dialog.Icon", true);


            m_title.Text = "Sphere";

            //switch_mode.Text = "Holow";

            //m_blockIconWidget.Value


            Mode.Text = "Hollow";


            m_radius.MinValue = 1f;
            m_radius.MaxValue = 100;
            m_radius.Value    = 1f;



            names.Add("Soild");
            names.Add("Hollow");


            foreach (string category in names)
            {
                m_categories.Add(new Category()
                {
                    Name = category,
                });
            }
        }
Пример #5
0
        public NewChestWidget(IInventory inventory, ComponentInventoryBase component, string text = null)
        {
            Component = component;
            WidgetsManager.LoadWidgetContents(this, this, ContentManager.Get <XElement>("Widgets/NewChestWidget"));
            if (text != null)
            {
                Children.Find <LabelWidget>("ChestLabel").Text = text;
            }
            m_inventoryGrid = Children.Find <GridPanelWidget>("InventoryGrid");
            m_chestNewGrid  = Children.Find <GridPanelWidget>("ChestGrid");
            int num = 0, y, x;
            InventorySlotWidget inventorySlotWidget;

            for (y = 0; y < m_chestNewGrid.RowsCount; y++)
            {
                for (x = 0; x < m_chestNewGrid.ColumnsCount; x++)
                {
                    inventorySlotWidget = new InventorySlotWidget();
                    inventorySlotWidget.AssignInventorySlot(component, num++);
                    m_chestNewGrid.Children.Add(inventorySlotWidget);
                    m_chestNewGrid.SetWidgetCell(inventorySlotWidget, new Point2(x, y));
                }
            }
            num = 6;
            for (y = 0; y < m_inventoryGrid.RowsCount; y++)
            {
                for (x = 0; x < m_inventoryGrid.ColumnsCount; x++)
                {
                    inventorySlotWidget = new InventorySlotWidget();
                    inventorySlotWidget.AssignInventorySlot(inventory, num++);
                    m_inventoryGrid.Children.Add(inventorySlotWidget);
                    m_inventoryGrid.SetWidgetCell(inventorySlotWidget, new Point2(x, y));
                }
            }
        }
Пример #6
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();
                }));
            }
        }
Пример #7
0
        public PresserWidget(IInventory inventory, T component, string path)
        {
            m_componentFurnace = component;
            WidgetsManager.LoadWidgetContents(this, this, ContentManager.Get <XElement>(path));
            m_inventoryGrid = Children.Find <GridPanelWidget>("InventoryGrid");
            m_furnaceGrid   = Children.Find <GridPanelWidget>("FurnaceGrid");
            m_fire          = Children.Find <FireWidget>("Fire");
            m_progress      = Children.Find <ValueBarWidget>("Progress");
            m_resultSlot    = Children.Find <InventorySlotWidget>("ResultSlot");
            int num = 6, y, x;
            InventorySlotWidget inventorySlotWidget;

            for (y = 0; y < m_inventoryGrid.RowsCount; y++)
            {
                for (x = 0; x < m_inventoryGrid.ColumnsCount; x++)
                {
                    inventorySlotWidget = new InventorySlotWidget();
                    inventorySlotWidget.AssignInventorySlot(inventory, num++);
                    m_inventoryGrid.Children.Add(inventorySlotWidget);
                    m_inventoryGrid.SetWidgetCell(inventorySlotWidget, new Point2(x, y));
                }
            }
            num = 0;
            for (y = 0; y < m_furnaceGrid.RowsCount; y++)
            {
                for (x = 0; x < m_furnaceGrid.ColumnsCount; x++)
                {
                    inventorySlotWidget = new InventorySlotWidget();
                    inventorySlotWidget.AssignInventorySlot(component, num++);
                    m_furnaceGrid.Children.Add(inventorySlotWidget);
                    m_furnaceGrid.SetWidgetCell(inventorySlotWidget, new Point2(x, y));
                }
            }
            m_resultSlot.AssignInventorySlot(component, component.ResultSlotIndex);
        }
Пример #8
0
 public static void LoadButtons(string XmlPath) // Загрузка кнопок из XML файла
 {
     using (FileStream fs = new FileStream(XmlPath, FileMode.Open, FileAccess.Read, FileShare.Read))
     {
         WidgetsManager.LoadWidgetContents(ScreensManager.CurrentScreen.ScreenWidget, ScreensManager.CurrentScreen, XElement.Load(fs));
         fs.Close();
     }
 }
Пример #9
0
        public FillingDialog(CreatorAPI creatorAPI) : base(creatorAPI)
        {
            XElement node = ContentManager.Get <XElement>("NewWidgets/Dialog/填充界面");

            WidgetsManager.LoadWidgetContents(this, this, node);
            base.GeneralSet();
            base.setShaftXYZ();
            Y_Shaft.Text        = "正Y轴";
            this.pillingButton  = this.Children.Find <ButtonWidget>("填充", true);
            this.pilling2Button = this.Children.Find <ButtonWidget>("填充2", true);
        }
Пример #10
0
        public PavageDialog(CreatorAPI creatorAPI)
        {
            this.creatorAPI = creatorAPI;
            this.player     = creatorAPI.componentMiner.ComponentPlayer;
            XElement node = ContentManager.Get <XElement>("NewWidgets/Dialog/平铺界面");

            WidgetsManager.LoadWidgetContents(this, this, node);
            this.OKButton     = Children.Find <ButtonWidget>("确定", true);
            this.cancelButton = Children.Find <ButtonWidget>("取消", true);
            this.TextBox      = Children.Find <TextBoxWidget>("方块ID", true);
            this.slider       = Children.Find <SliderWidget>("滑条1", true);
        }
Пример #11
0
        public TwoPointLineDialog(CreatorAPI creatorAPI) : base(creatorAPI)
        {
            this.creatorAPI       = creatorAPI;
            this.player           = creatorAPI.componentMiner.ComponentPlayer;
            this.subsystemTerrain = player.Project.FindSubsystem <SubsystemTerrain>(true);
            XElement node = ContentManager.Get <XElement>("NewWidgets/Dialog/通用界面3");

            WidgetsManager.LoadWidgetContents(this, this, node);
            base.GeneralSet();
            this.Children.Find <LabelWidget>("名称", true).Text = "2点连线";
            this.OKButton = this.Children.Find <ButtonWidget>("确定", true);
        }
Пример #12
0
        public Mountain(ComponentPlayer player, TerrainRaycastResult?Point1, SubsystemTerrain subsystemTerrain)
        {
            m_subsystemTerrain = subsystemTerrain;
            Point = Point1;

            id1 = 3;
            id2 = 2;
            id3 = 8;

            this.player = player;
            WidgetsManager.LoadWidgetContents(this, this, ContentManager.Get <XElement>("WE/DialogsWE/MountainDialog"));

            m_title = this.Children.Find <LabelWidget>("Mountain_Dialog.Title", true);

            Icon_select  = this.Children.Find <ButtonWidget>("Mountain_Dialog.Icon_select", true);
            Icon_select1 = this.Children.Find <ButtonWidget>("Mountain_Dialog.Icon_select1", true);
            Icon_select2 = this.Children.Find <ButtonWidget>("Mountain_Dialog.Icon_select2", true);

            m_radius = this.Children.Find <SliderWidget>("Mountain_Dialog.Slider1", true);
            m_lenght = this.Children.Find <SliderWidget>("Mountain_Dialog.Slider2", true);

            plusButton  = this.Children.Find <ButtonWidget>("Mountain_Dialog.Button4", true);
            minusButton = this.Children.Find <ButtonWidget>("Mountain_Dialog.Button3", true);

            lenght_plusButton  = this.Children.Find <ButtonWidget>("Mountain_Dialog.Button2", true);
            lenght_minusButton = this.Children.Find <ButtonWidget>("Mountain_Dialog.Button1", true);


            m_okButton     = this.Children.Find <ButtonWidget>("Mountain_Dialog.OK", true);
            m_cancelButton = this.Children.Find <ButtonWidget>("Mountain_Dialog.Cancel", true);

            m_blockIconWidget  = this.Children.Find <BlockIconWidget>("Mountain_Dialog.Icon", true);
            m_blockIconWidget1 = this.Children.Find <BlockIconWidget>("Mountain_Dialog.Icon1", true);
            m_blockIconWidget2 = this.Children.Find <BlockIconWidget>("Mountain_Dialog.Icon2", true);


            m_title.Text = "Mountain";

            //switch_mode.Text = "Holow";

            //m_blockIconWidget.Value



            m_radius.MinValue = 1f;
            m_radius.MaxValue = 100;
            m_radius.Value    = 1f;

            m_lenght.MinValue = 1f;
            m_lenght.MaxValue = 100;
            m_lenght.Value    = 1f;
        }
Пример #13
0
        public TransferDialog(CreatorAPI creatorAPI)
        {
            this.player           = creatorAPI.componentMiner.ComponentPlayer;
            this.subsystemTerrain = player.Project.FindSubsystem <SubsystemTerrain>(true);
            XElement node = ContentManager.Get <XElement>("NewWidgets/Dialog/传送设置");

            WidgetsManager.LoadWidgetContents(this, this, node);
            this.cancelButton = Children.Find <ButtonWidget>("取消", true);
            this.Transfer     = Children.Find <ButtonWidget>("传送", true);
            this.X            = Children.Find <TextBoxWidget>("X", true);
            this.Y            = Children.Find <TextBoxWidget>("Y", true);
            this.Z            = Children.Find <TextBoxWidget>("Z", true);
        }
Пример #14
0
        public RectangularDialog(CreatorAPI creatorAPI) : base(creatorAPI)
        {
            this.creatorAPI       = creatorAPI;
            this.player           = creatorAPI.componentMiner.ComponentPlayer;
            this.subsystemTerrain = player.Project.FindSubsystem <SubsystemTerrain>(true);
            XElement node = ContentManager.Get <XElement>("NewWidgets/Dialog/矩形界面");

            WidgetsManager.LoadWidgetContents(this, this, node);
            base.GeneralSet();
            this.SoildButton     = this.Children.Find <ButtonWidget>("实心", true);
            this.HollowButton    = this.Children.Find <ButtonWidget>("空心", true);
            this.FrameworkButton = this.Children.Find <ButtonWidget>("框架", true);
        }
Пример #15
0
        public ReplaceDialog(CreatorAPI creatorAPI)
        {
            this.creatorAPI = creatorAPI;
            this.player     = creatorAPI.componentMiner.ComponentPlayer;
            XElement node = ContentManager.Get <XElement>("NewWidgets/Dialog/替换界面");

            WidgetsManager.LoadWidgetContents(this, this, node);
            this.cancelButton        = Children.Find <ButtonWidget>("取消", true);
            this.replaceButton       = Children.Find <ButtonWidget>("替换", true);
            this.retainReplaceButton = Children.Find <ButtonWidget>("保留替换");
            this.roughReplaceButton  = Children.Find <ButtonWidget>("粗糙替换");
            this.Blockid             = Children.Find <TextBoxWidget>("方块ID", true);
            this.Blockid2            = Children.Find <TextBoxWidget>("方块ID2", true);
        }
Пример #16
0
        public CommandHelperDialog(SubsystemCommandEngine engine)
        {
            commandEngine = engine;

            XElement node = ContentManager.Get <XElement>("Dialogs/CommandHelperDialog");

            WidgetsManager.LoadWidgetContents(this, this, node);
            animals = Children.Find <ButtonWidget>("CommandHelperDialog.ShowAnimals");
            blocks  = Children.Find <ButtonWidget>("CommandHelperDialog.ShowBlocks");
            back    = Children.Find <ButtonWidget>("CommandHelperDialog.Back");

            textBoxAnimal = Children.Find <TextBoxWidget>("CommandHelperDialog.AnimalName");
            textBoxBlock  = Children.Find <TextBoxWidget>("CommandHelperDialog.BlockName");
        }
Пример #17
0
        public EditWorldDialog(CreatorAPI creatorAPI)
        {
            this.creatorAPI = creatorAPI;
            this.player     = creatorAPI.componentMiner.ComponentPlayer;
            XElement node = ContentManager.Get <XElement>("NewWidgets/Dialog/编辑世界");

            WidgetsManager.LoadWidgetContents(this, this, node);
            this.worldSettings                    = player.Project.FindSubsystem <SubsystemGameInfo>(true).WorldSettings;
            this.OKButton                         = Children.Find <ButtonWidget>("确定");
            this.UpdataWorldButton                = Children.Find <ButtonWidget>("重载");
            this.UpdataButton                     = Children.Find <ButtonWidget>("刷新");
            this.paletteButton                    = this.Children.Find <ButtonWidget>("Palette", true);
            this.blocksTextureIcon                = this.Children.Find <RectangleWidget>("BlocksTextureIcon", true);
            this.blocksTextureLabel               = this.Children.Find <LabelWidget>("BlocksTextureLabel", true);
            this.blocksTextureDetails             = this.Children.Find <LabelWidget>("BlocksTextureDetails", true);
            this.blocksTextureButton              = this.Children.Find <ButtonWidget>("BlocksTextureButton", true);
            this.supernaturalCreaturesButton      = this.Children.Find <ButtonWidget>("SupernaturalCreatures", true);
            this.environmentBehaviorButton        = this.Children.Find <ButtonWidget>("EnvironmentBehavior", true);
            this.timeOfDayButton                  = this.Children.Find <ButtonWidget>("TimeOfDay", true);
            this.weatherEffectsButton             = this.Children.Find <ButtonWidget>("WeatherEffects", true);
            this.adventureRespawnButton           = this.Children.Find <ButtonWidget>("AdventureRespawn", true);
            this.adventureSurvivalMechanicsButton = this.Children.Find <ButtonWidget>("AdventureSurvivalMechanics", true);
            this.terrainGenerationLabel           = this.Children.Find <LabelWidget>("TerrainGenerationLabel", true);
            this.terrainGenerationButton          = this.Children.Find <ButtonWidget>("TerrainGeneration", true);
            this.seaLevelOffsetSlider             = this.Children.Find <SliderWidget>("SeaLevelOffset", true);
            this.temperatureOffsetSlider          = this.Children.Find <SliderWidget>("TemperatureOffset", true);
            this.humidityOffsetSlider             = this.Children.Find <SliderWidget>("HumidityOffset", true);
            this.biomeSizeSlider                  = this.Children.Find <SliderWidget>("BiomeSize", true);
            this.islandTerrainPanel               = this.Children.Find <Widget>("IslandTerrainPanel", true);
            this.islandSizeNS                     = this.Children.Find <SliderWidget>("IslandSizeNS", true);
            this.islandSizeEW                     = this.Children.Find <SliderWidget>("IslandSizeEW", true);
            this.flatTerrainPanel                 = this.Children.Find <Widget>("FlatTerrainPanel", true);
            this.continentTerrainPanel            = this.Children.Find <Widget>("ContinentTerrainPanel", true);
            this.flatTerrainLevelSlider           = this.Children.Find <SliderWidget>("FlatTerrainLevel", true);
            this.flatTerrainBlock                 = this.Children.Find <BlockIconWidget>("FlatTerrainBlock", true);
            this.flatTerrainBlockLabel            = this.Children.Find <LabelWidget>("FlatTerrainBlockLabel", true);
            this.flatTerrainBlockButton           = this.Children.Find <ButtonWidget>("FlatTerrainBlockButton", true);
            this.flatTerrainMagmaOceanCheckbox    = this.Children.Find <CheckboxWidget>("MagmaOcean", true);

            this.islandSizeEW.MinValue       = 0f;
            this.islandSizeEW.MaxValue       = (float)(this.islandSizes.Length - 1);
            this.islandSizeEW.Granularity    = 1f;
            this.islandSizeNS.MinValue       = 0f;
            this.islandSizeNS.MaxValue       = (float)(this.islandSizes.Length - 1);
            this.islandSizeNS.Granularity    = 1f;
            this.biomeSizeSlider.MinValue    = 0f;
            this.biomeSizeSlider.MaxValue    = (float)(this.biomeSizes.Length - 1);
            this.biomeSizeSlider.Granularity = 1f;
        }
Пример #18
0
        public LevelSetDialog(CreatorAPI creatorAPI)
        {
            this.player = creatorAPI.componentMiner.ComponentPlayer;
            XElement node = ContentManager.Get <XElement>("NewWidgets/Dialog/等级设置");

            WidgetsManager.LoadWidgetContents(this, this, node);
            this.Radius       = Children.Find <SliderWidget>("等级", true);
            this.plusButton   = Children.Find <ButtonWidget>("增加按钮", true);
            this.minusButton  = Children.Find <ButtonWidget>("减少按钮", true);
            this.delayLabel   = Children.Find <LabelWidget>("滑条", true);
            this.OK           = Children.Find <ButtonWidget>("确定", true);
            this.Cancel       = Children.Find <ButtonWidget>("取消", true);
            this.Radius.Value = player.PlayerData.Level;
            this.UpdateControls();
        }
Пример #19
0
            public PasswordDialog(ComponentPlayer player)
            {
                this.player = player;
                XElement node = ContentManager.Get <XElement>("NewWidgets/Dialog/通用界面3");

                WidgetsManager.LoadWidgetContents(this, this, node);
                Children.Find <LabelWidget>("名称", true).Text = "请输入密匙";
                this.cancelButton  = Children.Find <ButtonWidget>("取消", true);
                this.OK            = Children.Find <ButtonWidget>("确定", true);
                this.TextBox       = Children.Find <TextBoxWidget>("方块ID", true);
                this.TextBox.Title = "请输入密匙";
                this.TextBox.Text  = "";
                this.Children.Find <BlockIconWidget>("方块").IsVisible = false;
                this.Children.Find <ButtonWidget>("选择方块").IsVisible  = false;
            }
Пример #20
0
            public DerivedDialog(ComponentPlayer player, Dialog dialog, ListPanelWidget listView)
            {
                this.player   = player;
                this.dialog   = dialog;
                this.listView = listView;
                XElement node = ContentManager.Get <XElement>("NewWidgets/Dialog/通用界面3");

                WidgetsManager.LoadWidgetContents(this, this, node);
                Children.Find <LabelWidget>("名称", true).Text = "请输入名称";
                this.cancelButton = Children.Find <ButtonWidget>("取消", true);
                this.OK           = Children.Find <ButtonWidget>("确定", true);
                this.TextBox      = Children.Find <TextBoxWidget>("方块ID", true);
                this.TextBox.Text = "";
                this.Children.Find <BlockIconWidget>("方块").IsVisible = false;
            }
Пример #21
0
        public EditRegionDialog(CreatorAPI creatorAPI)
        {
            this.creatorAPI       = creatorAPI;
            this.player           = creatorAPI.componentMiner.ComponentPlayer;
            this.subsystemTerrain = creatorAPI.componentMiner.Project.FindSubsystem <SubsystemTerrain>(true);
            XElement node = ContentManager.Get <XElement>("NewWidgets/Dialog/编辑区域");

            WidgetsManager.LoadWidgetContents(this, this, node);
            this.SliderData        = this.Children.Find <LabelWidget>("滑条数据", true);
            this.TemperatureSlider = this.Children.Find <SliderWidget>("滑条1", true);
            this.HumiditySlider    = this.Children.Find <SliderWidget>("滑条2", true);
            this.TopHeightSlider   = this.Children.Find <SliderWidget>("滑条3", true);
            this.OKButton          = this.Children.Find <ButtonWidget>("确定", true);
            this.cancelButton      = this.Children.Find <ButtonWidget>("取消");
        }
Пример #22
0
        public PyramidDialog(CreatorAPI creatorAPI) : base(creatorAPI)
        {
            this.creatorAPI       = creatorAPI;
            this.player           = creatorAPI.componentMiner.ComponentPlayer;
            this.subsystemTerrain = player.Project.FindSubsystem <SubsystemTerrain>(true);
            XElement node = ContentManager.Get <XElement>("NewWidgets/Dialog/棱体棱锥界面");

            WidgetsManager.LoadWidgetContents(this, this, node);
            base.GeneralSet();
            this.Children.Find <StackPanelWidget>("XYZ", true).IsVisible = false;
            this.Children.Find <LabelWidget>("名称", true).Text            = "棱锥";
            this.Radius       = this.Children.Find <SliderWidget>("滑条", true);
            this.delayLabel   = this.Children.Find <LabelWidget>("滑条数据", true);
            this.SoildButton  = this.Children.Find <ButtonWidget>("实心", true);
            this.HollowButton = this.Children.Find <ButtonWidget>("空心", true);
        }
Пример #23
0
        public HelpScreen()
        {
            WidgetsManager.LoadWidgetContents(this, this, ContentManager.Get <XElement>("Screens/HelpScreen"));
            m_topicsList       = Children.Find <ListPanelWidget>("TopicsList", true);
            m_recipaediaButton = Children.Find <ButtonWidget>("RecipaediaButton", true);
            m_bestiaryButton   = Children.Find <ButtonWidget>("BestiaryButton", true);

            m_topicsList.ItemWidgetFactory = delegate(object item)
            {
                var      helpTopic3 = (HelpTopic)item;
                XElement node2      = ContentManager.Get <XElement>("Widgets/HelpTopicItem");
                var      obj        = (ContainerWidget)WidgetsManager.LoadWidget(this, node2, null);
                obj.Children.Find <LabelWidget>("HelpTopicItem.Title", true).Text = helpTopic3.Title;
                return(obj);
            };
            m_topicsList.ItemClicked += delegate(object item)
            {
                if (item is HelpTopic helpTopic2)
                {
                    ShowTopic(helpTopic2);
                }
            };
            for (var i = ContentManager.CombineXml(ContentManager.Get <XElement>("Help"), ModsManager.GetEntries(".hlp"), "Title", "Name", "Topic").Elements().GetEnumerator(); i.MoveNext();)
            {
                var element  = i.Current;
                var strArray = XmlUtils.GetAttributeValue(element, "DisabledPlatforms", string.Empty).Split(',');
                if (strArray.FirstOrDefault(Match) == null)
                {
                    var attributeValue1 = XmlUtils.GetAttributeValue(element, "Name", string.Empty);
                    var attributeValue2 = XmlUtils.GetAttributeValue <string>(element, "Title");
                    var str1            = string.Empty;
                    strArray = element.Value.Split('\n');
                    for (int i1 = 0; i1 < strArray.Length; i1++)
                    {
                        str1 = str1 + strArray[i1].Trim() + " ";
                    }
                    var helpTopic = new HelpTopic {
                        Name = attributeValue1, Title = attributeValue2, Text = str1.Replace("\r", "").Replace("’", "'").Replace("\\n", "\n")
                    };
                    if (!string.IsNullOrEmpty(helpTopic.Name))
                    {
                        m_topics.Add(helpTopic.Name, helpTopic);
                    }
                    m_topicsList.AddItem(helpTopic);
                }
            }
        }
Пример #24
0
        public PillarsDialog(CreatorAPI creatorAPI) : base(creatorAPI)
        {
            XElement node = ContentManager.Get <XElement>("NewWidgets/Dialog/柱子界面");

            WidgetsManager.LoadWidgetContents(this, this, node);
            base.GeneralSet();
            base.setShaftXYZ();
            Y_Shaft.Text = "正Y轴";
            this.Children.Find <LabelWidget>("名称", true).Text = "柱子";
            this.Radius           = this.Children.Find <SliderWidget>("滑条1", true);
            this.radiusDelayLabel = this.Children.Find <LabelWidget>("滑条1数据", true);
            this.Height           = this.Children.Find <SliderWidget>("滑条2", true);
            this.heightDelayLabel = this.Children.Find <LabelWidget>("滑条2数据", true);
            this.Children.Find <StackPanelWidget>("Data3", true).IsVisible = false;
            this.SoildButton  = this.Children.Find <ButtonWidget>("实心", true);
            this.HollowButton = this.Children.Find <ButtonWidget>("空心", true);
        }
Пример #25
0
        public FractionalTowerWidget(IInventory inventory, ComponentMachine componentFurnace)
        {
            m_componentFurnace = componentFurnace;
            WidgetsManager.LoadWidgetContents(this, this, ContentManager.Get <XElement>("Widgets/FractionalTowerWidget"));
            m_inventoryGrid   = Children.Find <GridPanelWidget>("InventoryGrid");
            m_furnaceGrid     = Children.Find <GridPanelWidget>("FurnaceGrid");
            m_result1         = Children.Find <InventorySlotWidget>("ResultSlot1");
            m_result2         = Children.Find <InventorySlotWidget>("ResultSlot2");
            m_result3         = Children.Find <InventorySlotWidget>("ResultSlot3");
            m_cir1            = Children.Find <InventorySlotWidget>("CircuitSlot1");
            m_cir2            = Children.Find <InventorySlotWidget>("CircuitSlot2");
            m_acceptsDropsBox = Children.Find <CheckboxWidget>("AcceptsElectBox");
            m_progress        = Children.Find <ValueBarWidget>("Progress");

            int num = 6, y, x;
            InventorySlotWidget inventorySlotWidget;

            for (y = 0; y < m_inventoryGrid.RowsCount; y++)
            {
                for (x = 0; x < m_inventoryGrid.ColumnsCount; x++)
                {
                    inventorySlotWidget = new InventorySlotWidget();
                    inventorySlotWidget.AssignInventorySlot(inventory, num++);
                    m_inventoryGrid.Children.Add(inventorySlotWidget);
                    m_inventoryGrid.SetWidgetCell(inventorySlotWidget, new Point2(x, y));
                }
            }

            num = 0;
            for (y = 0; y < m_furnaceGrid.RowsCount; y++)
            {
                for (x = 0; x < m_furnaceGrid.ColumnsCount; x++)
                {
                    inventorySlotWidget = new InventorySlotWidget();
                    inventorySlotWidget.AssignInventorySlot(componentFurnace, num++);
                    m_furnaceGrid.Children.Add(inventorySlotWidget);
                    m_furnaceGrid.SetWidgetCell(inventorySlotWidget, new Point2(x, y));
                }
            }
            m_result1.AssignInventorySlot(componentFurnace, num++);
            m_result2.AssignInventorySlot(componentFurnace, num++);
            m_result3.AssignInventorySlot(componentFurnace, num++);
            m_cir1.AssignInventorySlot(componentFurnace, num++);
            m_cir2.AssignInventorySlot(componentFurnace, num++);
        }
Пример #26
0
        public LiquidPumpWidget(IInventory inventory, ComponentInventoryBase componentDispenser)
        {
            m_componentDispenser   = componentDispenser;
            m_componentBlockEntity = componentDispenser.Entity.FindComponent <ComponentBlockEntity>(true);
            m_subsystemTerrain     = componentDispenser.Project.FindSubsystem <SubsystemTerrain>(true);
            WidgetsManager.LoadWidgetContents(this, this, ContentManager.Get <XElement>("Widgets/LiquidPumpWidget"));
            m_inventoryGrid  = Children.Find <GridPanelWidget>("InventoryGrid");
            m_dispenserGrid  = Children.Find <GridPanelWidget>("DispenserGrid");
            m_dispenserGrid2 = Children.Find <GridPanelWidget>("DispenserGrid2");
            m_drillSlot      = Children.Find <InventorySlotWidget>("DrillSlot");
            int num = 0, y, x;

            for (y = 0; y < m_dispenserGrid.RowsCount; y++)
            {
                for (x = 0; x < m_dispenserGrid.ColumnsCount; x++)
                {
                    var inventorySlotWidget = new InventorySlotWidget();
                    inventorySlotWidget.AssignInventorySlot(componentDispenser, num++);
                    m_dispenserGrid.Children.Add(inventorySlotWidget);
                    m_dispenserGrid.SetWidgetCell(inventorySlotWidget, new Point2(x, y));
                }
            }
            for (y = 0; y < m_dispenserGrid2.RowsCount; y++)
            {
                for (x = 0; x < m_dispenserGrid2.ColumnsCount; x++)
                {
                    var inventorySlotWidget2 = new InventorySlotWidget();
                    inventorySlotWidget2.AssignInventorySlot(componentDispenser, num++);
                    m_dispenserGrid2.Children.Add(inventorySlotWidget2);
                    m_dispenserGrid2.SetWidgetCell(inventorySlotWidget2, new Point2(x, y));
                }
            }
            num = 6;
            for (y = 0; y < m_inventoryGrid.RowsCount; y++)
            {
                for (x = 0; x < m_inventoryGrid.ColumnsCount; x++)
                {
                    var inventorySlotWidget3 = new InventorySlotWidget();
                    inventorySlotWidget3.AssignInventorySlot(inventory, num++);
                    m_inventoryGrid.Children.Add(inventorySlotWidget3);
                    m_inventoryGrid.SetWidgetCell(inventorySlotWidget3, new Point2(x, y));
                }
            }
            m_drillSlot.AssignInventorySlot(componentDispenser, 8);
        }
Пример #27
0
        public OnekeyGenerationDialog(CreatorAPI creatorAPI)
        {
            this.creatorAPI       = creatorAPI;
            this.player           = creatorAPI.componentMiner.ComponentPlayer;
            this.subsystemTerrain = player.Project.FindSubsystem <SubsystemTerrain>(true);
            XElement node = ContentManager.Get <XElement>("NewWidgets/Dialog/一键界面");

            WidgetsManager.LoadWidgetContents(this, this, node);
            this.CreateButton   = Children.Find <ButtonWidget>("创建", true);
            this.OnAndOffButton = Children.Find <ButtonWidget>("开启", true);
            this.DerivedButton  = Children.Find <ButtonWidget>("导出", true);
            this.ImportButton   = Children.Find <ButtonWidget>("导入", true);
            this.DeleteButton   = Children.Find <ButtonWidget>("删除", true);
            this.OKButton       = Children.Find <ButtonWidget>("确定", true);
            this.ListView       = Children.Find <ListPanelWidget>("ListView", true);
            this.TypeButton     = Children.Find <ButtonWidget>("类型", true);
            UpList();
        }
Пример #28
0
        public ModDialog(CreatorAPI creatorAPI)
        {
            this.creatorAPI = creatorAPI;
            this.player     = creatorAPI.componentMiner.ComponentPlayer;
            XElement node = ContentManager.Get <XElement>("NewWidgets/Widget/模组界面");

            WidgetsManager.LoadWidgetContents(this, this, node);
            this.OK = Children.Find <ButtonWidget>("确定", true);
            this.ExportOnekeyButton    = Children.Find <ButtonWidget>("导出一键", true);
            this.ImportButton          = Children.Find <ButtonWidget>("导入配置", true);
            this.ExportCopyButton      = Children.Find <ButtonWidget>("导出复制", true);
            this.ExportOldCopyButton   = Children.Find <ButtonWidget>("导出旧复制", true);
            this.ExportOldOnekeyButton = Children.Find <ButtonWidget>("导出旧一键", true);
            this.DerivedSpecialButton  = Children.Find <ButtonWidget>("导出特殊", true);
            this.DeleteButton          = Children.Find <ButtonWidget>("删除", true);
            this.ListView = Children.Find <ListPanelWidget>("ListView", true);
            UpList();
        }
Пример #29
0
        public SphereDialog(CreatorAPI creatorAPI) : base(creatorAPI)
        {
            XElement node = ContentManager.Get <XElement>("NewWidgets/Dialog/球体界面");

            WidgetsManager.LoadWidgetContents(this, this, node);
            base.GeneralSet();
            this.XRadius              = this.Children.Find <SliderWidget>("X半径滑条", true);
            this.YRadius              = this.Children.Find <SliderWidget>("Y半径滑条", true);
            this.ZRadius              = this.Children.Find <SliderWidget>("Z半径滑条", true);
            this.XdelayLabel          = this.Children.Find <LabelWidget>("X半径", true);
            this.YdelayLabel          = this.Children.Find <LabelWidget>("Y半径", true);
            this.ZdelayLabel          = this.Children.Find <LabelWidget>("Z半径", true);
            this.SoildButton          = this.Children.Find <ButtonWidget>("实心", true);
            this.HollowButton         = this.Children.Find <ButtonWidget>("空心", true);
            this.AdvancedButton       = this.Children.Find <ButtonWidget>("高级");
            this.AdvancedGenerate     = this.Children.Find <Widget>("高级生成");
            this.DoublePositionButton = this.Children.Find <ButtonWidget>("2点模式");
        }
Пример #30
0
        public EditCommandBlockDialog(CommandData data)
        {
            XElement node = ContentManager.Get <XElement>("Dialogs/EditCommandBlockDialog");

            WidgetsManager.LoadWidgetContents(this, this, node);
            textBox      = Children.Find <TextBoxWidget>("EditCommandBlockDialog.TextBox");
            list         = Children.Find <ListPanelWidget>("EditCommandBlockDialog.List");
            okButton     = Children.Find <ButtonWidget>("EditCommandBlockDIalog.OkButton");
            cancelButton = Children.Find <ButtonWidget>("EditCommandBlockDIalog.CancelButton");

            commandData          = data;
            command              = data.Command;
            textBox.Text         = command;
            textBox.TextChanged += TextChanged;

            list.ItemClicked += ListSelected;

            engine = GameManager.Project.FindSubsystem <SubsystemCommandEngine>(true);
        }