快速业务通道

[更新]键位设置组件和连招组件[KeyMapper & ComboInput]

作者 佚名技术 来源 服务器技术 浏览 发布时间 2012-07-11
////////////////////////////////////// before using this Class,I suggest you’d better read the code & comment through carefully first

/*
////////////////////// ComboInput class /////////
class xp.gameLib.input.ComboInput extends MovieClip
{
public function ComboInput(bf:Number, inputDevice:xp.events.EventDispatcher_itf);
public function addCombo(c:Object, priority:Object, nm:String, io:Object):Number;
public function addComboToState(id, st);
public var addListener:Function;
public function addState(st:String);
function set broadcastType(p:String);
function get broadcastType():String;
public var defaultDelay:Number;
public function getCombo(id:Number):String;
public function listAllState();
function set pFuncName(p:String);
function get pFuncName():String;
static var prio:Object;
public var removeListener:Function;
public function resetBuffer(bf:Number);
function set state(st);
function get state():String;
};
*/
//create new ComboInput Object for combo input test
//1st parameter is buffer size ComboInput used for storing input button data from KeyMapper(or sth else dispatching ’button’ event)
import xp.gameLib.input.*;
var ci:ComboInput=new ComboInput(10,km);
//or :
//var ci:ComboInput=new ComboInput(10);//use addEventListener to listen to KeyMapper’s ’button’ event,see below
//var ci:ComboInput=new ComboInput();//default buffer 10 used here.
//add a combo definition:
var ciId=ci.addCombo("up",0,"jump");//this will trigger jump function when ’up’ button pressed..here we used default set.
//or:
ci.addCombo("up(KD)",0,"jump");//it is the same as above.
ci.addCombo("up(KD)=1-10",0,"jump")//the same as abover.
ci.addCombo("up(KD)=1-5",0,"jump");//after ’up’ button pressed,we can hv ’jump’ function triggered in 5 frames
ci.addCombo("up(KD)=3-5",0,"jump");//we can receive the ’jump’ invoke only 3 frames after ’up’ pressed.
ci.addCombo("back,down,front",0,"shot");//defined a CCW_half_circle action to trigger a ’shot’ function for listener Objects.
ci.addCombo("up","normal","jump");//specify a priority ’normal’,not the 0 used above.
ci.addCombo("up","normal-1","jump");//a bit higher priority than ’normal’,it makes this combo to be find first if more than one combo found
//below is the definition for all priorities:
/*
super:0,
special_high:100,
special:200,
special_low:300,
command_high:400,
command:500,
command_low:600,
normal_high:700,
normal:800,
normal_low:900
*/

ci.addCombo("up","normal","jump",{stateList:"stand,jump"});//you can use this combo in 2 states:’stand’ and ’jump’.
//one ComboInput instance could have many states,and at a time it is in one of them.
//each combo has to assign to one or more states, means this combo could only used in these states.you can change combo set from one to another by simply select another state.
//if you dont specify stateList in the 4th parameter,this combo is add to a default state ’normal’,as the addCombo sentences above do
//about state in ComboInput,see below for more.
ci.addCombo(

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号