47 lines
		
	
	
		
			786 B
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			786 B
		
	
	
	
		
			C#
		
	
	
	
| using System.Runtime.InteropServices;
 | |
| 
 | |
| /// <summary>
 | |
| /// Unity调用Js
 | |
| /// </summary>
 | |
| public static class UnityToWeb
 | |
| {
 | |
|     [DllImport("__Internal")]
 | |
|     private static extern void OnPlant();
 | |
| 
 | |
|     [DllImport("__Internal")]
 | |
|     private static extern void OnWorkshop(string str);
 | |
| 
 | |
|     [DllImport("__Internal")]
 | |
|     private static extern void OnStation(string str);
 | |
| 
 | |
| 
 | |
|     public static void ToPlant()
 | |
|     {
 | |
|         try
 | |
|         {
 | |
|             OnPlant();
 | |
|         }
 | |
|         catch { }
 | |
|        
 | |
|     }
 | |
| 
 | |
|     public static void ToWorkshop(string str)
 | |
|     {
 | |
|         try
 | |
|         {
 | |
|             OnWorkshop(str);
 | |
|         }
 | |
|         catch { }
 | |
|         
 | |
|     }
 | |
| 
 | |
|     public static void ToStation(string str)
 | |
|     {
 | |
|         try
 | |
|         {
 | |
|             OnStation(str);
 | |
|         }
 | |
|         catch { }
 | |
|         
 | |
|     }
 | |
| } |