第一次提交
This commit is contained in:
commit
8121362a03
4412 files changed
+1091845
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,13 @@
|
||||
package com.yy.vip.pk.effect.event
|
||||
{
|
||||
import flash.events.Event;
|
||||
|
||||
public class EnterEffectEvent extends Event
|
||||
{
|
||||
public static var SAME_ENTER:String = "sameSameEvent";
|
||||
public function EnterEffectEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false)
|
||||
{
|
||||
super(type, bubbles, cancelable);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.yy.vip.pk.effect.event
|
||||
{
|
||||
import flash.events.Event;
|
||||
|
||||
public class GiftBroEvent extends Event
|
||||
{
|
||||
public static var GIFT_BRO_CAST:String = "GIFT_BRO_CAST";
|
||||
public function GiftBroEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false)
|
||||
{
|
||||
super(type, bubbles, cancelable);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,383 @@
|
||||
package com.yy.vip.pk.effect.left
|
||||
{
|
||||
import com.greensock.TweenLite;
|
||||
import com.yy.vip.pk.base.BaseGroup;
|
||||
import com.yy.vip.pk.effect.service.GiftService;
|
||||
import com.yy.vip.pk.event.CommonEvent;
|
||||
import com.yy.vip.pk.service.BaseService;
|
||||
import com.yy.vip.pk.util.BULoader;
|
||||
import com.yy.vip.pk.util.DeposeUtil;
|
||||
import com.yy.vip.pk.vo.GiftInfo;
|
||||
|
||||
import flash.display.Bitmap;
|
||||
import flash.display.BitmapData;
|
||||
import flash.events.Event;
|
||||
import flash.events.TimerEvent;
|
||||
import flash.geom.Matrix;
|
||||
import flash.geom.Point;
|
||||
import flash.geom.Rectangle;
|
||||
import flash.utils.Timer;
|
||||
import flash.utils.clearTimeout;
|
||||
import flash.utils.setTimeout;
|
||||
|
||||
import org.flexlite.domUI.core.UIComponent;
|
||||
import org.flexlite.domUI.utils.callLater;
|
||||
|
||||
import yy.YY;
|
||||
import yy.events.PropsEvent;
|
||||
|
||||
public class GiftReceiveLeftEffect extends BaseGroup
|
||||
{
|
||||
|
||||
private static var TIMEOUT_HIDE:Number = 30000;
|
||||
|
||||
private var _showTimer:Timer;
|
||||
private var _hideTimer:Timer;
|
||||
|
||||
public static var isPlaying:Boolean = false;
|
||||
|
||||
private var _MC_CardTip:MC_LuckCard_Tip;
|
||||
private var _MC_CardTipUI:UIComponent;
|
||||
|
||||
public function GiftReceiveLeftEffect()
|
||||
{
|
||||
super();
|
||||
this.width = 280;
|
||||
this.height = 210;
|
||||
this.mouseEnabled = false;
|
||||
BaseService.getInstance().addEventListener(Event.RESIZE,resizeHandler);
|
||||
YY.instance.props.addEventListener(PropsEvent.GIVE_PROPS_CHANNEL_BROADCAST,onGivePropsChannelBroadcastEvent2,false,998);
|
||||
|
||||
}
|
||||
|
||||
private function onGivePropsChannelBroadcastEvent2(e:PropsEvent = null):void
|
||||
{
|
||||
|
||||
if(GiftService.getInstance().getPropById(e.eventData.propsId)){
|
||||
|
||||
this.recieverUid = e.eventData.recveruid;
|
||||
|
||||
var support:Number = Number(GiftService.getInstance().getPropById(e.eventData.propsId).support);
|
||||
|
||||
var effectList:Object = GiftService.getInstance().getPropById(e.eventData.propsId).effectList;
|
||||
|
||||
//如果我在该人的贡献榜上,需要立即刷新我的贡献值
|
||||
//如果是专属特效
|
||||
var url:String = GiftService.getInstance().getLeftEffectUrl(e.eventData.propsId,e.eventData.count);
|
||||
|
||||
if(url)
|
||||
{
|
||||
isPlaying = true;
|
||||
//特效效果
|
||||
var info:GiftInfo = new GiftInfo();
|
||||
info.senderUid = e.eventData.senderuid;
|
||||
info.sender = e.eventData.sendernickname;
|
||||
info.reciever = e.eventData.recvernickname;
|
||||
info.giftCount = e.eventData.count;
|
||||
info.propsId = e.eventData.propsId;
|
||||
var desc:Number = Number(GiftService.getInstance().getPropById(e.eventData.propsId).support);
|
||||
info.isAttack = desc < 0;
|
||||
setUrl(url);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected function resizeHandler(event:Event):void
|
||||
{
|
||||
callLater(checkSize);
|
||||
}
|
||||
|
||||
private function checkSize():void
|
||||
{
|
||||
try
|
||||
{
|
||||
var loader :BULoader = this.currentGiftLoader;
|
||||
if(!loader)
|
||||
return;
|
||||
var p :Point = new Point();
|
||||
p = BaseService.getInstance().localToGlobal(this,p);
|
||||
loader.y = p.y+ (this.height - loader.contentHeight * _scale)/2 - 73;
|
||||
loader.x = p.x + (this.width - loader.contentWidth * _scale)/2 + 10
|
||||
BaseService.getInstance().APP_SERVICE(1).addToSecondTopLayer(loader);
|
||||
}
|
||||
catch(e:Error)
|
||||
{
|
||||
loader.visible = false;
|
||||
}
|
||||
|
||||
}
|
||||
private var _scale:Number = 1;
|
||||
|
||||
private var url:String;
|
||||
private var currentGiftLoader:BULoader;
|
||||
|
||||
private function gifgSwfCompleteHandler(e:Event):void{
|
||||
|
||||
var p :Point = new Point();
|
||||
p = BaseService.getInstance().localToGlobal(this,p);
|
||||
|
||||
if(currentGiftLoader)
|
||||
currentGiftLoader.visible = false;
|
||||
|
||||
|
||||
_scale = 1;
|
||||
var _scaleX :Number= 1;
|
||||
var _scaleY :Number= 1;
|
||||
try{
|
||||
|
||||
}
|
||||
catch(e:Error)
|
||||
{
|
||||
currentGiftLoader.visible = false;
|
||||
}
|
||||
|
||||
checkSize();
|
||||
currentGiftLoader.visible = true;
|
||||
checkSize();
|
||||
|
||||
_hideTimer.stop();
|
||||
_hideTimer.start();
|
||||
_MC_CardTipUI.x = 23;
|
||||
_MC_CardTipUI.y = 70;
|
||||
_MC_CardTipUI.visible = true;
|
||||
|
||||
BaseService.getInstance().APP_SERVICE(1).addToSecondTopLayer(currentGiftLoader);
|
||||
|
||||
}
|
||||
|
||||
protected function _hideTimerHandler(event:TimerEvent):void
|
||||
{
|
||||
depose();
|
||||
}
|
||||
|
||||
protected function showTimerHandler(event:TimerEvent):void
|
||||
{
|
||||
dd();
|
||||
_showTimer.stop();
|
||||
}
|
||||
|
||||
public function setUrl(_url:String):void{
|
||||
|
||||
this.url = _url;
|
||||
if(!_url)return;
|
||||
|
||||
init();
|
||||
|
||||
_showTimer.stop();
|
||||
_showTimer.start();
|
||||
|
||||
}
|
||||
|
||||
private function init():void{
|
||||
if(!_MC_CardTip)
|
||||
{
|
||||
_MC_CardTip = new MC_LuckCard_Tip();
|
||||
_MC_CardTipUI = new UIComponent();
|
||||
_MC_CardTipUI.mouseChildren = _MC_CardTipUI.mouseEnabled = false;
|
||||
_MC_CardTipUI.addChild(_MC_CardTip);
|
||||
_MC_CardTipUI.visible = false;
|
||||
addElement(_MC_CardTipUI);
|
||||
}
|
||||
if(!this.currentGiftLoader)
|
||||
{
|
||||
this.currentGiftLoader = new BULoader();
|
||||
currentGiftLoader.addEventListener("click_card",clickCardHandler);
|
||||
currentGiftLoader.addEventListener("luck_card_2",luckCard1Handler);
|
||||
currentGiftLoader.addEventListener("luck_card_1",luckCard2Handler);
|
||||
currentGiftLoader.addEventListener("unLuck_card",unLuckCardHandler);
|
||||
currentGiftLoader.addEventListener(Event.COMPLETE,gifgSwfCompleteHandler);
|
||||
currentGiftLoader.mouseEnabled = false;
|
||||
}
|
||||
|
||||
if(!_hideTimer)
|
||||
{
|
||||
_hideTimer = new Timer(TIMEOUT_HIDE);
|
||||
_hideTimer.addEventListener(TimerEvent.TIMER,_hideTimerHandler);
|
||||
_hideTimer.delay = TIMEOUT_HIDE;
|
||||
}
|
||||
|
||||
if(!_showTimer)
|
||||
{
|
||||
_showTimer = new Timer(1000);
|
||||
_showTimer.addEventListener(TimerEvent.TIMER,showTimerHandler);
|
||||
}
|
||||
clickCardCount = 0;
|
||||
unLuckCount = 0;
|
||||
|
||||
}
|
||||
private var clickCardCount:uint = 0;
|
||||
private var recieverUid:uint = 0;
|
||||
private var unLuckCount:int;
|
||||
private function dd():void{
|
||||
|
||||
stopPlay();
|
||||
|
||||
currentGiftLoader.context = BaseService.getInstance().context;
|
||||
currentGiftLoader.source = url+"?v="+BaseService.getInstance().VERSION;
|
||||
currentGiftLoader.start();
|
||||
|
||||
}
|
||||
|
||||
private function stopPlay():void
|
||||
{
|
||||
if(this.currentGiftLoader)
|
||||
{
|
||||
this.currentGiftLoader.unloadAndStop();
|
||||
this.currentGiftLoader.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected function unLuckCardHandler(event:Event):void
|
||||
{
|
||||
unLuckCount++;
|
||||
}
|
||||
|
||||
protected function luckCard2Handler(event:Event):void
|
||||
{
|
||||
playCardEnterMovie(event.target);
|
||||
|
||||
//140030
|
||||
BaseService.getInstance().APP_SERVICE(1).getOnlineGiftByPropId(140030,1);
|
||||
BaseService.getInstance().APP_SERVICE(1).removeEventListener(CommonEvent.GET_ONLINE_PACKET_AFTER,getOnlinePacketInfoOneHandler);
|
||||
BaseService.getInstance().APP_SERVICE(1).addEventListener(CommonEvent.GET_ONLINE_PACKET_AFTER,getOnlinePacketInfoOneHandler);
|
||||
}
|
||||
|
||||
private function playCardEnterMovie(target:Object):void
|
||||
{
|
||||
var it : int = setTimeout(function dd(...params):void{
|
||||
clearTimeout(it);
|
||||
var target:* = params[0];
|
||||
var p:Point = new Point();
|
||||
p = target.localToGlobal(p);
|
||||
p = globalToLocal(p);
|
||||
var tmpRect:Rectangle = target.getRect(target);
|
||||
var picture:BitmapData = new BitmapData(target.width-1,target.height-3,true);
|
||||
var s:Matrix =new Matrix();
|
||||
s.scale(target.width/tmpRect.width,target.height/tmpRect.height);
|
||||
picture.draw(target,s);
|
||||
var bitmap:Bitmap = new Bitmap(picture);
|
||||
|
||||
var ui:UIComponent = new UIComponent();
|
||||
ui.x = p.x;
|
||||
ui.y = p.y;
|
||||
ui.addChild(bitmap);
|
||||
TweenLite.to(ui,.5,{x:20,y:210,scaleX:.4,scaleY:.4,alpha:0});
|
||||
addElement(ui);
|
||||
},2000,target);
|
||||
}
|
||||
|
||||
protected function luckCard1Handler(event:Event):void
|
||||
{
|
||||
playCardEnterMovie(event.target);
|
||||
|
||||
//140029
|
||||
BaseService.getInstance().APP_SERVICE(1).getOnlineGiftByPropId(140029,1);
|
||||
BaseService.getInstance().APP_SERVICE(1).removeEventListener(CommonEvent.GET_ONLINE_PACKET_AFTER,getOnlinePacketInfoOneHandler);
|
||||
BaseService.getInstance().APP_SERVICE(1).addEventListener(CommonEvent.GET_ONLINE_PACKET_AFTER,getOnlinePacketInfoOneHandler);
|
||||
}
|
||||
|
||||
private function getOnlinePacketInfoOneHandler(event:CommonEvent):void
|
||||
{
|
||||
BaseService.getInstance().APP_SERVICE(1).removeEventListener(CommonEvent.GET_ONLINE_PACKET_AFTER,getOnlinePacketInfoOneHandler);
|
||||
if(event.data.res_code == 0){
|
||||
|
||||
if(recieverUid > 0 )
|
||||
{
|
||||
var propsId :uint = event.data.props_id;
|
||||
BaseService.getInstance().timeOut(function handler(event:Event = null):void{
|
||||
BaseService.getInstance().APP_SERVICE(1).igiftSender.givePropsByCurrency(recieverUid,propsId,1);
|
||||
},1000);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected function clickCardHandler(event:Event):void
|
||||
{
|
||||
clickCardCount++;
|
||||
if(clickCardCount >= 6)
|
||||
{
|
||||
event.currentTarget.removeEventListener("click_card",clickCardHandler);
|
||||
_hideTimer.delay = 5000;
|
||||
_hideTimer.stop();
|
||||
_hideTimer.start();
|
||||
}
|
||||
|
||||
if(unLuckCount >=6)
|
||||
{
|
||||
_hideTimer.delay = 1;
|
||||
_hideTimer.stop();
|
||||
_hideTimer.start();
|
||||
}
|
||||
}
|
||||
protected function errorHandler(event:Event):void
|
||||
{
|
||||
isPlaying = false;
|
||||
|
||||
}
|
||||
|
||||
override public function depose():void
|
||||
{
|
||||
super.depose();
|
||||
try
|
||||
{
|
||||
stopPlay();
|
||||
|
||||
clickCardCount = 0;
|
||||
unLuckCount = 0;
|
||||
isPlaying = false;
|
||||
|
||||
if(_hideTimer)
|
||||
{
|
||||
_hideTimer.removeEventListener(TimerEvent.TIMER,_hideTimerHandler);
|
||||
_hideTimer.stop();
|
||||
_hideTimer = null;
|
||||
}
|
||||
if(_showTimer)
|
||||
{
|
||||
_showTimer.removeEventListener(TimerEvent.TIMER,showTimerHandler);
|
||||
_showTimer.stop();
|
||||
_showTimer = null;
|
||||
}
|
||||
|
||||
|
||||
if(this.currentGiftLoader)
|
||||
{
|
||||
DeposeUtil.removeFromStage(this.currentGiftLoader);
|
||||
this.currentGiftLoader.depose();
|
||||
currentGiftLoader.removeEventListener("click_card",clickCardHandler);
|
||||
currentGiftLoader.removeEventListener("luck_card_2",luckCard1Handler);
|
||||
currentGiftLoader.removeEventListener("luck_card_1",luckCard2Handler);
|
||||
currentGiftLoader.removeEventListener("unLuck_card",unLuckCardHandler);
|
||||
currentGiftLoader.removeEventListener(Event.COMPLETE,gifgSwfCompleteHandler);
|
||||
|
||||
}
|
||||
this.currentGiftLoader = null;
|
||||
|
||||
|
||||
if(_MC_CardTip)
|
||||
{
|
||||
DeposeUtil.removeFromStage(_MC_CardTip);
|
||||
_MC_CardTip = null;
|
||||
}
|
||||
|
||||
if(_MC_CardTipUI)
|
||||
{
|
||||
DeposeUtil.removeFromStage(_MC_CardTipUI);
|
||||
_MC_CardTipUI = null;
|
||||
}
|
||||
|
||||
}
|
||||
catch(e:Error)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,313 @@
|
||||
package com.yy.vip.pk.effect.middel
|
||||
{
|
||||
import com.yy.vip.pk.base.BaseGroup;
|
||||
import com.yy.vip.pk.effect.event.EnterEffectEvent;
|
||||
import com.yy.vip.pk.effect.renderer.BaseGiftReceiveMiddleTipRenderer;
|
||||
import com.yy.vip.pk.effect.renderer.GiftReceiveMiddleEffictTipRenderer;
|
||||
import com.yy.vip.pk.effect.service.GiftService;
|
||||
import com.yy.vip.pk.event.CommonEvent;
|
||||
import com.yy.vip.pk.event.MiddleEffectEvent;
|
||||
import com.yy.vip.pk.inter.IEnterEffectModule;
|
||||
import com.yy.vip.pk.inter.IGiftReceiveMiddleEffect;
|
||||
import com.yy.vip.pk.service.BaseService;
|
||||
import com.yy.vip.pk.util.DeposeUtil;
|
||||
import com.yy.vip.pk.util.JSONUtil;
|
||||
import com.yy.vip.pk.vo.GiftInfo;
|
||||
|
||||
import flash.events.Event;
|
||||
import flash.events.EventDispatcher;
|
||||
import flash.events.TimerEvent;
|
||||
import flash.utils.Timer;
|
||||
|
||||
import yy.YY;
|
||||
import yy.events.PropsEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* 中间送道具加护or攻击特效播放提示容器
|
||||
*
|
||||
*/
|
||||
public class GiftReceiveMiddleEffect extends EventDispatcher implements IGiftReceiveMiddleEffect
|
||||
{
|
||||
|
||||
|
||||
private var _gifReceiveTipDatas:Array = [];
|
||||
private var _gifReceiveTipQueueDatas:Array = [];
|
||||
|
||||
private var _gifReceiveTipDatasTimer:Timer ;
|
||||
private var _renderTemps:Array = [] ;
|
||||
|
||||
public function GiftReceiveMiddleEffect()
|
||||
{
|
||||
super();
|
||||
|
||||
_myGifReceiveTip = new GiftReceiveMiddleEffictTipRenderer();
|
||||
_myGifReceiveTip.visible = false;
|
||||
|
||||
_myGifReceiveTip.addEventListener(MiddleEffectEvent.END_NOW,endHandler_my);//消失完毕
|
||||
_myGifReceiveTip.addEventListener(MiddleEffectEvent.END_START,endStartHandler);//开始消失
|
||||
_myGifReceiveTip.addEventListener(MiddleEffectEvent.PLAY_NOW,playHandler);
|
||||
|
||||
_gifReceiveTipDatasTimer = new Timer(1000/50)
|
||||
_gifReceiveTipDatasTimer.addEventListener(TimerEvent.TIMER,gifReceiveTipDatasTimerHandler);
|
||||
BaseService.getInstance().addEventListener(Event.RESIZE,resizeHandler);
|
||||
_gifReceiveTipDatasTimer.start();
|
||||
resizeHandler();
|
||||
|
||||
YY.instance.props.addEventListener(PropsEvent.GIVE_PROPS_CHANNEL_BROADCAST,onGivePropsChannelBroadcastEvent,false,998);
|
||||
|
||||
//radomDo();
|
||||
}
|
||||
|
||||
protected function resizeHandler(event:Event = null):void
|
||||
{
|
||||
|
||||
for(var i:uint = 0;i < _renderTemps.length;i++)
|
||||
{
|
||||
var item:* = _renderTemps[i];
|
||||
item.x = (BaseService.getInstance().appWidth - 700)/2 + 234 ;
|
||||
item.y = (-175 + 499) + i*73;
|
||||
}
|
||||
if(_myGifReceiveTip)
|
||||
{
|
||||
_myGifReceiveTip.y = -405 + 499;
|
||||
_myGifReceiveTip.x = (BaseService.getInstance().appWidth - 700)/2 + 234 ;
|
||||
}
|
||||
}
|
||||
|
||||
private var c1:int = 0;
|
||||
private var c2:int = 0;
|
||||
private var _myGifReceiveTip:BaseGiftReceiveMiddleTipRenderer;
|
||||
|
||||
private function radomDo():void
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected function gifReceiveTipDatasTimerHandler(event:TimerEvent = null):void
|
||||
{
|
||||
|
||||
if(_gifReceiveTipQueueDatas.length>0 && _renderTemps.length < 2)
|
||||
{
|
||||
var info:GiftInfo = _gifReceiveTipQueueDatas.shift();
|
||||
|
||||
var tip:BaseGiftReceiveMiddleTipRenderer = initRender(info.middelRenderer);
|
||||
tip.setItem(info);
|
||||
tip.visible = true;
|
||||
BaseService.getInstance().addToSecondTopLayer(tip);
|
||||
tip.play();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private function initRender(clz:Class):BaseGiftReceiveMiddleTipRenderer{
|
||||
if(!clz)
|
||||
clz = GiftReceiveMiddleEffictTipRenderer;
|
||||
var _gifReceiveTip:* = new clz();
|
||||
_gifReceiveTip.visible = false;
|
||||
_renderTemps.push(_gifReceiveTip);
|
||||
|
||||
resizeHandler();
|
||||
|
||||
_gifReceiveTip.addEventListener(MiddleEffectEvent.END_NOW,endHandler);//消失完毕
|
||||
_gifReceiveTip.addEventListener(MiddleEffectEvent.END_START,endStartHandler);//开始消失
|
||||
_gifReceiveTip.addEventListener(MiddleEffectEvent.PLAY_NOW,playHandler);//
|
||||
return _gifReceiveTip;
|
||||
|
||||
}
|
||||
|
||||
//判断当前横幅是否出现
|
||||
private function checkIfShowGiftReceiveMiddleEffictTipRenderer(propsId:uint,expand:Object,count:uint):Boolean{
|
||||
if(propsId == 140074 && (!expand.hasOwnProperty("canShowEffect") || expand.canShowEffect == "true") && count >= 10){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private function actionSameDatas(info:GiftInfo):Boolean
|
||||
{
|
||||
//找到当前的横幅
|
||||
var flag:Boolean = false;
|
||||
var item:Object = info;
|
||||
for each(var item2:Object in _gifReceiveTipDatas){
|
||||
|
||||
/**
|
||||
* 礼物广播expand扩展字段返回 {"comboInfo":{"comboHits":8,"intervalTime":4724,"isFinishCombo":"false"}
|
||||
* comboHits 为连送组数
|
||||
* isFinishCombo: 是否连送结束,暂时不需要用到
|
||||
* intervalTime:与上次连送时间间隔,暂时不需要用到
|
||||
* **/
|
||||
if(item.expand.hasOwnProperty('comboInfo') && item.expand.comboInfo.hasOwnProperty('comboHits') && item.expand.comboInfo.comboHits > 1){
|
||||
if(item2 && item && item.recieverUid == item2.recieverUid && item.senderUid == item2.senderUid && item.propsId == item2.propsId && item2.giftCount == item.giftCount)
|
||||
{
|
||||
flag = true;
|
||||
//if(!item2.rendererExtendData.hasOwnProperty("groupCount"))
|
||||
//{
|
||||
// item2.rendererExtendData.groupCount = 1;
|
||||
//}
|
||||
item2.rendererExtendData.groupCount = item.expand.comboInfo.comboHits;
|
||||
|
||||
item2.dispatchEvent(new Event(EnterEffectEvent.SAME_ENTER));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
protected function endStartHandler(event:Event):void
|
||||
{
|
||||
var tip3:* = event.currentTarget;
|
||||
|
||||
var info2:GiftInfo = tip3.item as GiftInfo;
|
||||
if(info2 && info2.rendererExtendData.hasOwnProperty("groupCount") && info2.rendererExtendData.groupCount > 1)
|
||||
{
|
||||
var e:CommonEvent = new CommonEvent(CommonEvent.RECEIVE_GIFT_GROUP_START_END_EVENT);//开始消失
|
||||
e.data = info2;
|
||||
BaseService.getInstance().APP_SERVICE(1).dispatchEvent(e);
|
||||
}
|
||||
if(_gifReceiveTipDatas.indexOf(info2)!=-1)
|
||||
{
|
||||
_gifReceiveTipDatas.splice(_gifReceiveTipDatas.indexOf(info2),1);
|
||||
}
|
||||
|
||||
if(_gifReceiveTipQueueDatas.indexOf(info2)!=-1)
|
||||
{
|
||||
_gifReceiveTipQueueDatas.splice(_gifReceiveTipQueueDatas.indexOf(info2),1);
|
||||
}
|
||||
|
||||
info2 = null;
|
||||
tip3.item = null;
|
||||
|
||||
}
|
||||
|
||||
private var posArr:Array = [];
|
||||
|
||||
private function endHandler(event:Event):void{
|
||||
|
||||
event.stopPropagation();
|
||||
var tip:* = event.currentTarget;
|
||||
clearTip(tip);
|
||||
|
||||
}
|
||||
private function playHandler(event:Event):void{
|
||||
|
||||
event.currentTarget.visible = !BaseService.getInstance().isTemplateEffectPlayerOn;
|
||||
}
|
||||
|
||||
private function clearTip(tip:*):void
|
||||
{
|
||||
tip.removeEventListener(MiddleEffectEvent.END_NOW,endHandler);//消失完毕
|
||||
tip.removeEventListener(MiddleEffectEvent.END_START,endStartHandler);//开始消失
|
||||
tip.removeEventListener(MiddleEffectEvent.PLAY_NOW,playHandler);
|
||||
DeposeUtil.depose(tip);
|
||||
DeposeUtil.removeFromStage(tip);
|
||||
|
||||
if(_renderTemps.indexOf(tip) != -1)
|
||||
_renderTemps.splice(_renderTemps.indexOf(tip),1);
|
||||
|
||||
tip = null;
|
||||
}
|
||||
|
||||
private function endHandler_my(event:Event):void
|
||||
{
|
||||
event.stopPropagation();
|
||||
var tip:* = event.currentTarget;
|
||||
tip.visible = false;
|
||||
DeposeUtil.removeFromStage(tip);
|
||||
}
|
||||
|
||||
|
||||
private function addInfo(info:GiftInfo):void
|
||||
{
|
||||
if(info.senderUid == BaseService.getInstance().APP_SERVICE(1).getCurrentUserInfo().uid && checkIfShowMySelf() )
|
||||
{
|
||||
|
||||
if(!actionSameDatas(info)){
|
||||
|
||||
_gifReceiveTipDatas.push(info);
|
||||
_myGifReceiveTip.setItem(info);
|
||||
resizeHandler();
|
||||
_myGifReceiveTip.visible = true;
|
||||
BaseService.getInstance().addToSecondTopLayer(_myGifReceiveTip);
|
||||
_myGifReceiveTip.play();
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
//合并掉相同的
|
||||
if(!actionSameDatas(info)){
|
||||
_gifReceiveTipDatas.push(info);
|
||||
_gifReceiveTipQueueDatas.push(info);
|
||||
|
||||
var e:CommonEvent = new CommonEvent(CommonEvent.RECEIVE_GIFT_GROUP_START_EVENT);
|
||||
e.data = info;
|
||||
BaseService.getInstance().APP_SERVICE(1).dispatchEvent(e);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function checkIfShowMySelf():Boolean
|
||||
{
|
||||
if(_renderTemps.length >=2)
|
||||
return true;
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* 送出道具成功频道广播事件 进行添加播放特效
|
||||
* @param e
|
||||
*
|
||||
*/
|
||||
protected function onGivePropsChannelBroadcastEvent(e:PropsEvent):void
|
||||
{
|
||||
if(GiftService.getInstance().getPropById(e.eventData.propsId)){
|
||||
|
||||
var expandStr:String = e.eventData.expand;
|
||||
var expand:Object = JSONUtil.decode(expandStr);
|
||||
var level1Count:int = GiftService.getInstance().getMiddleEffectLevelCount(e.eventData.propsId,1);//1级横幅;
|
||||
var flag:Boolean = checkIfShowGiftReceiveMiddleEffictTipRenderer(e.eventData.propsId,expand,e.eventData.count);
|
||||
|
||||
if(flag || (level1Count > 0 && e.eventData.count >= level1Count))
|
||||
{
|
||||
var info:GiftInfo = new GiftInfo();
|
||||
info.senderUid = e.eventData.senderuid;
|
||||
info.sender = e.eventData.sendernickname;
|
||||
info.reciever = e.eventData.recvernickname;
|
||||
info.recieverUid = e.eventData.recveruid;
|
||||
info.giftCount = e.eventData.count;
|
||||
info.propsId = e.eventData.propsId;
|
||||
info.showWithoutLevel = flag;
|
||||
info.setExpand( expand );
|
||||
info.support = GiftService.getInstance().getPropById(e.eventData.propsId).support;
|
||||
var desc:Number = Number(GiftService.getInstance().getPropById(e.eventData.propsId).support);
|
||||
info.isAttack = desc < 0;
|
||||
addInfo(info);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function showOrHide(b:Boolean):void{
|
||||
|
||||
if(_myGifReceiveTip.parent)
|
||||
_myGifReceiveTip.visible = b;
|
||||
|
||||
for(var i:int = 0;i < _renderTemps.length;i++){
|
||||
if(_renderTemps[i].parent)
|
||||
_renderTemps[i].visible = b;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.yy.vip.pk.effect.renderer
|
||||
{
|
||||
import com.yy.vip.pk.inter.IGiftReceiveMiddleTipRenderer;
|
||||
import com.yy.vip.pk.vo.GiftInfo;
|
||||
|
||||
import org.flexlite.domUI.core.UIComponent;
|
||||
|
||||
public class BaseGiftReceiveMiddleTipRenderer extends UIComponent implements IGiftReceiveMiddleTipRenderer
|
||||
{
|
||||
public function BaseGiftReceiveMiddleTipRenderer()
|
||||
{
|
||||
|
||||
}
|
||||
public function setItem(item:GiftInfo):void
|
||||
{
|
||||
}
|
||||
/**播放淡入特效*/
|
||||
public function play():void
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
+649
@@ -0,0 +1,649 @@
|
||||
package com.yy.vip.pk.effect.renderer
|
||||
{
|
||||
import com.greensock.TweenLite;
|
||||
import com.yy.vip.pk.base.components.HeadBgUIComponent;
|
||||
import com.yy.vip.pk.effect.event.EnterEffectEvent;
|
||||
import com.yy.vip.pk.effect.service.GiftService;
|
||||
import com.yy.vip.pk.effect.util.RollNumGroup;
|
||||
import com.yy.vip.pk.event.MiddleEffectEvent;
|
||||
import com.yy.vip.pk.inter.IDepose;
|
||||
import com.yy.vip.pk.service.BaseService;
|
||||
import com.yy.vip.pk.util.BitmapMovieLoader;
|
||||
import com.yy.vip.pk.util.DeposeUtil;
|
||||
import com.yy.vip.pk.util.EffectConfig;
|
||||
import com.yy.vip.pk.util.TextEffect;
|
||||
import com.yy.vip.pk.util.UnicodeCheck;
|
||||
import com.yy.vip.pk.vo.GiftInfo;
|
||||
|
||||
import flash.display.BlendMode;
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.Event;
|
||||
import flash.events.EventDispatcher;
|
||||
import flash.filters.GlowFilter;
|
||||
import flash.utils.clearTimeout;
|
||||
import flash.utils.setTimeout;
|
||||
|
||||
import org.flexlite.domUI.core.UIComponent;
|
||||
import org.flexlite.domUI.events.UIEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* 送道具播放的对应每条特效容器
|
||||
*
|
||||
*/
|
||||
public class GiftReceiveMiddleEffictTipRenderer extends BaseGiftReceiveMiddleTipRenderer implements IDepose
|
||||
{
|
||||
private var _bgui:Sprite;
|
||||
/**礼物发送人的昵称*/
|
||||
private var senderNameTxtEff:TextEffect;
|
||||
/**礼物被赠送人的昵称*/
|
||||
private var receiveNameTxtEff:TextEffect;
|
||||
/**加护or攻击文本*/
|
||||
private var tmpTxtEff:TextEffect;
|
||||
/**赠送的数量*/
|
||||
private var countTxtEff:TextEffect;
|
||||
/**所送道具特效url*/
|
||||
private var _url:String;
|
||||
/**当前所送道具显示的动画特效*/
|
||||
private var _currentGiftLoader:BitmapMovieLoader;
|
||||
/**不同级别的特效背景图片集合*/
|
||||
private var effectBg:MovieClip;
|
||||
|
||||
/**用户头像*/
|
||||
private var headUI:HeadBgUIComponent;
|
||||
/**用户头像背景*/
|
||||
private var defHeadIconBg:MC_HeadIcon_Bg;
|
||||
|
||||
private var _item:GiftInfo;
|
||||
private var _rollNumer:RollNumGroup;
|
||||
private var _rollNumerUI:UIComponent;
|
||||
|
||||
private var _otherIcon:MC_Plugin_Icon;
|
||||
|
||||
/**贵族勋章*/
|
||||
private var _nobleLevelIcon:MC_Noble_Meda_Icon;
|
||||
/**贵族爵位ID**/
|
||||
private var _nobleId:int;
|
||||
|
||||
private var timeIt:uint;
|
||||
public function GiftReceiveMiddleEffictTipRenderer()
|
||||
{
|
||||
super();
|
||||
this.width = 700;
|
||||
this.height = 60;
|
||||
_bgui = new Sprite();
|
||||
_bgui.y = 120;
|
||||
_bgui.x = 120;
|
||||
addChild(_bgui);
|
||||
effectBg = new MC_MidEffect_Bg();
|
||||
effectBg.y = 10;
|
||||
effectBg.gotoAndStop(1);
|
||||
effectBg.mouseEnabled = false;
|
||||
effectBg.scaleX = effectBg.scaleY = 1;
|
||||
_bgui.addChild(effectBg);
|
||||
|
||||
senderNameTxtEff = new TextEffect();
|
||||
senderNameTxtEff.createTxt("SimSun",14,false,false,"left");
|
||||
senderNameTxtEff.glowFilter = [new GlowFilter(0x5f5280, 1, 4.0, 4.0, 10, 1, false, false)];
|
||||
senderNameTxtEff.Ccolors = [0xffffff,0xffffff,0xffffff];
|
||||
_bgui.addChild(senderNameTxtEff);
|
||||
|
||||
tmpTxtEff = new TextEffect();
|
||||
tmpTxtEff.createTxt("SimSun",14,false,false);
|
||||
tmpTxtEff.glowFilter = [new GlowFilter(0x5f5280, 1, 4.0, 4.0, 10, 1, false, false)];
|
||||
tmpTxtEff.Ccolors = [0xfff323,0xfff323,0xfff323];
|
||||
tmpTxtEff.x = -118;
|
||||
tmpTxtEff.txtFilter("加护");
|
||||
_bgui.addChild(tmpTxtEff);
|
||||
|
||||
receiveNameTxtEff = new TextEffect();
|
||||
receiveNameTxtEff.createTxt("SimSun",14,false,false,"left");
|
||||
receiveNameTxtEff.glowFilter = [new GlowFilter(0x5f5280, 1, 4.0, 4.0, 10, 1, false, false)];
|
||||
receiveNameTxtEff.Ccolors = [0xffffff,0xffffff,0xffffff];
|
||||
_bgui.addChild(receiveNameTxtEff);
|
||||
|
||||
countTxtEff = new TextEffect();
|
||||
countTxtEff.createTxt("Arial",18,true,false,"left");
|
||||
countTxtEff.glowFilter = [new GlowFilter(0x5f5280, 1, 4.0, 4.0, 10, 1, false, false)];
|
||||
countTxtEff.Ccolors = [0xfff213,0xfff213,0xfff213];
|
||||
countTxtEff.x = 125;
|
||||
countTxtEff.y = -2;
|
||||
_bgui.addChild(countTxtEff);
|
||||
|
||||
defHeadIconBg = new MC_HeadIcon_Bg();
|
||||
defHeadIconBg.gotoAndStop(2);
|
||||
_bgui.addChildAt(defHeadIconBg,1);
|
||||
defHeadIconBg.visible = false;
|
||||
headUI = new HeadBgUIComponent();
|
||||
headUI.visible = false;
|
||||
_bgui.addChild(headUI);
|
||||
_nobleLevelIcon = new MC_Noble_Meda_Icon();
|
||||
_nobleLevelIcon.visible = false;
|
||||
headUI.addChild(_nobleLevelIcon);
|
||||
|
||||
_rollNumerUI = new UIComponent();
|
||||
_rollNumerUI.height = 30;
|
||||
_rollNumerUI.x = 160;
|
||||
_bgui.addChild(_rollNumerUI);
|
||||
_rollNumer = new RollNumGroup();
|
||||
_rollNumerUI.addChild(_rollNumer);
|
||||
_rollNumer.addEventListener(UIEvent.UPDATE_COMPLETE,_rollNumerHandler);
|
||||
}
|
||||
|
||||
override public function setItem(item:GiftInfo):void
|
||||
{
|
||||
if(!item || !senderNameTxtEff) return;
|
||||
if(_item)
|
||||
{
|
||||
_item.removeEventListener(EnterEffectEvent.SAME_ENTER,sameSameEventHandler);
|
||||
}else{
|
||||
_item = item;
|
||||
}
|
||||
_item.addEventListener(EnterEffectEvent.SAME_ENTER,sameSameEventHandler);
|
||||
senderNameTxtEff.txtFilter(UnicodeCheck.strProcessing(item.sender,16));
|
||||
senderNameTxtEff.x = tmpTxtEff.x - senderNameTxtEff.getTxtWidth() + 28;
|
||||
|
||||
if(_otherIcon){
|
||||
_otherIcon.visible = false;
|
||||
}
|
||||
if(item.propsId != 140074){
|
||||
tmpTxtEff.glowFilter = [new GlowFilter(0x5f5280, 1, 4.0, 4.0, 10, 1, false, false)];
|
||||
tmpTxtEff.Ccolors = [0xfff323,0xfff323,0xfff323];
|
||||
}else{
|
||||
tmpTxtEff.glowFilter = [new GlowFilter(0x38246C, 1, 4.0, 4.0, 8, 1, false, false)];
|
||||
tmpTxtEff.Ccolors = [0xFF60EE,0xFF60EE,0xFF60EE];
|
||||
}
|
||||
|
||||
if(item.isAttack)
|
||||
{
|
||||
tmpTxtEff.txtFilter("攻击");
|
||||
}else{
|
||||
tmpTxtEff.txtFilter("加护");
|
||||
}
|
||||
receiveNameTxtEff.txtFilter(UnicodeCheck.strProcessing(item.reciever,12));
|
||||
receiveNameTxtEff.x = tmpTxtEff.x + 57;
|
||||
if(item.senderUid > 0)
|
||||
{
|
||||
BaseService.getInstance().APP_SERVICE(1).getUserInfoSync(item.senderUid,callBack3);
|
||||
}
|
||||
if(item.recieverUid > 0)
|
||||
{
|
||||
BaseService.getInstance().APP_SERVICE(1).getUserInfoSync(item.recieverUid,callBack2);
|
||||
}
|
||||
countTxtEff.visible = true;
|
||||
countTxtEff.txtFilter(String(item.giftCount));
|
||||
_rollNumer.visible = false;
|
||||
_rollNumer.clear();
|
||||
sameSameEventHandler(null);
|
||||
|
||||
/**爵位id**/
|
||||
if(item.expand.pkinfo){
|
||||
_nobleId = item.expand.pkinfo.sender.nobleId;
|
||||
}
|
||||
|
||||
if(GiftService.getInstance().getPropById(item.propsId))
|
||||
{
|
||||
var level3Count:int = GiftService.getInstance().getMiddleEffectLevelCount(item.propsId,3);//3级横幅
|
||||
var level2Count:int = GiftService.getInstance().getMiddleEffectLevelCount(item.propsId,2);//2级横幅
|
||||
var level1Count:int = GiftService.getInstance().getMiddleEffectLevelCount(item.propsId,1);//1级横幅
|
||||
var showWithoutLevel:Boolean = item.showWithoutLevel;
|
||||
|
||||
_nobleLevelIcon.visible = false;
|
||||
|
||||
if(item.giftCount >= level3Count && level3Count > 0)
|
||||
{
|
||||
|
||||
effectBg.gotoAndStop(3);
|
||||
|
||||
headUI.visible = true;
|
||||
if(isShowBannerType(item) == 1) {
|
||||
headUI.setWidthAndUrl(53.5, BaseService.getInstance().getUserLogo6060(item.senderUid));
|
||||
headUI.x = senderNameTxtEff.x - 50;
|
||||
headUI.y = 9;
|
||||
defHeadIconBg.x = headUI.x ;
|
||||
defHeadIconBg.y = headUI.y;
|
||||
defHeadIconBg.gotoAndStop(4);
|
||||
defHeadIconBg.visible = true;
|
||||
}else if(isShowBannerType(item) == 2) {//显示贵族礼物横幅-大
|
||||
effectBg.gotoAndStop(8);
|
||||
headUI.setWidthAndUrl(55, BaseService.getInstance().getUserLogo6060(item.senderUid));
|
||||
headUI.x = -245;
|
||||
headUI.y = 9;
|
||||
_nobleLevelIcon.x = (55 - _nobleLevelIcon.width)/2 -4;
|
||||
_nobleLevelIcon.y = (55 - _nobleLevelIcon.height)/2 -4;
|
||||
defHeadIconBg.x = headUI.x + 1 ;
|
||||
defHeadIconBg.y = headUI.y + 1;
|
||||
defHeadIconBg.gotoAndStop(7);
|
||||
_nobleLevelIcon.gotoAndStop(_nobleId - 99);
|
||||
defHeadIconBg.visible = _nobleLevelIcon.visible = true;
|
||||
}
|
||||
else{
|
||||
headUI.setWidthAndUrl(60, BaseService.getInstance().getUserLogo6060(item.senderUid));
|
||||
headUI.x = senderNameTxtEff.x - 50;
|
||||
headUI.y = 9;
|
||||
defHeadIconBg.x = headUI.x;
|
||||
defHeadIconBg.y = headUI.y;
|
||||
defHeadIconBg.gotoAndStop(1);
|
||||
defHeadIconBg.visible = true;
|
||||
}
|
||||
|
||||
}
|
||||
else if(item.giftCount >= level2Count && level2Count > 0){//二级横幅
|
||||
|
||||
effectBg.gotoAndStop(2);
|
||||
if(isShowBannerType(item) == 1)
|
||||
{
|
||||
headUI.setWidthAndUrl(45, BaseService.getInstance().getUserLogo6060(item.senderUid));
|
||||
headUI.x = senderNameTxtEff.x - 50;
|
||||
headUI.y = 9;
|
||||
defHeadIconBg.x = headUI.x;
|
||||
defHeadIconBg.y = headUI.y + 1;
|
||||
defHeadIconBg.gotoAndStop(3);
|
||||
headUI.visible = defHeadIconBg.visible = true;
|
||||
_nobleLevelIcon.visible = false;
|
||||
}else if(isShowBannerType(item) == 2) {//显示贵族礼物横幅-中
|
||||
effectBg.gotoAndStop(7);
|
||||
headUI.setWidthAndUrl(45, BaseService.getInstance().getUserLogo6060(item.senderUid));
|
||||
headUI.x = -251;
|
||||
headUI.y = 9;
|
||||
_nobleLevelIcon.x = (45 - _nobleLevelIcon.width)/2 -4;
|
||||
_nobleLevelIcon.y = (45 - _nobleLevelIcon.height)/2 -4;
|
||||
defHeadIconBg.x = headUI.x + 1;
|
||||
defHeadIconBg.y = headUI.y + 1;
|
||||
defHeadIconBg.gotoAndStop(6);
|
||||
_nobleLevelIcon.gotoAndStop(_nobleId - 99);
|
||||
headUI.visible = defHeadIconBg.visible = _nobleLevelIcon.visible = true;
|
||||
}
|
||||
else{
|
||||
headUI.visible = defHeadIconBg.visible = false;
|
||||
}
|
||||
|
||||
}
|
||||
else if((item.giftCount >= level1Count && level1Count>0) || showWithoutLevel){//一级横幅
|
||||
|
||||
if(!showWithoutLevel){
|
||||
|
||||
effectBg.gotoAndStop(1);
|
||||
if(isShowBannerType(item) == 1)
|
||||
{
|
||||
headUI.setWidthAndUrl(40, BaseService.getInstance().getUserLogo6060(item.senderUid));
|
||||
headUI.x = senderNameTxtEff.x - 50;
|
||||
headUI.y = 9;
|
||||
defHeadIconBg.x = headUI.x - 0.5;
|
||||
defHeadIconBg.y = headUI.y - 1;
|
||||
defHeadIconBg.gotoAndStop(2);
|
||||
headUI.visible = defHeadIconBg.visible = true;
|
||||
}else if(isShowBannerType(item) == 2) {//显示贵族礼物横幅-小
|
||||
effectBg.gotoAndStop(6);
|
||||
headUI.setWidthAndUrl(40, BaseService.getInstance().getUserLogo6060(item.senderUid));
|
||||
headUI.x = -251;
|
||||
headUI.y = 9;
|
||||
_nobleLevelIcon.x = (40 - _nobleLevelIcon.width)/2 -4;
|
||||
_nobleLevelIcon.y = (40 - _nobleLevelIcon.height)/2 -4;
|
||||
defHeadIconBg.x = headUI.x ;
|
||||
defHeadIconBg.y = headUI.y;
|
||||
defHeadIconBg.gotoAndStop(5);
|
||||
_nobleLevelIcon.gotoAndStop(_nobleId - 99);
|
||||
headUI.visible = defHeadIconBg.visible = _nobleLevelIcon.visible = true;
|
||||
}else{
|
||||
headUI.visible = defHeadIconBg.visible = false;
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
if(item.propsId == 140074)
|
||||
{
|
||||
var pluginState:int = int(item.expand.pkinfo.sender.pluginState);
|
||||
if(pluginState > 0){
|
||||
if(!_otherIcon){
|
||||
_otherIcon = new MC_Plugin_Icon();
|
||||
_bgui.addChild(_otherIcon);
|
||||
}
|
||||
_otherIcon.visible = true;
|
||||
_otherIcon.x = tmpTxtEff.x - (_otherIcon.width > 0 ? _otherIcon.width : 38);
|
||||
_otherIcon.y = 2;
|
||||
senderNameTxtEff.x = _otherIcon.x -senderNameTxtEff.width - 5;
|
||||
_otherIcon.gotoAndStop(pluginState);
|
||||
}
|
||||
effectBg.gotoAndStop(4);
|
||||
headUI.visible = defHeadIconBg.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(GiftService.getInstance().getPropById(item.propsId)){
|
||||
var url:String = GiftService.getInstance().getListGiftEffectUrl(item.propsId,1)
|
||||
setUrl(url);
|
||||
}
|
||||
}
|
||||
|
||||
public function get item():GiftInfo
|
||||
{
|
||||
return _item;
|
||||
}
|
||||
|
||||
public function set item(value:GiftInfo):void
|
||||
{
|
||||
_item = value;
|
||||
}
|
||||
|
||||
protected function stopMovieHandler(event:Event):void
|
||||
{
|
||||
}
|
||||
|
||||
protected function _rollNumerHandler(event:Event):void
|
||||
{
|
||||
_rollNumerUI.width = _rollNumer.width;
|
||||
}
|
||||
|
||||
protected function swfLoaderCompleteHandler(event:Event):void
|
||||
{
|
||||
if(!_currentGiftLoader)
|
||||
return;
|
||||
|
||||
try{
|
||||
_currentGiftLoader.scaleX = .5;
|
||||
_currentGiftLoader.scaleY = _currentGiftLoader.scaleX;
|
||||
_currentGiftLoader.visible = true;
|
||||
|
||||
}catch(e:Error){
|
||||
_currentGiftLoader.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function clearGiftMovie():void
|
||||
{
|
||||
try
|
||||
{
|
||||
if(_currentGiftLoader)
|
||||
{
|
||||
_currentGiftLoader.removeEventListener(BitmapMovieLoader.COMPLETE,swfLoaderCompleteHandler);
|
||||
_currentGiftLoader.depose();
|
||||
DeposeUtil.removeFromStage(_currentGiftLoader);
|
||||
_currentGiftLoader = null;
|
||||
}
|
||||
}catch(e:Error){
|
||||
}
|
||||
}
|
||||
|
||||
//开始消失
|
||||
private function rollCompleteHandler(event:Event):void
|
||||
{
|
||||
_rollNumer.removeEventListener(RollNumGroup.ROLL_COMPLETE,rollCompleteHandler);
|
||||
startPlayEnd();
|
||||
}
|
||||
|
||||
private function playEndHandler():void
|
||||
{
|
||||
endPlay();
|
||||
}
|
||||
|
||||
/**
|
||||
* 收到多组同样礼物道具 显示X 连续数字
|
||||
* @param event
|
||||
*
|
||||
*/
|
||||
private function sameSameEventHandler(event:Event):void
|
||||
{
|
||||
reStopAndPlay();//停止消失
|
||||
if(_item.rendererExtendData && _item.rendererExtendData.groupCount > 1)
|
||||
{
|
||||
countTxtEff.visible = true;
|
||||
countTxtEff.txtFilter(String(_item.giftCount +" x " ));
|
||||
_rollNumer.visible = true;
|
||||
_rollNumerUI.x = countTxtEff.x + countTxtEff.getTxtWidth() - 20;
|
||||
_rollNumer.removeEventListener(RollNumGroup.ROLL_COMPLETE,rollCompleteHandler);
|
||||
_rollNumer.addEventListener(RollNumGroup.ROLL_COMPLETE,rollCompleteHandler);
|
||||
_rollNumer.targetNum = _item.rendererExtendData.groupCount;
|
||||
_rollNumer.start();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载对应道具的小特效
|
||||
* @param url
|
||||
*
|
||||
*/
|
||||
public function setUrl(url:String):void
|
||||
{
|
||||
_url = url;
|
||||
if(!_url) return;
|
||||
clearGiftMovie();
|
||||
if(!_currentGiftLoader)
|
||||
{
|
||||
_currentGiftLoader = new BitmapMovieLoader();
|
||||
_currentGiftLoader.useCache = true;
|
||||
_currentGiftLoader.converPngs = true;
|
||||
_currentGiftLoader.smoothing = true;
|
||||
_currentGiftLoader.addEventListener(BitmapMovieLoader.COMPLETE,swfLoaderCompleteHandler);
|
||||
_currentGiftLoader.frameRate = EffectConfig.MIDDEL_GIFT_FRAME_RATE;
|
||||
_currentGiftLoader.ajustWidth = _currentGiftLoader.ajustHeight = 100;
|
||||
_currentGiftLoader.cHeight = 100 ;
|
||||
_currentGiftLoader.cWidth = 100 ;
|
||||
_currentGiftLoader.mode = 1;
|
||||
_currentGiftLoader.captureFrames = 30;
|
||||
_currentGiftLoader.x = 50 + 9;
|
||||
_currentGiftLoader.y = -34 + 7;
|
||||
|
||||
}
|
||||
_bgui.blendMode = BlendMode.NORMAL;
|
||||
_currentGiftLoader.blendMode = BlendMode.LAYER;
|
||||
_bgui.addChildAt(_currentGiftLoader,_bgui.numChildren);
|
||||
|
||||
if(_url.lastIndexOf(".swf") != -1)
|
||||
_currentGiftLoader.load(url);
|
||||
else if(_url.lastIndexOf(".png") != -1)
|
||||
_currentGiftLoader.getPics(url,10);
|
||||
}
|
||||
|
||||
private var t1:TweenLite;
|
||||
private var t2:TweenLite;
|
||||
|
||||
/**播放淡入特效*/
|
||||
override public function play():void
|
||||
{
|
||||
_bgui.x = -100;
|
||||
TweenLite.killTweensOf(_bgui);
|
||||
if(t1)
|
||||
t1.kill();
|
||||
if(t2)
|
||||
t2.kill();
|
||||
_bgui.alpha = .2;
|
||||
t1 = TweenLite.to(_bgui,.5,{alpha:1,x:108});
|
||||
startPlayEnd();
|
||||
dispatchEvent(new MiddleEffectEvent(MiddleEffectEvent.PLAY_NOW));
|
||||
}
|
||||
|
||||
private function startPlayEnd():void
|
||||
{
|
||||
clearTimeout(timeIt);
|
||||
var $this:EventDispatcher = this;
|
||||
timeIt = setTimeout(function ddHandler():void{
|
||||
clearTimeout(timeIt);
|
||||
if(t2)
|
||||
t2.kill();
|
||||
|
||||
TweenLite.killTweensOf(_bgui);
|
||||
_bgui.x = 108;
|
||||
t2 = TweenLite.to(_bgui,.5,{x:500,alpha:.2,onComplete:playEndHandler});
|
||||
$this.dispatchEvent(new Event(MiddleEffectEvent.END_START));
|
||||
},5000);
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示连续数量 停止消失
|
||||
*/
|
||||
private function reStopAndPlay():void
|
||||
{
|
||||
TweenLite.killTweensOf(_bgui);
|
||||
if(t2)
|
||||
t2.kill();
|
||||
_bgui.x = 108;
|
||||
_bgui.alpha = 1;
|
||||
startPlayEnd();
|
||||
}
|
||||
|
||||
private function endPlay():void
|
||||
{
|
||||
if(t1)
|
||||
t1.kill();
|
||||
if(t2)
|
||||
t2.kill();
|
||||
t1 = null;
|
||||
t2 = null;
|
||||
clearGiftMovie();
|
||||
this.visible = false;
|
||||
dispatchEvent(new Event(MiddleEffectEvent.END_NOW));
|
||||
TweenLite.killTweensOf(_bgui);
|
||||
}
|
||||
|
||||
private function callBack2(...params):void
|
||||
{
|
||||
if(this._item && this._item.recieverUid > 0 )
|
||||
{
|
||||
var user:Object = params[1];
|
||||
if(user && user.uid > 0 && receiveNameTxtEff)
|
||||
{
|
||||
receiveNameTxtEff.txtFilter(UnicodeCheck.strProcessing(String(user.name),12));
|
||||
// receiveNameTxtEff.txtFilter(setTextWidth("の——*⑧丷!。。。。dfdsf很好的测试文章数量", 12));
|
||||
receiveNameTxtEff.x = tmpTxtEff.x + 57;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function callBack3(...params):void
|
||||
{
|
||||
if(this._item && this._item.recieverUid > 0)
|
||||
{
|
||||
var user:Object = params[1];
|
||||
if(user && user.uid > 0 && senderNameTxtEff )
|
||||
{
|
||||
senderNameTxtEff.txtFilter(UnicodeCheck.strProcessing(String(user.name),16));
|
||||
// senderNameTxtEff.txtFilter(setTextWidth("の——*⑧丷!。。。。dfdsf很好的测试文章数量",16));
|
||||
senderNameTxtEff.x = tmpTxtEff.x - senderNameTxtEff.getTxtWidth() + 28;
|
||||
// headIconUI.x = senderNameTxtEff.x - 70;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function isShowGoldenTage(item:GiftInfo):Boolean
|
||||
{
|
||||
var isShow:Boolean = false;
|
||||
if(item.expand && item.expand.pkinfo && item.expand.pkinfo.sender)
|
||||
{
|
||||
if(item.expand.pkinfo.sender.goldenTag > 0 && item.expand.pkinfo.sender.totalPKValue > 20000)//总PK值大于2W
|
||||
{
|
||||
isShow = true;
|
||||
}
|
||||
}
|
||||
return isShow;
|
||||
}
|
||||
|
||||
private function isShowBannerType(item:GiftInfo):int
|
||||
{
|
||||
var showType:int = 0;
|
||||
if(item.expand && item.expand.pkinfo && item.expand.pkinfo.sender)
|
||||
{
|
||||
if(item.expand.pkinfo.sender.favourIds && item.expand.pkinfo.sender.favourIds.length > 0)
|
||||
{
|
||||
showType = 1;
|
||||
}
|
||||
if(item.expand.pkinfo.sender.nobleId >= 100)//贵族
|
||||
{
|
||||
showType = 2;
|
||||
}
|
||||
}
|
||||
return showType;
|
||||
}
|
||||
|
||||
public function depose():void{
|
||||
|
||||
clearGiftMovie();
|
||||
|
||||
if(_rollNumer)
|
||||
{
|
||||
_rollNumer.clear();
|
||||
_rollNumer.removeEventListener(UIEvent.UPDATE_COMPLETE,_rollNumerHandler);
|
||||
_rollNumer.removeEventListener(RollNumGroup.ROLL_COMPLETE,rollCompleteHandler);
|
||||
}
|
||||
|
||||
if(t1)
|
||||
t1.kill();
|
||||
if(t2)
|
||||
t2.kill();
|
||||
|
||||
t1 = null;
|
||||
t2 = null;
|
||||
clearTimeout(timeIt);
|
||||
|
||||
if(senderNameTxtEff)
|
||||
senderNameTxtEff.depose();
|
||||
|
||||
DeposeUtil.removeFromStage(senderNameTxtEff);
|
||||
senderNameTxtEff = null;
|
||||
|
||||
if(_rollNumer)
|
||||
{
|
||||
_rollNumer.clear();
|
||||
_rollNumer.removeEventListener(UIEvent.UPDATE_COMPLETE,_rollNumerHandler);
|
||||
_rollNumer.removeEventListener(RollNumGroup.ROLL_COMPLETE,rollCompleteHandler);
|
||||
DeposeUtil.removeFromStage(_rollNumer);
|
||||
_rollNumer = null;
|
||||
}
|
||||
|
||||
if(tmpTxtEff)
|
||||
tmpTxtEff.depose();
|
||||
|
||||
DeposeUtil.removeFromStage(_rollNumerUI);
|
||||
_rollNumerUI = null;
|
||||
|
||||
DeposeUtil.removeFromStage(tmpTxtEff);
|
||||
tmpTxtEff = null;
|
||||
|
||||
DeposeUtil.removeFromStage(receiveNameTxtEff);
|
||||
receiveNameTxtEff = null;
|
||||
|
||||
if(countTxtEff)
|
||||
countTxtEff.depose();
|
||||
|
||||
DeposeUtil.removeFromStage(countTxtEff);
|
||||
countTxtEff = null;
|
||||
|
||||
DeposeUtil.removeFromStage(effectBg);
|
||||
effectBg = null;
|
||||
|
||||
DeposeUtil.removeFromStage(headUI);
|
||||
if(headUI)
|
||||
headUI.depose();
|
||||
headUI = null;
|
||||
|
||||
|
||||
DeposeUtil.removeFromStage(defHeadIconBg);
|
||||
defHeadIconBg = null;
|
||||
|
||||
DeposeUtil.removeFromStage(_otherIcon);
|
||||
_otherIcon = null;
|
||||
|
||||
DeposeUtil.removeFromStage(_nobleLevelIcon);
|
||||
_nobleLevelIcon = null;
|
||||
|
||||
DeposeUtil.removeFromStage(_rollNumerUI);
|
||||
_rollNumerUI = null;
|
||||
|
||||
DeposeUtil.removeFromStage(_otherIcon);
|
||||
_otherIcon = null;
|
||||
|
||||
DeposeUtil.removeFromStage(_bgui);
|
||||
_bgui = null;
|
||||
|
||||
if(_item)
|
||||
{
|
||||
_item.removeEventListener(EnterEffectEvent.SAME_ENTER,sameSameEventHandler);
|
||||
_item = null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,241 @@
|
||||
package com.yy.vip.pk.effect.team
|
||||
{
|
||||
import com.yy.vip.pk.base.BaseGroup;
|
||||
import com.yy.vip.pk.effect.service.GiftService;
|
||||
import com.yy.vip.pk.service.BaseService;
|
||||
import com.yy.vip.pk.util.BitmapMovieLoader;
|
||||
import com.yy.vip.pk.util.DeposeUtil;
|
||||
import com.yy.vip.pk.util.EffectConfig;
|
||||
import com.yy.vip.pk.vo.GiftInfo;
|
||||
|
||||
import flash.events.Event;
|
||||
import flash.events.TimerEvent;
|
||||
import flash.geom.Point;
|
||||
import flash.utils.Timer;
|
||||
import flash.utils.clearTimeout;
|
||||
import flash.utils.setTimeout;
|
||||
|
||||
import org.flexlite.domUI.core.UIComponent;
|
||||
import org.flexlite.domUI.utils.callLater;
|
||||
|
||||
import yy.YY;
|
||||
import yy.events.PropsEvent;
|
||||
|
||||
public class TeamGiftReceiveEffectTip extends BaseGroup
|
||||
{
|
||||
|
||||
private static var queues:Array = [];
|
||||
|
||||
private var _showTimer:Timer;
|
||||
|
||||
private var _ui:UIComponent;
|
||||
|
||||
public function TeamGiftReceiveEffectTip()
|
||||
{
|
||||
super();
|
||||
this.width = 420;
|
||||
this.height = 210;
|
||||
this.mouseChildren = this.mouseEnabled = false;
|
||||
|
||||
if(!_showTimer)
|
||||
{
|
||||
_showTimer = new Timer(2000);
|
||||
_showTimer.addEventListener(TimerEvent.TIMER,showTimerHandler);
|
||||
}
|
||||
BaseService.getInstance().addEventListener(Event.RESIZE,resizeHandler);
|
||||
YY.instance.props.addEventListener(PropsEvent.GIVE_PROPS_CHANNEL_BROADCAST,onGivePropsChannelBroadcastEvent,false,10001);
|
||||
}
|
||||
|
||||
private function onGivePropsChannelBroadcastEvent(e:PropsEvent = null):void
|
||||
{
|
||||
if(GiftService.getInstance().getPropById(e.eventData.propsId)){
|
||||
|
||||
var support:Number = Number(GiftService.getInstance().getPropById(e.eventData.propsId).support);
|
||||
|
||||
var effectList:Object = GiftService.getInstance().getPropById(e.eventData.propsId).effectList;
|
||||
|
||||
//如果我在该人的贡献榜上,需要立即刷新我的贡献值
|
||||
//如果是专属特效
|
||||
var url:String = GiftService.getInstance().getTeamEffectUrl(e.eventData.propsId,e.eventData.count);
|
||||
|
||||
if(url)
|
||||
{
|
||||
this.propsId = e.eventData.propsId;
|
||||
//特效效果
|
||||
var info:GiftInfo = new GiftInfo();
|
||||
info.senderUid = e.eventData.senderuid;
|
||||
info.sender = e.eventData.sendernickname;
|
||||
info.reciever = e.eventData.recvernickname;
|
||||
info.giftCount = e.eventData.count;
|
||||
info.propsId = e.eventData.propsId;
|
||||
var desc:Number = Number(GiftService.getInstance().getPropById(e.eventData.propsId).support);
|
||||
info.isAttack = desc < 0;
|
||||
var leftUid:uint = BaseService.getInstance().APP_SERVICE(1).getLeftPKAnchorLocal()
|
||||
var rightUid:uint = BaseService.getInstance().APP_SERVICE(1).getRightPKAnchorLocal()
|
||||
if(e.eventData.recveruid == leftUid && planeType == 0){
|
||||
setUrl(url);
|
||||
}
|
||||
else if(e.eventData.recveruid == rightUid && planeType == 1){
|
||||
setUrl(url);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
protected function resizeHandler(event:Event):void
|
||||
{
|
||||
callLater(checkSize);
|
||||
}
|
||||
|
||||
private function checkSize():void
|
||||
{
|
||||
try
|
||||
{
|
||||
if(!_bitmapMovieLoader)
|
||||
return;
|
||||
var p :Point = new Point();
|
||||
p = BaseService.getInstance().localToGlobal(this,p);
|
||||
_bitmapMovieLoader.y = p.y+ (this.height - _bitmapMovieLoader.cHeight * _scale)/2;
|
||||
if(this.planeType == 0)
|
||||
{
|
||||
_bitmapMovieLoader.scaleX= 1;
|
||||
_bitmapMovieLoader.x = p.x + (this.width - _bitmapMovieLoader.cWidth * _scale)/2 - 50 ;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(propsId!= 140049 && propsId!= 140053)
|
||||
{
|
||||
_bitmapMovieLoader.x = p.x + (this.width - _bitmapMovieLoader.cWidth * _scale)/2 + 692;
|
||||
_bitmapMovieLoader.scaleX= -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_bitmapMovieLoader.x = p.x + (this.width - _bitmapMovieLoader.cWidth * _scale)/2 + 272;
|
||||
_bitmapMovieLoader.scaleX = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
catch(e:Error)
|
||||
{
|
||||
_bitmapMovieLoader.visible = false;
|
||||
}
|
||||
|
||||
}
|
||||
private var _scale:Number = 1;
|
||||
private var url:String;
|
||||
private var _bitmapMovieLoader:BitmapMovieLoader;
|
||||
private var _ht:uint;
|
||||
public var planeType:int;
|
||||
private var propsId:Object;
|
||||
|
||||
private function gifgSwfCompleteHandler(event:Event):void{
|
||||
checkSize();
|
||||
_bitmapMovieLoader.visible = true;
|
||||
}
|
||||
|
||||
|
||||
protected function showTimerHandler(event:TimerEvent):void
|
||||
{
|
||||
dd();
|
||||
_showTimer.stop();
|
||||
}
|
||||
|
||||
public function setUrl(_url:String):void{
|
||||
this.url = _url;
|
||||
_showTimer.stop();
|
||||
_showTimer.start();
|
||||
}
|
||||
|
||||
private function stopAndClear():void
|
||||
{
|
||||
clearTimeout(_ht);
|
||||
|
||||
if(_bitmapMovieLoader)
|
||||
_bitmapMovieLoader.depose();
|
||||
DeposeUtil.removeFromStage(_bitmapMovieLoader);
|
||||
_bitmapMovieLoader = null;
|
||||
if(_showTimer)
|
||||
_showTimer.stop();
|
||||
}
|
||||
|
||||
private function dd():void{
|
||||
|
||||
stopAndClear();
|
||||
|
||||
if(!_bitmapMovieLoader)
|
||||
{
|
||||
_bitmapMovieLoader= new BitmapMovieLoader();
|
||||
_bitmapMovieLoader.isLooped = true;
|
||||
_bitmapMovieLoader.loopedCount = 2;
|
||||
_bitmapMovieLoader.mouseChildren = false;
|
||||
_bitmapMovieLoader.mouseEnabled = false;
|
||||
_bitmapMovieLoader.mode = 1;
|
||||
_bitmapMovieLoader.cWidth = 420;
|
||||
_bitmapMovieLoader.cHeight = 210;
|
||||
_bitmapMovieLoader.ajustWidth = 420;
|
||||
_bitmapMovieLoader.ajustHeight = 210;
|
||||
_bitmapMovieLoader.captureFrames = 75;
|
||||
_bitmapMovieLoader.frameRate = EffectConfig.TEAM_GIFT_FRAME_RATE;
|
||||
_bitmapMovieLoader.addEventListener(BitmapMovieLoader.COMPLETE,gifgSwfCompleteHandler);
|
||||
}
|
||||
|
||||
if(!this._ui)
|
||||
{
|
||||
this._ui = new UIComponent();
|
||||
this._ui.mouseChildren = false;
|
||||
this._ui.mouseEnabled = false;
|
||||
// this._ui.addChild(_bitmapMovieLoader);
|
||||
}
|
||||
this._ui.addChild(_bitmapMovieLoader);
|
||||
BaseService.getInstance().APP_SERVICE(1).addToSecondTopLayer(this._ui);
|
||||
if(url.lastIndexOf(".swf") != -1)
|
||||
{
|
||||
_bitmapMovieLoader.load(url);
|
||||
clearTimeout(_ht);
|
||||
_ht = setTimeout(stopAndClear,15000);
|
||||
}
|
||||
|
||||
else if(url.lastIndexOf(".png") != -1)
|
||||
{
|
||||
clearTimeout(_ht);
|
||||
_bitmapMovieLoader.getPics(url,10);
|
||||
}
|
||||
}
|
||||
|
||||
protected function errorHandler(event:Event):void
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
override public function depose():void
|
||||
{
|
||||
super.depose();
|
||||
try
|
||||
{
|
||||
if(_showTimer)
|
||||
{
|
||||
_showTimer.removeEventListener(TimerEvent.TIMER,showTimerHandler);
|
||||
_showTimer.stop();
|
||||
_showTimer = null;
|
||||
}
|
||||
DeposeUtil.removeFromStage(this._ui);
|
||||
stopAndClear();
|
||||
if(_bitmapMovieLoader)
|
||||
_bitmapMovieLoader.depose();
|
||||
DeposeUtil.removeFromStage(_bitmapMovieLoader);
|
||||
_bitmapMovieLoader = null;
|
||||
this._ui = null;
|
||||
|
||||
}
|
||||
catch(e:Error)
|
||||
{
|
||||
trace(e.getStackTrace())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,221 @@
|
||||
package com.yy.vip.pk.effect.template
|
||||
{
|
||||
import com.yy.vip.pk.base.BaseGroup;
|
||||
import com.yy.vip.pk.effect.service.GiftService;
|
||||
import com.yy.vip.pk.event.CommonEvent;
|
||||
import com.yy.vip.pk.service.BaseService;
|
||||
import com.yy.vip.pk.util.DeposeUtil;
|
||||
|
||||
import flash.display.Loader;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.Event;
|
||||
import flash.events.IOErrorEvent;
|
||||
import flash.events.SecurityErrorEvent;
|
||||
import flash.events.TimerEvent;
|
||||
import flash.geom.Point;
|
||||
import flash.net.URLRequest;
|
||||
import flash.utils.Timer;
|
||||
import flash.utils.clearTimeout;
|
||||
import flash.utils.setTimeout;
|
||||
|
||||
import org.flexlite.domUI.core.UIComponent;
|
||||
import org.flexlite.domUI.utils.callLater;
|
||||
|
||||
import yy.YY;
|
||||
import yy.events.PropsEvent;
|
||||
|
||||
public class GiftReceiveTemplateEffect extends BaseGroup
|
||||
{
|
||||
private var _showTimer:Timer;
|
||||
|
||||
private var _ui:UIComponent;
|
||||
|
||||
public function GiftReceiveTemplateEffect()
|
||||
{
|
||||
super();
|
||||
this.width = 500;
|
||||
this.height = 500;
|
||||
this.mouseChildren = this.mouseEnabled = false;
|
||||
|
||||
if(!_showTimer)
|
||||
{
|
||||
_showTimer = new Timer(2000);
|
||||
_showTimer.addEventListener(TimerEvent.TIMER,showTimerHandler);
|
||||
}
|
||||
|
||||
}
|
||||
override protected function createChildren():void
|
||||
{
|
||||
super.createChildren();
|
||||
YY.instance.props.addEventListener(PropsEvent.GIVE_PROPS_CHANNEL_BROADCAST,onGivePropsChannelBroadcastEvent,false,10001);
|
||||
}
|
||||
|
||||
private function onGivePropsChannelBroadcastEvent(e:PropsEvent):void
|
||||
{
|
||||
|
||||
if(GiftService.getInstance().getPropById(e.eventData.propsId)){
|
||||
if(e.eventData.recveruid == BaseService.getInstance().APP_SERVICE(1).getLeftPKAnchorLocal()
|
||||
|| e.eventData.recveruid == BaseService.getInstance().APP_SERVICE(1).getRightPKAnchorLocal()){
|
||||
var url:String = GiftService.getInstance().getTemplate500500EffectUrl(e.eventData.propsId,e.eventData.count);
|
||||
if(url)
|
||||
{
|
||||
setUrl(url,urlScale);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private function checkSize():void
|
||||
{
|
||||
try
|
||||
{
|
||||
if(!_movieLoader)
|
||||
return;
|
||||
|
||||
_scale = 1;
|
||||
_movieLoader.scaleY = _movieLoader.scaleX = _scale;
|
||||
}
|
||||
catch(e:Error)
|
||||
{
|
||||
_movieLoader.visible = false;
|
||||
}
|
||||
|
||||
}
|
||||
private var _scale:Number = 1;
|
||||
private var url:String;
|
||||
private var _currentUrl:String;
|
||||
private var _movieLoader:Loader;
|
||||
private var _ht:uint;
|
||||
private var HIDE_TIME:Number = 10000;
|
||||
private var urlScale:Number;
|
||||
|
||||
private function gifgSwfCompleteHandler(event:Event):void{
|
||||
checkSize();
|
||||
|
||||
_currentUrl = this.url;
|
||||
|
||||
_movieLoader.visible = true;
|
||||
_movieLoader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR,errorHandler);
|
||||
_movieLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE,gifgSwfCompleteHandler);
|
||||
_movieLoader.contentLoaderInfo.removeEventListener(SecurityErrorEvent.SECURITY_ERROR,errorHandler);
|
||||
BaseService.getInstance().isTemplateEffectPlayerOn = true;
|
||||
BaseService.getInstance().dispatchEvent(new CommonEvent(CommonEvent.TEMPLATE_GIFT_EFFECT_START));
|
||||
|
||||
clearTimeout(_ht);
|
||||
_ht = setTimeout(clearSwf,HIDE_TIME);
|
||||
}
|
||||
|
||||
|
||||
protected function showTimerHandler(event:TimerEvent):void
|
||||
{
|
||||
dd();
|
||||
_showTimer.stop();
|
||||
}
|
||||
|
||||
public function setUrl(url:String,urlScale:Number = NaN):void{
|
||||
|
||||
this.url = url;
|
||||
this.urlScale = urlScale;
|
||||
_showTimer.stop();
|
||||
_showTimer.start();
|
||||
|
||||
}
|
||||
|
||||
private function clearSwf():void{
|
||||
stopAndClear();
|
||||
|
||||
BaseService.getInstance().isTemplateEffectPlayerOn = false;
|
||||
BaseService.getInstance().dispatchEvent(new CommonEvent(CommonEvent.TEMPLATE_GIFT_EFFECT_END));
|
||||
}
|
||||
|
||||
private function stopAndClear():void
|
||||
{
|
||||
clearTimeout(_ht);
|
||||
|
||||
if(_showTimer)
|
||||
_showTimer.stop();
|
||||
|
||||
DeposeUtil.removeFromStage(this._ui);
|
||||
if(_movieLoader)
|
||||
{
|
||||
_movieLoader.contentLoaderInfo.removeEventListener(SecurityErrorEvent.SECURITY_ERROR,errorHandler);
|
||||
_movieLoader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR,errorHandler);
|
||||
_movieLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE,gifgSwfCompleteHandler);
|
||||
_movieLoader.unloadAndStop(true);
|
||||
}
|
||||
|
||||
DeposeUtil.removeFromStage(_movieLoader);
|
||||
_movieLoader = null;
|
||||
this._ui = null;
|
||||
_currentUrl = "";
|
||||
}
|
||||
|
||||
private function dd():void{
|
||||
if(_movieLoader && _currentUrl == url && _currentUrl != ""){
|
||||
try{
|
||||
(_movieLoader.content as MovieClip).gotoAndPlay(1);
|
||||
_movieLoader.visible = true;
|
||||
|
||||
clearTimeout(_ht);
|
||||
_ht = setTimeout(clearSwf,HIDE_TIME);
|
||||
return;
|
||||
}catch(err:Error){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
stopAndClear();
|
||||
|
||||
if(!_movieLoader)
|
||||
{
|
||||
_movieLoader= new Loader();
|
||||
_movieLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,errorHandler);
|
||||
_movieLoader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR,errorHandler);
|
||||
_movieLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,gifgSwfCompleteHandler);
|
||||
}
|
||||
|
||||
if(!this._ui)
|
||||
{
|
||||
this._ui = new UIComponent();
|
||||
this._ui.mouseChildren = false;
|
||||
this._ui.mouseEnabled = false;
|
||||
this._ui.addChild(_movieLoader);
|
||||
}
|
||||
|
||||
this.addElement(this._ui);
|
||||
if(url.lastIndexOf(".swf") != -1)
|
||||
{
|
||||
_movieLoader.load(new URLRequest(url),BaseService.getInstance().context);
|
||||
_movieLoader.visible = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected function errorHandler(event:Event):void
|
||||
{
|
||||
clearSwf();
|
||||
}
|
||||
|
||||
override public function depose():void
|
||||
{
|
||||
super.depose();
|
||||
try
|
||||
{
|
||||
if(_showTimer)
|
||||
{
|
||||
_showTimer.removeEventListener(TimerEvent.TIMER,showTimerHandler);
|
||||
_showTimer.stop();
|
||||
_showTimer = null;
|
||||
}
|
||||
|
||||
stopAndClear();
|
||||
|
||||
}
|
||||
catch(e:Error)
|
||||
{
|
||||
trace(e.getStackTrace())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,331 @@
|
||||
package com.yy.vip.pk.effect.util
|
||||
{
|
||||
import com.greensock.*;
|
||||
import com.greensock.easing.*;
|
||||
import com.yy.vip.pk.event.CommonEvent;
|
||||
import com.yy.vip.pk.util.DeposeUtil;
|
||||
|
||||
import flash.display.GradientType;
|
||||
import flash.display.Shape;
|
||||
import flash.display.SpreadMethod;
|
||||
import flash.display.Sprite;
|
||||
import flash.filters.GlowFilter;
|
||||
import flash.geom.Matrix;
|
||||
import flash.text.TextField;
|
||||
import flash.text.TextFormat;
|
||||
|
||||
import org.flexlite.domUI.core.UIComponent;
|
||||
|
||||
public class RollNum extends UIComponent
|
||||
{
|
||||
//文本父级
|
||||
private var _sprite:Sprite ;
|
||||
//文本
|
||||
private var _txt:TextField;
|
||||
//文本遮罩样式
|
||||
private var tempStyle:Shape;
|
||||
|
||||
//动画效果总时间
|
||||
private var _playTime:int = 600;
|
||||
//文本基本属性
|
||||
private var _formatFont:String = "Arial";
|
||||
private var _formatSize:int = 30;
|
||||
private var _formatColor:Number = 0xFEB93C;
|
||||
|
||||
private var passCount:int = 0;
|
||||
|
||||
public static var NUM_NOW:String = "ROLL_NUM_NOW";
|
||||
private var autoAdd:Boolean;
|
||||
public var isStop:Boolean;
|
||||
|
||||
private var _targetNum:Number = -1;
|
||||
public static var NUM_END:String = "ROLL_NUM_END";
|
||||
|
||||
private var _timeline:TimelineLite;
|
||||
private var tempGradShape:Shape;
|
||||
private var matr:Matrix;
|
||||
|
||||
public function RollNum()
|
||||
{
|
||||
this.mouseChildren = false;
|
||||
}
|
||||
public function getNumber():Number{
|
||||
return passCount;
|
||||
}
|
||||
|
||||
public function get targetNum():Number
|
||||
{
|
||||
return _targetNum;
|
||||
}
|
||||
|
||||
public function set targetNum(value:Number):void
|
||||
{
|
||||
_targetNum = value;
|
||||
}
|
||||
|
||||
public function set playTime(time:int):void{
|
||||
_playTime = time;
|
||||
}
|
||||
public function get playTime():int{
|
||||
return _playTime;
|
||||
}
|
||||
public function set formatFont(font:String):void{
|
||||
_formatFont = font;
|
||||
}
|
||||
public function set formatSize(size:int):void{
|
||||
_formatSize = size;
|
||||
}
|
||||
public function get formatSize():int
|
||||
{
|
||||
if(targetNum > 0 && targetNum <=9)
|
||||
{
|
||||
_formatSize = 36;
|
||||
}else if(targetNum >9 && targetNum <= 65){
|
||||
_formatSize = 42;
|
||||
}else if(targetNum > 65 && targetNum <= 197){
|
||||
_formatSize = 48;
|
||||
}else if(_targetNum >= 198){
|
||||
_formatSize = 54;
|
||||
}
|
||||
return _formatSize;
|
||||
}
|
||||
|
||||
public function set formatColor(color:Number):void{
|
||||
_formatColor = color;
|
||||
}
|
||||
public function set text(content:String):void{
|
||||
if(_txt)
|
||||
{
|
||||
_txt.text = content;
|
||||
if(_txt.textWidth > _txt.width){
|
||||
_txt.width = _txt.textWidth+30;
|
||||
}
|
||||
//获取渐变
|
||||
if(tempStyle)
|
||||
{
|
||||
tempStyle = null;
|
||||
}
|
||||
var glowFilter:Array = [];
|
||||
var colors:Array = [];
|
||||
if(int(_txt.text) > 0 && int(_txt.text) <=9)
|
||||
{
|
||||
glowFilter = [new GlowFilter(0x38246c,1, 3.0, 3.0, 5, 1, false, false)];
|
||||
colors = [0xfff213,0xfff213,0xfff213];
|
||||
}else if(int(_txt.text) >9 && int(_txt.text) <= 65){
|
||||
glowFilter = [new GlowFilter(0xfff213,1, 7.0, 7.0, 10, 1, false, false)];//fffb90
|
||||
colors = [0x955bff,0x955bff,0x955bff];
|
||||
}else if(int(_txt.text) > 65 && int(_txt.text) <= 197){
|
||||
glowFilter = [new GlowFilter(0xfff213,1, 7.0, 7.0, 10, 1, false, false)];
|
||||
colors = [0xf247e1,0xf247e1,0xf247e1];
|
||||
}else if(int(_txt.text) >= 198){
|
||||
glowFilter = [new GlowFilter(0xfff213,1, 7.0, 7.0, 10, 1, false, false)];
|
||||
colors = [0xfe754d,0xfe754d,0xfe754d];
|
||||
}
|
||||
_sprite.filters = glowFilter;
|
||||
tempStyle = drawRectGradien(100,100,Math.PI/2,[100,100,100],[0x00, 0x55,0xFF],colors);
|
||||
// tempStyle = drawRectGradien(100,100,Math.PI/2,[100,100,100],[0x00, 0x55,0xFF],[0xF8FA5E,0xE6E350,0xF17C13]);
|
||||
tempStyle.cacheAsBitmap=_txt.cacheAsBitmap = true;
|
||||
tempStyle.mask=_txt;
|
||||
_sprite.addChild(tempStyle);
|
||||
tempStyle.x=_txt.x;
|
||||
tempStyle.y=_txt.y;
|
||||
tempStyle.width=_txt.width;
|
||||
tempStyle.height=_txt.textHeight;
|
||||
}
|
||||
}
|
||||
public function stop():void
|
||||
{
|
||||
if(_timeline)
|
||||
_timeline.kill();
|
||||
|
||||
TweenLite.killTweensOf(_sprite);
|
||||
}
|
||||
public function depose():void
|
||||
{
|
||||
stop();
|
||||
|
||||
_timeline = null;
|
||||
|
||||
DeposeUtil.removeFromStage(tempStyle);
|
||||
tempStyle = null;
|
||||
DeposeUtil.removeFromStage(_txt);
|
||||
_txt = null;
|
||||
|
||||
_sprite.filters = null;
|
||||
DeposeUtil.removeFromStage(_sprite);
|
||||
_sprite = null;
|
||||
}
|
||||
public function setNum(value:int,dispatch:Boolean = true):void{
|
||||
|
||||
createTxt();
|
||||
|
||||
this.text = value.toString();
|
||||
|
||||
if(_timeline)
|
||||
_timeline.kill();
|
||||
if(_sprite)
|
||||
TweenLite.killTweensOf(_sprite);
|
||||
|
||||
isStop = true;
|
||||
targetNum = value;
|
||||
passCount = value;
|
||||
if(dispatch)
|
||||
{
|
||||
var e:CommonEvent = new CommonEvent(RollNum.NUM_END);
|
||||
dispatchEvent(e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public function start():void
|
||||
{
|
||||
autoAdd = true;
|
||||
|
||||
autoRollOne();
|
||||
}
|
||||
private function autoRollOne(_time:Number = -1):void
|
||||
{
|
||||
if(isStop)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(passCount+1 > targetNum)
|
||||
{
|
||||
stop();
|
||||
return;
|
||||
}
|
||||
playEffect((passCount+1).toString(),effectHandler,_time);
|
||||
passCount++;
|
||||
}
|
||||
private function effectHandler():void{
|
||||
if(isStop)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var e:CommonEvent = new CommonEvent(RollNum.NUM_NOW);
|
||||
e.data = passCount;
|
||||
dispatchEvent(e);
|
||||
if(targetNum == passCount)
|
||||
{
|
||||
var e1:CommonEvent = new CommonEvent(RollNum.NUM_END);
|
||||
dispatchEvent(e1);
|
||||
return;
|
||||
}
|
||||
if(autoAdd)
|
||||
{
|
||||
autoRollOne()
|
||||
}
|
||||
}
|
||||
|
||||
//播放动画效果
|
||||
public function playEffect(content:String,callback:Function,time:Number = -1):void
|
||||
{
|
||||
createTxt();
|
||||
this.text = content;
|
||||
|
||||
var delayTime:Number = _playTime / 1000;
|
||||
if(time > 0){
|
||||
delayTime = time;
|
||||
}
|
||||
|
||||
_sprite.x = 20;
|
||||
_sprite.y = -20;
|
||||
_sprite.alpha = .9;
|
||||
_sprite.scaleX = 1.4;
|
||||
_sprite.scaleY = 1.4;
|
||||
if(!_timeline)
|
||||
{
|
||||
_timeline = new TimelineLite();
|
||||
_timeline.to( _sprite, delayTime * 5 / 6, {delay:.1,alpha:1,x:0, y:0, z:0, scaleX:1, scaleY:1, onComplete:callback});
|
||||
_timeline.play();
|
||||
}
|
||||
else
|
||||
{
|
||||
_timeline.restart();
|
||||
}
|
||||
}
|
||||
|
||||
private var format:TextFormat;
|
||||
//创建文本
|
||||
private function createTxt():void
|
||||
{
|
||||
if(!_txt)
|
||||
_txt = new TextField();
|
||||
if(!format)
|
||||
format = new TextFormat();
|
||||
if(targetNum > 0 && targetNum <=9)
|
||||
{
|
||||
format.size = 36;
|
||||
}else if(targetNum >9 && targetNum <= 65){
|
||||
format.size = 42;
|
||||
}else if(targetNum > 65 && targetNum <= 197){
|
||||
format.size = 48;
|
||||
}else if(_targetNum >= 198){
|
||||
format.size = 54;
|
||||
}
|
||||
format.font = _formatFont;
|
||||
format.align = "left"
|
||||
format.bold = true;
|
||||
format.color = _formatColor;
|
||||
format.size = formatSize;
|
||||
_txt.defaultTextFormat = format;
|
||||
_txt.multiline = true;
|
||||
_txt.width = 100;
|
||||
if(targetNum > 0 && targetNum <=9)
|
||||
{
|
||||
_txt.y = -20;//左边定位调整
|
||||
}else if(targetNum >9 && targetNum <= 65){
|
||||
_txt.y =-25;//左边定位调整
|
||||
}else if(targetNum > 65&& targetNum <= 197){
|
||||
_txt.y = -30;//左边定位调整
|
||||
}else if(_targetNum >= 198){
|
||||
_txt.y = -35;//左边定位调整
|
||||
}
|
||||
|
||||
if(!_sprite)
|
||||
{
|
||||
_sprite = new Sprite();
|
||||
}
|
||||
_sprite.addChild(_txt);
|
||||
addChild(_sprite);
|
||||
}
|
||||
|
||||
private static var _glowFilter :Array = [new GlowFilter(0xE5600C, 1.0, 4.0, 4.0, 10, 1, false, false)];
|
||||
|
||||
//绘制矩形线性渐变,遮罩用,无色彩需求
|
||||
private function drawRectGradien(Cwidth:Number,Cheight:Number,
|
||||
Crotation:Number=0,
|
||||
Calphas:Array=null,Cratios:Array=null,
|
||||
Ccolors:Array=null
|
||||
):Shape{
|
||||
if(!tempGradShape)
|
||||
tempGradShape = new Shape();
|
||||
|
||||
tempGradShape.graphics.clear();
|
||||
|
||||
var fillType:String = GradientType.LINEAR;
|
||||
var colors:Array = Ccolors;
|
||||
if(colors==null){
|
||||
colors=[0xFF0000, 0xFF0000];
|
||||
}
|
||||
var alphas:Array = Calphas;
|
||||
if(alphas==null){
|
||||
alphas= [100, 100];
|
||||
}
|
||||
var ratios:Array =Cratios;
|
||||
if(ratios==null){
|
||||
ratios=[0x00,0xFF];
|
||||
}
|
||||
if(!matr)
|
||||
matr = new Matrix();
|
||||
|
||||
matr.createGradientBox(Cwidth, Cheight, Crotation, 0, 0);
|
||||
var spreadMethod:String = SpreadMethod.PAD;
|
||||
tempGradShape.graphics.beginGradientFill(fillType, colors, alphas, ratios, matr);
|
||||
tempGradShape.graphics.drawRect(0,0,Cwidth,Cheight);
|
||||
|
||||
return tempGradShape;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.yy.vip.pk.effect.util
|
||||
{
|
||||
import com.greensock.TweenLite;
|
||||
import com.yy.vip.pk.event.CommonEvent;
|
||||
import com.yy.vip.pk.util.DeposeUtil;
|
||||
|
||||
import flash.display.Sprite;
|
||||
import flash.events.Event;
|
||||
import flash.filters.BitmapFilterQuality;
|
||||
import flash.filters.GlowFilter;
|
||||
|
||||
import org.flexlite.domUI.components.Label;
|
||||
import org.flexlite.domUI.core.UIComponent;
|
||||
import org.flexlite.domUI.layouts.HorizontalLayout;
|
||||
|
||||
public class RollNumGroup extends Sprite
|
||||
{
|
||||
public static var NUM_NOW_GROUP:String = "NUM_NOW_GROUP";
|
||||
public static var ROLL_COMPLETE:String = "rollComplete";
|
||||
|
||||
private var _targetNum:Number;
|
||||
|
||||
private var _rollNum:RollNum;
|
||||
|
||||
|
||||
public function RollNumGroup()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function get targetNum():Number
|
||||
{
|
||||
return _targetNum;
|
||||
}
|
||||
|
||||
public function set targetNum(value:Number):void
|
||||
{
|
||||
_targetNum = value;
|
||||
if(_rollNum){
|
||||
_rollNum.targetNum = _targetNum;
|
||||
}
|
||||
}
|
||||
|
||||
public function clear():void
|
||||
{
|
||||
if(!_rollNum) return;
|
||||
_rollNum.isStop = true;
|
||||
|
||||
DeposeUtil.removeFromStage(_rollNum);
|
||||
|
||||
_rollNum.depose();
|
||||
_rollNum = null;
|
||||
}
|
||||
|
||||
public function start():void
|
||||
{
|
||||
if(isNaN(targetNum))
|
||||
{
|
||||
targetNum = 0;
|
||||
}
|
||||
if(!_rollNum)
|
||||
{
|
||||
_rollNum = new RollNum();
|
||||
_rollNum.playTime = 500;
|
||||
_rollNum.targetNum = targetNum;
|
||||
addChild(_rollNum);
|
||||
}
|
||||
_rollNum.isStop = false;
|
||||
_rollNum.start();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,243 @@
|
||||
package com.yy.vip.pk.effect.video
|
||||
{
|
||||
import com.yy.vip.pk.effect.service.GiftService;
|
||||
import com.yy.vip.pk.inter.IDepose;
|
||||
import com.yy.vip.pk.service.BaseService;
|
||||
import com.yy.vip.pk.util.DeposeUtil;
|
||||
|
||||
import flash.display.Loader;
|
||||
import flash.events.Event;
|
||||
import flash.events.EventDispatcher;
|
||||
import flash.events.IOErrorEvent;
|
||||
import flash.events.SecurityErrorEvent;
|
||||
import flash.events.TimerEvent;
|
||||
import flash.geom.Point;
|
||||
import flash.net.URLRequest;
|
||||
import flash.utils.Timer;
|
||||
import flash.utils.clearTimeout;
|
||||
import flash.utils.setTimeout;
|
||||
|
||||
import org.flexlite.domUI.core.UIComponent;
|
||||
import org.flexlite.domUI.utils.callLater;
|
||||
|
||||
import yy.YY;
|
||||
import yy.events.PropsEvent;
|
||||
import flash.display.Sprite;
|
||||
|
||||
public class GiftReceiveVideoEffect extends EventDispatcher implements IDepose
|
||||
{
|
||||
|
||||
private static var queues:Array = [];
|
||||
|
||||
public var planeType:int;
|
||||
|
||||
private var _showTimer:Timer;
|
||||
|
||||
private var _ui:UIComponent;
|
||||
|
||||
private var _uiOn:Boolean = true;
|
||||
|
||||
public function GiftReceiveVideoEffect()
|
||||
{
|
||||
super();
|
||||
this.swfWidth = 320;
|
||||
this.swfHeight = 240;
|
||||
|
||||
if(!_showTimer)
|
||||
{
|
||||
_showTimer = new Timer(2000);
|
||||
_showTimer.addEventListener(TimerEvent.TIMER,showTimerHandler);
|
||||
}
|
||||
BaseService.getInstance().addEventListener(Event.RESIZE,resizeHandler);
|
||||
YY.instance.props.addEventListener(PropsEvent.GIVE_PROPS_CHANNEL_BROADCAST,onGivePropsChannelBroadcastEvent,false,10001);
|
||||
|
||||
}
|
||||
|
||||
private function onGivePropsChannelBroadcastEvent(e:PropsEvent):void
|
||||
{
|
||||
//模板大动画500x500
|
||||
if( BaseService.getInstance().isTemplateEffectPlayerOn){
|
||||
return;
|
||||
}
|
||||
if(GiftService.getInstance().getPropById(e.eventData.propsId)){
|
||||
if( (e.eventData.recveruid == BaseService.getInstance().APP_SERVICE(1).getLeftPKAnchorLocal() && this.planeType == 0)
|
||||
|| (e.eventData.recveruid == BaseService.getInstance().APP_SERVICE(1).getRightPKAnchorLocal() && this.planeType == 1)){
|
||||
var url:String = GiftService.getInstance().getVideoEffectUrl(e.eventData.propsId,e.eventData.count);
|
||||
if(url)
|
||||
{
|
||||
setUrl(url,urlScale);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function resizeHandler(event:Event):void
|
||||
{
|
||||
callLater(checkSize);
|
||||
}
|
||||
|
||||
private function checkSize():void
|
||||
{
|
||||
try
|
||||
{
|
||||
if(!_movieLoader)
|
||||
return;
|
||||
var p :Point = new Point();
|
||||
p = BaseService.getInstance().localToGlobal(target,p);
|
||||
|
||||
_scale = 1;
|
||||
if(_movieLoader.contentLoaderInfo.width == 320)
|
||||
_scale = 1;
|
||||
else if(_movieLoader.contentLoaderInfo.width == 500 || _movieLoader.contentLoaderInfo.width == 480)
|
||||
_scale = .6;
|
||||
|
||||
_movieLoader.scaleY = _movieLoader.scaleX = _scale;
|
||||
_movieLoader.y = p.y+ (this.swfHeight - _movieLoader.contentLoaderInfo.height * _scale)/2 + 20;
|
||||
|
||||
if(planeType == 1)
|
||||
{
|
||||
_movieLoader.x = p.x + (this.swfWidth - _movieLoader.contentLoaderInfo.width * _scale)/2 ;
|
||||
}
|
||||
else
|
||||
{
|
||||
_movieLoader.x = p.x + (this.swfWidth - _movieLoader.contentLoaderInfo.width * _scale)/2;
|
||||
}
|
||||
|
||||
}
|
||||
catch(e:Error)
|
||||
{
|
||||
_movieLoader.visible = false;
|
||||
}
|
||||
|
||||
}
|
||||
private var _scale:Number = 1;
|
||||
private var url:String;
|
||||
private var _movieLoader:Loader;
|
||||
private var _ht:uint;
|
||||
private var HIDE_TIME:Number = 5000;
|
||||
private var urlScale:Number;
|
||||
|
||||
private function gifgSwfCompleteHandler(event:Event):void{
|
||||
checkSize();
|
||||
_movieLoader.visible = true;
|
||||
_movieLoader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR,errorHandler);
|
||||
_movieLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE,gifgSwfCompleteHandler);
|
||||
clearTimeout(_ht);
|
||||
_ht = setTimeout(stopAndClear,HIDE_TIME);
|
||||
}
|
||||
|
||||
|
||||
protected function showTimerHandler(event:TimerEvent):void
|
||||
{
|
||||
dd();
|
||||
_showTimer.stop();
|
||||
}
|
||||
|
||||
public function setUrl(url:String,urlScale:Number = NaN):void{
|
||||
if(!this._showFlag)
|
||||
return;
|
||||
this.url = url;
|
||||
this.urlScale = urlScale;
|
||||
_showTimer.stop();
|
||||
_showTimer.start();
|
||||
|
||||
}
|
||||
|
||||
private function stopAndClear():void
|
||||
{
|
||||
clearTimeout(_ht);
|
||||
|
||||
if(_showTimer)
|
||||
_showTimer.stop();
|
||||
|
||||
DeposeUtil.removeFromStage(this._ui);
|
||||
if(_movieLoader)
|
||||
{
|
||||
_movieLoader.contentLoaderInfo.removeEventListener(SecurityErrorEvent.SECURITY_ERROR,errorHandler);
|
||||
_movieLoader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR,errorHandler);
|
||||
_movieLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE,gifgSwfCompleteHandler);
|
||||
_movieLoader.unloadAndStop(true);
|
||||
}
|
||||
|
||||
DeposeUtil.removeFromStage(_movieLoader);
|
||||
_movieLoader = null;
|
||||
this._ui = null;
|
||||
}
|
||||
|
||||
private function dd():void{
|
||||
|
||||
stopAndClear();
|
||||
|
||||
if(!_movieLoader)
|
||||
{
|
||||
_movieLoader= new Loader();
|
||||
_movieLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,errorHandler);
|
||||
_movieLoader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR,errorHandler);
|
||||
_movieLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,gifgSwfCompleteHandler);
|
||||
}
|
||||
|
||||
if(!this._ui)
|
||||
{
|
||||
this._ui = new UIComponent();
|
||||
this._ui.mouseChildren = false;
|
||||
this._ui.mouseEnabled = false;
|
||||
this._ui.addChild(_movieLoader);
|
||||
}
|
||||
this._ui.visible = _uiOn;
|
||||
|
||||
BaseService.getInstance().APP_SERVICE(1).addToSecondTopLayer(this._ui);
|
||||
if(url.lastIndexOf(".swf") != -1)
|
||||
{
|
||||
_movieLoader.load(new URLRequest(url));
|
||||
_movieLoader.visible = false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected function errorHandler(event:Event):void
|
||||
{
|
||||
_movieLoader.contentLoaderInfo.removeEventListener(SecurityErrorEvent.SECURITY_ERROR,errorHandler);
|
||||
_movieLoader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR,errorHandler);
|
||||
_movieLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE,gifgSwfCompleteHandler);
|
||||
}
|
||||
|
||||
public function depose():void
|
||||
{
|
||||
try
|
||||
{
|
||||
if(_showTimer)
|
||||
{
|
||||
_showTimer.removeEventListener(TimerEvent.TIMER,showTimerHandler);
|
||||
_showTimer.stop();
|
||||
_showTimer = null;
|
||||
}
|
||||
stopAndClear();
|
||||
|
||||
}
|
||||
catch(e:Error)
|
||||
{
|
||||
trace(e.getStackTrace())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private var _showFlag:Boolean = true;
|
||||
private var _showFlagIt:uint;
|
||||
private var swfWidth:int = 320;
|
||||
public var target:Sprite;
|
||||
private var swfHeight:int = 240;
|
||||
public function showOrHide(flag:Boolean):void
|
||||
{
|
||||
this._showFlag = flag;
|
||||
if(!flag)
|
||||
{
|
||||
stopAndClear();
|
||||
}
|
||||
clearTimeout(_showFlagIt);
|
||||
_showFlagIt = setTimeout(function handler():void{
|
||||
_showFlag = true;
|
||||
},30000);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.yy.vip.pk.effect.video
|
||||
{
|
||||
import com.yy.vip.pk.inter.IGiftVideoEffectModule;
|
||||
|
||||
import flash.display.Sprite;
|
||||
import flash.events.EventDispatcher;
|
||||
|
||||
public class GiftVideoEffectModule extends EventDispatcher implements IGiftVideoEffectModule
|
||||
{
|
||||
private var _leftVideoEffect:GiftReceiveVideoEffect;
|
||||
private var _rightVideoEffect:GiftReceiveVideoEffect;
|
||||
|
||||
public function GiftVideoEffectModule(leftTarget:Sprite,rightTarget:Sprite){
|
||||
_leftVideoEffect = new GiftReceiveVideoEffect();
|
||||
_leftVideoEffect.planeType = 0;
|
||||
_leftVideoEffect.target = leftTarget;
|
||||
|
||||
_rightVideoEffect = new GiftReceiveVideoEffect();
|
||||
_rightVideoEffect.planeType = 1;
|
||||
_rightVideoEffect.target = rightTarget;
|
||||
}
|
||||
public function showOrHide(flag:Boolean):void
|
||||
{
|
||||
if(_leftVideoEffect)
|
||||
_leftVideoEffect.showOrHide(flag);
|
||||
|
||||
if(_rightVideoEffect)
|
||||
_rightVideoEffect.showOrHide(flag);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user