Exemplo n.º 1
0
    // Gross
    public EnergyTankWidget(WidgetGroup parentGroup, EnergyTankWidgetStyle style, EnergyTankData energyTankData)
        : base(parentGroup, 
            style.Width, 
            style.Height, 
            GameConstants.ConvertRoomPositionToPixelPosition(energyTankData.position).x, 
            GameConstants.ConvertRoomPositionToPixelPosition(energyTankData.position).y)
    {
        m_style= style;

        m_title = new LabelWidget(
            this,
            m_style.LabelWidth,
            m_style.LabelHeight,
            (m_style.Width / 2.0f) - (m_style.LabelWidth / 2.0f), // local x
            m_style.Height, // local y
            "0"); // text
        m_title.Alignment = TextAnchor.UpperCenter;

        // Create the sprite game object
        m_spriteObject =
            GameObject.Instantiate(
                Resources.Load<GameObject>("Gfx/Sprites/Items/EnergyTank/EnergyTank_sprite")) as GameObject;
        m_spriteAnimator = m_spriteObject.GetComponent<Animator>();
        UpdateWorldPosition();

        // Set the initial animation controller parameters
        UpdateState(energyTankData);
    }
Exemplo n.º 2
0
 void InitOther()
 {
     Money_Label = (LabelWidget)widgetsMap["Money_Label"];
     Time_Label  = (LabelWidget)widgetsMap["Time_Label"];
     Wave_Label  = (LabelWidget)widgetsMap["Wave_Label"];
     Box_Label   = (LabelWidget)widgetsMap["Box_Label"];
 }
Exemplo n.º 3
0
 public CylindricalDialog(CreatorAPI creatorAPI) : base(creatorAPI)
 {
     this.Children.Find <LabelWidget>("名称", true).Text = "圆柱";
     this.Children.Find <StackPanelWidget>("Data3", true).IsVisible = true;
     this.ZRadius            = this.Children.Find <SliderWidget>("滑条3", true);
     this.zRadiusLabelWidget = this.Children.Find <LabelWidget>("滑条3数据", true);
 }
Exemplo n.º 4
0
        void ChangedActiveState(Widget widget)
        {
            ButtonWidget button = widget as ButtonWidget;

            if (button != null)
            {
                button.RedrawBackground();
                RedrawWidget(button);
            }

            LabelWidget label = widget as LabelWidget;

            if (label != null && label.DarkenWhenInactive)
            {
                game.ResetArea(label.X, label.Y, label.Width, label.Height);
                RedrawWidget(label);
            }

            BitmapWidget bitmap = widget as BitmapWidget;

            if (bitmap != null)
            {
                RedrawWidget(bitmap);
            }
        }
Exemplo n.º 5
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;
                }));
            }
        }
Exemplo n.º 6
0
    public EnergyTankWidget(WidgetGroup parentGroup, EnergyTankWidgetStyle style, EnergyTankData energyTankData) :
        base(
            parentGroup,
            style.Width,
            style.Height,
            GameConstants.ConvertRoomPositionToPixelPosition(energyTankData.position).x,
            GameConstants.ConvertRoomPositionToPixelPosition(energyTankData.position).y) // Gross
    {
        m_style = style;

        m_title = new LabelWidget(
            this,
            m_style.LabelWidth,
            m_style.LabelHeight,
            (m_style.Width / 2.0f) - (m_style.LabelWidth / 2.0f), // local x
            m_style.Height,                                       // local y
            "0");                                                 // text
        m_title.Alignment = TextAnchor.UpperCenter;

        // Create the sprite game object
        m_spriteObject =
            GameObject.Instantiate(
                Resources.Load <GameObject>("Gfx/Sprites/Items/EnergyTank/EnergyTank_sprite")) as GameObject;
        m_spriteAnimator = m_spriteObject.GetComponent <Animator>();
        UpdateWorldPosition();

        // Set the initial animation controller parameters
        UpdateState(energyTankData);
    }
        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,
                });
            }
        }
Exemplo n.º 8
0
    public GamePanelWidget(WidgetGroup parentGroup, GamePanelStyle gamePanelStyle, float x, float y)
        : base(parentGroup, gamePanelStyle.Width, gamePanelStyle.Height, x, y)
    {
        float statsX = BORDER_WIDTH;
        float statsY = BORDER_WIDTH;

        // Background for the character info
        m_background = new ImageWidget(this, gamePanelStyle.Width, gamePanelStyle.Height, gamePanelStyle.Background, 0, 0);

        // Game name
        m_nameLabel         = new LabelWidget(this, STATS_LABEL_WIDTH, STATS_LABEL_HEIGHT, statsX, statsY, "Name:");
        m_nameLabel.Visible = false;

        m_nameText         = new LabelWidget(this, STATS_LABEL_WIDTH, STATS_LABEL_HEIGHT, statsX + STATS_LABEL_WIDTH, statsY, "");
        m_nameText.Visible = false;

        // Game Owner
        statsY              += STATS_LABEL_HEIGHT;
        m_ownerLabel         = new LabelWidget(this, STATS_LABEL_WIDTH, STATS_LABEL_HEIGHT, statsX, statsY, "Owner:");
        m_ownerLabel.Visible = false;

        m_ownerText         = new LabelWidget(this, STATS_LABEL_WIDTH, STATS_LABEL_HEIGHT, statsX + STATS_LABEL_WIDTH, statsY, "");
        m_ownerText.Visible = false;

        // Characters
        statsY                   += STATS_LABEL_HEIGHT;
        m_charactersLabel         = new LabelWidget(this, STATS_LABEL_WIDTH, STATS_LABEL_HEIGHT, statsX, statsY, "Characters:");
        m_charactersLabel.Visible = false;

        statsY                  += STATS_LABEL_HEIGHT;
        m_charactersText         = new LabelWidget(this, m_background.Width - 2 * BORDER_WIDTH, STATS_LABEL_HEIGHT, statsX, statsY, "");
        m_charactersText.Visible = false;
    }
Exemplo n.º 9
0
        internal void UpdateStatus()
        {
            LabelWidget widget = (LabelWidget)widgets[statusIndex];

            widget.SetDrawData(drawer, statusText);
            widget.SetLocation(Anchor.Centre, Anchor.Centre, 0, 130);
        }
 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);
         }));
     }
 }
