using System.Collections; using System.Collections.Generic; using UnityEngine; using Photon.Pun; using System; public class SelectDNACondition : MonoBehaviourPunCallbacks { public void SetUp (Player SelectPlayer, CardSource targetDNA, Func SelectDNACoroutine, bool IsLocal = false) { _selectPlayer = SelectPlayer; _targetDNA = targetDNA; _selectDNACoroutine = SelectDNACoroutine; _notDoSync = false; _isDigivolutionCost = false; _isLocal = IsLocal; } Player _selectPlayer = null; CardSource _targetDNA = null; Func _selectDNACoroutine = null; List _candidates = new List(); public int _selectedCount = 0; bool _notDoSync = false; bool _isDigivolutionCost = false; bool _isLocal = false; public void ResetSelectDNAConditionClass() { _selectedCount = 0; } public IEnumerator Activate() { if (!_notDoSync) { //yield return GManager.instance.photonWaitController.StartWait("SelectDNACondition"); } if (_targetDNA.jogressCondition.Count > 1) { if (_targetDNA.jogressCondition.Count == 1) { _selectedCount = 0; } else { List> selectionElements = new List>(); for (int i = 0; i < _targetDNA.jogressCondition.Count; i++) { string message = $""; for (int e = 0; e < _targetDNA.jogressCondition[i].elements.Length; e++) { message += $"{_targetDNA.jogressCondition[i].elements[e].SelectMessage}"; if (e < _targetDNA.jogressCondition[i].elements.Length - 1) message += " + "; } selectionElements.Add(new(message: $"{message}", value: i, spriteIndex: 0)); } string selectPlayerMessage = "Which DNA do you want?"; string notSelectPlayerMessage = "The opponent is choosing from which DNA to do."; GManager.instance.userSelectionManager.SetIntSelection(selectionElements: selectionElements, selectPlayer: _targetDNA.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage, _isLocal); yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect()); _selectedCount = GManager.instance.userSelectionManager.SelectedIntValue; } } GManager.instance.commandText.CloseCommandText(); yield return new WaitWhile(() => GManager.instance.commandText.gameObject.activeSelf); if (_selectDNACoroutine != null) { yield return ContinuousController.instance.StartCoroutine(_selectDNACoroutine(_selectedCount)); } } }