Beispiel #1
0
 public FreedomEffect(Type clazz, int count_0, int limit, int x_1, int y_2,
                      int w, int h)
 {
     this.visible = true;
     this.tex2ds  = new List <LTexture>(10);
     this.SetLocation(x_1, y_2);
     this.width   = w;
     this.height  = h;
     this.count   = count_0;
     this.timer   = new LTimer(80);
     this.kernels = (IKernel[])Arrays.NewInstance(clazz, count_0);
     try
     {
         System.Reflection.ConstructorInfo constructor = JavaRuntime.GetConstructor(clazz, new Type[] { typeof(int), typeof(int),
                                                                                                        typeof(int) });
         for (int i = 0; i < count_0; i++)
         {
             int no = MathUtils.Random(0, limit);
             kernels[i] = (IKernel)JavaRuntime.Invoke(constructor, new object[] {
                 ((int)(no)), ((int)(w)), ((int)(h))
             });
         }
     }
     catch (Exception e)
     {
         Console.Error.WriteLine(e.StackTrace);
     }
 }
Beispiel #2
0
 public void Register(LSetting setting, Type clazz,
                      params object[] args)
 {
     MaxScreen(setting.width, setting.height);
     Initialization(setting.landscape, setting.mode);
     SetShowFPS(setting.showFPS);
     SetShowMemory(setting.showMemory);
     SetShowLogo(setting.showLogo);
     SetFPS(setting.fps);
     if (GamePage != null)
     {
         GamePage.Title = setting.title;
     }
     if (clazz != null)
     {
         if (args != null)
         {
             try
             {
                 int funs = args.Length;
                 if (funs == 0)
                 {
                     SetScreen((Screen)JavaRuntime.NewInstance(clazz));
                     ShowScreen();
                 }
                 else
                 {
                     Type[] functions = new Type[funs];
                     for (int i = 0; i < funs; i++)
                     {
                         functions[i] = GetType(args[i]);
                     }
                     System.Reflection.ConstructorInfo constructor = JavaRuntime.GetConstructor(clazz, functions);
                     Object o = JavaRuntime.Invoke(constructor, args);
                 }
             }
             catch (Exception ex)
             {
                 Log.Exception(ex);
             }
         }
     }
 }
Beispiel #3
0
 public void Register(LSetting setting, Type clazz,
                      params object[] args)
 {
     XNAConfig.Load();
     SetShowFPS(setting.showFPS);
     SetShowMemory(setting.showMemory);
     SetShowLogo(setting.showLogo);
     SetFPS(setting.fps);
     if (clazz != null)
     {
         if (args != null)
         {
             try
             {
                 int funs = args.Length;
                 if (funs == 0)
                 {
                     SetScreen((Screen)JavaRuntime.NewInstance(clazz));
                     ShowScreen();
                 }
                 else
                 {
                     Type[] functions = new Type[funs];
                     for (int i = 0; i < funs; i++)
                     {
                         functions[i] = GetType(args[i]);
                     }
                     System.Reflection.ConstructorInfo constructor = JavaRuntime.GetConstructor(clazz, functions);
                     object o = JavaRuntime.Invoke(constructor, args);
                 }
             }
             catch (Exception ex)
             {
                 Loon.Utils.Debug.Log.Exception(ex);
             }
         }
     }
 }