public void ShowDesign(DesignServer.Pattern pattern, System.Action confirm) { if (confirm == null && Cancel == null && Confirm == null && ConfirmImport == null) { return; } // we are coming from items if (confirm == null) { SelectedPattern = pattern; CancelPop.PopOut(); } if (CurrentPreview != null) { CurrentPreview.Dispose(); CurrentPreview = null; } if (CurrentUpscaledPreview != null) { CurrentUpscaledPreview.Dispose(); CurrentUpscaledPreview = null; } this.Pattern = pattern; this.Confirm = confirm; this.DesignName.Open(); this.DesignName.Text = Pattern.Name; this.CreatorName.text = Pattern.Creator; var t = (DesignPattern.TypeEnum)Pattern.Type; try { var acnhFileFormat = new ACNHFileFormat(pattern.Bytes); if (acnhFileFormat.IsPro) { DesignPattern = new ProDesignPattern(); DesignPattern.CopyFrom(acnhFileFormat); } else { DesignPattern = new SimpleDesignPattern(); DesignPattern.CopyFrom(acnhFileFormat); } CurrentPreview = DesignPattern.GetBitmap(); CurrentPreview.Apply(); CurrentPreview.Texture.filterMode = FilterMode.Point; CurrentPreview.Texture.wrapMode = TextureWrapMode.Clamp; CurrentUpscaledPreview = new TextureBitmap(CurrentPreview.Width * 4, CurrentPreview.Height * 4); int[] src = CurrentPreview.ConvertToInt(); int[] target = new int[CurrentUpscaledPreview.Width * CurrentUpscaledPreview.Height]; var scaler = new xBRZScaler(); scaler.ScaleImage(4, src, target, CurrentPreview.Width, CurrentPreview.Height, new xBRZNet.ScalerCfg(), 0, int.MaxValue); CurrentUpscaledPreview.FromInt(target); CurrentUpscaledPreview.Apply(); Previews.AllPreviews[DesignPattern.Type].SetTexture(CurrentUpscaledPreview.Texture); Previews.AllPreviews[DesignPattern.Type].Render(); PatternPreview.texture = CurrentPreview.Texture; DesignPreview.texture = Previews.AllPreviews[DesignPattern.Type].Camera.targetTexture; this.DesignType.text = DesignPatternInformation.Types[t].Name; this.DesignCode.text = "DE-" + pattern.Code; } catch (System.Exception e) { } StartCoroutine(ShowDesignCoroutine()); }