public void Set(NextLocation nextLocation, bool last) { this.nextLocation = nextLocation; textDisplay.text = nextLocation.Decision; dashedLine.gameObject.SetActive(!last); }
public void ShowNextLocationInfo(NextLocation nextLocation) { nextLocationInfoLocationNameText.text = nextLocation.LocationName; SetChooseLocationAreaVisibility(false); }
public static Location Parse(string qrCodeText, DateTime scanDateTime) { if (Separators == null) { Separators = new string[EndOfLineMarkers.Length]; for (var i = 0; i < Separators.Length; i++) { var endOfLineMarker = EndOfLineMarkers[i]; Separators[i] = endOfLineMarker + SeparatorBase + endOfLineMarker; } } try { var formatVersionIndex = qrCodeText.LastIndexOf(FormatVersionPrefix, StringComparison.InvariantCulture); if (formatVersionIndex == -1) { Debug.Log("QR code not recognized: Didn't find the format version."); return(null); } var formatVersion = int.Parse(qrCodeText.Substring(formatVersionIndex + FormatVersionPrefix.Length)); var parts = qrCodeText.Split(Separators, StringSplitOptions.None); if (parts.Length != 4) { Debug.LogError("QR code not recognized: Wrong parts length (" + parts.Length + ")."); return(null); } var sceneName = parts[0]; var description = parts[1]; /* * CustomHtmlFormatter.SetIfNotSet(); * description = CommonMarkConverter.Convert(description); * description = description.Replace("<p>", "").Replace("</p>", "\n").Trim(); */ var nextLocationsLines = (parts[2].Length > 0) ? parts[2].Split(EndOfLineMarkers, StringSplitOptions.None) : new string[0]; var nextLocations = new NextLocation[nextLocationsLines.Length]; for (var i = 0; i < nextLocationsLines.Length; i++) { var nextLocationLine = nextLocationsLines[i]; var matches = Regex.Match(nextLocationLine, NextLocationRegExp); if (matches.Success && (matches.Groups.Count == 3)) { var groups = matches.Groups; nextLocations[i] = new NextLocation(groups[1].Value, groups[2].Value); } else { Debug.LogError("QR code not recognized: Couldn't read next location \"" + nextLocationLine + "\n"); return(null); } } var metaInfoLines = parts[3].Split('\n'); var gameNameLine = metaInfoLines[0]; var gameName = gameNameLine.Substring(GameNamePrefix.Length); return(new Location(qrCodeText, scanDateTime, formatVersion, gameName, sceneName, description, nextLocations)); } catch (Exception e) { Debug.LogError(e); return(null); } }