예제 #1
0
 public void Create(string m, Action Confirm_, Action Cancel_, PopupOption option_)
 {
     Performance.RecordProfiler(nameof(MessagePopup <M>));
     _OnConfirm = Confirm_;
     _OnCancel  = Cancel_;
     if (Cancel_ == null)
     {
         UnityExtension.TrySetActive(_cancel, false);
         _confirm.transform.localPosition = _positionSingle;
     }
     else
     {
         UnityExtension.TrySetActive(_cancel, true);
         _confirm.transform.localPosition = _positionBoth;
     }
     _message.Text = string.IsNullOrEmpty(m) ? "<no message>" : m.Replace("\\n", "\n");
     option_.Modify?.Invoke(_content);
     option_.Modify = null;
     _obj.SetActive(true);
     if (option_.sync != null)
     {
         MainLoop.OnUpdate.Add(_ => Sync(option_.sync.position), this);
     }
     _option = option_;
     Performance.End(nameof(MessagePopup <M>));
 }