Ejemplo n.º 1
0
        private async Task Parse(StandardLevelDetailViewController standardLevelDetailViewController)
        {
            if (!_didParse)
            {
                var info = await _platformUserModel.GetUserInfo();

                CanVote = true;

                _siraLog.Debug("Doing Initial BSML Parsing of the Detail View");
                _siraLog.Debug("Getting Manifest Stream");
                using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("DiTails.Views.detail-view.bsml"))
                    using (var reader = new StreamReader(stream))
                    {
                        _siraLog.Debug("Reading Manifest Stream");
                        _bsmlContent = await reader.ReadToEndAsync();
                    }
                if (!string.IsNullOrWhiteSpace(_bsmlContent))
                {
                    _siraLog.Debug("Parsing Details");
                    try
                    {
                        BSMLParser.instance.Parse(_bsmlContent, standardLevelDetailViewController.gameObject, this);
                    }
                    catch (Exception e)
                    {
                        _siraLog.Critical(e);
                    }
                    if (rootTransform != null && mainModalTransform != null)
                    {
                        rootTransform.gameObject.name      = "DiTailsDetailView";
                        mainModalTransform.gameObject.name = "DiTailsMainModal";
                    }
                    if (descriptionModalTransform != null && artworkModalTransform != null)
                    {
                        descriptionModalTransform.gameObject.name = "DiTailsDescriptionModal";
                        artworkModalTransform.gameObject.name     = "DiTailsArtworkModal";
                    }
                    if (panel1Transform != null && mainOkButton != null)
                    {
                        var buttons = panel1Transform.GetComponentsInChildren <UnityEngine.UI.Button>(true).ToList();
                        buttons.Add(mainOkButton);
                        foreach (var button in buttons)
                        {
                            foreach (var image in button.GetComponentsInChildren <ImageView>(true))
                            {
                                var view = image;
                                IMAGESKEW(ref view) = 0f;
                                image.SetVerticesDirty();
                            }
                            foreach (var text in button.GetComponentsInChildren <TMP_Text>(true))
                            {
                                text.alignment = TextAlignmentOptions.Center;
                                if (text.fontStyle.HasFlag(FontStyles.Italic))
                                {
                                    text.fontStyle -= FontStyles.Italic;
                                }
                            }
                        }
                    }
                    _siraLog.Debug("Parsing Complete");
                    _didParse = true;
                }
            }
        }