Initialize local project and fix ranch growth synchronization
This commit is contained in:
@@ -0,0 +1,131 @@
|
||||
package net.pixvi.myr.panel.npc
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.Event;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.myr.element.npc.NPCVo;
|
||||
import net.pixvi.myr.element.npc.PositionNPC;
|
||||
import net.pixvi.myr.element.randomevent.RandomEventVo;
|
||||
import net.pixvi.myr.element.task.TaskVo;
|
||||
import net.pixvi.myr.event.MYREvent;
|
||||
import net.pixvi.pfw.display.NetBitImg;
|
||||
import net.pixvi.pfw.event.MobiEvent;
|
||||
import net.pixvi.pfw.ui.controls.PiBitTextField;
|
||||
import net.pixvi.pfw.ui.controls.PiSliderListItem;
|
||||
import net.pixvi.pfw.utils.Paster;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class NPCSliderListItem extends PiSliderListItem
|
||||
{
|
||||
|
||||
public var mc_talk:MovieClip;
|
||||
|
||||
public var img:NetBitImg;
|
||||
|
||||
public var text_name:PiBitTextField;
|
||||
|
||||
public var text_des:PiBitTextField;
|
||||
|
||||
public var mc_container:Sprite;
|
||||
|
||||
public function NPCSliderListItem(skin:DisplayObject = null, auto:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
skin = FF.getMC("ui.NPCSliderItemUI");
|
||||
super(skin,auto,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
mc_talk.mouseEnabled = mc_talk.mouseChildren = false;
|
||||
text_name.mouseChildren = text_name.mouseEnabled = false;
|
||||
text_des.mouseChildren = text_des.mouseEnabled = false;
|
||||
text_name.scaleMode = true;
|
||||
text_des.scaleMode = true;
|
||||
}
|
||||
|
||||
override public function onData(value:Object) : void
|
||||
{
|
||||
var name:String = null;
|
||||
mc_talk.visible = false;
|
||||
mc_talk.stop();
|
||||
PiLightButton.btnTouchLight.setDisplay(this);
|
||||
if(img != null)
|
||||
{
|
||||
if(mc_container.contains(img))
|
||||
{
|
||||
mc_container.removeChild(img);
|
||||
img.dispose();
|
||||
}
|
||||
}
|
||||
img = new NetBitImg();
|
||||
img.addEventListener("complete",imgComplete);
|
||||
var npc:NPCVo = new NPCVo();
|
||||
if(value is TaskVo)
|
||||
{
|
||||
mc_talk.visible = true;
|
||||
mc_talk.play();
|
||||
TweenMax.fromTo(mc_talk,0.5,{
|
||||
"scaleX":0.1,
|
||||
"scaleY":0.1
|
||||
},{
|
||||
"scaleX":1,
|
||||
"scaleY":1
|
||||
});
|
||||
npc.type = (value as TaskVo).stepVo.npc;
|
||||
}
|
||||
else if(value is RandomEventVo)
|
||||
{
|
||||
mc_talk.visible = false;
|
||||
mc_talk.stop();
|
||||
npc.type = (value as RandomEventVo).storyNpc;
|
||||
}
|
||||
else if(value is PositionNPC)
|
||||
{
|
||||
mc_talk.visible = false;
|
||||
mc_talk.stop();
|
||||
npc.type = (value as PositionNPC).npc;
|
||||
}
|
||||
if(npc.exsist())
|
||||
{
|
||||
text_des.text = npc.des;
|
||||
name = npc.name;
|
||||
name = Paster.replace(name,"NANO","NANO");
|
||||
name = Paster.replace(name,"MIO","MIO");
|
||||
text_name.text = name;
|
||||
img.load(npc.img_avatar());
|
||||
if(npc.darkMode)
|
||||
{
|
||||
TweenMax.to(img,0,{"tint":0});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
text_name.text = "error";
|
||||
text_des.text = npc.type + ":can\'t find NPC";
|
||||
}
|
||||
this.addEventListener(MobiEvent.CLICK,clickHandler);
|
||||
}
|
||||
|
||||
public function clickHandler(e:Event = null) : void
|
||||
{
|
||||
dispatchEvent(new MYREvent(MYREvent.TALK,data,true));
|
||||
}
|
||||
|
||||
public function imgComplete(e:Event = null) : void
|
||||
{
|
||||
img.x = 0;
|
||||
img.y = -img.height;
|
||||
img.alpha = 0;
|
||||
mc_container.addChildAt(img,0);
|
||||
TweenMax.to(img,0.5,{"alpha":1});
|
||||
}
|
||||
|
||||
override public function reset() : void
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user