public void SelectPattern(DesignPattern pattern) { if (pattern == Pattern) { return; } Controller.Instance.ConfirmationPopup.Show("<align=\"center\"><#827157>,,<#12c7ce>" + pattern.Name + "<#827157>‘‘\r\nwill be removed by this", () => { pattern.CopyFrom(Pattern); _IsFinished = true; }, () => { _IsFinished = true; }); }
public void SelectPattern(DesignPattern pattern) { if (pattern == Pattern) { return; } var backup = new DesignPattern(); if (Pattern.IsPro) { backup.CopyFrom(Controller.Instance.CurrentSavegame.ProDesignPatterns[Pattern.Index]); Controller.Instance.CurrentSavegame.ProDesignPatterns[Pattern.Index].CopyFrom(Controller.Instance.CurrentSavegame.ProDesignPatterns[pattern.Index]); Controller.Instance.CurrentSavegame.ProDesignPatterns[pattern.Index].CopyFrom(backup); } else { backup.CopyFrom(Controller.Instance.CurrentSavegame.DesignPatterns[Pattern.Index]); Controller.Instance.CurrentSavegame.DesignPatterns[Pattern.Index].CopyFrom(Controller.Instance.CurrentSavegame.DesignPatterns[pattern.Index]); Controller.Instance.CurrentSavegame.DesignPatterns[pattern.Index].CopyFrom(backup); } _IsFinished = true; }
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()); }