Exemplo n.º 11
0
    public GamePanelWidget(WidgetGroup parentGroup, GamePanelStyle gamePanelStyle, float x, float y)
        : base(parentGroup, gamePanelStyle.Width, gamePanelStyle.Height, x, y)
    {
        float statsX = BORDER_WIDTH;
        float statsY = BORDER_WIDTH;

        // Background for the character info
        m_background = new ImageWidget(this, gamePanelStyle.Width, gamePanelStyle.Height, gamePanelStyle.Background, 0, 0);

        // Game name
        m_nameLabel = new LabelWidget(this, STATS_LABEL_WIDTH, STATS_LABEL_HEIGHT, statsX, statsY, "Name:");
        m_nameLabel.Visible = false;

        m_nameText = new LabelWidget(this, STATS_LABEL_WIDTH, STATS_LABEL_HEIGHT, statsX + STATS_LABEL_WIDTH, statsY, "");
        m_nameText.Visible = false;

        // Game Owner
        statsY += STATS_LABEL_HEIGHT;
        m_ownerLabel = new LabelWidget(this, STATS_LABEL_WIDTH, STATS_LABEL_HEIGHT, statsX, statsY, "Owner:");
        m_ownerLabel.Visible = false;

        m_ownerText = new LabelWidget(this, STATS_LABEL_WIDTH, STATS_LABEL_HEIGHT, statsX + STATS_LABEL_WIDTH, statsY, "");
        m_ownerText.Visible = false;

        // Characters
        statsY += STATS_LABEL_HEIGHT;
        m_charactersLabel = new LabelWidget(this, STATS_LABEL_WIDTH, STATS_LABEL_HEIGHT, statsX, statsY, "Characters:");
        m_charactersLabel.Visible = false;

        statsY += STATS_LABEL_HEIGHT;
        m_charactersText = new LabelWidget(this, m_background.Width - 2*BORDER_WIDTH, STATS_LABEL_HEIGHT, statsX, statsY, "");
        m_charactersText.Visible = false;
    }
Exemplo n.º 12
0
        public void UpdateHookForm()
        {
            // update hook form
            if (m_hookForm != null)
            {
                if (m_hookForm.Enabled)
                {
                    m_hookForm.Text         = this.DMS();
                    m_hookGeneralLabel.Text = this.GeneralInfo();
                    m_hookDetailLabel.Text  = this.DetailedInfo();
                    m_hookDescLabel.Text    = this.DescriptionInfo();
                }
                else
                {
                    m_hookForm.Dispose();

                    m_hookTreeNode        = null;
                    m_hookGeneralTreeNode = null;
                    m_hookDetailTreeNode  = null;
                    m_hookDescTreeNode    = null;
                    m_hookGeneralLabel    = null;
                    m_hookDetailLabel     = null;
                    m_hookDescLabel       = null;

                    m_hookForm = null;
                    IsHooked   = false;
                }
            }
        }
Exemplo n.º 13
0
        void SetStatus(string text)
        {
            LabelWidget widget = (LabelWidget)widgets[view.statusIndex];

            game.ResetArea(widget.X, widget.Y, widget.Width, widget.Height);
            widget.SetDrawData(drawer, text);
            RedrawWidget(widget);
        }
Exemplo n.º 14
0
        public static BoxWidget <LabelWidget> FooterLabel(LabelWidget widget)
        {
            var box = Label(widget);

            box.Style.Background = Color.DarkBlue;

            return(box);
        }
Exemplo n.º 15
0
        internal void SetWarning()
        {
            string      text   = gameOpen ? "&cThe game must be closed before updating" : "";
            LabelWidget widget = (LabelWidget)widgets[statusIndex];

            widget.SetDrawData(drawer, text);
            widget.SetLocation(Anchor.Centre, Anchor.Centre, 0, 130);
        }
Exemplo n.º 16
0
 public SpiralDialog(CreatorAPI creatorAPI) : base(creatorAPI)
 {
     this.Children.Find <LabelWidget>("名称", true).Text = "螺旋";
     this.Children.Find <StackPanelWidget>("Data3", true).IsVisible = true;
     this.Number                 = this.Children.Find <SliderWidget>("滑条3", true);
     this.numberLabelWidget      = this.Children.Find <LabelWidget>("滑条3数据", true);
     this.SoildButton.Text       = "确定";
     this.HollowButton.IsVisible = false;
 }
Exemplo n.º 17
0
        public ASCreditsLogic(Widget widget, ModData modData, Action onExit)
        {
            this.modData = modData;

            var panel = widget.Get("CREDITS_PANEL");

            panel.Get <ButtonWidget>("BACK_BUTTON").OnClick = () =>
            {
                Ui.CloseWindow();
                onExit();
            };

            engineLines   = ParseLines(File.OpenRead(Platform.ResolvePath("./AUTHORS")));
            asEngineLines = ParseLines(File.OpenRead(Platform.ResolvePath("./AUTHORS.AS")));

            var tabContainer = panel.Get("TAB_CONTAINER");
            var modTab       = tabContainer.Get <ButtonWidget>("MOD_TAB");

            modTab.IsHighlighted = () => tabState == ASCreditsState.Mod;
            modTab.OnClick       = () => ShowCredits(ASCreditsState.Mod);

            var engineTab = tabContainer.Get <ButtonWidget>("ENGINE_TAB");

            engineTab.IsHighlighted = () => tabState == ASCreditsState.Engine;
            engineTab.OnClick       = () => ShowCredits(ASCreditsState.Engine);

            var asTab = tabContainer.Get <ButtonWidget>("ASENGINE_TAB");

            asTab.IsHighlighted = () => tabState == ASCreditsState.AS;
            asTab.OnClick       = () => ShowCredits(ASCreditsState.AS);

            scrollPanel = panel.Get <ScrollPanelWidget>("CREDITS_DISPLAY");
            template    = scrollPanel.Get <LabelWidget>("CREDITS_TEMPLATE");

            // Make space to show the tabs
            tabContainer.IsVisible     = () => true;
            scrollPanel.Bounds.Y      += tabContainer.Bounds.Height;
            scrollPanel.Bounds.Height -= tabContainer.Bounds.Height;

            var hasModCredits = modData.Manifest.Contains <ModCredits>();

            if (hasModCredits)
            {
                var modCredits = modData.Manifest.Get <ModCredits>();
                modLines       = ParseLines(modData.DefaultFileSystem.Open(modCredits.ModCreditsFile));
                modTab.GetText = () => modCredits.ModTabTitle;
            }

            if (hasModCredits)
            {
                ShowCredits(ASCreditsState.Mod);
            }
            else
            {
                ShowCredits(ASCreditsState.AS);
            }
        }
