Initialize local project and fix ranch growth synchronization
This commit is contained in:
@@ -0,0 +1,289 @@
|
||||
package net.pixvi.myr.panel.itemselect
|
||||
{
|
||||
import flash.events.Event;
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.myr.GameSetting;
|
||||
import net.pixvi.myr.center.ImgCenter;
|
||||
import net.pixvi.myr.center.Master;
|
||||
import net.pixvi.myr.element.alchemy.MaterialType;
|
||||
import net.pixvi.myr.element.bag.EquipVo;
|
||||
import net.pixvi.myr.element.bag.ItemVo;
|
||||
import net.pixvi.myr.panel.bag.EquipTip;
|
||||
import net.pixvi.pfw.utils.Paster;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
import net.pixvi.psg.ui.PSGPopPanel;
|
||||
|
||||
public class ItemSelectPanel extends PSGPopPanel
|
||||
{
|
||||
|
||||
public static var selectItem:ItemVo;
|
||||
|
||||
public static var selectedComplete:Boolean;
|
||||
|
||||
public static var itemTipGetFunction:Function;
|
||||
|
||||
public static const MODE_MON_GIFT:String = "gift";
|
||||
|
||||
public static const MODE_ALCHEMY_MATERIAL:String = "equipMaterial";
|
||||
|
||||
public static const MODE_EQUIP_INSTALL:String = "equipInstall";
|
||||
|
||||
public static const MODE_ARRAY:String = "modeArray";
|
||||
|
||||
public var ui:ItemSelectPanelUI = new ItemSelectPanelUI();
|
||||
|
||||
public var mode:String = "";
|
||||
|
||||
private var alertUseEquip:Boolean;
|
||||
|
||||
public function ItemSelectPanel(showTime:Number = -1, hideTime:Number = -1)
|
||||
{
|
||||
addChild(ui);
|
||||
super(GameSetting.PanelTransTime,GameSetting.PanelTransTime);
|
||||
ui.btn_close.onClick(closeHandler);
|
||||
ui.btn_sortDirect.onClick(switchSortDirect);
|
||||
ui.switch_sort.addEventListener("piselect",updateSort);
|
||||
}
|
||||
|
||||
private static function getItemName(item:Object) : String
|
||||
{
|
||||
return item.name;
|
||||
}
|
||||
|
||||
private static function getItemMaterial(item:Object) : String
|
||||
{
|
||||
var str:String = item.name + "<br/>";
|
||||
return str + Paster.font(MaterialType.getMaterialsTip([item.type]).join("<br/>"),"#ca5000",18);
|
||||
}
|
||||
|
||||
public static function cleanModeTipMode() : void
|
||||
{
|
||||
itemTipGetFunction = null;
|
||||
}
|
||||
|
||||
public static function getIns() : ItemSelectPanel
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(ItemSelectPanel) as ItemSelectPanel;
|
||||
}
|
||||
|
||||
public function closeHandler(e:Event = null) : void
|
||||
{
|
||||
selectedComplete = false;
|
||||
selectItem = null;
|
||||
this.showOut();
|
||||
dispatchEvent(new Event("complete"));
|
||||
}
|
||||
|
||||
override public function init() : void
|
||||
{
|
||||
GlobalBroadcast.addEventListener("androidBack",AndroidBackHandler);
|
||||
ImgCenter.addFsMask(this);
|
||||
}
|
||||
|
||||
private function AndroidBackHandler(e:Event = null) : void
|
||||
{
|
||||
if(PopCenter.getIns().topPanel == this)
|
||||
{
|
||||
closeHandler();
|
||||
}
|
||||
}
|
||||
|
||||
private function switchSortDirect(e:Event = null) : void
|
||||
{
|
||||
ui.btn_sortDirect.switchSelectStatus();
|
||||
updateSort();
|
||||
}
|
||||
|
||||
public function updateSort(e:Event = null) : void
|
||||
{
|
||||
var sortDownDirect:Boolean = ui.btn_sortDirect.selected ? false : true;
|
||||
var sortPara:String = "quality";
|
||||
if(ui.switch_sort.value != null)
|
||||
{
|
||||
sortPara = ui.switch_sort.value.toString();
|
||||
}
|
||||
if(sortDownDirect)
|
||||
{
|
||||
ui.list_item.itemDatas.sortOn(sortPara,0x10 | 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.list_item.itemDatas.sortOn(sortPara,16);
|
||||
}
|
||||
ui.list_item.setDatas(ui.list_item.itemDatas);
|
||||
}
|
||||
|
||||
public function modeMonsterGift() : void
|
||||
{
|
||||
mode = "gift";
|
||||
ui.btn_cancel.visible = false;
|
||||
ui.text_info.text = lang("选择赠送的礼物");
|
||||
itemTipGetFunction = getItemName;
|
||||
ui.list_item.setDatas(Master.bag.sellableItems());
|
||||
ui.list_item.addEventListener("piselect",selectHandler);
|
||||
if(ui.list_item.itemDatasLength <= 0)
|
||||
{
|
||||
if(ui.mc_empty != null)
|
||||
{
|
||||
ui.mc_empty.visible = true;
|
||||
}
|
||||
}
|
||||
else if(ui.mc_empty != null)
|
||||
{
|
||||
ui.mc_empty.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function modeEquipMakeMaterial() : void
|
||||
{
|
||||
mode = "equipMaterial";
|
||||
itemTipGetFunction = getItemMaterial;
|
||||
ui.btn_cancel.visible = false;
|
||||
ui.text_info.text = lang("选择材料");
|
||||
ui.list_item.setDatas(Master.bag.alchemyMaterialItems());
|
||||
ui.list_item.addEventListener("piselect",selectHandler);
|
||||
if(ui.list_item.itemDatasLength <= 0)
|
||||
{
|
||||
if(ui.mc_empty != null)
|
||||
{
|
||||
ui.mc_empty.visible = true;
|
||||
}
|
||||
}
|
||||
else if(ui.mc_empty != null)
|
||||
{
|
||||
ui.mc_empty.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function modeEquipInstall(part:int = 1, exceptItemId:Number = -1) : void
|
||||
{
|
||||
var i:int = 0;
|
||||
mode = "equipInstall";
|
||||
ui.text_info.text = lang("选择装备");
|
||||
itemTipGetFunction = null;
|
||||
ui.btn_cancel.visible = true;
|
||||
ui.btn_cancel.onClick(cancelHandler);
|
||||
var alle:Array = Master.bag.getEquipArr();
|
||||
var es:Array = [];
|
||||
for(i = 0; i < alle.length; )
|
||||
{
|
||||
if((alle[i] as EquipVo).part == part)
|
||||
{
|
||||
es.push(alle[i]);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
ui.list_item.setDatas(es);
|
||||
ui.list_item.removeEventListener("piselect",selectHandler);
|
||||
ui.list_item.addEventListener("piselect",equipInstallSelectHandler);
|
||||
if(ui.list_item.itemDatasLength <= 0)
|
||||
{
|
||||
if(ui.mc_empty != null)
|
||||
{
|
||||
ui.mc_empty.visible = true;
|
||||
}
|
||||
}
|
||||
else if(ui.mc_empty != null)
|
||||
{
|
||||
ui.mc_empty.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function modeArray(arr:Array, alertUseEquip:Boolean = true) : void
|
||||
{
|
||||
ui.btn_cancel.visible = false;
|
||||
mode = "modeArray";
|
||||
this.alertUseEquip = alertUseEquip;
|
||||
ui.text_info.text = lang("选择被打造的物品");
|
||||
itemTipGetFunction = getItemName;
|
||||
ui.list_item.setDatas(arr);
|
||||
ui.list_item.addEventListener("piselect",selectHandler);
|
||||
if(ui.list_item.itemDatasLength <= 0)
|
||||
{
|
||||
if(ui.mc_empty != null)
|
||||
{
|
||||
ui.mc_empty.visible = true;
|
||||
}
|
||||
}
|
||||
else if(ui.mc_empty != null)
|
||||
{
|
||||
ui.mc_empty.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function equipInstallSelectHandler(e:Event = null) : void
|
||||
{
|
||||
EquipTip.getIns().showOut();
|
||||
EquipTip.getIns().onData(ui.list_item.curSelectedItemData);
|
||||
EquipTip.getIns().showOn(ui.list_item.curSelectedItem,true,false,true);
|
||||
addChild(EquipTip.getIns());
|
||||
EquipTip.getIns().addEventListener("use",selectHandler);
|
||||
ui.list_item.addEventListener("pislide",EquipTip.getIns().clickHandler);
|
||||
}
|
||||
|
||||
private function cancelHandler(e:Event = null) : void
|
||||
{
|
||||
selectedComplete = true;
|
||||
selectItem = null;
|
||||
this.showOut();
|
||||
dispatchEvent(new Event("complete"));
|
||||
}
|
||||
|
||||
public function selectHandler(e:Event = null) : void
|
||||
{
|
||||
selectItem = ui.list_item.curSelectedItemData as ItemVo;
|
||||
if(mode == "modeArray")
|
||||
{
|
||||
if(alertUseEquip == true)
|
||||
{
|
||||
if(selectItem is EquipVo)
|
||||
{
|
||||
if((selectItem as EquipVo).isUsed)
|
||||
{
|
||||
Alert.showMsg(lang("装备【{0}】正在使用中。",selectItem.name));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
selectedComplete = true;
|
||||
if(mode == "equipInstall")
|
||||
{
|
||||
ui.list_item.removeEventListener("pislide",EquipTip.getIns().clickHandler);
|
||||
EquipTip.getIns().showOut();
|
||||
EquipTip.getIns().removeEventListener("use",selectHandler);
|
||||
}
|
||||
if(mode == "gift")
|
||||
{
|
||||
Alert.yesno(lang("请确认"),lang("是否将【{0}】作为礼物赠送?",selectItem.name),yesSelectHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.showOut();
|
||||
dispatchEvent(new Event("complete"));
|
||||
}
|
||||
}
|
||||
|
||||
override public function reset() : void
|
||||
{
|
||||
ui.list_item.removeEventListener("piselect",equipInstallSelectHandler);
|
||||
}
|
||||
|
||||
override public function showOut() : void
|
||||
{
|
||||
cleanModeTipMode();
|
||||
super.showOut();
|
||||
GlobalBroadcast.removeEventListener("androidBack",AndroidBackHandler);
|
||||
}
|
||||
|
||||
public function yesSelectHandler() : void
|
||||
{
|
||||
this.showOut();
|
||||
dispatchEvent(new Event("complete"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package net.pixvi.myr.panel.itemselect
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.Sprite;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.myr.element.snd.GameSound;
|
||||
import net.pixvi.myr.panel.bag.ItemSliderListItemLarge;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.controls.PiBitTextField;
|
||||
import net.pixvi.pfw.ui.controls.PiSliderList;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
import net.pixvi.psg.ui.controller.PiLightSwitch;
|
||||
|
||||
public class ItemSelectPanelUI extends UIComponent
|
||||
{
|
||||
|
||||
public var list_item:PiSliderList;
|
||||
|
||||
public var btn_close:PiLightButton;
|
||||
|
||||
public var text_info:PiBitTextField;
|
||||
|
||||
public var btn_cancel:PiLightButton;
|
||||
|
||||
public var mc_empty:Sprite;
|
||||
|
||||
public var switch_sort:PiLightSwitch;
|
||||
|
||||
public var btn_sortDirect:PiLightButton;
|
||||
|
||||
public function ItemSelectPanelUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
skin = FF.getMC("ui.ItemSelectPanelUI");
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
list_item.setList(ItemSliderListItemLarge,30,false,143,4,146);
|
||||
btn_close.sound_click = GameSound.effect_click_close1;
|
||||
btn_cancel.sound_click = GameSound.effect_click_close1;
|
||||
switch_sort.setValues("quality","q1","q2","q3","q4","q5");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user