public FootCheckMenu(PlayerController owner) : base(owner, Vector2.zero, Vector2.zero, "FootCheck") { var viewpos = new Vector2(Screen.width * 0.1f, Screen.height * 0.25f); var viewsize = new Vector2(WindowConfigure.fontScale(16f), WindowConfigure.fontScale(2f)); var view = new ViewOnlyWindow(viewpos, viewsize); MainWindow = view; WindowText wt = new WindowText("",MainWindow.TextAreaPosition); //Debug.Log("Owner On:"+owner.OnObjectEntity.Entity); this.OnObject = owner.OnObjectEntity; if (OnObject is ItemEntity) { //UseMenu = new SelectedItemUseMenu(OnObject.Entity as ItemBasis, WindowOwner, MainWindow.WindowPosition + new Vector2(MainWindow.WindowSize.x, 0),SelectedItemUseMenu.InventoryMode.FIELD); wt.Text = (OnObject.Object as ItemBasis).Name; } else if (OnObject is TrapEntity) { wt.Text = (OnObject.Object as TrapBasis).Name; } else if(OnObject is GateWayEntity){ wt.Text = (OnObject.Object as GateWayBasis).Name; } view.addWindowText(wt); //UseMenu.SubWindows.Add(view); //SubWindows.Add(UseMenu.MainWindow); }
public StringBoardMenu(MyCharacterController owener, int maxlength) : base(rowsize,columnsize,owener,pos, size, "StringBoardMenu") { CurrentText = new StringBuilder(maxlength); MaxLength = maxlength; BoardText = new WindowText[rowsize, columnsize]; Vector2 textpos0 = Window.TextAreaPosition+Vector2.one*WindowConfigure.fontScale(1f); for (int r = 0; r < rowsize; r++) { Vector2 prevpos = textpos0 + new Vector2(0,r*ymargin); for (int c = 0; c < columnsize; c++) { float xmargin = c%5==0 ? WindowConfigure.fontScale(1.5f) : WindowConfigure.fontScale(1.2f); xmargin = c == 0 ? WindowConfigure.fontScale(0.5f) : xmargin; Vector2 textpos = prevpos + new Vector2(xmargin, 0); BoardText[r, c] = new WindowText( "", textpos); prevpos = textpos; } } //string[] table = createHiraKanaTable(); setHirakanaTable(); setSystemText(); Window.MultiSelectMode = false; Vector2 dispsize = new Vector2(WindowConfigure.fontScale(maxlength +6), WindowConfigure.fontScale(1.5f)); Vector2 disppos = new Vector2(Window.WindowPosition.x + (Window.WindowSize.x/2 - dispsize.x/2),(Window.WindowPosition.y - dispsize.y)); InputDisplay = new ViewOnlyWindow(disppos, dispsize); WindowText prevtext = new WindowText("",InputDisplay.TextAreaPosition + new Vector2(WindowConfigure.fontScale(2f),-WindowConfigure.fontScale(0.3f))); InputDisplay.addWindowText(prevtext); SubWindows.Add(InputDisplay); Window.SkipText.Add(""); Window.ReplaceText.Add(WhiteSpace,""); }
private void CreateIconInSystemTray() { _systemTrayIcon = _systemTrayIcon ?? new NotifyIcon(); _systemTrayIcon.MouseClick -= SystemTrayIconClick; _systemTrayIcon.MouseClick += SystemTrayIconClick; _systemTrayIcon.Icon = GetWindowIcon(); _systemTrayIcon.Text = WindowText.Length > 63 ? WindowText.Substring(0, 60).PadRight(63, '.') : WindowText; _systemTrayIcon.Visible = true; }
public ShopMenu() : base(10, 1, null, pos, size, "ShopMenu") { Window.MultiSelectMode = true; var itemnames = new WindowText[10,1]; for (int i = 0; i < itemnames.Length; i++) { itemnames[i, 0] = new WindowText(SelectableWindow.EOL, Window.TextAreaPosition + new Vector2(10, WindowConfigure.fontScale(scale * i))); itemnames[i, 0].TextAreaSize = new Vector2(Window.TextAreaSize.x - WindowConfigure.fontScale(1.25f), WindowConfigure.fontScale(scale)); } Window.setText(itemnames); }
/// <summary> /// Makes the character talk. /// </summary> /// <param name="text"> Message you would like them to say. </param> /// <param name="TimeToTalk"> Time you would like the character to stay in the talking animation. </param> public void Talk(String text, int TimeToTalk) { message = text; state = State.talk; currentmessage = new StringBuilder(); currentmessagePosition = 0; currentmessageLength = text.Length; textwindow = new WindowText(textureWindow, fontJetset, currentmessage.ToString(), Bounds.X + (Bounds.Width / 4), Bounds.Y + (Bounds.Height / 2)); talkTimerStart = TimeToTalk; talkTimer = talkTimerStart; }
public YesNoMenu(MyCharacterController owner, Vector2 pos, Vector2 size, params string[] captions) : this(owner,new ViewOnlyWindow(pos,size)) { Vector2 orgpos = CaptionWindow.TextAreaPosition; Vector2 posdelta = new Vector2(0, WindowConfigure.fontScale(1f)); for (int i = 0; i < captions.Length; i++) { var caption = new WindowText(captions[i], orgpos + (posdelta * i)); CaptionWindow.addWindowText(caption); } }
public SelectedObjectUseMenu(ObjectBasis selectedobject, MyCharacterController owner,Vector2 pos,Vector2 size, string name) : base(owner, pos, size, name) { Debug.Log("Object: "+(selectedobject != null)); SelectedObject = selectedobject; DescriptionMenu = new ItemDescriptionMenu(); WindowText wt = new WindowText(SelectedObject.Description, DescriptionMenu.Window.TextAreaPosition + new Vector2(WindowConfigure.fontScale(1f), 0)); wt.TextAreaSize = DescriptionMenu.Window.TextAreaSize - new Vector2(WindowConfigure.fontScale(5), WindowConfigure.fontScale(2)); DescriptionMenu.Window.addWindowText(wt); VisiblePreviousMenu = true; }
public MultiChoicesMenu(MyCharacterController owner, string[] choiceslabels, Vector2 pos, Vector2 size, Action<int> choicesaction) : base(choiceslabels.Length,1, owner, pos, size) { WindowText[,] texts = new WindowText[choiceslabels.Length,1]; Vector2 textpos = MainWindow.TextAreaPosition; for (int i = 0; i < texts.Length; i++) { texts[i,0] = new WindowText(choiceslabels[i] ?? (""), textpos+(posmergin*i)); } setTexts(texts); ChoicesAction = choicesaction; }
public WriteBookTitleMenu(MyCharacterController owner,NoTitleBook src) : base(rowsize, 1, owner, pos, size, "WriteBookTitle") { BookTitles = new string[GameController.GlobalGameInformation.ReadBookTitles.Length]; updateReadBookTiltes(); MaxPageNum = BookTitles.Length / rowsize + 1; Src = src; Window.MultiSelectMode = false; WindowText[,] lables = new WindowText[rowsize, 1]; for (int i = 0; i < rowsize; i++) { lables[i, 0] = new WindowText(SelectableWindow.EOL,Window.TextAreaPosition + WindowConfigure.createFontScaleForVector(0,i*1.5f)); Window.setText(lables); } }
public SelectableWindow(WindowText[,] texts,Vector2 pos, Vector2 size, string name = "SelectableWindow") : base(pos, size, name) { this.texts = texts;//new WindowText[Mathf.Max(rowsize, 1), Mathf.Max(columnsize, 1)]; LimitRow = RowSize; LimitColumn = ColumnSize; multiselectedindex = new List<string>(); MultiSelectMode = false; SkipText = new List<string>(); SkipText.Add(EOL); ReplaceText = new Dictionary<string, string>(); HighLightVisibleWhenUnFocus = true; ViewOnlyTexts = new List<WindowText>(); }
public YesNoMenu(MyCharacterController owner,ViewOnlyWindow captionwindow) : base(2,1,owner,new Vector2(captionwindow.Rect.xMin,captionwindow.Rect.yMax) + new Vector2(0,10),size,"YesNoMenu") { //Debug.Log("YESNOMenu!!!!!"); this.Window.MultiSelectMode = false; CaptionWindow = captionwindow; if (captionwindow != null) this.SubWindows.Add(captionwindow); yeslabel = new WindowText("はい",this.Window.TextAreaPosition); nolabel = new WindowText("いいえ", yeslabel.Position + new Vector2(0,WindowConfigure.fontScale(1.2f))); WindowText[,] yesno = { { yeslabel}, {nolabel } }; setTexts(yesno); PlayYesSound = true; PlayNoSound = true; }
protected override void initTalkAction() { base.initTalkAction(); selectmenu.setChoicesLabels(labels); selectmenu.ChoicesAction = action; message.setMessage(firstmessage); invmenu = new ItemInventoryMenu(GameController.MainPlayer,submitact); bankdislplay = new ViewOnlyWindow(WindowConfigure.createScreenPoint(0.5f, 0.3f), WindowConfigure.createFontScaleForVector(16f, 3f)); WindowText[] wts = new WindowText[2]; wts[0] = new WindowText("", bankdislplay.TextAreaPosition); wts[1] = new WindowText("", bankdislplay.TextAreaPosition+WindowConfigure.createFontScaleForVector(0,1.5f)); bankdislplay.addWindowText(wts); TalkAction.setTalkActions(new OpenMenu(message),new OpenMenu(selectmenu)); TalkAction.PreOperation = preoperaion; }
public PlayerMainMenu(MyCharacterController owner) : base(owner,pos,size,"MainMenu") { WindowText[,] menus = new WindowText[2,2]; menus[0, 0] = new WindowText(inventory, Window.TextAreaPosition+new Vector2(0,-5)); menus[1, 0] = new WindowText(underfoot, menus[0,0].Position+new Vector2(0,WindowConfigure.fontScale(scale))); menus[0, 1] = new WindowText(logs, menus[0, 0].Position + new Vector2(WindowConfigure.fontScale(menus[0, 0].Text.Length+0.5f), 0)); menus[1, 1] = new WindowText(others, menus[0, 0].Position + new Vector2(WindowConfigure.fontScale(menus[0, 0].Text.Length+0.5f), WindowConfigure.fontScale(scale))); Window.setText(menus); Window.MultiSelectMode = false; initParameterWindow(); invmenu = new ItemInventoryMenu(owner); submitsave = new YesNoMenu(owner,new ViewOnlyWindow(WindowConfigure.ScreenCenter,WindowConfigure.createFontScaleForVector(13,2))); submitsave.CaptionWindow.addWindowText(new WindowText("冒険を中断しますか?",submitsave.CaptionWindow.TextAreaPosition)); submitsave.YesAct = yesaction; submitsave.NoAct = noaction; SubWindows.Add(ParameterWindow); }
private static void print(EOsType type) { IButton button = null; IText text = null; switch (type) { case EOsType.Window: button = new WindowButton(); text = new WindowText(); break; case EOsType.Mac: button = new MacButton(); text = new MacText(); break; } button.click_Button(); text.text_Description(); }
public ItemDescriptionMenu() : base(null,DefaultPosition,DefaultSize,"ItemDescription") { MainDescriptions = new WindowText[2]; AbilityLabelCount = (int)Mathf.Max((DefaultSize.y / (WindowConfigure.DefaultFontSize*2)) - 3,1); AbilityDescriptions = new WindowText[AbilityLabelCount]; Vector2 orgpos = MainWindow.TextAreaPosition; MainDescriptions[0] = new WindowText("", orgpos); MainDescriptions[1] = new WindowText("", orgpos + mergin); var w = (DefaultSize.x / WindowConfigure.DefaultFontSize) - 1; var h = 3; MainDescriptions[1].changeTextAreaSize(WindowConfigure.createFontScaleForVector(w, h)); orgpos = MainDescriptions[1].Position; CurrentPageCount = 0; TotalPageCount = 0; for (int i = 0; i < AbilityLabelCount; i++) { AbilityDescriptions[i] = new WindowText("", orgpos + (mergin * 2.2f * i)); } Vector2 arrowpos = new Vector2(Window.WindowSize.x/2,Window.WindowSize.y - WindowConfigure.fontScale(0.15f)); pagearrow = new WindowText("",arrowpos); }
protected void setMenuLabels(params string[] labels) { WindowText[,] wts = new WindowText[labels.Length, 1]; Vector2 initpos = Window.TextAreaPosition; for (int i = 0; i < wts.Length; i++) { wts[i, 0] = new WindowText(labels[i], initpos + new Vector2(0, WindowConfigure.fontScale(1.1f * i))); } Vector2 size = new Vector2(WindowConfigure.fontScale(4.5f), WindowConfigure.fontScale(wts.Length * 1.4f)); Window = new SelectableWindow(wts, Window.WindowPosition, size, this.MenuName); }
public void addWindowText(WindowText text) { texts.Add(text); }
public string Parse(string pattern) { if (string.IsNullOrEmpty(pattern)) { return(string.Empty); } StringBuilder sb = new StringBuilder(pattern); if (WindowText != null) { sb.Replace(ReplacementVariables.t.ToPrefixString(), WindowText.Replace(' ', '_')); } string width = string.Empty, height = string.Empty; if (Picture != null) { width = Picture.Width.ToString(); height = Picture.Height.ToString(); } sb.Replace(ReplacementVariables.width.ToPrefixString(), width); sb.Replace(ReplacementVariables.height.ToPrefixString(), height); DateTime dt = DateTime.Now; if (CustomDate != DateTime.MinValue) { dt = CustomDate; } sb.Replace(ReplacementVariables.mon2.ToPrefixString(), CultureInfo.InvariantCulture.DateTimeFormat.GetMonthName(dt.Month)) .Replace(ReplacementVariables.mon.ToPrefixString(), CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(dt.Month)) .Replace(ReplacementVariables.y.ToPrefixString(), dt.Year.ToString()) .Replace(ReplacementVariables.mo.ToPrefixString(), Helpers.AddZeroes(dt.Month)) .Replace(ReplacementVariables.d.ToPrefixString(), Helpers.AddZeroes(dt.Day)); string hour; if (sb.ToString().Contains(ReplacementVariables.pm.ToPrefixString())) { hour = Helpers.HourTo12(dt.Hour); } else { hour = Helpers.AddZeroes(dt.Hour); } sb.Replace(ReplacementVariables.h.ToPrefixString(), hour) .Replace(ReplacementVariables.mi.ToPrefixString(), Helpers.AddZeroes(dt.Minute)) .Replace(ReplacementVariables.s.ToPrefixString(), Helpers.AddZeroes(dt.Second)) .Replace(ReplacementVariables.ms.ToPrefixString(), Helpers.AddZeroes(dt.Millisecond, 3)) .Replace(ReplacementVariables.w2.ToPrefixString(), CultureInfo.InvariantCulture.DateTimeFormat.GetDayName(dt.DayOfWeek)) .Replace(ReplacementVariables.w.ToPrefixString(), CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(dt.DayOfWeek)) .Replace(ReplacementVariables.pm.ToPrefixString(), (dt.Hour >= 12 ? "PM" : "AM")); sb.Replace(ReplacementVariables.unix.ToPrefixString(), DateTime.UtcNow.ToUnix().ToString()); if (sb.ToString().Contains(ReplacementVariables.i.ToPrefixString())) { AutoIncrementNumber++; sb.Replace(ReplacementVariables.i.ToPrefixString(), AutoIncrementNumber.ToString()); } sb.Replace(ReplacementVariables.un.ToPrefixString(), Environment.UserName); sb.Replace(ReplacementVariables.uln.ToPrefixString(), Environment.UserDomainName); sb.Replace(ReplacementVariables.cn.ToPrefixString(), Environment.MachineName); if (Type == NameParserType.Text) { sb.Replace(ReplacementVariables.n.ToPrefixString(), Environment.NewLine); } string result = sb.ToString(); result = result.ReplaceAll(ReplacementVariables.rn.ToPrefixString(), () => Helpers.GetRandomChar(Helpers.Numbers).ToString()); result = result.ReplaceAll(ReplacementVariables.ra.ToPrefixString(), () => Helpers.GetRandomChar(Helpers.Alphanumeric).ToString()); if (Type == NameParserType.FolderPath) { result = Helpers.GetValidFolderPath(result); } else if (Type == NameParserType.FileName) { result = Helpers.GetValidFileName(result); } else if (Type == NameParserType.FilePath) { result = Helpers.GetValidFilePath(result); } else if (Type == NameParserType.URL) { result = Helpers.GetValidURL(result); } if (MaxNameLength > 0 && result.Length > MaxNameLength) { result = result.Remove(MaxNameLength); } return(result); }
private void initParameterWindow() { ParameterWindow = new ViewOnlyWindow(pos2,size2,"PlayerParameter"); Vector2 textpos = ParameterWindow.TextAreaPosition + new Vector2(WindowConfigure.DefaultFontSize,0); paramtexts = new WindowText[5]; paramtexts[0] = new WindowText(atk, textpos + new Vector2(5, 10)); paramtexts[1] = new WindowText(def, textpos + new Vector2(5, 10+WindowConfigure.DefaultFontSize*2)); paramtexts[2] = new WindowText(hunger, textpos + new Vector2(5 + WindowConfigure.DefaultFontSize * 10, 10)); paramtexts[4] = new WindowText(exp, textpos + new Vector2(5 + WindowConfigure.DefaultFontSize * 20, 10 + WindowConfigure.DefaultFontSize * 2)); paramtexts[3] = new WindowText(strength, textpos + new Vector2(5 + WindowConfigure.DefaultFontSize * 10, 10 + WindowConfigure.DefaultFontSize * 2)); ParameterWindow.addWindowText(paramtexts); }
public void setText(string[] texts, Vector2 orgpos, LabelAxis axis, float merginscale, bool resize=true) { int r = 1, c = 1; int h =1,v=1; switch (axis) { case LabelAxis.HOLIZONTAL: c = texts.Length; v = 0; break; case LabelAxis.VERTICAL: r = texts.Length; h = 0; break; } Debug.LogFormat("R:{0}, C:{1}, H:{2}, V:{3}",r,c,h,v); WindowText[,] newtexts = new WindowText[r, c]; Vector2 mergin = Vector2.zero; int idx = 0; int strlength = 0; for (int x = 0; x < c; x++) { for (int y = 0; y < r; y++) { if (idx > 0) strlength = texts.Length; mergin = WindowConfigure.createFontScaleForVector((strlength+merginscale)*h,idx*v*merginscale); newtexts[y, x] = new WindowText(texts[idx],orgpos + mergin); idx++; } } setText(newtexts); if (resize) { float width = 1, height = 1; switch (axis) { case LabelAxis.HOLIZONTAL: int sum = texts.Sum(str => str.Length); width = sum; break; case LabelAxis.VERTICAL: height = r; width = texts.Max(str => str.Length); break; } Vector2 size = WindowConfigure.createFontScaleForVector(width*merginscale,height*merginscale*1.15f); WindowSize = size; init(); } }
public void setText(WindowText[,] newtexts) { texts = newtexts; LimitColumn = ColumnSize; LimitRow = RowSize; }
public void setText(WindowText text, int rowidx, int columnidx) { if (rowidx < RowSize && columnidx < ColumnSize) { texts[rowidx, columnidx] = text; LimitColumn = Mathf.Max(LimitColumn, columnidx+1); LimitRow = Mathf.Max(LimitRow, rowidx+1); } }
public void initHeadLabel(string text) { headlabel = new ViewOnlyWindow(new Vector2(0, WindowConfigure.fontScale(0.5f)), new Vector2(Size.x, WindowConfigure.fontScale(1.8f))); headlabelText = new WindowText(text, headlabel.TextAreaPosition + new Vector2(WindowConfigure.fontScale(0.5f), 0)); headlabel.addWindowText(headlabelText); this.SubWindows.Add(headlabel); }
public void setTexts(WindowText[,] texts) { Window.setText(texts); }
public SelectableMenu(WindowText[,] texts, MyCharacterController owner,Vector2 pos, Vector2 size, string name = "SelectableMenu") : base(owner,pos,size,name) { Window = new SelectableWindow(texts,pos,size); //Window.setText(texts); }
public string Parse(string pattern) { if (string.IsNullOrEmpty(pattern)) { return(string.Empty); } StringBuilder sb = new StringBuilder(pattern); if (WindowText != null) { string windowText = WindowText.Replace(' ', '_'); if (MaxTitleLength > 0 && windowText.Length > MaxTitleLength) { windowText = windowText.Remove(MaxTitleLength); } sb.Replace(ReplCodeMenuEntry.t.ToPrefixString(), windowText); } if (ProcessName != null) { sb.Replace(ReplCodeMenuEntry.pn.ToPrefixString(), ProcessName); } string width = string.Empty, height = string.Empty; if (Picture != null) { width = Picture.Width.ToString(); height = Picture.Height.ToString(); } sb.Replace(ReplCodeMenuEntry.width.ToPrefixString(), width); sb.Replace(ReplCodeMenuEntry.height.ToPrefixString(), height); DateTime dt = DateTime.Now; if (CustomTimeZone != null) { dt = TimeZoneInfo.ConvertTime(dt, CustomTimeZone); } sb.Replace(ReplCodeMenuEntry.mon2.ToPrefixString(), CultureInfo.InvariantCulture.DateTimeFormat.GetMonthName(dt.Month)) .Replace(ReplCodeMenuEntry.mon.ToPrefixString(), CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(dt.Month)) .Replace(ReplCodeMenuEntry.yy.ToPrefixString(), dt.ToString("yy")) .Replace(ReplCodeMenuEntry.y.ToPrefixString(), dt.Year.ToString()) .Replace(ReplCodeMenuEntry.mo.ToPrefixString(), Helpers.AddZeroes(dt.Month)) .Replace(ReplCodeMenuEntry.d.ToPrefixString(), Helpers.AddZeroes(dt.Day)); string hour; if (sb.ToString().Contains(ReplCodeMenuEntry.pm.ToPrefixString())) { hour = Helpers.HourTo12(dt.Hour); } else { hour = Helpers.AddZeroes(dt.Hour); } sb.Replace(ReplCodeMenuEntry.h.ToPrefixString(), hour) .Replace(ReplCodeMenuEntry.mi.ToPrefixString(), Helpers.AddZeroes(dt.Minute)) .Replace(ReplCodeMenuEntry.s.ToPrefixString(), Helpers.AddZeroes(dt.Second)) .Replace(ReplCodeMenuEntry.ms.ToPrefixString(), Helpers.AddZeroes(dt.Millisecond, 3)) .Replace(ReplCodeMenuEntry.w2.ToPrefixString(), CultureInfo.InvariantCulture.DateTimeFormat.GetDayName(dt.DayOfWeek)) .Replace(ReplCodeMenuEntry.w.ToPrefixString(), CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(dt.DayOfWeek)) .Replace(ReplCodeMenuEntry.pm.ToPrefixString(), (dt.Hour >= 12 ? "PM" : "AM")); sb.Replace(ReplCodeMenuEntry.unix.ToPrefixString(), DateTime.UtcNow.ToUnix().ToString()); if (sb.ToString().Contains(ReplCodeMenuEntry.i.ToPrefixString()) || sb.ToString().Contains(ReplCodeMenuEntry.ib.ToPrefixString()) || sb.ToString().Contains(ReplCodeMenuEntry.ib.ToPrefixString().Replace('b', 'B')) || sb.ToString().Contains(ReplCodeMenuEntry.iAa.ToPrefixString()) || sb.ToString().Contains(ReplCodeMenuEntry.iAa.ToPrefixString().Replace("Aa", "aA")) || sb.ToString().Contains(ReplCodeMenuEntry.ia.ToPrefixString()) || sb.ToString().Contains(ReplCodeMenuEntry.ia.ToPrefixString().Replace('a', 'A')) || sb.ToString().Contains(ReplCodeMenuEntry.ix.ToPrefixString()) || sb.ToString().Contains(ReplCodeMenuEntry.ix.ToPrefixString().Replace('x', 'X'))) { AutoIncrementNumber++; // Base try { foreach (Tuple <string, int[]> entry in ListEntryWithValues(sb.ToString(), ReplCodeMenuEntry.ib.ToPrefixString(), 2)) { sb.Replace(entry.Item1, Helpers.AddZeroes(AutoIncrementNumber.ToBase(entry.Item2[0], Helpers.AlphanumericInverse), entry.Item2[1])); } foreach (Tuple <string, int[]> entry in ListEntryWithValues(sb.ToString(), ReplCodeMenuEntry.ib.ToPrefixString().Replace('b', 'B'), 2)) { sb.Replace(entry.Item1, Helpers.AddZeroes(AutoIncrementNumber.ToBase(entry.Item2[0], Helpers.Alphanumeric), entry.Item2[1])); } } catch { } // Alphanumeric Dual Case (Base 62) foreach (Tuple <string, int> entry in ListEntryWithValue(sb.ToString(), ReplCodeMenuEntry.iAa.ToPrefixString())) { sb.Replace(entry.Item1, Helpers.AddZeroes(AutoIncrementNumber.ToBase(62, Helpers.Alphanumeric), entry.Item2)); } sb.Replace(ReplCodeMenuEntry.iAa.ToPrefixString(), AutoIncrementNumber.ToBase(62, Helpers.Alphanumeric)); // Alphanumeric Dual Case (Base 62) foreach (Tuple <string, int> entry in ListEntryWithValue(sb.ToString(), ReplCodeMenuEntry.iAa.ToPrefixString().Replace("Aa", "aA"))) { sb.Replace(entry.Item1, Helpers.AddZeroes(AutoIncrementNumber.ToBase(62, Helpers.AlphanumericInverse), entry.Item2)); } sb.Replace(ReplCodeMenuEntry.iAa.ToPrefixString().Replace("Aa", "aA"), AutoIncrementNumber.ToBase(62, Helpers.AlphanumericInverse)); // Alphanumeric Single Case (Base 36) foreach (Tuple <string, int> entry in ListEntryWithValue(sb.ToString(), ReplCodeMenuEntry.ia.ToPrefixString())) { sb.Replace(entry.Item1, Helpers.AddZeroes(AutoIncrementNumber.ToBase(36, Helpers.Alphanumeric), entry.Item2).ToLowerInvariant()); } sb.Replace(ReplCodeMenuEntry.ia.ToPrefixString(), AutoIncrementNumber.ToBase(36, Helpers.Alphanumeric).ToLowerInvariant()); // Alphanumeric Single Case Capital (Base 36) foreach (Tuple <string, int> entry in ListEntryWithValue(sb.ToString(), ReplCodeMenuEntry.ia.ToPrefixString().Replace('a', 'A'))) { sb.Replace(entry.Item1, Helpers.AddZeroes(AutoIncrementNumber.ToBase(36, Helpers.Alphanumeric), entry.Item2).ToUpperInvariant()); } sb.Replace(ReplCodeMenuEntry.ia.ToPrefixString().Replace('a', 'A'), AutoIncrementNumber.ToBase(36, Helpers.Alphanumeric).ToUpperInvariant()); // Hexadecimal (Base 16) foreach (Tuple <string, int> entry in ListEntryWithValue(sb.ToString(), ReplCodeMenuEntry.ix.ToPrefixString())) { sb.Replace(entry.Item1, AutoIncrementNumber.ToString("x" + entry.Item2.ToString())); } sb.Replace(ReplCodeMenuEntry.ix.ToPrefixString(), AutoIncrementNumber.ToString("x")); // Hexadecimal Capital (Base 16) foreach (Tuple <string, int> entry in ListEntryWithValue(sb.ToString(), ReplCodeMenuEntry.ix.ToPrefixString().Replace('x', 'X'))) { sb.Replace(entry.Item1, AutoIncrementNumber.ToString("X" + entry.Item2.ToString())); } sb.Replace(ReplCodeMenuEntry.ix.ToPrefixString().Replace('x', 'X'), AutoIncrementNumber.ToString("X")); // Number (Base 10) foreach (Tuple <string, int> entry in ListEntryWithValue(sb.ToString(), ReplCodeMenuEntry.i.ToPrefixString())) { sb.Replace(entry.Item1, AutoIncrementNumber.ToString("d" + entry.Item2.ToString())); } sb.Replace(ReplCodeMenuEntry.i.ToPrefixString(), AutoIncrementNumber.ToString("d")); } sb.Replace(ReplCodeMenuEntry.un.ToPrefixString(), Environment.UserName); sb.Replace(ReplCodeMenuEntry.uln.ToPrefixString(), Environment.UserDomainName); sb.Replace(ReplCodeMenuEntry.cn.ToPrefixString(), Environment.MachineName); if (Type == NameParserType.Text) { sb.Replace(ReplCodeMenuEntry.n.ToPrefixString(), Environment.NewLine); } string result = sb.ToString(); foreach (Tuple <string, int> entry in ListEntryWithValue(result, ReplCodeMenuEntry.rn.ToPrefixString())) { result = result.ReplaceAll(entry.Item1, () => Helpers.RepeatGenerator(entry.Item2, () => Helpers.GetRandomChar(Helpers.Numbers).ToString())); } foreach (Tuple <string, int> entry in ListEntryWithValue(result, ReplCodeMenuEntry.ra.ToPrefixString())) { result = result.ReplaceAll(entry.Item1, () => Helpers.RepeatGenerator(entry.Item2, () => Helpers.GetRandomChar(Helpers.Alphanumeric).ToString())); } foreach (Tuple <string, int> entry in ListEntryWithValue(result, ReplCodeMenuEntry.rx.ToPrefixString())) { result = result.ReplaceAll(entry.Item1, () => Helpers.RepeatGenerator(entry.Item2, () => Helpers.GetRandomChar(Helpers.Hexadecimal.ToLowerInvariant()).ToString())); } foreach (Tuple <string, int> entry in ListEntryWithValue(result, ReplCodeMenuEntry.rx.ToPrefixString().Replace('x', 'X'))) { result = result.ReplaceAll(entry.Item1, () => Helpers.RepeatGenerator(entry.Item2, () => Helpers.GetRandomChar(Helpers.Hexadecimal.ToUpperInvariant()).ToString())); } result = result.ReplaceAll(ReplCodeMenuEntry.rn.ToPrefixString(), () => Helpers.GetRandomChar(Helpers.Numbers).ToString()); result = result.ReplaceAll(ReplCodeMenuEntry.ra.ToPrefixString(), () => Helpers.GetRandomChar(Helpers.Alphanumeric).ToString()); result = result.ReplaceAll(ReplCodeMenuEntry.rx.ToPrefixString(), () => Helpers.GetRandomChar(Helpers.Hexadecimal.ToLowerInvariant()).ToString()); result = result.ReplaceAll(ReplCodeMenuEntry.rx.ToPrefixString().Replace('x', 'X'), () => Helpers.GetRandomChar(Helpers.Hexadecimal.ToUpperInvariant()).ToString()); result = result.ReplaceAll(ReplCodeMenuEntry.guid.ToPrefixString().ToLowerInvariant(), () => Guid.NewGuid().ToString().ToLowerInvariant()); result = result.ReplaceAll(ReplCodeMenuEntry.guid.ToPrefixString().ToUpperInvariant(), () => Guid.NewGuid().ToString().ToUpperInvariant()); if (Type == NameParserType.FolderPath) { result = Helpers.GetValidFolderPath(result); } else if (Type == NameParserType.FileName) { result = Helpers.GetValidFileName(result); } else if (Type == NameParserType.FilePath) { result = Helpers.GetValidFilePath(result); } else if (Type == NameParserType.URL) { result = Helpers.GetValidURL(result); } if (MaxNameLength > 0 && result.Length > MaxNameLength) { result = result.Remove(MaxNameLength); } return(result); }
public void init(ItemBasis[] target) { //Items = target.toArray();//WindowOwner.Parameter.Inventory.toArray(); //if (Items.Length == 0) return; WindowText[,] itemname = new WindowText[Window.RowSize, 1]; for (int i = 0; i < itemname.Length; i++) { itemname[i, 0] = new WindowText(SelectableWindow.EOL, Window.TextAreaPosition + new Vector2(10, WindowConfigure.fontScale(scale * i))); itemname[i, 0].TextAreaSize = new Vector2(Window.TextAreaSize.x - WindowConfigure.fontScale(1.25f), WindowConfigure.fontScale(scale)); } Window.setText(itemname); MaxPageNum = (int)Mathf.Ceil(target.Length / (float)Window.RowSize); //Debug.Log(MaxPageNum); CurrentPageNum = 0; setOnePageTexts(); }
public DungeonCompositorMenu(PlayerController owner,CompositionLeve compositionlevel,int saveslotnumber) : base(rowsize,1,owner,pos,size,"DungeonCompositer") { this.PlayerInventoryItems = owner.Parameter.Inventory.FindAll(item => item is IDungeonMaterial).ToArray(); this.PlayerWareHouseItems = owner.Parameter.WareHouseInventory.FindAll(item => item is IDungeonMaterial).ToArray(); Window.SkipText.Add(""); Window.WindoName = "ItemList"; Window.HighLightVisibleWhenUnFocus = false; SelectedItems = new List<SelectedItemEntity>(); init(PlayerInventoryItems); CurrentCompositionLevel = compositionlevel; SelectedItemTexts = new WindowText[(int)compositionlevel]; CurrentInventory = SelectedInventory.PLAYER; resetPageText(); CurrentFocusMenu = this.Window; ButtonMenu = new SelectableWindow(1, 3,pos + new Vector2(0,this.MainWindow.WindowSize.y + 40), WindowConfigure.createFontScaleForVector(12.5f,1.8f),"Button"); ButtonMenu.HighLightVisibleWhenUnFocus = false; var buttons = new WindowText[3]; var orgpos = ButtonMenu.TextAreaPosition; int idx = 0; buttons[0] = new WindowText(WareHouseLabel, orgpos); var posdelta = buttons[idx].Position + new Vector2(WindowConfigure.fontScale(buttons[idx].Text.Length + 1.2f), 0); buttons[1] = new WindowText(SubmitButton, posdelta); idx++; posdelta = buttons[idx].Position + new Vector2(WindowConfigure.fontScale(buttons[idx].Text.Length + 0.5f), 0); buttons[2] = new WindowText(CancelButton, posdelta); for (int i = 0; i < ButtonMenu.ColumnSize; i++) { ButtonMenu.setText(buttons[i], 0, i); } ButtonMenu.CurrentPageNum = 0; ButtonMenu.SelectColumnIndex = 0; ButtonMenu.SelectRowIndex = 0; /// Vector2 viewpos = this.Window.WindowPosition; viewpos.x += this.Window.WindowSize.x+10; Vector2 viewsize = new Vector2(WindowConfigure.fontScale(12),WindowConfigure.fontScale((int)compositionlevel*1.5f)); SelectedItemWindow = new ViewOnlyWindow(viewpos, viewsize, "SelectedItem"); orgpos = SelectedItemWindow.TextAreaPosition; for (int i = 0; i < SelectedItemTexts.Length; i++) { SelectedItemTexts[i] = new WindowText("",orgpos+new Vector2(0,WindowConfigure.fontScale(i*1.05f))); } SelectedItemWindow.addWindowText(SelectedItemTexts); resetSelectItemTexts(); /// PreviewTexts = new WindowText[PreviewLables.Length]; viewpos = SelectedItemWindow.WindowPosition + new Vector2(0, SelectedItemWindow.WindowSize.y + 80); viewsize = new Vector2(WindowConfigure.fontScale(12), WindowConfigure.fontScale(PreviewTexts.Length+1.5f)); PreviewWindow = new ViewOnlyWindow(viewpos, viewsize, "Preview"); orgpos = PreviewWindow.TextAreaPosition; ///--- for (int i = 0; i < PreviewTexts.Length; i++) { PreviewTexts[i] = new WindowText(PreviewLables[i], orgpos+(new Vector2(0, WindowConfigure.fontScale(1.25f)*i))); } //PreviewTexts[0] = new WindowText(MaxRank,orgpos); //PreviewTexts[1] = new WindowText(MaxFloorNum, PreviewTexts[0].Position + new Vector2(0, WindowConfigure.fontScale(1.25f))); ///--- PreviewWindow.addWindowText(PreviewTexts); /// Compositor = new DungeonCompositor(); SaveSlotNumber = saveslotnumber; this.SubWindows.Add(PreviewWindow); this.SubWindows.Add(SelectedItemWindow); this.SubWindows.Add(ButtonMenu); /// SubmitCaption = new ViewOnlyWindow(submitpos, submitsize); SubmitCaption.addWindowText(new WindowText(SubmitText,SubmitCaption.TextAreaPosition)); SubmitMenu = new YesNoMenu(owner, SubmitCaption); SubmitMenu.YesAct = delegate () { Debug.Log("Yes"); MenuContoller.doDisableMenu(SubmitMenu); StringInputSystem.initInputMenu(owner, 12); StringInputSystem.menuOpen((text,iscancel) => { if (iscancel) return; var dgparam = Compositor.createParameter(text); GameController.DgParameterTable[SaveSlotNumber] = dgparam; for (int i = 0; i < GameController.DgParameterTable.TableSize; i++) { var param = GameController.DgParameterTable[i]; string name; if (param == null) { name = "NULL"; } else { name = param.DungeonName; } Debug.LogFormat("[{0}]:{1}", i, name); } MenuContoller.doDisableAllMenu(); }); }; SubmitMenu.NoAct = delegate () { Debug.Log("No"); SubmitMenu.cancelclose(); changeFocus(WindowFocus.BUTTON); }; /// if (PlayerInventoryItems.Length != 0) { changeFocus(WindowFocus.ITEM); } else { changeFocus(WindowFocus.BUTTON); } setOnePageTexts(); updatePreview(); }
public override void LoadContent(ContentManager content) { Background = content.Load <Texture2D>("Results Screen 2"); TextureCharacterIdle = content.Load <Texture2D>("Characters/Rayo/Rayo"); TextureCharacterTalk1 = content.Load <Texture2D>("Characters/Rayo/RayoTalk1"); TextureCharacterTalk2 = content.Load <Texture2D>("Characters/Rayo/RayoTalk2"); TextureWindow = content.Load <Texture2D>("Textures/UI/Window1Anim"); fontJetset = content.Load <SpriteFont>("Fonts/JetSet"); song = content.Load <Song>("Music/Menu/result_bgm"); MediaPlayer.IsRepeating = true; MediaPlayer.Play(song); character = new Character(TextureCharacterIdle, TextureCharacterTalk1, TextureCharacterTalk2, TextureWindow, fontJetset, 1000, -100); UInt64 globalpoints = 0; // Earned points that will be added to the global total. string charactermessage; if (countBreak == 0 && accuracy >= 100.0f) // X RANK { charactermessage = "I... I don't know what to say...\nYou cleared the song with a completely\nperfect rating!\nIt really doesn't get better than that!"; globalpoints += 5; } else if (accuracy >= 95.0f) // S RANK { charactermessage = "Wow! You're super accurate!\nYou have an amazing sense of rhythm!"; globalpoints += 3; } else if (accuracy >= 90.0f) // A RANK { charactermessage = "You played really well, that was great!\nI always enjoy performing with you!"; globalpoints += 2; } else if (accuracy >= 80.0f) // B RANK { charactermessage = "Nice one! That was a solid performance.\nI'm excited to see what you play next!"; globalpoints += 1; } else if (accuracy >= 70.0f) // C RANK { charactermessage = "Woah, just made it!\nThat one was hard, but you got through!\nI never gave up hope!"; globalpoints += 1; } else // D RANMK { charactermessage = "Oops... that's okay though.\nGive it another shot, you can do it!"; globalpoints = 0; } if (countBreak == 0 && accuracy < 100.0f) // MAX CHAIN { charactermessage = "Amazing! you got a full chain!\nYou're a really skilled performer!\nUm... would you show me again sometime?"; globalpoints += 1; } character.Talk(charactermessage, 360); // Try connecting to Firebase server try { client = new FireSharp.FirebaseClient(fcon); windowText = new WindowText(TextureWindow, fontJetset, "\nCommunicating with server...", 744, 100); // Get the current amount of global points var getter = client.Get("GlobalData/Total Points"); UInt64 currenttotal = getter.ResultAs <UInt64>(); windowText = new WindowText(TextureWindow, fontJetset, "\nData get successful.", 744, 100); // Add the amount of points the user scored this game UInt64 newtotal = currenttotal + globalpoints; // Set the global points to the newly updated value var setter = client.Set("GlobalData/Total Points", newtotal); if (globalpoints > 0) { windowText = new WindowText(TextureWindow, fontJetset, "You earned " + globalpoints + " points this round.\n" + "Global total: " + newtotal + "\n" + "Thank you for your contribution, pilot.\n" + "We look forward to all of your hard work.\n" + "--Mission Control", 744, 100); } else if (globalpoints == 0) { windowText = new WindowText(TextureWindow, fontJetset, "You earned " + globalpoints + " points this round.\n" + "Global total: " + newtotal + "\n" + "Keep practicing, pilot. We know you can do it.\n" + "We look forward to all of your hard work.\n" + "--Mission Control", 744, 100); } } catch { windowText = new WindowText(TextureWindow, fontJetset, "Error connecting to server.", 744, 100); } }
protected override void setMenuLabels() { List<string> list = new List<string>(8); if (Pot.BasisParameter.RemovableItem) { list.Add(pickout); if (MultiSelectedItems.Count == 0) { if (SelectedObject is UsableItemBasis) { list.Add((SelectedObject as UsableItemBasis).UseTimeLabel); if (SelectedObject is PotBasis) list.Add(lookinside); } if (CurrentMode == InventoryMode.PLYAER) { if (WindowOwner.OnItem) { list.Add(trade); } else { list.Add(put); } } if (!(SelectedObject is ShotItemBasis)) list.Add(throwitem); } } if (MultiSelectedItems.Count == 0) { if (SelectedObject.CurrentDetectionLevel == ItemBasis.DetectionLevel.UNKWON) list.Add(term); } list.Add(description); list.RemoveAll(x => x.Length == 0); WindowText[,] wts = new WindowText[list.Count, 1]; Vector2 initpos = Window.TextAreaPosition; for (int i = 0; i < wts.Length; i++) { wts[i, 0] = new WindowText(list[i], initpos + new Vector2(0, WindowConfigure.fontScale(1.1f * i))); } Vector2 size = new Vector2(WindowConfigure.fontScale(4.5f), WindowConfigure.fontScale(wts.Length * 1.5f)); Window = new SelectableWindow(wts, Window.WindowPosition, size, "SelectedItemUseMenu"); }
public string Parse(string pattern) { if (string.IsNullOrEmpty(pattern)) { return(""); } StringBuilder sb = new StringBuilder(pattern); if (WindowText != null) { string windowText = WindowText.Trim().Replace(' ', '_'); if (MaxTitleLength > 0 && windowText.Length > MaxTitleLength) { windowText = windowText.Remove(MaxTitleLength); } sb.Replace(CodeMenuEntryFilename.t.ToPrefixString(), windowText); } if (ProcessName != null) { string processName = ProcessName.Trim().Replace(' ', '_'); sb.Replace(CodeMenuEntryFilename.pn.ToPrefixString(), processName); } string width = "", height = ""; if (ImageWidth > 0) { width = ImageWidth.ToString(); } if (ImageHeight > 0) { height = ImageHeight.ToString(); } sb.Replace(CodeMenuEntryFilename.width.ToPrefixString(), width); sb.Replace(CodeMenuEntryFilename.height.ToPrefixString(), height); DateTime dt = DateTime.Now; if (CustomTimeZone != null) { dt = TimeZoneInfo.ConvertTime(dt, CustomTimeZone); } sb.Replace(CodeMenuEntryFilename.mon2.ToPrefixString(), CultureInfo.InvariantCulture.DateTimeFormat.GetMonthName(dt.Month)) .Replace(CodeMenuEntryFilename.mon.ToPrefixString(), CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(dt.Month)) .Replace(CodeMenuEntryFilename.yy.ToPrefixString(), dt.ToString("yy")) .Replace(CodeMenuEntryFilename.y.ToPrefixString(), dt.Year.ToString()) .Replace(CodeMenuEntryFilename.mo.ToPrefixString(), Helpers.AddZeroes(dt.Month)) .Replace(CodeMenuEntryFilename.d.ToPrefixString(), Helpers.AddZeroes(dt.Day)); string hour; if (sb.ToString().Contains(CodeMenuEntryFilename.pm.ToPrefixString())) { hour = Helpers.HourTo12(dt.Hour); } else { hour = Helpers.AddZeroes(dt.Hour); } sb.Replace(CodeMenuEntryFilename.h.ToPrefixString(), hour) .Replace(CodeMenuEntryFilename.mi.ToPrefixString(), Helpers.AddZeroes(dt.Minute)) .Replace(CodeMenuEntryFilename.s.ToPrefixString(), Helpers.AddZeroes(dt.Second)) .Replace(CodeMenuEntryFilename.ms.ToPrefixString(), Helpers.AddZeroes(dt.Millisecond, 3)) .Replace(CodeMenuEntryFilename.wy.ToPrefixString(), dt.WeekOfYear().ToString()) .Replace(CodeMenuEntryFilename.w2.ToPrefixString(), CultureInfo.InvariantCulture.DateTimeFormat.GetDayName(dt.DayOfWeek)) .Replace(CodeMenuEntryFilename.w.ToPrefixString(), CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(dt.DayOfWeek)) .Replace(CodeMenuEntryFilename.pm.ToPrefixString(), dt.Hour >= 12 ? "PM" : "AM"); sb.Replace(CodeMenuEntryFilename.unix.ToPrefixString(), DateTime.UtcNow.ToUnix().ToString()); if (sb.ToString().Contains(CodeMenuEntryFilename.i.ToPrefixString()) || sb.ToString().Contains(CodeMenuEntryFilename.ib.ToPrefixString()) || sb.ToString().Contains(CodeMenuEntryFilename.ib.ToPrefixString().Replace('b', 'B')) || sb.ToString().Contains(CodeMenuEntryFilename.iAa.ToPrefixString()) || sb.ToString().Contains(CodeMenuEntryFilename.iAa.ToPrefixString().Replace("Aa", "aA")) || sb.ToString().Contains(CodeMenuEntryFilename.ia.ToPrefixString()) || sb.ToString().Contains(CodeMenuEntryFilename.ia.ToPrefixString().Replace('a', 'A')) || sb.ToString().Contains(CodeMenuEntryFilename.ix.ToPrefixString()) || sb.ToString().Contains(CodeMenuEntryFilename.ix.ToPrefixString().Replace('x', 'X'))) { AutoIncrementNumber++; // Base try { foreach (Tuple <string, int[]> entry in ListEntryWithValues(sb.ToString(), CodeMenuEntryFilename.ib.ToPrefixString(), 2)) { sb.Replace(entry.Item1, Helpers.AddZeroes(AutoIncrementNumber.ToBase(entry.Item2[0], Helpers.AlphanumericInverse), entry.Item2[1])); } foreach (Tuple <string, int[]> entry in ListEntryWithValues(sb.ToString(), CodeMenuEntryFilename.ib.ToPrefixString().Replace('b', 'B'), 2)) { sb.Replace(entry.Item1, Helpers.AddZeroes(AutoIncrementNumber.ToBase(entry.Item2[0], Helpers.Alphanumeric), entry.Item2[1])); } } catch { } // Alphanumeric Dual Case (Base 62) foreach (Tuple <string, int> entry in ListEntryWithValue(sb.ToString(), CodeMenuEntryFilename.iAa.ToPrefixString())) { sb.Replace(entry.Item1, Helpers.AddZeroes(AutoIncrementNumber.ToBase(62, Helpers.Alphanumeric), entry.Item2)); } sb.Replace(CodeMenuEntryFilename.iAa.ToPrefixString(), AutoIncrementNumber.ToBase(62, Helpers.Alphanumeric)); // Alphanumeric Dual Case (Base 62) foreach (Tuple <string, int> entry in ListEntryWithValue(sb.ToString(), CodeMenuEntryFilename.iAa.ToPrefixString().Replace("Aa", "aA"))) { sb.Replace(entry.Item1, Helpers.AddZeroes(AutoIncrementNumber.ToBase(62, Helpers.AlphanumericInverse), entry.Item2)); } sb.Replace(CodeMenuEntryFilename.iAa.ToPrefixString().Replace("Aa", "aA"), AutoIncrementNumber.ToBase(62, Helpers.AlphanumericInverse)); // Alphanumeric Single Case (Base 36) foreach (Tuple <string, int> entry in ListEntryWithValue(sb.ToString(), CodeMenuEntryFilename.ia.ToPrefixString())) { sb.Replace(entry.Item1, Helpers.AddZeroes(AutoIncrementNumber.ToBase(36, Helpers.Alphanumeric), entry.Item2).ToLowerInvariant()); } sb.Replace(CodeMenuEntryFilename.ia.ToPrefixString(), AutoIncrementNumber.ToBase(36, Helpers.Alphanumeric).ToLowerInvariant()); // Alphanumeric Single Case Capital (Base 36) foreach (Tuple <string, int> entry in ListEntryWithValue(sb.ToString(), CodeMenuEntryFilename.ia.ToPrefixString().Replace('a', 'A'))) { sb.Replace(entry.Item1, Helpers.AddZeroes(AutoIncrementNumber.ToBase(36, Helpers.Alphanumeric), entry.Item2).ToUpperInvariant()); } sb.Replace(CodeMenuEntryFilename.ia.ToPrefixString().Replace('a', 'A'), AutoIncrementNumber.ToBase(36, Helpers.Alphanumeric).ToUpperInvariant()); // Hexadecimal (Base 16) foreach (Tuple <string, int> entry in ListEntryWithValue(sb.ToString(), CodeMenuEntryFilename.ix.ToPrefixString())) { sb.Replace(entry.Item1, AutoIncrementNumber.ToString("x" + entry.Item2.ToString())); } sb.Replace(CodeMenuEntryFilename.ix.ToPrefixString(), AutoIncrementNumber.ToString("x")); // Hexadecimal Capital (Base 16) foreach (Tuple <string, int> entry in ListEntryWithValue(sb.ToString(), CodeMenuEntryFilename.ix.ToPrefixString().Replace('x', 'X'))) { sb.Replace(entry.Item1, AutoIncrementNumber.ToString("X" + entry.Item2.ToString())); } sb.Replace(CodeMenuEntryFilename.ix.ToPrefixString().Replace('x', 'X'), AutoIncrementNumber.ToString("X")); // Number (Base 10) foreach (Tuple <string, int> entry in ListEntryWithValue(sb.ToString(), CodeMenuEntryFilename.i.ToPrefixString())) { sb.Replace(entry.Item1, AutoIncrementNumber.ToString("d" + entry.Item2.ToString())); } sb.Replace(CodeMenuEntryFilename.i.ToPrefixString(), AutoIncrementNumber.ToString("d")); } sb.Replace(CodeMenuEntryFilename.un.ToPrefixString(), Environment.UserName); sb.Replace(CodeMenuEntryFilename.uln.ToPrefixString(), Environment.UserDomainName); sb.Replace(CodeMenuEntryFilename.cn.ToPrefixString(), Environment.MachineName); if (Type == NameParserType.Text) { sb.Replace(CodeMenuEntryFilename.n.ToPrefixString(), Environment.NewLine); } string result = sb.ToString(); result = result.ReplaceAll(CodeMenuEntryFilename.radjective.ToPrefixString(), () => CultureInfo.InvariantCulture.TextInfo.ToTitleCase(Helpers.GetRandomLine(Resources.adjectives))); result = result.ReplaceAll(CodeMenuEntryFilename.ranimal.ToPrefixString(), () => CultureInfo.InvariantCulture.TextInfo.ToTitleCase(Helpers.GetRandomLine(Resources.animals))); foreach (Tuple <string, string> entry in ListEntryWithArgument(result, CodeMenuEntryFilename.rf.ToPrefixString())) { result = result.ReplaceAll(entry.Item1, () => { try { string path = entry.Item2; if (Helpers.IsTextFile(path)) { return(Helpers.GetRandomLineFromFile(path)); } else { throw new Exception("Valid text file path is required."); } } catch (Exception e) when(IsPreviewMode) { return(e.Message); } }); } foreach (Tuple <string, int> entry in ListEntryWithValue(result, CodeMenuEntryFilename.rna.ToPrefixString())) { result = result.ReplaceAll(entry.Item1, () => Helpers.RepeatGenerator(entry.Item2, () => Helpers.GetRandomChar(Helpers.Base56).ToString())); } foreach (Tuple <string, int> entry in ListEntryWithValue(result, CodeMenuEntryFilename.rn.ToPrefixString())) { result = result.ReplaceAll(entry.Item1, () => Helpers.RepeatGenerator(entry.Item2, () => Helpers.GetRandomChar(Helpers.Numbers).ToString())); } foreach (Tuple <string, int> entry in ListEntryWithValue(result, CodeMenuEntryFilename.ra.ToPrefixString())) { result = result.ReplaceAll(entry.Item1, () => Helpers.RepeatGenerator(entry.Item2, () => Helpers.GetRandomChar(Helpers.Alphanumeric).ToString())); } foreach (Tuple <string, int> entry in ListEntryWithValue(result, CodeMenuEntryFilename.rx.ToPrefixString())) { result = result.ReplaceAll(entry.Item1, () => Helpers.RepeatGenerator(entry.Item2, () => Helpers.GetRandomChar(Helpers.Hexadecimal.ToLowerInvariant()).ToString())); } foreach (Tuple <string, int> entry in ListEntryWithValue(result, CodeMenuEntryFilename.rx.ToPrefixString().Replace('x', 'X'))) { result = result.ReplaceAll(entry.Item1, () => Helpers.RepeatGenerator(entry.Item2, () => Helpers.GetRandomChar(Helpers.Hexadecimal.ToUpperInvariant()).ToString())); } foreach (Tuple <string, int> entry in ListEntryWithValue(result, CodeMenuEntryFilename.remoji.ToPrefixString())) { result = result.ReplaceAll(entry.Item1, () => Helpers.RepeatGenerator(entry.Item2, () => MathHelpers.CryptoRandomPick(Emoji.Emojis))); } result = result.ReplaceAll(CodeMenuEntryFilename.rna.ToPrefixString(), () => Helpers.GetRandomChar(Helpers.Base56).ToString()); result = result.ReplaceAll(CodeMenuEntryFilename.rn.ToPrefixString(), () => Helpers.GetRandomChar(Helpers.Numbers).ToString()); result = result.ReplaceAll(CodeMenuEntryFilename.ra.ToPrefixString(), () => Helpers.GetRandomChar(Helpers.Alphanumeric).ToString()); result = result.ReplaceAll(CodeMenuEntryFilename.rx.ToPrefixString(), () => Helpers.GetRandomChar(Helpers.Hexadecimal.ToLowerInvariant()).ToString()); result = result.ReplaceAll(CodeMenuEntryFilename.rx.ToPrefixString().Replace('x', 'X'), () => Helpers.GetRandomChar(Helpers.Hexadecimal.ToUpperInvariant()).ToString()); result = result.ReplaceAll(CodeMenuEntryFilename.guid.ToPrefixString().ToLowerInvariant(), () => Guid.NewGuid().ToString().ToLowerInvariant()); result = result.ReplaceAll(CodeMenuEntryFilename.guid.ToPrefixString().ToUpperInvariant(), () => Guid.NewGuid().ToString().ToUpperInvariant()); result = result.ReplaceAll(CodeMenuEntryFilename.remoji.ToPrefixString(), () => MathHelpers.CryptoRandomPick(Emoji.Emojis)); if (Type == NameParserType.FolderPath) { result = Helpers.GetValidFolderPath(result); } else if (Type == NameParserType.FileName) { result = Helpers.GetValidFileName(result); } else if (Type == NameParserType.FilePath) { result = Helpers.GetValidFilePath(result); } else if (Type == NameParserType.URL) { result = Helpers.GetValidURL(result); } if (MaxNameLength > 0 && result.Length > MaxNameLength) { result = result.Remove(MaxNameLength); } return(result); }
public void addWindowText(WindowText[] text) { texts.AddRange(text); }