Exemplo n.º 18
0
        private IWidget AddFieldName(FormContext formContext, BaseField fieldInfo)
        {
            var widgetContext = WidgetContext.BuildContext(formContext, "Name");
            var label         = new LabelWidget(widgetContext);

            label.SetValue(fieldInfo.Text);

            return(label);
        }
Exemplo n.º 19
0
        void SetupWidget(Widget widget, LabelWidget objectiveText, LabelWidget objectiveStatus, Objective objective)
        {
            var font = Game.Renderer.Fonts[objectiveText.Font];
            var text = WidgetUtils.WrapText(objective.Text, objectiveText.Bounds.Width, font);

            widget.Bounds.Height    = objectiveText.Bounds.Height = objectiveStatus.Bounds.Height = font.Measure(text).Y;
            objectiveText.GetText   = () => text;
            objectiveStatus.GetText = () => GetObjectiveStatusText(objective.Status);
        }
Exemplo n.º 20
0
        public D2kDownloadPackagesLogic(Widget widget, Dictionary <string, string> installData, Action afterInstall)
        {
            this.installData = installData;
            //this.afterInstall = afterInstall;

            panel       = widget.Get("INSTALL_DOWNLOAD_PANEL");
            progressBar = panel.Get <ProgressBarWidget>("PROGRESS_BAR");
            statusLabel = panel.Get <LabelWidget>("STATUS_LABEL");

            ShowDownloadDialog();
        }
Exemplo n.º 21
0
        public DownloadPackagesLogic(Widget widget, Action afterInstall, string mirrorListUrl)
        {
            this.mirrorListUrl = mirrorListUrl;
            this.afterInstall  = afterInstall;

            panel       = widget.Get("INSTALL_DOWNLOAD_PANEL");
            progressBar = panel.Get <ProgressBarWidget>("PROGRESS_BAR");
            statusLabel = panel.Get <LabelWidget>("STATUS_LABEL");

            ShowDownloadDialog();
        }
Exemplo n.º 22
0
        Widget MakeLabelWidget(LabelWidget template, object item)
        {
            var itemString = item.ToString();
            var widget     = (LabelWidget)template.Clone();
            var font       = Game.Renderer.Fonts[widget.Font];

            itemString           = WidgetUtils.WrapText(itemString, widget.Bounds.Width, font);
            widget.Bounds.Height = font.Measure(itemString).Y;
            widget.GetText       = () => itemString;
            return(widget);
        }
Exemplo n.º 23
0
        public static BoxWidget <LabelWidget> Label(LabelWidget widget)
        {
            var box = new BoxWidget <LabelWidget>(widget);

            box.Style = new Style()
            {
                Foreground = Color.White,
            };

            return(box);
        }
Exemplo n.º 24
0
        internal void RedrawStatus(string text)
        {
            LabelWidget widget = (LabelWidget)widgets[0];

            using ( drawer ) {
                drawer.SetBitmap(game.Framebuffer);
                drawer.Clear(backCol, widget.X, widget.Y, widget.Width, widget.Height);
                widget.SetDrawData(drawer, text);
                widget.SetLocation(Anchor.Centre, Anchor.Centre, 0, -10);
                widget.Redraw(drawer);
            }
        }
Exemplo n.º 25
0
        public MissionBrowserLogic(Widget widget, Action onStart, Action onExit)
        {
            this.onStart = onStart;

            var missionList = widget.Get <ScrollPanelWidget>("MISSION_LIST");
            var template    = widget.Get <ScrollItemWidget>("MISSION_TEMPLATE");

            widget.Get("MISSION_INFO").IsVisible = () => selectedMapPreview != null;

            var previewWidget = widget.Get <MapPreviewWidget>("MISSION_PREVIEW");

            previewWidget.Preview = () => selectedMapPreview;

            descriptionPanel = widget.Get <ScrollPanelWidget>("MISSION_DESCRIPTION_PANEL");
            description      = widget.Get <LabelWidget>("MISSION_DESCRIPTION");
            descriptionFont  = Game.Renderer.Fonts[description.Font];

            var yaml = new MiniYaml(null, Game.modData.Manifest.Missions.Select(MiniYaml.FromFile).Aggregate(MiniYaml.MergeLiberal)).ToDictionary();

            var missionMapPaths = yaml["Missions"].Nodes.Select(n => Path.GetFullPath(n.Key));

            var maps = Game.modData.MapCache
                       .Where(p => p.Status == MapStatus.Available && missionMapPaths.Contains(Path.GetFullPath(p.Map.Path)))
                       .Select(p => p.Map);

            missionList.RemoveChildren();
            foreach (var m in maps)
            {
                var map = m;

                var item = ScrollItemWidget.Setup(template,
                                                  () => selectedMapPreview != null && selectedMapPreview.Uid == map.Uid,
                                                  () => SelectMap(map),
                                                  StartMission);

                item.Get <LabelWidget>("TITLE").GetText = () => map.Title;
                missionList.AddChild(item);
            }

            if (maps.Any())
            {
                SelectMap(maps.First());
            }

            widget.Get <ButtonWidget>("STARTGAME_BUTTON").OnClick = StartMission;

            widget.Get <ButtonWidget>("BACK_BUTTON").OnClick = () =>
            {
                Game.Disconnect();
                Ui.CloseWindow();
                onExit();
            };
        }
