public ScrollListWidget( WidgetGroup parentGroup, WidgetFactory widgetFactory, ScrollListStyle style, float x, float y) : base(parentGroup, style.Width, style.Height, x, y) { m_widgetFactory = widgetFactory; m_widgetList = new List<IWidget>(); m_scrollIndex = 0; m_scrollFrame = new ImageWidget(this, style.Width, style.Height, style.Background, 0.0f, 0.0f); m_scrollUpButton = new ButtonWidget(this, style.ButtonStyle, 0, 0, "Previous"); m_scrollUpButton.SetLocalPosition( m_scrollFrame.Width / 2 - m_scrollUpButton.Width / 2, BORDER_WIDTH); m_scrollUpButton.Visible = false; m_scrollDownButton = new ButtonWidget(this, style.ButtonStyle, 0, 0, "Next"); m_scrollDownButton.SetLocalPosition( m_scrollUpButton.LocalX, m_scrollFrame.Height - m_scrollDownButton.Height - BORDER_WIDTH); m_scrollDownButton.Visible = false; }
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 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; }
public override bool Load() { dataBook = (DataBook)GetDataBook(mainWindow); // create the finder object ProgressDialog findProgressDialog = new ProgressDialog("", mainWindow); finder = new DataBookFinder(dataBook, findProgressDialog.Update); finder.Strategy = new BMFindStrategy(); finder.FirstFind += OnFirstFind; // create the FindReplaceWidget (hidden) widget = new FindReplaceWidget(dataBook, finder); widget.Visible = false; WidgetGroup wgroup = (WidgetGroup)GetWidgetGroup(mainWindow, 0); wgroup.Add(widget); // add the menu items AddActions(uiManager); dataBook.PageAdded += new DataView.DataViewEventHandler(OnDataViewAdded); dataBook.PageRemoved += new DataView.DataViewEventHandler(OnDataViewRemoved); dataBook.SwitchPage += new SwitchPageHandler(OnSwitchPage); loaded = true; return(true); }
public void Start(WidgetGroup parentGroup) { _rootWidgetGroup = new WidgetGroup(parentGroup, 0, 0, 0.0f, 0.0f); _rootWidgetGroup.SetWidgetEventListener(this); _window = new WindowWidget( _rootWidgetGroup, "Chat", m_chatWindowStyle.windowStyle, Screen.width - m_chatWindowStyle.windowStyle.WindowWidth - 3, 0); _chatText = new ScrollTextWidget( _window, m_chatWindowStyle.windowStyle.WindowWidth, m_chatWindowStyle.windowStyle.WindowHeight - m_chatWindowStyle.chatInputHeight - m_chatWindowStyle.windowStyle.TitleBarHeight, 0.0f, 0.0f, ""); _chatText.FontSize = 12; _chatInput = new TextEntryWidget( _window, m_chatWindowStyle.windowStyle.WindowWidth, m_chatWindowStyle.chatInputHeight, 0, m_chatWindowStyle.windowStyle.WindowHeight - m_chatWindowStyle.chatInputHeight, ""); _chatText.FontSize = 12; _chatInput.MaxLength = (int)IRCSession.MAX_CHAT_STRING_LENGTH; SetChatInputVisible(true); }
// 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); }
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; }
public void Start(WidgetGroup parentGroup) { m_rootWidgetGroup = new WidgetGroup(parentGroup, Screen.width, Screen.height, 0.0f, 0.0f); m_rootWidgetGroup.SetWidgetEventListener(this); m_mouseCursorState = eMouseCursorState.defaultCursor; }
public ScrollListWidget( WidgetGroup parentGroup, WidgetFactory widgetFactory, ScrollListStyle style, float x, float y) : base(parentGroup, style.Width, style.Height, x, y) { m_widgetFactory = widgetFactory; m_widgetList = new List <IWidget>(); m_scrollIndex = 0; m_scrollFrame = new ImageWidget(this, style.Width, style.Height, style.Background, 0.0f, 0.0f); m_scrollUpButton = new ButtonWidget(this, style.ButtonStyle, 0, 0, "Previous"); m_scrollUpButton.SetLocalPosition( m_scrollFrame.Width / 2 - m_scrollUpButton.Width / 2, BORDER_WIDTH); m_scrollUpButton.Visible = false; m_scrollDownButton = new ButtonWidget(this, style.ButtonStyle, 0, 0, "Next"); m_scrollDownButton.SetLocalPosition( m_scrollUpButton.LocalX, m_scrollFrame.Height - m_scrollDownButton.Height - BORDER_WIDTH); m_scrollDownButton.Visible = false; }
public LabelWidget(WidgetGroup parentGroup, float width, float height, float x, float y, string text) : base(parentGroup, width, height, x, y) { Text = text; FontSize = 12; Alignment = TextAnchor.UpperLeft; Color = new Color(1.0f, 1.0f, 1.0f, 1.0f); }
public LabelWidget(WidgetGroup parentGroup, LabelStyle style, float x, float y, string text) : base(parentGroup, style.Width, style.Height, x, y) { Text = text; FontSize = style.FontSize; Alignment = style.Alignment; Color = new Color(1.0f, 1.0f, 1.0f, 1.0f); }
public WidgetEventDispatcher() { m_mousePosition = new Point2d(); m_rootWidgetGroup = null; m_mouseOverIWidget = null; m_mouseDownIWidget = null; m_mouseIsDragging = false; m_mouseWasDown = false; }
public TileGridWidget(WidgetGroup parentGroup, string name, float width, float height, float depth, float x, float y) : base(parentGroup, width, height, x, y) { Name = name; TileRows = 0; TileColomns = 0; TilePixelWidth = 0; TilePixelHeight = 0; TileSet = ""; Depth = depth; }
public VisionConeWidget(WidgetGroup parentGroup, string name, float range, float coneAngle, float x, float y, float z) : base(parentGroup, 0, 0, x, y) { Name = name; Range = range; ConeAngle = coneAngle; Depth = z; CreateMesh(); UpdateWorldPosition(); }
public HotspotWidget( WidgetGroup parentGroup, string name, float width, float height, float x, float y, object userdata) : base(parentGroup, width, height, x, y) { Name = name; Userdata = userdata; }
/// <inheritdoc /> /// <summary> /// Update dashboard /// </summary> /// <param name="model"></param> /// <returns></returns> public async Task <ResultModel> UpdateWidgetGroupAsync(WidgetGroup model) { var result = new ResultModel(); if (model == null) { result.Errors.Add(new ErrorModel(string.Empty, nameof(ArgumentNullException))); return(result); } _context.WidgetGroups.Update(model); return(await _context.PushAsync()); }
public TextEntryWidget(WidgetGroup parentGroup, float width, float height, float x, float y, string text) : base(parentGroup, width, height, x, y) { Text = text; FontSize = 12; Alignment = TextAnchor.UpperLeft; Color = new Color(1.0f, 1.0f, 1.0f, 1.0f); MaxLength = 255; Restrict = ""; EnableReturnSignal = false; EnableTabSignal = false; }
public ScrollTextWidget(WidgetGroup parentGroup, float width, float height, float x, float y, string text) : base(parentGroup, width, height, x, y) { Text = text; FontSize = 12; Alignment = TextAnchor.UpperLeft; Color = new Color(1.0f, 1.0f, 1.0f, 1.0f); ScrollRate = 1.0f; m_scrollPosition = new Vector2(0.0f, 0.0f); m_scrollToEnd = false; }
public ScrollTextWidget(WidgetGroup parentGroup, ScrollTextStyle style, float x, float y, string text) : base(parentGroup, style.Width, style.Height, x, y) { Text = text; FontSize = style.FontSize; Alignment = style.Alignment; Color = new Color(1.0f, 1.0f, 1.0f, 1.0f); ScrollRate = 1.0f; m_scrollPosition = new Vector2(0.0f, 0.0f); m_scrollToEnd = false; }
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); }
public virtual void OnDestroy() { for (int childIndex = 0; childIndex < m_childWidgets.Count; childIndex++) { IWidget widget = m_childWidgets[childIndex]; widget.OnDestroy(); } // Clear references to the parent and children m_parentWidgetGroup = null; m_childWidgets = new List <IWidget>(); }
public void Start() { float viewWidth = GAME_PANEL_X + gamePanelStyle.Width; float viewHeight = Math.Max(SCROLL_LIST_Y + scrollListStyle.Width, GAME_PANEL_Y + gamePanelStyle.Height); // Create the root widget group m_rootWidgetGroup = new WidgetGroup(null, viewWidth, viewHeight, 0.0f, 0.0f); m_rootWidgetGroup.SetWidgetEventListener(this); // Game list m_gameScrollList = new ScrollListWidget( m_rootWidgetGroup, (ScrollListWidget parentGroup, object parameters) => { return(new GameThumbnailWidget( parentGroup, gameThumbnailStyle, parameters as GameResponseEntry, 0.0f, 0.0f)); }, scrollListStyle, SCROLL_LIST_X, SCROLL_LIST_Y); // Game panel m_gamePanel = new GamePanelWidget(m_rootWidgetGroup, gamePanelStyle, GAME_PANEL_X, GAME_PANEL_Y); float panelWidth = m_gamePanel.Width - 2.0f * BORDER_WIDTH; // Create game button m_gameCreateButton = new ButtonWidget(m_gamePanel, buttonStyle, 0, 0, "Create"); m_gameCreateButton.SetLocalPosition( BORDER_WIDTH + panelWidth / 3 - m_gameCreateButton.Width, m_gamePanel.Height - m_gameCreateButton.Height - 5); // Select game button m_gameSelectButton = new ButtonWidget(m_gamePanel, buttonStyle, 0, 0, "Select"); m_gameSelectButton.SetLocalPosition( BORDER_WIDTH + (2 * panelWidth) / 3 - m_gameSelectButton.Width, m_gamePanel.Height - m_gameSelectButton.Height - 5); m_gameSelectButton.Visible = false; // Delete game button m_gameDeleteButton = new ButtonWidget(m_gamePanel, buttonStyle, 0, 0, "Delete"); m_gameDeleteButton.SetLocalPosition( BORDER_WIDTH + (3 * panelWidth) / 3 - m_gameDeleteButton.Width, m_gamePanel.Height - m_gameSelectButton.Height - 5); m_gameDeleteButton.Visible = false; // Initially hide all game data m_gamePanel.HideGameData(); }
public void Start() { float viewWidth = CHARACTER_PANEL_X + characterPanelStyle.BackgroundWidth; float viewHeight = Math.Max(SCROLL_LIST_Y + scrollListStyle.Width, CHARACTER_PANEL_Y + characterPanelStyle.BackgroundHeight); // Create the root widget group m_rootWidgetGroup = new WidgetGroup(null, viewWidth, viewHeight, 0.0f, 0.0f); m_rootWidgetGroup.SetWidgetEventListener(this); // Game list m_characterScrollList = new ScrollListWidget( m_rootWidgetGroup, (ScrollListWidget parentGroup, object parameters) => { return(new CharacterThumbnailWidget( parentGroup, characterThumbnailStyle, parameters as CharacterData)); }, scrollListStyle, SCROLL_LIST_X, SCROLL_LIST_Y); // Character panel m_characterPanel = new CharacterPanelWidget(m_rootWidgetGroup, characterPanelStyle, CHARACTER_PANEL_X, CHARACTER_PANEL_Y); float panelWidth = m_characterPanel.Width - 2.0f * BORDER_WIDTH; // Create game button m_characterCreateButton = new ButtonWidget(m_characterPanel, buttonStyle, 0, 0, "Create"); m_characterCreateButton.SetLocalPosition( BORDER_WIDTH + panelWidth / 3 - m_characterCreateButton.Width, m_characterPanel.Height - m_characterCreateButton.Height - 5); // Select game button m_characterSelectButton = new ButtonWidget(m_characterPanel, buttonStyle, 0, 0, "Select"); m_characterSelectButton.SetLocalPosition( BORDER_WIDTH + (2 * panelWidth) / 3 - m_characterSelectButton.Width, m_characterPanel.Height - m_characterSelectButton.Height - 5); m_characterSelectButton.Visible = false; // Delete game button m_characterDeleteButton = new ButtonWidget(m_characterPanel, buttonStyle, 0, 0, "Delete"); m_characterDeleteButton.SetLocalPosition( BORDER_WIDTH + (3 * panelWidth) / 3 - m_characterDeleteButton.Width, m_characterPanel.Height - m_characterDeleteButton.Height - 5); m_characterDeleteButton.Visible = false; // Initially hide all game data m_characterPanel.HideCharacterData(); }
public override bool Load() { dataBook = (DataBook)GetDataBook(mainWindow); widget = new SelectRangeWidget(dataBook); widget.Visible = false; WidgetGroup wgroup = (WidgetGroup)GetWidgetGroup(mainWindow, 0); wgroup.Add(widget); AddMenuItems(uiManager); loaded = true; return(true); }
public async Task <IActionResult> Create(WidgetGroup model) { if (!ModelState.IsValid) { return(View(model)); } var result = await _repository.CreateWidgetGroupAsync(model); if (result.IsSuccess) { return(RedirectToAction(nameof(Index))); } ModelState.AppendResultModelErrors(result.Errors); return(View(model)); }
public override bool Load() { widget = new GotoOffsetWidget((DataBook)GetDataBook(mainWindow)); widget.Visible = false; WidgetGroup wgroup = (WidgetGroup)GetWidgetGroup(mainWindow, 0); wgroup.Add(widget); // add the menu items AddMenuItems(uiManager); loaded = true; return(true); }
public void Start() { // 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 background m_backgroundGroup = new WidgetGroup(m_rootWidgetGroup, Screen.width, Screen.height, 0.0f, 0.0f); m_backgroundTiles = null; m_wallTiles = null; m_backgroundObjectTiles = null; // Create the foreground object group m_entityGroup = new WidgetGroup(m_rootWidgetGroup, Screen.width, Screen.height, 0.0f, 0.0f); // Create the foreground tile group m_foregroundGroup = new WidgetGroup(m_rootWidgetGroup, Screen.width, Screen.height, 0.0f, 0.0f); m_foregroundObjectTiles = null; // Create the foreground UI m_foregroundUIGroup = new WidgetGroup(m_rootWidgetGroup, Screen.width, Screen.height, 0.0f, 0.0f); // Create game button m_logoutButton = new ButtonWidget(m_foregroundUIGroup, buttonStyle, 0, 0, "Logout"); // Create the event navigation buttons { float layoutX = 0; float layoutY = Screen.height - buttonStyle.Height; m_firstEventButton = new ButtonWidget(m_foregroundUIGroup, buttonStyle, layoutX, layoutY, "<<"); layoutX += m_firstEventButton.Width; m_previousEventButton = new ButtonWidget(m_foregroundUIGroup, buttonStyle, layoutX, layoutY, "<"); layoutX += m_previousEventButton.Width; m_playPauseEventButton = new ButtonWidget(m_foregroundUIGroup, buttonStyle, layoutX, layoutY, "||"); layoutX += m_playPauseEventButton.Width; m_nextEventButton = new ButtonWidget(m_foregroundUIGroup, buttonStyle, layoutX, layoutY, ">"); layoutX += m_nextEventButton.Width; m_lastEventButton = new ButtonWidget(m_foregroundUIGroup, buttonStyle, layoutX, layoutY, ">>"); } }
public void Start(WidgetGroup widgetGroup) { Point2d newMousePosition = GetMousePosition(); m_rootWidgetGroup = widgetGroup; m_mousePosition.Set(newMousePosition.x, newMousePosition.y); m_mouseOverIWidget = m_rootWidgetGroup.FindChildIWidgetContainingPoint(m_mousePosition); m_mouseIsDragging = false; m_mouseWasDown = Input.GetMouseButton((int)eMouseButton.left); if (Debug.isDebugBuild) { DebugRegistry.SetToggle("ui.event.log", false); } }
public Widget(WidgetGroup parentGroup, float width, float height, float x, float y) { m_localPosition = new Point2d(); m_worldPosition = new Point2d(); Width = width; Height = height; Visible = true; m_parentGroup = parentGroup; if (m_parentGroup != null) { m_parentGroup.AddWidget(this); } SetLocalPosition(x, y); }
public override bool Load() { dataBook = (DataBook)GetDataBook(mainWindow); WidgetGroup wg = (WidgetGroup)GetWidgetGroup(mainWindow, 1); sw = new StatisticsWidget(dataBook); wg.Add(sw); AddMenuItems(uiManager); Preferences.Proxy.Subscribe("Tools.Statistics.Show", "stats1", new PreferencesChangedHandler(OnPreferencesChanged)); loaded = true; return(true); }
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; }
/// <summary> /// 创建部件配置 /// </summary> /// <param name="dcs"></param> /// <returns></returns> void CreateWidgetConfig(List <DataControlInfo> dcs, string filePath) { WidgetCollection wdCollection = new WidgetCollection(); wdCollection.Name = "default"; wdCollection.Label = "部件列表信息"; wdCollection.Description = "部件列表信息"; Dictionary <string, WidgetGroup> groups = new Dictionary <string, WidgetGroup>(); foreach (DataControlInfo dci in dcs) { WidgetGroup group; if (!groups.ContainsKey(dci.Group)) { group = new WidgetGroup(); group.Description = dci.Group; group.Label = dci.Group; group.Name = dci.Group; groups.Add(dci.Group, group); wdCollection.Groups.Add(group); } else { group = groups[dci.Group]; } Widget wd = new Widget(); wd.Name = dci.Directory; wd.Label = dci.Name; wd.Icon = dci.Desc; wd.File = dci.Path; wd.Description = dci.Desc; foreach (DataControl dc in dci.Controls) { WidgetType wdType = new WidgetType(); wdType.Name = dc.Control; wdType.Label = dc.Name; wdType.File = dc.FileName; wd.Types.Add(wdType); } group.Widgets.Add(wd); } SerializationHelper.Save(wdCollection, filePath); }
private Widget UpdateWidgetCollectionWithNewAddition(Widget baseWidget) { var widgetGroup = WidgetGroups.FirstOrDefault(group => @group.Heading == baseWidget.Category); if (widgetGroup == null) { widgetGroup = new WidgetGroup { Heading = baseWidget.Category, Widgets = new ObservableCollection <Widget>() }; WidgetGroups.Add(widgetGroup); } widgetGroup.Widgets.Add(baseWidget); UpdateAllWidgets(); return(baseWidget); }
public WidgetGroup(WidgetGroup parentGroup, float width, float height, float x, float y) { m_widgetEventListener = null; m_childWidgets = new List<IWidget>() { }; m_parentWidgetGroup = parentGroup; m_localPosition = new Point2d(); m_worldPosition = new Point2d(); Width = width; Height = height; Visible = true; if (m_parentWidgetGroup != null) { m_parentWidgetGroup.AddWidget(this); } SetLocalPosition(x, y); }
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; }
public WindowWidget(WidgetGroup parentGroup, string title, WindowStyle style, float x, float y) : base(parentGroup, style.WindowWidth, style.WindowHeight, x, y) { m_title = title; }
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; } }
public void Start(WidgetGroup parentWidgetGroup) { _chatWindowView.Start(parentWidgetGroup); _chatWindowModel.Start(); }
// 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); }
// Use this for initialization public void Start(WidgetGroup parentWidgetGroup) { m_contextOverlayView.Start(parentWidgetGroup); m_contextOverlayModel.Start(); }
public CheckBoxWidget(WidgetGroup parentGroup, CheckBoxStyle style, float x, float y) : base(parentGroup, style.Width, style.Height, x, y) { m_buttonSkin = style.ButtonSkin; Enabled = false; }
public void Start() { float viewWidth = GAME_PANEL_X + gamePanelStyle.Width; float viewHeight = Math.Max(SCROLL_LIST_Y + scrollListStyle.Width, GAME_PANEL_Y + gamePanelStyle.Height); // Create the root widget group m_rootWidgetGroup = new WidgetGroup(null, viewWidth, viewHeight, 0.0f, 0.0f); m_rootWidgetGroup.SetWidgetEventListener(this); // Game list m_gameScrollList = new ScrollListWidget( m_rootWidgetGroup, (ScrollListWidget parentGroup, object parameters) => { return new GameThumbnailWidget( parentGroup, gameThumbnailStyle, parameters as GameResponseEntry, 0.0f, 0.0f); }, scrollListStyle, SCROLL_LIST_X, SCROLL_LIST_Y); // Game panel m_gamePanel = new GamePanelWidget(m_rootWidgetGroup, gamePanelStyle, GAME_PANEL_X, GAME_PANEL_Y); float panelWidth= m_gamePanel.Width - 2.0f * BORDER_WIDTH; // Create game button m_gameCreateButton = new ButtonWidget(m_gamePanel, buttonStyle, 0, 0, "Create"); m_gameCreateButton.SetLocalPosition( BORDER_WIDTH + panelWidth/3 - m_gameCreateButton.Width, m_gamePanel.Height - m_gameCreateButton.Height - 5); // Select game button m_gameSelectButton = new ButtonWidget(m_gamePanel, buttonStyle, 0, 0, "Select"); m_gameSelectButton.SetLocalPosition( BORDER_WIDTH + (2*panelWidth)/3 - m_gameSelectButton.Width, m_gamePanel.Height - m_gameSelectButton.Height - 5); m_gameSelectButton.Visible = false; // Delete game button m_gameDeleteButton = new ButtonWidget(m_gamePanel, buttonStyle, 0, 0, "Delete"); m_gameDeleteButton.SetLocalPosition( BORDER_WIDTH + (3*panelWidth)/3 - m_gameDeleteButton.Width, m_gamePanel.Height - m_gameSelectButton.Height - 5); m_gameDeleteButton.Visible = false; // Initially hide all game data m_gamePanel.HideGameData(); }
public virtual void OnDestroy() { for (int childIndex = 0; childIndex < m_childWidgets.Count; childIndex++ ) { IWidget widget = m_childWidgets[childIndex]; widget.OnDestroy(); } // Clear references to the parent and children m_parentWidgetGroup = null; m_childWidgets = new List<IWidget>(); }
private void OnBudgetBucketMonitorWidgetAdded(object sender, BudgetBucketChosenEventArgs args) { if (args.CorrelationId != CorrelationId) { return; } CorrelationId = Guid.NewGuid(); BudgetBucket bucket = this.chooseBudgetBucketController.Selected; if (bucket == null) { // Cancelled by user. return; } if (WidgetGroups.OfType<BudgetBucketMonitorWidget>().Any(w => w.BucketCode == bucket.Code)) { this.messageBox.Show("New Budget Bucket Widget", "This Budget Bucket Monitor Widget for [{0}] already exists.", bucket.Code); return; } IMultiInstanceWidget widget = this.widgetRepository.Create(typeof(BudgetBucketMonitorWidget).FullName, bucket.Code); var baseWidget = (Widget)widget; WidgetGroup widgetGroup = WidgetGroups.FirstOrDefault(group => group.Heading == baseWidget.Category); if (widgetGroup == null) { widgetGroup = new WidgetGroup { Heading = baseWidget.Category, Widgets = new ObservableCollection<Widget>() }; WidgetGroups.Add(widgetGroup); } widgetGroup.Widgets.Add(baseWidget); UpdateWidget(baseWidget); }
public ButtonWidget(WidgetGroup parentGroup, ButtonStyle style, float x, float y, string label) : base(parentGroup, style.Width, style.Height, x, y) { Label = label; }
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); }
public ImageWidget(WidgetGroup parentGroup, float width, float height, Texture image, float x, float y) : base(parentGroup, width, height, x, y) { Image = image; Color = new Color(1.0f, 1.0f, 1.0f, 1.0f); }
public void Start() { float viewWidth = CHARACTER_PANEL_X + characterPanelStyle.BackgroundWidth; float viewHeight = Math.Max(SCROLL_LIST_Y + scrollListStyle.Width, CHARACTER_PANEL_Y + characterPanelStyle.BackgroundHeight); // Create the root widget group m_rootWidgetGroup = new WidgetGroup(null, viewWidth, viewHeight, 0.0f, 0.0f); m_rootWidgetGroup.SetWidgetEventListener(this); // Game list m_characterScrollList = new ScrollListWidget( m_rootWidgetGroup, (ScrollListWidget parentGroup, object parameters) => { return new CharacterThumbnailWidget( parentGroup, characterThumbnailStyle, parameters as CharacterData); }, scrollListStyle, SCROLL_LIST_X, SCROLL_LIST_Y); // Character panel m_characterPanel = new CharacterPanelWidget(m_rootWidgetGroup, characterPanelStyle, CHARACTER_PANEL_X, CHARACTER_PANEL_Y); float panelWidth = m_characterPanel.Width - 2.0f * BORDER_WIDTH; // Create game button m_characterCreateButton = new ButtonWidget(m_characterPanel, buttonStyle, 0, 0, "Create"); m_characterCreateButton.SetLocalPosition( BORDER_WIDTH + panelWidth / 3 - m_characterCreateButton.Width, m_characterPanel.Height - m_characterCreateButton.Height - 5); // Select game button m_characterSelectButton = new ButtonWidget(m_characterPanel, buttonStyle, 0, 0, "Select"); m_characterSelectButton.SetLocalPosition( BORDER_WIDTH + (2 * panelWidth) / 3 - m_characterSelectButton.Width, m_characterPanel.Height - m_characterSelectButton.Height - 5); m_characterSelectButton.Visible = false; // Delete game button m_characterDeleteButton = new ButtonWidget(m_characterPanel, buttonStyle, 0, 0, "Delete"); m_characterDeleteButton.SetLocalPosition( BORDER_WIDTH + (3 * panelWidth) / 3 - m_characterDeleteButton.Width, m_characterPanel.Height - m_characterDeleteButton.Height - 5); m_characterDeleteButton.Visible = false; // Initially hide all game data m_characterPanel.HideCharacterData(); }
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, ">"); }