Example #1
0
 void Awake()
 {
     //創建CLRSharp環境
     if (env == null)
     {
         env = new CLRSharp_Environment(new Logger());
     }
     //1、建立一个线程上下文,用来模拟L#线程模型
     context = new ThreadContext(env);
     Debug.Log("Create ThreadContext for L#.");
     StartCoroutine(WWWLoad("GameUI"));
 }
 private void InitEnv()
 {
     this.mRunEnv = new CLRSharp_Environment(new LSharpLogger());
 }
Example #3
0
    void Initialize()
    {
        env = new CLRSharp.CLRSharp_Environment(new Logger());

        ////for aot
        //env.GetType(typeof(Dictionary<int, string>));
        //env.GetType(typeof(Dictionary<int, object>));
        //env.GetType(typeof(Dictionary<int, CLRSharp.CLRSharp_Instance>));
        //env.GetType(typeof(Dictionary<int, Action>));

        //env.GetType(typeof(Dictionary<Int16, Action>));
        //env.GetType(typeof(LinkedList<int>));
        //env.GetType(typeof(int[,]));

        //env.GetType(typeof(List<Vector3>));
        //env.GetType(typeof(List<int>[]));
        //env.GetType(typeof(List<List<int>>));
        //env.GetType(typeof(List<List<List<int>>>));
        //env.GetType(typeof(Vector3[]));
        //env.GetType(typeof(System.Collections.Generic.IEnumerable<int>));

        ////for aot dele
        //CLRSharp.Delegate_Binder.RegBind(typeof(Action<int>), new CLRSharp.Delegate_BindTool<int>());
        //CLRSharp.Delegate_Binder.RegBind(typeof(Action<int, int>), new CLRSharp.Delegate_BindTool<int, int>());
        //CLRSharp.Delegate_Binder.RegBind(typeof(Action<int, int, int>), new CLRSharp.Delegate_BindTool<int, int, int>());
        //CLRSharp.Delegate_Binder.RegBind(typeof(Func<int, int, int>), new CLRSharp.Delegate_BindTool_Ret<int, int, int>());
        //CLRSharp.Delegate_Binder.RegBind(typeof(Action<int, string>), new CLRSharp.Delegate_BindTool<int, string>());
        //CLRSharp.Delegate_Binder.RegBind(typeof(Action<string>), new CLRSharp.Delegate_BindTool<string>());

        //CLRSharp.Delegate_Binder.RegBind(typeof(Action<bool>), new CLRSharp.Delegate_BindTool<bool>());

        //for aot
        env.GetType(typeof(Dictionary <int, string>));
        env.GetType(typeof(Dictionary <int, object>));
        env.GetType(typeof(Dictionary <int, int>));
        env.GetType(typeof(Dictionary <int, CLRSharp.CLRSharp_Instance>));
        env.GetType(typeof(Dictionary <long, CLRSharp.CLRSharp_Instance>));
        env.GetType(typeof(Dictionary <int, Action>));
        env.GetType(typeof(Queue <Vector3>));

        env.GetType(typeof(Dictionary <Int16, Action>));
        env.GetType(typeof(LinkedList <int>));
        env.GetType(typeof(int[, ]));
        env.GetType(typeof(int[]));
        env.GetType(typeof(int));
        env.GetType(typeof(List <long>));

        env.GetType(typeof(List <Vector3>));
        env.GetType(typeof(List <int>[]));
        env.GetType(typeof(List <long>[]));
        env.GetType(typeof(List <List <int> >));
        env.GetType(typeof(List <List <List <int> > >));
        env.GetType(typeof(List <List <List <KeyCode> > >));
        env.GetType(typeof(Vector3[]));
        env.GetType(typeof(System.Collections.Generic.IEnumerable <int>));
        env.GetType(typeof(System.Collections.Generic.IEnumerable <CLRSharp.CLRSharp_Instance>));
        env.GetType(typeof(System.IO.Stream));
        env.GetType(typeof(CLRSharp.Delegate_BindTool_Ret <long, CLRSharp.CLRSharp_Instance>));
        env.GetType(typeof(UnityEngine.Events.UnityAction <UnityEngine.Vector2>));
        env.GetType(typeof(UnityEngine.Events.UnityAction <CLRSharp.CLRSharp_Instance>));

        //env.GetType(typeof(LitJson.JsonData));
        //env.GetType(typeof(LitJson.JsonException));
        //env.GetType(typeof(LitJson.JsonMapper));
        //env.GetType(typeof(LitJson.JsonReader));
        //env.GetType(typeof(LitJson.JsonToken));
        //env.GetType(typeof(LitJson.JsonType));
        //env.GetType(typeof(LitJson.JsonWriter));

        //for aot dele
        CLRSharp.Delegate_Binder.RegBind(typeof(Action <int>), new CLRSharp.Delegate_BindTool <int>());
        CLRSharp.Delegate_Binder.RegBind(typeof(Action <long>), new CLRSharp.Delegate_BindTool <long>());
        CLRSharp.Delegate_Binder.RegBind(typeof(Action <float>), new CLRSharp.Delegate_BindTool <float>());
        CLRSharp.Delegate_Binder.RegBind(typeof(Action <int, int>), new CLRSharp.Delegate_BindTool <int, int>());
        CLRSharp.Delegate_Binder.RegBind(typeof(Action <int, int, int>), new CLRSharp.Delegate_BindTool <int, int, int>());
        CLRSharp.Delegate_Binder.RegBind(typeof(Func <int, int, int>), new CLRSharp.Delegate_BindTool_Ret <int, int, int>());
        CLRSharp.Delegate_Binder.RegBind(typeof(Func <CLRSharp.CLRSharp_Instance, long>), new CLRSharp.Delegate_BindTool_Ret <long, CLRSharp.CLRSharp_Instance>());
        CLRSharp.Delegate_Binder.RegBind(typeof(Action <int, string>), new CLRSharp.Delegate_BindTool <int, string>());
        CLRSharp.Delegate_Binder.RegBind(typeof(Action <string>), new CLRSharp.Delegate_BindTool <string>());
        CLRSharp.Delegate_Binder.RegBind(typeof(Action <string, float>), new CLRSharp.Delegate_BindTool <string, float>());
        CLRSharp.Delegate_Binder.RegBind(typeof(Action <bool>), new CLRSharp.Delegate_BindTool <bool>());
        CLRSharp.Delegate_Binder.RegBind(typeof(UnityEngine.Events.UnityAction <UnityEngine.Vector2>), new CLRSharp.Delegate_BindTool <UnityEngine.Vector2>());

        CLRSharp.Delegate_Binder.RegBind(typeof(Action <CLRSharp.CLRSharp_Instance, CLRSharp.CLRSharp_Instance, int>), new CLRSharp.Delegate_BindTool <CLRSharp.CLRSharp_Instance, CLRSharp.CLRSharp_Instance, int>());
        CLRSharp.Delegate_Binder.RegBind(typeof(Action <UnityEngine.EventSystems.PointerEventData>), new CLRSharp.Delegate_BindTool <UnityEngine.EventSystems.PointerEventData>());
        CLRSharp.Delegate_Binder.RegBind(typeof(Func <CLRSharp.CLRSharp_Instance, int, CLRSharp.CLRSharp_Instance>), new CLRSharp.Delegate_BindTool_Ret <CLRSharp.CLRSharp_Instance, CLRSharp.CLRSharp_Instance, int>());
        CLRSharp.Delegate_Binder.RegBind(typeof(Action <CLRSharp.CLRSharp_Instance>), new CLRSharp.Delegate_BindTool <CLRSharp.CLRSharp_Instance>());
        CLRSharp.Delegate_Binder.RegBind(typeof(Action <GSDKUnityLib.Pay.PayResultInfo>), new CLRSharp.Delegate_BindTool <GSDKUnityLib.Pay.PayResultInfo>());
        CLRSharp.Delegate_Binder.RegBind(typeof(Action <UnityEngine.AudioClip>), new CLRSharp.Delegate_BindTool <UnityEngine.AudioClip>());
        CLRSharp.Delegate_Binder.RegBind(typeof(Action <UnityEngine.Object>), new CLRSharp.Delegate_BindTool <UnityEngine.Object>());
    }