public Neocom(MemoryStruct.INeocom raw) { this.Raw = raw; if (null == raw) { return; } var ButtonWithTexturePathMatch = new Func <string, MemoryStruct.IUIElement>(texturePathRegexPattern => raw?.Button?.FirstOrDefault(candidate => candidate?.TexturePath?.RegexMatchSuccess(texturePathRegexPattern, System.Text.RegularExpressions.RegexOptions.IgnoreCase) ?? false)); PeopleAndPlacesButton = ButtonWithTexturePathMatch("peopleandplaces"); ChatButton = ButtonWithTexturePathMatch("chat"); MailButton = ButtonWithTexturePathMatch("mail"); FittingButton = ButtonWithTexturePathMatch("fitting"); InventoryButton = ButtonWithTexturePathMatch("items"); MarketButton = ButtonWithTexturePathMatch("market"); WalletButton = ButtonWithTexturePathMatch("wallet"); }
static public IWindowAgentDialogue Parse(this MemoryStruct.IWindowAgentDialogue window) { if (null == window) { return(null); } IWindowAgentPane LeftPane = null; IWindowAgentPane RightPane = null; MemoryStruct.IUIElement AcceptButton = null; MemoryStruct.IUIElement DeclineButton = null; MemoryStruct.IUIElement CloseButton = null; MemoryStruct.IUIElement CompleteButton = null; MemoryStruct.IUIElement QuitButton = null; MemoryStruct.IUIElement DelayButton = null; DialogueMission Mission = null; try { LeftPane = window?.LeftPane?.Parse(); RightPane = window?.RightPane?.Parse(); var Objective = RightPane?.Objective; Mission = null == Objective ? null : new DialogueMission() { Title = LeftPane?.Caption, Objective = Objective, Reward = RightPane?.Reward, }; var ButtonContainingTextIgnoringCase = new Func <string, MemoryStruct.IUIElement>( labelText => window?.ButtonText?.FirstOrDefault(button => button?.Text?.ToLower()?.Contains(labelText?.ToLower()) ?? false)); AcceptButton = ButtonContainingTextIgnoringCase("Accept"); DeclineButton = ButtonContainingTextIgnoringCase("Decline"); CloseButton = ButtonContainingTextIgnoringCase("Close"); CompleteButton = ButtonContainingTextIgnoringCase("Complete"); QuitButton = ButtonContainingTextIgnoringCase("Quit"); DelayButton = ButtonContainingTextIgnoringCase("Delay"); } catch { } return(new WindowAgentDialogue() { Raw = window, LeftPane = LeftPane, RightPane = RightPane, Mission = Mission, AcceptButton = AcceptButton, DeclineButton = DeclineButton, CloseButton = CloseButton, CompleteButton = CompleteButton, QuitButton = QuitButton, DelayButton = DelayButton, DeclineWithoutStandingLossAvailable = LeftPane?.Html?.DeclineWithoutStandingLossAvailableFromDialogueHtml(), DeclineWithoutStandingLossWait = LeftPane?.Html?.DeclineWithoutStandingLossWaitTimeFromDialogueHtml(), }); }
public Neocom(MemoryStruct.INeocom Raw) { this.Raw = Raw; if (null == Raw) { return; } var ButtonWithTexturePathMatch = new Func<string, MemoryStruct.IUIElement>(TexturePathRegexPattern => Raw?.Button?.FirstOrDefault(candidate => candidate?.TexturePath?.RegexMatchSuccess(TexturePathRegexPattern, System.Text.RegularExpressions.RegexOptions.IgnoreCase) ?? false)); PeopleAndPlacesButton = ButtonWithTexturePathMatch("peopleandplaces"); ChatButton = ButtonWithTexturePathMatch("chat"); MailButton = ButtonWithTexturePathMatch("mail"); FittingButton = ButtonWithTexturePathMatch("fitting"); InventoryButton = ButtonWithTexturePathMatch("items"); MarketButton = ButtonWithTexturePathMatch("market"); }