Ejemplo n.º 1
0
 public override void Assemble(Assembly.Assembler assembler)
 {
     int keycode = Key.KeyCode;
     int dindex = ScripterUtil.GetDirectionIndex(Key);
     if (Duration is ValRegEx)
     {
         if (Duration is ValReg32)
             throw new Assembly.AssembleException(ErrorMessage.NotSupported);
         var reg = Duration as ValRegEx;
         assembler.Add(Assembly.Instructions.AsmStoreOp.Create(reg.Index));
         assembler.Add(Assembly.Instructions.AsmStick_Standard.Create(keycode, dindex, 0));
         ReleasePrevious(assembler);
     }
     else if (Duration is ValInstant)
     {
         int duration = (Duration as ValInstant).Val;
         var ins = Assembly.Instructions.AsmStick_Standard.Create(keycode, dindex, duration);
         if (ins.Success)
         {
             assembler.Add(ins);
             ReleasePrevious(assembler);
         }
         else if (ins == Assembly.Instruction.Failed.OutOfRange)
         {
             assembler.Add(Assembly.Instructions.AsmStick_Hold.Create(keycode, dindex));
             ReleasePrevious(assembler);
             assembler.StickMapping[keycode] = assembler.Last() as Assembly.Instructions.AsmStick_Hold;
             assembler.Add(Assembly.Instructions.AsmWait.Create(duration));
             assembler.Add(Assembly.Instructions.AsmEmpty.Create());
             ReleasePrevious(assembler);
         }
     }
     else
         throw new Assembly.AssembleException(ErrorMessage.NotImplemented);
 }
Ejemplo n.º 2
0
 public override void Assemble(Assembly.Assembler assembler)
 {
     assembler.Add(Assembly.Instructions.AsmStick_Hold.Create(Key.KeyCode, ScripterUtil.GetDirectionIndex(Key)));
     ReleasePrevious(assembler);
     assembler.StickMapping[Key.KeyCode] = assembler.Last() as Assembly.Instructions.AsmStick_Hold;
 }