Exemplo n.º 26
0
    public CharacterWidget(WidgetGroup parentGroup, CharacterWidgetStyle style, CharacterData characterData) :
        base(
            parentGroup,
            style.Width,
            style.Height,
            GameConstants.ConvertRoomPositionToPixelPosition(characterData.PositionInRoom).x,
            GameConstants.ConvertRoomPositionToPixelPosition(characterData.PositionInRoom).y) // Gross
    {
        m_style = style;

        m_title =
            new LabelWidget(
                this,
                style.LabelWidth,                                     // width
                style.LabelHeight,                                    // height
                (m_style.Width / 2.0f) - (m_style.LabelWidth / 2.0f), // local x
                -m_style.BoundsHeight - style.LabelHeight,            // local y
                characterData.character_name);                        // text
        m_title.Alignment = TextAnchor.UpperCenter;

        m_energy =
            new LabelWidget(
                this,
                m_style.LabelWidth,                                   // width
                m_style.LabelHeight,                                  // height
                (m_style.Width / 2.0f) - (m_style.LabelWidth / 2.0f), // local x
                0,                                                    // local y
                "");                                                  // text
        m_energy.Alignment = TextAnchor.UpperCenter;
        this.Energy        = characterData.energy;

        // Create the sprite game object
        {
            // TODO: Add this back in once we have sprites for each class
            //string archetype = GameConstants.GetArchetypeString(characterData.archetype);
            string archetype      = "Warrior";
            string gameObjectPath = "Gfx/Sprites/Players/" + archetype + "/" + archetype + "_sprite";

            m_spriteObject =
                GameObject.Instantiate(
                    Resources.Load <GameObject>(gameObjectPath)) as GameObject;
            m_spriteAnimator = m_spriteObject.GetComponent <Animator>();

            UpdateWorldPosition();
        }

        // Set the initial animation controller parameters
        m_spriteAnimator.SetFloat(SPEED_FLOAT_PARAMETER, 0.0f);
        m_spriteAnimator.SetFloat(FACING_X_FLOAT_PARAMETER, 0.0f);
        m_spriteAnimator.SetFloat(FACING_Y_FLOAT_PARAMETER, -1.0f);
        m_spriteAnimator.SetBool(IS_ATTACKING_BOOL_PARAMETER, false);
    }
Exemplo n.º 27
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;
        }
Exemplo n.º 28
0
        public void InsertWidget(int insertRow, LayoutWidgetType widgetType)
        {
            AbstractWidget widgetModel = null;

            switch (widgetType)
            {
            case LayoutWidgetType.Label:
                widgetModel = new LabelWidget {
                    Id = Guid.NewGuid()
                };
                break;

            case LayoutWidgetType.Text:
                widgetModel = new TextWidget {
                    Id = Guid.NewGuid()
                };
                break;

            case LayoutWidgetType.Container:
                widgetModel = new ContainerWidget {
                    Id = Guid.NewGuid(), Items = new List <ContainerItem>()
                };
                break;

            default:
                throw new ArgumentException($"InsertWidget for widget {widgetType} not implemented");
            }

            if (insertRow == -1)
            {
                _model.Items.Add(new ContainerItem
                {
                    Row    = _model.Items.Count + 1,
                    Widget = widgetModel
                });
            }
            else
            {
                foreach (var item in _model.Items.Where(o => o.Row >= insertRow))
                {
                    item.Row = item.Row + 1;
                }
                _model.Items.Insert(insertRow, new ContainerItem
                {
                    Row    = insertRow,
                    Widget = widgetModel
                });
            }

            UpdateViewModels();
        }
Exemplo n.º 29
0
		protected LabelWidget(LabelWidget other)
			: base(other)
		{
			Text = other.Text;
			Align = other.Align;
			Font = other.Font;
			TextColor = other.TextColor;
			Contrast = other.Contrast;
			ContrastColor = other.ContrastColor;
			WordWrap = other.WordWrap;
			GetText = other.GetText;
			GetColor = other.GetColor;
			GetContrastColor = other.GetContrastColor;
		}
Exemplo n.º 30
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;
        }
Exemplo n.º 31
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>("取消");
        }
Exemplo n.º 32
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();
        }
Exemplo n.º 33
0
        void IWorldLoaded.WorldLoaded(World w, OpenRA.Graphics.WorldRenderer wr)
        {
            mapOptions = w.WorldActor.Trait <MapOptions>();
            if (string.IsNullOrWhiteSpace(info.CountdownLabel) || string.IsNullOrWhiteSpace(info.CountdownText))
            {
                return;
            }

            countdownLabel = Ui.Root.GetOrNull <LabelWidget>(info.CountdownLabel);
            if (countdownLabel != null)
            {
                countdown = new CachedTransform <int, string>(t =>
                                                              info.CountdownText.F(WidgetUtils.FormatTime(t, true, w.IsReplay ? mapOptions.GameSpeed.Timestep : w.Timestep)));
                countdownLabel.GetText = () => countdown.Update(ticksRemaining);
            }
        }
Exemplo n.º 34
0
    public void Start()
    {
        _pathStatusLabel = new LabelWidget(null, 150, 100, 0.0f, 0.0f, "");
        _pathStatusLabel.Visible = false;

        _visibilityStatusLabel = new LabelWidget(null, 150, 100, 0.0f, 0.0f, "");
        _visibilityStatusLabel.Visible = false;

        _widgetLabel = new LabelWidget(null, 150, 20, 0.0f, 0.0f, "");
        _widgetLabel.Color = Color.red;
        _widgetLabel.Visible = false;

        _positionLabel = new LabelWidget(null, 150, 300, 100, 0, "");
        _positionLabel.Color = Color.red;
        _positionLabel.Visible = false;
    }
Exemplo n.º 35
0
 protected LabelWidget(LabelWidget other)
     : base(other)
 {
     Text = other.Text;
     Align = other.Align;
     Font = other.Font;
     TextColor = other.TextColor;
     Contrast = other.Contrast;
     ContrastColorDark = other.ContrastColorDark;
     ContrastColorLight = other.ContrastColorLight;
     Shadow = other.Shadow;
     WordWrap = other.WordWrap;
     GetText = other.GetText;
     GetColor = other.GetColor;
     GetContrastColorDark = other.GetContrastColorDark;
     GetContrastColorLight = other.GetContrastColorLight;
 }
