You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			67 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			C#
		
	
			
		
		
	
	
			67 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			C#
		
	
| using System.Collections.Generic;
 | |
| using UnityEngine;
 | |
| using Articy.Unity;
 | |
| using Articy.Touhou;
 | |
| using Articy.Unity.Interfaces;
 | |
| using Game;
 | |
| 
 | |
| public class DramaFlowPlayer : MonoBehaviour, IArticyFlowPlayerCallbacks
 | |
| {
 | |
|     private IList<Branch> _nextbranchs;
 | |
|     private List<string> _choices = new List<string>();
 | |
|     public void OnFlowPlayerPaused(IFlowObject aObject)
 | |
|     {
 | |
|         var dialog = aObject as DialogueFragment;
 | |
|         if (dialog != null)
 | |
|         {
 | |
|             var character = dialog.Speaker as DramaCharacterTemplete;
 | |
|             var pic = character.Template.DramaCharacter.Icon as IAsset;
 | |
|             Util.SendDialog(character.Template.DramaCharacter.Name, dialog.Text, character.Template.DramaCharacter.Icon);
 | |
|         }
 | |
|     }
 | |
|     public void OnBranchesUpdated(IList<Branch> aBranches)
 | |
|     {
 | |
|         if (aBranches.Count > 0)
 | |
|         {
 | |
|             _nextbranchs = aBranches;
 | |
|             if (_nextbranchs.Count > 1)
 | |
|             {
 | |
|                 _choices.Clear();
 | |
|                 foreach (var item in aBranches)
 | |
|                 {
 | |
|                     if (!item.IsValid) continue;
 | |
|                     var target = item.Target as DialogueFragment;
 | |
|                     _choices.Add(target.MenuText);
 | |
|                 }
 | |
|                 Util.SendDialogChoice(_choices);
 | |
|             }
 | |
|         }
 | |
|         else
 | |
|         {
 | |
|             _nextbranchs = null;
 | |
|             Util.EndDrama();
 | |
|         }
 | |
|     }
 | |
|     public void NextDrama()
 | |
|     {
 | |
|         if (_nextbranchs != null && _nextbranchs.Count > 0)
 | |
|         {
 | |
|             GetComponent<ArticyFlowPlayer>().Play(_nextbranchs[0]);
 | |
|         }
 | |
|         else
 | |
|         {
 | |
|             Util.EndDrama();
 | |
|         }
 | |
|     }
 | |
|     public void NextDramaChoice(int index)
 | |
|     {
 | |
|         if (_nextbranchs != null && _nextbranchs.Count > index)
 | |
|         {
 | |
|             GetComponent<ArticyFlowPlayer>().Play(_nextbranchs[index]);
 | |
|         }
 | |
|         else
 | |
|         {
 | |
|             Util.EndDrama();
 | |
|         }
 | |
|     }
 | |
| } |