home *** CD-ROM | disk | FTP | other *** search
- class DialogGeneratorHandler
- {
- var mc;
- var mcProfTotal;
- var msgFailureArray;
- var tipsNumber;
- var tipsMode;
- var tipsTimer;
- var noTipsTimer;
- var tipsDelay;
- var noTipsDelay;
- var msgTips;
- var msgTodo;
- var msgSuccess;
- function DialogGeneratorHandler(mc, mcProfTotal)
- {
- this.mc = mc;
- this.mcProfTotal = mcProfTotal;
- this.msgFailureArray = new Array();
- this.tipsNumber = 0;
- this.tipsMode = "tips";
- this.tipsTimer = new TimerSynchronizer();
- this.noTipsTimer = new TimerSynchronizer();
- this.tipsDelay = 3000;
- this.noTipsDelay = 3000;
- }
- function setMsgTips(msgTips)
- {
- this.msgTips = msgTips;
- }
- function setMsgTodo(msgTodo)
- {
- this.msgTodo = msgTodo;
- }
- function setMsgSuccess(msgSuccess)
- {
- this.msgSuccess = msgSuccess;
- }
- function setMsgFailureType0(msgFailureType0)
- {
- this.msgFailureArray[0] = msgFailureType0;
- }
- function setMsgFailureType1(msgFailureType1)
- {
- this.msgFailureArray[1] = msgFailureType1;
- }
- function setMsgFailureType2(msgFailureType2)
- {
- this.msgFailureArray[2] = msgFailureType2;
- }
- function playTips()
- {
- this.mcProfTotal.mcProfBubble._visible = true;
- this.mc.F3 = "";
- this.mc.F4 = "";
- this.mc.F5 = "";
- this.mc.F6 = "";
- if(this.msgTips == undefined || this.msgTodo == undefined)
- {
- trace("DialogGeneratorHandler - msgTips and/or msgTodo are undefined !");
- this.mc.F1 = "";
- this.mc.F2 = "";
- return undefined;
- }
- if(this.tipsNumber > this.msgTips.length || this.tipsNumber > this.msgTodo.length)
- {
- trace("DialogGeneratorHandler - Bad Tips number !");
- this.mc.F1 = "";
- this.mc.F2 = "";
- return undefined;
- }
- this.mc.F1 = this.msgTips[this.tipsNumber];
- this.mc.F2 = this.msgTodo[this.tipsNumber];
- this.tipsMode = "tips";
- this.tipsTimer.setOldTimer(getTimer());
- }
- function playMsgSuccess(customMsg)
- {
- this.mcProfTotal.mcProfBubble._visible = true;
- this.mc.F1 = "";
- this.mc.F2 = "";
- this.mc.F4 = customMsg;
- this.mc.F5 = "";
- this.mc.F6 = "";
- if(this.msgSuccess == undefined)
- {
- trace("DialogGeneratorHandler - msgSuccess is undefined !");
- this.mc.F3 = "";
- return undefined;
- }
- var _loc2_ = random(this.msgSuccess.length);
- this.mc.F3 = this.msgSuccess[_loc2_];
- this.tipsMode = "noTips";
- this.noTipsTimer.setOldTimer(getTimer());
- }
- function playMsgFailure(errorType, customMsg)
- {
- this.mcProfTotal.mcProfBubble._visible = true;
- this.mc.F1 = "";
- this.mc.F2 = "";
- this.mc.F3 = "";
- this.mc.F4 = customMsg;
- this.mc.F6 = "";
- if(this.msgFailureArray[errorType] == undefined)
- {
- trace("DialogGeneratorHandler - msgFailureArray " + errorType + "s is undefined !");
- this.mc.F5 = "";
- return undefined;
- }
- var _loc2_ = this.msgFailureArray[errorType];
- var _loc4_ = random(_loc2_.length);
- this.mc.F5 = _loc2_[_loc4_];
- this.tipsMode = "noTips";
- this.noTipsTimer.setOldTimer(getTimer());
- }
- function playMsgCustom(msgCustom)
- {
- this.mcProfTotal.mcProfBubble._visible = true;
- this.mc.F1 = "";
- this.mc.F2 = "";
- this.mc.F3 = "";
- this.mc.F4 = "";
- this.mc.F5 = "";
- this.mc.F6 = msgCustom;
- this.tipsMode = "noTips";
- this.noTipsTimer.setOldTimer(getTimer());
- }
- function playNothing()
- {
- this.mcProfTotal.mcProfBubble._visible = false;
- this.mc.F1 = "";
- this.mc.F2 = "";
- this.mc.F3 = "";
- this.mc.F4 = "";
- this.mc.F5 = "";
- this.mc.F6 = "";
- this.tipsMode = "nothing";
- }
- function setTipsNumber(n)
- {
- this.tipsNumber = n;
- }
- function manageDisplay()
- {
- if(this.tipsMode == "tips" && this.tipsTimer.getElapsedTimeMs() > this.tipsDelay)
- {
- this.playNothing();
- this.tipsMode == "nothing";
- }
- if(this.tipsMode == "noTips" && this.noTipsTimer.getElapsedTimeMs() > this.noTipsDelay)
- {
- this.playTips();
- this.tipsMode = "tips";
- }
- }
- }
-