📄 chatui.as
字号:
if(o.chatUI.settings.layout.userList.width != -1) o.chatUI.userList_XScale = o.chatUI.settings.layout.userList.width / percent; } if(o.chatUI.userListPosition == o.chatUI.USERLIST_POSITION_RIGHT) { o.chatUI.userList_XScale += ((o.userList.paneWindow._x - o.stretchBar._x) / percent ); } else if(o.chatUI.userListPosition == o.chatUI.USERLIST_POSITION_LEFT) { var dim = o.userList.paneWindow.getSize(); o.chatUI.userList_XScale += ((o.stretchBar._x - (dim.width + o.userList.paneWindow._x)) / percent ); } if(o.chatUI.settings.layout.userList.relWidth != -1) o.chatUI.settings.user.layout.userList.relWidth = o.chatUI.userList_XScale; if(o.chatUI.settings.layout.userList.width != -1) o.chatUI.settings.user.layout.userList.width = o.chatUI.userList_XScale * percent; o.chatUI.userList_XScalePrev = o.chatUI.userList_XScale; //save_user_settings o.chatUI.saveUserSettings(); } else if(this.symbolName == 'inputTextArea') { var pane = o.chatUI.inputTextAreaPane; var percent = Stage.height / 100.0; if (o.chatUI.optionPanel_YScale == undefined) { o.chatUI.optionPanel_YScale = pane.content_obj.minHeight / percent; } if(o.chatUI.optionPanelPosition == o.chatUI.OPTIONPANEL_POSITION_BOTTOM) { o.chatUI.optionPanel_YScale += ((pane._y - o.stretchBar._y) / percent ); } else if(o.chatUI.optionPanelPosition == o.chatUI.OPTIONPANEL_POSITION_TOP) { var dim = pane.getSize(); o.chatUI.optionPanel_YScale += ((o.stretchBar._y - (dim.height + pane._y)) / percent ); } o.chatUI.optionPanel_YScalePrev = o.chatUI.optionPanel_YScale; o.chatUI.settings.user.layout.inputBox.YScale = o.chatUI.optionPanel_YScale; //save_user_settings o.chatUI.saveUserSettings(); } // kill the bar and cursor o.stretchBar._visible = false; this.onRollOut(); o.chatUI.onResize();};//------------------------------------------------------------------------------------------------------------//ChatUI.prototype.processDragPane = function(sourceObj){ var parent = _global.FlashChatNS.chatUI; var creator = parent.dialogManager.dialogHolder; var dim = sourceObj.getSize(); if(sourceObj.symbolName == 'userList') { var point = { x : sourceObj.dragframe._x, y : sourceObj.dragframe._y}; sourceObj.localToGlobal(point); var ret = parent.glueDropPane(Stage.width, dim.width, point.x, sourceObj.symbolName); var ULWidth = Stage.width * parent.userList_XScale / 100.0; var ULHeight = parent.preff_ul_height + parent.preff_ul_topY + parent.SPACER; if( ret > 0 ) { sourceObj.dragframe._visible = false; if(creator.pane_presizer_ul == undefined) creator.createEmptyMovieClip('pane_presizer_ul', sourceObj.getDepth()-1); creator.pane_presizer_ul.clear(); if(ret == parent.USERLIST_POSITION_LEFT) { creator.pane_presizer_ul.pos = parent.USERLIST_POSITION_LEFT; parent.drawRect(parent.SPACER, parent.preff_ul_topY + parent.SPACER, ULWidth, ULHeight, parent.DRAG_FRAME_THICKNESS, parent.DRAG_FRAME_COLOR,100, 0xACACAC,-1, creator.pane_presizer_ul); } else if(ret == parent.USERLIST_POSITION_RIGHT) { creator.pane_presizer_ul.pos = parent.USERLIST_POSITION_RIGHT; parent.drawRect(Stage.width - ULWidth - parent.SPACER, parent.preff_ul_topY + parent.SPACER, Stage.width - parent.SPACER, ULHeight, parent.DRAG_FRAME_THICKNESS, parent.DRAG_FRAME_COLOR,100, 0xACACAC,-1, creator.pane_presizer_ul); } } else { creator.pane_presizer_ul.removeMovieClip(); sourceObj.dragframe._visible = true; } } else if(sourceObj.symbolName == 'inputTextArea') { var ULWidth = 0; var OPWidth = parent.preff_op_width; var OPHeight = parent.preff_op_height; var OPTopY = parent.preff_op_top_y; var point = { x : sourceObj.dragframe._x, y : sourceObj.dragframe._y}; sourceObj.localToGlobal(point); var ret = parent.glueDropPane(Stage.height, dim.height, point.y, sourceObj.symbolName, OPTopY); if(parent.userListPosition != parent.USERLIST_POSITION_DOCKABLE) ULWidth = Stage.width * parent.userList_XScale / 100.0; if( ret > 0 ) { sourceObj.dragframe._visible = false; if(creator.pane_presizer_op == undefined) creator.createEmptyMovieClip('pane_presizer_op', sourceObj.getDepth()-1); creator.pane_presizer_op.clear(); var ul_pos = 1; if(parent.userListPosition != parent.USERLIST_POSITION_DOCKABLE) { if ( point.x < (Stage.width - dim.width) / 2 ) { creator.pane_presizer_op.ul_pos = parent.USERLIST_POSITION_RIGHT; ul_pos = 1; } else if (point.x >= (Stage.width - dim.width)/ 2) { creator.pane_presizer_op.ul_pos = parent.USERLIST_POSITION_LEFT; ul_pos = 2; } else { creator.pane_presizer_op.ul_pos = parent.userListPosition; if(creator.pane_presizer_op.ul_pos == parent.USERLIST_POSITION_RIGHT) ul_pos = 1; else if(creator.pane_presizer_op.ul_pos == parent.USERLIST_POSITION_LEFT) ul_pos = 2; } } if(ret == parent.OPTIONPANEL_POSITION_TOP) { creator.pane_presizer_op.pos = parent.OPTIONPANEL_POSITION_TOP; if(ul_pos == 1) parent.drawRect(parent.SPACER, OPTopY+parent.SPACER, OPWidth, OPHeight+OPTopY+parent.SPACER, parent.DRAG_FRAME_THICKNESS, parent.DRAG_FRAME_COLOR,100, 0xACACAC,-1, creator.pane_presizer_op); else if(ul_pos == 2) parent.drawRect(ULWidth+2*parent.SPACER, OPTopY+parent.SPACER, OPWidth+ULWidth+parent.SPACER, OPHeight+OPTopY+parent.SPACER, parent.DRAG_FRAME_THICKNESS, parent.DRAG_FRAME_COLOR,100, 0xACACAC,-1, creator.pane_presizer_op); } else if(ret == parent.OPTIONPANEL_POSITION_BOTTOM) { creator.pane_presizer_op.pos = parent.OPTIONPANEL_POSITION_BOTTOM; if(ul_pos == 1) parent.drawRect(parent.SPACER, Stage.height-(OPHeight+parent.SPACER), OPWidth, Stage.height-parent.SPACER, parent.DRAG_FRAME_THICKNESS, parent.DRAG_FRAME_COLOR,100, 0xACACAC,-1, creator.pane_presizer_op); else if(ul_pos == 2) parent.drawRect(ULWidth+2*parent.SPACER, Stage.height-(OPHeight+parent.SPACER), OPWidth+ULWidth+parent.SPACER, Stage.height-parent.SPACER, parent.DRAG_FRAME_THICKNESS, parent.DRAG_FRAME_COLOR,100, 0xACACAC,-1, creator.pane_presizer_op); } } else { creator.pane_presizer_op.removeMovieClip(); sourceObj.dragframe._visible = true; } }};//------------------------------------------------------------------------------------------------------------//ChatUI.prototype.processDropPane = function(sourceObj){ var parent = _global.FlashChatNS.chatUI; var creator = parent.dialogManager.dialogHolder; if(sourceObj.symbolName == 'userList') { if(creator.pane_presizer_ul != undefined) { sourceObj.setDockState(false); parent.dialogManager.paneToBack(sourceObj.symbolName); parent.userListPosition = creator.pane_presizer_ul.pos; creator.pane_presizer_ul.removeMovieClip(); parent.onResize(); } } else if(sourceObj.symbolName == 'inputTextArea') { if(creator.pane_presizer_op != undefined) { sourceObj.setDockState(false); parent.dialogManager.paneToBack(sourceObj.symbolName); parent.optionPanelPosition = creator.pane_presizer_op.pos; if(parent.userListPosition != parent.USERLIST_POSITION_DOCKABLE) parent.userListPosition = creator.pane_presizer_op.ul_pos; creator.pane_presizer_op.removeMovieClip(); parent.onResize(); } }};//------------------------------------------------------------------------------------------------------------//ChatUI.prototype.processDragFrame = function(sourceObj){ var x0 = sourceObj._x, y0 = sourceObj._y; var w = sourceObj._width, h = sourceObj._height; var dim = sourceObj.getSize(); if(dim != undefined) { w = dim.width; h = dim.height; }; //create var creator = this.mc.dialogHolder; creator.createEmptyMovieClip('dragFrame', 5000); //paint var thickness = this.mc.chatUI.DRAG_FRAME_THICKNESS; var lcolor = this.mc.chatUI.DRAG_FRAME_COLOR; with (creator.dragFrame) { lineStyle( thickness, lcolor, 100 ); moveTo( 0, 0 ); lineTo( w, 0); lineTo( w, h); lineTo( 0, h); lineTo( 0, 0); } creator.dragFrame.sourceObjName = sourceObj.symbolName; creator.dragFrame.parent = this; //handle coordinate changes creator.dragFrame.onEnterFrame = function() { if(this.sourceObjName == 'userList') { this._x = this.parent.glueDropFrame(Stage.width, this._width, this._x); } else if(this.sourceObjName == 'inputTextArea') { if( this.parent.userListPosition != this.parent.USERLIST_POSITION_DOCKABLE && this.parent.settings.layout.showUserList) { this._x = this.parent.glueDropFrame(Stage.width, this._width, this._x); } this._y = this.parent.glueDropFrame(Stage.height, this._height, this._y); } } //stop drag creator.dragFrame.onMouseUp = function() { this.stopDrag(); this._visible = false; if(this.sourceObjName == 'userList') { if (this._x < 20) { this.parent.userListPosition = this.parent.USERLIST_POSITION_LEFT; this.parent.userListPane.setDockState(false); } else if (this._x > (Stage.width - this._width)) { this.parent.userListPosition = this.parent.USERLIST_POSITION_RIGHT; this.parent.userListPane.setDockState(false); } else if(this._x != this.parent.userListPane._x) { this.parent.userListPosition = this.parent.USERLIST_POSITION_DOCKABLE; this.parent.userListPane.setDockState(true, {x : this._x, y : this._y}); this.parent.userListPane.sendToFront(); this.parent.userListPane.setMoveHandler('processDragPane', this.parent); this.parent.userListPane.setMouseUpHandler('processDropPane', this.parent); } } else if(this.sourceObjName == 'inputTextArea') { if( this.parent.userListPosition != this.parent.USERLIST_POSITION_DOCKABLE ) { if (this._x < 20) this.parent.userListPosition = this.parent.USERLIST_POSITION_RIGHT; if (this._x > (Stage.width - this._width)) this.parent.userListPosition = this.parent.USERLIST_POSITION_LEFT; } if (this._y < 20) { this.parent.optionPanelPosition = this.parent.OPTIONPANEL_POSITION_TOP; this.parent.inputTextAreaPane.setDockState(false); } else if (this._y > (Stage.height - this._height)) { this.parent.optionPanelPosition = this.parent.OPTIONPANEL_POSITION_BOTTOM; this.parent.inputTextAreaPane.setDockState(false); } else if(this._y != this.parent.inputTextAreaPane._y) { this.parent.optionPanelPosition = this.parent.OPTIONPANEL_POSITION_DOCKABLE; this.parent.inputTextAreaPane.setDockState(true, {x : this._x, y : this._y}); this.parent.inputTextAreaPane.sendToFront(); this.parent.inputTextAreaPane.setMoveHandler('processDragPane', this.parent); this.parent.inputTextAreaPane.setMouseUpHandler('processDropPane', this.parent); } } this.parent.settings.user.layout.inputBox.position = this.parent.optionPanelPosition; this.parent.settings.user.layout.userList.position = this.parent.userListPosition; //save_user_settings this.parent.saveUserSettings(); this.parent.onResize(); delete(this.onMouseUp); delete(this.onEnterFrame); } creator.dragFrame._x = x0; creator.dragFrame._y = y0; //begin drag creator.dragFrame.startDrag(false, 0, 0, Stage.width - w, Stage.height - h);};ChatUI.prototype.glueDropPane = function(stage_len, this_len, set_value, symbolName, inDd) { var max_diff = 50; var dd = (inDd != undefined)? inDd : 0; //left or top var bool1 = 0; if(set_value < (max_diff + dd)) { if( symbolName == 'userList' ) bool1 = this.USERLIST_POSITION_LEFT; else if( symbolName == 'inputTextArea' ) bool1 = this.OPTIONPANEL_POSITION_TOP; } //right or bottom var bool2 = 0; if((set_value + this_len) > (stage_len - max_diff)) { if( symbolName == 'userList' ) bool2 = this.USERLIST_POSITION_RIGHT; else if( symbolName == 'inputTextArea' ) bool2 = this.OPTIONPANEL_POSITION_BOTTOM; } return (bool1 + bool2); }; ChatUI.prototype.glueDropFrame = function(stage_len, this_len, set_value) { var max_diff = 40, min_diff = 20, zero_diff = 5, ret_value = set_value; //left or top if( set_value < max_diff && set_value > min_diff) ret_value = zero_diff; else if( set_value > zero_diff && set_value < min_diff) ret_value = max_diff; //right or bottom max_diff = stage_len - 40 - this_len; min_diff = stage_len - 20 - this_len; zero_diff = stage_len - 5 - this_len; if( set_value > max_diff && set_value < min_diff) ret_value = zero_diff; else if( set_value < zero_diff && set_value > min_diff) ret_value = max_diff; return (ret_value);};//INCOMING SERVER MESSAGES.ChatUI.prototype.loggedin = function(inSelfUserId, inSelfUserRole, inSelfUserGender) { //trace('LOGIN : ID ' + inSelfUserId + ' ROLE ' + inSelfUserRole + ' GEN ' + inSelfUserGender) if (inSelfUserId == null) { this.error('ChatUI: loggedin: invalid self user id [' + inSelfUserId + '].'); return; } this.dialogManager.showPane('userList'); this.dialogManager.showPane('inputTextArea'); if(_level0.ini.module.anchor == -1) { this.dialogManager.showPane('modulePane'); this.modulePane.setContentObject({minWidth : this.mc['module'].bWidth, minHeight : this.mc['module'].bHeight}); this.modulePane.setSize(Number(_level0.ini.module.float_w), Number(_level0.ini.module.float_h)); this.modulePane._x = Number(_level0.ini.module.float_x); this.modulePane._y = Number(_level0.ini.module.float_y); } this.selfUserId = inSelfUserId; this.selfUserRole = inSelfUserRole; this.selfUserGender = inSelfUserGender; this.setControlsEnabled(true); //!!! this.soundObj.attachSound('InitialLogin');};ChatUI.prototype.loggedout = function(inText) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -