Initialize local project and fix ranch growth synchronization
This commit is contained in:
@@ -0,0 +1,201 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.myr.element.bag.ItemType;
|
||||
import net.pixvi.myr.element.lib.LibEquipVo;
|
||||
import net.pixvi.myr.element.lib.LibTypeVo;
|
||||
import net.pixvi.pfw.utils.ArrayUtil;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class LibCenter extends Singleton
|
||||
{
|
||||
|
||||
public var curLibVo:LibTypeVo;
|
||||
|
||||
public function LibCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : LibCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(LibCenter) as LibCenter;
|
||||
}
|
||||
|
||||
public function getUnlockLibs() : Array
|
||||
{
|
||||
var i:int = 0;
|
||||
var unlockLibs:Array = [];
|
||||
var libs:Array = getLibs();
|
||||
for(i = 0; i < libs.length; )
|
||||
{
|
||||
if((libs[i] as LibTypeVo).unlock)
|
||||
{
|
||||
unlockLibs.push(libs[i]);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return unlockLibs;
|
||||
}
|
||||
|
||||
public function getLibs() : Array
|
||||
{
|
||||
var libvo:LibTypeVo = null;
|
||||
var i:int = 0;
|
||||
var libVos:Array = [];
|
||||
for each(var vo:Object in Table.monster_infoArr)
|
||||
{
|
||||
if(!vo.hideLib)
|
||||
{
|
||||
libvo = new LibTypeVo();
|
||||
libvo.monType = vo.type;
|
||||
libVos.push(libvo);
|
||||
}
|
||||
}
|
||||
libVos.sortOn("sort",16);
|
||||
for(i = 0; i < libVos.length; )
|
||||
{
|
||||
libVos[i].no = i + 1;
|
||||
i++;
|
||||
}
|
||||
return libVos;
|
||||
}
|
||||
|
||||
public function getLibByType(monType:int) : LibTypeVo
|
||||
{
|
||||
var a:Object = ArrayUtil.getElementByValue(getLibs(),"monType",monType);
|
||||
if(a == null)
|
||||
{
|
||||
Alert.yes("error","Can\'t find monLib type[" + monType + "]");
|
||||
}
|
||||
return ArrayUtil.getElementByValue(getLibs(),"monType",monType) as LibTypeVo;
|
||||
}
|
||||
|
||||
public function getEquipLibs() : Array
|
||||
{
|
||||
var libvo:LibEquipVo = null;
|
||||
var libVos:Array = [];
|
||||
var nos:Object = {
|
||||
"1":0,
|
||||
"2":0,
|
||||
"3":0,
|
||||
"4":0,
|
||||
"5":0,
|
||||
"6":0
|
||||
};
|
||||
for each(var vo:Object in Table.item_info)
|
||||
{
|
||||
if(vo.itemType == ItemType.TYPE_EQUIP && vo.hideLib != true)
|
||||
{
|
||||
libvo = new LibEquipVo();
|
||||
libvo.equipType = vo.type;
|
||||
if(libvo.part <= 3)
|
||||
{
|
||||
libvo.no = nos[libvo.quality.toString()] + 1;
|
||||
nos[libvo.quality.toString()]++;
|
||||
}
|
||||
else
|
||||
{
|
||||
libvo.no = nos[6] + 1;
|
||||
nos[6]++;
|
||||
}
|
||||
libVos.push(libvo);
|
||||
}
|
||||
}
|
||||
libVos.sortOn("sort",16);
|
||||
return libVos;
|
||||
}
|
||||
|
||||
public function getEquipUnlockLibs() : Array
|
||||
{
|
||||
var i:int = 0;
|
||||
var unlockLibs:Array = [];
|
||||
var libs:Array = getEquipLibs();
|
||||
for(i = 0; i < libs.length; )
|
||||
{
|
||||
if((libs[i] as LibEquipVo).unlock)
|
||||
{
|
||||
unlockLibs.push(libs[i]);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return unlockLibs;
|
||||
}
|
||||
|
||||
public function countEquipLibs() : int
|
||||
{
|
||||
var num:int = 0;
|
||||
for each(var vo:Object in Table.item_info)
|
||||
{
|
||||
if(vo.itemType == ItemType.TYPE_EQUIP && !vo.hideLib)
|
||||
{
|
||||
num++;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
public function countLibs() : int
|
||||
{
|
||||
var num:int = 0;
|
||||
for each(var vo:Object in Table.monster_infoArr)
|
||||
{
|
||||
if(!vo.hideLib)
|
||||
{
|
||||
num++;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
public function unlockLib(type:int, show:Boolean = true) : void
|
||||
{
|
||||
Master.history.monLib.push(type);
|
||||
LibTypeVo.newType.push(type);
|
||||
if(show)
|
||||
{
|
||||
StatusCenter.getIns().unlockMonster(type);
|
||||
}
|
||||
}
|
||||
|
||||
public function getNumUnlockByMonTypes(types:Array) : int
|
||||
{
|
||||
var i:int = 0;
|
||||
var num:int = 0;
|
||||
for(i = 0; i < types.length; )
|
||||
{
|
||||
if(Master.history.monLib.indexOf(types[i]) != -1)
|
||||
{
|
||||
num++;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
public function checkUnlock(type:int) : Boolean
|
||||
{
|
||||
return Master.history.monLib.indexOf(type) >= 0;
|
||||
}
|
||||
|
||||
public function checkEquipUnlock(type:int) : Boolean
|
||||
{
|
||||
return Master.history.equipLib.indexOf(type.toString()) >= 0;
|
||||
}
|
||||
|
||||
public function checkUnlocks(types:Array) : Boolean
|
||||
{
|
||||
var i:int = 0;
|
||||
for(i = 0; i < types.length; )
|
||||
{
|
||||
if(!checkUnlock(types[i]))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user