Exemplo n.º 36
0
    public GameThumbnailWidget(WidgetGroup parentGroup, GameThumbnailStyle style, GameResponseEntry gameInfo, float x, float y)
        : base(parentGroup, style.Width, style.Height, x, y)
    {
        new ImageWidget(this, style.Width, style.Height, style.Background, 0.0f, 0.0f);

        LabelWidget gameNameLabel =
            new LabelWidget(
                this,
                40, style.LabelHeight,
                BORDER_WIDTH, BORDER_WIDTH,
                "Game:");
        gameNameLabel.Alignment = TextAnchor.UpperRight;

        LabelWidget gameOwnerLabel =
            new LabelWidget(
                this,
                40, style.LabelHeight,
                BORDER_WIDTH, gameNameLabel.LocalY + gameNameLabel.Height,
                "Owner:");
        gameOwnerLabel.Alignment = TextAnchor.UpperRight;

        {
            float textWidth = style.Width - gameNameLabel.Width - 2 * BORDER_WIDTH;
            float textX = BORDER_WIDTH + gameNameLabel.Width;

            LabelWidget gameNameText =
                new LabelWidget(
                    this,
                    textWidth, style.LabelHeight,
                    textX, BORDER_WIDTH,
                    gameInfo.game_name);
            gameNameText.Alignment = TextAnchor.UpperLeft;

            LabelWidget gameOwnerText =
                new LabelWidget(
                    this,
                    textWidth, style.LabelHeight,
                    textX, gameNameText.LocalY + gameNameText.Height,
                    gameInfo.owner_account_name);
            gameOwnerText.Alignment = TextAnchor.UpperLeft;
        }

        this.Visible = false;
    }
    public CharacterThumbnailWidget(
        WidgetGroup parentGroup, 
        CharacterThumbnailStyle style, 
        CharacterData characterData)
        : base(parentGroup, style.BackgroundWidth, style.BackgroundHeight, 0, 0)
    {
        new ImageWidget(this, style.BackgroundWidth, style.BackgroundHeight, style.Background, 0.0f, 0.0f);

        // Background for the character info
        string portraitResource = ClientGameConstants.GetResourceNameForPicture((uint)characterData.picture_id);
        ImageWidget portrait=
            new ImageWidget(
                this,
                style.PortraitWidth, style.PortraitHeight,
                Resources.Load<Texture>(portraitResource),
                5, 5);

        // Character name
        LabelWidget nameLabel=
            new LabelWidget(
                this,
                style.LabelWidth, style.LabelHeight,
                portrait.LocalX + portrait.Width + 3, 0,
                characterData.character_name);

        // Character info
        string archetype = GameConstants.GetArchetypeString(ClientGameConstants.GetArchetypeForPicture((uint)characterData.picture_id));
        string infoString = "Lvl " + characterData.power_level.ToString() + " " + archetype;
        new LabelWidget(
            this,
            style.LabelWidth, style.LabelHeight,
            portrait.LocalX + portrait.Width + 3,
            nameLabel.LocalY + nameLabel.Height,
            infoString);

        this.Visible = false;
    }
Exemplo n.º 38
0
        void LayoutDialog(Widget bg)
        {
            bg.Children.RemoveAll(w => controls.Contains(w));
            controls.Clear();

            var y = 50;
            var margin = 20;
            var labelWidth = (bg.Bounds.Width - 3 * margin) / 3;

            var ts = new LabelWidget
            {
                Bold = true,
                Bounds = new Rectangle(margin + labelWidth + 10, y, labelWidth, 25),
                Text = "Their Stance",
                Align = LabelWidget.TextAlign.Left,
            };

            bg.AddChild(ts);
            controls.Add(ts);

            var ms = new LabelWidget
            {
                Bold = true,
                Bounds = new Rectangle(margin + 2 * labelWidth + 20, y, labelWidth, 25),
                Text = "My Stance",
                Align = LabelWidget.TextAlign.Left,
            };

            bg.AddChild(ms);
            controls.Add(ms);

            y += 35;

            foreach (var p in world.players.Values.Where(a => a != world.LocalPlayer && !a.NonCombatant))
            {
                var pp = p;
                var label = new LabelWidget
                {
                    Bounds = new Rectangle(margin, y, labelWidth, 25),
                    Id = "DIPLOMACY_PLAYER_LABEL_{0}".F(p.Index),
                    Text = p.PlayerName,
                    Align = LabelWidget.TextAlign.Left,
                    Bold = true,
                };

                bg.AddChild(label);
                controls.Add(label);

                var theirStance = new LabelWidget
                {
                    Bounds = new Rectangle( margin + labelWidth + 10, y, labelWidth, 25),
                    Id = "DIPLOMACY_PLAYER_LABEL_THEIR_{0}".F(p.Index),
                    Text = p.PlayerName,
                    Align = LabelWidget.TextAlign.Left,
                    Bold = false,

                    GetText = () => pp.Stances[ world.LocalPlayer ].ToString(),
                };

                bg.AddChild(theirStance);
                controls.Add(theirStance);

                var myStance = new ButtonWidget
                {
                    Bounds = new Rectangle( margin + 2 * labelWidth + 20,  y, labelWidth, 25),
                    Id = "DIPLOMACY_PLAYER_LABEL_MY_{0}".F(p.Index),
                    Text = world.LocalPlayer.Stances[ pp ].ToString(),
                };

                myStance.OnMouseUp = mi => { CycleStance(pp, myStance); return true; };

                bg.AddChild(myStance);
                controls.Add(myStance);

                y += 35;
            }
        }
