private void _showForgetAllMessage(Action forgetAllAction) { List <string> drawStrings = new List <string>(); string[] messages = { OldWorld.GetString(EOResourceID.SKILLMASTER_FORGET_ALL), OldWorld.GetString(EOResourceID.SKILLMASTER_FORGET_ALL_MSG_1), OldWorld.GetString(EOResourceID.SKILLMASTER_FORGET_ALL_MSG_2), OldWorld.GetString(EOResourceID.SKILLMASTER_FORGET_ALL_MSG_3), OldWorld.GetString(EOResourceID.SKILLMASTER_CLICK_HERE_TO_FORGET_ALL) }; TextSplitter ts = new TextSplitter("", Game.Content.Load <SpriteFont>(Constants.FontSize08pt5)) { LineLength = 200 }; foreach (string s in messages) { ts.Text = s; if (!ts.NeedsProcessing) { //no text clipping needed drawStrings.Add(s); drawStrings.Add(" "); continue; } drawStrings.AddRange(ts.SplitIntoLines()); drawStrings.Add(" "); } //now need to take the processed draw strings and make an ListDialogItem for each one foreach (string s in drawStrings) { string next = s; bool link = false; if (next.Length > 0 && next[0] == '*') { next = next.Remove(0, 1); link = true; } ListDialogItem nextItem = new ListDialogItem(this, ListDialogItem.ListItemStyle.Small) { Text = next }; if (link) { nextItem.SetPrimaryTextLink(forgetAllAction); } AddItemToList(nextItem, false); } }
private void _setDialogText() { ClearItemList(); List <string> rows = new List <string>(); TextSplitter ts = new TextSplitter(_pages[_pageIndex], Game.Content.Load <SpriteFont>(Constants.FontSize08pt5)); if (!ts.NeedsProcessing) { rows.Add(_pages[_pageIndex]); } else { rows.AddRange(ts.SplitIntoLines()); } int index = 0; foreach (var row in rows) { ListDialogItem rowItem = new ListDialogItem(this, ListDialogItem.ListItemStyle.Small, index++) { Text = row }; AddItemToList(rowItem, false); } if (_pageIndex < _pages.Count - 1) { return; } ListDialogItem item = new ListDialogItem(this, ListDialogItem.ListItemStyle.Small, index++) { Text = " " }; AddItemToList(item, false); foreach (var link in _links) { ListDialogItem linkItem = new ListDialogItem(this, ListDialogItem.ListItemStyle.Small, index++) { Text = link.Value }; var linkIndex = (byte)link.Key; linkItem.SetPrimaryTextLink(() => _clickLink(linkIndex)); AddItemToList(linkItem, false); } }
private void _setDialogText() { ClearItemList(); List<string> rows = new List<string>(); TextSplitter ts = new TextSplitter(_pages[_pageIndex], Game.Content.Load<SpriteFont>(Constants.FontSize08pt5)); if (!ts.NeedsProcessing) rows.Add(_pages[_pageIndex]); else rows.AddRange(ts.SplitIntoLines()); int index = 0; foreach (var row in rows) { ListDialogItem rowItem = new ListDialogItem(this, ListDialogItem.ListItemStyle.Small, index++) { Text = row }; AddItemToList(rowItem, false); } if (_pageIndex < _pages.Count - 1) return; ListDialogItem item = new ListDialogItem(this, ListDialogItem.ListItemStyle.Small, index++) { Text = " " }; AddItemToList(item, false); foreach (var link in _links) { ListDialogItem linkItem = new ListDialogItem(this, ListDialogItem.ListItemStyle.Small, index++) { Text = link.Value }; var linkIndex = (byte)link.Key; linkItem.SetPrimaryTextLink(() => _clickLink(linkIndex)); AddItemToList(linkItem, false); } }
private void _showForgetAllMessage(Action forgetAllAction) { List<string> drawStrings = new List<string>(); string[] messages = { World.GetString(DATCONST2.SKILLMASTER_FORGET_ALL), World.GetString(DATCONST2.SKILLMASTER_FORGET_ALL_MSG_1), World.GetString(DATCONST2.SKILLMASTER_FORGET_ALL_MSG_2), World.GetString(DATCONST2.SKILLMASTER_FORGET_ALL_MSG_3), World.GetString(DATCONST2.SKILLMASTER_CLICK_HERE_TO_FORGET_ALL) }; TextSplitter ts = new TextSplitter("", Game.Content.Load<SpriteFont>(Constants.FontSize08pt5)) { LineLength = 200 }; foreach (string s in messages) { ts.Text = s; if (!ts.NeedsProcessing) { //no text clipping needed drawStrings.Add(s); drawStrings.Add(" "); continue; } drawStrings.AddRange(ts.SplitIntoLines()); drawStrings.Add(" "); } //now need to take the processed draw strings and make an ListDialogItem for each one foreach (string s in drawStrings) { string next = s; bool link = false; if (next.Length > 0 && next[0] == '*') { next = next.Remove(0, 1); link = true; } ListDialogItem nextItem = new ListDialogItem(this, ListDialogItem.ListItemStyle.Small) { Text = next }; if (link) nextItem.SetPrimaryTextLink(forgetAllAction); AddItemToList(nextItem, false); } }