Вот небольшой код
Синтаксис:
Используется csharp
using UnityEngine.Flash;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class Networking : MonoBehaviour {
private static string key = "test123";
void Awake () {
ActionScript.Import("com.mycompany.mytool");
}
public static List<Item> items()
{
int f = ActionScript.Expression<int>("com.mycompany.mytool.GetProtocolVersionFromServer({0})", key);
List<Item> t = new List<Item>();
Item i = new Item(1);
i.test = f;
t.Add(i);
return t;
}
}
public class Item {
public int test;
public Item(int a)
{
test = a;
}
}
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class Networking : MonoBehaviour {
private static string key = "test123";
void Awake () {
ActionScript.Import("com.mycompany.mytool");
}
public static List<Item> items()
{
int f = ActionScript.Expression<int>("com.mycompany.mytool.GetProtocolVersionFromServer({0})", key);
List<Item> t = new List<Item>();
Item i = new Item(1);
i.test = f;
t.Add(i);
return t;
}
}
public class Item {
public int test;
public Item(int a)
{
test = a;
}
}
Синтаксис:
Используется actionscript
package com.mycompany
{
public final class mytool
{
public static function GetProtocolVersionFromServer(name: String): int
{
//talk the the flash api here.
return 18;
}
}
}
{
public final class mytool
{
public static function GetProtocolVersionFromServer(name: String): int
{
//talk the the flash api here.
return 18;
}
}
}
При попытке запустить - InvalidOperationException: Operation is not valid due to the current state of the object
При попытке скомпилить - C:\Unity\Projects\VirtualShop\Temp\StagingArea\Data\ConvertedDotNetCode\global\Networking.as(20): col: 35 Error: Access of undefined property mytool.
C:\Unity\Projects\VirtualShop\Temp\StagingArea\Data\ConvertedDotNetCode\global\Networking.as(3): col: 22 Error: Definition com.mycompany:mytool could not be found.