Exemplo n.º 39
0
    public void Start()
    {
        bool isLocalServerRunning= AsyncRPGServer.GetInstance().IsServerActive();
        Screen.showCursor = true;

        // Create the root widget group
        m_rootWidgetGroup = new WidgetGroup(null, Screen.width, Screen.height, 0.0f, 0.0f);
        m_rootWidgetGroup.SetWidgetEventListener(this);

        m_widgetEventDispatcher = new WidgetEventDispatcher();
        m_widgetEventDispatcher.Start(m_rootWidgetGroup);

        // Create the widget group to hold the login panel
        m_loginPanelWidgetGroup =
            new WidgetGroup(
                m_rootWidgetGroup,
                loginPanelStyle.gamePanelStyle.Width, loginPanelStyle.gamePanelStyle.Height,
                Screen.width / 2 - loginPanelStyle.gamePanelStyle.Width / 2,
                Screen.height / 2 - loginPanelStyle.gamePanelStyle.Height / 2);

        // Background for the game info
        new ImageWidget(
            m_loginPanelWidgetGroup,
            loginPanelStyle.gamePanelStyle.Width,
            loginPanelStyle.gamePanelStyle.Height,
            loginPanelStyle.gamePanelStyle.Background,
            0.0f, 0.0f);

        // Username and Password - Left Aligned
        {
            WidgetLayoutCursor cursor = new WidgetLayoutCursor(
                loginPanelStyle.gamePanelStyle.BorderWidth
                + loginPanelStyle.gamePanelStyle.WidgetSpacing,
                loginPanelStyle.gamePanelStyle.BorderWidth
                + loginPanelStyle.gamePanelStyle.WidgetSpacing);
            cursor.Kerning= loginPanelStyle.gamePanelStyle.WidgetSpacing;
            cursor.Leading= loginPanelStyle.gamePanelStyle.WidgetSpacing;

            // Server
            cursor.Advance(
                new LabelWidget(
                    m_loginPanelWidgetGroup,
                    loginPanelStyle.labelStyle,
                    cursor.X, cursor.Y,
                    "Server:"));
            m_serverText =
                cursor.Advance(
                    new TextEntryWidget(
                        m_loginPanelWidgetGroup,
                        loginPanelStyle.textEntryStyle,
                        cursor.X, cursor.Y,
                        "localhost"));
            m_serverText.Visible= !isLocalServerRunning;
            m_localHostLabel=
                new LabelWidget(
                    m_loginPanelWidgetGroup,
                    m_serverText.Width, m_serverText.Height,
                    m_serverText.LocalX, m_serverText.LocalY,
                    "localhost");
            m_localHostLabel.Visible= isLocalServerRunning;
            cursor.NewLine();

            // Local hosted check box
            cursor.Advance(
                new LabelWidget(
                m_loginPanelWidgetGroup,
                loginPanelStyle.labelStyle,
                cursor.X, cursor.Y,
                "Host Server:"));
            m_localHostCheckBox=
                cursor.Advance(
                    new CheckBoxWidget(
                        m_loginPanelWidgetGroup,
                        loginPanelStyle.checkBoxStyle,
                        cursor.X, cursor.Y));
            m_localHostCheckBox.Enabled = isLocalServerRunning;
            cursor.NewLine();

            // Username
            cursor.Advance(
                new LabelWidget(
                    m_loginPanelWidgetGroup,
                    loginPanelStyle.labelStyle,
                    cursor.X, cursor.Y,
                    "Username:"******"test" : ""));
            cursor.NewLine();

            // Password
            cursor.Advance(
                new LabelWidget(
                    m_loginPanelWidgetGroup,
                    loginPanelStyle.labelStyle,
                    cursor.X, cursor.Y,
                    "Password:"******"password" : ""));
            m_passwordText.IsPassword= true;
            cursor.NewLine();
        }

        // Buttons - Centered along the bottom
        {
            WidgetLayoutCursor cursor = new WidgetLayoutCursor(
                loginPanelStyle.gamePanelStyle.Width/2
                - loginPanelStyle.gamePanelStyle.WidgetSpacing/2
                - loginPanelStyle.buttonStyle.Width,
                loginPanelStyle.gamePanelStyle.Height
                - loginPanelStyle.buttonStyle.Height
                - loginPanelStyle.labelStyle.Height
                - loginPanelStyle.gamePanelStyle.BorderWidth
                - loginPanelStyle.gamePanelStyle.WidgetSpacing);

            m_createAccountButton =
                cursor.Advance(
                    new ButtonWidget(
                        m_loginPanelWidgetGroup,
                        loginPanelStyle.buttonStyle,
                        cursor.X, cursor.Y,
                        "New Account"));
            m_createAccountButton.Visible= false;

            m_loginButton =
                cursor.Advance(
                    new ButtonWidget(
                        m_loginPanelWidgetGroup,
                        loginPanelStyle.buttonStyle,
                        cursor.X, cursor.Y,
                        "Login"));
            m_loginButton.Visible= true;

            cursor.NewLine();

            m_loginStatusLabel=
                cursor.Advance(
                    new LabelWidget(
                    m_loginPanelWidgetGroup,
                    loginPanelStyle.gamePanelStyle.Width
                    - 2.0f*loginPanelStyle.gamePanelStyle.BorderWidth,
                    loginPanelStyle.labelStyle.Height,
                    cursor.X, cursor.Y,
                    ""));
        }

        // Server Status Panel
        m_serverPanelWidgetGroup =
            new WidgetGroup(
                m_rootWidgetGroup,
                loginPanelStyle.gamePanelStyle.Width, loginPanelStyle.gamePanelStyle.Height,
                Screen.width / 2 - loginPanelStyle.gamePanelStyle.Width / 2,
                Screen.height / 2 - loginPanelStyle.gamePanelStyle.Height / 2);
        m_serverPanelWidgetGroup.Visible= false;

        // Background for the game info
        new ImageWidget(
            m_serverPanelWidgetGroup,
            loginPanelStyle.gamePanelStyle.Width,
            loginPanelStyle.gamePanelStyle.Height,
            loginPanelStyle.gamePanelStyle.Background,
            0.0f, 0.0f);

        {
            float contentCenter= loginPanelStyle.gamePanelStyle.Width / 2.0f;
            WidgetLayoutCursor cursor = new WidgetLayoutCursor(
                0.0f,
                loginPanelStyle.gamePanelStyle.BorderWidth
                + loginPanelStyle.gamePanelStyle.WidgetSpacing);
            cursor.Kerning= loginPanelStyle.gamePanelStyle.WidgetSpacing;
            cursor.Leading= loginPanelStyle.gamePanelStyle.WidgetSpacing;

            LabelWidget topLabel=
                cursor.Advance(
                    new LabelWidget(
                        m_serverPanelWidgetGroup,
                        loginPanelStyle.labelStyle,
                        contentCenter - loginPanelStyle.labelStyle.Width / 2.0f, cursor.Y,
                        "[Server]"));
            topLabel.Alignment= TextAnchor.UpperCenter;
            cursor.NewLine();

            m_serverStatusText=
                cursor.Advance(
                    new ScrollTextWidget(
                    m_serverPanelWidgetGroup,
                    loginPanelStyle.scrollTextStyle,
                    contentCenter - loginPanelStyle.scrollTextStyle.Width / 2.0f, cursor.Y,
                    ""));
            cursor.NewLine();

            m_serverOkButton=
                cursor.Advance(
                    new ButtonWidget(
                    m_serverPanelWidgetGroup,
                    loginPanelStyle.buttonStyle,
                    contentCenter - loginPanelStyle.buttonStyle.Width / 2.0f, cursor.Y,
                    "Ok"));
            m_serverOkButton.Visible= false;
        }
    }
Exemplo n.º 40
0
    public void Start()
    {
        SessionData sessionData = SessionData.GetInstance();

        // Create the root widget group
        m_rootWidgetGroup = new WidgetGroup(null, gamePanelStyle.Width, gamePanelStyle.Height, 0.0f, 0.0f);
        m_rootWidgetGroup.SetWidgetEventListener(this);

        // Background for the game info
        ImageWidget gamePanel =
            new ImageWidget(
                m_rootWidgetGroup,
                gamePanelStyle.Width,
                gamePanelStyle.Height,
                gamePanelStyle.Background,
                0.0f, 0.0f);

        float statsLabelWidth = (gamePanel.Width - 2 * BORDER_WIDTH) / 2 - 3;
        float statsX = 10;
        float statsY = 10;

        // Owner Name
        LabelWidget ownerNameLabel =
            new LabelWidget(m_rootWidgetGroup, statsLabelWidth, STATS_LABEL_HEIGHT, statsX, statsY, "Owner Name:");
        ownerNameLabel.Alignment = TextAnchor.UpperRight;
        m_ownerNameLabel =
            new LabelWidget(
                m_rootWidgetGroup, statsLabelWidth, STATS_LABEL_HEIGHT,
                statsX + statsLabelWidth, statsY, sessionData.UserName);
        m_ownerNameLabel.Text = "";

        // Game name
        statsY += STATS_LABEL_HEIGHT;
        LabelWidget gameNameLabel =
            new LabelWidget(m_rootWidgetGroup, statsLabelWidth, STATS_LABEL_HEIGHT, statsX, statsY, "Game Name:");
        gameNameLabel.Alignment = TextAnchor.UpperRight;
        m_gameNameTextField = new TextEntryWidget(m_rootWidgetGroup,
            statsLabelWidth, STATS_LABEL_HEIGHT, statsX+statsLabelWidth, statsY, "");

        // IRC Server
        statsY += STATS_LABEL_HEIGHT;
        LabelWidget IRCServerLabel =
            new LabelWidget(m_rootWidgetGroup, statsLabelWidth, STATS_LABEL_HEIGHT, statsX, statsY, "IRC Server:");
        IRCServerLabel.Alignment = TextAnchor.UpperRight;
        m_IRCServerTextField = new TextEntryWidget(m_rootWidgetGroup,
            statsLabelWidth, STATS_LABEL_HEIGHT, statsX+statsLabelWidth, statsY, "");
        m_IRCServerTextField.Text = ServerConstants.DEFAULT_IRC_SERVER;

        // IRC Port
        statsY += STATS_LABEL_HEIGHT;
        LabelWidget IRCPortLabel =
            new LabelWidget(m_rootWidgetGroup, statsLabelWidth, STATS_LABEL_HEIGHT, statsX, statsY, "IRC Port:");
        IRCPortLabel.Alignment = TextAnchor.UpperRight;
        m_IRCPortTextField = new TextEntryWidget(m_rootWidgetGroup,
            statsLabelWidth, STATS_LABEL_HEIGHT, statsX + statsLabelWidth, statsY, "");
        m_IRCPortTextField.Restrict = @"[^0-9]";
        m_IRCPortTextField.MaxLength = 6;
        m_IRCPortTextField.Text = ServerConstants.DEFAULT_IRC_PORT.ToString();

        // IRC Enabled
        statsY += STATS_LABEL_HEIGHT;
        LabelWidget IRCEnabledLabel =
            new LabelWidget(m_rootWidgetGroup, statsLabelWidth, STATS_LABEL_HEIGHT, statsX, statsY, "IRC Enabled:");
        IRCEnabledLabel.Alignment = TextAnchor.UpperRight;
        m_IRCEnabledToggle = new CheckBoxWidget(m_rootWidgetGroup, chekBoxStyle, statsX + statsLabelWidth, statsY);
        m_IRCEnabledToggle.Enabled = true;

        // IRC Encryption Enabled
        statsY += STATS_LABEL_HEIGHT;
        LabelWidget IRCEncryptionEnabledLabel =
            new LabelWidget(m_rootWidgetGroup, statsLabelWidth, STATS_LABEL_HEIGHT, statsX, statsY, "IRC Encryption Enabled:");
        IRCEncryptionEnabledLabel.Alignment = TextAnchor.UpperRight;
        m_IRCEncryptionEnabledToggle = new CheckBoxWidget(m_rootWidgetGroup, chekBoxStyle, statsX + statsLabelWidth, statsY);
        m_IRCEncryptionEnabledToggle.Enabled = true;

        // Creation status
        m_statusLabel = new LabelWidget(m_rootWidgetGroup, gamePanel.Width, STATS_LABEL_HEIGHT, 0.0f, 0.0f, "");
        m_statusLabel.SetLocalPosition(0, gamePanel.Height - m_statusLabel.Height - BORDER_WIDTH);
        m_statusLabel.Alignment = TextAnchor.UpperCenter;

        // Create button
        m_createButton = new ButtonWidget(m_rootWidgetGroup, buttonStyle, 0, 0, "Create");
        m_createButton.SetLocalPosition(gamePanel.Width/3 - m_createButton.Width/2, m_statusLabel.LocalY - m_createButton.Height - 5);

        // Cancel button
        m_cancelButton = new ButtonWidget(m_rootWidgetGroup, buttonStyle, 0, 0, "Cancel");
        m_cancelButton.SetLocalPosition((2*gamePanel.Width)/3 - m_cancelButton.Width/2, m_statusLabel.LocalY - m_cancelButton.Height - 5);

        // Center the group info widgets
        m_rootWidgetGroup.SetLocalPosition(Screen.width / 2 - gamePanel.Width / 2, Screen.height / 2 - gamePanel.Height / 2);
    }
Exemplo n.º 41
0
 public void SetReadout(String labelString, String valueString)
 {
     ReadoutValues[labelString] = valueString;
     LabelWidgets[labelString] = new LabelWidget(labelString);
     LabelWidgets[labelString].SetValue(valueString);
 }
Exemplo n.º 42
0
    public void Start()
    {
        // Create the root widget group
        m_rootWidgetGroup =
            new WidgetGroup(
                null,
                panelWidth, panelHeight,
                Screen.width/2 - panelWidth/2, Screen.height/2 - panelHeight/2);
        m_rootWidgetGroup.SetWidgetEventListener(this);

        // Background for the game info
        new ImageWidget(m_rootWidgetGroup, panelWidth, panelHeight, panelTexture, 0.0f, 0.0f);

        // Character portraits
        m_portraits = new List<ImageWidget>();
        for (int portraitIndex = 0; portraitIndex < ClientGameConstants.GetPortraitCount(); portraitIndex++ )
        {
            ImageWidget portrait = new ImageWidget(
                m_rootWidgetGroup,
                portraitWidth, portraitHeight,
                Resources.Load<Texture>(ClientGameConstants.GetResourceNameForPicture((uint)portraitIndex)),
                PORTRAIT_X, PORTRAIT_Y);

            portrait.Visible = false;
            m_portraits.Add(portrait);
        }

        float statsX = PORTRAIT_X + portraitWidth + BORDER_WIDTH;
        float statsY = PORTRAIT_Y;

        // Character Name
        new LabelWidget(m_rootWidgetGroup, labelWidth, labelHeight, statsX, statsY, "Name:");
        m_nameTextField =
            new TextEntryWidget(m_rootWidgetGroup, labelWidth, labelHeight, statsX + labelWidth, statsY, "");
        m_nameTextField.Restrict = @"[^0-9A-Za-z]";
        m_nameTextField.MaxLength = 12;

        // Character Gender
        statsY += labelHeight;
        new LabelWidget(m_rootWidgetGroup, labelWidth, labelHeight, statsX, statsY, "Gender:");
        m_genderLabel = new LabelWidget(m_rootWidgetGroup, labelWidth, labelHeight, statsX+labelWidth, statsY, "");

        // Character Archetype
        statsY += labelHeight;
        new LabelWidget(m_rootWidgetGroup, labelWidth, labelHeight, statsX, statsY, "Archetype:");
        m_archetypeLabel = new LabelWidget(m_rootWidgetGroup, labelWidth, labelHeight, statsX + labelWidth, statsY, "");

        // Creation Status Label
        m_statusLabel = new LabelWidget(m_rootWidgetGroup, panelWidth, panelHeight, 0, panelHeight - labelHeight, "");
        m_statusLabel.Alignment = TextAnchor.UpperCenter;

        // Create Button
        m_createButton =
            new ButtonWidget(
                m_rootWidgetGroup,
                buttonStyle,
                panelWidth / 3 - buttonStyle.Width / 2, m_statusLabel.LocalY - buttonStyle.Height - 5,
                "Create");

        // Cancel Button
        m_cancelButton =
            new ButtonWidget(
                m_rootWidgetGroup,
                buttonStyle,
                (2*panelWidth) / 3 - buttonStyle.Width / 2, m_statusLabel.LocalY - buttonStyle.Height - 5,
                "Cancel");

        // Previous Portrait Button
        m_previousPortraitButton=
            new ButtonWidget(
                m_rootWidgetGroup,
                buttonStyle,
                m_createButton.LocalX, m_createButton.LocalY - buttonStyle.Height - 5,
                "<");

        // Next Portrait Button
        m_nextPortraitButton =
            new ButtonWidget(
                m_rootWidgetGroup,
                buttonStyle,
                m_cancelButton.LocalX, m_cancelButton.LocalY - buttonStyle.Height - 5,
                ">");
    }
Exemplo n.º 43
0
    // Gross
    public MobWidget(WidgetGroup parentGroup, MobWidgetStyle style, MobData mobData)
        : base(parentGroup,
            style.Width,
            style.Height,
            GameConstants.ConvertRoomPositionToPixelPosition(mobData.PositionInRoom).x,
            GameConstants.ConvertRoomPositionToPixelPosition(mobData.PositionInRoom).y)
    {
        MobType mobType = MobTypeManager.GetMobTypeByName(mobData.mob_type_name);

        m_style = style;

        m_title =
            new LabelWidget(
                this,
                style.LabelWidth, // width
                style.LabelHeight, // height
                (m_style.Width / 2.0f) - (m_style.LabelWidth / 2.0f), // local x
                -m_style.BoundsHeight - style.LabelHeight, // local y
                mobType.Label); // text
        m_title.Alignment = TextAnchor.UpperCenter;

        m_energy =
            new LabelWidget(
                this,
                style.LabelWidth, // width
                style.LabelHeight, // height
                (m_style.Width / 2.0f) - (m_style.LabelWidth / 2.0f), // local x
                0, // local y
                ""); // text
        m_energy.Alignment = TextAnchor.UpperCenter;
        this.Energy = mobData.energy;

        // Create the sprite game object
        {
            string archetype = mobType.Name;
            string gameObjectPath = "Gfx/Sprites/Enemies/" + archetype + "/" + archetype + "_sprite";

            m_spriteObject =
                GameObject.Instantiate(
                    Resources.Load<GameObject>(gameObjectPath)) as GameObject;
            m_spriteAnimator = m_spriteObject.GetComponent<Animator>();

            UpdateWorldPosition();
        }

        // Create the dialog label
        m_dialog =
            new LabelWidget(
                this,
                style.DialogWidth, // width
                style.DialogHeight, // height
                (m_style.Width / 2.0f) - (m_style.DialogWidth / 2.0f), // local x
                m_title.LocalY - style.DialogHeight, // local y
                ""); // text
        m_dialog.FontSize = 14;
        m_dialog.Color = Color.red;
        m_dialog.Alignment = TextAnchor.UpperCenter;
        m_dialog.Visible = false;

        // Set the initial animation controller parameters
        m_spriteAnimator.SetFloat(SPEED_FLOAT_PARAMETER, 0.0f);
        m_spriteAnimator.SetFloat(FACING_X_FLOAT_PARAMETER, 0.0f);
        m_spriteAnimator.SetFloat(FACING_Y_FLOAT_PARAMETER, -1.0f);
        m_spriteAnimator.SetBool(IS_ATTACKING_BOOL_PARAMETER, false);

        // Create the vision cone
        m_visionCone =
            new VisionConeWidget(
                this,
                mobType.Name + mobData.mob_id.ToString(),
                mobType.VisionConeDistance,
                mobType.VisionConeAngleDegrees,
                0.0f,
                0.0f,
                0.0f);
        m_visionCone.ConeFacing = MathConstants.GetAngleForDirection(MathConstants.eDirection.down);
    }