Initialize local project and fix ranch growth synchronization
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
package net.pixvi.common.net
|
||||
{
|
||||
import net.pixvi.common.manager.resource.ConfigManager;
|
||||
import net.pixvi.pfw.net.PiStringLoader;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class ConfigLoader extends Singleton
|
||||
{
|
||||
|
||||
private var _onLoaded:Function;
|
||||
|
||||
private var loader:PiStringLoader;
|
||||
|
||||
private var srcHack:Object = {};
|
||||
|
||||
public function ConfigLoader()
|
||||
{
|
||||
super();
|
||||
loader = new PiStringLoader();
|
||||
}
|
||||
|
||||
public static function getInstance() : ConfigLoader
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(ConfigLoader) as ConfigLoader;
|
||||
}
|
||||
|
||||
public function loadConfig(src:String, onloaded:Function = null, onerror:Function = null, crypto:Boolean = false, srcHack:Object = null) : void
|
||||
{
|
||||
this._onLoaded = onloaded;
|
||||
if(srcHack != null)
|
||||
{
|
||||
this.srcHack = srcHack;
|
||||
}
|
||||
loader.cryptoMode = crypto;
|
||||
loader.load(src,completeHandler,null,onerror);
|
||||
}
|
||||
|
||||
private function completeHandler() : void
|
||||
{
|
||||
ConfigManager.getInstance().setup(new XML(loader.getData()),srcHack);
|
||||
this._onLoaded.call();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
package net.pixvi.common.net.remote
|
||||
{
|
||||
import flash.events.Event;
|
||||
import flash.events.IOErrorEvent;
|
||||
import flash.events.TimerEvent;
|
||||
import flash.net.URLLoader;
|
||||
import flash.net.URLRequest;
|
||||
import flash.net.URLRequestHeader;
|
||||
import flash.utils.Timer;
|
||||
|
||||
public class HttpRemote
|
||||
{
|
||||
|
||||
public static const TRADITIONAL_DATAFORMAT:String = "traditional";
|
||||
|
||||
public static const JSON_DATAFORMAT:String = "jsonDataFormat";
|
||||
|
||||
public var _callBackFun:Function;
|
||||
|
||||
private var _errorFun:Function;
|
||||
|
||||
private var _loader:URLLoader;
|
||||
|
||||
private var _request:URLRequest;
|
||||
|
||||
private var overTimer:Timer;
|
||||
|
||||
public var url:String;
|
||||
|
||||
private var _data:Object;
|
||||
|
||||
public var retryMode:Boolean = false;
|
||||
|
||||
public var cryptoMode:Boolean = false;
|
||||
|
||||
public var waiting:Boolean = true;
|
||||
|
||||
public var errorBack:Boolean = false;
|
||||
|
||||
public function HttpRemote(url:String, sendData:Object, callBackFun:Function = null, errorFun:Function = null, requestHeaders:Array = null, overTime:int = 1500, dataFormat:String = "text")
|
||||
{
|
||||
var i:int = 0;
|
||||
super();
|
||||
this.url = url;
|
||||
this._callBackFun = callBackFun;
|
||||
this._errorFun = errorFun;
|
||||
var request:URLRequest = new URLRequest(url);
|
||||
_loader = new URLLoader();
|
||||
if(dataFormat == "text")
|
||||
{
|
||||
request.contentType = "text/xml";
|
||||
_loader.dataFormat = "text";
|
||||
}
|
||||
else if(dataFormat == "binary")
|
||||
{
|
||||
request.contentType = "application/octet-stream";
|
||||
_loader.dataFormat = "binary";
|
||||
}
|
||||
else if(dataFormat == "variables")
|
||||
{
|
||||
request.contentType = "application/x-www-form-urlencoded";
|
||||
_loader.dataFormat = "binary";
|
||||
}
|
||||
else if(dataFormat == "traditional")
|
||||
{
|
||||
request.contentType = "application/x-www-form-urlencoded";
|
||||
_loader.dataFormat = "text";
|
||||
}
|
||||
else if(dataFormat == "jsonDataFormat")
|
||||
{
|
||||
request.contentType = "application/json;charset=UTF-8";
|
||||
_loader.dataFormat = "text";
|
||||
}
|
||||
var rhArray:Array = [];
|
||||
if(requestHeaders != null)
|
||||
{
|
||||
for(i = 0; i < requestHeaders.length; )
|
||||
{
|
||||
rhArray.push(new URLRequestHeader(requestHeaders[i][0],requestHeaders[i][1]));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
request.data = sendData;
|
||||
_data = sendData;
|
||||
request.method = "POST";
|
||||
request.requestHeaders = rhArray;
|
||||
_request = request;
|
||||
if(overTime > 0)
|
||||
{
|
||||
overTimer = new Timer(overTime,1);
|
||||
overTimer.addEventListener("timerComplete",timerHandler);
|
||||
}
|
||||
}
|
||||
|
||||
public function start() : void
|
||||
{
|
||||
if(overTimer != null)
|
||||
{
|
||||
overTimer.start();
|
||||
}
|
||||
_loader.addEventListener("complete",completeHandler);
|
||||
_loader.addEventListener("ioError",errorHandler);
|
||||
trace("【loadURL】 " + _request.url);
|
||||
_loader.load(_request);
|
||||
}
|
||||
|
||||
protected function timerHandler(e:TimerEvent) : void
|
||||
{
|
||||
errorHandler(null);
|
||||
}
|
||||
|
||||
private function completeHandler(e:Event) : void
|
||||
{
|
||||
trace("【loadData】 " + e.target.data);
|
||||
this._callBackFun(e.target.data);
|
||||
this._callBackFun = null;
|
||||
this._errorFun = null;
|
||||
if(overTimer != null)
|
||||
{
|
||||
overTimer.stop();
|
||||
overTimer.removeEventListener("timerComplete",timerHandler);
|
||||
}
|
||||
}
|
||||
|
||||
private function errorHandler(event:IOErrorEvent) : void
|
||||
{
|
||||
if(overTimer != null)
|
||||
{
|
||||
overTimer.reset();
|
||||
}
|
||||
_loader.removeEventListener("ioError",errorHandler);
|
||||
if(this._errorFun != null)
|
||||
{
|
||||
if(event == null)
|
||||
{
|
||||
event = new IOErrorEvent("ioError");
|
||||
event.text = "[HttpRemote]请求超时(" + int(overTimer.delay / 1000) + "s)!url:" + url;
|
||||
}
|
||||
this._errorFun(event);
|
||||
}
|
||||
if(!retryMode)
|
||||
{
|
||||
clear();
|
||||
}
|
||||
}
|
||||
|
||||
private function clear() : void
|
||||
{
|
||||
_loader.removeEventListener("complete",completeHandler);
|
||||
_loader.removeEventListener("ioError",errorHandler);
|
||||
if(overTimer != null)
|
||||
{
|
||||
overTimer.stop();
|
||||
overTimer.removeEventListener("timerComplete",timerHandler);
|
||||
overTimer = null;
|
||||
}
|
||||
_loader = null;
|
||||
this._callBackFun = null;
|
||||
this._errorFun = null;
|
||||
}
|
||||
|
||||
public function get data() : Object
|
||||
{
|
||||
return _data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package net.pixvi.common.net.remote
|
||||
{
|
||||
public class HttpRemoteContentType
|
||||
{
|
||||
|
||||
public static const TEXT_XML:String = "text/xml";
|
||||
|
||||
public static const APPLICATION_OCTET_STREAM:String = "application/octet-stream";
|
||||
|
||||
public static const X_WWW_FORM_URLENCODED:String = "application/x-www-form-urlencoded";
|
||||
|
||||
public static const JSON_CONTENT:String = "application/json;charset=UTF-8";
|
||||
|
||||
public function HttpRemoteContentType()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,223 @@
|
||||
package net.pixvi.common.net.resource
|
||||
{
|
||||
import flash.events.ErrorEvent;
|
||||
import net.pixvi.common.SysSetting;
|
||||
import net.pixvi.common.manager.resource.RM;
|
||||
import net.pixvi.pfw.net.PiDisplayLoader;
|
||||
import net.pixvi.pfw.net.base.PiLoader;
|
||||
|
||||
public class ResourceLoader extends PiLoader
|
||||
{
|
||||
|
||||
private var _resourceList:Array;
|
||||
|
||||
private var _resource:ResourceVo;
|
||||
|
||||
private var _flag:int = 0;
|
||||
|
||||
private var loader:PiLoader;
|
||||
|
||||
private var _allBytesLoaded:int = 0;
|
||||
|
||||
private var _allBytesTotal:int = 0;
|
||||
|
||||
public function ResourceLoader()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
override public function load(list:*, onComplete:Function = null, onProgress:Function = null, onError:Function = null) : void
|
||||
{
|
||||
var resourceArr:Array = null;
|
||||
if(list is Vector.<ResourceVo>)
|
||||
{
|
||||
resourceArr = [];
|
||||
for each(var rv:ResourceVo in list)
|
||||
{
|
||||
resourceArr.push(rv);
|
||||
}
|
||||
_resourceList = resourceArr;
|
||||
}
|
||||
else
|
||||
{
|
||||
_resourceList = list;
|
||||
}
|
||||
super.load(_resourceList,onComplete,onProgress,onError);
|
||||
}
|
||||
|
||||
public function get filesTotal() : int
|
||||
{
|
||||
return _resourceList.length;
|
||||
}
|
||||
|
||||
public function get filesLoaded() : int
|
||||
{
|
||||
return _flag;
|
||||
}
|
||||
|
||||
override public function doLoad() : void
|
||||
{
|
||||
startCurrentLoader();
|
||||
}
|
||||
|
||||
public function getResource(id:String) : ResourceVo
|
||||
{
|
||||
for each(var r:ResourceVo in _resourceList)
|
||||
{
|
||||
if(r.id == id)
|
||||
{
|
||||
return r;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private function startCurrentLoader() : void
|
||||
{
|
||||
if(_flag < _resourceList.length)
|
||||
{
|
||||
_resource = _resourceList[_flag];
|
||||
trace("[ResourceLoader]" + _resource.src + " " + _flag);
|
||||
if(_resource.loaded)
|
||||
{
|
||||
_allBytesLoaded += _resource.size;
|
||||
_flag++;
|
||||
startCurrentLoader();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_resource.type == null || _resource.type == "")
|
||||
{
|
||||
_resource.setBySrc(_resource.src);
|
||||
}
|
||||
loader = ResourceType.createLoader(_resource.type,_resource.crypto,_resource.binaryMode);
|
||||
loader.load(_resource.src,loaderComplete,loaderProgress,loaderError);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
completeHandler();
|
||||
removeHandler();
|
||||
}
|
||||
}
|
||||
|
||||
public function get curResource() : ResourceVo
|
||||
{
|
||||
return _resource;
|
||||
}
|
||||
|
||||
private function loaderComplete() : void
|
||||
{
|
||||
_flag++;
|
||||
_allBytesLoaded += loader.bytesTotal;
|
||||
trace(loader + "【加载完毕】" + loader.src + "[" + loader.bytesTotal + "]");
|
||||
if(loader is PiDisplayLoader)
|
||||
{
|
||||
trace("binaryMode:" + (loader as PiDisplayLoader).binaryMode);
|
||||
}
|
||||
loader.removeHandler();
|
||||
_resource.data = loader.getData();
|
||||
RM.getInstance().add(_resource);
|
||||
loader = null;
|
||||
startCurrentLoader();
|
||||
}
|
||||
|
||||
private function loaderProgress() : void
|
||||
{
|
||||
if(loader.bytesTotal > 0 && _resource.size != loader.bytesLoaded)
|
||||
{
|
||||
_resource.size = loader.bytesTotal;
|
||||
}
|
||||
progressHandler();
|
||||
}
|
||||
|
||||
private function loaderError(e:ErrorEvent) : void
|
||||
{
|
||||
loader.removeHandler();
|
||||
loader.unload();
|
||||
if(_resource.retryCount < SysSetting.maxRetry)
|
||||
{
|
||||
trace("资源" + _resource.src + "加载失败!重试: " + _resource.retryCount + 1);
|
||||
_resource.retryCount++;
|
||||
startCurrentLoader();
|
||||
return;
|
||||
}
|
||||
throw new Error("资源" + _resource.src + "加载失败!");
|
||||
}
|
||||
|
||||
public function get allBytesTotal() : uint
|
||||
{
|
||||
var i:int = 0;
|
||||
_allBytesTotal = 0;
|
||||
var len:int = int(_resourceList.length);
|
||||
for(i = 0; i < len; )
|
||||
{
|
||||
if(_resourceList[i].size && !_resourceList[i].failed)
|
||||
{
|
||||
_allBytesTotal += _resourceList[i].size;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return _allBytesTotal;
|
||||
}
|
||||
|
||||
public function get allBytesLoaded() : uint
|
||||
{
|
||||
if(loader != null)
|
||||
{
|
||||
return _allBytesLoaded + loader.bytesLoaded;
|
||||
}
|
||||
return _allBytesLoaded;
|
||||
}
|
||||
|
||||
override public function stopLoad() : void
|
||||
{
|
||||
if(loader != null)
|
||||
{
|
||||
loader.stopLoad();
|
||||
}
|
||||
}
|
||||
|
||||
override public function getData() : *
|
||||
{
|
||||
return _resourceList;
|
||||
}
|
||||
|
||||
public function get smartLoadedPercent() : Number
|
||||
{
|
||||
return filesLoaded / filesTotal + bytesLoaded / bytesTotal * (1 / filesTotal);
|
||||
}
|
||||
|
||||
public function get loadedPercent() : Number
|
||||
{
|
||||
return allBytesLoaded / allBytesTotal;
|
||||
}
|
||||
|
||||
override public function get bytesLoaded() : int
|
||||
{
|
||||
if(loader != null)
|
||||
{
|
||||
return loader.bytesLoaded;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
override public function get bytesTotal() : int
|
||||
{
|
||||
if(loader != null)
|
||||
{
|
||||
return loader.bytesTotal;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function removeAllResource() : void
|
||||
{
|
||||
for each(var r:ResourceVo in _resourceList)
|
||||
{
|
||||
RM.getInstance().remove(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
package net.pixvi.common.net.resource
|
||||
{
|
||||
import net.pixvi.pfw.display.NetImg;
|
||||
import net.pixvi.pfw.net.PiByteLoader;
|
||||
import net.pixvi.pfw.net.PiDisplayLoader;
|
||||
import net.pixvi.pfw.net.PiSoundLoader;
|
||||
import net.pixvi.pfw.net.PiStringLoader;
|
||||
import net.pixvi.pfw.net.base.PiLoader;
|
||||
|
||||
public class ResourceType
|
||||
{
|
||||
|
||||
public static const SWF:String = "swf";
|
||||
|
||||
public static const XML:String = "xml";
|
||||
|
||||
public static const JPG:String = "jpg";
|
||||
|
||||
public static const PNG:String = "png";
|
||||
|
||||
public static const CSV:String = "csv";
|
||||
|
||||
public static const MP3:String = "mp3";
|
||||
|
||||
public static const BYTE:String = "byte";
|
||||
|
||||
public static const TXT:String = "txt";
|
||||
|
||||
public static const JSON:String = "json";
|
||||
|
||||
public function ResourceType()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function createLoader(type:String, crypto:Boolean = false, binaryMode:Boolean = false) : PiLoader
|
||||
{
|
||||
var loader:PiLoader = null;
|
||||
switch(type)
|
||||
{
|
||||
case "jpg":
|
||||
case "png":
|
||||
case "swf":
|
||||
loader = new PiDisplayLoader();
|
||||
if((type == "jpg" || type == "png") && NetImg.globalImgCryptoMode)
|
||||
{
|
||||
(loader as PiDisplayLoader).cryptoMode = true;
|
||||
}
|
||||
if(type == "swf" && binaryMode)
|
||||
{
|
||||
(loader as PiDisplayLoader).binaryMode = true;
|
||||
}
|
||||
break;
|
||||
case "xml":
|
||||
case "csv":
|
||||
case "txt":
|
||||
loader = new PiStringLoader();
|
||||
if(crypto)
|
||||
{
|
||||
(loader as PiStringLoader).cryptoMode = true;
|
||||
}
|
||||
break;
|
||||
case "json":
|
||||
if(crypto && PiStringLoader.globalCryptoMode)
|
||||
{
|
||||
loader = new PiByteLoader();
|
||||
loader["jsonCryptoMode"] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
loader = new PiStringLoader();
|
||||
}
|
||||
break;
|
||||
case "mp3":
|
||||
loader = new PiSoundLoader();
|
||||
break;
|
||||
default:
|
||||
case "byte":
|
||||
loader = new PiByteLoader();
|
||||
}
|
||||
return loader;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
package net.pixvi.common.net.resource
|
||||
{
|
||||
import net.pixvi.pfw.interfaces.IDispose;
|
||||
|
||||
public class ResourceVo implements IDispose
|
||||
{
|
||||
|
||||
public var id:String;
|
||||
|
||||
public var src:String;
|
||||
|
||||
public var type:String;
|
||||
|
||||
public var size:int;
|
||||
|
||||
public var loadwhenstart:int;
|
||||
|
||||
public var team:String;
|
||||
|
||||
public var param:String;
|
||||
|
||||
public var paramObj:Object;
|
||||
|
||||
public var crypto:Boolean = false;
|
||||
|
||||
public var binaryMode:Boolean = false;
|
||||
|
||||
private var _loaded:Boolean;
|
||||
|
||||
private var _failed:Boolean = false;
|
||||
|
||||
public var retryCount:int = 0;
|
||||
|
||||
private var _data:*;
|
||||
|
||||
public function ResourceVo(src:String = "")
|
||||
{
|
||||
super();
|
||||
_loaded = false;
|
||||
paramObj = {};
|
||||
if(src != "")
|
||||
{
|
||||
setBySrc(src);
|
||||
}
|
||||
}
|
||||
|
||||
public function setBySrc(src:String) : void
|
||||
{
|
||||
this.src = src;
|
||||
var tag:Array = src.split("/");
|
||||
var file:String = tag[tag.length - 1];
|
||||
tag = file.split(".");
|
||||
type = tag[1];
|
||||
id = tag[0];
|
||||
loaded = false;
|
||||
size = -1;
|
||||
}
|
||||
|
||||
public function get loaded() : Boolean
|
||||
{
|
||||
return _loaded;
|
||||
}
|
||||
|
||||
public function get data() : *
|
||||
{
|
||||
return _data;
|
||||
}
|
||||
|
||||
public function set data(value:*) : void
|
||||
{
|
||||
_data = value;
|
||||
if(!loaded)
|
||||
{
|
||||
_loaded = true;
|
||||
}
|
||||
}
|
||||
|
||||
public function removeData() : void
|
||||
{
|
||||
_data = null;
|
||||
_loaded = false;
|
||||
}
|
||||
|
||||
public function get failed() : Boolean
|
||||
{
|
||||
return _failed;
|
||||
}
|
||||
|
||||
public function set failed(value:Boolean) : void
|
||||
{
|
||||
_failed = value;
|
||||
}
|
||||
|
||||
public function dispose() : void
|
||||
{
|
||||
_loaded = false;
|
||||
_failed = false;
|
||||
_data = null;
|
||||
}
|
||||
|
||||
public function set loaded(value:Boolean) : void
|
||||
{
|
||||
_loaded = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
package net.pixvi.myr
|
||||
{
|
||||
import net.pixvi.pfw.utils.Paster;
|
||||
|
||||
public class CP
|
||||
{
|
||||
|
||||
public static var ZI:uint = 16711866;
|
||||
|
||||
public static var RED:uint = 12333361;
|
||||
|
||||
public static var ZONG:uint = 8606003;
|
||||
|
||||
public static var GOLD:uint = 16777011;
|
||||
|
||||
public static var KE:uint = 16738047;
|
||||
|
||||
public static var MONEY:uint = 16750848;
|
||||
|
||||
public static const qualityUint:Object = {
|
||||
1:16777215,
|
||||
2:11534237,
|
||||
3:10350847,
|
||||
4:16738047,
|
||||
5:16763904
|
||||
};
|
||||
|
||||
public function CP()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function mon(text:String) : String
|
||||
{
|
||||
return Paster.font(text,"#ff6600",null,true);
|
||||
}
|
||||
|
||||
public static function darkBlue(text:String) : String
|
||||
{
|
||||
return Paster.font(text,"#005672",null,true);
|
||||
}
|
||||
|
||||
public static function lightYellow(text:String) : String
|
||||
{
|
||||
return Paster.font(text,"#f6ffb7",null,true);
|
||||
}
|
||||
|
||||
public static function money(text:String) : String
|
||||
{
|
||||
return Paster.font(text,"#ce8800",null,true);
|
||||
}
|
||||
|
||||
public static function gold(text:String) : String
|
||||
{
|
||||
return Paster.font(text,"#ffde00",null,true);
|
||||
}
|
||||
|
||||
public static function item(text:String) : String
|
||||
{
|
||||
return Paster.font(text,"#ca5000",null,true);
|
||||
}
|
||||
|
||||
public static function red(text:String) : String
|
||||
{
|
||||
return Paster.font(text,"#884444",null,true);
|
||||
}
|
||||
|
||||
public static function itemNeedRed(text:String) : String
|
||||
{
|
||||
return Paster.font(text,"#FF3E3E");
|
||||
}
|
||||
|
||||
public static function ke(text:String) : String
|
||||
{
|
||||
return Paster.font(text,"#be3cd5",null,true);
|
||||
}
|
||||
|
||||
public static function ti(text:String) : String
|
||||
{
|
||||
return Paster.font(text,"#006600",null,true);
|
||||
}
|
||||
|
||||
public static function task(text:String) : String
|
||||
{
|
||||
return Paster.font(text,"#0066CC",null,true);
|
||||
}
|
||||
|
||||
public static function taskTitle(text:String) : String
|
||||
{
|
||||
return Paster.font(text,"#fdff78");
|
||||
}
|
||||
|
||||
public static function exp(text:String) : String
|
||||
{
|
||||
return Paster.font(text,"#33CC00",null,true);
|
||||
}
|
||||
|
||||
public static function GREEN(text:String) : String
|
||||
{
|
||||
return Paster.font(text,"#aeff00",null,true);
|
||||
}
|
||||
|
||||
public static function room(text:String) : String
|
||||
{
|
||||
return Paster.font(text,"#FF66FF",null,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,603 @@
|
||||
package net.pixvi.myr
|
||||
{
|
||||
import net.pixvi.myr.center.Table;
|
||||
import net.pixvi.myr.element.mon.MonsterVo;
|
||||
import net.pixvi.myr.view.attack.type.AttackType;
|
||||
import net.pixvi.myrloader.center.MyrCenter;
|
||||
import net.pixvi.pfw.utils.Counter;
|
||||
import net.pixvi.pfw.utils.Random;
|
||||
|
||||
public class GameMath
|
||||
{
|
||||
|
||||
public static const ModeEvent:Boolean = false;
|
||||
|
||||
public static var ModeTrace:Boolean = false;
|
||||
|
||||
public static var ModeTraceOpened:Boolean = false;
|
||||
|
||||
public static var ModeTraceServer:Boolean = false;
|
||||
|
||||
public static var ModeCrypto:Boolean = true;
|
||||
|
||||
public static var ModeNetCrypto:Boolean = true;
|
||||
|
||||
public static var ModePayCrypto:Boolean = true;
|
||||
|
||||
private static var modereal:Object = null;
|
||||
|
||||
public static var quickLogin:Boolean = false;
|
||||
|
||||
public static const waveSpaceTime:int = 700;
|
||||
|
||||
public static const numScale:Number = 4;
|
||||
|
||||
public function GameMath()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function get ModeRealName() : Boolean
|
||||
{
|
||||
if(modereal != null)
|
||||
{
|
||||
return modereal;
|
||||
}
|
||||
if(Table.setting.safeModePlatform != null && Table.setting.safeModePlatform.indexOf(MyrCenter.platform) == -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(MyrCenter.closeRealName == true)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(MyrCenter.channel == "DYD")
|
||||
{
|
||||
modereal = true;
|
||||
return true;
|
||||
}
|
||||
modereal = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function get OpenPay() : Boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function get critAdd() : Number
|
||||
{
|
||||
return Table.game_setting.critAdd;
|
||||
}
|
||||
|
||||
public static function get counterAdd() : Number
|
||||
{
|
||||
return Table.game_setting.counterAdd;
|
||||
}
|
||||
|
||||
public static function get apCD() : int
|
||||
{
|
||||
return Table.game_setting.apCD;
|
||||
}
|
||||
|
||||
public static function get tiCD() : int
|
||||
{
|
||||
return Table.game_setting.tiCD;
|
||||
}
|
||||
|
||||
public static function get apCostByStar() : Array
|
||||
{
|
||||
return Table.game_setting.apCostByStar;
|
||||
}
|
||||
|
||||
public static function get maxFeel() : int
|
||||
{
|
||||
return Table.game_setting.maxFeel;
|
||||
}
|
||||
|
||||
public static function get monGiftTime() : int
|
||||
{
|
||||
return Table.game_setting.monGiftTime;
|
||||
}
|
||||
|
||||
public static function get monGiftMax() : int
|
||||
{
|
||||
return Table.game_setting.monGiftMax;
|
||||
}
|
||||
|
||||
public static function get masterMaxLevel() : int
|
||||
{
|
||||
return Table.game_setting.masterMaxLevel;
|
||||
}
|
||||
|
||||
public static function get loopTaskMaxNum() : int
|
||||
{
|
||||
return Table.game_setting.loopTaskMaxNum;
|
||||
}
|
||||
|
||||
public static function get farmEventTime() : int
|
||||
{
|
||||
return Table.game_setting.farmEventTime;
|
||||
}
|
||||
|
||||
public static function get normalBattleTime() : int
|
||||
{
|
||||
return Table.game_setting.normalBattleTime;
|
||||
}
|
||||
|
||||
public static function get countDamagePerAtk() : Number
|
||||
{
|
||||
return Table.game_setting.countDamagePerAtk;
|
||||
}
|
||||
|
||||
public static function get countGuardPerDef() : Number
|
||||
{
|
||||
return Table.game_setting.countGuardPerDef;
|
||||
}
|
||||
|
||||
public static function get tpExp() : Object
|
||||
{
|
||||
return Table.game_setting.tpExp;
|
||||
}
|
||||
|
||||
public static function get maxTpLevel() : int
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
public static function get alchemyFormulaLevel() : Array
|
||||
{
|
||||
return Table.game_setting.alchemyFormulaLevel;
|
||||
}
|
||||
|
||||
public static function get alchemyFormulaCost() : Object
|
||||
{
|
||||
return Table.game_setting.alchemyFormulaCost;
|
||||
}
|
||||
|
||||
public static function get feedExpScale() : Number
|
||||
{
|
||||
return Table.game_setting.monExpScale;
|
||||
}
|
||||
|
||||
public static function get equipNumFloat() : Number
|
||||
{
|
||||
return Table.game_setting.equipNumFloat;
|
||||
}
|
||||
|
||||
public static function get speedItemId() : int
|
||||
{
|
||||
return Table.game_setting.monSpeedItemId;
|
||||
}
|
||||
|
||||
public static function get alchemySpeedItemId() : int
|
||||
{
|
||||
return Table.game_setting.alchemySpeedItemId;
|
||||
}
|
||||
|
||||
public static function get equipNum() : int
|
||||
{
|
||||
return Table.game_setting.equipNum;
|
||||
}
|
||||
|
||||
public static function get monSpeedItemTime() : int
|
||||
{
|
||||
return Table.game_setting.monSpeedItemTime;
|
||||
}
|
||||
|
||||
public static function get monExpScale() : int
|
||||
{
|
||||
return Table.game_setting.monExpScale;
|
||||
}
|
||||
|
||||
public static function apByLevel(lv:int) : int
|
||||
{
|
||||
return Table.game_setting.startAp + (lv - 1) * Table.game_setting.addApByLevel;
|
||||
}
|
||||
|
||||
public static function tiMaxByLevel(lv:int) : int
|
||||
{
|
||||
var timax:int = Table.game_setting.tiFirst + (lv - 1) * Table.game_setting.tiLevelAdd;
|
||||
if(timax > Table.game_setting.tiTotalMax)
|
||||
{
|
||||
return Table.game_setting.tiTotalMax;
|
||||
}
|
||||
return timax;
|
||||
}
|
||||
|
||||
public static function get_apCost(star:int) : int
|
||||
{
|
||||
return Table.game_setting.apCostByStar[star - 1];
|
||||
}
|
||||
|
||||
public static function damage(atkA:int, dexA:int, dexB:int, defB:int, defDamaB:Number = 0) : int
|
||||
{
|
||||
var dexp:int = dexA - dexB;
|
||||
var dam:int = 0;
|
||||
var minp:Number = 0.8;
|
||||
var maxp:Number = 1.2;
|
||||
var maxa:int = 80;
|
||||
if(dexp > 0)
|
||||
{
|
||||
if(dexp > maxa)
|
||||
{
|
||||
dexp = maxa;
|
||||
}
|
||||
minp += 0.3 * dexp / maxa;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(dexp < -maxa)
|
||||
{
|
||||
dexp = -maxa;
|
||||
}
|
||||
maxp += 0.3 * dexp / maxa;
|
||||
}
|
||||
dam = Math.round(atkA * countDamagePerAtk * Random.number(minp,maxp) - defB * (countGuardPerDef * 0.75 + Random.number(0,countGuardPerDef * 0.25)));
|
||||
dam *= 1 - defDamaB;
|
||||
if(dam < 1)
|
||||
{
|
||||
dam = 1;
|
||||
}
|
||||
return dam;
|
||||
}
|
||||
|
||||
public static function fix_spd_atk(atk_spd:int) : int
|
||||
{
|
||||
return atk_spd;
|
||||
}
|
||||
|
||||
public static function cost_speedGrow(s:int) : int
|
||||
{
|
||||
return Math.ceil(s / 120);
|
||||
}
|
||||
|
||||
public static function cost_speedAlchemy(s:int) : int
|
||||
{
|
||||
return Math.ceil(s / 120);
|
||||
}
|
||||
|
||||
public static function addSecondByCost(cost:int) : int
|
||||
{
|
||||
return cost * 120;
|
||||
}
|
||||
|
||||
public static function critByDex(crit:Number, dexA:int, dexB:int) : Number
|
||||
{
|
||||
var dexp:int = (dexA - dexB) / 4;
|
||||
if(dexp < 0)
|
||||
{
|
||||
return 0.02 + crit / 100;
|
||||
}
|
||||
return 0.02 + crit / 100 + dexp / (dexp + 120);
|
||||
}
|
||||
|
||||
public static function addAtkSpdByDex(dex:int) : int
|
||||
{
|
||||
return -(dex * 3) / 4;
|
||||
}
|
||||
|
||||
public static function addMovSpdByDex(dex:int) : Number
|
||||
{
|
||||
return Number((dex / (50 * 4)).toFixed(2));
|
||||
}
|
||||
|
||||
public static function addPowByAtk(atk:int) : Number
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static function addPowDefByHp(hp:int) : Number
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static function pveThornDmg(countDamage:int, thorn:int) : int
|
||||
{
|
||||
var a:int = 2;
|
||||
var b:int = 400;
|
||||
if(Table.game_setting.pveThornDmg_a != null)
|
||||
{
|
||||
a = int(Table.game_setting.pveThornDmg_a);
|
||||
}
|
||||
if(Table.game_setting.pveThornDmg_b != null)
|
||||
{
|
||||
b = int(Table.game_setting.pveThornDmg_b);
|
||||
}
|
||||
var dmg:int = countDamage * (thorn / (a * thorn + b));
|
||||
if(dmg < 1)
|
||||
{
|
||||
dmg = 1;
|
||||
}
|
||||
return dmg;
|
||||
}
|
||||
|
||||
public static function getFeedExpByMonsterVo(vo:MonsterVo) : int
|
||||
{
|
||||
return vo.sell_exp + int(vo.exp * GameMath.feedExpScale);
|
||||
}
|
||||
|
||||
public static function zl_atk(atk:Number, atk_spd:int = 1600) : int
|
||||
{
|
||||
if(1600 / atk_spd > 1)
|
||||
{
|
||||
return atk * 10 * (1 + (1600 / atk_spd - 1) * 0.7);
|
||||
}
|
||||
return atk * 10 * (1 - (1 - 1600 / atk_spd) * 0.8);
|
||||
}
|
||||
|
||||
public static function zl_def(def:Number) : int
|
||||
{
|
||||
return def * 5;
|
||||
}
|
||||
|
||||
public static function zl_hp(hp:Number) : int
|
||||
{
|
||||
return hp;
|
||||
}
|
||||
|
||||
public static function zl_dex(dex:Number) : int
|
||||
{
|
||||
return dex * 10;
|
||||
}
|
||||
|
||||
public static function zl_atkSpd(atkspd:Number) : int
|
||||
{
|
||||
return atkspd * 20;
|
||||
}
|
||||
|
||||
public static function zl_atkVim(atkvim:Number) : int
|
||||
{
|
||||
return atkvim * 50;
|
||||
}
|
||||
|
||||
public static function zl_selfCure(selfCure:Number) : int
|
||||
{
|
||||
return selfCure * 6;
|
||||
}
|
||||
|
||||
public static function zl_deadBoom(deadBoom:Number) : int
|
||||
{
|
||||
return int(deadBoom * 1.5);
|
||||
}
|
||||
|
||||
public static function zl_atkStun(atkStunChance:Number) : int
|
||||
{
|
||||
return atkStunChance * 20;
|
||||
}
|
||||
|
||||
public static function zl_defStun(defStunChance:Number) : int
|
||||
{
|
||||
return defStunChance * 30;
|
||||
}
|
||||
|
||||
public static function zl_atkPoi(atkPoiChance:Number, atkPoiDamage:*) : int
|
||||
{
|
||||
return atkPoiChance * 10 + atkPoiDamage * 2;
|
||||
}
|
||||
|
||||
public static function zl_apCostSave(apCostSave:int) : int
|
||||
{
|
||||
return apCostSave * 150;
|
||||
}
|
||||
|
||||
public static function zl_sunFire(sunFire:int) : int
|
||||
{
|
||||
return sunFire * 4;
|
||||
}
|
||||
|
||||
public static function zl_moonHeal(moonHeal:int) : int
|
||||
{
|
||||
return moonHeal * 10;
|
||||
}
|
||||
|
||||
public static function zl_crit(crit:Number) : int
|
||||
{
|
||||
return crit * 30;
|
||||
}
|
||||
|
||||
public static function zl_skillCooldown(skillCooldown:Number) : int
|
||||
{
|
||||
return skillCooldown * 20;
|
||||
}
|
||||
|
||||
public static function zl_thorns(thorns:int) : int
|
||||
{
|
||||
return thorns * 2;
|
||||
}
|
||||
|
||||
public static function zl_editMon(mon:Object, abilityScale:Number = 1, hpScale:Number = 1) : int
|
||||
{
|
||||
var m:Object = null;
|
||||
var zl:int = 0;
|
||||
var moveImmune:Boolean = Boolean(mon.moveImmune);
|
||||
var mode:int = int(mon.mode);
|
||||
var teampos:int = int(mon.teamPos);
|
||||
if(mon.autoValue)
|
||||
{
|
||||
m = new MonsterVo();
|
||||
m.editorInit(mon.type);
|
||||
m.buildByArea();
|
||||
m.level = mon.level;
|
||||
mon = m;
|
||||
}
|
||||
zl = hpScale * zl_hp(mon.hp) + abilityScale * (zl_def(mon.def) + zl_dex(mon.dex) + zl_atk(mon.atk,mon.spd_atk));
|
||||
if(moveImmune)
|
||||
{
|
||||
if(!AttackType.isShooter(mon.type,mode))
|
||||
{
|
||||
return int(zl * 0.25);
|
||||
}
|
||||
zl *= 0.8;
|
||||
}
|
||||
if(teampos >= 6)
|
||||
{
|
||||
zl *= 0.8;
|
||||
}
|
||||
return zl;
|
||||
}
|
||||
|
||||
public static function zl_battleMonVo(mon:Object) : int
|
||||
{
|
||||
return int(zl_hp(mon.hp) + zl_def(mon.def) + zl_dex(mon.dex) + zl_atk(mon.atk,mon.spd_atk));
|
||||
}
|
||||
|
||||
public static function zl_monVo(monvo:MonsterVo) : int
|
||||
{
|
||||
var zl:int = zl_hp(monvo.hp) + zl_def(monvo.def) + zl_dex(monvo.dex) + zl_atk(monvo.atk);
|
||||
zl += zl_atkSpd(monvo.allAdd("atkSpd"));
|
||||
zl += zl_crit(monvo.allAdd("crit"));
|
||||
zl += zl_selfCure(monvo.allAdd("selfCure"));
|
||||
zl += zl_atkVim(monvo.allAdd("atkVim"));
|
||||
zl += zl_atkStun(monvo.allAdd("atkStun"));
|
||||
zl += zl_defStun(monvo.allAdd("defStun"));
|
||||
zl += zl_atkPoi(monvo.allAdd("atkPoi"),monvo.allAdd("atkPoiDmg"));
|
||||
zl += zl_skillCooldown(monvo.allAdd("skillCooldown"));
|
||||
zl += zl_sunFire(monvo.allAdd("sunFire"));
|
||||
zl += zl_moonHeal(monvo.allAdd("moonHeal"));
|
||||
zl += zl_deadBoom(monvo.allAdd("deadBoom"));
|
||||
return int(zl + zl_thorns(monvo.allAdd("thorns")));
|
||||
}
|
||||
|
||||
public static function zl_battle(battle:Object) : int
|
||||
{
|
||||
var zl:int = 0;
|
||||
var arr:Array = null;
|
||||
try
|
||||
{
|
||||
zl = 0;
|
||||
arr = battle.teams[0].mons;
|
||||
for each(var mo:Object in arr)
|
||||
{
|
||||
if(!(mo is int) && mo.team == 2 && mo != null)
|
||||
{
|
||||
if(battle.scaleAbility == null)
|
||||
{
|
||||
battle.scaleAbility = 1;
|
||||
}
|
||||
if(battle.scaleHp == null)
|
||||
{
|
||||
battle.scaleHp = 1;
|
||||
}
|
||||
zl += zl_editMon(mo,battle.scaleAbility,battle.scaleHp);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(error:Error)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return zl;
|
||||
}
|
||||
|
||||
public static function zl_battle_onstage(battle:Object) : int
|
||||
{
|
||||
var zl:int = 0;
|
||||
var arr:Array = battle.teams[0].mons;
|
||||
for each(var mo:Object in arr)
|
||||
{
|
||||
if(!(mo is int) && mo.team == 2 && mo != null && mo.teamPos < 6)
|
||||
{
|
||||
if(battle.scaleAbility == null)
|
||||
{
|
||||
battle.scaleAbility = 1;
|
||||
}
|
||||
if(battle.scaleHp == null)
|
||||
{
|
||||
battle.scaleHp = 1;
|
||||
}
|
||||
zl += zl_editMon(mo,battle.scaleAbility,battle.scaleHp);
|
||||
}
|
||||
}
|
||||
return zl;
|
||||
}
|
||||
|
||||
public static function feelAdd(feel:int) : Number
|
||||
{
|
||||
return Counter.getAreaByArea(0,0.1,0,200,feel,true);
|
||||
}
|
||||
|
||||
public static function isVipGood(goodId:String) : Boolean
|
||||
{
|
||||
if(goodId == "301")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function getSwitchMoney(star:int) : int
|
||||
{
|
||||
return Table.game_setting.monSwitchCost[star - 1];
|
||||
}
|
||||
|
||||
public static function getGrowUpFarmExp(montype:int) : int
|
||||
{
|
||||
var exp:int = (int(Table.monster_info[montype].time_1) + int(Table.monster_info[montype].time_2)) / 1200;
|
||||
if(exp < 1)
|
||||
{
|
||||
exp = 1;
|
||||
}
|
||||
return exp;
|
||||
}
|
||||
|
||||
public static function getMonMaxLevel(potentialLevel:int) : int
|
||||
{
|
||||
return potentialLevel * Table.potential_info.potentialLevelMaxAdd;
|
||||
}
|
||||
|
||||
public static function getStageNumByLevel(level:int) : int
|
||||
{
|
||||
var stageNum:int = 2;
|
||||
if(level >= Table.team_info.battleTeam[2].level)
|
||||
{
|
||||
stageNum++;
|
||||
}
|
||||
if(level >= Table.team_info.battleTeam[3].level)
|
||||
{
|
||||
stageNum++;
|
||||
}
|
||||
return stageNum;
|
||||
}
|
||||
|
||||
public static function getLevelByStageNum(stageNum:*) : int
|
||||
{
|
||||
if(stageNum <= 2)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if(stageNum <= 3)
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
if(stageNum <= 4)
|
||||
{
|
||||
return 12;
|
||||
}
|
||||
return 12;
|
||||
}
|
||||
|
||||
public static function getEquipZdl(equip:Object) : int
|
||||
{
|
||||
var zdl:int = 0;
|
||||
zdl += zl_atk(equip.atk);
|
||||
zdl += zl_def(equip.def);
|
||||
zdl += zl_hp(equip.hp);
|
||||
zdl += zl_dex(equip.dex);
|
||||
zdl += zl_crit(equip.crit);
|
||||
zdl += zl_atkSpd(equip.atkSpd);
|
||||
zdl += zl_atkVim(equip.atkVim);
|
||||
zdl += zl_selfCure(equip.selfCure);
|
||||
zdl += zl_deadBoom(equip.deadBoom);
|
||||
zdl += zl_atkStun(equip.atkStun);
|
||||
zdl += zl_defStun(equip.defStun);
|
||||
zdl += zl_atkPoi(equip.atkPoi,equip.atkPoiDmg);
|
||||
zdl += zl_apCostSave(equip.apCostSave);
|
||||
zdl += zl_skillCooldown(equip.skillCooldown);
|
||||
zdl += zl_sunFire(equip.sunFire);
|
||||
zdl += zl_moonHeal(equip.moonHeal);
|
||||
return int(zdl + zl_thorns(equip.thorns));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package net.pixvi.myr
|
||||
{
|
||||
public class GamePool
|
||||
{
|
||||
|
||||
public function GamePool()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function startUp() : void
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package net.pixvi.myr
|
||||
{
|
||||
import flash.geom.Rectangle;
|
||||
|
||||
public class GameSetting
|
||||
{
|
||||
|
||||
public static var Y_DISTANCE_SCALE:Number = 0.5;
|
||||
|
||||
public static var attackImgWaitTime:int = 300;
|
||||
|
||||
public static var MainUITopHeight:int = 44;
|
||||
|
||||
public static var MainUIBottomHeight:int = 60;
|
||||
|
||||
public static var BottomMenuSpace:Number = 23;
|
||||
|
||||
public static var PanelTransTime:Number = 0.3;
|
||||
|
||||
public static var BattleStartCD:int = 7;
|
||||
|
||||
public function GameSetting()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function fixDragRecWithMainUI(rec:Rectangle, scaleY:Number = 1, checkHeight:Boolean = true) : void
|
||||
{
|
||||
if(rec.height != 0 || !checkHeight)
|
||||
{
|
||||
rec.y -= GameSetting.MainUIBottomHeight / scaleY;
|
||||
rec.height += (GameSetting.MainUIBottomHeight + GameSetting.MainUITopHeight) / scaleY;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,55 @@
|
||||
package net.pixvi.myr.battle
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.MovieClip;
|
||||
import net.pixvi.myr.battle.view.BattleMonItem;
|
||||
import net.pixvi.myr.battle.view.BattleSkillUI;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.controls.PiBar;
|
||||
import net.pixvi.pfw.ui.controls.PiBitTextField;
|
||||
import net.pixvi.pfw.ui.controls.PiDataList;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class BattleGroundBottomUI extends UIComponent
|
||||
{
|
||||
|
||||
public var text_ap:PiBitTextField;
|
||||
|
||||
public var bar_ap:PiBar;
|
||||
|
||||
public var list_team1:PiDataList;
|
||||
|
||||
public var ui_skill1:BattleSkillUI;
|
||||
|
||||
public var ui_skill2:BattleSkillUI;
|
||||
|
||||
public var mc_autoSkill:MovieClip;
|
||||
|
||||
public var btn_autoSkill:PiLightButton;
|
||||
|
||||
public function BattleGroundBottomUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
list_team1.itemClass = BattleMonItem;
|
||||
}
|
||||
|
||||
public function autoSkillMode(open:Boolean = true) : void
|
||||
{
|
||||
if(open)
|
||||
{
|
||||
btn_autoSkill.selected = true;
|
||||
mc_autoSkill.play();
|
||||
}
|
||||
else
|
||||
{
|
||||
btn_autoSkill.selected = false;
|
||||
mc_autoSkill.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package net.pixvi.myr.battle
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.MovieClip;
|
||||
import net.pixvi.myr.battle.view.BattleMon;
|
||||
import net.pixvi.myr.element.battle.BattleMonVo;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.containers.PiImgContainer;
|
||||
import net.pixvi.pfw.ui.controls.PiBar;
|
||||
import net.pixvi.pfw.ui.controls.PiBitTextField;
|
||||
import net.pixvi.pfw.utils.Paster;
|
||||
|
||||
public class BattleGroundMonInfoUI extends UIComponent
|
||||
{
|
||||
|
||||
public var text_name:PiBitTextField;
|
||||
|
||||
public var bar_hp:PiBar;
|
||||
|
||||
public var text_hp:PiBitTextField;
|
||||
|
||||
public var container_avatar:PiImgContainer;
|
||||
|
||||
public var text_level:PiBitTextField;
|
||||
|
||||
public var mc_board:MovieClip;
|
||||
|
||||
public function BattleGroundMonInfoUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
container_avatar.setSize(75,75);
|
||||
if(mc_board != null)
|
||||
{
|
||||
mc_board.stop();
|
||||
}
|
||||
}
|
||||
|
||||
public function onMon(mon:BattleMon) : void
|
||||
{
|
||||
if(mon.team == 1)
|
||||
{
|
||||
mc_board.gotoAndStop(mon.vo.quality);
|
||||
}
|
||||
text_level.htmlText = Paster.font("LV:",null,20) + Paster.font(mon.monVo.level.toString(),null,28);
|
||||
text_name.text = mon.monVo.name;
|
||||
bar_hp.setValue(mon.monVo.hp,mon.monVo.hpMax,0,false);
|
||||
text_hp.text = mon.monVo.hp + "/" + mon.monVo.hpMax;
|
||||
container_avatar.loadNetBitImg(mon.vo.getImg("avatar"),true,true,0);
|
||||
}
|
||||
|
||||
public function update(mon:BattleMon) : void
|
||||
{
|
||||
bar_hp.setValue(mon.monVo.hp,mon.monVo.hpMax,0,true);
|
||||
text_hp.text = mon.monVo.hp + "/" + mon.monVo.hpMax;
|
||||
}
|
||||
|
||||
public function updateByVo(monVo:BattleMonVo) : void
|
||||
{
|
||||
bar_hp.setValue(monVo.hp,monVo.hpMax,0,true);
|
||||
text_hp.text = monVo.hp + "/" + monVo.hpMax;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
package net.pixvi.myr.battle
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import com.greensock.easing.Expo;
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.Sprite;
|
||||
import net.pixvi.myr.battle.view.BattleBossPointUI;
|
||||
import net.pixvi.myr.battle.view.BattleMon;
|
||||
import net.pixvi.myrloader.center.MyrCenter;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.controls.PiBitTextField;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class BattleGroundTopUI extends UIComponent
|
||||
{
|
||||
|
||||
public var text_time:PiBitTextField;
|
||||
|
||||
public var text_wait1:PiBitTextField;
|
||||
|
||||
public var text_wait2:PiBitTextField;
|
||||
|
||||
public var text_name1:PiBitTextField;
|
||||
|
||||
public var text_name2:PiBitTextField;
|
||||
|
||||
public var ui_bossPoint:BattleBossPointUI;
|
||||
|
||||
public var ui_info1:BattleGroundMonInfoUI;
|
||||
|
||||
public var ui_info2:BattleGroundMonInfoUI;
|
||||
|
||||
public var mc_proKill:Sprite;
|
||||
|
||||
public var mc_desKill:Sprite;
|
||||
|
||||
public var btn_pause:PiLightButton;
|
||||
|
||||
public function BattleGroundTopUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
mc_desKill.visible = mc_proKill.visible = false;
|
||||
ui_info1.visible = ui_info2.visible = false;
|
||||
if(MyrCenter.channel == "XDG")
|
||||
{
|
||||
text_name1.scaleMode = true;
|
||||
text_name2.scaleMode = true;
|
||||
}
|
||||
}
|
||||
|
||||
public function showProtectKill() : void
|
||||
{
|
||||
TweenMax.fromTo(mc_proKill,2,{
|
||||
"visible":true,
|
||||
"x":-87,
|
||||
"tint":16777215
|
||||
},{
|
||||
"x":-47,
|
||||
"tint":null,
|
||||
"visible":false,
|
||||
"ease":Expo.easeOut
|
||||
});
|
||||
TweenMax.fromTo(mc_proKill,2,{"alpha":1},{
|
||||
"delay":1,
|
||||
"alpha":0,
|
||||
"Ease":Expo.easeIn
|
||||
});
|
||||
}
|
||||
|
||||
public function showDestroyKill() : void
|
||||
{
|
||||
TweenMax.fromTo(mc_desKill,2,{
|
||||
"visible":true,
|
||||
"x":441,
|
||||
"tint":16777215
|
||||
},{
|
||||
"x":401,
|
||||
"tint":null,
|
||||
"visible":false,
|
||||
"ease":Expo.easeOut
|
||||
});
|
||||
TweenMax.fromTo(mc_desKill,1,{"alpha":1},{
|
||||
"delay":1,
|
||||
"alpha":0,
|
||||
"Ease":Expo.easeIn
|
||||
});
|
||||
}
|
||||
|
||||
public function updateByMon(mon:BattleMon) : void
|
||||
{
|
||||
if(mon.team == 1)
|
||||
{
|
||||
ui_info1.onMon(mon);
|
||||
ui_info1.visible = true;
|
||||
ui_info2.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ui_info1.visible = false;
|
||||
ui_info2.onMon(mon);
|
||||
ui_info2.visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
public function updateHpByMon(mon:BattleMon) : void
|
||||
{
|
||||
var info:BattleGroundMonInfoUI = null;
|
||||
if(mon.team == 1)
|
||||
{
|
||||
info = ui_info1;
|
||||
}
|
||||
else
|
||||
{
|
||||
info = ui_info2;
|
||||
}
|
||||
info.update(mon);
|
||||
}
|
||||
|
||||
public function lostSelect() : void
|
||||
{
|
||||
ui_info1.visible = ui_info2.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
package net.pixvi.myr.battle
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.Event;
|
||||
import net.pixvi.common.driver.StageDriver;
|
||||
import net.pixvi.common.utils.PiFixVo;
|
||||
import net.pixvi.common.utils.StageLocator;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.myr.center.ImgCenter;
|
||||
import net.pixvi.myr.element.snd.GameSound;
|
||||
import net.pixvi.pfw.display.NetBitImg;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
|
||||
public class BattleGroundUI extends UIComponent
|
||||
{
|
||||
|
||||
public var mc_area:MovieClip;
|
||||
|
||||
public var mc_bg:Sprite;
|
||||
|
||||
public var bg:NetBitImg;
|
||||
|
||||
public var ui_bottom:BattleGroundBottomUI;
|
||||
|
||||
public var ui_top:BattleGroundTopUI;
|
||||
|
||||
public var onBuildTypeComplete:Function;
|
||||
|
||||
public function BattleGroundUI(skin:DisplayObject = null, auto:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
if(skin == null)
|
||||
{
|
||||
skin = FF.getMC("ui.BattleGroundUI");
|
||||
}
|
||||
super(skin,auto,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
super.onSkinComplete();
|
||||
mc_bg = new Sprite();
|
||||
addChildAt(mc_bg,0);
|
||||
ui_bottom.mouseChildren = ui_bottom.mouseEnabled = true;
|
||||
ui_top.mouseChildren = ui_top.mouseEnabled = false;
|
||||
ui_top.btn_pause.sound_click = GameSound.effect_click1;
|
||||
StageDriver.getInstance().regist(onStageChange);
|
||||
var fixvo:PiFixVo = StageLocator.SubFixVos["fs2"];
|
||||
StageLocator.setSide(ui_top,"none","top",0,-10,fixvo);
|
||||
StageLocator.setSide(ui_top.btn_pause,"none","top",0,-2,fixvo);
|
||||
StageLocator.setSide(ui_bottom,"none","bottom",0,-21,fixvo);
|
||||
}
|
||||
|
||||
public function buildByType(type:String, onComplete:Function) : void
|
||||
{
|
||||
onBuildTypeComplete = onComplete;
|
||||
bg = new NetBitImg();
|
||||
bg.addEventListener("complete",buildByTypeCompleteHandler);
|
||||
bg.load(ImgCenter.getBattleImgByGroundType(type.toString()));
|
||||
mc_bg.addChild(bg);
|
||||
}
|
||||
|
||||
private function buildByTypeCompleteHandler(e:Event = null) : void
|
||||
{
|
||||
onBuildTypeComplete();
|
||||
onBuildTypeComplete = null;
|
||||
}
|
||||
|
||||
public function gc() : void
|
||||
{
|
||||
bg.unloadMapping();
|
||||
}
|
||||
|
||||
public function onStageChange() : void
|
||||
{
|
||||
StageLocator.setSide(ui_bottom,"none","bottom",0,-25);
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
super.dispose();
|
||||
gc();
|
||||
StageDriver.getInstance().remove(onStageChange);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package net.pixvi.myr.battle
|
||||
{
|
||||
public class BattleModeType
|
||||
{
|
||||
|
||||
public static var NORMAL:int = 0;
|
||||
|
||||
public static var PVE:int = 1;
|
||||
|
||||
public static var BOSS:int = 2;
|
||||
|
||||
public function BattleModeType()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
package net.pixvi.myr.battle
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.Sprite;
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.myr.element.battle.BattleVo;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.controls.PiBitTextField;
|
||||
import net.pixvi.pfw.utils.Paster;
|
||||
|
||||
public class BattleStartTipUI extends UIComponent
|
||||
{
|
||||
|
||||
public static var winDicColor:Object = {
|
||||
"2":"#ffff00",
|
||||
"3":"#ffff00",
|
||||
"4":"#ffff00"
|
||||
};
|
||||
|
||||
public static var loseDicColor:Object = {
|
||||
"3":"#ffff00",
|
||||
"4":"#ffff00"
|
||||
};
|
||||
|
||||
public var text_winType:PiBitTextField;
|
||||
|
||||
public var text_loseType:PiBitTextField;
|
||||
|
||||
public var mc_longMap:Sprite;
|
||||
|
||||
public var text_countDown:PiBitTextField;
|
||||
|
||||
public function BattleStartTipUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
skin = FF.getMC("ui.BattleTipPanelUI");
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
|
||||
public static function get winDic() : Object
|
||||
{
|
||||
return {
|
||||
"1":lang("◆消灭所有敌人"),
|
||||
"2":lang("◆坚守到战斗结束"),
|
||||
"3":lang("◆消灭任意指定目标"),
|
||||
"4":lang("◆消灭所有指定目标")
|
||||
};
|
||||
}
|
||||
|
||||
public static function get loseDic() : Object
|
||||
{
|
||||
return {
|
||||
"1":lang("◆我方全灭"),
|
||||
"2":lang("◆战斗时间结束"),
|
||||
"3":lang("◆任意保护目标被消灭"),
|
||||
"4":lang("◆所有保护目标被消灭")
|
||||
};
|
||||
}
|
||||
|
||||
public function showType(vo:BattleVo) : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var j:int = 0;
|
||||
var wintype:String = "";
|
||||
var losetype:String = "";
|
||||
for(i = 0; i < vo.winType.length; )
|
||||
{
|
||||
if(i != 0)
|
||||
{
|
||||
wintype += "<br/>";
|
||||
}
|
||||
if(winDicColor[vo.winType[i.toString()]] != null)
|
||||
{
|
||||
wintype += Paster.font(winDic[vo.winType[i.toString()]],winDicColor[vo.winType[i.toString()]]);
|
||||
}
|
||||
else
|
||||
{
|
||||
wintype += winDic[vo.winType[i]];
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if(vo.rollmapMode)
|
||||
{
|
||||
mc_longMap.visible = true;
|
||||
TweenMax.from(mc_longMap,0.5,{
|
||||
"alpha":0,
|
||||
"y":mc_longMap.y + 50
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
mc_longMap.visible = false;
|
||||
}
|
||||
j = 0;
|
||||
while(j < vo.loseType.length)
|
||||
{
|
||||
if(j != 0)
|
||||
{
|
||||
losetype += "<br/>";
|
||||
}
|
||||
if(loseDicColor[vo.loseType[j.toString()]] != null)
|
||||
{
|
||||
losetype += Paster.font(loseDic[vo.loseType[j.toString()]],loseDicColor[vo.loseType[j.toString()]]);
|
||||
}
|
||||
else
|
||||
{
|
||||
losetype += loseDic[vo.loseType[j]];
|
||||
}
|
||||
j++;
|
||||
}
|
||||
text_loseType.htmlText = losetype;
|
||||
text_winType.htmlText = wintype;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package net.pixvi.myr.battle.view
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.controls.PiBitTextField;
|
||||
|
||||
public class BattleBossPointUI extends UIComponent
|
||||
{
|
||||
|
||||
public var text_bossPoint:PiBitTextField;
|
||||
|
||||
public var text_pointName:PiBitTextField;
|
||||
|
||||
public function BattleBossPointUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,103 @@
|
||||
package net.pixvi.myr.battle.view
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.Event;
|
||||
import flash.utils.Timer;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.pfw.display.BitMovieClip;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.controls.PiBar;
|
||||
import net.pixvi.pfw.ui.controls.PiBitTextField;
|
||||
|
||||
public class BattleMonInfoUI extends UIComponent
|
||||
{
|
||||
|
||||
public var bar_hp:PiBar;
|
||||
|
||||
public var text_level:PiBitTextField;
|
||||
|
||||
public var mc_shooter:MovieClip;
|
||||
|
||||
private var _keepShow:Boolean = false;
|
||||
|
||||
private var showTimer:Timer;
|
||||
|
||||
public var importantTarget:Boolean = false;
|
||||
|
||||
public var text_name:PiBitTextField;
|
||||
|
||||
public function BattleMonInfoUI(team:int = 1)
|
||||
{
|
||||
var skin:DisplayObject = null;
|
||||
if(team == 1)
|
||||
{
|
||||
skin = FF.getMC("ui.BattleMonInfoUIGreen");
|
||||
}
|
||||
else
|
||||
{
|
||||
skin = FF.getMC("ui.BattleMonInfoUIRed");
|
||||
}
|
||||
super(skin);
|
||||
this.setScale(0.75);
|
||||
showTimer = new Timer(1500,1);
|
||||
showTimer.addEventListener("timerComplete",timerComplete);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
text_name.scaleMode = true;
|
||||
super.onSkinComplete();
|
||||
bar_hp.buffTime = 0.15;
|
||||
}
|
||||
|
||||
public function showIcon(icon:String) : void
|
||||
{
|
||||
var bm:BitMovieClip = FF.getBMC(icon);
|
||||
bm.mouseChildren = bm.mouseEnabled = false;
|
||||
addChild(bm);
|
||||
}
|
||||
|
||||
private function timerComplete(e:Event = null) : void
|
||||
{
|
||||
if(!_keepShow)
|
||||
{
|
||||
hideHp();
|
||||
}
|
||||
}
|
||||
|
||||
public function set keepShow(show:Boolean) : void
|
||||
{
|
||||
_keepShow = show;
|
||||
if(show)
|
||||
{
|
||||
showHp();
|
||||
}
|
||||
else
|
||||
{
|
||||
hideHp();
|
||||
}
|
||||
}
|
||||
|
||||
public function showHpSomeTime() : void
|
||||
{
|
||||
showHp();
|
||||
showTimer.reset();
|
||||
showTimer.start();
|
||||
}
|
||||
|
||||
public function showHp() : void
|
||||
{
|
||||
this.visible = true;
|
||||
}
|
||||
|
||||
public function hideHp() : void
|
||||
{
|
||||
if(!importantTarget)
|
||||
{
|
||||
this.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
package net.pixvi.myr.battle.view
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.Event;
|
||||
import net.pixvi.common.utils.Gesturer;
|
||||
import net.pixvi.myr.center.ImgCenter;
|
||||
import net.pixvi.myr.panel.battle.BattlePanel;
|
||||
import net.pixvi.pfw.display.NetBitImg;
|
||||
import net.pixvi.pfw.event.MobiEvent;
|
||||
import net.pixvi.pfw.ui.containers.PiImgContainer;
|
||||
import net.pixvi.pfw.ui.controls.PiBitTextField;
|
||||
import net.pixvi.pfw.ui.controls.PiListItem;
|
||||
import net.pixvi.pfw.utils.Paster;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class BattleMonItem extends PiListItem
|
||||
{
|
||||
|
||||
public var text_level:PiBitTextField;
|
||||
|
||||
public var img_select:Sprite;
|
||||
|
||||
public var container_img:PiImgContainer;
|
||||
|
||||
public var boardimg:NetBitImg;
|
||||
|
||||
public var curmon:BattleMon;
|
||||
|
||||
public var gesture:Gesturer;
|
||||
|
||||
public function BattleMonItem(skin:DisplayObject = null, auto:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
super(skin,auto,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
img_select.visible = false;
|
||||
container_img.setSize(75,75);
|
||||
PiLightButton.btnTouchLight.setDisplay(this);
|
||||
super.onSkinComplete();
|
||||
gesture = new Gesturer(skin,true);
|
||||
gesture.dragLength = 80;
|
||||
gesture.addEventListener(Gesturer.DRAG,dragHandler);
|
||||
gesture.start();
|
||||
}
|
||||
|
||||
private function dragHandler(e:Event = null) : void
|
||||
{
|
||||
if(!BattlePanel.getIns().ground.battleIsStart || BattlePanel.getIns().ground.paused || !(_data as BattleMon).moveable || (_data as BattleMon).monVo.isObject)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(_data != null)
|
||||
{
|
||||
(_data as BattleMon).dragHandler();
|
||||
}
|
||||
}
|
||||
|
||||
override public function onData(value:Object) : void
|
||||
{
|
||||
var battlemon:BattleMon = value as BattleMon;
|
||||
if(curmon == battlemon)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(curmon != null && (curmon.monVo.type != battlemon.monVo.type || curmon.monVo.mode != battlemon.monVo.mode))
|
||||
{
|
||||
if(boardimg != null)
|
||||
{
|
||||
boardimg.dispose();
|
||||
}
|
||||
}
|
||||
boardimg = new NetBitImg(ImgCenter.getBattleMonBoard(battlemon.vo.quality));
|
||||
container_img.parent.addChildAt(boardimg,container_img.parent.getChildIndex(container_img) + 1);
|
||||
curmon = battlemon;
|
||||
text_level.htmlText = Paster.font("LV:",null,20) + Paster.font(battlemon.monVo.level.toString(),null,28);
|
||||
container_img.loadNetBitImg(battlemon.vo.getImg("avatar"),true,true,0);
|
||||
this.addEventListener(MobiEvent.CLICK,clickHandler);
|
||||
}
|
||||
|
||||
public function clickHandler(e:Event = null) : void
|
||||
{
|
||||
if(!BattlePanel.getIns().ground.battleIsStart)
|
||||
{
|
||||
return;
|
||||
}
|
||||
sendSelect();
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
curmon = null;
|
||||
gesture.dispose();
|
||||
PiLightButton.btnTouchLight.removeDisplay(this);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
override public function set selected(value:Boolean) : void
|
||||
{
|
||||
img_select.visible = value;
|
||||
super.selected = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
package net.pixvi.myr.battle.view
|
||||
{
|
||||
public class BattleMonRecordVo
|
||||
{
|
||||
|
||||
public var maxDamage:Number = 0;
|
||||
|
||||
public var avgDamage:Number = 0;
|
||||
|
||||
public var totalCure:Number = 0;
|
||||
|
||||
public var mid:String;
|
||||
|
||||
public var atk:Number;
|
||||
|
||||
public var def:Number;
|
||||
|
||||
public var hp:Number;
|
||||
|
||||
public var buffAtk:Number;
|
||||
|
||||
public var buffDefDama:Number;
|
||||
|
||||
public var hpMax:Number;
|
||||
|
||||
public var dex:Number;
|
||||
|
||||
public var selfCure:Number;
|
||||
|
||||
public var atkVim:Number;
|
||||
|
||||
public var atkStun:Number;
|
||||
|
||||
public var defStun:Number;
|
||||
|
||||
public var atkPoi:Number;
|
||||
|
||||
public var atkPoiDmg:Number;
|
||||
|
||||
public var skillCooldown:Number;
|
||||
|
||||
public var sunFire:Number;
|
||||
|
||||
public var moonHeal:Number;
|
||||
|
||||
public var deadBoom:Number;
|
||||
|
||||
public var thorns:Number;
|
||||
|
||||
public var crit:Number;
|
||||
|
||||
public var totalDmg:Number = 0;
|
||||
|
||||
public var monsterVo:Object;
|
||||
|
||||
public var skillLevel1:Number;
|
||||
|
||||
public var skillLevel2:Number;
|
||||
|
||||
public function BattleMonRecordVo()
|
||||
{
|
||||
super();
|
||||
totalDmg = 0;
|
||||
}
|
||||
|
||||
public function recordDmg(dmg:int) : void
|
||||
{
|
||||
if(maxDamage < dmg)
|
||||
{
|
||||
maxDamage = dmg;
|
||||
}
|
||||
totalDmg += dmg;
|
||||
}
|
||||
|
||||
public function recordCure(cure:int) : void
|
||||
{
|
||||
totalCure += cure;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
package net.pixvi.myr.battle.view
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.text.TextField;
|
||||
import net.pixvi.common.center.TipCenter;
|
||||
import net.pixvi.common.driver.TipDriver;
|
||||
import net.pixvi.myr.event.BattleEvent;
|
||||
import net.pixvi.myr.view.skill.BaseSkill;
|
||||
import net.pixvi.pfw.display.NetBitImg;
|
||||
import net.pixvi.pfw.driver.EnterFrameDriver;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.containers.PiImgContainer;
|
||||
import net.pixvi.pfw.ui.controls.PiBitTextField;
|
||||
import net.pixvi.pfw.utils.Colorator;
|
||||
import net.pixvi.pfw.utils.Jumper;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
|
||||
public class BattleSkillUI extends UIComponent
|
||||
{
|
||||
|
||||
public var mc_container:PiImgContainer;
|
||||
|
||||
public var text_level:PiBitTextField;
|
||||
|
||||
public var text_cost:PiBitTextField;
|
||||
|
||||
public var text_cd:TextField;
|
||||
|
||||
public var img:NetBitImg;
|
||||
|
||||
public var curSkill:BaseSkill;
|
||||
|
||||
public var dark:Boolean = false;
|
||||
|
||||
public var cdjump:Jumper = new Jumper(5);
|
||||
|
||||
public function BattleSkillUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
super.onSkinComplete();
|
||||
mc_container.setSize(89,91);
|
||||
mc_container.x += 5;
|
||||
lightMode(false);
|
||||
this.visible = false;
|
||||
}
|
||||
|
||||
public function onSkill(vo:BaseSkill) : void
|
||||
{
|
||||
if(vo == null)
|
||||
{
|
||||
this.visible = false;
|
||||
return;
|
||||
}
|
||||
curSkill = vo;
|
||||
this.visible = true;
|
||||
text_cost.text = vo.cost.toString();
|
||||
text_level.text = vo.lv.toString();
|
||||
mc_container.fillNetBitImg(vo.imgsrc);
|
||||
TipDriver.getInstance().regist(this,TipCenter.textTipLeft,vo.getTip(),1000);
|
||||
EnterFrameDriver.getInstance().regist(autoCheckMode);
|
||||
GlobalBroadcast.addEventListener(BattleEvent.MONSTER_SKILL,onSomeSkillHandler);
|
||||
}
|
||||
|
||||
private function onSomeSkillHandler(e:BattleEvent) : void
|
||||
{
|
||||
if(e.data == this.curSkill)
|
||||
{
|
||||
autoCheckMode();
|
||||
}
|
||||
}
|
||||
|
||||
public function autoCheckMode() : void
|
||||
{
|
||||
if(this.visible && curSkill != null)
|
||||
{
|
||||
if(curSkill.cder.cooldown)
|
||||
{
|
||||
lightMode();
|
||||
}
|
||||
else
|
||||
{
|
||||
darkMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function darkMode(check:Boolean = true) : void
|
||||
{
|
||||
if(!dark || !check)
|
||||
{
|
||||
mc_container.transform.colorTransform = Colorator.createDarkTrans(0.3);
|
||||
dark = true;
|
||||
}
|
||||
text_cd.visible = true;
|
||||
var time:Number = curSkill.cder.leftTime / 1000;
|
||||
if(cdjump.jump())
|
||||
{
|
||||
if(time > 0)
|
||||
{
|
||||
if(time > 10)
|
||||
{
|
||||
text_cd.text = Math.floor(time).toString();
|
||||
}
|
||||
else
|
||||
{
|
||||
text_cd.text = time.toFixed(1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
text_cd.text = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function lightMode(check:Boolean = true) : void
|
||||
{
|
||||
if(dark || !check)
|
||||
{
|
||||
mc_container.transform.colorTransform = Colorator.emptyColorTrans;
|
||||
dark = false;
|
||||
}
|
||||
text_cd.visible = false;
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
EnterFrameDriver.getInstance().remove(autoCheckMode);
|
||||
GlobalBroadcast.removeEventListener(BattleEvent.MONSTER_SKILL,onSomeSkillHandler);
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package net.pixvi.myr.battle.view
|
||||
{
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.myr.element.snd.GameSound;
|
||||
|
||||
public class BulletCureView extends BulletView
|
||||
{
|
||||
|
||||
public function BulletCureView()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
override public function hit() : void
|
||||
{
|
||||
if(target != null)
|
||||
{
|
||||
target.beCure(1,this.atk);
|
||||
SoundCenter.getIns().play(GameSound.effect_skill_cure);
|
||||
}
|
||||
stop();
|
||||
this.dispose();
|
||||
this.remove = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,250 @@
|
||||
package net.pixvi.myr.battle.view
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.Event;
|
||||
import flash.utils.getTimer;
|
||||
import net.pixvi.common.driver.StageDriver;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.myr.GameSetting;
|
||||
import net.pixvi.myr.event.MYREvent;
|
||||
import net.pixvi.myr.view.attack.BaseAttack;
|
||||
import net.pixvi.myr.view.attack.rocket.BaseBulletRocket;
|
||||
import net.pixvi.myr.view.attack.rocket.type.RocketType;
|
||||
import net.pixvi.pfw.display.BitMovieClip;
|
||||
import net.pixvi.pfw.display.PiSprite;
|
||||
import net.pixvi.pfw.utils.Locator;
|
||||
import net.pixvi.pfw.utils.PointLocker;
|
||||
|
||||
public class BulletView extends PiSprite
|
||||
{
|
||||
|
||||
public static const HIT_SPACE:int = 30;
|
||||
|
||||
public var target:BattleMon;
|
||||
|
||||
public var targetFloatX:int = 0;
|
||||
|
||||
public var targetFloatY:int = 0;
|
||||
|
||||
public var shooterFloatX:int = 0;
|
||||
|
||||
public var shooterFloatY:int = 0;
|
||||
|
||||
public var targetPoint:Object;
|
||||
|
||||
private var _atk:PointLocker = new PointLocker();
|
||||
|
||||
public var setpow:Number;
|
||||
|
||||
public var spd:Number;
|
||||
|
||||
public var master:BattleMon;
|
||||
|
||||
public var attack:BaseAttack;
|
||||
|
||||
public var img:BitMovieClip;
|
||||
|
||||
public var container:Sprite;
|
||||
|
||||
public var allDistance:Number;
|
||||
|
||||
public var remove:Boolean = false;
|
||||
|
||||
public var action:BaseBulletRocket;
|
||||
|
||||
public var t:TweenMax;
|
||||
|
||||
public var atime:int = 0;
|
||||
|
||||
public var paused:Boolean = false;
|
||||
|
||||
public var force_crit:Boolean = false;
|
||||
|
||||
public var virtualBullet:Boolean = false;
|
||||
|
||||
public var skillBullet:Boolean = false;
|
||||
|
||||
public function BulletView()
|
||||
{
|
||||
super();
|
||||
this.mouseChildren = this.mouseEnabled = false;
|
||||
}
|
||||
|
||||
public function get atk() : int
|
||||
{
|
||||
return _atk.val;
|
||||
}
|
||||
|
||||
public function set atk(value:int) : void
|
||||
{
|
||||
_atk.val = value;
|
||||
}
|
||||
|
||||
public function init(target:BattleMon, master:BattleMon, attack:BaseAttack, setatk:int = -1, setpow:Number = -1) : void
|
||||
{
|
||||
this.target = target;
|
||||
this.master = master;
|
||||
this.attack = attack;
|
||||
if(setatk == -1)
|
||||
{
|
||||
atk = master.all_atk;
|
||||
}
|
||||
else
|
||||
{
|
||||
atk = setatk;
|
||||
}
|
||||
this.setpow = setpow;
|
||||
spd = attack.spd_bullet;
|
||||
targetFloatX = attack.targetFloatX;
|
||||
targetFloatY = attack.targetFloatY;
|
||||
shooterFloatX = attack.shooterFloatX * -master.curFaceto();
|
||||
shooterFloatY = attack.shooterFloatY;
|
||||
allDistance = Locator.getLength3D(target.x,target.y,target.container.y / GameSetting.Y_DISTANCE_SCALE,master.x,master.y,master.container.y / GameSetting.Y_DISTANCE_SCALE);
|
||||
buildView(attack.type_rocket,attack.movie_bullet);
|
||||
t = new TweenMax(this,allTime / 1000,{
|
||||
"x":target.x,
|
||||
"y":target.y,
|
||||
"ease":attack.ease,
|
||||
"onComplete":hit
|
||||
});
|
||||
start();
|
||||
}
|
||||
|
||||
public function getSpd() : Number
|
||||
{
|
||||
if(master != null)
|
||||
{
|
||||
return spd + spd * master.buff.get_movSpd;
|
||||
}
|
||||
return spd;
|
||||
}
|
||||
|
||||
public function lostTarget() : void
|
||||
{
|
||||
targetPoint = {
|
||||
"x":target.x,
|
||||
"y":target.y,
|
||||
"centerXSelf":target.centerXSelf,
|
||||
"centerYSelf":target.centerYSelf
|
||||
};
|
||||
target = null;
|
||||
}
|
||||
|
||||
public function buildView(typeRocket:String, movieBullet:String) : void
|
||||
{
|
||||
container = new Sprite();
|
||||
addChild(container);
|
||||
action = RocketType.getAttack(typeRocket);
|
||||
action.init(container);
|
||||
img = FF.getBMC(movieBullet);
|
||||
if(attack.bulletScale > 0)
|
||||
{
|
||||
img.setScale(attack.bulletScale);
|
||||
}
|
||||
container.addChild(img);
|
||||
container.y = master.container.y + shooterFloatY - master.monMov.height / 2;
|
||||
this.x = master.x + shooterFloatX;
|
||||
this.y = master.y;
|
||||
var shadow:Sprite = FF.getBS("img.Shadow");
|
||||
shadow.scaleX = shadow.scaleY = attack.shadowScale;
|
||||
addChildAt(shadow,0);
|
||||
}
|
||||
|
||||
public function step(e:Event = null) : void
|
||||
{
|
||||
if(paused)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(target != null)
|
||||
{
|
||||
t.updateTo({
|
||||
"x":target.x + targetFloatX,
|
||||
"y":target.y + targetFloatY
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
t.updateTo({
|
||||
"x":targetPoint.x,
|
||||
"y":targetPoint.y
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public function start() : void
|
||||
{
|
||||
t.play();
|
||||
if(action != null)
|
||||
{
|
||||
action.start();
|
||||
}
|
||||
atime = getTimer();
|
||||
}
|
||||
|
||||
public function hit() : void
|
||||
{
|
||||
if(target != null)
|
||||
{
|
||||
if(!virtualBullet)
|
||||
{
|
||||
target.beAttack(master,this,-1,false,-1,skillBullet);
|
||||
}
|
||||
dispatchEvent(new MYREvent(MYREvent.BULLET_HIT,{"target":target}));
|
||||
}
|
||||
stop();
|
||||
this.dispose();
|
||||
this.remove = true;
|
||||
}
|
||||
|
||||
public function get allTime() : int
|
||||
{
|
||||
return (allDistance - 30) / getSpd() * (1000 / StageDriver.stage.frameRate);
|
||||
}
|
||||
|
||||
public function pause() : void
|
||||
{
|
||||
if(action != null)
|
||||
{
|
||||
action.pause();
|
||||
}
|
||||
t.pause();
|
||||
}
|
||||
|
||||
public function resume() : void
|
||||
{
|
||||
if(action != null)
|
||||
{
|
||||
action.resume();
|
||||
}
|
||||
t.resume();
|
||||
}
|
||||
|
||||
public function stop() : void
|
||||
{
|
||||
action.stop();
|
||||
if(t != null)
|
||||
{
|
||||
t.kill();
|
||||
}
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
if(t != null)
|
||||
{
|
||||
stop();
|
||||
}
|
||||
removeAllEventListener();
|
||||
if(this.parent != null)
|
||||
{
|
||||
this.parent.removeChild(this);
|
||||
}
|
||||
master = null;
|
||||
action = null;
|
||||
img.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package net.pixvi.myr.battle.view
|
||||
{
|
||||
public class DamageType
|
||||
{
|
||||
|
||||
public static const SKILL:int = 1;
|
||||
|
||||
public static const BASE_ATTACK:int = 2;
|
||||
|
||||
public static const THORNS:int = 3;
|
||||
|
||||
public static const GROUND:int = 4;
|
||||
|
||||
public static const DEAD_BOOM:int = 5;
|
||||
|
||||
public static const SUN_FIRE:int = 6;
|
||||
|
||||
public static const CHEAT:int = 7;
|
||||
|
||||
public static const BUFF_POI:int = 8;
|
||||
|
||||
public static const CONTROLLER_POI:int = 9;
|
||||
|
||||
public static const SELF_SKILL:int = 10;
|
||||
|
||||
public static const VIM:int = 11;
|
||||
|
||||
public static const CONTROLLER_CURE:int = 12;
|
||||
|
||||
public static const MOON_HEAL:int = 13;
|
||||
|
||||
public static const BUFF_CURE:int = 14;
|
||||
|
||||
public function DamageType()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
package net.pixvi.myr.battle.view.effectmov
|
||||
{
|
||||
import net.pixvi.myr.center.Table;
|
||||
import net.pixvi.myr.view.mon.MonView;
|
||||
import net.pixvi.pfw.display.BitMovieClip;
|
||||
import net.pixvi.pfw.interfaces.IDispose;
|
||||
import net.pixvi.pfw.utils.Random;
|
||||
|
||||
public class BaseMonEffectMov implements IDispose
|
||||
{
|
||||
|
||||
public var typeId:String;
|
||||
|
||||
public var lastMov:BitMovieClip;
|
||||
|
||||
public function BaseMonEffectMov()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function startEffect(target:MonView) : void
|
||||
{
|
||||
var rotation:int = int(para.rotation);
|
||||
if(rotation == -1)
|
||||
{
|
||||
rotation = Random.integer(1,360);
|
||||
}
|
||||
try
|
||||
{
|
||||
lastMov = target.addMovByClass(para.mov,para.position,para.scaleX * (para.faceTo ? target.curFaceto() : 1),para.scaleY,para.fps,rotation,para.floatX * (para.faceTo ? target.curFaceto() : 1),para.floatY,null,null,para.top,para.loop);
|
||||
}
|
||||
catch(error:Error)
|
||||
{
|
||||
lastMov = target.addMovByClass(para.mov,para.position,para.scaleX * (para.faceTo ? target.curFaceto() : 1),para.scaleY,para.fps,rotation,para.floatX * (para.faceTo ? target.curFaceto() : 1),para.floatY,null,null,para.top);
|
||||
}
|
||||
}
|
||||
|
||||
public function pause() : void
|
||||
{
|
||||
if(lastMov != null)
|
||||
{
|
||||
lastMov.stop();
|
||||
}
|
||||
}
|
||||
|
||||
public function resume() : void
|
||||
{
|
||||
if(lastMov != null)
|
||||
{
|
||||
lastMov.play();
|
||||
}
|
||||
}
|
||||
|
||||
public function dead() : void
|
||||
{
|
||||
dispose();
|
||||
}
|
||||
|
||||
public function dispose() : void
|
||||
{
|
||||
if(lastMov != null)
|
||||
{
|
||||
lastMov.dispose();
|
||||
lastMov = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function get type() : String
|
||||
{
|
||||
return table().type;
|
||||
}
|
||||
|
||||
public function get movController() : String
|
||||
{
|
||||
return table().movController;
|
||||
}
|
||||
|
||||
public function get para() : Object
|
||||
{
|
||||
return table().para;
|
||||
}
|
||||
|
||||
public function table() : Object
|
||||
{
|
||||
return Table.monster_setting.effectMov[typeId];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package net.pixvi.myr.battle.view.effectmov
|
||||
{
|
||||
import net.pixvi.common.utils.Cooldowner;
|
||||
import net.pixvi.myr.view.mon.MonView;
|
||||
|
||||
public class MonEffectMovKeep extends BaseMonEffectMov
|
||||
{
|
||||
|
||||
public var cd:Cooldowner;
|
||||
|
||||
public function MonEffectMovKeep()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
override public function startEffect(target:MonView) : void
|
||||
{
|
||||
if(cd == null)
|
||||
{
|
||||
cd = new Cooldowner(para.interval);
|
||||
}
|
||||
if(cd.cooldown)
|
||||
{
|
||||
cd.activity();
|
||||
super.startEffect(target);
|
||||
}
|
||||
}
|
||||
|
||||
override public function pause() : void
|
||||
{
|
||||
super.pause();
|
||||
if(cd != null)
|
||||
{
|
||||
cd.pause();
|
||||
}
|
||||
}
|
||||
|
||||
override public function resume() : void
|
||||
{
|
||||
super.resume();
|
||||
if(cd != null)
|
||||
{
|
||||
cd.resume();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package net.pixvi.myr.battle.view.effectmov
|
||||
{
|
||||
import net.pixvi.myr.center.Table;
|
||||
|
||||
public class MonEffectMovType
|
||||
{
|
||||
|
||||
public static const ATTACK_MOV:String = "attack";
|
||||
|
||||
public static const DEFENCE_MOV:String = "defence";
|
||||
|
||||
public static const NORMAL_MOV:String = "normal";
|
||||
|
||||
public function MonEffectMovType()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getMonEffectMovByTypeId(typeId:String) : BaseMonEffectMov
|
||||
{
|
||||
var effect:BaseMonEffectMov = null;
|
||||
switch(Table.monster_setting.effectMov[typeId].movController.toString())
|
||||
{
|
||||
case "1":
|
||||
effect = new BaseMonEffectMov();
|
||||
break;
|
||||
case "2":
|
||||
effect = new MonEffectMovKeep();
|
||||
break;
|
||||
default:
|
||||
effect = new BaseMonEffectMov();
|
||||
}
|
||||
effect.typeId = typeId;
|
||||
return effect;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package net.pixvi.myr.battle.view.piece
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import flash.display.DisplayObject;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.myr.center.Game;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.controls.PiBitTextField;
|
||||
|
||||
public class BattleCostUI extends UIComponent
|
||||
{
|
||||
|
||||
public var text_cost:PiBitTextField;
|
||||
|
||||
public var t:TweenMax;
|
||||
|
||||
public function BattleCostUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
skin = FF.getMC("mov.Cost");
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
text_cost.mapMode = true;
|
||||
}
|
||||
|
||||
public function prepareShow() : void
|
||||
{
|
||||
this.alpha = 1;
|
||||
if(t != null)
|
||||
{
|
||||
t.kill();
|
||||
t = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function showHide() : void
|
||||
{
|
||||
if(Game.HQ)
|
||||
{
|
||||
t = TweenMax.to(this,0.5,{
|
||||
"alpha":0,
|
||||
"y":this.y - 30,
|
||||
"onComplete":costMovieFinishHandler
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
t = TweenMax.to(this,0.5,{
|
||||
"alpha":0,
|
||||
"y":this.y - 30,
|
||||
"onComplete":costMovieFinishHandler
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private function costMovieFinishHandler() : void
|
||||
{
|
||||
t = null;
|
||||
if(this.parent != null)
|
||||
{
|
||||
this.parent.removeChild(this);
|
||||
this.alpha = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,243 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import flash.events.Event;
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.common.utils.mobi.MobiTools;
|
||||
import net.pixvi.myr.GameMath;
|
||||
import net.pixvi.myr.element.user.ServerVo;
|
||||
import net.pixvi.myr.net.NetUser;
|
||||
import net.pixvi.myrane.MyrAne;
|
||||
import net.pixvi.myrloader.center.MyrCenter;
|
||||
import net.pixvi.pfw.utils.ArrayUtil;
|
||||
import net.pixvi.pfw.utils.Saver;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class AccountCenter
|
||||
{
|
||||
|
||||
public var username:String = "";
|
||||
|
||||
public var password:String = "";
|
||||
|
||||
public var userToken:String = "";
|
||||
|
||||
public var sdkUserId:String = "";
|
||||
|
||||
public var isVisitor:Boolean = false;
|
||||
|
||||
public var userServerList:Array;
|
||||
|
||||
public var userMasterList:Array;
|
||||
|
||||
public var curServer:ServerVo;
|
||||
|
||||
public var realName:String;
|
||||
|
||||
public var realID:String;
|
||||
|
||||
public var noticeData:Object = {};
|
||||
|
||||
private var onSdkLoginComplete:Function;
|
||||
|
||||
private var onLoginComplete:Function;
|
||||
|
||||
private var onSelectServerComplete:Function;
|
||||
|
||||
private var onSelectServerError:Function;
|
||||
|
||||
private var selectServer_serverId:int;
|
||||
|
||||
public function AccountCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : AccountCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(AccountCenter) as AccountCenter;
|
||||
}
|
||||
|
||||
public function sdkLogin(sdkUid:String, sdkToken:String, onComplete:Function) : void
|
||||
{
|
||||
onSdkLoginComplete = onComplete;
|
||||
NetUser.getIns().sdkLogin(sdkUid,sdkToken,sdkLoginHandler);
|
||||
}
|
||||
|
||||
private function sdkLoginHandler(re:Object) : void
|
||||
{
|
||||
userLoginCompleteHandler(re);
|
||||
if(onSdkLoginComplete != null)
|
||||
{
|
||||
onSdkLoginComplete(re);
|
||||
onSdkLoginComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function login(un:String, pw:String, onComplete:Function) : void
|
||||
{
|
||||
onLoginComplete = onComplete;
|
||||
NetUser.getIns().login(un,pw,loginHandler);
|
||||
}
|
||||
|
||||
private function loginHandler(re:Object) : void
|
||||
{
|
||||
if(re.re == 0 && re.resCode == 0)
|
||||
{
|
||||
userLoginCompleteHandler(re);
|
||||
}
|
||||
if(onLoginComplete != null)
|
||||
{
|
||||
onLoginComplete(re);
|
||||
onLoginComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function userLoginCompleteHandler(re:Object) : void
|
||||
{
|
||||
var maxvo:ServerVo = null;
|
||||
var i:int = 0;
|
||||
var sData:Object = null;
|
||||
var sVo:ServerVo = null;
|
||||
var j:int = 0;
|
||||
var mData:Object = null;
|
||||
var msVo:ServerVo = null;
|
||||
logout();
|
||||
if(re.re != 0 || re.resCode != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
AccountCenter.getIns().userToken = re.playerInfo.token;
|
||||
userServerList = [];
|
||||
var serverDic:Object = {};
|
||||
for(i = 0; i < re.servers.length; )
|
||||
{
|
||||
sData = re.servers[i];
|
||||
if(sData.platform == MyrCenter.platform)
|
||||
{
|
||||
sVo = new ServerVo();
|
||||
sVo.channel = sData.channel;
|
||||
sVo.platform = sData.platform;
|
||||
sVo.gameServerAddress = sData.gameServerAddress;
|
||||
sVo.payServerAddress = sData.payServerAddress;
|
||||
sVo.serverName = sData.serverName;
|
||||
sVo.serverStatus = sData.serverStatus;
|
||||
sVo.serverId = sData.id;
|
||||
userServerList.push(sVo);
|
||||
serverDic[sVo.serverId] = sVo;
|
||||
if(maxvo == null || maxvo.serverId < sVo.serverId)
|
||||
{
|
||||
maxvo = sVo;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if(maxvo != null)
|
||||
{
|
||||
maxvo.isNew = true;
|
||||
}
|
||||
for(j = 0; j < re.masterInfos.length; )
|
||||
{
|
||||
mData = re.masterInfos[j];
|
||||
msVo = serverDic[mData.serverId];
|
||||
if(msVo != null)
|
||||
{
|
||||
msVo.masterCreateTime = mData.createTime;
|
||||
msVo.masterId = mData.id;
|
||||
msVo.masterName = mData.masterName;
|
||||
msVo.masterUpdateTime = mData.updateTime;
|
||||
msVo.masterStatus = mData.status ? 1 : 0;
|
||||
msVo.hasMaster = true;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
AccountCenter.getIns().realID = re.playerInfo.userIdCard;
|
||||
AccountCenter.getIns().realName = re.playerInfo.userName;
|
||||
}
|
||||
|
||||
public function selectServer(serverId:int, onComplete:Function, onError:Function) : void
|
||||
{
|
||||
onSelectServerComplete = onComplete;
|
||||
onSelectServerError = onError;
|
||||
selectServer_serverId = serverId;
|
||||
NetUser.getIns().selectServer(serverId,selectServerHandler);
|
||||
}
|
||||
|
||||
public function selectServerHandler(re:Object) : void
|
||||
{
|
||||
if(re.resCode == 994 && GameMath.ModeTrace == false)
|
||||
{
|
||||
if(onSelectServerError != null)
|
||||
{
|
||||
onSelectServerError(lang("服务器爆满了!请稍后再来吧!"));
|
||||
}
|
||||
onSelectServerError = null;
|
||||
onSelectServerComplete = null;
|
||||
return;
|
||||
}
|
||||
if(re.resCode == 990)
|
||||
{
|
||||
if(onSelectServerError != null)
|
||||
{
|
||||
onSelectServerError(lang("服务器繁忙,请稍后再试吧!"));
|
||||
}
|
||||
onSelectServerError = null;
|
||||
onSelectServerComplete = null;
|
||||
return;
|
||||
}
|
||||
curServer = ArrayUtil.getElementByValue(userServerList,"serverId",selectServer_serverId) as ServerVo;
|
||||
if(MobiTools.isMobi() && MyrCenter.channel == "MEIZU" && Boolean(MyrAne.meizu2Bingxue))
|
||||
{
|
||||
MyrAne.bingxueSetRoleData(1,curServer.serverId,curServer.serverName,curServer.masterId.toString(),curServer.masterName,"1",100,"驯养师","","牧羊人之心");
|
||||
}
|
||||
if(onSelectServerComplete != null)
|
||||
{
|
||||
onSelectServerComplete();
|
||||
onSelectServerError = null;
|
||||
onSelectServerComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function logout() : void
|
||||
{
|
||||
MasterCenter.getIns().masterInfo = null;
|
||||
Game.getIns().master = null;
|
||||
}
|
||||
|
||||
public function userUpgrade(e:Event = null) : void
|
||||
{
|
||||
trace("更新账号类型");
|
||||
isVisitor = false;
|
||||
}
|
||||
|
||||
public function userUpgrade2(e:Event = null) : void
|
||||
{
|
||||
trace("更新账号类型2");
|
||||
isVisitor = false;
|
||||
}
|
||||
|
||||
public function get account() : Object
|
||||
{
|
||||
return Saver.getAuto("accountsave");
|
||||
}
|
||||
|
||||
public function resetAccount() : void
|
||||
{
|
||||
Saver.removeAuto("accountsave");
|
||||
}
|
||||
|
||||
public function loginOut() : void
|
||||
{
|
||||
MasterCenter.getIns().masterInfo = null;
|
||||
AccountCenter.getIns().userToken = "";
|
||||
}
|
||||
|
||||
public function saveAccount(username:String, password:String) : void
|
||||
{
|
||||
Saver.saveAuto("accountsave",{
|
||||
"username":username,
|
||||
"password":password
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.myr.CP;
|
||||
import net.pixvi.myr.GameMath;
|
||||
import net.pixvi.myr.element.achi.AchiVo;
|
||||
import net.pixvi.myr.element.reward.RewardResultVo;
|
||||
import net.pixvi.myr.event.MYREvent;
|
||||
import net.pixvi.myr.net.NetAchi;
|
||||
import net.pixvi.pfw.utils.ArrayUtil;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class AchiCenter extends Singleton
|
||||
{
|
||||
|
||||
private var finishAchi_achi:AchiVo;
|
||||
|
||||
private var onFinishAchiComplete:Function;
|
||||
|
||||
public function AchiCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : AchiCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(AchiCenter) as AchiCenter;
|
||||
}
|
||||
|
||||
public function autoCheck(type:String = "all", show:Boolean = false) : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var a:String = null;
|
||||
var j:int = 0;
|
||||
var typeachis:Array = [];
|
||||
for(i = 0; i < Master.achis.length; )
|
||||
{
|
||||
a = Master.achis[i].type;
|
||||
if(type == "all" || Master.achis[i].type == type)
|
||||
{
|
||||
typeachis.push(Master.achis[i]);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
for(j = 0; j < typeachis.length; j++)
|
||||
{
|
||||
try
|
||||
{
|
||||
if((typeachis[j] as AchiVo).closed)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
catch(err:Error)
|
||||
{
|
||||
}
|
||||
if((show || !typeachis[j].showComplete) && typeachis[j].canFinish())
|
||||
{
|
||||
typeachis[j].showComplete = true;
|
||||
Alert.showMsg(CP.task(lang("获得成就") + "【" + typeachis[j].name + "】!"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function finishAchi(achi:AchiVo, onComplete:Function = null) : void
|
||||
{
|
||||
onFinishAchiComplete = onComplete;
|
||||
finishAchi_achi = achi;
|
||||
NetAchi.getIns().finishAchi(achi.id.toString(),finishAchiHandler);
|
||||
}
|
||||
|
||||
private function finishAchiHandler(rewardResult:RewardResultVo) : void
|
||||
{
|
||||
finishAchi_achi.isComplete = true;
|
||||
RewardCenter.getIns().getReward(rewardResult,true,"panel");
|
||||
ArrayUtil.remove(Master.achis,finishAchi_achi);
|
||||
Master.achispass.push(finishAchi_achi);
|
||||
Master.history.passAchi.push(finishAchi_achi.id);
|
||||
for each(var i:int in finishAchi_achi.next)
|
||||
{
|
||||
if(Table.achi_info[i] != null)
|
||||
{
|
||||
unlockLocalAchi(i);
|
||||
}
|
||||
}
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.ACHI_NUM_CHANGE));
|
||||
finishAchi_achi = null;
|
||||
if(onFinishAchiComplete != null)
|
||||
{
|
||||
onFinishAchiComplete();
|
||||
onFinishAchiComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function unlockLocalAchi(achiid:int) : void
|
||||
{
|
||||
var na:AchiVo = null;
|
||||
if(!checkAchiFinished(achiid))
|
||||
{
|
||||
na = new AchiVo();
|
||||
na.init(achiid);
|
||||
Master.achis.push(na);
|
||||
}
|
||||
}
|
||||
|
||||
public function getShowAchis() : Array
|
||||
{
|
||||
var i:int = 0;
|
||||
var achis:Array = [];
|
||||
for(i = 0; i < Master.achis.length; )
|
||||
{
|
||||
if(GameMath.ModeTrace || !Master.achis[i].hide || Master.achis[i].canFinish())
|
||||
{
|
||||
if(!Master.achis[i].closed)
|
||||
{
|
||||
achis.push(Master.achis[i]);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
achis.sortOn("id");
|
||||
return achis;
|
||||
}
|
||||
|
||||
public function hasCompleteAchi() : Boolean
|
||||
{
|
||||
for each(var achivo:AchiVo in Master.achis)
|
||||
{
|
||||
if(!achivo.closed && !achivo.isComplete && achivo.canFinish())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function checkLocalAchiList() : void
|
||||
{
|
||||
var k:int = 0;
|
||||
var data:Object = null;
|
||||
var ua:AchiVo = null;
|
||||
var i:int = 0;
|
||||
var achiTypeId:int = 0;
|
||||
var achiData:AchiVo = null;
|
||||
var j:int = 0;
|
||||
var nextId:int = 0;
|
||||
var curAchiData:AchiVo = null;
|
||||
var curAchis:Array = [];
|
||||
var passAchis:Array = [];
|
||||
for(k = 0; k < Table.achi_infoArr.length; )
|
||||
{
|
||||
data = Table.achi_infoArr[k];
|
||||
if(data.unlock && Master.history.passAchi.indexOf(int(data.id)) == -1)
|
||||
{
|
||||
ua = new AchiVo();
|
||||
ua.id = data.id;
|
||||
curAchis.push(ua);
|
||||
}
|
||||
k++;
|
||||
}
|
||||
for(i = 0; i < Master.history.passAchi.length; )
|
||||
{
|
||||
achiTypeId = int(Master.history.passAchi[i]);
|
||||
achiData = new AchiVo();
|
||||
achiData.isComplete = true;
|
||||
achiData.showComplete = true;
|
||||
achiData.id = achiTypeId;
|
||||
for(j = 0; j < achiData.next.length; )
|
||||
{
|
||||
nextId = int(achiData.next[j]);
|
||||
if(Table.achi_info[nextId] != null && Master.history.passAchi.indexOf(nextId) == -1)
|
||||
{
|
||||
curAchiData = new AchiVo();
|
||||
curAchiData.id = nextId;
|
||||
if(!curAchiData.closed)
|
||||
{
|
||||
curAchis.push(curAchiData);
|
||||
}
|
||||
}
|
||||
j++;
|
||||
}
|
||||
passAchis.push(achiData);
|
||||
i++;
|
||||
}
|
||||
Master.achis = curAchis;
|
||||
Master.achispass = passAchis;
|
||||
}
|
||||
|
||||
public function checkAchiFinished(id:int) : Boolean
|
||||
{
|
||||
if(Master.history.passAchi.indexOf(id) != -1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,261 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.common.driver.ClockDriver;
|
||||
import net.pixvi.myr.element.gacha.GachaVo;
|
||||
import net.pixvi.myr.element.reward.RewardResultVo;
|
||||
import net.pixvi.myr.net.NetActi;
|
||||
import net.pixvi.myr.panel.dailycheck.DailyCheckPanel;
|
||||
import net.pixvi.myr.panel.event.EventClickImgPanel;
|
||||
import net.pixvi.myr.panel.event.EventImgPanel;
|
||||
import net.pixvi.myr.panel.event.dailygift.ActiDailyGiftPanel;
|
||||
import net.pixvi.myr.panel.gacha.GachaPanel;
|
||||
import net.pixvi.myr.panel.mainmenu.MainMenu;
|
||||
import net.pixvi.myr.panel.moncol.MonColPanel;
|
||||
import net.pixvi.myr.panel.paypoint.PayPointPanel;
|
||||
import net.pixvi.myr.util.MyrCalendar;
|
||||
import net.pixvi.pfw.utils.Calendar;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class ActiCenter extends Singleton
|
||||
{
|
||||
|
||||
private var cacheDailyGet:Object;
|
||||
|
||||
private var onLoopCheckRewardComplete:Function;
|
||||
|
||||
private var onWeekTaskFinishComplete:Function;
|
||||
|
||||
private var onWeekTaskInfoComplete:Function;
|
||||
|
||||
private var onDailyGiftCheckComplete:Function;
|
||||
|
||||
private var updatingDailyGift:Boolean = false;
|
||||
|
||||
private var onVipDailyGiftCheckComplete:Function;
|
||||
|
||||
private var onDailyCheckCheckComplete:Function;
|
||||
|
||||
public function ActiCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : ActiCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(ActiCenter) as ActiCenter;
|
||||
}
|
||||
|
||||
public function startEvent(data:Object = null) : void
|
||||
{
|
||||
var gachavo:GachaVo = null;
|
||||
var action:String = data.action;
|
||||
switch(action)
|
||||
{
|
||||
case "dailyGift":
|
||||
PopCenter.POP(new ActiDailyGiftPanel());
|
||||
break;
|
||||
case "payPoint":
|
||||
PopCenter.POP(new PayPointPanel());
|
||||
break;
|
||||
case "monCol":
|
||||
PopCenter.POP(new MonColPanel());
|
||||
break;
|
||||
case "contentImg":
|
||||
PopCenter.POP(new EventImgPanel(data));
|
||||
break;
|
||||
case "contentBigImg":
|
||||
PopCenter.POP(new EventClickImgPanel(data.data.contentImg));
|
||||
break;
|
||||
case "dailyCheck":
|
||||
PopCenter.POP(new DailyCheckPanel());
|
||||
break;
|
||||
case "gacha":
|
||||
gachavo = new GachaVo();
|
||||
GachaPanel.popInGacha(data.data.gachaId);
|
||||
}
|
||||
}
|
||||
|
||||
public function LoopCheckReward(onComplete:Function) : void
|
||||
{
|
||||
onLoopCheckRewardComplete = onComplete;
|
||||
NetActi.getIns().LoopCheckReward(LoopCheckRewardHandler);
|
||||
}
|
||||
|
||||
private function LoopCheckRewardHandler(re:Object) : void
|
||||
{
|
||||
Master.activityHistory.loopCheckRewardTime = re.param.dailyRewardGetTime / 1000;
|
||||
RewardCenter.getIns().getRewardByData(re.reward,true,"panel");
|
||||
if(onLoopCheckRewardComplete != null)
|
||||
{
|
||||
onLoopCheckRewardComplete(re);
|
||||
onLoopCheckRewardComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function weekTaskFinish(onComplete:Function) : void
|
||||
{
|
||||
onWeekTaskFinishComplete = onComplete;
|
||||
NetActi.getIns().weekTaskFinish(weekTaskFinishHandler);
|
||||
}
|
||||
|
||||
private function weekTaskFinishHandler(re:Object) : void
|
||||
{
|
||||
RewardCenter.getIns().getRewardByData(re.reward,true,"panel");
|
||||
Master.activityHistory.weekTaskStatus["getReward"] = true;
|
||||
if(onWeekTaskFinishComplete != null)
|
||||
{
|
||||
onWeekTaskFinishComplete(re);
|
||||
onWeekTaskFinishComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function weekTaskInfo(onComplete:Function) : void
|
||||
{
|
||||
onWeekTaskInfoComplete = onComplete;
|
||||
NetActi.getIns().weekTaskInfo(weekTaskInfoHandler);
|
||||
}
|
||||
|
||||
private function weekTaskInfoHandler(re:Object) : void
|
||||
{
|
||||
Master.activityHistory.weekTaskStatus = re.data;
|
||||
if(onWeekTaskInfoComplete != null)
|
||||
{
|
||||
onWeekTaskInfoComplete(re);
|
||||
onWeekTaskInfoComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function checkFinish(activityType:String) : Boolean
|
||||
{
|
||||
var checkDay:int = 0;
|
||||
var today:int = 0;
|
||||
var _loc4_:String = activityType;
|
||||
if("dailyCheck" !== _loc4_)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
checkDay = Calendar.getDayNumber(Master.activityHistory.dailyCheckTime);
|
||||
today = Calendar.getDayNumber();
|
||||
if(Master.activityHistory.dailyCheckCount < 7 && checkDay != today)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function autoPopActivity() : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var eventdata:Object = null;
|
||||
if(GuideCenter.getIns().checkFreshGuideFinish())
|
||||
{
|
||||
for(i = 0; i < Table.activity_info.events.length; )
|
||||
{
|
||||
eventdata = Table.activity_info.events[i];
|
||||
if(eventdata.autoPop == true && (eventdata.autoPopTimestamp == null || eventdata.autoPopTimestamp > TimeCenter.timestamp) && !checkFinish(eventdata.type))
|
||||
{
|
||||
startEvent(eventdata);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function dailyGiftChecked() : Boolean
|
||||
{
|
||||
var today:Date = MyrCalendar.getShowDate(ClockDriver.timestamp * 1000);
|
||||
var checkDay:Date = MyrCalendar.getShowDate(Master.activityHistory.dailyGiftCheckTime * 1000);
|
||||
if(today.fullYear == checkDay.fullYear && today.month == checkDay.month && today.date == checkDay.date)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function dailyVipGiftChecked() : Boolean
|
||||
{
|
||||
return MasterCenter.getIns().getVipChecked();
|
||||
}
|
||||
|
||||
public function dailyGiftCheck(onComplete:Function = null) : void
|
||||
{
|
||||
onDailyGiftCheckComplete = onComplete;
|
||||
NetActi.getIns().dailyGiftCheck(dailyGiftCheckHandler);
|
||||
}
|
||||
|
||||
private function dailyGiftCheckHandler(rewardData:Object, newCount:int, newLevel:int) : void
|
||||
{
|
||||
Master.activityHistory.dailyGiftCheckTime = TimeCenter.timestamp;
|
||||
Master.activityHistory.dailyGiftCount = newCount;
|
||||
Master.activityHistory.dailyGiftLevel = newLevel;
|
||||
Master.activityHistory.dailyGiftSignCount++;
|
||||
MainMenu.getIns().ui.ui_top.update();
|
||||
RewardCenter.getIns().getRewardByData(rewardData,true,"panel");
|
||||
if(onDailyGiftCheckComplete != null)
|
||||
{
|
||||
onDailyGiftCheckComplete();
|
||||
onDailyGiftCheckComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function autoUpdateDailyGift() : void
|
||||
{
|
||||
if(updatingDailyGift)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private function startUpdateDailyGift() : void
|
||||
{
|
||||
updatingDailyGift = true;
|
||||
NetActi.getIns().updateDailyGift(startUpdateDailyGiftHandler);
|
||||
}
|
||||
|
||||
private function startUpdateDailyGiftHandler(newLevel:int, newCount:int) : void
|
||||
{
|
||||
Master.activityHistory.dailyGiftCount = newCount;
|
||||
Master.activityHistory.dailyGiftLevel = newLevel;
|
||||
updatingDailyGift = false;
|
||||
}
|
||||
|
||||
public function vipDailyGiftCheck(onComplete:Function) : void
|
||||
{
|
||||
onVipDailyGiftCheckComplete = onComplete;
|
||||
NetActi.getIns().vipDailyGiftCheck(vipDailyGiftCheckHandler);
|
||||
}
|
||||
|
||||
private function vipDailyGiftCheckHandler(rewardData:Object) : void
|
||||
{
|
||||
var reward:RewardResultVo = RewardCenter.getRewardResultVoByData(rewardData);
|
||||
RewardCenter.getIns().getReward(reward,true,"panel",null,false);
|
||||
Master.activityHistory.vipCheckTime = TimeCenter.timestamp * 1000;
|
||||
if(onVipDailyGiftCheckComplete != null)
|
||||
{
|
||||
onVipDailyGiftCheckComplete(reward);
|
||||
onVipDailyGiftCheckComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function dailyCheckCheck(onComplete:Function) : void
|
||||
{
|
||||
onDailyCheckCheckComplete = onComplete;
|
||||
NetActi.getIns().dailyCheckCheck(dailyCheckCheckHandler);
|
||||
}
|
||||
|
||||
private function dailyCheckCheckHandler(rewardData:Object) : void
|
||||
{
|
||||
var reward:RewardResultVo = RewardCenter.getRewardResultVoByData(rewardData);
|
||||
RewardCenter.getIns().getReward(reward,true,"panel",null,false);
|
||||
Master.activityHistory.dailyCheckTime = TimeCenter.timestamp * 1000;
|
||||
Master.activityHistory.dailyCheckCount++;
|
||||
if(onDailyCheckCheckComplete != null)
|
||||
{
|
||||
onDailyCheckCheckComplete();
|
||||
onDailyCheckCheckComplete = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,299 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.myr.GameMath;
|
||||
import net.pixvi.myr.element.alchemy.AlchemyStackVo;
|
||||
import net.pixvi.myr.element.bag.BuildMaterialVo;
|
||||
import net.pixvi.myr.element.bag.EquipBuildVo;
|
||||
import net.pixvi.myr.element.bag.EquipVo;
|
||||
import net.pixvi.myr.element.bag.ItemVo;
|
||||
import net.pixvi.myr.net.NetAlchemy;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
import net.pixvi.pfw.utils.json.Json;
|
||||
|
||||
public class AlchemyCenter extends Singleton
|
||||
{
|
||||
|
||||
public static var alchemySpeedTime:int = 1800;
|
||||
|
||||
private var startAlchemy_para:Object;
|
||||
|
||||
private var onStartAlchemyComplete:Function;
|
||||
|
||||
private var onOverAlchemyComplete:Function;
|
||||
|
||||
private var overAlchemy_para:AlchemyStackVo;
|
||||
|
||||
private var onSpeedAlchemyComplete:Function;
|
||||
|
||||
private var speedAlchemy_para:Object;
|
||||
|
||||
private var onAddAlchemyStackComplete:Function;
|
||||
|
||||
public function AlchemyCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : AlchemyCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(AlchemyCenter) as AlchemyCenter;
|
||||
}
|
||||
|
||||
public static function getAlchemyStackByAlchemyStackData(alchemyStackData:Object) : AlchemyStackVo
|
||||
{
|
||||
var asvo:AlchemyStackVo = new AlchemyStackVo();
|
||||
asvo.id = alchemyStackData.id;
|
||||
asvo.starting = alchemyStackData.starting == 1;
|
||||
asvo.endTime = alchemyStackData.endTime / 1000;
|
||||
if(!asvo.starting || alchemyStackData.itemTypes == null || alchemyStackData.itemTypes == "")
|
||||
{
|
||||
asvo.itemTypes = [];
|
||||
}
|
||||
else
|
||||
{
|
||||
asvo.itemTypes = Json.decode(alchemyStackData.itemTypes.toString()) as Array;
|
||||
}
|
||||
return asvo;
|
||||
}
|
||||
|
||||
public function startAlchemy(stackId:int, types:Array, items:Array, onComplete:Function) : void
|
||||
{
|
||||
onStartAlchemyComplete = onComplete;
|
||||
var materialDic:Object = {};
|
||||
var materialArr:Array = [];
|
||||
var level:int = getFormulaLevel(types);
|
||||
var cost:int = int(GameMath.alchemyFormulaCost[level].cost);
|
||||
for each(var item:ItemVo in items)
|
||||
{
|
||||
if(materialDic[item.id] == null)
|
||||
{
|
||||
materialDic[item.id] = {
|
||||
"itemId":item.id,
|
||||
"num":1
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
materialDic[item.id].num++;
|
||||
}
|
||||
}
|
||||
for each(var io:Object in materialDic)
|
||||
{
|
||||
materialArr.push(io);
|
||||
}
|
||||
startAlchemy_para = {
|
||||
"cost":cost,
|
||||
"items":materialArr,
|
||||
"types":types,
|
||||
"stackId":stackId
|
||||
};
|
||||
NetAlchemy.getIns().startAlchemy(stackId,materialArr,startAlchemyHandler);
|
||||
}
|
||||
|
||||
private function startAlchemyHandler(endTime:int, moneyCost:int) : void
|
||||
{
|
||||
MasterCenter.getIns().addMoney(-moneyCost,true);
|
||||
for each(var item:Object in startAlchemy_para.items)
|
||||
{
|
||||
BagCenter.getIns().subNum(item.itemId,item.num);
|
||||
}
|
||||
var stackvo:AlchemyStackVo = getAlchemyStackVoById(startAlchemy_para.stackId);
|
||||
stackvo.itemTypes = startAlchemy_para.types;
|
||||
stackvo.starting = true;
|
||||
stackvo.endTime = endTime;
|
||||
if(onStartAlchemyComplete != null)
|
||||
{
|
||||
onStartAlchemyComplete();
|
||||
onStartAlchemyComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function checkAlchemyFormula(types:Array) : Boolean
|
||||
{
|
||||
var exp:EquipBuildVo = null;
|
||||
var ivo:ItemVo = null;
|
||||
var i:int = 0;
|
||||
var exps:Array = [];
|
||||
var items:Array = [];
|
||||
for each(i in types)
|
||||
{
|
||||
ivo = new ItemVo();
|
||||
ivo.num = 1;
|
||||
ivo.type = i;
|
||||
items.push(ivo);
|
||||
}
|
||||
var buildMaterialVo:BuildMaterialVo = new BuildMaterialVo();
|
||||
buildMaterialVo.buildByItemVoArr(items);
|
||||
for(i = 0; i < Table.equipbuild_list.length; )
|
||||
{
|
||||
exp = Table.equipbuild_list[i];
|
||||
if(exp.check(buildMaterialVo))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function overAlchemy(alchemyStackId:int, onComplete:Function) : void
|
||||
{
|
||||
onOverAlchemyComplete = onComplete;
|
||||
var alchemyStack:AlchemyStackVo = getAlchemyStackVoById(alchemyStackId);
|
||||
overAlchemy_para = alchemyStack;
|
||||
NetAlchemy.getIns().finishAlchemy(alchemyStack.id,overAlchemyComplete);
|
||||
}
|
||||
|
||||
public function overAlchemyComplete(equipData:Object) : void
|
||||
{
|
||||
var equipVo:EquipVo = BagCenter.getItemByItemData(equipData) as EquipVo;
|
||||
BagCenter.getIns().addItem(equipVo);
|
||||
overAlchemy_para.starting = false;
|
||||
overAlchemy_para.itemTypes = [];
|
||||
if(onOverAlchemyComplete != null)
|
||||
{
|
||||
onOverAlchemyComplete(equipVo);
|
||||
onOverAlchemyComplete = null;
|
||||
}
|
||||
overAlchemy_para = null;
|
||||
}
|
||||
|
||||
public function getDazaoMoneyCost(items:Array) : int
|
||||
{
|
||||
var i:int = 0;
|
||||
var material:Object = null;
|
||||
var j:int = 0;
|
||||
var materialNum:int = 0;
|
||||
for each(var it:ItemVo in items)
|
||||
{
|
||||
for(i = 0; i < it.material.length; )
|
||||
{
|
||||
material = it.material[i];
|
||||
materialNum += material.num;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
for(j = 0; j < GameMath.alchemyFormulaLevel.length; )
|
||||
{
|
||||
if(GameMath.alchemyFormulaLevel[j].num > materialNum)
|
||||
{
|
||||
return GameMath.alchemyFormulaLevel[j].cost;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
return materialNum;
|
||||
}
|
||||
|
||||
public function getFormulaLevel(itemTypes:Array) : int
|
||||
{
|
||||
var k:int = 0;
|
||||
var type:int = 0;
|
||||
var i:int = 0;
|
||||
var material:Object = null;
|
||||
var j:int = 0;
|
||||
var materialNum:int = 0;
|
||||
for(k = 0; k < itemTypes.length; )
|
||||
{
|
||||
type = int(itemTypes[k]);
|
||||
for(i = 0; i < Table.item_info[type].material.length; )
|
||||
{
|
||||
material = Table.item_info[type].material[i];
|
||||
materialNum += int(material.value);
|
||||
i++;
|
||||
}
|
||||
k++;
|
||||
}
|
||||
var lv:int = 1;
|
||||
for(j = 0; j < GameMath.alchemyFormulaLevel.length; )
|
||||
{
|
||||
if(materialNum <= GameMath.alchemyFormulaLevel[j].num)
|
||||
{
|
||||
return GameMath.alchemyFormulaLevel[j].lv;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
return lv;
|
||||
}
|
||||
|
||||
public function getAlchemyStackVoById(id:int) : AlchemyStackVo
|
||||
{
|
||||
for each(var vo:AlchemyStackVo in Master.alchemyStacks)
|
||||
{
|
||||
if(vo.id == id)
|
||||
{
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function speedAlchemyByItem(alchemyStackId:int, itemNum:int, onComplete:Function) : void
|
||||
{
|
||||
onSpeedAlchemyComplete = onComplete;
|
||||
var item:ItemVo = BagCenter.getIns().getByType(GameMath.alchemySpeedItemId);
|
||||
speedAlchemy_para = {
|
||||
"num":itemNum,
|
||||
"id":alchemyStackId,
|
||||
"itemId":item.id
|
||||
};
|
||||
NetAlchemy.getIns().speedAlchemy(alchemyStackId,itemNum,item.id,speedAlchemyHandler);
|
||||
}
|
||||
|
||||
private function speedAlchemyHandler(newEndTime:int) : void
|
||||
{
|
||||
BagCenter.getIns().subNum(speedAlchemy_para.itemId,speedAlchemy_para.num,true);
|
||||
getAlchemyStackVoById(speedAlchemy_para.id).endTime = newEndTime;
|
||||
if(onSpeedAlchemyComplete != null)
|
||||
{
|
||||
onSpeedAlchemyComplete();
|
||||
onSpeedAlchemyComplete = null;
|
||||
speedAlchemy_para = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function addAlchemeyStack(onComplete:Function) : void
|
||||
{
|
||||
onAddAlchemyStackComplete = onComplete;
|
||||
NetAlchemy.getIns().addAlchemyStack(allAlchemyStackComplete);
|
||||
}
|
||||
|
||||
public function allAlchemyStackComplete(alchemyStackData:Object = null) : void
|
||||
{
|
||||
var num:int = int(Master.alchemyStacks.length);
|
||||
var money:int = int(Table.alchemyStack_price[num.toString()].money);
|
||||
var ke:int = int(Table.alchemyStack_price[num.toString()].ke);
|
||||
if(money != 0)
|
||||
{
|
||||
MasterCenter.getIns().addMoney(-money);
|
||||
}
|
||||
if(ke != 0)
|
||||
{
|
||||
MasterCenter.getIns().addKe(-ke);
|
||||
}
|
||||
var s:AlchemyStackVo = getAlchemyStackByAlchemyStackData(alchemyStackData);
|
||||
Master.alchemyStacks.push(s);
|
||||
if(onAddAlchemyStackComplete != null)
|
||||
{
|
||||
onAddAlchemyStackComplete();
|
||||
onAddAlchemyStackComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function hasFinish() : Boolean
|
||||
{
|
||||
var i:int = 0;
|
||||
var s:AlchemyStackVo = null;
|
||||
for(i = 0; i < Master.alchemyStacks.length; )
|
||||
{
|
||||
s = Master.alchemyStacks[i];
|
||||
if(s.starting && s.finish())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,609 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.myr.CP;
|
||||
import net.pixvi.myr.GameMath;
|
||||
import net.pixvi.myr.element.achi.AchiType;
|
||||
import net.pixvi.myr.element.bag.EquipVo;
|
||||
import net.pixvi.myr.element.bag.ItemType;
|
||||
import net.pixvi.myr.element.bag.ItemVo;
|
||||
import net.pixvi.myr.element.cost.CostVo;
|
||||
import net.pixvi.myr.element.guide.GSub;
|
||||
import net.pixvi.myr.element.mon.EggVo;
|
||||
import net.pixvi.myr.element.mon.MonsterVo;
|
||||
import net.pixvi.myr.event.MYREvent;
|
||||
import net.pixvi.myr.net.NetItem;
|
||||
import net.pixvi.myrane.MyrAne;
|
||||
import net.pixvi.myrloader.center.MyrCenter;
|
||||
import net.pixvi.pfw.utils.ArrayUtil;
|
||||
import net.pixvi.pfw.utils.Paster;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
import net.pixvi.pfw.utils.json.Json;
|
||||
|
||||
public class BagCenter
|
||||
{
|
||||
|
||||
public var nearstUseMethod:int = 0;
|
||||
|
||||
public var nearstGetMethod:int = 0;
|
||||
|
||||
private var sell_para:Object;
|
||||
|
||||
private var useItem_para:Object;
|
||||
|
||||
private var onUseItemComplete:Function;
|
||||
|
||||
private var onGiftCodeComplete:Function;
|
||||
|
||||
public function BagCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getName(type:int) : String
|
||||
{
|
||||
return Table.item_info[type].name;
|
||||
}
|
||||
|
||||
public static function getIns() : BagCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(BagCenter) as BagCenter;
|
||||
}
|
||||
|
||||
public static function eggSpeedItemNum() : int
|
||||
{
|
||||
return getIns().getNum(GameMath.speedItemId);
|
||||
}
|
||||
|
||||
public static function alchemySpeedItemNum() : int
|
||||
{
|
||||
return getIns().getNum(GameMath.alchemySpeedItemId);
|
||||
}
|
||||
|
||||
public static function getItemByItemData(itemData:Object) : ItemVo
|
||||
{
|
||||
var item:ItemVo = null;
|
||||
var eq:EquipVo = null;
|
||||
switch(ItemVo.getItemType(itemData.typeId))
|
||||
{
|
||||
case ItemType.TYPE_EGG:
|
||||
item = new EggVo();
|
||||
break;
|
||||
case ItemType.TYPE_EQUIP:
|
||||
item = new EquipVo();
|
||||
eq = item as EquipVo;
|
||||
eq.isUsed = itemData.isUsed > 0;
|
||||
if(itemData.equipParams == null || itemData.itemClass != 3)
|
||||
{
|
||||
itemData.equipPara = {
|
||||
"apCostSave":0,
|
||||
"atk":0,
|
||||
"atkPoi":0,
|
||||
"atkPoiDmg":0,
|
||||
"atkSpd":0,
|
||||
"atkStun":0,
|
||||
"atkVim":0,
|
||||
"crit":0,
|
||||
"deadBoom":0,
|
||||
"def":0,
|
||||
"defStun":0,
|
||||
"dex":0,
|
||||
"hp":0,
|
||||
"moonHeal":0,
|
||||
"selfCure":0,
|
||||
"skillCooldown":0,
|
||||
"sunFire":0,
|
||||
"thorns":0
|
||||
};
|
||||
Alert.showMsg(Paster.font("equip error:" + itemData.id + ",pls contact customer service to fix。",null,14,true));
|
||||
}
|
||||
else
|
||||
{
|
||||
itemData.equipPara = Json.decode(itemData.equipParams);
|
||||
}
|
||||
eq.atk.val = itemData.equipPara.atk;
|
||||
eq.def.val = itemData.equipPara.def;
|
||||
eq.hp.val = itemData.equipPara.hp;
|
||||
eq.dex.val = itemData.equipPara.dex;
|
||||
eq.crit.val = itemData.equipPara.crit;
|
||||
eq.atkSpd.val = itemData.equipPara.atkSpd;
|
||||
eq.atkVim.val = itemData.equipPara.atkVim;
|
||||
eq.selfCure.val = itemData.equipPara.selfCure;
|
||||
eq.deadBoom.val = itemData.equipPara.deadBoom;
|
||||
eq.atkStun.val = itemData.equipPara.atkStun;
|
||||
eq.atkStunTime.val = 2;
|
||||
eq.atkStunType = Table.item_info[itemData.typeId].atkStunType;
|
||||
eq.defStun.val = itemData.equipPara.defStun;
|
||||
eq.defStunTime.val = 2;
|
||||
eq.defStunType = Table.item_info[itemData.typeId].defStunType;
|
||||
eq.atkPoi.val = itemData.equipPara.atkPoi;
|
||||
eq.atkPoiDmg.val = itemData.equipPara.atkPoiDmg;
|
||||
eq.atkPoiType = itemData.equipPara.atkPoiType;
|
||||
eq.apCostSave.val = itemData.equipPara.apCostSave;
|
||||
eq.skillCooldown.val = itemData.equipPara.skillCooldown;
|
||||
eq.sunFire.val = itemData.equipPara.sunFire;
|
||||
eq.moonHeal.val = itemData.equipPara.moonHeal;
|
||||
eq.thorns.val = itemData.equipPara.thorns;
|
||||
break;
|
||||
default:
|
||||
item = new ItemVo();
|
||||
}
|
||||
item.id = itemData.id;
|
||||
item.type = itemData.typeId;
|
||||
item.num = itemData.num;
|
||||
return item;
|
||||
}
|
||||
|
||||
public function subNum(itemId:Number, num:int, show:Boolean = false, keyword:String = "") : ItemVo
|
||||
{
|
||||
var str:String = null;
|
||||
if(keyword == null || keyword == "")
|
||||
{
|
||||
keyword = lang("消耗了 {0} 个 {1}");
|
||||
}
|
||||
var itemvo:ItemVo = getById(itemId);
|
||||
itemvo.num -= num;
|
||||
if(show)
|
||||
{
|
||||
str = lang(keyword,CP.item(num.toString()),CP.item(itemvo.name));
|
||||
Alert.showMsg(str);
|
||||
}
|
||||
if(itemvo.num == 0)
|
||||
{
|
||||
removeItem(itemId);
|
||||
}
|
||||
else if(itemvo.num < 0)
|
||||
{
|
||||
throw new Error("err less than zero");
|
||||
}
|
||||
return itemvo;
|
||||
}
|
||||
|
||||
public function subNumByType(itemTypeId:int, num:int, show:Boolean = false, keyword:String = "", sendEvent:Boolean = false) : ItemVo
|
||||
{
|
||||
var vo:ItemVo = subNum(getByType(itemTypeId).id,num,show,keyword);
|
||||
if(sendEvent && vo != null)
|
||||
{
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.ITEM_NUM_CHANGE,vo));
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
public function removeItem(itemid:Number) : void
|
||||
{
|
||||
ArrayUtil.removeByValue(Master.bag.items,"id",itemid);
|
||||
}
|
||||
|
||||
public function checkNeed(needs:Array, money:int = 0, ke:int = 0) : Boolean
|
||||
{
|
||||
if(Master.money < money || Master.ke < ke)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for each(var o:Object in needs)
|
||||
{
|
||||
if(getNum(o.type) < o.num)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function subLocalCost(cost:CostVo, show:Boolean = false, num:int = 1, sendEvent:Boolean = false) : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var itemdata:Object = null;
|
||||
if(cost.ke > 0)
|
||||
{
|
||||
MasterCenter.getIns().addKe(-cost.ke * num,show);
|
||||
}
|
||||
if(cost.money > 0)
|
||||
{
|
||||
MasterCenter.getIns().addMoney(-cost.money * num,show);
|
||||
}
|
||||
if(cost.ti > 0)
|
||||
{
|
||||
MasterCenter.getIns().addTi(-cost.ti * num,show);
|
||||
}
|
||||
if(cost.items.length > 0)
|
||||
{
|
||||
for(i = 0; i < cost.items.length; )
|
||||
{
|
||||
itemdata = cost.items[i];
|
||||
subNumByType(itemdata.typeId,itemdata.num * num,show,"",sendEvent);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function checkCost(cost:CostVo, exceptEquipOn:Boolean = false, exceptTiKeMoney:Boolean = false) : Boolean
|
||||
{
|
||||
var i:int = 0;
|
||||
var needi:Object = null;
|
||||
var hasnum:int = 0;
|
||||
if(!exceptTiKeMoney && (Master.ke < cost.ke || Master.money < cost.money || Master.ti < cost.ti))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
i = 0;
|
||||
while(i < cost.items.length)
|
||||
{
|
||||
needi = cost.items[i];
|
||||
hasnum = BagCenter.getIns().getNum(needi.typeId,exceptEquipOn);
|
||||
if(hasnum < needi.num)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function addItem(itemvo:ItemVo) : void
|
||||
{
|
||||
var newItemVo:EggVo = null;
|
||||
var oldvo:ItemVo = getById(itemvo.id);
|
||||
if(oldvo == null)
|
||||
{
|
||||
if(itemvo.itemType == ItemType.TYPE_EGG)
|
||||
{
|
||||
newItemVo = new EggVo();
|
||||
newItemVo.id = itemvo.id;
|
||||
newItemVo.num = itemvo.num;
|
||||
newItemVo.type = itemvo.type;
|
||||
itemvo = newItemVo;
|
||||
}
|
||||
Master.bag.items.push(itemvo);
|
||||
if(itemvo.itemType == ItemType.TYPE_EQUIP)
|
||||
{
|
||||
if(Master.history.equipLib.indexOf(itemvo.type.toString()) == -1)
|
||||
{
|
||||
Master.history.equipLib.push(itemvo.type.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
oldvo.num += itemvo.num;
|
||||
}
|
||||
TaskCenter.getIns().activityItemNum(itemvo.type);
|
||||
}
|
||||
|
||||
public function addItems(arr:Array) : void
|
||||
{
|
||||
var i:int = 0;
|
||||
for(i = 0; i < arr.length; )
|
||||
{
|
||||
addItem(arr[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
public function isSingleItem(type:int) : Boolean
|
||||
{
|
||||
return Table.item_info[type].maxNum == 1;
|
||||
}
|
||||
|
||||
public function isEquipItem(type:int) : Boolean
|
||||
{
|
||||
return Table.item_info[type].itemType == ItemType.TYPE_EQUIP;
|
||||
}
|
||||
|
||||
public function getNum(type:int, exceptEquipOn:Boolean = false) : int
|
||||
{
|
||||
var j:int = 0;
|
||||
var eq:EquipVo = null;
|
||||
var i:int = 0;
|
||||
var num:int = 0;
|
||||
var arr:Array = getAllItemvo(type);
|
||||
if(arr.length > 0 && exceptEquipOn && arr[0] is EquipVo)
|
||||
{
|
||||
for(j = 0; j < arr.length; )
|
||||
{
|
||||
eq = arr[j] as EquipVo;
|
||||
if(!eq.isUsed)
|
||||
{
|
||||
num++;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
i = 0;
|
||||
while(i < arr.length)
|
||||
{
|
||||
num += arr[i].num;
|
||||
i++;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
public function getAllItemvo(type:int) : Array
|
||||
{
|
||||
var i:int = 0;
|
||||
var a:Array = [];
|
||||
var len:int = int(Master.bag.items.length);
|
||||
for(i = 0; i < len; )
|
||||
{
|
||||
if((Master.bag.items[i] as ItemVo).type == type)
|
||||
{
|
||||
a.push(Master.bag.items[i]);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
public function getIdsByType(type:int, num:int) : Array
|
||||
{
|
||||
var ids:Array = [];
|
||||
var hasNum:int = 0;
|
||||
var items:Array = getAllItemvo(type);
|
||||
for each(var item:ItemVo in items)
|
||||
{
|
||||
if(hasNum >= num)
|
||||
{
|
||||
break;
|
||||
}
|
||||
ids.push(item.id);
|
||||
hasNum += item.num;
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
public function getById(id:Number) : ItemVo
|
||||
{
|
||||
var i:int = 0;
|
||||
for(i = 0; i < Master.bag.items.length; )
|
||||
{
|
||||
if(Master.bag.items[i].id == id)
|
||||
{
|
||||
return Master.bag.items[i];
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getByType(type:int) : ItemVo
|
||||
{
|
||||
var i:int = 0;
|
||||
for(i = 0; i < Master.bag.items.length; )
|
||||
{
|
||||
if(Master.bag.items[i].type == type)
|
||||
{
|
||||
return Master.bag.items[i];
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function sell(itemId:Number, num:int = 1, show:Boolean = false) : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var mon:MonsterVo = null;
|
||||
var sellitem:ItemVo = getById(itemId);
|
||||
if(num < 0 || num > 10000)
|
||||
{
|
||||
Alert.showMsg("error number.");
|
||||
return;
|
||||
}
|
||||
if(sellitem.itemType == ItemType.TYPE_EQUIP)
|
||||
{
|
||||
if((sellitem as EquipVo).isUsed)
|
||||
{
|
||||
Alert.showMsg(lang("装备【{0}】正在使用中。").replace("{0}",sellitem.name));
|
||||
return;
|
||||
}
|
||||
i = 0;
|
||||
while(i < Master.monsters.length)
|
||||
{
|
||||
mon = Master.monsters[i];
|
||||
if(mon.equip1 == sellitem.id || mon.equip2 == sellitem.id || mon.equip3 == sellitem.id || mon.equip4 == sellitem.id || mon.equip5 == sellitem.id)
|
||||
{
|
||||
Alert.yes("sell item error","equip status:" + sellitem["isUsed"] + ",conflict:m" + mon.id + ",pls contact customer service。");
|
||||
return;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
sell_para = {
|
||||
"itemId":itemId,
|
||||
"num":num,
|
||||
"show":show
|
||||
};
|
||||
NetItem.getIns().sellItem(itemId,num,sellHandler);
|
||||
}
|
||||
|
||||
private function sellHandler(money:int) : void
|
||||
{
|
||||
var item:ItemVo = getById(sell_para.itemId);
|
||||
item.num -= sell_para.num;
|
||||
if(item.num == 0)
|
||||
{
|
||||
Master.bag.removeItem(sell_para.itemId);
|
||||
}
|
||||
MasterCenter.getIns().addMoney(money,sell_para.show);
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.ITEM_NUM_CHANGE,item));
|
||||
sell_para = null;
|
||||
}
|
||||
|
||||
public function subLocalNeed(arr:Array, show:Boolean = false) : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var o:Object = null;
|
||||
for(i = 0; i < arr.length; )
|
||||
{
|
||||
o = arr[i];
|
||||
subNumByType(o.type,o.num,show);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
public function useItem(id:Number, num:int, onComplete:Function) : void
|
||||
{
|
||||
onUseItemComplete = onComplete;
|
||||
useItem_para = {
|
||||
"id":id,
|
||||
"num":num
|
||||
};
|
||||
var item:ItemVo = getById(id);
|
||||
NetItem.getIns().useItem(id,num,useItemHandler);
|
||||
}
|
||||
|
||||
private function useItemHandler(rewardData:Object, param:Object) : void
|
||||
{
|
||||
var vipstr:String = null;
|
||||
var item:ItemVo = subNum(useItem_para.id,useItem_para.num);
|
||||
switch(item.para.action)
|
||||
{
|
||||
case "vipCard":
|
||||
Master.vipTime = param.vipTime;
|
||||
vipstr = lang("获得了{0}天的【特别驯养师】资格!剩余天数:{1}",item.para.day * useItem_para.num,MasterCenter.getIns().getVipDay());
|
||||
Alert.yes(lang("恭喜!"),vipstr);
|
||||
if(!GuideCenter.getIns().checkFin(GSub.ACHI_VIP))
|
||||
{
|
||||
GuideCenter.getIns().fin(GSub.ACHI_VIP);
|
||||
AchiCenter.getIns().autoCheck(AchiType.NONE,true);
|
||||
if(MyrCenter.channel == "XDG")
|
||||
{
|
||||
MyrAne.track("monthlycard");
|
||||
}
|
||||
}
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.VIP_STATUS_CHANGE));
|
||||
break;
|
||||
case "getAvatar":
|
||||
if(Master.avatars != null)
|
||||
{
|
||||
Master.avatars.push(item.para.avatarType);
|
||||
}
|
||||
if(Master.newAvatars == null)
|
||||
{
|
||||
Master.newAvatars = [];
|
||||
}
|
||||
Master.newAvatars.push(item.para.avatarType);
|
||||
Alert.showMsg(lang("解锁了新头像") + "【" + Table.avatar_info[item.para.avatarType].des + "】");
|
||||
break;
|
||||
case "getSkin":
|
||||
Master.history.unlockSkins.push(int(item.para.skinType));
|
||||
Alert.showMsg(lang("解锁了魔物时装") + "【" + Table.skin_info[item.para.skinType].name + "】");
|
||||
break;
|
||||
default:
|
||||
RewardCenter.getIns().getRewardByData(rewardData,true,"panel");
|
||||
}
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.ITEM_NUM_CHANGE,item));
|
||||
useItem_para = null;
|
||||
if(onUseItemComplete != null)
|
||||
{
|
||||
onUseItemComplete();
|
||||
onUseItemComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function resetItemUsingNum() : void
|
||||
{
|
||||
var j:int = 0;
|
||||
var len:int = int(Master.bag.items.length);
|
||||
for(j = 0; j < len; )
|
||||
{
|
||||
Master.bag.items[j].usingNum = 0;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
public function giftCode(giftCode:String, onComplete:Function) : void
|
||||
{
|
||||
onGiftCodeComplete = onComplete;
|
||||
NetItem.getIns().giftCode(giftCode,giftCodeHandler);
|
||||
}
|
||||
|
||||
private function giftCodeHandler(rewardData:Object, resCode:int, resMsg:String) : void
|
||||
{
|
||||
if(resCode != 0)
|
||||
{
|
||||
Alert.yes("giftcode失效",resMsg);
|
||||
return;
|
||||
}
|
||||
RewardCenter.getIns().getRewardByData(rewardData,true,"panel",null);
|
||||
if(onGiftCodeComplete != null)
|
||||
{
|
||||
onGiftCodeComplete();
|
||||
onGiftCodeComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function equipTypeByTypes(valueName:String, type:String, typeIds:Array) : int
|
||||
{
|
||||
var equip:EquipVo = null;
|
||||
var i:int = 0;
|
||||
var num:int = 0;
|
||||
for(i = 0; i < typeIds.length; )
|
||||
{
|
||||
equip = new EquipVo();
|
||||
equip.type = typeIds[i];
|
||||
equip.buildAuto();
|
||||
if(equip != null)
|
||||
{
|
||||
if(equip[valueName] != null && equip[valueName].val > 0)
|
||||
{
|
||||
return equip[type];
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function getAllSkinItem() : Array
|
||||
{
|
||||
var itemIds:Array = [];
|
||||
if(Table.item_info == null || Master.history == null || Master.history.unlockSkins == null)
|
||||
{
|
||||
return itemIds;
|
||||
}
|
||||
for each(var itemData:Object in Table.item_info)
|
||||
{
|
||||
if(!(itemData == null || itemData.para == null || itemData.para.action != "getSkin"))
|
||||
{
|
||||
if(Master.history.unlockSkins.indexOf(int(itemData.para.skinType)) != -1)
|
||||
{
|
||||
itemIds.push(itemData.type.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
itemIds.sort(sortBySkinLevel);
|
||||
return itemIds;
|
||||
}
|
||||
|
||||
private function sortBySkinLevel(a:Object, b:Object) : int
|
||||
{
|
||||
var la:int = getSkinLevelByItem(int(a));
|
||||
var lb:int = getSkinLevelByItem(int(b));
|
||||
if(la != lb)
|
||||
{
|
||||
return lb - la;
|
||||
}
|
||||
return int(a) - int(b);
|
||||
}
|
||||
|
||||
private function getSkinLevelByItem(type:int) : int
|
||||
{
|
||||
var item:Object = Table.item_info[type];
|
||||
if(item == null || item.para == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
var skin:Object = Table.skin_info[item.para.skinType.toString()];
|
||||
if(skin == null || skin.level == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return int(skin.level);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,223 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.myr.GameMath;
|
||||
import net.pixvi.myr.battle.BattleModeType;
|
||||
import net.pixvi.myr.battle.view.BattleMon;
|
||||
import net.pixvi.myr.element.bag.EquipVo;
|
||||
import net.pixvi.myr.element.battle.BattleMonVo;
|
||||
import net.pixvi.myr.element.battle.BattlePosition;
|
||||
import net.pixvi.myr.element.battle.BattleTeamVo;
|
||||
import net.pixvi.myr.element.battle.BattleVo;
|
||||
import net.pixvi.myr.element.boss.BossVo;
|
||||
import net.pixvi.myr.element.mon.MonsterVo;
|
||||
import net.pixvi.myr.element.pve.PveAreaInfoVo;
|
||||
import net.pixvi.myr.element.pve.PveCharaDataVo;
|
||||
import net.pixvi.myr.element.reward.RewardVo;
|
||||
import net.pixvi.myr.panel.battle.BattlePanel;
|
||||
import net.pixvi.pfw.utils.Random;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class BattleCenter extends Singleton
|
||||
{
|
||||
|
||||
public function BattleCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : BattleCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(BattleCenter) as BattleCenter;
|
||||
}
|
||||
|
||||
public function startBattle(battlePosition:BattlePosition, battleObj:Object, rewardObj:Object, onComplete:Function, onBattleOver:Function = null) : void
|
||||
{
|
||||
SoundCenter.getIns().bgmStop();
|
||||
var battle:BattleVo = new BattleVo();
|
||||
battle.buildByObject(battleObj);
|
||||
battle.teams[0].team = 2;
|
||||
var reward:RewardVo = new RewardVo();
|
||||
reward.setByObject(rewardObj);
|
||||
battle.reward = reward;
|
||||
var myteam:BattleTeamVo = TeamCenter.getIns().getBattleTeamVo(Master.curBattleTeam);
|
||||
if(battle.hideTeamMon)
|
||||
{
|
||||
myteam.mons = [];
|
||||
}
|
||||
myteam.team = 1;
|
||||
battle.teams.push(myteam);
|
||||
battle.teamDic["1"] = myteam;
|
||||
var p:BattlePanel = BattlePanel.getIns();
|
||||
p.battlePosition = battlePosition;
|
||||
p.onComplete = onComplete;
|
||||
p.onBattleShowResult = onBattleOver;
|
||||
p.battle = battle;
|
||||
p.startBuild();
|
||||
PopCenter.POP(p);
|
||||
}
|
||||
|
||||
public function startPveBattle(area:PveAreaInfoVo, enemyPveData:PveCharaDataVo, onComplete:Function, onBattleOver:Function = null) : void
|
||||
{
|
||||
SoundCenter.getIns().bgmStop();
|
||||
var battleData:Object = Random.element(Table.pve_info.areaBattle[area.pveAreaType]);
|
||||
battleData.teams = [];
|
||||
battleData.teams.push(PveCenter.getIns().getPveBattleTeamVo(area,enemyPveData));
|
||||
var battle:BattleVo = new BattleVo();
|
||||
battle.battleMode = BattleModeType.PVE;
|
||||
battle.buildByObject(battleData);
|
||||
var myteam:BattleTeamVo = TeamCenter.getIns().getBattleTeamVo(area.pveAreaType);
|
||||
myteam.numMax = area.getNumMax(myteam.numMax);
|
||||
if(battle.hideTeamMon)
|
||||
{
|
||||
myteam.mons = [];
|
||||
}
|
||||
myteam.team = 1;
|
||||
battle.teams.push(myteam);
|
||||
battle.teamDic["1"] = myteam;
|
||||
battle.initPve();
|
||||
var p:BattlePanel = BattlePanel.getIns();
|
||||
p.onComplete = onComplete;
|
||||
p.onBattleShowResult = onBattleOver;
|
||||
p.battle = battle;
|
||||
p.battleMode = BattleModeType.PVE;
|
||||
p.startBuild();
|
||||
PopCenter.POP(p);
|
||||
}
|
||||
|
||||
public function startBossBattle(bossvo:BossVo, onComplete:Function, onBattleOver:Function = null) : void
|
||||
{
|
||||
SoundCenter.getIns().bgmStop();
|
||||
var battle:BattleVo = new BattleVo();
|
||||
battle.buildByObject(bossvo.getCurBattle());
|
||||
battle.teams[0].team = 2;
|
||||
battle.battleMode = BattleModeType.BOSS;
|
||||
var reward:RewardVo = new RewardVo();
|
||||
battle.reward = reward;
|
||||
var myteam:BattleTeamVo = TeamCenter.getIns().getBattleTeamVo(Master.curBattleTeam);
|
||||
if(battle.hideTeamMon)
|
||||
{
|
||||
myteam.mons = [];
|
||||
}
|
||||
myteam.team = 1;
|
||||
battle.teams.push(myteam);
|
||||
battle.teamDic["1"] = myteam;
|
||||
var p:BattlePanel = BattlePanel.getIns();
|
||||
p.onComplete = onComplete;
|
||||
p.onBattleShowResult = onBattleOver;
|
||||
p.battle = battle;
|
||||
p.battleMode = BattleModeType.BOSS;
|
||||
p.startBuild();
|
||||
PopCenter.POP(p);
|
||||
}
|
||||
|
||||
public function makeBattleMon(type:int, level:int, team:int = 2, mode:int = 2, oscale:Number = 0, name:String = "", equips:Array = null, skills:Array = null, skillsLv:Array = null) : BattleMon
|
||||
{
|
||||
if(equips == null)
|
||||
{
|
||||
equips = [];
|
||||
}
|
||||
if(Table.monster_info[type.toString()] == null)
|
||||
{
|
||||
Alert.yes("error","查找不到的魔物类型[" + type + "]");
|
||||
return null;
|
||||
}
|
||||
var m:MonsterVo = new MonsterVo(type);
|
||||
m.buildByArea();
|
||||
m.level = level;
|
||||
m.mode = mode;
|
||||
if(name != "")
|
||||
{
|
||||
m.nicName = name;
|
||||
}
|
||||
var b:BattleMonVo = new BattleMonVo();
|
||||
b.buildByMonster(m);
|
||||
b.team = team;
|
||||
b.equips = equips;
|
||||
if(skills != null && skills[0] != null)
|
||||
{
|
||||
b.skill_1 = int(skills[0]);
|
||||
}
|
||||
if(skills != null && skills[1] != null)
|
||||
{
|
||||
b.skill_2 = int(skills[1]);
|
||||
}
|
||||
if(skillsLv != null && skillsLv[0] != null)
|
||||
{
|
||||
b.skill_1_lv = int(skillsLv[0]);
|
||||
}
|
||||
if(skillsLv != null && skillsLv[0] != null)
|
||||
{
|
||||
b.skill_2_lv = int(skillsLv[0]);
|
||||
}
|
||||
var mon:BattleMon = new BattleMon();
|
||||
if(oscale != 0)
|
||||
{
|
||||
mon.oscale = oscale;
|
||||
}
|
||||
mon.init(b);
|
||||
mon.buildView();
|
||||
mon.teamVo = BattlePanel.getIns().ground.vo.teamDic[team];
|
||||
return mon;
|
||||
}
|
||||
|
||||
public function getBattleMonVoDataByNetUserMonData(mondata:Object, teamPos:int) : Object
|
||||
{
|
||||
var j:int = 0;
|
||||
var pveMonData:Object = mondata;
|
||||
var equipTypes:Array = [];
|
||||
for(j = 1; j <= 5; )
|
||||
{
|
||||
if(pveMonData["equip" + j + "TypeId"] > 0)
|
||||
{
|
||||
equipTypes.push(pveMonData["equip" + j + "TypeId"]);
|
||||
}
|
||||
j++;
|
||||
}
|
||||
var monstervo:MonsterVo = new MonsterVo(pveMonData.typeId);
|
||||
monstervo.level = pveMonData.monLevel;
|
||||
monstervo.tplevel = pveMonData.monTpLevel;
|
||||
if(pveMonData.monUpStar != null)
|
||||
{
|
||||
monstervo.upStar = pveMonData.monUpStar;
|
||||
}
|
||||
monstervo.buildSkill();
|
||||
if(pveMonData.skin != null)
|
||||
{
|
||||
monstervo.skin = pveMonData.skin;
|
||||
}
|
||||
var battleMonVo:Object = {
|
||||
"setOScale":0,
|
||||
"nicname":pveMonData.nicName,
|
||||
"level":monstervo.level,
|
||||
"type":monstervo.skinShowType,
|
||||
"mode":2,
|
||||
"teamPos":teamPos,
|
||||
"atk_dis":Table.monster_info[pveMonData.typeId].atk_dis,
|
||||
"spd_mov":Table.monster_info[pveMonData.typeId].spd_move + GameMath.addMovSpdByDex(pveMonData.dex),
|
||||
"spd_atk":Table.monster_info[pveMonData.typeId].spd_atk + GameMath.addAtkSpdByDex(pveMonData.dex),
|
||||
"autoValue":false,
|
||||
"ai":MonsterCenter.getIns().getAiByAiType(pveMonData.aiType),
|
||||
"ai_search":MonsterCenter.getIns().getAiSearchByAiType(pveMonData.aiType),
|
||||
"mid":pveMonData.monsterId,
|
||||
"skill_1":monstervo.skill_1,
|
||||
"skill_1_lv":monstervo.skill_1_lv,
|
||||
"skill_2":monstervo.skill_2,
|
||||
"skill_2_lv":monstervo.skill_2_lv,
|
||||
"ornaments":equipTypes,
|
||||
"apRecovery":true
|
||||
};
|
||||
battleMonVo.teamPos = TeamCenter.getIns().teamPos2battleTeamPos[battleMonVo.teamPos];
|
||||
for each(var equipPara:String in EquipVo.EQUIP_PARAS)
|
||||
{
|
||||
battleMonVo[equipPara] = pveMonData[equipPara];
|
||||
}
|
||||
battleMonVo.defStunType = BagCenter.getIns().equipTypeByTypes("defStun","defStunType",equipTypes);
|
||||
battleMonVo.atkStunType = BagCenter.getIns().equipTypeByTypes("atkStun","atkStunType",equipTypes);
|
||||
return battleMonVo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,263 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import flash.events.Event;
|
||||
import net.pixvi.myr.element.battle.BattleData;
|
||||
import net.pixvi.myr.element.boss.BossVo;
|
||||
import net.pixvi.myr.element.master.HistoryVo;
|
||||
import net.pixvi.myr.element.reward.RewardResultVo;
|
||||
import net.pixvi.myr.event.MYREvent;
|
||||
import net.pixvi.myr.net.NetBoss;
|
||||
import net.pixvi.myr.panel.boss.BossStagePanel;
|
||||
import net.pixvi.myr.panel.mainmenu.MainMenu;
|
||||
import net.pixvi.myr.panel.wild.WildPanel;
|
||||
import net.pixvi.pfw.utils.Caller;
|
||||
import net.pixvi.pfw.utils.Random;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class BossCenter
|
||||
{
|
||||
|
||||
public var bossData:Array = [];
|
||||
|
||||
private var onGetBossListComplete:Function;
|
||||
|
||||
private var onStartBossComplete:Function;
|
||||
|
||||
private var startBoss_bossId:String;
|
||||
|
||||
private var onEndBossComplete:Function;
|
||||
|
||||
private var getBossReward_bossId:String;
|
||||
|
||||
private var getBossReward_time:Number;
|
||||
|
||||
private var onGetBossRewardComplete:Function;
|
||||
|
||||
private var updateBossHp_bossid:String;
|
||||
|
||||
private var onupdateBossHpComplete:Function;
|
||||
|
||||
public function BossCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : BossCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(BossCenter) as BossCenter;
|
||||
}
|
||||
|
||||
public function getBossByBossId(bossId:String) : BossVo
|
||||
{
|
||||
for each(var bvo:BossVo in bossData)
|
||||
{
|
||||
if(bvo.bossId == bossId)
|
||||
{
|
||||
return bvo;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function firstGetBossList() : void
|
||||
{
|
||||
getBossList(null,false);
|
||||
}
|
||||
|
||||
public function getBossList(onComplete:Function = null, wait:Boolean = true) : void
|
||||
{
|
||||
onGetBossListComplete = onComplete;
|
||||
if(HistoryVo.voVersion == 2)
|
||||
{
|
||||
if(onGetBossListComplete != null)
|
||||
{
|
||||
onGetBossListComplete();
|
||||
onGetBossListComplete = null;
|
||||
}
|
||||
return;
|
||||
}
|
||||
NetBoss.getIns().getBossList(getBossListHandler,wait);
|
||||
}
|
||||
|
||||
private function getBossListHandler(re:Object) : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var bvo:BossVo = null;
|
||||
var j:int = 0;
|
||||
var ubo:BossVo = null;
|
||||
var bossesData:Array = re.bossInfo;
|
||||
var userData:Array = re.bossHuntInfos;
|
||||
bossData = [];
|
||||
for(i = 0; i < bossesData.length; )
|
||||
{
|
||||
bvo = new BossVo();
|
||||
bvo.setData(bossesData[i]);
|
||||
bossData.push(bvo);
|
||||
bvo.prevLocalCheckTime = TimeCenter.timestamp;
|
||||
i++;
|
||||
}
|
||||
if(userData != null)
|
||||
{
|
||||
for(j = 0; j < userData.length; )
|
||||
{
|
||||
ubo = getBossByBossId(userData[j].bossId);
|
||||
if(ubo != null)
|
||||
{
|
||||
ubo.setHuntInfo(userData[j]);
|
||||
}
|
||||
j++;
|
||||
}
|
||||
}
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.BOSS_LIST_UPDATE));
|
||||
if(onGetBossListComplete != null)
|
||||
{
|
||||
onGetBossListComplete();
|
||||
onGetBossListComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function autoCheckBossTip() : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var bossvo:BossVo = null;
|
||||
MainMenu.getIns().ui.ui_top.ui_notice.resetAllMsg("boss");
|
||||
for(i = 0; i < bossData.length; )
|
||||
{
|
||||
bossvo = bossData[i];
|
||||
MainMenu.getIns().ui.ui_top.ui_notice.insert(bossvo.notice);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
public function startBoss(bossId:String, onComplete:Function) : void
|
||||
{
|
||||
startBoss_bossId = bossId;
|
||||
onStartBossComplete = onComplete;
|
||||
NetBoss.getIns().startBoss(bossId,startBossHandler);
|
||||
}
|
||||
|
||||
private function startBossHandler(re:Object) : void
|
||||
{
|
||||
var bossvo:BossVo = getBossByBossId(startBoss_bossId);
|
||||
bossvo.currentHp = re.bossInfo.currentHp;
|
||||
bossvo.damage = re.bossHuntInfo.damage;
|
||||
bossvo.huntNumCount = re.bossHuntInfo.huntNumCount;
|
||||
bossvo.huntTime = re.bossHuntInfo.huntTime / 1000;
|
||||
BagCenter.getIns().subLocalCost(bossvo.battleCost);
|
||||
if(onStartBossComplete != null)
|
||||
{
|
||||
onStartBossComplete();
|
||||
onStartBossComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function endBoss(bossId:String, damage:int, battleData:BattleData, onComplete:Function) : void
|
||||
{
|
||||
onEndBossComplete = onComplete;
|
||||
BossStagePanel.userHit = damage;
|
||||
NetBoss.getIns().endBoss(bossId,damage,battleData,endBossHandler);
|
||||
}
|
||||
|
||||
private function endBossHandler(re:Object) : void
|
||||
{
|
||||
var reward:RewardResultVo = RewardCenter.getRewardResultVoByData(re.reward);
|
||||
var boss:BossVo = getBossByBossId(startBoss_bossId);
|
||||
boss.damage = re.param.damage;
|
||||
boss.damageCount = re.param.totalDamage;
|
||||
boss.huntNumCount = re.param.totalHuntNum;
|
||||
boss.currentHp = re.param.currentBossHp;
|
||||
if(onEndBossComplete != null)
|
||||
{
|
||||
onEndBossComplete(reward);
|
||||
onEndBossComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function getBossReward(bossId:String, onComplete:Function) : void
|
||||
{
|
||||
onGetBossRewardComplete = onComplete;
|
||||
getBossReward_bossId = bossId;
|
||||
getBossReward_time = TimeCenter.timestamp;
|
||||
NetBoss.getIns().getBossReward(bossId,getBossRewardHandler);
|
||||
}
|
||||
|
||||
private function getBossRewardHandler(re:Object) : void
|
||||
{
|
||||
var reward:RewardResultVo = RewardCenter.getRewardResultVoByData(re.reward);
|
||||
var boss:BossVo = getBossByBossId(getBossReward_bossId);
|
||||
boss.getRewardTime = getBossReward_time;
|
||||
boss.getReward = true;
|
||||
RewardCenter.getIns().getReward(reward,true,"panel",onGetBossRewardComplete);
|
||||
onGetBossRewardComplete = null;
|
||||
}
|
||||
|
||||
public function updateBossHp(bossId:String, onComplete:Function) : void
|
||||
{
|
||||
onupdateBossHpComplete = onComplete;
|
||||
updateBossHp_bossid = bossId;
|
||||
NetBoss.getIns().updateBossHp(bossId,updateBossHpHandler);
|
||||
}
|
||||
|
||||
private function updateBossHpHandler(hp:Number) : void
|
||||
{
|
||||
var bossVo:BossVo = getBossByBossId(updateBossHp_bossid);
|
||||
if(bossVo != null)
|
||||
{
|
||||
bossVo.currentHp = hp;
|
||||
}
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.BOSS_HP_UPDATE,bossVo));
|
||||
if(onupdateBossHpComplete != null)
|
||||
{
|
||||
onupdateBossHpComplete(hp);
|
||||
onupdateBossHpComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function dayPass() : void
|
||||
{
|
||||
Caller.delayCall(getBossList,100 + Random.integer(1,800),1,[dayPassHandler]);
|
||||
}
|
||||
|
||||
public function dayPassHandler(e:Event = null) : void
|
||||
{
|
||||
}
|
||||
|
||||
public function secondCheck() : void
|
||||
{
|
||||
var bossvo:BossVo = null;
|
||||
var i:int = 0;
|
||||
if(bossData == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
i = 0;
|
||||
while(i < bossData.length)
|
||||
{
|
||||
bossvo = bossData[i];
|
||||
if(!bossvo.preNoticed && bossvo.needPreNotice())
|
||||
{
|
||||
bossvo.preNoticed = true;
|
||||
MainMenu.getIns().ui.ui_top.ui_notice.insert(bossvo.preNotice,2,"boss" + bossvo.bossId);
|
||||
}
|
||||
else if(!bossvo.noticed && bossvo.needNotice())
|
||||
{
|
||||
bossvo.noticed = true;
|
||||
bossvo.status = 1;
|
||||
MainMenu.getIns().ui.ui_top.ui_notice.insert(bossvo.notice,99999,"boss" + bossvo.bossId);
|
||||
if(WildPanel.getIns().showing)
|
||||
{
|
||||
WildPanel.getIns().stageMap.updateBoss();
|
||||
}
|
||||
}
|
||||
else if(bossvo.noticed && bossvo.status == 1 && bossvo.isOver())
|
||||
{
|
||||
bossvo.status = 2;
|
||||
MainMenu.getIns().ui.ui_top.ui_notice.resetAllMsg("boss" + bossvo.bossId);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.myr.battle.view.BattleMonBuff;
|
||||
import net.pixvi.myr.element.snd.GameSound;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class BuffCenter extends Singleton
|
||||
{
|
||||
|
||||
public function BuffCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function makeIns() : BuffCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(Singleton);
|
||||
}
|
||||
|
||||
public static function getStunMovByType(buff:BattleMonBuff, stunType:int, time:int) : void
|
||||
{
|
||||
switch(stunType - 1)
|
||||
{
|
||||
case 0:
|
||||
buff.addBuffMov("mov.BuffStun","stun",time * 1000,1,24,1,0,0,true);
|
||||
break;
|
||||
case 1:
|
||||
SoundCenter.getIns().play(GameSound.effect_skill_icehit);
|
||||
buff.addBuffMov("mov.BuffIce","ice",time * 1000,1.4,20,0,0,0,true,true);
|
||||
}
|
||||
}
|
||||
|
||||
public static function getPoiMovByType(buff:BattleMonBuff, atkStunType:int, atkStunTime:int) : void
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.myr.element.city.CityVo;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class CityCenter
|
||||
{
|
||||
|
||||
public var citys:Object;
|
||||
|
||||
public function CityCenter()
|
||||
{
|
||||
super();
|
||||
citys = {};
|
||||
}
|
||||
|
||||
public static function getIns() : CityCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(CityCenter) as CityCenter;
|
||||
}
|
||||
|
||||
public function getCity(id:int) : CityVo
|
||||
{
|
||||
if(citys[id] == null)
|
||||
{
|
||||
if(Table.city_info[id] == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
citys[id] = new CityVo(id);
|
||||
}
|
||||
return citys[id];
|
||||
}
|
||||
|
||||
public function get curCity() : CityVo
|
||||
{
|
||||
var city:CityVo = getCity(Master.curCityId);
|
||||
if(city == null)
|
||||
{
|
||||
return getCity(1);
|
||||
}
|
||||
return city;
|
||||
}
|
||||
|
||||
public function unlockCity(cid:String) : void
|
||||
{
|
||||
Master.history.unlockCity[cid] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.myr.element.bag.ItemVo;
|
||||
import net.pixvi.myr.element.mon.MonsterVo;
|
||||
import net.pixvi.myr.element.task.TaskStatusType;
|
||||
import net.pixvi.myr.element.task.TaskType;
|
||||
import net.pixvi.myr.element.task.TaskVo;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class DiaryCenter extends Singleton
|
||||
{
|
||||
|
||||
public function DiaryCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : DiaryCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(DiaryCenter) as DiaryCenter;
|
||||
}
|
||||
|
||||
public function autoCheckPassStory() : void
|
||||
{
|
||||
var taskData:Object = null;
|
||||
var i:int = 0;
|
||||
var stepData:Object = null;
|
||||
var j:int = 0;
|
||||
var stepData2:Object = null;
|
||||
for(var taskid:String in Master.history.passTask)
|
||||
{
|
||||
taskData = Table.task_info[taskid];
|
||||
if(taskData == null)
|
||||
{
|
||||
Alert.showMsg("can\'t find task:" + taskid);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(taskData.startStep.npc != "" && taskData.startStep.story != "")
|
||||
{
|
||||
Master.history.passStory[taskData.startStep.story] = true;
|
||||
}
|
||||
for(i = 0; i < taskData.steps.length; )
|
||||
{
|
||||
stepData = taskData.steps[i];
|
||||
Master.history.passStory[stepData.story] = true;
|
||||
Master.history.passStory[stepData.afterStory] = true;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
for each(var t:TaskVo in Master.tasks)
|
||||
{
|
||||
if(t.recieved)
|
||||
{
|
||||
if(t.table().startStep.npc != "" && t.table().startStep.story != "")
|
||||
{
|
||||
Master.history.passStory[taskData.startStep.story] = true;
|
||||
}
|
||||
for(j = 0; j < t.steps.length; )
|
||||
{
|
||||
if(j < t.step)
|
||||
{
|
||||
stepData2 = t.steps[j];
|
||||
Master.history.passStory[stepData2.story] = true;
|
||||
Master.history.passStory[stepData2.afterStory] = true;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
for each(var bindStory:Object in Table.diary_info.storyBindTask)
|
||||
{
|
||||
if(Master.history.passTask[bindStory.task])
|
||||
{
|
||||
Master.history.passStory[bindStory.story] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getTaskAllStory(taskTypeId:String) : Array
|
||||
{
|
||||
var i:int = 0;
|
||||
var stepData:Object = null;
|
||||
var para:Object = null;
|
||||
var monTypeId:String = null;
|
||||
var mon:MonsterVo = null;
|
||||
var j:int = 0;
|
||||
var arr:Array = [];
|
||||
var id:int = 1;
|
||||
var taskData:Object = Table.task_info[taskTypeId];
|
||||
if(taskData.startStep.story != "")
|
||||
{
|
||||
Master.history.passStory[taskData.startStep.story] = true;
|
||||
arr.push({
|
||||
"story":taskData.startStep.story,
|
||||
"para":{}
|
||||
});
|
||||
id++;
|
||||
}
|
||||
for(i = 0; i < taskData.steps.length; )
|
||||
{
|
||||
stepData = taskData.steps[i];
|
||||
para = {};
|
||||
if(stepData.statusType == TaskStatusType.GET_ITEM)
|
||||
{
|
||||
para.itemNum = stepData.statusValue.num;
|
||||
para.itemName = ItemVo.getName(stepData.statusValue.type);
|
||||
}
|
||||
if(stepData.story != "")
|
||||
{
|
||||
Master.history.passStory[stepData.story] = true;
|
||||
arr.push({
|
||||
"story":stepData.story,
|
||||
"para":para
|
||||
});
|
||||
id++;
|
||||
}
|
||||
if(stepData.afterStory != "")
|
||||
{
|
||||
Master.history.passStory[stepData.afterStory] = true;
|
||||
arr.push({
|
||||
"story":stepData.afterStory,
|
||||
"para":para
|
||||
});
|
||||
id++;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if(taskData.type == TaskType.ENTANGLE_TASK)
|
||||
{
|
||||
monTypeId = taskTypeId.substr(1,7);
|
||||
if(Table.setting.entangleTaskToMonTypeFix[taskTypeId] != null)
|
||||
{
|
||||
monTypeId = Table.setting.entangleTaskToMonTypeFix[taskTypeId];
|
||||
}
|
||||
mon = MonsterCenter.getIns().getEntangleMonByType(int(monTypeId));
|
||||
for(j = 0; j < arr.length; )
|
||||
{
|
||||
arr[j].para.monName = mon.name;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
public function getDiaryCg() : Array
|
||||
{
|
||||
return Table.diary_info.cgs;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import flash.display.Sprite;
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.common.system.AppLayer;
|
||||
import net.pixvi.common.utils.StageLocator;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.gamelib.utils.GameClickMovie;
|
||||
import net.pixvi.pfw.display.BitMovieClip;
|
||||
import net.pixvi.pfw.utils.Caller;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class DisplayCenter
|
||||
{
|
||||
|
||||
public var clickMovie:GameClickMovie;
|
||||
|
||||
public var connectingMovie:BitMovieClip;
|
||||
|
||||
public var connectingMovieShow:Boolean = false;
|
||||
|
||||
public var shadowMask:Sprite;
|
||||
|
||||
public function DisplayCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : DisplayCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(DisplayCenter) as DisplayCenter;
|
||||
}
|
||||
|
||||
public function startUp() : void
|
||||
{
|
||||
clickMovie = new GameClickMovie(FF.getFC("ui.ClickMov"),60);
|
||||
AppLayer.app.LAYER_MOUSE.addChild(clickMovie);
|
||||
connectingMovie = FF.getBMC("mov.ConnectingMovie");
|
||||
connectingMovie.stop();
|
||||
connectingMovie.scaleX = connectingMovie.scaleY = 0.9;
|
||||
StageLocator.setPosition(connectingMovie);
|
||||
shadowMask = PopCenter.getIns().createMaskWithNormalSet();
|
||||
shadowMask.alpha = 0;
|
||||
}
|
||||
|
||||
public function showConnecting(delay:int = 1000) : void
|
||||
{
|
||||
if(connectingMovieShow)
|
||||
{
|
||||
return;
|
||||
}
|
||||
connectingMovieShow = true;
|
||||
AppLayer.app.LAYER_AD.addChild(shadowMask);
|
||||
if(delay > 0)
|
||||
{
|
||||
Caller.delayCall(connectingShowing,delay);
|
||||
}
|
||||
else
|
||||
{
|
||||
connectingShowing();
|
||||
}
|
||||
}
|
||||
|
||||
private function connectingShowing() : void
|
||||
{
|
||||
trace("showing connectingmovie");
|
||||
if(connectingMovieShow)
|
||||
{
|
||||
AppLayer.app.LAYER_AD.addChild(connectingMovie);
|
||||
connectingMovie.play();
|
||||
connectingMovie.mouseChildren = connectingMovie.mouseEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
public function connectingComplete() : void
|
||||
{
|
||||
connectingMovieShow = false;
|
||||
if(connectingMovie.parent != null)
|
||||
{
|
||||
connectingMovie.parent.removeChild(connectingMovie);
|
||||
}
|
||||
if(shadowMask.parent != null)
|
||||
{
|
||||
shadowMask.parent.removeChild(shadowMask);
|
||||
}
|
||||
connectingMovie.stop();
|
||||
Caller.stopCall(connectingComplete);
|
||||
trace("hide connectingmovie");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.common.system.AppLayer;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.pfw.display.BitMovieClip;
|
||||
import net.pixvi.pfw.utils.Director;
|
||||
|
||||
public class EffectCenter
|
||||
{
|
||||
|
||||
public function EffectCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function open_effect(x:int, y:int, fps:int = 40, scaleX:Number = 1.5, scaleY:Number = 1.5) : void
|
||||
{
|
||||
var bmc:BitMovieClip = FF.getBMC("mov.SkillStartLevel3",40);
|
||||
bmc.x = x;
|
||||
bmc.y = y;
|
||||
bmc.scaleX = scaleX;
|
||||
bmc.scaleY = scaleY;
|
||||
AppLayer.app.LAYER_FRONT.addChild(bmc);
|
||||
Director.playOnce(bmc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.myr.element.achi.AchiType;
|
||||
import net.pixvi.myr.element.bag.ItemVo;
|
||||
import net.pixvi.myr.element.mon.MonsterVo;
|
||||
import net.pixvi.myr.event.MYREvent;
|
||||
import net.pixvi.myr.net.NetEntangle;
|
||||
import net.pixvi.pfw.event.PiEvent;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class EntangleCenter
|
||||
{
|
||||
|
||||
private var onMakeEntangleComplete:Function;
|
||||
|
||||
private var makeEntangle_mon:MonsterVo;
|
||||
|
||||
private var makeEntangle_item:ItemVo;
|
||||
|
||||
private var onEntangleLevelUpComplete:Function;
|
||||
|
||||
private var entangleLevelUp_mon:MonsterVo;
|
||||
|
||||
private var onSetEntangleSkillComplete:Function;
|
||||
|
||||
private var entangleSkill_para:Object;
|
||||
|
||||
private var onResetEntangleSkillComplete:Function;
|
||||
|
||||
private var resetEntangleSkill_mon:MonsterVo;
|
||||
|
||||
public function EntangleCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : EntangleCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(EntangleCenter) as EntangleCenter;
|
||||
}
|
||||
|
||||
public function makeEntangle(mid:Number, onComplete:Function) : void
|
||||
{
|
||||
onMakeEntangleComplete = onComplete;
|
||||
makeEntangle_mon = MonsterCenter.getIns().getMonById(mid);
|
||||
makeEntangle_item = BagCenter.getIns().getByType(Table.entangle_info.entangleItem);
|
||||
NetEntangle.getIns().makeEntangle(mid,makeEntangle_item.id,makeEntangleHandler);
|
||||
}
|
||||
|
||||
private function makeEntangleHandler(unlockTask:String) : void
|
||||
{
|
||||
TaskCenter.getIns().unlockLocalTask(unlockTask);
|
||||
makeEntangle_mon.entangle = true;
|
||||
BagCenter.getIns().subNumByType(Table.entangle_info.entangleItem,1,true);
|
||||
GlobalBroadcast.dispatchEvent(new PiEvent(MYREvent.MONSTER_INFO_CHANGE,{"mon":makeEntangle_mon}));
|
||||
makeEntangle_mon = null;
|
||||
makeEntangle_item = null;
|
||||
AchiCenter.getIns().autoCheck(AchiType.ENTANGLE);
|
||||
if(onMakeEntangleComplete != null)
|
||||
{
|
||||
onMakeEntangleComplete();
|
||||
onMakeEntangleComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function entangleLevelUp(mid:Number, onComplete:Function) : void
|
||||
{
|
||||
onEntangleLevelUpComplete = onComplete;
|
||||
entangleLevelUp_mon = MonsterCenter.getIns().getMonById(mid);
|
||||
NetEntangle.getIns().entangleLevelUp(mid,entangleLevelUpHandler);
|
||||
}
|
||||
|
||||
private function entangleLevelUpHandler(unlockTask:String, newLevel:int) : void
|
||||
{
|
||||
TaskCenter.getIns().unlockLocalTask(unlockTask);
|
||||
entangleLevelUp_mon.entangleLevel = newLevel;
|
||||
entangleLevelUp_mon = null;
|
||||
if(onEntangleLevelUpComplete != null)
|
||||
{
|
||||
onEntangleLevelUpComplete();
|
||||
onEntangleLevelUpComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function setEntangleSkill(monId:Number, skillType:String, level:int, onComplete:Function) : void
|
||||
{
|
||||
onSetEntangleSkillComplete = onComplete;
|
||||
entangleSkill_para = {
|
||||
"monId":monId,
|
||||
"skillType":skillType,
|
||||
"level":level
|
||||
};
|
||||
NetEntangle.getIns().setEntangleSkill(monId,level,skillType,setEntangleSkillHandler);
|
||||
}
|
||||
|
||||
private function setEntangleSkillHandler(globalAdd:Object, monAdd:Object) : void
|
||||
{
|
||||
var mon:MonsterVo = MonsterCenter.getIns().getMonById(entangleSkill_para.monId);
|
||||
mon.entangleSkill[entangleSkill_para.level] = entangleSkill_para.skillType;
|
||||
Master.globalAdd.update(globalAdd);
|
||||
mon.abilityAdd.update(monAdd);
|
||||
if(onSetEntangleSkillComplete != null)
|
||||
{
|
||||
onSetEntangleSkillComplete();
|
||||
onSetEntangleSkillComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function resetEntangleSkill(monId:Number, onComplete:Function) : void
|
||||
{
|
||||
onResetEntangleSkillComplete = onComplete;
|
||||
resetEntangleSkill_mon = MonsterCenter.getIns().getMonById(monId);
|
||||
var itemvo:ItemVo = BagCenter.getIns().getByType(Table.entangle_info.resetEntangleSkillItem);
|
||||
NetEntangle.getIns().resetEntangleSkill(monId,itemvo.id,resetEntangleSkillHandler);
|
||||
}
|
||||
|
||||
private function resetEntangleSkillHandler(globalAdd:Object, monAdd:Object) : void
|
||||
{
|
||||
resetEntangleSkill_mon.entangleSkill = {};
|
||||
BagCenter.getIns().subNumByType(Table.entangle_info.resetEntangleSkillItem,1,true);
|
||||
Master.globalAdd.update(globalAdd);
|
||||
resetEntangleSkill_mon.abilityAdd.update(monAdd);
|
||||
if(onResetEntangleSkillComplete != null)
|
||||
{
|
||||
onResetEntangleSkillComplete();
|
||||
onResetEntangleSkillComplete = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,304 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.common.driver.ClockDriver;
|
||||
import net.pixvi.myr.element.explore.ExploreAreaVo;
|
||||
import net.pixvi.myr.element.explore.ExploreTeamVo;
|
||||
import net.pixvi.myr.element.mon.MonsterVo;
|
||||
import net.pixvi.myr.element.reward.RewardResultVo;
|
||||
import net.pixvi.myr.event.MYREvent;
|
||||
import net.pixvi.myr.net.NetExplore;
|
||||
import net.pixvi.pfw.utils.ArrayUtil;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
import net.pixvi.pfw.utils.json.Json;
|
||||
|
||||
public class ExploreCenter extends Singleton
|
||||
{
|
||||
|
||||
private var onCancelExploreComplete:Function;
|
||||
|
||||
private var cancelExplore_teamId:int;
|
||||
|
||||
private var onAddTeamComplete:Function;
|
||||
|
||||
private var addTeam_para:Object;
|
||||
|
||||
private var onStartExploreComplete:Function;
|
||||
|
||||
private var onFinishExploreComplete:Function;
|
||||
|
||||
private var finishExplore_teamID:int;
|
||||
|
||||
public function ExploreCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : ExploreCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(ExploreCenter) as ExploreCenter;
|
||||
}
|
||||
|
||||
public static function makeTeamByData(data:Object) : ExploreTeamVo
|
||||
{
|
||||
var team:ExploreTeamVo = new ExploreTeamVo();
|
||||
team.area = data.area;
|
||||
team.id = data.id;
|
||||
if(data.rewardResult != null && data.rewardResult != "")
|
||||
{
|
||||
team.endTime = data.endTime / 1000;
|
||||
team.monsters = ArrayUtil.split(data.monsters,",");
|
||||
team.randoms = ArrayUtil.split(data.random,",",true);
|
||||
team.reward = RewardCenter.getRewardResultVoByData(Json.decode(data.rewardResult));
|
||||
team.startTime;
|
||||
}
|
||||
team.status = data.status;
|
||||
return team;
|
||||
}
|
||||
|
||||
public function hasFinishExplore() : Boolean
|
||||
{
|
||||
var i:int = 0;
|
||||
var team:ExploreTeamVo = null;
|
||||
for(i = 0; i < Master.exploreTeams.length; )
|
||||
{
|
||||
team = Master.exploreTeams[i];
|
||||
if(team.status == 1 && team.endTime < TimeCenter.timestamp)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getExploreAreas() : Array
|
||||
{
|
||||
var area:ExploreAreaVo = null;
|
||||
var arr:Array = [];
|
||||
for each(var o:Object in Table.explore_info)
|
||||
{
|
||||
if(o.mine == null)
|
||||
{
|
||||
area = new ExploreAreaVo();
|
||||
area.area = o.id;
|
||||
if(area.unlock)
|
||||
{
|
||||
arr.push(area);
|
||||
}
|
||||
}
|
||||
}
|
||||
arr.sortOn("area");
|
||||
return arr;
|
||||
}
|
||||
|
||||
public function getMineAreas(mine:String = "mine1") : Array
|
||||
{
|
||||
var area:ExploreAreaVo = null;
|
||||
var arr:Array = [];
|
||||
for each(var o:Object in Table.explore_info)
|
||||
{
|
||||
if(o.mine != null)
|
||||
{
|
||||
area = new ExploreAreaVo();
|
||||
area.area = o.id;
|
||||
if(area.unlock)
|
||||
{
|
||||
arr.push(area);
|
||||
}
|
||||
}
|
||||
}
|
||||
arr.sortOn("area");
|
||||
return arr;
|
||||
}
|
||||
|
||||
public function getAreaByTeam(team:String = "normal") : Array
|
||||
{
|
||||
var area:ExploreAreaVo = null;
|
||||
var arr:Array = [];
|
||||
for each(var o:Object in Table.explore_info)
|
||||
{
|
||||
if(o.team == team)
|
||||
{
|
||||
area = new ExploreAreaVo();
|
||||
area.area = o.id;
|
||||
if(area.unlock)
|
||||
{
|
||||
arr.push(area);
|
||||
}
|
||||
}
|
||||
}
|
||||
arr.sortOn("area",16);
|
||||
return arr;
|
||||
}
|
||||
|
||||
public function checkStage(stage:String) : ExploreAreaVo
|
||||
{
|
||||
var area:ExploreAreaVo = null;
|
||||
for each(var o:Object in Table.explore_info)
|
||||
{
|
||||
area = new ExploreAreaVo();
|
||||
area.area = o.id;
|
||||
if(area.passStage() == stage)
|
||||
{
|
||||
return area;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function cancelExplore(teamId:int, onComplete:Function) : void
|
||||
{
|
||||
onCancelExploreComplete = onComplete;
|
||||
cancelExplore_teamId = teamId;
|
||||
NetExplore.getIns().cancelExplore(teamId,cancelExploreHandler);
|
||||
}
|
||||
|
||||
private function cancelExploreHandler(re:Object) : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var mon:MonsterVo = null;
|
||||
var team:ExploreTeamVo = ExploreCenter.getIns().getTeamById(cancelExplore_teamId);
|
||||
team.status = 0;
|
||||
for(i = 0; i < team.monsters.length; )
|
||||
{
|
||||
mon = MonsterCenter.getIns().getMonById(team.monsters[i]);
|
||||
mon.inExploreTeam = false;
|
||||
i++;
|
||||
}
|
||||
if(onCancelExploreComplete != null)
|
||||
{
|
||||
onCancelExploreComplete();
|
||||
onCancelExploreComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function addTeam(onComplete:Function) : void
|
||||
{
|
||||
onAddTeamComplete = onComplete;
|
||||
addTeam_para = {};
|
||||
if(ExploreCenter.getIns().nextTable.money > 0)
|
||||
{
|
||||
addTeam_para.costNum = ExploreCenter.getIns().nextTable.money;
|
||||
addTeam_para.type = "money";
|
||||
}
|
||||
else
|
||||
{
|
||||
addTeam_para.costNum = ExploreCenter.getIns().nextTable.ke;
|
||||
addTeam_para.type = "ke";
|
||||
}
|
||||
NetExplore.getIns().addTeam(addTeamHandler);
|
||||
}
|
||||
|
||||
private function addTeamHandler(teamdata:Object) : void
|
||||
{
|
||||
var team:ExploreTeamVo = makeTeamByData(teamdata);
|
||||
Master.exploreTeams.push(team);
|
||||
if(addTeam_para.type == "money")
|
||||
{
|
||||
MasterCenter.getIns().addMoney(-addTeam_para.costNum,true);
|
||||
}
|
||||
else
|
||||
{
|
||||
MasterCenter.getIns().addKe(-addTeam_para.costNum,true);
|
||||
}
|
||||
addTeam_para = null;
|
||||
if(onAddTeamComplete != null)
|
||||
{
|
||||
onAddTeamComplete();
|
||||
onAddTeamComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function startExplore(teamID:int, monsters:Array, area:String, onComplete:Function) : void
|
||||
{
|
||||
onStartExploreComplete = onComplete;
|
||||
NetExplore.getIns().startExplore(teamID,monsters,area,startExploreHandler);
|
||||
}
|
||||
|
||||
private function startExploreHandler(teamData:Object, newTime:Number) : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var monstervo:MonsterVo = null;
|
||||
ClockDriver.getIns().timestamp = newTime;
|
||||
var team:ExploreTeamVo = getTeamById(teamData.id);
|
||||
team.endTime = teamData.endTime / 1000;
|
||||
team.reward = RewardCenter.getRewardResultVoByData(Json.decode(teamData.rewardResult));
|
||||
team.monsters = ArrayUtil.split(teamData.monsters,",",true);
|
||||
team.randoms = ArrayUtil.split(teamData.random,",",true);
|
||||
team.status = teamData.status;
|
||||
team.area = teamData.area;
|
||||
var area:ExploreAreaVo = new ExploreAreaVo();
|
||||
area.area = team.area;
|
||||
MasterCenter.getIns().addTi(-area.costTi);
|
||||
for(i = 0; i < team.monsters.length; )
|
||||
{
|
||||
monstervo = MonsterCenter.getIns().getMonById(team.monsters[i]);
|
||||
monstervo.inExploreTeam = true;
|
||||
i++;
|
||||
}
|
||||
if(onStartExploreComplete != null)
|
||||
{
|
||||
onStartExploreComplete();
|
||||
onStartExploreComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function finishExplore(teamID:int, onComplete:Function) : void
|
||||
{
|
||||
onFinishExploreComplete = onComplete;
|
||||
finishExplore_teamID = teamID;
|
||||
NetExplore.getIns().finishExplore(teamID,finishExploreHandler);
|
||||
}
|
||||
|
||||
private function finishExploreHandler(rewardData:Object, monExp:Array, unlockStage:Array) : void
|
||||
{
|
||||
var mon:MonsterVo = null;
|
||||
var reward:RewardResultVo = RewardCenter.getIns().getRewardByData(rewardData);
|
||||
for each(var o:Object in monExp)
|
||||
{
|
||||
mon = MonsterCenter.getIns().getMonById(o.monId);
|
||||
mon.exp += o.exp;
|
||||
if(mon.level != o.level)
|
||||
{
|
||||
mon.level = o.level;
|
||||
o.levelUp = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
o.levelUp = false;
|
||||
}
|
||||
mon.inExploreTeam = false;
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.MONSTER_NUM_CHANGE,{"mon":mon}));
|
||||
}
|
||||
if(unlockStage.length > 0)
|
||||
{
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.EXPLORE_STAGE_UPDATE));
|
||||
}
|
||||
StageCenter.getIns().unlockLocalStages(unlockStage,true);
|
||||
var teamvo:ExploreTeamVo = getTeamById(finishExplore_teamID);
|
||||
teamvo.status = 0;
|
||||
onFinishExploreComplete(reward,monExp);
|
||||
}
|
||||
|
||||
public function getTeamById(teamId:int) : ExploreTeamVo
|
||||
{
|
||||
var i:int = 0;
|
||||
for(i = 0; i < Master.exploreTeams.length; )
|
||||
{
|
||||
if(Master.exploreTeams[i].id == teamId)
|
||||
{
|
||||
return Master.exploreTeams[i];
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function get nextTable() : Object
|
||||
{
|
||||
return Table.game_setting.exploreTeamLevel[Master.exploreTeams.length];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.myr.element.bag.ItemVo;
|
||||
import net.pixvi.myr.element.gacha.GachaVo;
|
||||
import net.pixvi.myr.element.mon.EggVo;
|
||||
import net.pixvi.myr.net.NetGacha;
|
||||
import net.pixvi.myr.panel.reward.RewardShowPanel;
|
||||
import net.pixvi.myrane.MyrAne;
|
||||
import net.pixvi.myrloader.center.MyrCenter;
|
||||
import net.pixvi.pfw.utils.Random;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class GachaCenter extends Singleton
|
||||
{
|
||||
|
||||
private var onGachaComplete:Function;
|
||||
|
||||
private var gacha_para:Object;
|
||||
|
||||
private var onTimeEggGachaComplete:Function;
|
||||
|
||||
private var onTimeEggBuyComplete:Function;
|
||||
|
||||
private var timeEggBuy_buffid:uint;
|
||||
|
||||
public function GachaCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : GachaCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(GachaCenter) as GachaCenter;
|
||||
}
|
||||
|
||||
public function gacha(machineID:String = "", num:int = 0, useTicket:int = 0, onComplete:Function = null, traceInfo:Object = null, sliceEggs:Boolean = true) : void
|
||||
{
|
||||
onGachaComplete = onComplete;
|
||||
var cur:GachaVo = new GachaVo();
|
||||
cur.id = machineID;
|
||||
var needMoney:int = 0;
|
||||
var needKe:int = 0;
|
||||
var needTicket:int = useTicket;
|
||||
if(cur.money > 0)
|
||||
{
|
||||
needMoney = (num - useTicket) * cur.money;
|
||||
}
|
||||
else
|
||||
{
|
||||
needKe = (num - useTicket) * cur.ke;
|
||||
}
|
||||
gacha_para = {
|
||||
"sliceEggs":sliceEggs,
|
||||
"num":num,
|
||||
"useTicket":useTicket,
|
||||
"itemType":cur.item,
|
||||
"needKe":needKe,
|
||||
"needMoney":needMoney
|
||||
};
|
||||
if(MyrCenter.channel == "XDG" && !GuideCenter.getIns().checkFin("first10gacha") && cur.ke > 0 && num >= 10)
|
||||
{
|
||||
MyrAne.track("firstgacha");
|
||||
GuideCenter.getIns().fin("first10gacha");
|
||||
}
|
||||
NetGacha.getIns().gacha(machineID,num,needTicket,gachaHandler,traceInfo);
|
||||
}
|
||||
|
||||
private function gachaHandler(reEggs:Array, getMoney:int = 0, getItem:Object = null) : void
|
||||
{
|
||||
var j:int = 0;
|
||||
var egg:EggVo = null;
|
||||
var sliceEgg:EggVo = null;
|
||||
var getitemVo:ItemVo = null;
|
||||
var item:ItemVo = BagCenter.getIns().getByType(gacha_para.itemType);
|
||||
if(gacha_para.useTicket > 0)
|
||||
{
|
||||
BagCenter.getIns().subNum(item.id,gacha_para.useTicket,true);
|
||||
}
|
||||
if(gacha_para.needKe > 0)
|
||||
{
|
||||
MasterCenter.getIns().addKe(-gacha_para.needKe,true);
|
||||
}
|
||||
if(gacha_para.needMoney > 0)
|
||||
{
|
||||
MasterCenter.getIns().addMoney(-gacha_para.needMoney,true);
|
||||
}
|
||||
if(getMoney > 0)
|
||||
{
|
||||
MasterCenter.getIns().addMoney(getMoney,true);
|
||||
}
|
||||
var eggs:Array = [];
|
||||
for(j = 0; j < reEggs.length; )
|
||||
{
|
||||
egg = BagCenter.getItemByItemData(reEggs[j]) as EggVo;
|
||||
while(gacha_para.sliceEggs == true && egg.num > 1)
|
||||
{
|
||||
sliceEgg = new EggVo();
|
||||
sliceEgg.num = 1;
|
||||
sliceEgg.type = egg.type;
|
||||
sliceEgg.id = egg.id;
|
||||
egg.num--;
|
||||
eggs.push(sliceEgg);
|
||||
}
|
||||
trace(egg.num);
|
||||
eggs.push(egg);
|
||||
j++;
|
||||
}
|
||||
eggs = Random.randomArr(eggs);
|
||||
BagCenter.getIns().addItems(eggs);
|
||||
if(getItem != null)
|
||||
{
|
||||
getitemVo = new ItemVo();
|
||||
getitemVo.readObject(getItem);
|
||||
getitemVo.num = gacha_para.num;
|
||||
getitemVo.type = getItem.typeId;
|
||||
BagCenter.getIns().addItem(getitemVo);
|
||||
}
|
||||
onGachaComplete(eggs);
|
||||
}
|
||||
|
||||
public function timeEggGacha(onComplete:Function) : void
|
||||
{
|
||||
onTimeEggGachaComplete = onComplete;
|
||||
NetGacha.getIns().timeEggGacha(timeEggGachaHandler);
|
||||
}
|
||||
|
||||
public function timeEggGachaHandler(re:Object) : void
|
||||
{
|
||||
Master.history.timeEggItems.push(re.timeGacha);
|
||||
if(onTimeEggGachaComplete != null)
|
||||
{
|
||||
onTimeEggGachaComplete(re.timeGacha);
|
||||
onTimeEggGachaComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function timeEggBuy(id:uint, onComplete:Function) : void
|
||||
{
|
||||
onTimeEggBuyComplete = onComplete;
|
||||
timeEggBuy_buffid = id;
|
||||
NetGacha.getIns().timeEggBuy(id,timeEggBuyHandler);
|
||||
}
|
||||
|
||||
public function timeEggBuyHandler(re:Object) : void
|
||||
{
|
||||
var resultStr:String = null;
|
||||
var i:int = 0;
|
||||
var showEggVo:EggVo = null;
|
||||
BagCenter.getIns().subNumByType(Table.game_setting["timeEggItem"],1,true,lang("使用了{0} 个 {1}"));
|
||||
RewardCenter.getIns().getRewardByData(re.reward,false);
|
||||
for each(var o:Object in Master.history.timeEggItems)
|
||||
{
|
||||
if(o.id == timeEggBuy_buffid)
|
||||
{
|
||||
o.selected = true;
|
||||
resultStr = o.result;
|
||||
}
|
||||
}
|
||||
var monEggTypes:Array = resultStr.split(",");
|
||||
var showEggs:Array = [];
|
||||
for(i = 0; i < monEggTypes.length; )
|
||||
{
|
||||
showEggVo = new EggVo();
|
||||
showEggVo.type = monEggTypes[i];
|
||||
showEggVo.num = 1;
|
||||
showEggs.push(showEggVo);
|
||||
i++;
|
||||
}
|
||||
RewardShowPanel.show(showEggs,null,false);
|
||||
if(Boolean(onTimeEggBuyComplete))
|
||||
{
|
||||
onTimeEggBuyComplete();
|
||||
onTimeEggBuyComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function getTimeEggItemNum() : int
|
||||
{
|
||||
return BagCenter.getIns().getNum(Table.game_setting["timeEggItem"]);
|
||||
}
|
||||
|
||||
public function getTimeEggLeftGacha() : int
|
||||
{
|
||||
return Table.game_setting["timeEggNum"] - Master.history.timeEggItems.length;
|
||||
}
|
||||
|
||||
public function getSelectedTimeEggItem() : Object
|
||||
{
|
||||
for each(var o:Object in Master.history.timeEggItems)
|
||||
{
|
||||
if(o.selected == true)
|
||||
{
|
||||
return o;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import flash.events.Event;
|
||||
import flash.system.Capabilities;
|
||||
import net.gaooo.nano.center.GAoNano;
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.common.utils.PiObject;
|
||||
import net.pixvi.common.utils.mobi.MobiTools;
|
||||
import net.pixvi.myr.element.SettingVo;
|
||||
import net.pixvi.myr.element.master.MasterVo;
|
||||
import net.pixvi.myrloader.center.MyrCenter;
|
||||
import net.pixvi.pfw.utils.Saver;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class Game extends Singleton
|
||||
{
|
||||
|
||||
public var master:MasterVo;
|
||||
|
||||
public var setting:SettingVo;
|
||||
|
||||
public function Game()
|
||||
{
|
||||
super();
|
||||
if(Saver.getAuto("myrSetting") == null)
|
||||
{
|
||||
setting = new SettingVo();
|
||||
if(MobiTools.isMobi() && Capabilities.screenResolutionY / Capabilities.screenResolutionX >= 2)
|
||||
{
|
||||
setting.liuhaiMode = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setting = PiObject.readPiObj(Saver.getAuto("myrSetting")) as SettingVo;
|
||||
if(setting == null)
|
||||
{
|
||||
setting = new SettingVo();
|
||||
if(MobiTools.isMobi() && Capabilities.screenResolutionY / Capabilities.screenResolutionX >= 2)
|
||||
{
|
||||
setting.liuhaiMode = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function getIns() : Game
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(Game) as Game;
|
||||
}
|
||||
|
||||
public static function get HQ() : Boolean
|
||||
{
|
||||
return getIns().setting.quality == 3;
|
||||
}
|
||||
|
||||
public static function get LQ() : Boolean
|
||||
{
|
||||
return getIns().setting.quality == 1;
|
||||
}
|
||||
|
||||
public static function exit(e:Event = null) : void
|
||||
{
|
||||
MobiTools.getIns().exit();
|
||||
}
|
||||
|
||||
public function beforeGroundCheck() : void
|
||||
{
|
||||
MasterCenter.getIns().inJectGAoPara();
|
||||
MonsterCenter.getIns().secondHandler(false);
|
||||
MailCenter.getIns().autoCheckMailDay();
|
||||
}
|
||||
|
||||
public function saveSetting() : void
|
||||
{
|
||||
Saver.saveAuto("myrSetting",setting.toObject());
|
||||
}
|
||||
|
||||
public function initSetting() : void
|
||||
{
|
||||
if(!setting.openBgm)
|
||||
{
|
||||
SoundCenter.getIns().setBgmEnable(false);
|
||||
GAoNano.getIns().volume = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
SoundCenter.getIns().bgmVolume = setting.globalVolume;
|
||||
GAoNano.getIns().volume = setting.globalVolume;
|
||||
}
|
||||
if(!setting.openEffect)
|
||||
{
|
||||
SoundCenter.getIns().setEffectEnable(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
SoundCenter.getIns().effectVolume = setting.globalVolume;
|
||||
}
|
||||
}
|
||||
|
||||
public function getLiuHaiAdd() : int
|
||||
{
|
||||
if(MyrCenter.platform == "IOS")
|
||||
{
|
||||
return 75;
|
||||
}
|
||||
return 50;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,300 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import flash.events.Event;
|
||||
import flash.events.StatusEvent;
|
||||
import flash.text.TextField;
|
||||
import flash.utils.Timer;
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.common.driver.SecondDriver;
|
||||
import net.pixvi.common.driver.StageDriver;
|
||||
import net.pixvi.common.driver.TimerDriver;
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.common.utils.mobi.MobiTools;
|
||||
import net.pixvi.myr.GameMath;
|
||||
import net.pixvi.myr.event.MYREvent;
|
||||
import net.pixvi.myr.net.NetMaster;
|
||||
import net.pixvi.myr.panel.login.PressStartPanel;
|
||||
import net.pixvi.myr.util.MyrCalendar;
|
||||
import net.pixvi.myrloader.center.MyrCenter;
|
||||
import net.pixvi.pfw.driver.EnterFrameDriver;
|
||||
import net.pixvi.pfw.utils.Calendar;
|
||||
import net.pixvi.pfw.utils.Random;
|
||||
import net.pixvi.pfw.utils.Saver;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
import net.pixvi.pse.file.FileTools;
|
||||
import net.pixvi.psg.driver.GuideDriver;
|
||||
|
||||
public class GameCenter extends Singleton
|
||||
{
|
||||
|
||||
public static var tf:TextField;
|
||||
|
||||
private var heartbeatTimer:Timer;
|
||||
|
||||
private var gameStart:Boolean = false;
|
||||
|
||||
public var inGameDay:Number;
|
||||
|
||||
public var safeModeAge:int = 0;
|
||||
|
||||
public var endcheck:Boolean = false;
|
||||
|
||||
public var checkNum:int = 0;
|
||||
|
||||
public function GameCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function traceMode(txt:String, err:Boolean = false) : void
|
||||
{
|
||||
}
|
||||
|
||||
public static function getIns() : GameCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(GameCenter) as GameCenter;
|
||||
}
|
||||
|
||||
public function startGame() : void
|
||||
{
|
||||
heartbeatTimer = new Timer(240000);
|
||||
gameStart = true;
|
||||
TimerDriver.getInstance().regist(NetMaster.getIns().heartBeating,heartbeatTimer,true);
|
||||
SecondDriver.getIns().regist(checkDayChange);
|
||||
SecondDriver.getIns().regist(BossCenter.getIns().secondCheck);
|
||||
NetMaster.getIns().heartBeating();
|
||||
GuideDriver.getIns().traceMode = GameMath.ModeTrace;
|
||||
}
|
||||
|
||||
public function userAuth(e:Object) : void
|
||||
{
|
||||
var idcard:String = null;
|
||||
if(e is Event)
|
||||
{
|
||||
if(e is StatusEvent)
|
||||
{
|
||||
idcard = (e as StatusEvent).code;
|
||||
}
|
||||
else
|
||||
{
|
||||
idcard = e.data;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
idcard = e.toString();
|
||||
}
|
||||
var year:int = int(idcard.substr(6,4));
|
||||
var month:int = int(idcard.substr(10,2)) - 1;
|
||||
var day:int = int(idcard.substr(12,2));
|
||||
var date:Date = new Date(year,month,day);
|
||||
var birthday:int = MyrCalendar.getDayNumber(date.time);
|
||||
var curday:int = MyrCalendar.getDayNumber(new Date().time);
|
||||
var age:int = (curday - birthday) / 365;
|
||||
if(idcard.length < 16)
|
||||
{
|
||||
age = 100;
|
||||
}
|
||||
safeModeAge = age;
|
||||
if(GameMath.ModeTrace)
|
||||
{
|
||||
Alert.yes("实名","实名认证年龄:" + age);
|
||||
}
|
||||
if(age < 18 && MyrCenter.channel == "DYD")
|
||||
{
|
||||
Alert.yes("实名认证完成","请重新进入游戏并登录。",MobiTools.getIns().exit);
|
||||
}
|
||||
}
|
||||
|
||||
public function returnLogin() : void
|
||||
{
|
||||
while(PopCenter.getIns().topPanel != null)
|
||||
{
|
||||
PopCenter.getIns().topPanel.showOut();
|
||||
}
|
||||
GameCenter.getIns().resetGame();
|
||||
PressStartPanel.getIns().reload();
|
||||
PressStartPanel.getIns().popIn();
|
||||
}
|
||||
|
||||
public function clickSafeTime(id:String, add:Boolean = false) : void
|
||||
{
|
||||
var prevClick:Number = NaN;
|
||||
var countTime:int = 0;
|
||||
var prevDay:int = 0;
|
||||
var curDay:int = 0;
|
||||
if(endcheck)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(!GameMath.ModeTrace && GameMath.ModeRealName && Table.setting.safeModeAge != null && safeModeAge < Table.setting.safeModeAge && Table.setting.safeModeTime != null && Table.setting.safeModeTime > 0)
|
||||
{
|
||||
prevClick = 0;
|
||||
if(Saver.getAuto(id + "clickTime") != null)
|
||||
{
|
||||
prevClick = Number(Saver.getAuto(id + "clickTime"));
|
||||
}
|
||||
if(MyrCalendar.getShowDate().hours > Table.setting.safeModeTimeClose || MyrCalendar.getShowDate().hours < Table.setting.safeModeTimeOpen)
|
||||
{
|
||||
Alert.yes("防沉迷系统","今日游戏时间已结束,还是休息一下吧!",MobiTools.getIns().exit);
|
||||
return;
|
||||
}
|
||||
countTime = 0;
|
||||
if(Saver.getAuto(id + "countTime") != null)
|
||||
{
|
||||
countTime = Number(Saver.getAuto(id + "countTime"));
|
||||
}
|
||||
prevDay = MyrCalendar.getDayNumber(prevClick * 1000);
|
||||
curDay = MyrCalendar.getDayNumber();
|
||||
if(prevDay != curDay && !AccountCenter.getIns().isVisitor)
|
||||
{
|
||||
Saver.saveAuto(id + "countTime",0);
|
||||
countTime = 0;
|
||||
if(GameMath.ModeTrace)
|
||||
{
|
||||
Alert.showMsg("防沉迷调试:跨天清零");
|
||||
}
|
||||
}
|
||||
if(GameMath.ModeTrace)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(countTime > Table.setting.safeModeTime)
|
||||
{
|
||||
endcheck = true;
|
||||
Alert.yes("防沉迷系统","今日游戏时间:" + int(Table.setting.safeModeTime / 60) + "分钟,已超过未成年人每日游戏时间,还是休息一下吧!",MobiTools.getIns().exit);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(add)
|
||||
{
|
||||
countTime += 20;
|
||||
}
|
||||
Saver.saveAuto(id + "countTime",countTime);
|
||||
if(GameMath.ModeTrace)
|
||||
{
|
||||
Alert.showMsg("防沉累加:60s 今日:" + countTime + "s");
|
||||
}
|
||||
}
|
||||
Saver.saveAuto(id + "clickTime",TimeCenter.timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
public function countSafeTime(id:String, add:Boolean = false) : Number
|
||||
{
|
||||
var countTime:int = 0;
|
||||
if(GameMath.ModeRealName && Table.setting.safeModeTime != null && Table.setting.safeModeTime > 0)
|
||||
{
|
||||
clickSafeTime(id,add);
|
||||
countTime = 0;
|
||||
if(Saver.getAuto(id + "countTime") != null)
|
||||
{
|
||||
countTime = Number(Saver.getAuto(id + "countTime"));
|
||||
}
|
||||
return countTime;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function countSafeTimePass(id:String, add:Boolean = false) : Boolean
|
||||
{
|
||||
var todaySafetime:int = 0;
|
||||
var safetime:int = 0;
|
||||
trace("check",GameMath.ModeRealName,Table.setting.safeModeTime,Table.setting.safeModeTime);
|
||||
if(!GameMath.ModeTrace && GameMath.ModeRealName && Table.setting.safeModeAge != null && safeModeAge < Table.setting.safeModeAge && Table.setting.safeModeTime != null && Table.setting.safeModeTime > 0)
|
||||
{
|
||||
todaySafetime = countSafeTime(id,add);
|
||||
safetime = int(Table.setting.safeModeTime);
|
||||
return todaySafetime <= safetime;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function resetGame() : void
|
||||
{
|
||||
MonsterCenter.getIns().reset();
|
||||
TimerDriver.getInstance().remove(NetMaster.getIns().heartBeating,heartbeatTimer,true);
|
||||
SecondDriver.getIns().remove(checkDayChange);
|
||||
SecondDriver.getIns().remove(BossCenter.getIns().secondCheck);
|
||||
}
|
||||
|
||||
public function inFunction() : void
|
||||
{
|
||||
EnterFrameDriver.getInstance().resume();
|
||||
SecondDriver.getInstance().resume();
|
||||
TimeCenter.getIns().startTimeSynchro();
|
||||
}
|
||||
|
||||
public function outFunction() : void
|
||||
{
|
||||
EnterFrameDriver.getInstance().pause();
|
||||
SecondDriver.getInstance().pause();
|
||||
}
|
||||
|
||||
public function userChangeInGame(e:Object = null) : void
|
||||
{
|
||||
Alert.yes("提示","账号已切换,请重新进入游戏。",MobiTools.getIns().exit);
|
||||
}
|
||||
|
||||
public function checkDayChange() : void
|
||||
{
|
||||
var day:int = Calendar.getDayNumber();
|
||||
if(inGameDay != day)
|
||||
{
|
||||
inGameDay = day;
|
||||
Master.history.payTypeDayCount = {};
|
||||
BossCenter.getIns().dayPass();
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.DAY_CHANGE));
|
||||
}
|
||||
}
|
||||
|
||||
public function roboCheck() : void
|
||||
{
|
||||
if(GameMath.ModeTrace || true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
FileTools.silentSaveTextFile(FileTools.applicationStorageDirectory.resolvePath("autosystem.txt"),"1");
|
||||
Alert.yes("警告","疑似脚本账号,账号将被加入监控范围,请回答以下问题。",roboCheck1);
|
||||
}
|
||||
|
||||
public function roboCheck1() : void
|
||||
{
|
||||
switch(Random.integer(1,5) - 1)
|
||||
{
|
||||
case 0:
|
||||
Alert.yesno("调查","是否正在使用挂机脚本?",roboCheckFalse,roboCheckRight,"确定","取消",false);
|
||||
break;
|
||||
case 1:
|
||||
Alert.yesno("调查","是否正常游戏而没有使用挂机脚本?",roboCheckRight,roboCheckFalse,"确定","取消",false);
|
||||
break;
|
||||
case 2:
|
||||
Alert.yesno("调查","是否购买自其他平台出售的初始账号?",roboCheckFalse,roboCheckRight,"确定","取消",false);
|
||||
break;
|
||||
case 3:
|
||||
Alert.yesno("调查",Random.integer(1,45) + "是否大于" + Random.integer(49,100),roboCheckFalse,roboCheckRight,"确定","取消",false);
|
||||
break;
|
||||
case 4:
|
||||
Alert.yesno("调查",Random.integer(1,45) + "是否小于" + Random.integer(49,100),roboCheckRight,roboCheckFalse,"确定","取消",false);
|
||||
}
|
||||
}
|
||||
|
||||
public function roboCheckRight() : void
|
||||
{
|
||||
checkNum++;
|
||||
if(checkNum > 6)
|
||||
{
|
||||
return;
|
||||
}
|
||||
roboCheck1();
|
||||
}
|
||||
|
||||
public function roboCheckFalse() : void
|
||||
{
|
||||
checkNum = 0;
|
||||
roboCheck1();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.myrloader.center.MyrCenter;
|
||||
|
||||
public class GameTools
|
||||
{
|
||||
|
||||
public static var words:Array;
|
||||
|
||||
public static var chars:String = " ,<>.{}[]-_=+`~/?!@#$%^&*|\\/\"\';:";
|
||||
|
||||
public function GameTools()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function checkWord(str:String) : String
|
||||
{
|
||||
var i:int = 0;
|
||||
if(MyrCenter.lang == "JP")
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var len:int = int(words.length);
|
||||
for(i = 0; i < len; )
|
||||
{
|
||||
if(str.indexOf(words[i]) != -1)
|
||||
{
|
||||
return words[i];
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function checkChar(str:String) : String
|
||||
{
|
||||
var i:int = 0;
|
||||
if(chars == null || chars.length <= 1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var len:int = str.length;
|
||||
for(i = 0; i < len; )
|
||||
{
|
||||
if(chars.indexOf(str.charAt(i)) != -1)
|
||||
{
|
||||
return str.charAt(i);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.myr.element.guide.GMain;
|
||||
import net.pixvi.myr.element.guide.GSub;
|
||||
import net.pixvi.myr.element.room.RoomVo;
|
||||
import net.pixvi.myr.element.task.TaskVo;
|
||||
import net.pixvi.myr.net.NetMaster;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class GuideCenter extends Singleton
|
||||
{
|
||||
|
||||
public static var guideFixed:Boolean = false;
|
||||
|
||||
public function GuideCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : GuideCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(GuideCenter) as GuideCenter;
|
||||
}
|
||||
|
||||
public static function guideFix() : void
|
||||
{
|
||||
trace("fixguide");
|
||||
if(guideFixed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
guideFixed = true;
|
||||
var fmgtaskfin:Boolean = Boolean(GuideCenter.getIns().checkFin(GSub.TASK_STATUS_BUILD));
|
||||
var fmgtask:TaskVo = TaskCenter.getIns().getLocalTaskByTypeId("1001012");
|
||||
if(!fmgtaskfin && fmgtask != null)
|
||||
{
|
||||
for each(var roomvo:RoomVo in Master.rooms)
|
||||
{
|
||||
if(roomvo.type != 1001)
|
||||
{
|
||||
TaskCenter.getIns().activityLockStatus(GSub.TASK_STATUS_BUILD);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function fin(guideType:String = "auto", update:Boolean = true) : void
|
||||
{
|
||||
if(guideType == "auto")
|
||||
{
|
||||
guideType = Master.history.guide_main;
|
||||
}
|
||||
if(checkCur(guideType))
|
||||
{
|
||||
Master.history.guide_main = GMain.Process[GMain.Process.indexOf(Master.history.guide_main) + 1];
|
||||
if(update)
|
||||
{
|
||||
if(Master.history.guide_record[guideType] != true)
|
||||
{
|
||||
NetMaster.getIns().updateGuide(Master.history.guide_main,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(Master.history.guide_record[guideType] != true)
|
||||
{
|
||||
NetMaster.getIns().updateGuide(guideType,false);
|
||||
}
|
||||
Master.history.guide_record[guideType] = true;
|
||||
}
|
||||
|
||||
public function checkCur(guideType:String) : Boolean
|
||||
{
|
||||
return Master.history.guide_main == guideType;
|
||||
}
|
||||
|
||||
public function checkFin(guideType:String) : Boolean
|
||||
{
|
||||
return Master.history.guide_record[guideType] == true;
|
||||
}
|
||||
|
||||
public function checkFreshGuideFinish() : Boolean
|
||||
{
|
||||
return Master.history.passTask["1001004"] == true;
|
||||
}
|
||||
|
||||
public function checkOnceFirstGuideMode() : void
|
||||
{
|
||||
var i:int = 0;
|
||||
if(Table.game_setting.openOnceFirstGuide == true)
|
||||
{
|
||||
if(Master.history.passTask["1001004"] == true)
|
||||
{
|
||||
Master.history.guide_main = "goWildOver";
|
||||
for(i = 0; i < GMain.Process.length; )
|
||||
{
|
||||
Master.history.guide_record[GMain.Process[i]] = true;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,281 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import flash.display.Bitmap;
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import net.pixvi.common.driver.StageDriver;
|
||||
import net.pixvi.common.utils.PiFixVo;
|
||||
import net.pixvi.common.utils.StageLocator;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.myr.element.mon.EggVo;
|
||||
import net.pixvi.myr.element.mon.MonsterVo;
|
||||
import net.pixvi.pfw.display.BitFactory;
|
||||
import net.pixvi.pfw.display.BitSprite;
|
||||
import net.pixvi.pfw.display.NetBitImg;
|
||||
import net.pixvi.pfw.display.PiSprite;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class ImgCenter extends Singleton
|
||||
{
|
||||
|
||||
private static var fsMaskUp:BitSprite;
|
||||
|
||||
private static var fsMaskDown:BitSprite;
|
||||
|
||||
public static var rankDic:Object = {
|
||||
"-1":"0",
|
||||
"0":"C",
|
||||
"1":"C",
|
||||
"2":"B",
|
||||
"3":"A",
|
||||
"4":"S",
|
||||
"5":"S"
|
||||
};
|
||||
|
||||
public static var elementDic:Object = {
|
||||
"1":"water",
|
||||
"2":"fire",
|
||||
"3":"ground",
|
||||
"4":"wind",
|
||||
"5":"none"
|
||||
};
|
||||
|
||||
public function ImgCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function addFsMask(container:DisplayObjectContainer, mode:String = "fs1") : void
|
||||
{
|
||||
var vo:PiFixVo = StageLocator.SubFixVos[mode];
|
||||
if(vo.hasFix)
|
||||
{
|
||||
if(fsMaskUp == null)
|
||||
{
|
||||
fsMaskUp = FF.getBS("ui.FsMask");
|
||||
fsMaskDown = FF.getBS("ui.FsMask");
|
||||
fsMaskDown.scaleY = -1;
|
||||
}
|
||||
fsMaskUp.y = vo.fix[0];
|
||||
fsMaskDown.y = StageDriver.stageHeight + vo.fix[2];
|
||||
container.addChild(fsMaskUp);
|
||||
container.addChild(fsMaskDown);
|
||||
}
|
||||
}
|
||||
|
||||
public static function getBrickHeroImg(type:int = 1) : Bitmap
|
||||
{
|
||||
return FF.getBM("hero.type" + type,"auto",true);
|
||||
}
|
||||
|
||||
public static function getItemBgImg(itemOrEggOrMon:Object = null, LM:String = "L") : String
|
||||
{
|
||||
var lv:int = 1;
|
||||
if(itemOrEggOrMon is EggVo)
|
||||
{
|
||||
lv = int(itemOrEggOrMon.star);
|
||||
}
|
||||
else if(itemOrEggOrMon is MonsterVo)
|
||||
{
|
||||
lv = int(itemOrEggOrMon.star);
|
||||
}
|
||||
else
|
||||
{
|
||||
lv = int(itemOrEggOrMon.quality);
|
||||
}
|
||||
return "data/img/common/common_items_" + lv + "_" + LM + ".png";
|
||||
}
|
||||
|
||||
public static function getItemBgImgByRank(rank:int, LM:String = "L") : String
|
||||
{
|
||||
return "data/img/common/common_items_" + rank + "_" + LM + ".png";
|
||||
}
|
||||
|
||||
public static function getStarImg(star:int) : String
|
||||
{
|
||||
return "data/img/common/common_stars_" + star + ".png";
|
||||
}
|
||||
|
||||
public static function getItemImg(type:int, small:Boolean = false, ornament:Boolean = false) : String
|
||||
{
|
||||
if(small)
|
||||
{
|
||||
return "data/img/item/s/item_" + type + "_s.png";
|
||||
}
|
||||
if(ornament)
|
||||
{
|
||||
return "data/img/item/item_" + type + "_o.png";
|
||||
}
|
||||
return "data/img/item/item_" + type + ".png";
|
||||
}
|
||||
|
||||
public static function getMonCardFront(star:int = 1, rank:int = 1) : String
|
||||
{
|
||||
return "data/img/common/monsterframe_rank" + rankDic[rank] + "_" + star + ".png";
|
||||
}
|
||||
|
||||
public static function getMonMidCardFront(rank:int = 1) : String
|
||||
{
|
||||
return "data/img/common/array_frame_rank" + rankDic[rank] + ".png";
|
||||
}
|
||||
|
||||
public static function getMonCardBack(rank:int = 1) : String
|
||||
{
|
||||
return "data/img/common/monsterframe_rank" + rankDic[rank] + "_botm.png";
|
||||
}
|
||||
|
||||
public static function getMonElement(element:int) : String
|
||||
{
|
||||
return "data/img/common/monsterframe_attrib_" + elementDic[element] + ".png";
|
||||
}
|
||||
|
||||
public static function getMonGroup(ground:int) : String
|
||||
{
|
||||
return "data/img/common/group" + ground + ".png";
|
||||
}
|
||||
|
||||
public static function skillIcon(type:int) : String
|
||||
{
|
||||
return "data/img/skill/skill_" + type + ".png";
|
||||
}
|
||||
|
||||
public static function getAchiTagImg(achiTag:String) : String
|
||||
{
|
||||
return "data/img/common/myroom_achv_class_" + achiTag + ".png";
|
||||
}
|
||||
|
||||
public static function farmEventImg(img:String) : String
|
||||
{
|
||||
return "data/img/farmevent/farmevent_" + img + ".png";
|
||||
}
|
||||
|
||||
public static function getMonFullCardImg(type:int, equips:Array = null, reFixQ:Boolean = false) : PiSprite
|
||||
{
|
||||
var i:int = 0;
|
||||
var equipData:Object = null;
|
||||
var equipImg:NetBitImg = null;
|
||||
var equipContainer:PiSprite = null;
|
||||
var ofix:Object = null;
|
||||
var s:PiSprite = new PiSprite();
|
||||
var monImg:NetBitImg = new NetBitImg(getMonQImg(type,2));
|
||||
var monImgFix:Object = getMonQFix(type,2);
|
||||
monImg.x = monImgFix.x;
|
||||
monImg.y = monImgFix.y;
|
||||
s.addChild(monImg);
|
||||
for(i = 0; i < equips.length; )
|
||||
{
|
||||
if(equips[i] > 0)
|
||||
{
|
||||
if(Table.item_info[equips[i]].position.position != "0")
|
||||
{
|
||||
equipData = Table.item_info[equips[i]];
|
||||
equipImg = new NetBitImg(getItemImg(equips[i],false,equipData.position.img));
|
||||
equipContainer = new PiSprite();
|
||||
equipContainer.addChild(equipImg);
|
||||
ofix = getMonOrnamentFix(type,2,equipData.position.position);
|
||||
equipImg.x = equipData.position.floatX;
|
||||
equipImg.y = equipData.position.floatY;
|
||||
equipImg.setScale(equipData.position.scale);
|
||||
equipImg.rotation = equipData.position.rotation;
|
||||
equipContainer.x = ofix.x;
|
||||
equipContainer.y = ofix.y;
|
||||
if(ofix.rotation != null)
|
||||
{
|
||||
equipContainer.rotation = ofix.rotation;
|
||||
}
|
||||
if(ofix.hide != null)
|
||||
{
|
||||
equipContainer.visible = ofix.hide;
|
||||
}
|
||||
else
|
||||
{
|
||||
equipContainer.visible = true;
|
||||
}
|
||||
if(equipData.position.front)
|
||||
{
|
||||
s.addChild(equipContainer);
|
||||
}
|
||||
else
|
||||
{
|
||||
s.addChildAt(equipContainer,s.getChildIndex(monImg));
|
||||
}
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if(reFixQ)
|
||||
{
|
||||
s.x -= monImgFix.x;
|
||||
s.y -= monImgFix.y;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
public static function getBattleMonBoard(quality:int) : String
|
||||
{
|
||||
return "data/img/common/battle_monster" + rankDic[quality] + ".png";
|
||||
}
|
||||
|
||||
public static function getMonsterCGImg(type:int, upStar:int = 0) : String
|
||||
{
|
||||
if(upStar == 0)
|
||||
{
|
||||
return "data/img/monster/l/" + type + "_l_0.png";
|
||||
}
|
||||
try
|
||||
{
|
||||
return getMonsterCGImg(Table.upstar_info[type].skin[upStar][upStar]);
|
||||
}
|
||||
catch(e:Error)
|
||||
{
|
||||
var _loc5_:String = "";
|
||||
}
|
||||
return _loc5_;
|
||||
}
|
||||
|
||||
public static function getBattleImgByGroundType(groundType:String) : String
|
||||
{
|
||||
return "data/img/bg/" + Table.setting.groundType[groundType].battleImg;
|
||||
}
|
||||
|
||||
public static function getEntangleSkillIcon(type:String) : String
|
||||
{
|
||||
return "data/img/eskill/e_" + type + ".png";
|
||||
}
|
||||
|
||||
public static function gcMonsterImg(type:int, l:Boolean = true) : void
|
||||
{
|
||||
BitFactory.removeBitmapDataMapping(getMonsterCGImg(type));
|
||||
}
|
||||
|
||||
public static function getMonQImg(type:int, mode:int, tag:String = "") : String
|
||||
{
|
||||
return "data/img/monster/q/" + type + "_q_" + mode + tag + ".png";
|
||||
}
|
||||
|
||||
public static function getMonAvatar(type:int) : String
|
||||
{
|
||||
return "data/img/monster/a/" + type + "_a_0.png";
|
||||
}
|
||||
|
||||
public static function getMonQFix(type:int, mode:int, tag:String = "") : Object
|
||||
{
|
||||
return Table.monster_info[type].imgFix[mode + tag];
|
||||
}
|
||||
|
||||
public static function getMonTagFix(type:int, tag:String = "l") : Object
|
||||
{
|
||||
return Table.monster_info[type].imgFix[tag];
|
||||
}
|
||||
|
||||
public static function getMonOrnamentFix(type:int, mode:int, position:int, tag:String = "") : Object
|
||||
{
|
||||
return Table.monster_info[type].ornamentFix[position.toString()][mode + tag];
|
||||
}
|
||||
|
||||
public static function hasMonQImg(type:int, mode:int, tag:String = "") : Boolean
|
||||
{
|
||||
return getMonQFix(type,mode,tag) != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,355 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.myr.element.msg.MailVo;
|
||||
import net.pixvi.myr.element.snd.GameSound;
|
||||
import net.pixvi.myr.event.MYREvent;
|
||||
import net.pixvi.myr.net.NetMail;
|
||||
import net.pixvi.myr.net.NetMiniGame;
|
||||
import net.pixvi.pfw.utils.ArrayUtil;
|
||||
import net.pixvi.pfw.utils.Saver;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
import net.pixvi.pfw.utils.json.Json;
|
||||
|
||||
public class MailCenter
|
||||
{
|
||||
|
||||
private static const MAIL_COLLECT_TYPE_ID:String = "mailCollectList";
|
||||
|
||||
private var firstUpdate:Boolean = true;
|
||||
|
||||
private var onAutoGetMailListComplete:Function;
|
||||
|
||||
private var getMail_mail:MailVo;
|
||||
|
||||
private var onGetMailRewardComplete:Function;
|
||||
|
||||
private var removeMails_removemails:Array;
|
||||
|
||||
private var onRemoveMailsComplete:Function;
|
||||
|
||||
public var collectMails:Array = null;
|
||||
|
||||
private var _onLoadCollectComplete:Function;
|
||||
|
||||
public function MailCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getMailByMailData(mailData:Object) : MailVo
|
||||
{
|
||||
var mail:MailVo = new MailVo();
|
||||
mail.id = mailData.id;
|
||||
mail.title = mailData.title;
|
||||
mail.content = mailData.content;
|
||||
mail.date = mailData.createTime / 1000;
|
||||
mail.read = mailData.isRead == 1;
|
||||
mail.level = mailData.level;
|
||||
if(mailData.reward != null)
|
||||
{
|
||||
mail.reward = Json.decode(mailData.reward);
|
||||
}
|
||||
mail.getReward = mailData.isGetReward == 1;
|
||||
return mail;
|
||||
}
|
||||
|
||||
public static function getIns() : MailCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(MailCenter) as MailCenter;
|
||||
}
|
||||
|
||||
public function pushMail(mail:MailVo) : void
|
||||
{
|
||||
Master.mailBox.mails.push(mail);
|
||||
}
|
||||
|
||||
private function get lastCheckTime() : int
|
||||
{
|
||||
if(Saver.getAuto(Master.id.toString() + "lastMailCheckTime") == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return Number(Saver.getAuto(Master.id.toString() + "lastMailCheckTime"));
|
||||
}
|
||||
|
||||
private function set lastCheckTime(val:int) : void
|
||||
{
|
||||
Saver.saveAuto(Master.id.toString() + "lastMailCheckTime",TimeCenter.timestamp);
|
||||
}
|
||||
|
||||
public function autoGetMailList(onComplete:Function = null) : void
|
||||
{
|
||||
onAutoGetMailListComplete = onComplete;
|
||||
NetMail.getIns().checkNew(autoGetMailListHandler);
|
||||
}
|
||||
|
||||
public function autoGetMailListHandler(maildatas:Array) : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var mails:Array = null;
|
||||
var i2:int = 0;
|
||||
var mail:MailVo = null;
|
||||
var hasChange:Boolean = false;
|
||||
var hasNew:Boolean = false;
|
||||
for(i = 0; i < maildatas.length; )
|
||||
{
|
||||
if(Master.mailBox.getMailById(maildatas[i].id) == null)
|
||||
{
|
||||
hasChange = true;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
var preCheckTime:Number = lastCheckTime;
|
||||
lastCheckTime = TimeCenter.timestamp;
|
||||
if(hasChange)
|
||||
{
|
||||
mails = [];
|
||||
for(i2 = 0; i2 < maildatas.length; )
|
||||
{
|
||||
mail = MailCenter.getMailByMailData(maildatas[i2]);
|
||||
if(!hasNew && mail.date > preCheckTime && !mail.read)
|
||||
{
|
||||
hasNew = true;
|
||||
}
|
||||
mails.push(mail);
|
||||
i2++;
|
||||
}
|
||||
Master.mailBox.mails = mails;
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.MAIL_UPDATE));
|
||||
}
|
||||
if(hasNew)
|
||||
{
|
||||
Alert.showMsg(lang("收到了新的邮件!"));
|
||||
GameSound.playSysVoice("mail",true,true);
|
||||
}
|
||||
if(onAutoGetMailListComplete != null)
|
||||
{
|
||||
onAutoGetMailListComplete();
|
||||
onAutoGetMailListComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function readMail(id:int) : void
|
||||
{
|
||||
NetMail.getIns().readMail([id]);
|
||||
}
|
||||
|
||||
public function getMailReward(mailvo:MailVo, onComplete:Function) : void
|
||||
{
|
||||
onGetMailRewardComplete = onComplete;
|
||||
getMail_mail = mailvo;
|
||||
NetMail.getIns().getReward(mailvo.id,getMailRewardHandler);
|
||||
}
|
||||
|
||||
private function getMailRewardHandler(re:Object) : void
|
||||
{
|
||||
getMail_mail.getReward = true;
|
||||
RewardCenter.getIns().getRewardByData(re.reward,true,"panel");
|
||||
if(onGetMailRewardComplete != null)
|
||||
{
|
||||
onGetMailRewardComplete();
|
||||
onGetMailRewardComplete = null;
|
||||
getMail_mail = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function removeMails(ids:Array, onComplete:Function) : void
|
||||
{
|
||||
onRemoveMailsComplete = onComplete;
|
||||
var removeids:Array = [];
|
||||
for each(var m:MailVo in Master.mailBox.mails)
|
||||
{
|
||||
if(ids.indexOf(m.id) != -1 && (!m.hasReward || m.getReward))
|
||||
{
|
||||
removeids.push(m.id);
|
||||
}
|
||||
}
|
||||
removeMails_removemails = removeids;
|
||||
NetMail.getIns().deleteMail(removeids,removeMailsHandler);
|
||||
}
|
||||
|
||||
private function removeMailsHandler(re:Object = null) : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var mail:MailVo = null;
|
||||
for(i = 0; i < Master.mailBox.mails.length; )
|
||||
{
|
||||
mail = Master.mailBox.mails[i];
|
||||
if(removeMails_removemails.indexOf(mail.id) != -1)
|
||||
{
|
||||
Master.mailBox.mails.splice(i,1);
|
||||
i--;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if(onRemoveMailsComplete != null)
|
||||
{
|
||||
onRemoveMailsComplete();
|
||||
onRemoveMailsComplete = null;
|
||||
removeMails_removemails = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function autoCheckMailDay() : void
|
||||
{
|
||||
for each(var m:MailVo in Master.mailBox.mails)
|
||||
{
|
||||
if(m.overday <= 0)
|
||||
{
|
||||
ArrayUtil.remove(Master.mailBox.mails,m);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function hasNewMail() : Boolean
|
||||
{
|
||||
for each(var m:MailVo in Master.mailBox.mails)
|
||||
{
|
||||
if(!m.read)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function get isCollectMailLoaded() : Boolean
|
||||
{
|
||||
return collectMails != null;
|
||||
}
|
||||
|
||||
public function loadCollectMails(onComplete:Function = null) : void
|
||||
{
|
||||
_onLoadCollectComplete = onComplete;
|
||||
NetMiniGame.getIns().loadData("mailCollectList",loadCollectMailsHandler);
|
||||
}
|
||||
|
||||
private function loadCollectMailsHandler(re:Object) : void
|
||||
{
|
||||
var data:Object = null;
|
||||
var i:int = 0;
|
||||
var mailData:Object = null;
|
||||
var mail:MailVo = null;
|
||||
collectMails = [];
|
||||
if(re != null && re.data != null)
|
||||
{
|
||||
data = re.data;
|
||||
if(data is String)
|
||||
{
|
||||
data = Json.decode(data as String);
|
||||
}
|
||||
if(data is Array)
|
||||
{
|
||||
for(i = 0; i < (data as Array).length; )
|
||||
{
|
||||
mailData = (data as Array)[i];
|
||||
mail = new MailVo();
|
||||
mail.id = mailData.id;
|
||||
mail.title = mailData.title;
|
||||
mail.content = mailData.content;
|
||||
mail.date = mailData.date;
|
||||
mail.read = true;
|
||||
mail.level = mailData.level;
|
||||
if(mailData.reward != null)
|
||||
{
|
||||
mail.reward = mailData.reward;
|
||||
}
|
||||
mail.getReward = true;
|
||||
mail.isCollectionMail = true;
|
||||
collectMails.push(mail);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(_onLoadCollectComplete != null)
|
||||
{
|
||||
_onLoadCollectComplete();
|
||||
_onLoadCollectComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function saveCollectMails(onComplete:Function = null) : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var m:MailVo = null;
|
||||
var obj:Object = null;
|
||||
var arr:Array = [];
|
||||
for(i = 0; i < collectMails.length; )
|
||||
{
|
||||
m = collectMails[i];
|
||||
obj = {
|
||||
"id":m.id,
|
||||
"title":m.title,
|
||||
"content":m.content,
|
||||
"date":m.date,
|
||||
"level":m.level,
|
||||
"reward":m.reward
|
||||
};
|
||||
arr.push(obj);
|
||||
i++;
|
||||
}
|
||||
var saveStr:String = Json.encode(arr);
|
||||
NetMiniGame.getIns().saveData("mailCollectList",saveStr,"","",onComplete);
|
||||
}
|
||||
|
||||
public function isMailCollected(mailId:int) : Boolean
|
||||
{
|
||||
var i:int = 0;
|
||||
if(collectMails == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for(i = 0; i < collectMails.length; )
|
||||
{
|
||||
if((collectMails[i] as MailVo).id == mailId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function addCollectMail(mail:MailVo, onComplete:Function = null) : void
|
||||
{
|
||||
if(isMailCollected(mail.id))
|
||||
{
|
||||
return;
|
||||
}
|
||||
var cMail:MailVo = new MailVo();
|
||||
cMail.id = mail.id;
|
||||
cMail.title = mail.title;
|
||||
cMail.content = mail.content;
|
||||
cMail.date = mail.date;
|
||||
cMail.level = mail.level;
|
||||
cMail.reward = mail.reward;
|
||||
cMail.read = true;
|
||||
cMail.getReward = true;
|
||||
cMail.isCollectionMail = true;
|
||||
collectMails.push(cMail);
|
||||
saveCollectMails(onComplete);
|
||||
}
|
||||
|
||||
public function removeCollectMails(ids:Array, onComplete:Function = null) : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var m:MailVo = null;
|
||||
for(i = 0; i < collectMails.length; )
|
||||
{
|
||||
m = collectMails[i];
|
||||
if(ids.indexOf(m.id) != -1)
|
||||
{
|
||||
collectMails.splice(i,1);
|
||||
i--;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
saveCollectMails(onComplete);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.myr.element.master.MasterVo;
|
||||
|
||||
public function get Master() : MasterVo
|
||||
{
|
||||
return Game.getIns().master;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,637 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import flash.events.Event;
|
||||
import net.pixvi.common.driver.ClockDriver;
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.common.utils.global;
|
||||
import net.pixvi.common.utils.mobi.MobiTools;
|
||||
import net.pixvi.myr.CP;
|
||||
import net.pixvi.myr.GameMath;
|
||||
import net.pixvi.myr.element.achi.AchiType;
|
||||
import net.pixvi.myr.element.alchemy.AlchemyStackVo;
|
||||
import net.pixvi.myr.element.bag.ItemVo;
|
||||
import net.pixvi.myr.element.explore.ExploreTeamVo;
|
||||
import net.pixvi.myr.element.guide.GSub;
|
||||
import net.pixvi.myr.element.master.MasterInfoVo;
|
||||
import net.pixvi.myr.element.master.MasterVo;
|
||||
import net.pixvi.myr.element.mon.MonsterVo;
|
||||
import net.pixvi.myr.element.room.RoomVo;
|
||||
import net.pixvi.myr.element.stack.StackVo;
|
||||
import net.pixvi.myr.element.task.TaskVo;
|
||||
import net.pixvi.myr.element.team.TeamVo;
|
||||
import net.pixvi.myr.element.user.ServerVo;
|
||||
import net.pixvi.myr.event.MYREvent;
|
||||
import net.pixvi.myr.net.NetMaster;
|
||||
import net.pixvi.myr.panel.avatar.AvatarVo;
|
||||
import net.pixvi.myr.panel.levelup.LevelUpPanel;
|
||||
import net.pixvi.myr.panel.mainmenu.MainMenu;
|
||||
import net.pixvi.myrane.MyrAne;
|
||||
import net.pixvi.myrloader.center.MyrCenter;
|
||||
import net.pixvi.pfw.utils.Calendar;
|
||||
import net.pixvi.pfw.utils.Caller;
|
||||
import net.pixvi.pfw.utils.Oncer;
|
||||
import net.pixvi.pfw.utils.Saver;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class MasterCenter extends Singleton
|
||||
{
|
||||
|
||||
public var masterInfo:MasterInfoVo;
|
||||
|
||||
private var onAutoChecklevelUpComplete:Function;
|
||||
|
||||
private var levelUp_para:Object;
|
||||
|
||||
private var autoAddTi_checking:Boolean = false;
|
||||
|
||||
private var onSetAvatarComplete:Function;
|
||||
|
||||
private var setAvatar_buffAvatar:int;
|
||||
|
||||
private var onGetAvatarComplete:Function;
|
||||
|
||||
private var onChangeNameComplete:Function;
|
||||
|
||||
private var changeName_paraName:String = "";
|
||||
|
||||
public function MasterCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : MasterCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(MasterCenter) as MasterCenter;
|
||||
}
|
||||
|
||||
public function loadMasterData(data:Object) : void
|
||||
{
|
||||
var payGiftArr:Array = null;
|
||||
var i8:int = 0;
|
||||
var i:int = 0;
|
||||
var stackData:Object = null;
|
||||
var stack:StackVo = null;
|
||||
var i4:int = 0;
|
||||
var alchemyStackData:Object = null;
|
||||
var alchemyStack:AlchemyStackVo = null;
|
||||
var i7:int = 0;
|
||||
var mb:Object = null;
|
||||
var j:int = 0;
|
||||
var monData:Object = null;
|
||||
var mon:MonsterVo = null;
|
||||
var k:int = 0;
|
||||
var itemData:Object = null;
|
||||
var item:ItemVo = null;
|
||||
var i2:int = 0;
|
||||
var expTeam:ExploreTeamVo = null;
|
||||
var i3:int = 0;
|
||||
var taskData:Object = null;
|
||||
var task:TaskVo = null;
|
||||
var i5:int = 0;
|
||||
var roomData:Object = null;
|
||||
var room:RoomVo = null;
|
||||
var i6:int = 0;
|
||||
var team:TeamVo = null;
|
||||
var roomPos:int = 0;
|
||||
var curServer:ServerVo = null;
|
||||
var m:MasterVo = new MasterVo();
|
||||
m.init();
|
||||
m.id = data.master.id;
|
||||
m.createTime = data.master.createTime;
|
||||
m.level = data.master.level;
|
||||
m.name = data.master.roleName;
|
||||
m.farmName = data.master.farmName;
|
||||
m.avatar = data.master.avatar;
|
||||
m.exp = data.master.exp;
|
||||
m.money = data.master.money;
|
||||
m.ti = data.master.ti;
|
||||
m.ke = data.master.ke;
|
||||
m.curBattleTeam = "teamA";
|
||||
m.timeTi = data.master.timeTi / 1000;
|
||||
if(MobiTools.isMobi())
|
||||
{
|
||||
if(MyrCenter.channel == "BLBL")
|
||||
{
|
||||
MyrAne.notifyZone("1000","bilibili区",m.id.toString(),m.name);
|
||||
}
|
||||
}
|
||||
GameCenter.getIns().inGameDay = Calendar.getDayNumber();
|
||||
m.history.loadHistoryData(data.history,data.data2);
|
||||
if(data.payInfo != null)
|
||||
{
|
||||
if(data.payInfo.payGiftTypes == null)
|
||||
{
|
||||
data.payInfo.payGiftTypes = data.payInfo.payGitfTypes;
|
||||
}
|
||||
m.history.payPoint = data.payInfo.payPoint;
|
||||
if(data.payInfo.payGiftTypes != null)
|
||||
{
|
||||
payGiftArr = data.payInfo.payGiftTypes.split(",");
|
||||
for(i8 = 0; i8 < payGiftArr.length; )
|
||||
{
|
||||
m.history.payGiftTypes[payGiftArr[i8]] = true;
|
||||
i8++;
|
||||
}
|
||||
}
|
||||
}
|
||||
m.activityHistory.loadActivityData(data.activityHistory);
|
||||
m.vipTime = data.activityHistory.vipInfo.vipTime;
|
||||
m.globalAdd.update(data.master);
|
||||
if(data.masterEventTimer != null)
|
||||
{
|
||||
m.randomEventTimer = data.masterEventTimer;
|
||||
}
|
||||
if(data.masterCurrentEvent != null)
|
||||
{
|
||||
m.randomEvent = data.masterCurrentEvent;
|
||||
}
|
||||
if(m.history.guide_record[GSub.FIRST_OUT] == null)
|
||||
{
|
||||
m.curCityId = 0;
|
||||
}
|
||||
for(i = 0; i < data.stacks.length; )
|
||||
{
|
||||
stackData = data.stacks[i];
|
||||
stack = StackCenter.getStackByStackData(stackData);
|
||||
m.stacks.push(stack);
|
||||
i++;
|
||||
}
|
||||
for(i4 = 0; i4 < data.alchemyStacks.length; )
|
||||
{
|
||||
alchemyStackData = data.alchemyStacks[i4];
|
||||
alchemyStack = AlchemyCenter.getAlchemyStackByAlchemyStackData(alchemyStackData);
|
||||
m.alchemyStacks.push(alchemyStack);
|
||||
i4++;
|
||||
}
|
||||
var allMbs:Object = {};
|
||||
if(data.monsterAttributes != null)
|
||||
{
|
||||
for(i7 = 0; i7 < data.monsterAttributes.length; )
|
||||
{
|
||||
mb = data.monsterAttributes[i7];
|
||||
allMbs[mb.monsterId] = mb;
|
||||
i7++;
|
||||
}
|
||||
}
|
||||
for(j = 0; j < data.monsters.length; )
|
||||
{
|
||||
monData = data.monsters[j];
|
||||
mon = MonsterCenter.getMonByMonData(monData);
|
||||
m.monsters.push(mon);
|
||||
if(allMbs[mon.id] != null)
|
||||
{
|
||||
mon.abilityAdd.update(allMbs[mon.id]);
|
||||
}
|
||||
j++;
|
||||
}
|
||||
for(k = 0; k < data.items.length; )
|
||||
{
|
||||
itemData = data.items[k];
|
||||
item = BagCenter.getItemByItemData(itemData);
|
||||
m.bag.items.push(item);
|
||||
k++;
|
||||
}
|
||||
for(i2 = 0; i2 < data.exploreTeams.length; )
|
||||
{
|
||||
expTeam = ExploreCenter.makeTeamByData(data.exploreTeams[i2]);
|
||||
m.exploreTeams.push(expTeam);
|
||||
i2++;
|
||||
}
|
||||
for(i3 = 0; i3 < data.currentTasks.length; )
|
||||
{
|
||||
taskData = data.currentTasks[i3];
|
||||
if(taskData == null || Table.task_info[taskData.typeId] == null)
|
||||
{
|
||||
if(taskData != null)
|
||||
{
|
||||
trace("找不到任务:" + taskData.typeId);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
task = TaskCenter.getTaskByTaskData(taskData);
|
||||
m.tasks.push(task);
|
||||
}
|
||||
i3++;
|
||||
}
|
||||
for(i5 = 0; i5 < data.rooms.length; )
|
||||
{
|
||||
roomData = data.rooms[i5];
|
||||
room = RoomCenter.getRoomByRoomData(roomData);
|
||||
m.rooms.push(room);
|
||||
i5++;
|
||||
}
|
||||
for(i6 = 0; i6 < data.teams.length; )
|
||||
{
|
||||
team = TeamCenter.getTeamVoByData(data.teams[i6]);
|
||||
m.teams[i6] = team;
|
||||
i6++;
|
||||
}
|
||||
Game.getIns().master = m;
|
||||
if(Saver.getAuto(Master.id + "city") != null)
|
||||
{
|
||||
Master.curCityId = int(Saver.getAuto(Master.id + "city"));
|
||||
}
|
||||
if(Saver.getAuto(Master.id + "battleTeam") != null)
|
||||
{
|
||||
Master.curBattleTeam = Saver.getAuto(Master.id + "battleTeam").toString();
|
||||
}
|
||||
if(Saver.getAuto(Master.id + "roomSort") != null)
|
||||
{
|
||||
Master.roomSort = Saver.getAuto(Master.id + "roomSort");
|
||||
}
|
||||
else
|
||||
{
|
||||
Master.roomSort = {};
|
||||
}
|
||||
roomPos = 0;
|
||||
while(roomPos < Master.rooms.length)
|
||||
{
|
||||
if(Master.roomSort[roomPos.toString()] != null)
|
||||
{
|
||||
Master.rooms[roomPos].sort = Master.roomSort[roomPos.toString()];
|
||||
}
|
||||
else
|
||||
{
|
||||
Master.rooms[roomPos].sort = roomPos;
|
||||
}
|
||||
roomPos++;
|
||||
}
|
||||
TaskCenter.getIns().checkReceivableTask();
|
||||
AchiCenter.getIns().checkLocalAchiList();
|
||||
if(MobiTools.isMobi() && MyrCenter.channel == "MEIZU" && Boolean(MyrAne.meizu2Bingxue))
|
||||
{
|
||||
curServer = AccountCenter.getIns().curServer;
|
||||
MyrAne.bingxueSetRoleData(3,curServer.serverId,curServer.serverName,curServer.masterId.toString(),curServer.masterName,Master.level.toString(),Master.money,"驯养师","","牧羊人之心");
|
||||
}
|
||||
}
|
||||
|
||||
public function autoCheckLevelUp(show:Boolean = true, onComplete:* = null) : void
|
||||
{
|
||||
onAutoChecklevelUpComplete = onComplete;
|
||||
var oldLevel:int = int(Master.level);
|
||||
var newLevel:int = oldLevel;
|
||||
while(newLevel + 1 <= GameMath.masterMaxLevel && Master.exp >= Table.farm_level[newLevel + 1])
|
||||
{
|
||||
newLevel += 1;
|
||||
}
|
||||
if(newLevel > oldLevel)
|
||||
{
|
||||
levelUp(show);
|
||||
}
|
||||
else if(onAutoChecklevelUpComplete != null)
|
||||
{
|
||||
onAutoChecklevelUpComplete();
|
||||
onAutoChecklevelUpComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function levelUp(show:Boolean = true) : void
|
||||
{
|
||||
levelUp_para = {"show":show};
|
||||
NetMaster.getIns().checkLevel(levelUpHandler);
|
||||
}
|
||||
|
||||
private function levelUpHandler(newLevel:int) : void
|
||||
{
|
||||
Master.level = newLevel;
|
||||
if(levelUp_para.show)
|
||||
{
|
||||
if(onAutoChecklevelUpComplete != null)
|
||||
{
|
||||
LevelUpPanel.getIns().onComplete = onAutoChecklevelUpComplete;
|
||||
onAutoChecklevelUpComplete = null;
|
||||
}
|
||||
Caller.delayCall(LevelUpPanel.getIns().popIn,100);
|
||||
}
|
||||
sendNumChangeEvent();
|
||||
levelUp_para = null;
|
||||
if(MyrCenter.channel == "MEIZU" && MobiTools.isMobi())
|
||||
{
|
||||
if(MyrAne.meizu2Bingxue)
|
||||
{
|
||||
MyrAne.bingxueSetRoleData(4,AccountCenter.getIns().curServer.serverId,AccountCenter.getIns().curServer.serverName,Master.id.toString(),Master.name,Master.level.toString(),Master.money,"驯养师","","牧羊人之心");
|
||||
}
|
||||
else
|
||||
{
|
||||
MyrAne.meizuSetRoleData(3,(int(Master.createTime / 1000)).toString(),Master.id.toString(),Master.name,Master.level.toString(),"0","0",AccountCenter.getIns().curServer.serverId.toString(),AccountCenter.getIns().curServer.serverName);
|
||||
}
|
||||
}
|
||||
if(onAutoChecklevelUpComplete != null)
|
||||
{
|
||||
onAutoChecklevelUpComplete();
|
||||
onAutoChecklevelUpComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function addExp(exp:int, show:Boolean = false) : void
|
||||
{
|
||||
if(exp > 0)
|
||||
{
|
||||
Master.exp += exp;
|
||||
if(show)
|
||||
{
|
||||
Alert.showMsg(lang("获得了 {0} 牧场经验!",CP.exp(exp.toString())));
|
||||
}
|
||||
Oncer.lastRun(sendNumChangeEvent);
|
||||
}
|
||||
}
|
||||
|
||||
public function addMoney(money:int, show:Boolean = false) : void
|
||||
{
|
||||
if(money > 0)
|
||||
{
|
||||
Master.money += money;
|
||||
if(show)
|
||||
{
|
||||
Alert.showMsg(lang("获得了 {0} 金币!",CP.money(money.toString())));
|
||||
}
|
||||
Master.history.numAddMoney += money;
|
||||
AchiCenter.getIns().autoCheck(AchiType.MONEY);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(money >= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Master.money += money;
|
||||
if(show)
|
||||
{
|
||||
Alert.showMsg(lang("失去了 {0} 金币。",CP.money(Math.abs(money).toString())));
|
||||
}
|
||||
}
|
||||
Oncer.lastRun(sendNumChangeEvent);
|
||||
}
|
||||
|
||||
public function addKe(ke:int, show:Boolean = false) : void
|
||||
{
|
||||
if(ke > 0)
|
||||
{
|
||||
Master.ke += ke;
|
||||
if(show)
|
||||
{
|
||||
Alert.showMsg(lang("获得了 {0} 氪金!",CP.ke(ke.toString())));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(ke >= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Master.ke += ke;
|
||||
if(show)
|
||||
{
|
||||
Alert.showMsg(lang("失去了 {0} 氪金。",CP.ke(Math.abs(ke).toString())));
|
||||
}
|
||||
}
|
||||
Oncer.lastRun(sendNumChangeEvent);
|
||||
}
|
||||
|
||||
public function addTi(ti:int, show:Boolean = false, modeTime:Boolean = false) : void
|
||||
{
|
||||
if(ti > 0)
|
||||
{
|
||||
if(modeTime)
|
||||
{
|
||||
if(Master.ti >= Master.tiMax)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Master.ti += ti;
|
||||
if(Master.ti > Master.tiMax)
|
||||
{
|
||||
Master.ti = Master.tiMax;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Master.ti += ti;
|
||||
if(Master.ti > 999)
|
||||
{
|
||||
Master.ti = 999;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(ti >= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Master.ti += ti;
|
||||
if(Master.ti < 0)
|
||||
{
|
||||
Master.ti = 0;
|
||||
}
|
||||
if(show)
|
||||
{
|
||||
Alert.showMsg(lang("失去了 {0} 点体力。",CP.ti(Math.abs(ti).toString())));
|
||||
}
|
||||
}
|
||||
Oncer.lastRun(sendNumChangeEvent);
|
||||
}
|
||||
|
||||
public function autoAddTi() : void
|
||||
{
|
||||
if(autoAddTi_checking)
|
||||
{
|
||||
return;
|
||||
}
|
||||
autoAddTi_checking = true;
|
||||
var ct:int = ClockDriver.timestamp - Master.timeTi;
|
||||
var num:int = int(ct / GameMath.tiCD);
|
||||
if(num > 0)
|
||||
{
|
||||
NetMaster.getIns().checkTi(autoAddTiHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
autoAddTi_checking = false;
|
||||
}
|
||||
}
|
||||
|
||||
private function autoAddTiHandler(newTi:int, newTimeTi:uint) : void
|
||||
{
|
||||
if(newTi == Master.ti)
|
||||
{
|
||||
Master.timeTi = newTimeTi;
|
||||
Caller.delayCall(delaySetTiChecking,3000,1);
|
||||
return;
|
||||
}
|
||||
MasterCenter.getIns().addTi(newTi - Master.ti,false,true);
|
||||
Master.timeTi = newTimeTi;
|
||||
autoAddTi_checking = false;
|
||||
}
|
||||
|
||||
private function delaySetTiChecking() : void
|
||||
{
|
||||
autoAddTi_checking = false;
|
||||
autoAddTi();
|
||||
}
|
||||
|
||||
public function inJectGAoPara() : void
|
||||
{
|
||||
global.gn.myName = Master.name;
|
||||
global.gn.farmName = Master.farmName;
|
||||
}
|
||||
|
||||
public function sendNumChangeEvent() : void
|
||||
{
|
||||
GlobalBroadcast.dispatchEvent(new Event(MYREvent.ROLE_NUM_CHANGE));
|
||||
}
|
||||
|
||||
public function getCurZL() : int
|
||||
{
|
||||
var arr:Array = TeamCenter.getIns().getFightStackMonsters(Master.curBattleTeam);
|
||||
var zl:int = 0;
|
||||
for each(var m:MonsterVo in arr)
|
||||
{
|
||||
zl += GameMath.zl_monVo(m);
|
||||
}
|
||||
return zl;
|
||||
}
|
||||
|
||||
public function getVipDay() : int
|
||||
{
|
||||
if(TimeCenter.timestamp < Master.vipTime)
|
||||
{
|
||||
return Calendar.getDayNumber(Master.vipTime) - Calendar.getDayNumber();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function getVipChecked() : Boolean
|
||||
{
|
||||
var checkDay:int = Calendar.getDayNumber(Master.activityHistory.vipCheckTime);
|
||||
var curDay:int = Calendar.getDayNumber();
|
||||
if(checkDay != curDay)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function goCity(city:int) : void
|
||||
{
|
||||
Master.curCityId = city;
|
||||
if(!GuideCenter.getIns().checkFin(GSub.FIRST_OUT))
|
||||
{
|
||||
GuideCenter.getIns().fin(GSub.FIRST_OUT);
|
||||
}
|
||||
Saver.saveAuto(Master.id + "city",city);
|
||||
}
|
||||
|
||||
public function setAvatar(avatar:int, onComplete:Function) : void
|
||||
{
|
||||
onSetAvatarComplete = onComplete;
|
||||
setAvatar_buffAvatar = avatar;
|
||||
NetMaster.getIns().setAvatar(avatar,setAvatarComplete);
|
||||
}
|
||||
|
||||
private function setAvatarComplete() : void
|
||||
{
|
||||
Master.avatar = setAvatar_buffAvatar;
|
||||
if(onSetAvatarComplete != null)
|
||||
{
|
||||
onSetAvatarComplete();
|
||||
onSetAvatarComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function getUseableAvatar() : Array
|
||||
{
|
||||
var i:int = 0;
|
||||
var avo:AvatarVo = null;
|
||||
var avatars:Array = [];
|
||||
for(i = 0; i < Table.avatar_infoArr.length; )
|
||||
{
|
||||
avo = new AvatarVo();
|
||||
avo.avatarId = Table.avatar_infoArr[i].avatarId;
|
||||
trace(Table.avatar_infoArr[i].avatarId);
|
||||
if(avo.useable())
|
||||
{
|
||||
if(Master.newAvatars != null && Master.newAvatars.indexOf(avo.avatarId.toString()) != -1)
|
||||
{
|
||||
avatars.insertAt(0,avo);
|
||||
}
|
||||
else
|
||||
{
|
||||
avatars.push(avo);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return avatars;
|
||||
}
|
||||
|
||||
public function getAvatar(onComplete:Function) : void
|
||||
{
|
||||
if(Master.avatars != null)
|
||||
{
|
||||
onComplete();
|
||||
return;
|
||||
}
|
||||
onGetAvatarComplete = onComplete;
|
||||
NetMaster.getIns().getAvatar(getAvatarComplete);
|
||||
}
|
||||
|
||||
private function getAvatarComplete(avatars:Array) : void
|
||||
{
|
||||
Master.avatars = avatars;
|
||||
if(onGetAvatarComplete != null)
|
||||
{
|
||||
onGetAvatarComplete();
|
||||
onGetAvatarComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function changeName(newName:String, onComplete:Function) : void
|
||||
{
|
||||
onChangeNameComplete = onComplete;
|
||||
changeName_paraName = newName;
|
||||
NetMaster.getIns().changeName(newName,changeNameHandler);
|
||||
}
|
||||
|
||||
public function changeNameHandler(re:Object) : void
|
||||
{
|
||||
var costItemVo:ItemVo = null;
|
||||
var success:Boolean = false;
|
||||
if(re.resCode == 801)
|
||||
{
|
||||
Alert.yes(lang("哎呀"),lang("名称【{0}】已被使用,换个名字吧!",changeName_paraName));
|
||||
}
|
||||
else if(re.resCode == 0)
|
||||
{
|
||||
success = true;
|
||||
costItemVo = BagCenter.getIns().subNumByType(Table.game_setting.changeNameItemId,1,true,lang("使用了{0} 个 {1}"));
|
||||
Alert.yes(lang("提示"),lang("角色名已更改为【{0}】!",changeName_paraName));
|
||||
Master.name = changeName_paraName;
|
||||
MainMenu.getIns().ui.ui_top.text_name.text = changeName_paraName;
|
||||
masterInfo.roleName = Master.name;
|
||||
global.gn.myName = Master.name;
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.ITEM_NUM_CHANGE,costItemVo));
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.yes(lang("更改失败"),"code:" + re.resCode);
|
||||
}
|
||||
if(onChangeNameComplete != null)
|
||||
{
|
||||
onChangeNameComplete(success);
|
||||
onChangeNameComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function getSortedRoomArray() : Array
|
||||
{
|
||||
var soroom:Array = Master.rooms.concat();
|
||||
soroom.sortOn("sort",16);
|
||||
return soroom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,209 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
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.element.bag.ItemVo;
|
||||
import net.pixvi.myr.element.reward.RewardResultVo;
|
||||
import net.pixvi.myr.net.NetMiniGame;
|
||||
import net.pixvi.myr.panel.gameroom.MiniGameVo;
|
||||
import net.pixvi.myr.panel.minigame.BaseMiniGame;
|
||||
import net.pixvi.myr.panel.minigame.minigame1.MiniGame1_Runner;
|
||||
import net.pixvi.myr.panel.minigame.minigame2.MiniGame2_MoleHitter;
|
||||
import net.pixvi.myr.panel.minigame.minigame3.MiniGame3_SlimCombiner;
|
||||
import net.pixvi.myr.panel.minigame.minigame4.MiniGame4_WCCommander;
|
||||
import net.pixvi.myr.panel.minigame.minigame5.MiniGame5_TaoDaE;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.MiniGame6_BrickHero;
|
||||
import net.pixvi.myr.panel.reward.RewardShowPanel;
|
||||
import net.pixvi.pfw.utils.Saver;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class MiniGameCenter
|
||||
{
|
||||
|
||||
public var gameRecords:Object;
|
||||
|
||||
private var onMiniGameStartComplete:Function;
|
||||
|
||||
private var onMiniGameStart_vo:MiniGameVo;
|
||||
|
||||
private var onMiniGameOverComplete:Function;
|
||||
|
||||
private var onMiniGameOver_id:int;
|
||||
|
||||
private var onMiniGameOver_point:int;
|
||||
|
||||
private var onGetRecordComplete:Function;
|
||||
|
||||
public function MiniGameCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : MiniGameCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(MiniGameCenter) as MiniGameCenter;
|
||||
}
|
||||
|
||||
public function miniGameStart(id:int, onComplete:Function) : void
|
||||
{
|
||||
onMiniGameStartComplete = onComplete;
|
||||
var gamevo:MiniGameVo = new MiniGameVo();
|
||||
gamevo.typeId = id;
|
||||
onMiniGameStart_vo = gamevo;
|
||||
NetMiniGame.getIns().miniGameStart(onMiniGameStart_vo.type,miniGameStartHandler);
|
||||
}
|
||||
|
||||
public function miniGameStartHandler(re:Object = null) : void
|
||||
{
|
||||
BagCenter.getIns().subNumByType(int(onMiniGameStart_vo.coinType),onMiniGameStart_vo.coin,true,"",true);
|
||||
if(onMiniGameStartComplete != null)
|
||||
{
|
||||
onMiniGameStartComplete();
|
||||
onMiniGameStartComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function miniGameOver(id:int, point:int, onComplete:Function) : void
|
||||
{
|
||||
onMiniGameOverComplete = onComplete;
|
||||
onMiniGameOver_id = id;
|
||||
onMiniGameOver_point = point;
|
||||
NetMiniGame.getIns().miniGameOver(point,miniGameOverHandler);
|
||||
}
|
||||
|
||||
private function miniGameOverHandler(re:Object = null) : void
|
||||
{
|
||||
var vo:MiniGameVo = new MiniGameVo();
|
||||
vo.typeId = onMiniGameOver_id;
|
||||
if(gameRecords[onMiniGameOver_id.toString()] == null)
|
||||
{
|
||||
gameRecords[onMiniGameOver_id.toString()] = {
|
||||
"type":vo.type,
|
||||
"maxScore":onMiniGameOver_point,
|
||||
"num":0
|
||||
};
|
||||
}
|
||||
if(re.newRecord == true)
|
||||
{
|
||||
Alert.showMsg(lang("创造了新的个人记录!"));
|
||||
gameRecords[onMiniGameOver_id.toString()].maxScore = onMiniGameOver_point;
|
||||
}
|
||||
gameRecords[onMiniGameOver_id.toString()].num++;
|
||||
var itemvo:ItemVo = new ItemVo();
|
||||
itemvo.id = re.itemId;
|
||||
itemvo.num = re.num;
|
||||
var gamevovo:MiniGameVo = new MiniGameVo();
|
||||
gamevovo.typeId = onMiniGameOver_id;
|
||||
itemvo.type = gamevovo.ticketType;
|
||||
BagCenter.getIns().addItem(itemvo);
|
||||
var rewardre:RewardResultVo = new RewardResultVo();
|
||||
RewardShowPanel.show([itemvo],minigameOverRewardshowHandler);
|
||||
if(onMiniGameOverComplete != null)
|
||||
{
|
||||
onMiniGameOverComplete(re);
|
||||
onMiniGameOverComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function minigameOverRewardshowHandler(e:Event = null) : void
|
||||
{
|
||||
PopCenter.getIns().setMaskAlpha();
|
||||
}
|
||||
|
||||
public function getRecord(onComplete:Function) : void
|
||||
{
|
||||
onGetRecordComplete = onComplete;
|
||||
NetMiniGame.getIns().getRecord(getRecordHandler);
|
||||
}
|
||||
|
||||
private function getRecordHandler(re:Object = null) : void
|
||||
{
|
||||
if(re.gameRecords == null)
|
||||
{
|
||||
gameRecords = {};
|
||||
}
|
||||
else
|
||||
{
|
||||
gameRecords = {};
|
||||
for each(var o:Object in re.gameRecords)
|
||||
{
|
||||
gameRecords[Table.mini_game[o.type].typeId] = o;
|
||||
}
|
||||
}
|
||||
if(onGetRecordComplete != null)
|
||||
{
|
||||
onGetRecordComplete(re);
|
||||
onGetRecordComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function getMiniGame(gameType:int) : BaseMiniGame
|
||||
{
|
||||
var game:BaseMiniGame = null;
|
||||
switch(gameType - 1)
|
||||
{
|
||||
case 0:
|
||||
game = new MiniGame1_Runner();
|
||||
break;
|
||||
case 1:
|
||||
game = new MiniGame2_MoleHitter();
|
||||
break;
|
||||
case 2:
|
||||
game = new MiniGame3_SlimCombiner();
|
||||
break;
|
||||
case 3:
|
||||
game = new MiniGame4_WCCommander();
|
||||
break;
|
||||
case 4:
|
||||
game = new MiniGame5_TaoDaE();
|
||||
break;
|
||||
case 5:
|
||||
game = new MiniGame6_BrickHero();
|
||||
}
|
||||
return game;
|
||||
}
|
||||
|
||||
public function getRecordScore(gameType:int) : int
|
||||
{
|
||||
var vo:MiniGameVo = new MiniGameVo();
|
||||
vo.typeId = gameType;
|
||||
return vo.topPoint;
|
||||
}
|
||||
|
||||
public function saveLocalRecordScore(gameType:int, score:int) : void
|
||||
{
|
||||
var masterId:int = 0;
|
||||
if(Master == null)
|
||||
{
|
||||
masterId = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
masterId = int(Master.id);
|
||||
}
|
||||
Saver.saveAuto(masterId + "_game" + gameType,score);
|
||||
}
|
||||
|
||||
public function getLocalRecordScore(gameType:int) : int
|
||||
{
|
||||
var masterId:int = 0;
|
||||
if(Master == null)
|
||||
{
|
||||
masterId = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
masterId = int(Master.id);
|
||||
}
|
||||
var re:Object = Saver.getAuto(masterId + "game" + gameType);
|
||||
if(re == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return int(re);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,452 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.common.system.AppLayer;
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.myr.GameMath;
|
||||
import net.pixvi.myr.element.reward.RewardResultVo;
|
||||
import net.pixvi.myr.net.NetPay;
|
||||
import net.pixvi.myr.net.NetPayPoint;
|
||||
import net.pixvi.myrane.MyrAne;
|
||||
import net.pixvi.myrloader.center.MyrCenter;
|
||||
import net.pixvi.pfw.utils.Calendar;
|
||||
import net.pixvi.pfw.utils.Caller;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
import net.pixvi.pfw.utils.json.Json;
|
||||
import net.pixvi.psg.ui.PSGWaitingPanel;
|
||||
|
||||
public class PayCenter extends Singleton
|
||||
{
|
||||
|
||||
private var onBuyGoodSuccess:Function;
|
||||
|
||||
private var onBuyGoodFail:Function;
|
||||
|
||||
private var buyGood_tradeId:String;
|
||||
|
||||
private var buyGood_goodId:int;
|
||||
|
||||
private var vipCardId:Number;
|
||||
|
||||
private var onPayPointRewardComplete:Function;
|
||||
|
||||
private var payPointReward_giftTypeId:String;
|
||||
|
||||
public function PayCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : PayCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(PayCenter) as PayCenter;
|
||||
}
|
||||
|
||||
public function buyGood(goodId:int, onSuccess:Function, onFail:Function) : void
|
||||
{
|
||||
if(GameMath.ModeTrace)
|
||||
{
|
||||
AppLayer.app.trace("准备购买goodId:" + goodId);
|
||||
}
|
||||
onBuyGoodSuccess = onSuccess;
|
||||
onBuyGoodFail = onFail;
|
||||
buyGood_goodId = goodId;
|
||||
if(AccountCenter.getIns().isVisitor && Table.setting.open_visitorPay == false && MyrCenter.lang != "JP")
|
||||
{
|
||||
if(MyrCenter.platform == "IOS")
|
||||
{
|
||||
onBuyGoodFail("游客状态无法购买商品,请绑定账号后再操作吧!");
|
||||
}
|
||||
else
|
||||
{
|
||||
onBuyGoodFail("游客状态无法购买商品,请先完成账号绑定并重启游戏。");
|
||||
}
|
||||
return;
|
||||
}
|
||||
PSGWaitingPanel.getIns().setPanel(lang("购买中..."));
|
||||
PopCenter.POP(PSGWaitingPanel.getIns());
|
||||
if(MyrCenter.channel == "MEIZU")
|
||||
{
|
||||
Caller.delayCall(meizuCloseWaitPanel,20000);
|
||||
}
|
||||
NetPay.getIns().getTradeId(goodId,getTradeIdHandler);
|
||||
}
|
||||
|
||||
private function meizuCloseWaitPanel() : void
|
||||
{
|
||||
if(PSGWaitingPanel.getIns().showing)
|
||||
{
|
||||
PSGWaitingPanel.getIns().showOut();
|
||||
}
|
||||
}
|
||||
|
||||
private function getTradeIdHandler(resCode:int, resMsg:String, tradeId:String, blblOrderSign:String, resPara:Object = null) : void
|
||||
{
|
||||
var goodInfo:Object = null;
|
||||
var nameAndDes:String = null;
|
||||
var ext:Object = null;
|
||||
trace("[支付流程]获取交易号成功");
|
||||
if(GameMath.ModeTrace)
|
||||
{
|
||||
AppLayer.app.trace("[支付流程]获取交易号成功。");
|
||||
}
|
||||
if(resCode == 996)
|
||||
{
|
||||
if(MyrCenter.hasLang())
|
||||
{
|
||||
onBuyGoodFail(resMsg);
|
||||
}
|
||||
else
|
||||
{
|
||||
onBuyGoodFail(lang("获取交易号失败!err:{0}",resCode.toString()));
|
||||
}
|
||||
if(GameMath.ModeTrace)
|
||||
{
|
||||
AppLayer.app.trace("[支付流程]获取交易号失败。");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(GameMath.ModeTrace)
|
||||
{
|
||||
AppLayer.app.trace("[支付流程]调起SDK支付。");
|
||||
}
|
||||
buyGood_tradeId = tradeId;
|
||||
if(GameMath.ModeTrace)
|
||||
{
|
||||
AppLayer.app.trace("[支付流程]获得tracdeId:" + tradeId);
|
||||
}
|
||||
goodInfo = Table.pay_info[buyGood_goodId];
|
||||
if(GameMath.ModeTrace)
|
||||
{
|
||||
AppLayer.app.trace("[支付流程]buyGoodId:" + buyGood_goodId);
|
||||
AppLayer.app.trace("[支付流程]buyGoodInfo:" + Json.encode(goodInfo));
|
||||
AppLayer.app.trace("[支付流程]buyGoodChannel:" + MyrCenter.channel);
|
||||
}
|
||||
if(MyrCenter.channel == "BLBL")
|
||||
{
|
||||
MyrAne.payBlbl(tradeId,goodInfo.name,goodInfo.name,goodInfo.rmb,"1000",goodInfo.payPoint * 10,"","",blblOrderSign,AccountCenter.getIns().sdkUserId,Master.name,Master.name,tradeSuccessHandler,tradeFailHandler);
|
||||
}
|
||||
else if(MyrCenter.channel == "MEIZU")
|
||||
{
|
||||
if(GameMath.ModeTrace)
|
||||
{
|
||||
AppLayer.app.trace("[支付流程]goodInfoName:" + goodInfo.name);
|
||||
}
|
||||
nameAndDes = goodInfo.name;
|
||||
if(Table.channel_tag == null)
|
||||
{
|
||||
Table.channel_tag = {"channelTag":"none"};
|
||||
}
|
||||
if(nameAndDes.length > 5 && Table.channel_tag.channelTag == "vivo")
|
||||
{
|
||||
nameAndDes = nameAndDes.substr(0,5);
|
||||
if(GameMath.ModeTrace)
|
||||
{
|
||||
AppLayer.app.trace("vivo渠道");
|
||||
}
|
||||
}
|
||||
if(GameMath.ModeTrace)
|
||||
{
|
||||
AppLayer.app.trace("[支付流程]bingxue:" + MyrAne.meizu2Bingxue);
|
||||
}
|
||||
if(MyrAne.meizu2Bingxue)
|
||||
{
|
||||
ext = {"payOrderNo":tradeId};
|
||||
if(GameMath.ModeTrace)
|
||||
{
|
||||
AppLayer.app.trace("[支付流程]调用sdk最后一步extData:payOrderNo" + tradeId);
|
||||
}
|
||||
MyrAne.bingxuePay(1,1,Json.encode(ext),goodInfo.rmb / 100,goodInfo.id.toString(),nameAndDes,nameAndDes,Master.id.toString(),Master.level,Master.name,AccountCenter.getIns().curServer.serverId.toString(),AccountCenter.getIns().curServer.serverName,MasterCenter.getIns().getVipDay() > 0 ? "1" : "0",tradeSuccessHandler,tradeFailHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
MyrAne.payMeizu(tradeId,goodInfo.id,nameAndDes,nameAndDes,goodInfo.rmb.toString(),AccountCenter.getIns().curServer.serverId.toString(),"",Master.id.toString(),Master.name,tradeSuccessHandler,tradeFailHandler);
|
||||
}
|
||||
}
|
||||
else if(MyrCenter.channel == "XDG")
|
||||
{
|
||||
if(MyrCenter.platform == "IOS")
|
||||
{
|
||||
MyrAne.iosPayXD(goodInfo.xdid,1,AccountCenter.getIns().curServer.JPserverId.toString(),"{\"payOrderNo\":\"" + tradeId + "\"}",Master.level,tradeSuccessHandler,tradeFailHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
MyrAne.payXD(goodInfo.xdid,AccountCenter.getIns().curServer.JPserverId.toString(),"{\"payOrderNo\":\"" + tradeId + "\"}",Master.level,tradeSuccessHandler,tradeFailHandler);
|
||||
}
|
||||
}
|
||||
else if(MyrCenter.channel == "CPG")
|
||||
{
|
||||
trace("A");
|
||||
MyrAne.payCpg(resPara.orderID,resPara.productname,resPara.money,resPara.productcode,resPara.time,resPara.sign,tradeSuccessHandler,tradeFailHandler);
|
||||
}
|
||||
else if(MyrCenter.platform == "IOS")
|
||||
{
|
||||
MyrAne.payDydIos(goodInfo.iid,tradeId,goodInfo.name,goodInfo.rmb,1,tradeSuccessHandler,tradeFailHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
MyrAne.payDyd(tradeId,goodInfo.name,goodInfo.rmb,1,goodInfo.rmb,"无折扣",tradeSuccessHandler,tradeFailHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function meizuDelayFail() : void
|
||||
{
|
||||
Caller.delayCall(meizuDelayFail2,2800);
|
||||
}
|
||||
|
||||
public function meizuDelayFail2() : void
|
||||
{
|
||||
PSGWaitingPanel.getIns().showOut();
|
||||
Caller.stopCall(meizuCloseWaitPanel,20000);
|
||||
onBuyGoodFail(lang("付款失败!若已成功扣款,请尝试重新登录游戏并返回该界面领取奖励。"));
|
||||
onBuyGoodSuccess = null;
|
||||
onBuyGoodFail = null;
|
||||
}
|
||||
|
||||
private function tradeFailHandler() : void
|
||||
{
|
||||
if(GameMath.ModeTrace)
|
||||
{
|
||||
AppLayer.app.trace("SDK支付失败回调。");
|
||||
}
|
||||
if(MyrCenter.channel == "MEIZU")
|
||||
{
|
||||
meizuDelayFail();
|
||||
return;
|
||||
}
|
||||
PSGWaitingPanel.getIns().showOut();
|
||||
Caller.stopCall(meizuCloseWaitPanel,20000);
|
||||
onBuyGoodFail(lang("付款失败!若已成功扣款,请尝试重新登录游戏并返回该界面领取奖励。"));
|
||||
onBuyGoodSuccess = null;
|
||||
onBuyGoodFail = null;
|
||||
}
|
||||
|
||||
private function tradeSuccessHandler(sdk_trade_no:Object = null) : void
|
||||
{
|
||||
if(GameMath.ModeTrace)
|
||||
{
|
||||
AppLayer.app.trace("支付成功");
|
||||
}
|
||||
trace("支付成功");
|
||||
Caller.stopCall(meizuDelayFail2,2800);
|
||||
if(sdk_trade_no == null)
|
||||
{
|
||||
sdk_trade_no = "";
|
||||
}
|
||||
if(GameMath.ModeTrace)
|
||||
{
|
||||
Alert.yes(lang("支付成功"),lang("点击确定领取奖励。"),traceConfirm);
|
||||
}
|
||||
else
|
||||
{
|
||||
NetPay.getIns().getTradeReward(buyGood_tradeId,sdk_trade_no.toString(),getTradeRewardHandler);
|
||||
}
|
||||
}
|
||||
|
||||
private function traceConfirm() : void
|
||||
{
|
||||
NetPay.getIns().getTradeReward(buyGood_tradeId,buyGood_tradeId,getTradeRewardHandler);
|
||||
}
|
||||
|
||||
private function getTradeRewardHandler(rewardData:Object, resMsg:String, resCode:String = "0") : void
|
||||
{
|
||||
var guidelib:Object = null;
|
||||
var vo:RewardResultVo = null;
|
||||
PSGWaitingPanel.getIns().showOut();
|
||||
Caller.stopCall(meizuCloseWaitPanel,20000);
|
||||
if(resCode == "990")
|
||||
{
|
||||
if(MyrCenter.hasLang())
|
||||
{
|
||||
onBuyGoodFail(lang("获取奖励失败!{0}",resCode));
|
||||
}
|
||||
else
|
||||
{
|
||||
onBuyGoodFail(resMsg);
|
||||
}
|
||||
onBuyGoodSuccess = null;
|
||||
onBuyGoodFail = null;
|
||||
return;
|
||||
}
|
||||
if(rewardData != null)
|
||||
{
|
||||
if(Master.history.payTypeCount[buyGood_goodId] == null)
|
||||
{
|
||||
Master.history.payTypeCount[buyGood_goodId] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Master.history.payTypeCount[buyGood_goodId]++;
|
||||
}
|
||||
if(Master.history.payTypeDayCount[buyGood_goodId] == null)
|
||||
{
|
||||
Master.history.payTypeDayCount[buyGood_goodId] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Master.history.payTypeDayCount[buyGood_goodId]++;
|
||||
}
|
||||
Master.history.payPoint += Table.pay_info[buyGood_goodId].payPoint;
|
||||
if(MyrCenter.channel == "XDG")
|
||||
{
|
||||
guidelib = {
|
||||
"charge6":6,
|
||||
"charge60":60,
|
||||
"charge600":600,
|
||||
"charge3000":3000,
|
||||
"charge6000":6000,
|
||||
"charge7500":7500
|
||||
};
|
||||
for(var key:String in guidelib)
|
||||
{
|
||||
if(Master.history.payPoint >= guidelib[key] && !GuideCenter.getIns().checkFin(key))
|
||||
{
|
||||
GuideCenter.getIns().fin(key);
|
||||
MyrAne.track(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(GameMath.isVipGood(buyGood_goodId.toString()))
|
||||
{
|
||||
vo = RewardCenter.getIns().getRewardByData(rewardData,true,"panel",onBuyVipCardHandler);
|
||||
vipCardId = vo.items[0].id;
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardCenter.getIns().getRewardByData(rewardData,true,"panel",onBuyGoodSuccess);
|
||||
onBuyGoodSuccess = null;
|
||||
onBuyGoodFail = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(MyrCenter.hasLang())
|
||||
{
|
||||
onBuyGoodFail(lang("获取奖励失败!{0}",resCode));
|
||||
}
|
||||
else
|
||||
{
|
||||
onBuyGoodFail(resMsg);
|
||||
}
|
||||
onBuyGoodSuccess = null;
|
||||
onBuyGoodFail = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function onBuyVipCardHandler() : void
|
||||
{
|
||||
onBuyGoodSuccess();
|
||||
onBuyGoodSuccess = null;
|
||||
onBuyGoodFail = null;
|
||||
BagCenter.getIns().useItem(vipCardId,1,null);
|
||||
}
|
||||
|
||||
public function checkBuyAble(goodId:String) : Boolean
|
||||
{
|
||||
var canBuy:Boolean = true;
|
||||
var buynum:int = 0;
|
||||
var buyDayNum:int = 0;
|
||||
if(Master.history.payTypeCount[goodId] != null)
|
||||
{
|
||||
buynum = int(Master.history.payTypeCount[goodId]);
|
||||
}
|
||||
if(Master.history.payTypeDayCount[goodId] != null)
|
||||
{
|
||||
buyDayNum = int(Master.history.payTypeDayCount[goodId]);
|
||||
}
|
||||
if(Table.pay_info[goodId].num != -1 && Table.pay_info[goodId].num <= buynum)
|
||||
{
|
||||
canBuy = false;
|
||||
}
|
||||
if(Table.pay_info[goodId].dayNum != -1 && Table.pay_info[goodId].dayNum <= buyDayNum)
|
||||
{
|
||||
canBuy = false;
|
||||
}
|
||||
return canBuy;
|
||||
}
|
||||
|
||||
public function payPointReward(giftTypeId:String, onComplete:Function) : void
|
||||
{
|
||||
onPayPointRewardComplete = onComplete;
|
||||
payPointReward_giftTypeId = giftTypeId;
|
||||
NetPayPoint.getIns().payPointReward(giftTypeId,payPointRewardHandler);
|
||||
}
|
||||
|
||||
private function payPointRewardHandler(rewardData:Object) : void
|
||||
{
|
||||
var rewardResultVo:RewardResultVo = RewardCenter.getRewardResultVoByData(rewardData);
|
||||
RewardCenter.getIns().getReward(rewardResultVo);
|
||||
Master.history.payGiftTypes[payPointReward_giftTypeId] = true;
|
||||
if(onPayPointRewardComplete != null)
|
||||
{
|
||||
onPayPointRewardComplete(rewardResultVo);
|
||||
onPayPointRewardComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function checkPayGiftCanGet(giftId:String) : Boolean
|
||||
{
|
||||
if(Master.history.payGiftTypes[giftId] == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getGoodBuyNum(goodId:String) : int
|
||||
{
|
||||
if(Master.history.payTypeCount[goodId] == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return Master.history.payTypeCount[goodId];
|
||||
}
|
||||
|
||||
public function getGoodDayBuyNum(goodId:String) : int
|
||||
{
|
||||
var dayBuyNum:int = 0;
|
||||
if(Master.history.payTypeDayCount[goodId] != null)
|
||||
{
|
||||
dayBuyNum = int(Master.history.payTypeDayCount[goodId]);
|
||||
}
|
||||
return dayBuyNum;
|
||||
}
|
||||
|
||||
public function checkItemTime(id:String) : Boolean
|
||||
{
|
||||
var createDay:int = 0;
|
||||
var curDay:int = 0;
|
||||
var payData:Object = Table.pay_info[id];
|
||||
var time:Date = new Date();
|
||||
time.setTime(TimeCenter.timestamp * 1000);
|
||||
if(payData.month != null)
|
||||
{
|
||||
if(payData.month != time.month + 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(payData.day != null)
|
||||
{
|
||||
if(payData.day != int(time.date))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(payData.beforeDay != null)
|
||||
{
|
||||
createDay = Calendar.getDayNumber(Master.createTime);
|
||||
curDay = Calendar.getDayNumber();
|
||||
if(curDay - createDay > payData.beforeDay)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
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.myr.panel.mainmenu.MainMenu;
|
||||
import net.pixvi.myr.panel.randomevent.FarmEventImgPanel;
|
||||
import net.pixvi.myr.panel.randomevent.FarmEventStoryPanel;
|
||||
import net.pixvi.myr.panel.story.StoryPanel;
|
||||
import net.pixvi.myr.panel.taskstartpanel.TaskStartPanel;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
import net.pixvi.psg.ui.PSGPopPanel;
|
||||
|
||||
public class PosCenter extends Singleton
|
||||
{
|
||||
|
||||
public var curPos:String;
|
||||
|
||||
public function PosCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function activity(pos:String) : void
|
||||
{
|
||||
getIns().activity(pos);
|
||||
String(123);
|
||||
}
|
||||
|
||||
public static function getIns() : PosCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(PosCenter) as PosCenter;
|
||||
}
|
||||
|
||||
public function activity(pos:String) : void
|
||||
{
|
||||
curPos = pos;
|
||||
update();
|
||||
}
|
||||
|
||||
public function update() : void
|
||||
{
|
||||
var task:TaskVo = null;
|
||||
var i:int = 0;
|
||||
var event:RandomEventVo = null;
|
||||
var npcList:Array = [];
|
||||
var tasks:Array = Master.tasks;
|
||||
for(i = 0; i < tasks.length; )
|
||||
{
|
||||
task = tasks[i];
|
||||
if(!task.canFinish() && task.stepVo != null && task.stepVo.hasTalk(curPos) && task.stepVo.canShow() && task.closed != true)
|
||||
{
|
||||
if(task.stepVo.auto)
|
||||
{
|
||||
if(!TaskStartPanel.getIns().showing)
|
||||
{
|
||||
talkHandler(new MYREvent(MYREvent.TALK,task));
|
||||
}
|
||||
break;
|
||||
}
|
||||
npcList.push(task);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if(Master.history.openRandomEvent && RandomEventCenter.getIns().atLeastRefreshOnce)
|
||||
{
|
||||
for each(var eventTypeId:String in Master.randomEvent)
|
||||
{
|
||||
event = new RandomEventVo();
|
||||
event.typeId = eventTypeId;
|
||||
if(event.hasTalk(curPos))
|
||||
{
|
||||
npcList.push(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
for each(var posnpc:PositionNPC in Table.npc_position)
|
||||
{
|
||||
if(posnpc.position == curPos && posnpc.condition.check() && posnpc.random >= Math.random())
|
||||
{
|
||||
npcList.push(posnpc);
|
||||
}
|
||||
}
|
||||
MainMenu.getIns().ui.list_npc.setDatas(npcList);
|
||||
MainMenu.getIns().ui.list_npc.addEventListener(MYREvent.TALK,talkHandler);
|
||||
MainMenu.getIns().ui.npcListReshow();
|
||||
}
|
||||
|
||||
public function talkHandler(e:MYREvent = null) : void
|
||||
{
|
||||
var p:PSGPopPanel = null;
|
||||
var event:RandomEventVo = null;
|
||||
var posnpc:PositionNPC = null;
|
||||
if(e.data is TaskVo)
|
||||
{
|
||||
p = MainMenu.getIns().curPanel;
|
||||
TaskStartPanel.getIns().start(e.data as TaskVo,p);
|
||||
}
|
||||
else if(e.data is RandomEventVo)
|
||||
{
|
||||
event = e.data as RandomEventVo;
|
||||
if(event.hasPositionStory)
|
||||
{
|
||||
FarmEventStoryPanel.getIns().startEvent(event,MainMenu.getIns().curPanel);
|
||||
}
|
||||
else
|
||||
{
|
||||
FarmEventImgPanel.getIns().popIn();
|
||||
}
|
||||
}
|
||||
else if(e.data is PositionNPC)
|
||||
{
|
||||
posnpc = e.data as PositionNPC;
|
||||
StoryPanel.getIns().start(posnpc.getStory());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.myr.element.bag.ItemVo;
|
||||
import net.pixvi.myr.element.guide.GSub;
|
||||
import net.pixvi.myr.element.mon.MonsterVo;
|
||||
import net.pixvi.myr.net.NetPotential;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class PotentialCenter
|
||||
{
|
||||
|
||||
private var onAddPotentialComplete:Function;
|
||||
|
||||
private var addPotential_para:Object;
|
||||
|
||||
private var onPotentialLevelUpComplete:Function;
|
||||
|
||||
private var potentialLevelUp_para:Object;
|
||||
|
||||
public function PotentialCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : PotentialCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(PotentialCenter) as PotentialCenter;
|
||||
}
|
||||
|
||||
public function getAddPotentialItem(element:int) : ItemVo
|
||||
{
|
||||
return BagCenter.getIns().getByType(Table.potential_info.potentialElementItem[element]);
|
||||
}
|
||||
|
||||
public function getAddPotentialCostNum() : int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function addPotential(mid:Number, itemId:Number, ability:String = "atk", onComplete:Function = null) : void
|
||||
{
|
||||
onAddPotentialComplete = onComplete;
|
||||
var monvo:MonsterVo = MonsterCenter.getIns().getMonById(mid);
|
||||
var itemvo:ItemVo = getAddPotentialItem(monvo.element);
|
||||
addPotential_para = {
|
||||
"mon":monvo,
|
||||
"ability":ability,
|
||||
"item":itemvo
|
||||
};
|
||||
var traceinfo:Object = {
|
||||
"itemTypeId":itemvo.id,
|
||||
"itemNum":itemvo.num
|
||||
};
|
||||
NetPotential.getIns().addPotential(mid,itemvo.id,ability,addPotentialHandler,traceinfo);
|
||||
}
|
||||
|
||||
private function addPotentialHandler(newptAtk:int, newptDef:int, newptHp:int, newptDex:int) : void
|
||||
{
|
||||
var mon:MonsterVo = addPotential_para.mon;
|
||||
var ability:String = addPotential_para.ability;
|
||||
var itemvo:ItemVo = addPotential_para.item;
|
||||
switch(ability)
|
||||
{
|
||||
case "atk":
|
||||
mon.potential_atk.val = newptAtk;
|
||||
break;
|
||||
case "def":
|
||||
mon.potential_def.val = newptDef;
|
||||
break;
|
||||
case "hp":
|
||||
mon.potential_hp.val = newptHp;
|
||||
break;
|
||||
case "dex":
|
||||
mon.potential_dex.val = newptDex;
|
||||
}
|
||||
BagCenter.getIns().subNum(itemvo.id,getAddPotentialCostNum());
|
||||
TaskCenter.getIns().activityLockStatus(GSub.POTENTIAL_OVER);
|
||||
if(onAddPotentialComplete != null)
|
||||
{
|
||||
onAddPotentialComplete();
|
||||
onAddPotentialComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function potentialLevelUp(mid:Number, onComplete:Function) : void
|
||||
{
|
||||
var item:ItemVo = null;
|
||||
onPotentialLevelUpComplete = onComplete;
|
||||
var mon:MonsterVo = MonsterCenter.getIns().getMonById(mid);
|
||||
var elementItems:Object = Table.potential_info.elementItem[mon.element];
|
||||
var need:Object = Table.potential_info.potentialLevelItem[mon.star][mon.potentialLevel];
|
||||
var itemIds:Array = [];
|
||||
for(var needLv:String in need)
|
||||
{
|
||||
item = BagCenter.getIns().getByType(elementItems[needLv]);
|
||||
itemIds.push(item.id);
|
||||
}
|
||||
potentialLevelUp_para = {
|
||||
"mon":mon,
|
||||
"need":need,
|
||||
"elementItems":elementItems
|
||||
};
|
||||
NetPotential.getIns().potentialLevelUp(mid,itemIds,potentialLevelUpHandler);
|
||||
}
|
||||
|
||||
private function potentialLevelUpHandler(newLevel:int) : void
|
||||
{
|
||||
var item:ItemVo = null;
|
||||
var mon:MonsterVo = potentialLevelUp_para.mon;
|
||||
mon.potentialLevel = newLevel;
|
||||
var need:Object = potentialLevelUp_para.need;
|
||||
var elementItems:Object = potentialLevelUp_para.elementItems;
|
||||
for(var needLv:String in need)
|
||||
{
|
||||
item = BagCenter.getIns().getByType(elementItems[needLv]);
|
||||
BagCenter.getIns().subNumByType(elementItems[needLv],need[needLv]);
|
||||
}
|
||||
Alert.showMsg(lang("潜能成功突破至 阶段{0}",newLevel));
|
||||
potentialLevelUp_para = null;
|
||||
if(onPotentialLevelUpComplete != null)
|
||||
{
|
||||
onPotentialLevelUpComplete(newLevel);
|
||||
onPotentialLevelUpComplete = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,327 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.myr.GameMath;
|
||||
import net.pixvi.myr.battle.view.BattleMon;
|
||||
import net.pixvi.myr.element.battle.BattleData;
|
||||
import net.pixvi.myr.element.battle.BattleTeamVo;
|
||||
import net.pixvi.myr.element.mon.MonsterVo;
|
||||
import net.pixvi.myr.element.pve.PveAreaInfoVo;
|
||||
import net.pixvi.myr.element.pve.PveCharaDataVo;
|
||||
import net.pixvi.myr.element.pve.PveInfoVo;
|
||||
import net.pixvi.myr.element.pve.PveRankVo;
|
||||
import net.pixvi.myr.element.reward.RewardResultVo;
|
||||
import net.pixvi.myr.net.NetPve;
|
||||
import net.pixvi.pfw.utils.Random;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class PveCenter extends Singleton
|
||||
{
|
||||
|
||||
public var botInited:Boolean = false;
|
||||
|
||||
private var onGetPveInfoComplete:Function;
|
||||
|
||||
private var onStartPveComplete:Function;
|
||||
|
||||
public var pve_me:PveCharaDataVo;
|
||||
|
||||
public var pve_enemy:PveCharaDataVo;
|
||||
|
||||
public var cur_area:PveAreaInfoVo;
|
||||
|
||||
private var onFinishPveComplete:Function;
|
||||
|
||||
private var onWeekRewardComplete:Function;
|
||||
|
||||
private var weekReward_buff:Object;
|
||||
|
||||
public function PveCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : PveCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(PveCenter) as PveCenter;
|
||||
}
|
||||
|
||||
public function buildCheckVoByBattleMon(battlemon:BattleMon) : Object
|
||||
{
|
||||
var i:int = 0;
|
||||
var mon:Object = {};
|
||||
var pveMonData:Object = battlemon.monVo;
|
||||
mon.mid = pveMonData.monsterId;
|
||||
mon.type = pveMonData.typeId;
|
||||
mon.equips = [];
|
||||
for(i = 1; i <= 5; )
|
||||
{
|
||||
if(pveMonData["equip" + i + "TypeId"] > 0)
|
||||
{
|
||||
mon.equips.push(pveMonData["equip" + i + "TypeId"]);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
mon.atk = pveMonData.atk;
|
||||
mon.def = pveMonData.def;
|
||||
mon.hp = pveMonData.hp;
|
||||
mon.dex = pveMonData.dex;
|
||||
mon.crit = pveMonData.crit;
|
||||
mon.spd_atk_add = pveMonData.atkSpd;
|
||||
mon.atkVim = pveMonData.atkVim;
|
||||
mon.selfCure = pveMonData.selfCure;
|
||||
mon.deadBoom = pveMonData.deadBoom;
|
||||
mon.atkStun = pveMonData.atkStun;
|
||||
mon.defStun = pveMonData.defStun;
|
||||
mon.atkPoi = pveMonData.atkPoi;
|
||||
mon.atkPoiDmg = pveMonData.atkPoiDmg;
|
||||
if(mon.apCost < 1)
|
||||
{
|
||||
mon.apCost = 1;
|
||||
}
|
||||
mon.skillCooldown = pveMonData.skillCooldown;
|
||||
mon.sunFire = pveMonData.sunFire;
|
||||
mon.moonHeal = pveMonData.moonHeal;
|
||||
mon.thorns = pveMonData.thorns;
|
||||
mon.equips = [];
|
||||
return mon;
|
||||
}
|
||||
|
||||
public function getPveAreaInfoByCity(city:int) : PveAreaInfoVo
|
||||
{
|
||||
switch(city - 1)
|
||||
{
|
||||
case 0:
|
||||
return Master.pveInfo.pve_llts;
|
||||
case 1:
|
||||
return Master.pveInfo.pve_lah;
|
||||
case 2:
|
||||
return Master.pveInfo.pve_bslm;
|
||||
case 3:
|
||||
return Master.pveInfo.pve_nslm;
|
||||
case 4:
|
||||
return Master.pveInfo.pve_lrj;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public function getPveInfo(onComplete:Function) : void
|
||||
{
|
||||
onGetPveInfoComplete = onComplete;
|
||||
NetPve.getIns().getPveInfo(getPveInfoHandler);
|
||||
}
|
||||
|
||||
private function getPveInfoHandler(re:Object) : void
|
||||
{
|
||||
var areaInfoVo:PveAreaInfoVo = null;
|
||||
var infovo:PveInfoVo = new PveInfoVo();
|
||||
if(re.pve_llts == null)
|
||||
{
|
||||
re.pve_llts = null;
|
||||
}
|
||||
for(var pveKey:String in re)
|
||||
{
|
||||
areaInfoVo = new PveAreaInfoVo();
|
||||
areaInfoVo.onData(re[pveKey],pveKey);
|
||||
infovo[pveKey] = areaInfoVo;
|
||||
}
|
||||
Master.pveInfo = infovo;
|
||||
if(onGetPveInfoComplete != null)
|
||||
{
|
||||
onGetPveInfoComplete();
|
||||
onGetPveInfoComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function startPve(pveAreaName:String, onComplete:Function) : void
|
||||
{
|
||||
trace("[pve开始匹配]");
|
||||
onStartPveComplete = onComplete;
|
||||
NetPve.getIns().startPve(pveAreaName,startPveHandler);
|
||||
}
|
||||
|
||||
private function startPveHandler(re:Object) : void
|
||||
{
|
||||
if(re.resCode == 100)
|
||||
{
|
||||
Alert.yes("提示","挑战赛暂未开放,请稍后再来吧。");
|
||||
}
|
||||
pve_me = new PveCharaDataVo();
|
||||
pve_me.onData(re.myself);
|
||||
if(re.enemy.masterInfo == null)
|
||||
{
|
||||
trace("[pve没有匹配到玩家]");
|
||||
pve_enemy = getBotVo(cur_area);
|
||||
pve_enemy.isBot = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
trace("[pve匹配到玩家]");
|
||||
pve_enemy = new PveCharaDataVo();
|
||||
pve_enemy.onData(re.enemy);
|
||||
}
|
||||
if(onStartPveComplete != null)
|
||||
{
|
||||
onStartPveComplete();
|
||||
onStartPveComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function finishPve(battleData:BattleData, onComplete:Function) : void
|
||||
{
|
||||
onFinishPveComplete = onComplete;
|
||||
NetPve.getIns().finishPve(cur_area.pveAreaType,battleData,finishPveHandler);
|
||||
}
|
||||
|
||||
private function finishPveHandler(re:Object) : void
|
||||
{
|
||||
var reward:RewardResultVo = RewardCenter.getRewardResultVoByData(re.reward);
|
||||
var finalScore:int = int(re.param.finalScore);
|
||||
cur_area.num++;
|
||||
if(cur_area.score != finalScore)
|
||||
{
|
||||
cur_area.oldScore = cur_area.score;
|
||||
cur_area.score = finalScore;
|
||||
cur_area.hasUpdate = true;
|
||||
}
|
||||
if(onFinishPveComplete != null)
|
||||
{
|
||||
onFinishPveComplete(reward);
|
||||
onFinishPveComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function getBotsByStar(maxStar:int, botType:String = "all") : Array
|
||||
{
|
||||
var i:int = 0;
|
||||
var pveBotData:Object = null;
|
||||
var star:int = 0;
|
||||
i = 0;
|
||||
var pveBotData2:Object = null;
|
||||
var bots:Array = [];
|
||||
if(!botInited)
|
||||
{
|
||||
for(i = 0; i < Table.pve_bot.length; )
|
||||
{
|
||||
pveBotData = Table.pve_bot[i];
|
||||
star = 0;
|
||||
for each(var mondata:Object in pveBotData.teamData.mons)
|
||||
{
|
||||
star += MonsterVo.getStar(mondata.type);
|
||||
}
|
||||
pveBotData.star = star;
|
||||
if(pveBotData.star <= maxStar && (pveBotData.botType == botType || botType == "all"))
|
||||
{
|
||||
bots.push(pveBotData);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
Table.pve_bot.sortOn("zdl",16);
|
||||
}
|
||||
else
|
||||
{
|
||||
i = 0;
|
||||
while(i < Table.pve_bot.length)
|
||||
{
|
||||
pveBotData2 = Table.pve_bot[i];
|
||||
if(pveBotData2.star <= maxStar && (pveBotData2.botType == botType || botType == "all"))
|
||||
{
|
||||
bots.push(pveBotData2);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return bots;
|
||||
}
|
||||
|
||||
public function getBotVo(area:PveAreaInfoVo) : PveCharaDataVo
|
||||
{
|
||||
var i:int = 0;
|
||||
var getBots:Array = getBotsByStar(Table.pve_info.pveArea[area.pveAreaType].maxStar,Table.pve_info.pveArea[area.pveAreaType].botType);
|
||||
var myTeamZdl:int = TeamCenter.getIns().getTeamZdl(area.pveAreaType);
|
||||
trace("[pve我方总战力]",myTeamZdl);
|
||||
var bots:Array = [];
|
||||
for(i = 0; i < getBots.length; )
|
||||
{
|
||||
if(Math.abs(myTeamZdl - getBots[i].zdl) < myTeamZdl * 0.3)
|
||||
{
|
||||
bots.push(getBots[i]);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if(bots.length == 0)
|
||||
{
|
||||
if(myTeamZdl > getBots[getBots.length - 1])
|
||||
{
|
||||
trace("[pve触发上限机器人保底]");
|
||||
bots.push(bots[bots.length - 1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
trace("[pve触发下限机器人保底]");
|
||||
bots.push(getBots[0],getBots[1],getBots[2]);
|
||||
}
|
||||
}
|
||||
var bot:Object = Random.element(bots);
|
||||
trace("[pve机器人战力]",bot.zdl);
|
||||
var pveCharaDataVo:PveCharaDataVo = new PveCharaDataVo();
|
||||
pveCharaDataVo.onBot(bot,area);
|
||||
return pveCharaDataVo;
|
||||
}
|
||||
|
||||
public function getPveBattleTeamVo(area:PveAreaInfoVo, enemyData:PveCharaDataVo) : BattleTeamVo
|
||||
{
|
||||
var enemyTeamVo:BattleTeamVo = new BattleTeamVo();
|
||||
enemyTeamVo.ai = 2;
|
||||
enemyTeamVo.ai_search = 2;
|
||||
enemyTeamVo.apMax = enemyTeamVo.ap = GameMath.apByLevel(enemyData.masterInfo.level);
|
||||
enemyTeamVo.numMax = area.getNumMax(GameMath.getStageNumByLevel(enemyData.masterInfo.level));
|
||||
enemyTeamVo.team = 2;
|
||||
enemyTeamVo.name = enemyData.masterInfo.roleName;
|
||||
enemyTeamVo.mons = enemyData.pveBattleData.pveBattleMonVoArray;
|
||||
return enemyTeamVo;
|
||||
}
|
||||
|
||||
public function getRankByScore(score:int) : PveRankVo
|
||||
{
|
||||
var vo:Object = null;
|
||||
var rankinfo:Object = null;
|
||||
for(var keytype:String in Table.pve_info.rankInfo)
|
||||
{
|
||||
rankinfo = Table.pve_info.rankInfo[keytype];
|
||||
if(score >= rankinfo.score && (vo == null || vo.score < rankinfo.score))
|
||||
{
|
||||
vo = rankinfo;
|
||||
}
|
||||
}
|
||||
var rankvo:PveRankVo = new PveRankVo();
|
||||
rankvo.rankType = vo.type;
|
||||
return rankvo;
|
||||
}
|
||||
|
||||
public function weekReward(pveAreaName:String, onComplete:Function) : void
|
||||
{
|
||||
onWeekRewardComplete = onComplete;
|
||||
weekReward_buff = {"pveAreaName":pveAreaName};
|
||||
NetPve.getIns().weekReward(pveAreaName,weekRewardHandler);
|
||||
}
|
||||
|
||||
private function weekRewardHandler(re:Object) : void
|
||||
{
|
||||
RewardCenter.getIns().getRewardByData(re.reward,true,"panel");
|
||||
getAreaByAreaType(weekReward_buff.pveAreaName).weekRewardGet = true;
|
||||
if(onWeekRewardComplete != null)
|
||||
{
|
||||
onWeekRewardComplete();
|
||||
onWeekRewardComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function getAreaByAreaType(type:String) : PveAreaInfoVo
|
||||
{
|
||||
return Master.pveInfo[type];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.common.driver.ClockDriver;
|
||||
import net.pixvi.myr.element.randomevent.RandomEventType;
|
||||
import net.pixvi.myr.element.reward.RewardResultVo;
|
||||
import net.pixvi.myr.event.MYREvent;
|
||||
import net.pixvi.myr.net.NetRandomEvent;
|
||||
import net.pixvi.pfw.event.PiEvent;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class RandomEventCenter
|
||||
{
|
||||
|
||||
public var atLeastRefreshOnce:Boolean = false;
|
||||
|
||||
private var farmEventChecking:Boolean = false;
|
||||
|
||||
private var onFinishFarmEventComplete:Function;
|
||||
|
||||
private var finishFarmEvent_para:Object;
|
||||
|
||||
public function RandomEventCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : RandomEventCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(RandomEventCenter) as RandomEventCenter;
|
||||
}
|
||||
|
||||
public function get farmEventCooldown() : Boolean
|
||||
{
|
||||
if(Master.randomEventTimer[RandomEventType.FARM_TIMER_NAME] == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if(Master.randomEventTimer[RandomEventType.FARM_TIMER_NAME] < TimeCenter.timestamp * 1000)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function hasFarmEvent() : Boolean
|
||||
{
|
||||
if(Master.randomEvent[RandomEventType.FARM_TIMER_NAME] != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function autoCheckFarmEvent() : void
|
||||
{
|
||||
if(farmEventChecking)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(farmEventCooldown)
|
||||
{
|
||||
trace("牧场事件冷却!刷新牧场事件。");
|
||||
Master.randomEventTimer[RandomEventType.FARM_TIMER_NAME] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
atLeastRefreshOnce = true;
|
||||
}
|
||||
if(Master.randomEventTimer[RandomEventType.FARM_TIMER_NAME] < TimeCenter.timestamp * 1000)
|
||||
{
|
||||
farmEventChecking = true;
|
||||
NetRandomEvent.getIns().getFarmEvent(getFarmEventHandler);
|
||||
}
|
||||
}
|
||||
|
||||
public function getFarmEventHandler(hasEvent:Boolean, synchroTime:Object, farmEventType:String, masterEventTimer:Object) : void
|
||||
{
|
||||
if(synchroTime != null)
|
||||
{
|
||||
ClockDriver.getIns().timestamp = (synchroTime as Number) / 1000 - 1;
|
||||
return;
|
||||
}
|
||||
if(hasEvent)
|
||||
{
|
||||
Master.randomEvent[RandomEventType.FARM_TIMER_NAME] = farmEventType;
|
||||
}
|
||||
Master.randomEventTimer = masterEventTimer;
|
||||
atLeastRefreshOnce = true;
|
||||
GlobalBroadcast.dispatchEvent(new PiEvent(MYREvent.RANDOM_EVENT_CHANGE));
|
||||
farmEventChecking = false;
|
||||
}
|
||||
|
||||
public function finishFarmEvent(onComplete:Function) : void
|
||||
{
|
||||
onFinishFarmEventComplete = onComplete;
|
||||
finishFarmEvent_para = {"typeId":Master.randomEvent[RandomEventType.FARM_TIMER_NAME]};
|
||||
NetRandomEvent.getIns().finishFarmEvent(finishFarmEventHandler);
|
||||
}
|
||||
|
||||
public function finishFarmEventHandler(rewardData:Object, getTasks:Array, unlockTasks:Array) : void
|
||||
{
|
||||
var i:int = 0;
|
||||
delete Master.randomEvent[RandomEventType.FARM_TIMER_NAME];
|
||||
var rewardresultvo:RewardResultVo = RewardCenter.getIns().getRewardByData(rewardData,false);
|
||||
if(getTasks != null && getTasks.length > 0)
|
||||
{
|
||||
for each(var taskvo:Object in getTasks)
|
||||
{
|
||||
TaskCenter.getIns().addLocalTask(TaskCenter.getTaskByTaskData(taskvo));
|
||||
}
|
||||
}
|
||||
if(unlockTasks != null && unlockTasks.length > 0)
|
||||
{
|
||||
for(i = 0; i < unlockTasks.length; )
|
||||
{
|
||||
unlockTasks[i];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
GlobalBroadcast.dispatchEvent(new PiEvent(MYREvent.RANDOM_EVENT_CHANGE));
|
||||
finishFarmEvent_para = null;
|
||||
if(onFinishFarmEventComplete != null)
|
||||
{
|
||||
onFinishFarmEventComplete(rewardresultvo);
|
||||
onFinishFarmEventComplete = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.myr.element.rank.RankVo;
|
||||
import net.pixvi.myr.net.NetRank;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class RankCenter extends Singleton
|
||||
{
|
||||
|
||||
public var buffRanks:Object = {};
|
||||
|
||||
public var buffTime:int = 180;
|
||||
|
||||
private var onGetRankComplete:Function;
|
||||
|
||||
private var getRank_type:String;
|
||||
|
||||
public function RankCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : RankCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(RankCenter) as RankCenter;
|
||||
}
|
||||
|
||||
public function getRank(type:String, onComplete:Function) : void
|
||||
{
|
||||
var buffRank:RankVo = null;
|
||||
onGetRankComplete = onComplete;
|
||||
if(buffRanks[type] != null)
|
||||
{
|
||||
buffRank = buffRanks[type];
|
||||
if(TimeCenter.timestamp - buffRank.rankTime < buffTime)
|
||||
{
|
||||
onComplete(buffRank);
|
||||
return;
|
||||
}
|
||||
}
|
||||
getRank_type = type;
|
||||
var para:Object = {"rankName":type};
|
||||
NetRank.getIns().getRank(type,getRankHandler);
|
||||
}
|
||||
|
||||
private function getRankHandler(re:Object) : void
|
||||
{
|
||||
var rankvo:RankVo = new RankVo();
|
||||
rankvo.rankTime = TimeCenter.timestamp;
|
||||
rankvo.rankType = getRank_type;
|
||||
rankvo.onData(re);
|
||||
buffRanks[rankvo.rankType] = rankvo;
|
||||
if(onGetRankComplete != null)
|
||||
{
|
||||
onGetRankComplete(rankvo);
|
||||
onGetRankComplete = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.myr.element.reward.RewardResultVo;
|
||||
import net.pixvi.myr.event.MYREvent;
|
||||
import net.pixvi.myr.panel.reward.RewardShowPanel;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class RewardCenter
|
||||
{
|
||||
|
||||
public function RewardCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : RewardCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(RewardCenter) as RewardCenter;
|
||||
}
|
||||
|
||||
public static function getRewardResultVoByData(data:Object) : RewardResultVo
|
||||
{
|
||||
var reward:RewardResultVo = new RewardResultVo();
|
||||
reward.exp = data.exp;
|
||||
reward.ke = data.ke;
|
||||
reward.money = data.money;
|
||||
reward.ti = data.ti;
|
||||
reward.items = data.items;
|
||||
reward.monsters = data.monsters;
|
||||
return reward;
|
||||
}
|
||||
|
||||
public function getReward(reward:RewardResultVo, show:Boolean = false, showMode:String = "alert", onShowPanelComplete:Function = null, checkLevelUp:Boolean = true) : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var j:int = 0;
|
||||
var showalert:Boolean = false;
|
||||
if(show && showMode == "alert")
|
||||
{
|
||||
showalert = true;
|
||||
}
|
||||
MasterCenter.getIns().addMoney(reward.money,showalert);
|
||||
MasterCenter.getIns().addKe(reward.ke,showalert);
|
||||
MasterCenter.getIns().addTi(reward.ti,showalert);
|
||||
MasterCenter.getIns().addExp(reward.exp,showalert);
|
||||
var mons:Array = reward.getMonsters();
|
||||
var items:Array = reward.getItems();
|
||||
for(i = 0; i < items.length; )
|
||||
{
|
||||
BagCenter.getIns().addItem(items[i]);
|
||||
i++;
|
||||
}
|
||||
for(j = 0; j < mons.length; )
|
||||
{
|
||||
MonsterCenter.getIns().getLocalMonster(mons[j]);
|
||||
j++;
|
||||
}
|
||||
if(show && showMode == "panel")
|
||||
{
|
||||
if(reward.exp == 0)
|
||||
{
|
||||
checkLevelUp = false;
|
||||
}
|
||||
RewardShowPanel.showByVo(reward,onShowPanelComplete,checkLevelUp);
|
||||
}
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.ITEM_NUM_CHANGE,null));
|
||||
}
|
||||
|
||||
public function getRewardByData(data:Object, show:Boolean = false, showMode:String = "alert", onShowPanelComplete:Function = null) : RewardResultVo
|
||||
{
|
||||
var res:RewardResultVo = getRewardResultVoByData(data);
|
||||
getReward(res,show,showMode,onShowPanelComplete);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,218 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.myr.CP;
|
||||
import net.pixvi.myr.element.guide.GSub;
|
||||
import net.pixvi.myr.element.room.RoomVo;
|
||||
import net.pixvi.myr.event.MYREvent;
|
||||
import net.pixvi.myr.net.NetRoom;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class RoomCenter extends Singleton
|
||||
{
|
||||
|
||||
private var onBuyRoomComplete:Function;
|
||||
|
||||
private var BuyRoom_para:Object;
|
||||
|
||||
private var onBuyKeRoomComplete:Function;
|
||||
|
||||
private var BuyKeRoom_para:Object;
|
||||
|
||||
private var onEditRoomComplete:Function;
|
||||
|
||||
private var editRoom_para:Object;
|
||||
|
||||
public function RoomCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getRoomByRoomData(roomData:Object) : RoomVo
|
||||
{
|
||||
var room:RoomVo = new RoomVo();
|
||||
room.id = roomData.id;
|
||||
room.type = roomData.typeId;
|
||||
room.openType = roomData.openType;
|
||||
return room;
|
||||
}
|
||||
|
||||
public static function getIns() : RoomCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(RoomCenter) as RoomCenter;
|
||||
}
|
||||
|
||||
public function addRoom(room:RoomVo) : RoomVo
|
||||
{
|
||||
Master.rooms.push(room);
|
||||
room.sort = room.position;
|
||||
return room;
|
||||
}
|
||||
|
||||
public function buyRoom(onComplete:Function) : void
|
||||
{
|
||||
onBuyRoomComplete = onComplete;
|
||||
var val:Object = Table.room_price[Master.history.numAddRoom];
|
||||
BuyRoom_para = {"money":val.money};
|
||||
NetRoom.getIns().createRoom(1,buyRoomHandler);
|
||||
}
|
||||
|
||||
private function buyRoomHandler(roomData:Object) : void
|
||||
{
|
||||
MasterCenter.getIns().addMoney(-BuyRoom_para.money,true);
|
||||
var roomvo:RoomVo = RoomCenter.getRoomByRoomData(roomData);
|
||||
addRoom(roomvo);
|
||||
Master.history.countRoom++;
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.ROOM_ADD,roomvo));
|
||||
if(onBuyRoomComplete != null)
|
||||
{
|
||||
onBuyRoomComplete();
|
||||
onBuyRoomComplete = null;
|
||||
BuyRoom_para = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function buyKeRoom(onComplete:Function) : void
|
||||
{
|
||||
onBuyKeRoomComplete = onComplete;
|
||||
var val:Object = Table.room_price[Master.history.numKeAddRoom];
|
||||
BuyKeRoom_para = {"ke":val.ke};
|
||||
NetRoom.getIns().createRoom(2,buyKeRoomHandler);
|
||||
}
|
||||
|
||||
private function buyKeRoomHandler(roomData:Object) : void
|
||||
{
|
||||
MasterCenter.getIns().addKe(-BuyKeRoom_para.ke,true);
|
||||
var roomvo:RoomVo = RoomCenter.getRoomByRoomData(roomData);
|
||||
addRoom(roomvo);
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.ROOM_ADD,roomvo));
|
||||
if(onBuyKeRoomComplete != null)
|
||||
{
|
||||
onBuyKeRoomComplete();
|
||||
onBuyKeRoomComplete = null;
|
||||
BuyKeRoom_para = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function editRoom(room:RoomVo, type:Object, useVoucher:Boolean, onComplete:Function) : void
|
||||
{
|
||||
onEditRoomComplete = onComplete;
|
||||
if(useVoucher)
|
||||
{
|
||||
editRoom_para = {
|
||||
"oname":room.autoName,
|
||||
"room":room,
|
||||
"need":type.voucherNeed,
|
||||
"type":type.type,
|
||||
"needMoney":0,
|
||||
"needKe":0
|
||||
};
|
||||
NetRoom.getIns().editRoom(room.id,type.type,true,editRoomHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
editRoom_para = {
|
||||
"oname":room.autoName,
|
||||
"room":room,
|
||||
"need":type.need,
|
||||
"type":type.type,
|
||||
"needMoney":type.needMoney,
|
||||
"needKe":type.needKe
|
||||
};
|
||||
NetRoom.getIns().editRoom(room.id,type.type,false,editRoomHandler);
|
||||
}
|
||||
}
|
||||
|
||||
private function editRoomHandler(re:Object = null) : void
|
||||
{
|
||||
editRoom_para.room.type = editRoom_para.type;
|
||||
MasterCenter.getIns().addMoney(-editRoom_para.needMoney);
|
||||
MasterCenter.getIns().addKe(-editRoom_para.needKe);
|
||||
BagCenter.getIns().subLocalNeed(editRoom_para.need);
|
||||
TaskCenter.getIns().activityLockStatus(GSub.TASK_STATUS_BUILD);
|
||||
var notice:String = lang("改造 {0} 成为 {1}",CP.room(int(editRoom_para.room.position) + 1 + ":" + editRoom_para.oname),CP.room(int(editRoom_para.room.position) + 1 + ":" + editRoom_para.room.autoName));
|
||||
Alert.showMsg(notice,3000);
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.ROOM_EDIT,{"room":editRoom_para.room}));
|
||||
if(onEditRoomComplete != null)
|
||||
{
|
||||
onEditRoomComplete();
|
||||
onEditRoomComplete = null;
|
||||
editRoom_para = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function getRoomById(id:int) : RoomVo
|
||||
{
|
||||
for each(var r:RoomVo in Master.rooms)
|
||||
{
|
||||
if(r.id == id)
|
||||
{
|
||||
return r;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getRoomWithPosition(roomVo:RoomVo, float:int) : RoomVo
|
||||
{
|
||||
var flag:int = Master.rooms.indexOf(roomVo) + float;
|
||||
if(flag < 0)
|
||||
{
|
||||
flag = 0;
|
||||
}
|
||||
if(flag >= Master.rooms.length)
|
||||
{
|
||||
flag = Master.rooms.length - 1;
|
||||
}
|
||||
return Master.rooms[flag];
|
||||
}
|
||||
|
||||
public function getRoomWithSort(roomVo:RoomVo, float:int) : RoomVo
|
||||
{
|
||||
var rooms:Array = MasterCenter.getIns().getSortedRoomArray();
|
||||
var flag:int = rooms.indexOf(roomVo) + float;
|
||||
if(flag < 0)
|
||||
{
|
||||
flag = 0;
|
||||
}
|
||||
if(flag >= rooms.length)
|
||||
{
|
||||
flag = rooms.length - 1;
|
||||
}
|
||||
return rooms[flag];
|
||||
}
|
||||
|
||||
public function getRoomByPosition(position:int) : RoomVo
|
||||
{
|
||||
return Master.rooms[position];
|
||||
}
|
||||
|
||||
public function getRoomBySort(sort:int) : RoomVo
|
||||
{
|
||||
var rooms:Array = MasterCenter.getIns().getSortedRoomArray();
|
||||
if(rooms[sort] != null)
|
||||
{
|
||||
return rooms[sort];
|
||||
}
|
||||
return getRoomByPosition(sort);
|
||||
}
|
||||
|
||||
public function getRoomMonster(roomid:int) : Array
|
||||
{
|
||||
var i:int = 0;
|
||||
var mons:Array = [];
|
||||
for(i = 0; i < Master.monsters.length; )
|
||||
{
|
||||
if(Master.monsters[i].roomId == roomid)
|
||||
{
|
||||
mons.push(Master.monsters[i]);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return mons;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,304 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.myr.element.cost.CostVo;
|
||||
import net.pixvi.myr.element.npc.ConditionVo;
|
||||
import net.pixvi.myr.element.reward.RewardResultVo;
|
||||
import net.pixvi.myr.net.NetExchange;
|
||||
import net.pixvi.myr.net.NetShop;
|
||||
import net.pixvi.myr.panel.reward.RewardShowPanel;
|
||||
import net.pixvi.myr.util.MyrCalendar;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class ShopCenter extends Singleton
|
||||
{
|
||||
|
||||
public static var lastUpdateDay:int = -1;
|
||||
|
||||
public var moneyShopInfo:Array;
|
||||
|
||||
public var keShopInfo:Array;
|
||||
|
||||
private var refreshShopInfo_para:int;
|
||||
|
||||
private var onRefreshShopInfoComplete:Function;
|
||||
|
||||
private var onBuyShopItemComplete:Function;
|
||||
|
||||
private var buyShopItem_para:Object;
|
||||
|
||||
private var onExchangeItemComplete:Function;
|
||||
|
||||
private var exchangeItem_id:String = "";
|
||||
|
||||
private var exchangeNum:int = 0;
|
||||
|
||||
private var exchange_showReward:Boolean = false;
|
||||
|
||||
public function ShopCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : ShopCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(ShopCenter) as ShopCenter;
|
||||
}
|
||||
|
||||
public function getItemsByTeamAndCostType(team:String = "shop", costType:String = "all") : Array
|
||||
{
|
||||
var i:int = 0;
|
||||
i = 0;
|
||||
var j:int = 0;
|
||||
var vo:ConditionVo = null;
|
||||
var arr:Array = [];
|
||||
if(costType == "all" || costType == "ke")
|
||||
{
|
||||
for(i = 0; i < keShopInfo.length; )
|
||||
{
|
||||
if(Table.shop_info[keShopInfo[i].id] != null)
|
||||
{
|
||||
if(Table.shop_info[keShopInfo[i].id].team == team)
|
||||
{
|
||||
arr.push(keShopInfo[i]);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if(costType == "all" || costType == "money")
|
||||
{
|
||||
for(i = 0; i < moneyShopInfo.length; )
|
||||
{
|
||||
if(Table.shop_info[moneyShopInfo[i].id] != null)
|
||||
{
|
||||
if(Table.shop_info[moneyShopInfo[i].id].team == team)
|
||||
{
|
||||
arr.push(moneyShopInfo[i]);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
for(j = 0; j < arr.length; )
|
||||
{
|
||||
if(arr[j].condition != null)
|
||||
{
|
||||
vo = new ConditionVo(arr[j].condition);
|
||||
if(!vo.check())
|
||||
{
|
||||
arr.splice(j,1);
|
||||
j--;
|
||||
}
|
||||
}
|
||||
j++;
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
public function refreshShopInfo(onComplete:Function) : void
|
||||
{
|
||||
onRefreshShopInfoComplete = onComplete;
|
||||
var todayDate:int = MyrCalendar.getShowDate(TimeCenter.timestamp * 1000).date;
|
||||
if(todayDate == lastUpdateDay)
|
||||
{
|
||||
if(onRefreshShopInfoComplete != null)
|
||||
{
|
||||
onRefreshShopInfoComplete();
|
||||
onRefreshShopInfoComplete = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
refreshShopInfo_para = todayDate;
|
||||
NetShop.getIns().getShopInfo(refreshShopInfoHandler);
|
||||
}
|
||||
}
|
||||
|
||||
private function refreshShopInfoHandler(moneyShopList:Array = null, keShopList:Array = null, shopNum:Object = null) : void
|
||||
{
|
||||
this.moneyShopInfo = moneyShopList;
|
||||
this.keShopInfo = keShopList;
|
||||
this.fixShopNum();
|
||||
for(var key:String in shopNum)
|
||||
{
|
||||
Master.history.shopNum[key] = shopNum[key];
|
||||
}
|
||||
lastUpdateDay = refreshShopInfo_para;
|
||||
if(onRefreshShopInfoComplete != null)
|
||||
{
|
||||
onRefreshShopInfoComplete();
|
||||
onRefreshShopInfoComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function buyShopItem(shopId:int, shopType:int, num:int = 1, onComplete:Function = null) : void
|
||||
{
|
||||
onBuyShopItemComplete = onComplete;
|
||||
buyShopItem_para = {
|
||||
"shopId":shopId,
|
||||
"shopType":shopType,
|
||||
"num":num
|
||||
};
|
||||
NetShop.getIns().buyShopItem(shopId,shopType,num,buyShopItemHandler);
|
||||
}
|
||||
|
||||
private function buyShopItemHandler(itemDatas:Array, costMoney:int, costKe:int) : void
|
||||
{
|
||||
var rewards:RewardResultVo = new RewardResultVo();
|
||||
rewards.items = itemDatas;
|
||||
RewardCenter.getIns().getReward(rewards,true,"panel");
|
||||
MasterCenter.getIns().addMoney(-costMoney,true);
|
||||
MasterCenter.getIns().addKe(-costKe,true);
|
||||
Master.history.shopNum[buyShopItem_para.shopId] += buyShopItem_para.num;
|
||||
buyShopItem_para = null;
|
||||
if(onBuyShopItemComplete != null)
|
||||
{
|
||||
onBuyShopItemComplete();
|
||||
onBuyShopItemComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function fixShopNum() : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var j:int = 0;
|
||||
Master.history.shopNum = {};
|
||||
for(i = 0; i < keShopInfo.length; )
|
||||
{
|
||||
Master.history.shopNum[keShopInfo[i].id] = 0;
|
||||
i++;
|
||||
}
|
||||
for(j = 0; j < moneyShopInfo.length; )
|
||||
{
|
||||
Master.history.shopNum[moneyShopInfo[j].id] = 0;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
public function exchangeItem(exchangeId:String, num:int, onComplete:Function, showReward:Boolean = false) : void
|
||||
{
|
||||
onExchangeItemComplete = onComplete;
|
||||
exchangeItem_id = exchangeId;
|
||||
exchangeNum = num;
|
||||
exchange_showReward = showReward;
|
||||
NetExchange.getIns().exchangeItem(exchangeId,num,exchangeItemHandler);
|
||||
}
|
||||
|
||||
private function exchangeItemHandler(rewardData:Object) : void
|
||||
{
|
||||
var today:int = 0;
|
||||
var preday:int = 0;
|
||||
var rewardResultVo:RewardResultVo = RewardCenter.getRewardResultVoByData(rewardData);
|
||||
RewardCenter.getIns().getReward(rewardResultVo);
|
||||
var cost:CostVo = new CostVo();
|
||||
cost.setByVo(Table.exchange_info[exchangeItem_id].need);
|
||||
if(Table.exchange_info[exchangeItem_id].exchangeCondition != null)
|
||||
{
|
||||
if(Master.history.exchangeNum[exchangeItem_id] == null)
|
||||
{
|
||||
Master.history.exchangeNum[exchangeItem_id] = {
|
||||
"exchangeId":exchangeItem_id,
|
||||
"exchangeNum":exchangeNum,
|
||||
"exchangeTime":TimeCenter.timestamp * 1000
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
today = MyrCalendar.getDayNumber();
|
||||
preday = MyrCalendar.getDayNumber(Master.history.exchangeNum[exchangeItem_id].exchangeTime);
|
||||
if(today != preday)
|
||||
{
|
||||
Master.history.exchangeNum[exchangeItem_id] = {
|
||||
"exchangeId":exchangeItem_id,
|
||||
"exchangeNum":exchangeNum,
|
||||
"exchangeTime":TimeCenter.timestamp * 1000
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
Master.history.exchangeNum[exchangeItem_id].exchangeTime = TimeCenter.timestamp * 1000;
|
||||
Master.history.exchangeNum[exchangeItem_id].exchangeNum += exchangeNum;
|
||||
}
|
||||
}
|
||||
}
|
||||
BagCenter.getIns().subLocalCost(cost,false,exchangeNum,true);
|
||||
if(exchange_showReward)
|
||||
{
|
||||
RewardShowPanel.showByVo(rewardResultVo);
|
||||
}
|
||||
if(onExchangeItemComplete != null)
|
||||
{
|
||||
onExchangeItemComplete(rewardResultVo);
|
||||
onExchangeItemComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function getExchangeDatas(team:String) : Array
|
||||
{
|
||||
var i:int = 0;
|
||||
var data:Object = null;
|
||||
var con:ConditionVo = null;
|
||||
var arr:Array = [];
|
||||
for(i = 0; i < Table.exchange_infoArr.length; i++)
|
||||
{
|
||||
data = Table.exchange_infoArr[i];
|
||||
if(data.condition != null)
|
||||
{
|
||||
con = new ConditionVo();
|
||||
con.ondata(data.condition);
|
||||
if(!con.check())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if(data.team is Array)
|
||||
{
|
||||
if(data.team.indexOf("all") != -1 || data.team.indexOf(team) != -1)
|
||||
{
|
||||
arr.push(data);
|
||||
}
|
||||
}
|
||||
else if(data.team == team || team == "all")
|
||||
{
|
||||
arr.push(data);
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
public function getExchangeLeftNum(id:String) : int
|
||||
{
|
||||
var recordDay:int = 0;
|
||||
var toDay:int = 0;
|
||||
var exchangeData:Object = Table.exchange_info[id];
|
||||
var leftNum:int = 0;
|
||||
if(exchangeData.exchangeCondition != null)
|
||||
{
|
||||
if(Master.history.exchangeNum[exchangeData.id] == null)
|
||||
{
|
||||
leftNum = int(exchangeData.exchangeCondition.exchangeNum);
|
||||
}
|
||||
else if(exchangeData.exchangeCondition.exchangeType == "GLOBAL")
|
||||
{
|
||||
leftNum = exchangeData.exchangeCondition.exchangeNum - Master.history.exchangeNum[exchangeData.id].exchangeNum;
|
||||
}
|
||||
else if(exchangeData.exchangeCondition.exchangeType == "EVERYDAY")
|
||||
{
|
||||
recordDay = MyrCalendar.getDayNumber(Master.history.exchangeNum[exchangeData.id].exchangeTime);
|
||||
toDay = MyrCalendar.getDayNumber();
|
||||
if(toDay != recordDay)
|
||||
{
|
||||
leftNum = int(exchangeData.exchangeCondition.exchangeNum);
|
||||
}
|
||||
else
|
||||
{
|
||||
leftNum = exchangeData.exchangeCondition.exchangeNum - Master.history.exchangeNum[exchangeData.id].exchangeNum;
|
||||
}
|
||||
}
|
||||
return leftNum;
|
||||
}
|
||||
return 2147483647;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.myr.element.mon.MonsterVo;
|
||||
import net.pixvi.myr.element.mon.SkinVo;
|
||||
import net.pixvi.myr.event.MYREvent;
|
||||
import net.pixvi.myr.net.NetSkin;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class SkinCenter
|
||||
{
|
||||
|
||||
private var onSetSkinComplete:Function;
|
||||
|
||||
private var setSkin_buffId:uint;
|
||||
|
||||
private var setSkin_buffSkinType:String;
|
||||
|
||||
public function SkinCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : SkinCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(SkinCenter) as SkinCenter;
|
||||
}
|
||||
|
||||
public function getMonAllSkins(monTypeId:int, includeNormal:Boolean = true, lockSkin:Boolean = true) : Array
|
||||
{
|
||||
var vo:SkinVo = null;
|
||||
var unlockSkins:Array = [];
|
||||
var lockSkins:Array = [];
|
||||
if(includeNormal)
|
||||
{
|
||||
unlockSkins.push(new SkinVo(0,monTypeId));
|
||||
}
|
||||
for(var skinType:String in Table.skin_info)
|
||||
{
|
||||
if(Table.skin_info[skinType].monType == monTypeId.toString())
|
||||
{
|
||||
vo = new SkinVo(int(skinType));
|
||||
if(vo.hide != true)
|
||||
{
|
||||
if(vo.unlock)
|
||||
{
|
||||
unlockSkins.push(vo);
|
||||
}
|
||||
else
|
||||
{
|
||||
lockSkins.push(vo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
unlockSkins.sortOn("typeId",2);
|
||||
lockSkins.sortOn("typeId",2);
|
||||
if(!lockSkin)
|
||||
{
|
||||
return unlockSkins;
|
||||
}
|
||||
return unlockSkins.concat(lockSkins);
|
||||
}
|
||||
|
||||
public function setSkin(monsterId:int, skinTypeId:String, onComplete:Function) : void
|
||||
{
|
||||
onSetSkinComplete = onComplete;
|
||||
setSkin_buffId = monsterId;
|
||||
setSkin_buffSkinType = skinTypeId;
|
||||
NetSkin.getIns().setSkin(monsterId,skinTypeId,setSkinHandler);
|
||||
}
|
||||
|
||||
private function setSkinHandler(re:Object) : void
|
||||
{
|
||||
var vo:MonsterVo = MonsterCenter.getIns().getMonById(setSkin_buffId);
|
||||
vo.skin = int(setSkin_buffSkinType);
|
||||
vo.skinVo = new SkinVo(vo.skin,vo.type);
|
||||
vo.abilityAdd.update(re.monAdd);
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.MONSTER_NUM_CHANGE,{"mon":vo}));
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.MONSTER_SKIN_CHANGE,{"mon":vo}));
|
||||
if(onSetSkinComplete != null)
|
||||
{
|
||||
onSetSkinComplete();
|
||||
onSetSkinComplete = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,479 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.myr.GameMath;
|
||||
import net.pixvi.myr.element.bag.ItemVo;
|
||||
import net.pixvi.myr.element.mon.EggVo;
|
||||
import net.pixvi.myr.element.mon.MonsterVo;
|
||||
import net.pixvi.myr.element.stack.StackOpenType;
|
||||
import net.pixvi.myr.element.stack.StackVo;
|
||||
import net.pixvi.myr.event.MYREvent;
|
||||
import net.pixvi.myr.net.NetStack;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class StackCenter
|
||||
{
|
||||
|
||||
private var onAddQuality:Function;
|
||||
|
||||
private var addQuality_buffStackId:Number;
|
||||
|
||||
private var addQuality_buffAddPara:String;
|
||||
|
||||
private var speedEgg_para:Object;
|
||||
|
||||
private var onSpeedEggComplete:Function;
|
||||
|
||||
private var onBuyStackComplete:Function;
|
||||
|
||||
private var buyStack_para:Object;
|
||||
|
||||
private var onBuyKeStackComplete:Function;
|
||||
|
||||
private var buyKeStack_para:Object;
|
||||
|
||||
private var fillEggsToStack_para:Object;
|
||||
|
||||
private var onFillEggsToStackComplete:Function;
|
||||
|
||||
private var autoFilling:Boolean = false;
|
||||
|
||||
private var onAutoFillEggToStackComplete:Function;
|
||||
|
||||
private var onMoveMonsToRoomComplete:Function;
|
||||
|
||||
private var moveMonsToRoom_datas:Object;
|
||||
|
||||
public function StackCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : StackCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(StackCenter) as StackCenter;
|
||||
}
|
||||
|
||||
public static function getStackByStackData(stackData:Object) : StackVo
|
||||
{
|
||||
var stack:StackVo = new StackVo();
|
||||
stack.id = stackData.id;
|
||||
stack.position = stackData.position;
|
||||
stack.openType = stackData.openType;
|
||||
stack.monsterId = stackData.monsterId;
|
||||
stack.hpNum = stackData.hpNum;
|
||||
stack.atkNum = stackData.atkNum;
|
||||
stack.defNum = stackData.defNum;
|
||||
stack.dexNum = stackData.dexNum;
|
||||
return stack;
|
||||
}
|
||||
|
||||
public function addQuality(stackId:Number, addPara:String, onComplete:Function) : void
|
||||
{
|
||||
onAddQuality = onComplete;
|
||||
addQuality_buffStackId = stackId;
|
||||
addQuality_buffAddPara = addPara;
|
||||
NetStack.getIns().addQuality(stackId,addPara,addQualityHandler);
|
||||
}
|
||||
|
||||
private function addQualityHandler(re:Object) : void
|
||||
{
|
||||
var addStack:StackVo = getStackById(addQuality_buffStackId);
|
||||
BagCenter.getIns().subNumByType(addStack.getMon().getJxhItemType(),1);
|
||||
addStack[addQuality_buffAddPara + "Num"]++;
|
||||
if(onAddQuality != null)
|
||||
{
|
||||
onAddQuality(re);
|
||||
onAddQuality = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function speedEgg(mid:Number, itemNum:int, onComplete:Function) : void
|
||||
{
|
||||
onSpeedEggComplete = onComplete;
|
||||
var vo:MonsterVo = MonsterCenter.getIns().getMonById(mid);
|
||||
speedEgg_para = {
|
||||
"mon":vo,
|
||||
"num":itemNum
|
||||
};
|
||||
NetStack.getIns().speedMonsters(mid,itemNum,speedEggHandler);
|
||||
}
|
||||
|
||||
private function speedEggHandler(newStartTime:uint) : void
|
||||
{
|
||||
speedEgg_para.mon.timeStart = newStartTime;
|
||||
var itemvo:ItemVo = BagCenter.getIns().getByType(GameMath.speedItemId);
|
||||
BagCenter.getIns().subNum(itemvo.id,speedEgg_para.num,true);
|
||||
if(onSpeedEggComplete != null)
|
||||
{
|
||||
onSpeedEggComplete();
|
||||
onSpeedEggComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function countEmptyStack() : int
|
||||
{
|
||||
var i:int = 0;
|
||||
for each(var s:StackVo in Master.stacks)
|
||||
{
|
||||
if(s.isEmpty)
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
public function buyStack(position:int, onComplete:Function) : void
|
||||
{
|
||||
onBuyStackComplete = onComplete;
|
||||
var val:Object = Table.stack_price[Master.history.numAddStack];
|
||||
buyStack_para = {"money":val.money};
|
||||
NetStack.getIns().addStack(StackOpenType.GOLD,position,buyStackHandler);
|
||||
}
|
||||
|
||||
private function buyStackHandler(reStackData:Object) : void
|
||||
{
|
||||
var stackvo:StackVo = StackCenter.getStackByStackData(reStackData);
|
||||
addStack(stackvo);
|
||||
MasterCenter.getIns().addMoney(-buyStack_para.money,true);
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.STACK_ADD,stackvo));
|
||||
if(onBuyStackComplete != null)
|
||||
{
|
||||
onBuyStackComplete();
|
||||
onBuyStackComplete = null;
|
||||
buyStack_para = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function buyKeStack(position:int, onComplet:Function) : void
|
||||
{
|
||||
onBuyKeStackComplete = onComplet;
|
||||
var val:Object = Table.stack_price[Master.history.numKeAddStack];
|
||||
buyKeStack_para = {"ke":val.ke};
|
||||
NetStack.getIns().addStack(StackOpenType.KE,position,buyKeStackHandler);
|
||||
}
|
||||
|
||||
private function buyKeStackHandler(reStackData:Object) : void
|
||||
{
|
||||
var stackvo:StackVo = StackCenter.getStackByStackData(reStackData);
|
||||
addStack(stackvo);
|
||||
MasterCenter.getIns().addKe(-buyKeStack_para.ke,true);
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.STACK_ADD,stackvo));
|
||||
if(onBuyKeStackComplete != null)
|
||||
{
|
||||
onBuyKeStackComplete();
|
||||
onBuyKeStackComplete = null;
|
||||
buyKeStack_para = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function getStackByMonster(mid:Number) : StackVo
|
||||
{
|
||||
for each(var s:StackVo in Master.stacks)
|
||||
{
|
||||
if(s.monsterId == mid)
|
||||
{
|
||||
return s;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function addStack(stackvo:StackVo) : StackVo
|
||||
{
|
||||
Master.stacks.push(stackvo);
|
||||
return stackvo;
|
||||
}
|
||||
|
||||
public function fillEggsToStack(pushs:Array, sendEvent:Boolean = true, onComplete:Function = null) : void
|
||||
{
|
||||
onFillEggsToStackComplete = onComplete;
|
||||
fillEggsToStack_para = {
|
||||
"sendEvent":sendEvent,
|
||||
"pushs":pushs
|
||||
};
|
||||
NetStack.getIns().pushEgg(pushs,fillEggsToStackHandler);
|
||||
}
|
||||
|
||||
private function fillEggsToStackHandler(gets:Array) : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var stackId:int = 0;
|
||||
var monster:MonsterVo = null;
|
||||
var j:int = 0;
|
||||
var push:Object = null;
|
||||
for(i = 0; i < gets.length; )
|
||||
{
|
||||
stackId = int(gets[i].stackId);
|
||||
monster = MonsterCenter.getMonByMonData(gets[i].monster);
|
||||
getStackById(stackId).monsterId = monster.id;
|
||||
MonsterCenter.getIns().getLocalMonster(monster);
|
||||
if(fillEggsToStack_para.sendEvent)
|
||||
{
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.MONSTER_ADD_STACK,monster));
|
||||
}
|
||||
i++;
|
||||
}
|
||||
for(j = 0; j < fillEggsToStack_para.pushs.length; )
|
||||
{
|
||||
push = fillEggsToStack_para.pushs[j];
|
||||
BagCenter.getIns().subNum(push.itemId,1);
|
||||
j++;
|
||||
}
|
||||
fillEggsToStack_para = null;
|
||||
if(onFillEggsToStackComplete != null)
|
||||
{
|
||||
onFillEggsToStackComplete();
|
||||
onFillEggsToStackComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function autoFillEggToStack(mode:int = 1, onComplete:Function = null, eggvo:EggVo = null) : int
|
||||
{
|
||||
var eggs:Array = null;
|
||||
var k:int = 0;
|
||||
var eg:EggVo = null;
|
||||
var eggnum:int = 0;
|
||||
var j:int = 0;
|
||||
var count:int = 0;
|
||||
var pushs:Array = null;
|
||||
var numcountDic:Object = null;
|
||||
var eggflag:int = 0;
|
||||
var i:int = 0;
|
||||
onAutoFillEggToStackComplete = onComplete;
|
||||
if(autoFilling == false)
|
||||
{
|
||||
autoFilling = true;
|
||||
var emptyStack:Array = [];
|
||||
var isVip:Boolean = MasterCenter.getIns().getVipDay() > 0;
|
||||
for each(var s:StackVo in Master.stacks)
|
||||
{
|
||||
if(!(!isVip && s.position == 3))
|
||||
{
|
||||
if(s.isEmpty)
|
||||
{
|
||||
emptyStack.push(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(emptyStack.length > 0)
|
||||
{
|
||||
if(eggvo == null)
|
||||
{
|
||||
eggs = getAutoFillEggs(mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
eggs = [eggvo];
|
||||
}
|
||||
k = 0;
|
||||
while(k < eggs.length)
|
||||
{
|
||||
eg = eggs[k];
|
||||
if(eg.feedLock)
|
||||
{
|
||||
eggs.splice(k,1);
|
||||
k--;
|
||||
}
|
||||
k++;
|
||||
}
|
||||
eggnum = 0;
|
||||
for(j = 0; j < eggs.length; )
|
||||
{
|
||||
eggnum += eggs[j].num;
|
||||
j++;
|
||||
}
|
||||
count = Math.min(eggnum,emptyStack.length);
|
||||
if(count == 0)
|
||||
{
|
||||
autoFilling = false;
|
||||
return 0;
|
||||
}
|
||||
pushs = [];
|
||||
numcountDic = {};
|
||||
eggflag = 0;
|
||||
for(i = 0; i < count; )
|
||||
{
|
||||
if(numcountDic[eggs[eggflag].id] != null && numcountDic[eggs[eggflag].id] >= eggs[eggflag].num)
|
||||
{
|
||||
eggflag++;
|
||||
}
|
||||
pushs.push({
|
||||
"itemId":eggs[eggflag].id,
|
||||
"stackId":emptyStack[i].id
|
||||
});
|
||||
if(numcountDic[eggs[eggflag].id] == null)
|
||||
{
|
||||
numcountDic[eggs[eggflag].id] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
numcountDic[eggs[eggflag].id]++;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
fillEggsToStack(pushs,true,autoFillEggToStackHandler);
|
||||
return count;
|
||||
}
|
||||
autoFilling = false;
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private function autoFillEggToStackHandler() : void
|
||||
{
|
||||
autoFilling = false;
|
||||
if(onAutoFillEggToStackComplete != null)
|
||||
{
|
||||
onAutoFillEggToStackComplete();
|
||||
onAutoFillEggToStackComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function moveMonsToRoom(datas:Array, onComplete:Function) : void
|
||||
{
|
||||
onMoveMonsToRoomComplete = onComplete;
|
||||
moveMonsToRoom_datas = datas;
|
||||
NetStack.getIns().moveMonster(datas,moveMonsToRoomHandler);
|
||||
}
|
||||
|
||||
private function moveMonsToRoomHandler() : void
|
||||
{
|
||||
var j:int = 0;
|
||||
var movedata:Object = null;
|
||||
var mids:Array = null;
|
||||
var roomId:int = 0;
|
||||
var i:int = 0;
|
||||
var mon:MonsterVo = null;
|
||||
for(j = 0; j < moveMonsToRoom_datas.length; )
|
||||
{
|
||||
movedata = moveMonsToRoom_datas[j];
|
||||
mids = movedata.monsterId;
|
||||
roomId = int(movedata.roomId);
|
||||
for each(var stackvo:StackVo in Master.stacks)
|
||||
{
|
||||
if(stackvo.monsterId != 0 && mids.indexOf(stackvo.monsterId) != -1)
|
||||
{
|
||||
stackvo.monsterId = 0;
|
||||
stackvo.atkNum = 0;
|
||||
stackvo.defNum = 0;
|
||||
stackvo.hpNum = 0;
|
||||
stackvo.dexNum = 0;
|
||||
}
|
||||
}
|
||||
for(i = 0; i < mids.length; )
|
||||
{
|
||||
mon = MonsterCenter.getIns().getMonById(mids[i]);
|
||||
mon.roomId = roomId;
|
||||
mon.process = 3;
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.MONSTER_REMOVE_STACK,{
|
||||
"mon":mon,
|
||||
"type":"moveroom"
|
||||
}));
|
||||
i++;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
moveMonsToRoom_datas = null;
|
||||
if(onMoveMonsToRoomComplete != null)
|
||||
{
|
||||
onMoveMonsToRoomComplete();
|
||||
onMoveMonsToRoomComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function getAutoFillEggs(mode:int = 1) : Array
|
||||
{
|
||||
var eggs:Array = Master.bag.getEggArr();
|
||||
switch(mode)
|
||||
{
|
||||
case 0:
|
||||
eggs.sortOn("timeGet",0x10 | 2);
|
||||
break;
|
||||
case 1:
|
||||
eggs.sortOn("timeTotal",16);
|
||||
break;
|
||||
case 2:
|
||||
eggs.sortOn("timeTotal",0x10 | 2);
|
||||
break;
|
||||
case 3:
|
||||
eggs.sortOn("star",0x10 | 2);
|
||||
}
|
||||
return eggs;
|
||||
}
|
||||
|
||||
public function getMonsterCanFromStack() : Array
|
||||
{
|
||||
var mon:MonsterVo = null;
|
||||
var mons:Array = [];
|
||||
for each(var s:StackVo in Master.stacks)
|
||||
{
|
||||
if(!s.isEmpty)
|
||||
{
|
||||
mon = s.getMon();
|
||||
if(mon.mode == 2)
|
||||
{
|
||||
mons.push(mon);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mons;
|
||||
}
|
||||
|
||||
public function getNewStackId() : int
|
||||
{
|
||||
return Game.getIns().master.stacks.length + 1;
|
||||
}
|
||||
|
||||
public function getStackById(sid:int) : StackVo
|
||||
{
|
||||
var i:int = 0;
|
||||
for(i = 0; i < Master.stacks.length; )
|
||||
{
|
||||
if(Master.stacks[i].id == sid)
|
||||
{
|
||||
return Master.stacks[i];
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getStackMonsters() : Array
|
||||
{
|
||||
var arr:Array = [];
|
||||
for each(var s:StackVo in Master.stacks)
|
||||
{
|
||||
if(s.monsterId > 0)
|
||||
{
|
||||
arr.push(MonsterCenter.getIns().getMonById(s.monsterId));
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
public function cleanLocalStackByMonId(mid:Number) : void
|
||||
{
|
||||
var mon:MonsterVo = null;
|
||||
for each(var s:StackVo in Master.stacks)
|
||||
{
|
||||
mon = s.getMon();
|
||||
if(s.monsterId == mid)
|
||||
{
|
||||
s.monsterId = 0;
|
||||
s.atkNum = 0;
|
||||
s.defNum = 0;
|
||||
s.hpNum = 0;
|
||||
s.dexNum = 0;
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.MONSTER_REMOVE_STACK,{
|
||||
"mon":mon,
|
||||
"type":"task"
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,329 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.myr.CP;
|
||||
import net.pixvi.myr.element.achi.AchiType;
|
||||
import net.pixvi.myr.element.battle.BattleData;
|
||||
import net.pixvi.myr.element.cost.CostVo;
|
||||
import net.pixvi.myr.element.explore.ExploreAreaVo;
|
||||
import net.pixvi.myr.element.reward.RewardResultVo;
|
||||
import net.pixvi.myr.element.stage.StageVo;
|
||||
import net.pixvi.myr.event.MYREvent;
|
||||
import net.pixvi.myr.net.NetStage;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class StageCenter extends Singleton
|
||||
{
|
||||
|
||||
private var onCheckLoopStageComplete:Function;
|
||||
|
||||
private var onGetStageRewardComplete:Function;
|
||||
|
||||
private var getStageOnceReward_stageRewardId:String;
|
||||
|
||||
private var onStartStageComplete:Function;
|
||||
|
||||
private var onFinishStageComplete:Function;
|
||||
|
||||
private var finishStageBattle_battleData:BattleData;
|
||||
|
||||
public function StageCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : StageCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(StageCenter) as StageCenter;
|
||||
}
|
||||
|
||||
public function checkLoopStage(onComplete:Function) : void
|
||||
{
|
||||
onCheckLoopStageComplete = onComplete;
|
||||
NetStage.getIns().checkLoopStage(checkLoopStageHandler);
|
||||
}
|
||||
|
||||
private function checkLoopStageHandler(re:Object) : void
|
||||
{
|
||||
var stages:Array = null;
|
||||
var i:int = 0;
|
||||
Master.activityHistory.getStageRewardTime = TimeCenter.timestamp;
|
||||
Master.activityHistory.stageRewardStatus = re.rewardIds;
|
||||
if(re.emptyData == true)
|
||||
{
|
||||
stages = Table.loopStage_info.weekLoopStages;
|
||||
for(i = 0; i < stages.length; )
|
||||
{
|
||||
Master.history.passStage[stages[i]] = {
|
||||
1:false,
|
||||
2:false,
|
||||
3:false
|
||||
};
|
||||
Master.history.unlockStage[stages[i]] = {
|
||||
1:false,
|
||||
2:false,
|
||||
3:false
|
||||
};
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if(onCheckLoopStageComplete != null)
|
||||
{
|
||||
onCheckLoopStageComplete(re);
|
||||
onCheckLoopStageComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function getStageOnceReward(stageRewardId:String, onComplete:Function) : void
|
||||
{
|
||||
onGetStageRewardComplete = onComplete;
|
||||
getStageOnceReward_stageRewardId = stageRewardId;
|
||||
NetStage.getIns().getStageReward(stageRewardId,getStageRewardHandler);
|
||||
}
|
||||
|
||||
private function getStageRewardHandler(re:Object) : void
|
||||
{
|
||||
RewardCenter.getIns().getRewardByData(re.reward,"true","panel");
|
||||
Master.activityHistory.stageRewardStatus.push(getStageOnceReward_stageRewardId);
|
||||
if(onGetStageRewardComplete != null)
|
||||
{
|
||||
onGetStageRewardComplete(re);
|
||||
onGetStageRewardComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function startStage(stageTypeId:String, stageLevel:String, onComplete:Function) : void
|
||||
{
|
||||
onStartStageComplete = onComplete;
|
||||
NetStage.getIns().startStage(stageTypeId,stageLevel,startStageHandler);
|
||||
}
|
||||
|
||||
private function startStageHandler(isEvent:Boolean, stageEvent:Object) : void
|
||||
{
|
||||
var rewardResult:RewardResultVo = null;
|
||||
if(isEvent)
|
||||
{
|
||||
if(stageEvent.hideStageId == null)
|
||||
{
|
||||
Alert.pauseMsg();
|
||||
rewardResult = RewardCenter.getIns().getRewardByData(stageEvent.result);
|
||||
if(stageEvent.costTi > 0)
|
||||
{
|
||||
MasterCenter.getIns().addTi(-stageEvent.costTi);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(onStartStageComplete != null)
|
||||
{
|
||||
onStartStageComplete(isEvent,rewardResult,stageEvent);
|
||||
onStartStageComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function finishStageBattle(battledata:BattleData, onComplete:Function) : void
|
||||
{
|
||||
onFinishStageComplete = onComplete;
|
||||
finishStageBattle_battleData = battledata;
|
||||
NetStage.getIns().finishStageBattle(battledata.getObj(),finishStageHandler);
|
||||
}
|
||||
|
||||
private function finishStageHandler(rewardData:Object, costTi:int, unlockStage:Array, lockStage:Array, monsterExp:Array) : void
|
||||
{
|
||||
StageCenter.getIns().passLocalStage(finishStageBattle_battleData.battlePosition.stageId,finishStageBattle_battleData.battlePosition.stageLevel,costTi,unlockStage,lockStage);
|
||||
StageCenter.getIns().lockLocalStages(lockStage);
|
||||
var rewardvo:RewardResultVo = RewardCenter.getRewardResultVoByData(rewardData);
|
||||
if(onFinishStageComplete != null)
|
||||
{
|
||||
onFinishStageComplete(rewardvo,costTi,lockStage,monsterExp);
|
||||
onFinishStageComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function passLocalStage(stageid:String, level:String, costTi:int, unlockStages:Array, lockStages:Array) : Boolean
|
||||
{
|
||||
var area:ExploreAreaVo = null;
|
||||
var i:int = 0;
|
||||
var first:Boolean = false;
|
||||
var s:StageVo = new StageVo();
|
||||
s.id = stageid;
|
||||
MasterCenter.getIns().addTi(-costTi);
|
||||
var costvo:CostVo = s.costVo;
|
||||
if(costvo != null)
|
||||
{
|
||||
BagCenter.getIns().subLocalCost(s.costVo);
|
||||
}
|
||||
if(Master.history.passStage[stageid] == null)
|
||||
{
|
||||
Master.history.passStage[stageid] = {
|
||||
1:false,
|
||||
2:false,
|
||||
3:false
|
||||
};
|
||||
}
|
||||
if(Master.history.passStage[stageid][level] == false || Master.history.passStage[stageid][level] == null)
|
||||
{
|
||||
if(level == "1")
|
||||
{
|
||||
area = ExploreCenter.getIns().checkStage(stageid);
|
||||
if(area != null && Boolean(Master.history.openExplore))
|
||||
{
|
||||
Alert.showMsg(CP.task(lang("发现了新的可探索区域") + "【" + area.name() + "】!"),3000);
|
||||
}
|
||||
}
|
||||
if(CityCenter.getIns().getCity(s.city) != null && CityCenter.getIns().getCity(s.city).table().openHardModeStage == s.id)
|
||||
{
|
||||
Alert.showMsg(CP.task(lang("可以在该地区进行深入探索了!")),3000);
|
||||
}
|
||||
if(CityCenter.getIns().getCity(s.city) != null && CityCenter.getIns().getCity(s.city).table().openExtraModeStage == s.id)
|
||||
{
|
||||
Alert.showMsg(CP.task(lang("可以在该地区进行完全探索了!")),3000);
|
||||
}
|
||||
Master.history.passStage[stageid][level] = true;
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.STAGE_UPDATE,{
|
||||
"stageid":stageid,
|
||||
"level":int(level)
|
||||
}));
|
||||
first = true;
|
||||
AchiCenter.getIns().autoCheck(AchiType.STAGE);
|
||||
AchiCenter.getIns().autoCheck(AchiType.STARS);
|
||||
AchiCenter.getIns().autoCheck(AchiType.STAGE_LEVELS);
|
||||
}
|
||||
if(!s.special && int(level) < 3)
|
||||
{
|
||||
unlockStage(stageid,int(level) + 1);
|
||||
}
|
||||
if(unlockStages != null && unlockStages.length > 0)
|
||||
{
|
||||
for(i = 0; i < unlockStages.length; )
|
||||
{
|
||||
unlockStage(unlockStages[i],1);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
lockLocalStages(lockStages);
|
||||
return first;
|
||||
}
|
||||
|
||||
public function unlockStage(stageid:String, level:int = 1, show:Boolean = false) : Boolean
|
||||
{
|
||||
if(stageid == "")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(Master.history.unlockStage[stageid] == null)
|
||||
{
|
||||
if(show && !Table.stage_info[stageid].special)
|
||||
{
|
||||
Alert.showMsg(lang("发现了新地点:") + Table.stage_info[stageid].name + Table.stage_info[stageid].tagname);
|
||||
}
|
||||
Master.history.unlockStage[stageid] = {
|
||||
"stageid":stageid,
|
||||
1:false,
|
||||
2:false,
|
||||
3:false
|
||||
};
|
||||
}
|
||||
if(!Master.history.unlockStage[stageid][level])
|
||||
{
|
||||
Master.history.unlockStage[stageid][level] = true;
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.STAGE_UPDATE,{
|
||||
"stageid":stageid,
|
||||
"level":level
|
||||
}));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function unlockLocalStages(stages:Array, show:Boolean = false) : void
|
||||
{
|
||||
if(stages != null && stages.length > 0)
|
||||
{
|
||||
for each(var key:String in stages)
|
||||
{
|
||||
unlockStage(key,1,show);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function lockLocalStages(stages:Array) : void
|
||||
{
|
||||
if(stages != null && stages.length > 0)
|
||||
{
|
||||
for each(var key:String in stages)
|
||||
{
|
||||
delete Master.history.unlockStage[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getStageBattle(stageid:String, level:String) : Object
|
||||
{
|
||||
return Table.stage_info[stageid].level[level].battle;
|
||||
}
|
||||
|
||||
public function getStageReward(stageid:String, level:String) : Object
|
||||
{
|
||||
return Table.stage_info[stageid].level[level].reward;
|
||||
}
|
||||
|
||||
public function getStage(stageid:String) : StageVo
|
||||
{
|
||||
var stagevo:StageVo = null;
|
||||
if(Table.stage_info[stageid] != null)
|
||||
{
|
||||
stagevo = new StageVo();
|
||||
stagevo.id = stageid;
|
||||
return stagevo;
|
||||
}
|
||||
Alert.showMsg("can\'t find stage[" + stageid + "]");
|
||||
return null;
|
||||
}
|
||||
|
||||
public function countStars(city:int = -1) : int
|
||||
{
|
||||
var i:int = 0;
|
||||
var num:int = 0;
|
||||
var s:StageVo = new StageVo();
|
||||
for(var id:String in Master.history.passStage)
|
||||
{
|
||||
for(i = 1; i < 4; )
|
||||
{
|
||||
s.id = id;
|
||||
if(s.table() == null)
|
||||
{
|
||||
Alert.yes("error","找不到 关卡数据[" + s.id + "]");
|
||||
}
|
||||
else if(!s.special && Master.history.passStage[id][i] == true && (city == -1 || city == s.city))
|
||||
{
|
||||
trace(id,i);
|
||||
num++;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
public function isStageUnlock(stageid:String) : Boolean
|
||||
{
|
||||
if(Master.history.unlockStage[stageid] == null || Master.history.unlockStage[stageid]["1"] != true)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function isStagePass(stageid:String, level:int = 1) : Boolean
|
||||
{
|
||||
if(Master.history.passStage[stageid] != null && Master.history.passStage[stageid][level] == true)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class StatusCenter extends Singleton
|
||||
{
|
||||
|
||||
public function StatusCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : StatusCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(StatusCenter) as StatusCenter;
|
||||
}
|
||||
|
||||
public function killMonster(type:int, mode:int) : void
|
||||
{
|
||||
if(Master.history.numKillMonsters[type] == null)
|
||||
{
|
||||
Master.history.numKillMonsters[type] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Master.history.numKillMonsters[type]++;
|
||||
}
|
||||
}
|
||||
|
||||
public function getMonster(type:int) : void
|
||||
{
|
||||
}
|
||||
|
||||
public function monsterModeChange(type:int, mode:int) : void
|
||||
{
|
||||
if(mode == 2)
|
||||
{
|
||||
if(Master.history.numFeedMonsters[type] == null)
|
||||
{
|
||||
Master.history.numFeedMonsters[type] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Master.history.numFeedMonsters[type]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function unlockMonster(type:int) : void
|
||||
{
|
||||
}
|
||||
|
||||
public function passStage(stage:String, level:int) : void
|
||||
{
|
||||
}
|
||||
|
||||
public function passLevel(level:int) : void
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,440 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.common.manager.resource.RM;
|
||||
import net.pixvi.myr.element.bag.EquipBuildVo;
|
||||
import net.pixvi.myr.element.bag.ItemType;
|
||||
import net.pixvi.myr.element.bag.ItemVo;
|
||||
import net.pixvi.myr.element.npc.PositionNPC;
|
||||
import net.pixvi.myr.element.reward.RewardVo;
|
||||
import net.pixvi.myr.element.stage.StageVo;
|
||||
import net.pixvi.myr.net.NetCenter;
|
||||
import net.pixvi.myr.panel.login.LoginBg;
|
||||
import net.pixvi.pfw.utils.ArrayUtil;
|
||||
import net.pixvi.pfw.utils.Mapper;
|
||||
import net.pixvi.pfw.utils.ObjectUtil;
|
||||
import net.pixvi.pfw.utils.debug.CT;
|
||||
import net.pixvi.pse.file.FileTools;
|
||||
|
||||
public class Table
|
||||
{
|
||||
|
||||
public static var setting:Object;
|
||||
|
||||
public static var game_setting:Object;
|
||||
|
||||
public static var farm_level:Object;
|
||||
|
||||
public static var monster_info:Object;
|
||||
|
||||
public static var monster_infoArr:Array;
|
||||
|
||||
public static var monster_level:Object;
|
||||
|
||||
public static var monster_fix:Object;
|
||||
|
||||
public static var stack_price:Object;
|
||||
|
||||
public static var stack_info:Object;
|
||||
|
||||
public static var alchemyStack_price:Object;
|
||||
|
||||
public static var team_info:Object;
|
||||
|
||||
public static var monster_group:Object;
|
||||
|
||||
public static var monster_element:Object;
|
||||
|
||||
public static var monster_skill:Object;
|
||||
|
||||
public static var monster_setting:Object;
|
||||
|
||||
public static var city_info:Object;
|
||||
|
||||
public static var stage_info:Object;
|
||||
|
||||
public static var task_info:Object;
|
||||
|
||||
public static var gacha_machine:Object;
|
||||
|
||||
public static var item_info:Object;
|
||||
|
||||
public static var room_info:Object;
|
||||
|
||||
public static var room_info_arr:Object;
|
||||
|
||||
public static var room_price:Object;
|
||||
|
||||
public static var diary_info:Object;
|
||||
|
||||
public static var event_info:Object;
|
||||
|
||||
public static var event_table:Object;
|
||||
|
||||
public static var achi_info:Object;
|
||||
|
||||
public static var achi_infoArr:Array;
|
||||
|
||||
public static var looptask_info:Object;
|
||||
|
||||
public static var loopStage_info:Object;
|
||||
|
||||
public static var activity_info:Object;
|
||||
|
||||
public static var npc_info:Object;
|
||||
|
||||
public static var npc_position:Array;
|
||||
|
||||
public static var equipbuild_list:Array;
|
||||
|
||||
public static var explore_info:Object;
|
||||
|
||||
public static var explore_text:Object;
|
||||
|
||||
public static var potential_info:Object;
|
||||
|
||||
public static var pay_info:Object;
|
||||
|
||||
public static var pay_infoArr:Array;
|
||||
|
||||
public static var payGift_info:Object;
|
||||
|
||||
public static var payGift_infoArr:Array;
|
||||
|
||||
public static var entangle_info:Object;
|
||||
|
||||
public static var entangle_skill:Object;
|
||||
|
||||
public static var mine_info:Object;
|
||||
|
||||
public static var build_info:Object;
|
||||
|
||||
public static var exchange_info:Object;
|
||||
|
||||
public static var exchange_infoArr:Array;
|
||||
|
||||
public static var dazao_info:Object;
|
||||
|
||||
public static var tjchannel:Object;
|
||||
|
||||
public static var server_info:Object;
|
||||
|
||||
public static var avatar_info:Object;
|
||||
|
||||
public static var avatar_infoArr:Array;
|
||||
|
||||
public static var pve_info:Object;
|
||||
|
||||
public static var channel_tag:Object;
|
||||
|
||||
public static var pve_bot:Array;
|
||||
|
||||
public static var stage_sp:Object;
|
||||
|
||||
public static var shop_info:Object;
|
||||
|
||||
public static var boss_info:Object;
|
||||
|
||||
public static var skin_info:Object;
|
||||
|
||||
public static var mini_game:Object;
|
||||
|
||||
public static var game_config:Object;
|
||||
|
||||
public static var area_info:Object;
|
||||
|
||||
public static var chargeReward_info:Object;
|
||||
|
||||
public static var upstar_info:Object;
|
||||
|
||||
public function Table()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function startUp() : void
|
||||
{
|
||||
var j:int = 0;
|
||||
var i:int = 0;
|
||||
var npcPositionVo:PositionNPC = null;
|
||||
CT.scan();
|
||||
Table.setting = RM.TXT.getJson("setting");
|
||||
Table.game_setting = RM.TXT.getJson("game_setting");
|
||||
Table.farm_level = RM.TXT.getJson("farm_level").datas;
|
||||
Table.monster_info = RM.TXT.getJson("monster_info").datas;
|
||||
Table.monster_infoArr = ObjectUtil.tableToArray(Table.monster_info,"sort",0,true,"montype");
|
||||
Table.monster_skill = RM.TXT.getJson("monster_skill").datas;
|
||||
Table.monster_setting = RM.TXT.getJson("monster_setting");
|
||||
Table.monster_group = monster_setting.group;
|
||||
Table.monster_element = monster_setting.element;
|
||||
Table.monster_level = RM.TXT.getJson("monster_level").datas;
|
||||
var stackTable:Object = RM.TXT.getJson("stack_price");
|
||||
Table.stack_price = stackTable.datas;
|
||||
Table.stack_info = stackTable;
|
||||
Table.alchemyStack_price = stackTable.alchemyDatas;
|
||||
Table.team_info = RM.TXT.getJson("team_info");
|
||||
Table.city_info = Table.game_setting.cityInfo;
|
||||
CT.scan();
|
||||
var stagearr:Array = RM.TXT.getJson("stage_info").datas;
|
||||
CT.scan("json消耗");
|
||||
Table.stage_info = ObjectUtil.tableToObject(stagearr);
|
||||
Table.item_info = RM.TXT.getJson("item_info").datas;
|
||||
Table.room_info = RM.TXT.getJson("room_info").datas;
|
||||
Table.room_info_arr = ObjectUtil.tableToArray(room_info,"",0,true,"type");
|
||||
Table.room_price = RM.TXT.getJson("room_price").datas;
|
||||
Table.task_info = RM.TXT.getJson("task_info").datas;
|
||||
Table.achi_info = RM.TXT.getJson("achi_info").datas;
|
||||
Table.achi_infoArr = ObjectUtil.tableToArray(achi_info,"",0,true,"id");
|
||||
Table.diary_info = RM.TXT.getJson("diary_info");
|
||||
(Table.diary_info.cgs as Array).sortOn("sort",16);
|
||||
(Table.diary_info.storys as Array).sortOn("sort",16);
|
||||
for(j = 0; j < Table.diary_info.storys.length; )
|
||||
{
|
||||
Table.diary_info.storys[j].sort = j + 1;
|
||||
j++;
|
||||
}
|
||||
Table.looptask_info = RM.TXT.getJson("looptask_info").citys;
|
||||
Table.activity_info = RM.TXT.getJson("activity_info");
|
||||
Table.gacha_machine = ObjectUtil.tableToObject(RM.TXT.getJson("gacha_machine").datas,"id");
|
||||
var npcInfo:Object = RM.TXT.getJson("npc_info");
|
||||
Table.npc_info = npcInfo.datas;
|
||||
Table.npc_position = [];
|
||||
var npc_positionData:Array = npcInfo.positionNpc;
|
||||
for(i = 0; i < npc_positionData.length; )
|
||||
{
|
||||
npcPositionVo = new PositionNPC();
|
||||
npcPositionVo.ondata(npc_positionData[i]);
|
||||
Table.npc_position.push(npcPositionVo);
|
||||
i++;
|
||||
}
|
||||
Table.event_info = RM.TXT.getJson("event_info");
|
||||
Table.entangle_info = RM.TXT.getJson("entangle_info");
|
||||
Table.entangle_skill = Table.entangle_info.entangleSkill;
|
||||
Table.event_table = {};
|
||||
for each(var farmevent:Object in Table.event_info.farmEvents)
|
||||
{
|
||||
Table.event_table[farmevent.typeId] = farmevent;
|
||||
}
|
||||
Mapper.fillVariables(Table.event_table,Table.event_table.monEvents,false);
|
||||
for each(var exploreEvent:Object in Table.event_info.stageEvents)
|
||||
{
|
||||
Table.event_table[exploreEvent.typeId] = exploreEvent;
|
||||
}
|
||||
Table.explore_info = RM.TXT.getJson("explore_info").areas;
|
||||
Table.explore_text = RM.TXT.getJson("explore_text").datas;
|
||||
GameTools.words = RM.TXT.getTxt("words").split(",");
|
||||
if(setting.addWords != null)
|
||||
{
|
||||
GameTools.words = GameTools.words.concat(setting.addWords);
|
||||
}
|
||||
Table.potential_info = RM.TXT.getJson("potential_info");
|
||||
Table.equipbuild_list = makeBuildList();
|
||||
Table.pay_info = RM.TXT.getJson("pay_info").datas;
|
||||
Table.pay_infoArr = ObjectUtil.tableToArray(Table.pay_info,"id");
|
||||
Table.payGift_info = RM.TXT.getJson("payGift_info").datas;
|
||||
Table.payGift_infoArr = ObjectUtil.tableToArray(Table.payGift_info,"id");
|
||||
Table.mine_info = RM.TXT.getJson("mine_info");
|
||||
var exchangeObj:Object = RM.TXT.getJson("item_exchange_info");
|
||||
Table.exchange_info = exchangeObj.datas;
|
||||
Table.exchange_infoArr = ObjectUtil.tableToArray(Table.exchange_info,"id",16);
|
||||
Table.dazao_info = exchangeObj.dazao;
|
||||
Table.build_info = RM.TXT.getJson("build_info");
|
||||
if(RM.TXT.getJson("tjchannel") != null)
|
||||
{
|
||||
Table.tjchannel = RM.TXT.getJson("tjchannel");
|
||||
}
|
||||
else
|
||||
{
|
||||
Table.tjchannel = {"tjchannel":"unknow"};
|
||||
}
|
||||
Table.server_info = RM.TXT.getJson("server_info");
|
||||
LoginBg.getIns().trace("11%");
|
||||
Table.avatar_infoArr = RM.TXT.getJson("avatar_info").datas;
|
||||
Table.avatar_info = ObjectUtil.tableToObject(Table.avatar_infoArr,"avatarId");
|
||||
Table.pve_info = RM.TXT.getJson("pve_info");
|
||||
if(FileTools.applicationDirectory.resolvePath("channel_tag.json").exists)
|
||||
{
|
||||
Table.channel_tag = FileTools.readFileObject(FileTools.applicationDirectory.resolvePath("channel_tag.json"));
|
||||
}
|
||||
var shopdata:Object = RM.TXT.getJson("shop_info");
|
||||
var shoparr:Array = shopdata.keShopList;
|
||||
shoparr = shoparr.concat(shopdata.mustBeMoneyShopList);
|
||||
shoparr = shoparr.concat(shopdata.moneyShopList);
|
||||
if(shopdata.removeShopList != null)
|
||||
{
|
||||
shoparr = shoparr.concat(shopdata.removeShopList);
|
||||
}
|
||||
shop_info = ObjectUtil.tableToObject(shoparr);
|
||||
pve_bot = RM.TXT.getJson("pve_bot").datas;
|
||||
LoginBg.getIns().trace("12%");
|
||||
LoginBg.getIns().trace("13%");
|
||||
Table.stage_sp = RM.TXT.getJson("stage_sp").datas;
|
||||
Table.boss_info = RM.TXT.getJson("boss_info").boss;
|
||||
Table.area_info = RM.TXT.getJson("area_info");
|
||||
skin_info = RM.TXT.getJson("skin_info").skins;
|
||||
if(RM.TXT.hasResource("mini_game"))
|
||||
{
|
||||
mini_game = RM.TXT.getJson("mini_game").miniGameCfg;
|
||||
}
|
||||
if(RM.TXT.hasResource("chargeReward_info"))
|
||||
{
|
||||
chargeReward_info = RM.TXT.getJson("chargeReward_info").datas;
|
||||
}
|
||||
if(Table.game_setting.xyz1 != null)
|
||||
{
|
||||
NetCenter.netkey = Table.game_setting.xyz1;
|
||||
}
|
||||
if(RM.TXT.hasResource("loopStage_info"))
|
||||
{
|
||||
loopStage_info = RM.TXT.getJson("loopStage_info");
|
||||
}
|
||||
else
|
||||
{
|
||||
loopStage_info = {};
|
||||
}
|
||||
if(RM.TXT.hasResource("upstar_info"))
|
||||
{
|
||||
upstar_info = RM.TXT.getJson("upstar_info");
|
||||
}
|
||||
else
|
||||
{
|
||||
upstar_info = {};
|
||||
}
|
||||
makeAvatarTable();
|
||||
CT.scan("table");
|
||||
}
|
||||
|
||||
private static function makeAvatarTable() : void
|
||||
{
|
||||
var jbavatar:Object = null;
|
||||
var pfavatar:Object = null;
|
||||
for each(var mondata:Object in Table.monster_infoArr)
|
||||
{
|
||||
if(!mondata.hideLib && mondata.pifu != true)
|
||||
{
|
||||
jbavatar = {
|
||||
"avatarId":mondata.type,
|
||||
"type":"entangle",
|
||||
"img":ImgCenter.getMonAvatar(mondata.type)
|
||||
};
|
||||
Table.avatar_info[mondata.type] = jbavatar;
|
||||
Table.avatar_infoArr.push(jbavatar);
|
||||
}
|
||||
}
|
||||
for each(var skindata:Object in Table.skin_info)
|
||||
{
|
||||
pfavatar = {
|
||||
"avatarId":skindata.typeId,
|
||||
"type":"skin",
|
||||
"img":ImgCenter.getMonAvatar(skindata.typeId)
|
||||
};
|
||||
Table.avatar_info[skindata.typeId] = pfavatar;
|
||||
Table.avatar_infoArr.push(pfavatar);
|
||||
}
|
||||
}
|
||||
|
||||
private static function makeBuildList() : Array
|
||||
{
|
||||
var exp:EquipBuildVo = null;
|
||||
var o2:Object = null;
|
||||
var exps:Array = [];
|
||||
for each(var item:Object in Table.item_info)
|
||||
{
|
||||
if(item.itemType == ItemType.TYPE_EQUIP && item.canAlchemy)
|
||||
{
|
||||
exp = new EquipBuildVo();
|
||||
exp.chance = item.chance;
|
||||
exp.core = ObjectUtil.deepClone(item.buildCore);
|
||||
exp.material = ObjectUtil.deepClone(item.buildMaterial);
|
||||
exp.type = item.type;
|
||||
for each(var o:Object in exp.core)
|
||||
{
|
||||
for each(var mat:Object in Table.item_info[o.name].material)
|
||||
{
|
||||
o2 = ArrayUtil.getElementByValue(exp.material,"name",mat.name);
|
||||
if(o2 == null)
|
||||
{
|
||||
exp.material.push({
|
||||
"name":mat.name,
|
||||
"value":int(mat.value)
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
o2.value += int(mat.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
exps.push(exp);
|
||||
}
|
||||
}
|
||||
return exps;
|
||||
}
|
||||
|
||||
private static function makeDropTable() : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var stagevo:StageVo = null;
|
||||
var reward:RewardVo = null;
|
||||
var res:Array = null;
|
||||
CT.scan();
|
||||
var items:Array = ObjectUtil.tableToArray(item_info,"",0,false,"type");
|
||||
var stages:Array = ObjectUtil.tableToArray(stage_info,"",0,false,"id");
|
||||
stages.sortOn("id");
|
||||
var levelname:Object = {
|
||||
"0":"初步探索",
|
||||
"1":"深入探索",
|
||||
"2":"完全探索"
|
||||
};
|
||||
for each(var item:Object in items)
|
||||
{
|
||||
if(item.from != null && item.from != "")
|
||||
{
|
||||
item.from = "获取:" + item.from;
|
||||
}
|
||||
else if(item.itemType != ItemType.TYPE_EQUIP)
|
||||
{
|
||||
loop1:
|
||||
for each(var stageVo:Object in stages)
|
||||
{
|
||||
if(!stageVo.special)
|
||||
{
|
||||
i = 0;
|
||||
while(i < 3)
|
||||
{
|
||||
stagevo = new StageVo();
|
||||
stagevo.id = stageVo.id;
|
||||
reward = stagevo.getRewardVo(i + 1);
|
||||
res = reward.getAllRewardList();
|
||||
if(reward != null)
|
||||
{
|
||||
for each(var revo:ItemVo in res)
|
||||
{
|
||||
if(revo.type == item.type)
|
||||
{
|
||||
item.from = "获取:" + stageVo.tagname + levelname[i];
|
||||
break loop1;
|
||||
}
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(item.from == null && item.itemType == ItemType.TYPE_EGG)
|
||||
{
|
||||
item.from = "";
|
||||
}
|
||||
if(item.from == null)
|
||||
{
|
||||
item.from = "获取:未知";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
item.from = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,881 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.myr.CP;
|
||||
import net.pixvi.myr.GameMath;
|
||||
import net.pixvi.myr.element.bag.ItemVo;
|
||||
import net.pixvi.myr.element.city.CityVo;
|
||||
import net.pixvi.myr.element.guide.GSub;
|
||||
import net.pixvi.myr.element.mon.MonsterVo;
|
||||
import net.pixvi.myr.element.reward.RewardResultVo;
|
||||
import net.pixvi.myr.element.task.TaskStatusType;
|
||||
import net.pixvi.myr.element.task.TaskType;
|
||||
import net.pixvi.myr.element.task.TaskVo;
|
||||
import net.pixvi.myr.event.MYREvent;
|
||||
import net.pixvi.myr.net.NetTask;
|
||||
import net.pixvi.myr.panel.gacha.GachaPanel;
|
||||
import net.pixvi.myr.panel.looptask.LoopTaskPanel;
|
||||
import net.pixvi.myr.util.MyrCalendar;
|
||||
import net.pixvi.pfw.utils.ArrayUtil;
|
||||
import net.pixvi.pfw.utils.Caller;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class TaskCenter
|
||||
{
|
||||
|
||||
private var finishTask_tid:int;
|
||||
|
||||
private var finishTask_type:String;
|
||||
|
||||
private var onFinishTaskComplete:Function;
|
||||
|
||||
private var openCityName:String;
|
||||
|
||||
private var onCompleteStepComplete:Function;
|
||||
|
||||
private var completeStep_para:Object;
|
||||
|
||||
private var receiveTask_task:TaskVo;
|
||||
|
||||
private var receiveTask_show:Boolean;
|
||||
|
||||
private var onReceiveTaskComplete:Function;
|
||||
|
||||
private var resetingLoopTask:Boolean = false;
|
||||
|
||||
private var onResetLoopTaskComplete:Function;
|
||||
|
||||
private var onGetLoopTaskComplete:Function;
|
||||
|
||||
private var getLoopTask_para:Object;
|
||||
|
||||
public function TaskCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getTaskByTaskData(taskData:Object) : TaskVo
|
||||
{
|
||||
var taskVo:TaskVo = new TaskVo();
|
||||
taskVo.id = taskData.id;
|
||||
taskVo.typeId = taskData.typeId;
|
||||
taskVo.step = taskData.curStep - 1;
|
||||
taskVo.stepVo = taskVo.getStepVo(taskVo.step);
|
||||
taskVo.stepValue = taskData.stepValue;
|
||||
taskVo.recieved = true;
|
||||
return taskVo;
|
||||
}
|
||||
|
||||
public static function getIns() : TaskCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(TaskCenter) as TaskCenter;
|
||||
}
|
||||
|
||||
public function autoCheckNewTask(unlocks:Array = null) : void
|
||||
{
|
||||
var checkDatas:Object = null;
|
||||
var startTask:String = "1001001";
|
||||
if(Table.setting.useOldNewTaskFunction == true)
|
||||
{
|
||||
checkDatas = checkPassTasksNewTask(startTask);
|
||||
}
|
||||
else
|
||||
{
|
||||
checkDatas = checkNewTask();
|
||||
}
|
||||
var needGetTasks:Array = checkDatas.getNewTaskTypes;
|
||||
var needUnlockTasks:Array = checkDatas.unlockNewTaskTypes;
|
||||
var needRemoveTasks:Array = checkDatas.removeTaskIds;
|
||||
if(unlocks != null)
|
||||
{
|
||||
needUnlockTasks = unlocks;
|
||||
}
|
||||
NetTask.getIns().updateTask(needUnlockTasks,needGetTasks,needRemoveTasks,autoCheckNewTaskHandler);
|
||||
}
|
||||
|
||||
public function autoCheckNewTaskHandler(unlockTasks:Array, receiveTasks:Array) : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var j:int = 0;
|
||||
var unlockTaskTypeId:String = null;
|
||||
var k:int = 0;
|
||||
var tv:TaskVo = null;
|
||||
for(i = 0; i < receiveTasks.length; )
|
||||
{
|
||||
addLocalTask(TaskCenter.getTaskByTaskData(receiveTasks[i]));
|
||||
i++;
|
||||
}
|
||||
for(j = 0; j < unlockTasks.length; )
|
||||
{
|
||||
unlockTaskTypeId = unlockTasks[j];
|
||||
unlockLocalTask(unlockTaskTypeId);
|
||||
j++;
|
||||
}
|
||||
for(k = 0; k < Master.tasks.length; )
|
||||
{
|
||||
tv = Master.tasks[k];
|
||||
if(tv.closed == true)
|
||||
{
|
||||
Master.tasks.splice(k,1);
|
||||
}
|
||||
k++;
|
||||
}
|
||||
}
|
||||
|
||||
private function checkNewTask() : Object
|
||||
{
|
||||
var passTaskObject:Object = null;
|
||||
var nextTasks:Array = null;
|
||||
var unlockTasks:Array = null;
|
||||
var i:int = 0;
|
||||
var unlockTaskclose:Boolean = false;
|
||||
var j:int = 0;
|
||||
var nextTaskclose:Boolean = false;
|
||||
var getNewTaskTypes:Array = [];
|
||||
var unlockNewTaskTypes:Array = [];
|
||||
var removeTaskIds:Array = [];
|
||||
for(var taskKey:String in Master.history.passTask)
|
||||
{
|
||||
passTaskObject = Table.task_info[taskKey];
|
||||
if(passTaskObject == null)
|
||||
{
|
||||
if(GameMath.ModeTrace)
|
||||
{
|
||||
Alert.showMsg("can\'t find task[" + taskKey + "]");
|
||||
}
|
||||
}
|
||||
else if(!passTaskObject.closed)
|
||||
{
|
||||
nextTasks = passTaskObject.nextTasks;
|
||||
unlockTasks = passTaskObject.unlockTasks;
|
||||
for(i = 0; i < unlockTasks.length; )
|
||||
{
|
||||
unlockTaskclose = false;
|
||||
if(Table.task_info[unlockTasks[i]] != null && Table.task_info[unlockTasks[i]].closed)
|
||||
{
|
||||
unlockTaskclose = true;
|
||||
}
|
||||
if(!unlockTaskclose && Master.history.unlockTask[unlockTasks[i]] != true && unlockNewTaskTypes.indexOf(unlockTasks[i]) == -1)
|
||||
{
|
||||
unlockNewTaskTypes.push({
|
||||
"prev":taskKey,
|
||||
"taskTypeId":unlockTasks[i]
|
||||
});
|
||||
trace("新任务解锁:" + unlockTasks[i]);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
for(j = 0; j < nextTasks.length; )
|
||||
{
|
||||
nextTaskclose = false;
|
||||
if(Table.task_info[nextTasks[j]] != null && Table.task_info[nextTasks[j]].closed)
|
||||
{
|
||||
nextTaskclose = true;
|
||||
}
|
||||
if(!nextTaskclose && Master.history.passTask[nextTasks[j]] != true && TaskCenter.getIns().getTaskByType(nextTasks[j]) == null)
|
||||
{
|
||||
getNewTaskTypes.push({
|
||||
"prev":taskKey,
|
||||
"taskTypeId":nextTasks[j]
|
||||
});
|
||||
trace("新任务获取:" + nextTasks[j]);
|
||||
}
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
for each(var tv:TaskVo in Master.tasks)
|
||||
{
|
||||
if(tv.closed == true)
|
||||
{
|
||||
removeTaskIds.push(tv.id);
|
||||
}
|
||||
}
|
||||
return {
|
||||
"getNewTaskTypes":getNewTaskTypes,
|
||||
"unlockNewTaskTypes":unlockNewTaskTypes,
|
||||
"removeTaskIds":removeTaskIds
|
||||
};
|
||||
}
|
||||
|
||||
private function checkPassTasksNewTask(taskTypeId:String) : Object
|
||||
{
|
||||
var i:int = 0;
|
||||
var nextTaskType:String = null;
|
||||
var checkDatas:Object = null;
|
||||
var j:int = 0;
|
||||
var unlockTaskType:String = null;
|
||||
trace("开始检测:" + taskTypeId);
|
||||
if(Master.history.passTask[taskTypeId] != true)
|
||||
{
|
||||
trace(taskTypeId + "未通过");
|
||||
return {
|
||||
"getNewTaskTypes":[],
|
||||
"unlockNewTaskTypes":[]
|
||||
};
|
||||
}
|
||||
var getNewTaskTypes:Array = [];
|
||||
var unlockNewTaskTypes:Array = [];
|
||||
var nextTasks:Array = Table.task_info[taskTypeId].nextTasks;
|
||||
var unlockTasks:Array = Table.task_info[taskTypeId].unlockTasks;
|
||||
for(i = 0; i < nextTasks.length; )
|
||||
{
|
||||
nextTaskType = nextTasks[i];
|
||||
trace("检测" + taskTypeId + "关联:",nextTaskType);
|
||||
if(Master.history.passTask[nextTaskType] != true && TaskCenter.getIns().getTaskByType(nextTaskType) == null)
|
||||
{
|
||||
getNewTaskTypes.push({
|
||||
"prev":taskTypeId,
|
||||
"taskTypeId":nextTaskType
|
||||
});
|
||||
trace("检测" + taskTypeId + "关联:",nextTaskType,"补充获取!!!!!!");
|
||||
}
|
||||
else if(Master.history.passTask[nextTaskType] == true)
|
||||
{
|
||||
trace("检测" + taskTypeId + "关联:",nextTaskType,"检查");
|
||||
checkDatas = checkPassTasksNewTask(nextTaskType);
|
||||
getNewTaskTypes = getNewTaskTypes.concat(checkDatas.getNewTaskTypes);
|
||||
unlockNewTaskTypes = unlockNewTaskTypes.concat(checkDatas.unlockNewTaskTypes);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
for(j = 0; j < unlockTasks.length; )
|
||||
{
|
||||
unlockTaskType = unlockTasks[j];
|
||||
trace("检测" + taskTypeId + "解锁关联:",unlockTaskType);
|
||||
if(Master.history.unlockTask[unlockTaskType] != true)
|
||||
{
|
||||
trace("检测" + taskTypeId + "解锁关联:",unlockTaskType,"需解锁!!!!");
|
||||
unlockNewTaskTypes.push({
|
||||
"prev":taskTypeId,
|
||||
"taskTypeId":unlockTaskType
|
||||
});
|
||||
}
|
||||
j++;
|
||||
}
|
||||
return {
|
||||
"getNewTaskTypes":getNewTaskTypes,
|
||||
"unlockNewTaskTypes":unlockNewTaskTypes
|
||||
};
|
||||
}
|
||||
|
||||
public function finishTask(tid:int, tasktypeId:String, onComplete:Function) : void
|
||||
{
|
||||
onFinishTaskComplete = onComplete;
|
||||
finishTask_tid = tid;
|
||||
finishTask_type = tasktypeId;
|
||||
NetTask.getIns().finishTask(tid,tasktypeId,finishTaskHandler);
|
||||
}
|
||||
|
||||
private function finishTaskHandler(rewardData:Object, taskdatas:Array, unlockTasks:Array, unlockStages:Array) : void
|
||||
{
|
||||
var j:int = 0;
|
||||
var newTask:TaskVo = null;
|
||||
var k:int = 0;
|
||||
var task:TaskVo = getTaskById(finishTask_tid);
|
||||
var rewardResultVo:RewardResultVo = RewardCenter.getRewardResultVoByData(rewardData);
|
||||
task.complete = true;
|
||||
ArrayUtil.remove(Master.tasks,task);
|
||||
Master.history.passTask[task.typeId] = true;
|
||||
RewardCenter.getIns().getReward(rewardResultVo,true,"panel",showOpenCity);
|
||||
if(task.type == TaskType.LOOP_TASK)
|
||||
{
|
||||
LoopTaskPanel.getIns().update();
|
||||
}
|
||||
if(taskdatas != null && taskdatas.length > 0)
|
||||
{
|
||||
for(j = 0; j < taskdatas.length; )
|
||||
{
|
||||
newTask = TaskCenter.getTaskByTaskData(taskdatas[j]);
|
||||
Master.tasks.push(newTask);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
if(unlockTasks != null && unlockTasks.length > 0)
|
||||
{
|
||||
for(k = 0; k < unlockTasks.length; )
|
||||
{
|
||||
TaskCenter.getIns().unlockLocalTask(unlockTasks[k]);
|
||||
k++;
|
||||
}
|
||||
}
|
||||
if(unlockStages != null && unlockStages.length > 0)
|
||||
{
|
||||
for each(var s:String in unlockStages)
|
||||
{
|
||||
StageCenter.getIns().unlockStage(s,1,true);
|
||||
}
|
||||
}
|
||||
for each(var o:Object in Table.city_info)
|
||||
{
|
||||
if(task.typeId == o.openTask)
|
||||
{
|
||||
Master.history.unlockCity[o.cid] = true;
|
||||
openCityName = o.name;
|
||||
}
|
||||
}
|
||||
Master.history.passTask[task.typeId] = true;
|
||||
if(onFinishTaskComplete != null)
|
||||
{
|
||||
onFinishTaskComplete();
|
||||
onFinishTaskComplete = null;
|
||||
}
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.TASK_CHANGE));
|
||||
}
|
||||
|
||||
private function showOpenCity() : void
|
||||
{
|
||||
var entangleMon:MonsterVo = null;
|
||||
if(openCityName != null)
|
||||
{
|
||||
Alert.yes(lang("通关区域"),CP.task(lang("新地区【{0}】开启了!",openCityName)));
|
||||
openCityName = null;
|
||||
}
|
||||
for(var monType:String in Table.upstar_info)
|
||||
{
|
||||
if(Table.upstar_info[monType].task != null && Table.upstar_info[monType].task.indexOf(finishTask_type) >= 0)
|
||||
{
|
||||
entangleMon = MonsterCenter.getIns().getEntangleMonByType(int(monType));
|
||||
if(entangleMon != null)
|
||||
{
|
||||
Alert.yes(lang("升星契机"),CP.task(lang("完成了与【{0}】的升星契机!可前往羁绊界面解锁升星。",entangleMon.desName)));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function completeLocalStep(task:TaskVo) : void
|
||||
{
|
||||
if(task.stepVo.unlockStages.length > 0)
|
||||
{
|
||||
for each(var s:String in task.stepVo.unlockStages)
|
||||
{
|
||||
StageCenter.getIns().unlockStage(s,1,true);
|
||||
}
|
||||
}
|
||||
if(task.typeId == "1001006" && task.step == 3)
|
||||
{
|
||||
Caller.delayCall(GachaPanel.popInGacha,200,1,["task1"]);
|
||||
}
|
||||
task.step++;
|
||||
if(task.steps[task.step] == null)
|
||||
{
|
||||
task.stepVo = null;
|
||||
Alert.showMsg(lang("任务 {0} 完成!",CP.task(task.name)));
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.showMsg(lang("任务 {0} 有更新!",CP.task(task.name)));
|
||||
task.stepVo = task.getStepVo();
|
||||
}
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.TASK_CHANGE));
|
||||
}
|
||||
|
||||
public function finishStep(t:TaskVo, showReward:Boolean = false, onComplete:Function = null) : void
|
||||
{
|
||||
var removeIds:Array = null;
|
||||
onCompleteStepComplete = onComplete;
|
||||
switch(t.stepVo.statusType)
|
||||
{
|
||||
case TaskStatusType.GET_ITEM:
|
||||
removeIds = BagCenter.getIns().getIdsByType(t.stepVo.statusValue.type,t.stepVo.statusValue.num);
|
||||
break;
|
||||
case TaskStatusType.GET_MONSTER:
|
||||
if(int(t.stepVo.statusValue.mode) == 0)
|
||||
{
|
||||
removeIds = BagCenter.getIns().getIdsByType(t.stepVo.statusValue.type,t.stepVo.statusValue.num);
|
||||
}
|
||||
else
|
||||
{
|
||||
removeIds = MonsterCenter.getIns().getTaskMonsterMode2(t.stepVo.statusValue.type,t.stepVo.statusValue.num);
|
||||
}
|
||||
}
|
||||
completeStep_para = {
|
||||
"t":t,
|
||||
"removeIds":removeIds,
|
||||
"showReward":showReward
|
||||
};
|
||||
NetTask.getIns().finishStep(t.id,t.typeId,removeIds,null,completeStepHandler);
|
||||
}
|
||||
|
||||
private function completeStepHandler(rewardData:Object, re:Object) : void
|
||||
{
|
||||
var rewardResult:RewardResultVo = null;
|
||||
var leftNum:int = 0;
|
||||
var i:int = 0;
|
||||
var itemVo:ItemVo = null;
|
||||
var mons:Array = null;
|
||||
var costTi:int = int(re.costTi);
|
||||
if(rewardData != null)
|
||||
{
|
||||
rewardResult = RewardCenter.getRewardResultVoByData(rewardData);
|
||||
}
|
||||
var removeIds:Array = completeStep_para.removeIds;
|
||||
var t:TaskVo = completeStep_para.t;
|
||||
t.stepValue = re.taskStepValue;
|
||||
var statusType:String = t.stepVo.statusType;
|
||||
if(t.stepVo.statusType == TaskStatusType.GET_MONSTER && int(t.stepVo.statusValue.mode) == 0)
|
||||
{
|
||||
statusType = TaskStatusType.GET_ITEM;
|
||||
}
|
||||
switch(statusType)
|
||||
{
|
||||
case TaskStatusType.GET_ITEM:
|
||||
if(t.stepVo.statusValue.remove == true)
|
||||
{
|
||||
leftNum = int(t.stepVo.statusValue.num);
|
||||
for(i = 0; i < removeIds.length; )
|
||||
{
|
||||
itemVo = BagCenter.getIns().getById(removeIds[i]);
|
||||
if(itemVo.num >= leftNum)
|
||||
{
|
||||
BagCenter.getIns().subNum(itemVo.id,leftNum,true,"交出了 {0} 个 {1}");
|
||||
break;
|
||||
}
|
||||
leftNum -= itemVo.num;
|
||||
BagCenter.getIns().subNum(itemVo.id,itemVo.num,true,"交出了 {0} 个 {1}");
|
||||
i++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TaskStatusType.GET_MONSTER:
|
||||
if(t.stepVo.statusValue.remove == true)
|
||||
{
|
||||
mons = MonsterCenter.getIns().idsToMons(removeIds);
|
||||
MonsterCenter.getIns().removeLocalMonsters(mons);
|
||||
}
|
||||
break;
|
||||
case TaskStatusType.GET_MONEY:
|
||||
if(t.stepVo.statusValue.remove == true)
|
||||
{
|
||||
MasterCenter.getIns().addMoney(-t.stepVo.statusValue.money,true);
|
||||
}
|
||||
}
|
||||
if(!t.stepVo.hasBattle() && (t.stepVo.story == "" || t.stepVo.statusType != TaskStatusType.NONE && t.stepVo.afterStory == ""))
|
||||
{
|
||||
completeLocalStep(t);
|
||||
}
|
||||
else
|
||||
{
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.TASK_CHANGE));
|
||||
}
|
||||
if(rewardResult != null)
|
||||
{
|
||||
RewardCenter.getIns().getReward(rewardResult,completeStep_para.showReward,"alert",null,completeStep_para.showReward);
|
||||
}
|
||||
MasterCenter.getIns().addTi(-costTi);
|
||||
completeStep_para = null;
|
||||
if(onCompleteStepComplete != null)
|
||||
{
|
||||
onCompleteStepComplete(rewardResult);
|
||||
onCompleteStepComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function unlockLocalTask(taskid:String) : TaskVo
|
||||
{
|
||||
if(Table.task_info[taskid] == null || Table.task_info[taskid].closed == true)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var task:TaskVo = getLocalTaskByTypeId(taskid);
|
||||
if(task == null)
|
||||
{
|
||||
task = new TaskVo();
|
||||
task.id = 0;
|
||||
task.typeId = taskid;
|
||||
Master.tasks.push(task);
|
||||
}
|
||||
task.stepVo = task.startStep;
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.TASK_CHANGE));
|
||||
return task;
|
||||
}
|
||||
|
||||
public function activityLockStatus(key:String) : Boolean
|
||||
{
|
||||
var result:Boolean = false;
|
||||
for each(var t:TaskVo in Master.tasks)
|
||||
{
|
||||
if(t.recieved && !t.canFinish() && t.stepVo.statusType == TaskStatusType.SYS_LOCK && t.stepVo.statusValue.key == key)
|
||||
{
|
||||
Alert.showMsg(lang("任务 {0} 目标达成!",CP.task(t.name)));
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
if(result)
|
||||
{
|
||||
GuideCenter.getIns().fin(key);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public function activityMonsterNum(monType:int) : void
|
||||
{
|
||||
for each(var t:TaskVo in Master.tasks)
|
||||
{
|
||||
if(t.recieved && !t.canFinish() && t.stepVo.statusType == TaskStatusType.GET_MONSTER && t.stepVo.statusValue.type == monType)
|
||||
{
|
||||
if(t.stepVo.isStatusComplete())
|
||||
{
|
||||
Alert.showMsg(lang("任务 {0} 目标达成!",CP.task(t.name)));
|
||||
}
|
||||
if(t.stepVo.canStepComplete())
|
||||
{
|
||||
TaskCenter.getIns().finishStep(t,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function activityItemNum(itemType:int) : void
|
||||
{
|
||||
for each(var t:TaskVo in Master.tasks)
|
||||
{
|
||||
if(t.recieved && !t.canFinish() && t.stepVo.statusType == TaskStatusType.GET_ITEM && t.stepVo.statusValue == itemType)
|
||||
{
|
||||
if(t.stepVo.isStatusComplete())
|
||||
{
|
||||
Alert.showMsg(lang("任务 {0} 目标达成!",CP.task(t.name)));
|
||||
}
|
||||
if(t.stepVo.canStepComplete())
|
||||
{
|
||||
TaskCenter.getIns().finishStep(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function activityMoneyNum() : void
|
||||
{
|
||||
for each(var t:TaskVo in Master.tasks)
|
||||
{
|
||||
if(t.recieved && !t.canFinish() && t.stepVo.statusType == TaskStatusType.GET_MONEY)
|
||||
{
|
||||
if(t.stepVo.isStatusComplete())
|
||||
{
|
||||
Alert.showMsg(lang("任务 {0} 目标达成!",CP.task(t.name)));
|
||||
}
|
||||
if(t.stepVo.canStepComplete())
|
||||
{
|
||||
TaskCenter.getIns().finishStep(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function addLocalTask(task:TaskVo) : void
|
||||
{
|
||||
Master.tasks.push(task);
|
||||
Alert.showMsg(lang("获得任务 ") + CP.task(task.name));
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.TASK_CHANGE));
|
||||
}
|
||||
|
||||
public function receiveTask(taskid:String, show:Boolean = true, onComplete:Function = null) : void
|
||||
{
|
||||
onReceiveTaskComplete = onComplete;
|
||||
var task:TaskVo = getLocalTaskByTypeId(taskid);
|
||||
if(task != null)
|
||||
{
|
||||
receiveTask_task = task;
|
||||
receiveTask_show = show;
|
||||
NetTask.getIns().getTask(task.typeId,receiveTaskHandler);
|
||||
}
|
||||
}
|
||||
|
||||
private function receiveTaskHandler(taskData:Object) : void
|
||||
{
|
||||
receiveTask_task.id = taskData.id;
|
||||
receiveTask_task.stepValue = taskData.stepValue;
|
||||
receiveTask_task.step = 0;
|
||||
receiveTask_task.stepVo = receiveTask_task.getStepVo();
|
||||
receiveTask_task.recieved = true;
|
||||
if(receiveTask_show)
|
||||
{
|
||||
Alert.showMsg(lang("获得任务 ") + CP.task(receiveTask_task.name));
|
||||
}
|
||||
receiveTask_task = null;
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.TASK_CHANGE));
|
||||
if(onReceiveTaskComplete != null)
|
||||
{
|
||||
onReceiveTaskComplete();
|
||||
onReceiveTaskComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function getLocalTaskByTypeId(taskTypeId:String) : TaskVo
|
||||
{
|
||||
for each(var t:TaskVo in Master.tasks)
|
||||
{
|
||||
if(t.typeId == taskTypeId)
|
||||
{
|
||||
return t;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getTaskListData(type:int = -1) : Array
|
||||
{
|
||||
var i:int = 0;
|
||||
var t:TaskVo = null;
|
||||
var arrSub:Array = [];
|
||||
var arrMain:Array = [];
|
||||
var arrFinish:Array = [];
|
||||
for(i = 0; i < Master.tasks.length; )
|
||||
{
|
||||
t = Master.tasks[i] as TaskVo;
|
||||
if(!(type != -1 && t.type != type))
|
||||
{
|
||||
if(t.recieved)
|
||||
{
|
||||
if(t.canFinish())
|
||||
{
|
||||
arrFinish.push(t);
|
||||
}
|
||||
else if(t.isMain)
|
||||
{
|
||||
arrMain.push(t);
|
||||
}
|
||||
else
|
||||
{
|
||||
arrSub.push(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return arrFinish.concat(arrMain.concat(arrSub.reverse()));
|
||||
}
|
||||
|
||||
public function hasTaskByPosition(pos:String) : Boolean
|
||||
{
|
||||
var _loc4_:int = 0;
|
||||
var _loc3_:* = Master.tasks;
|
||||
while(true)
|
||||
{
|
||||
for each(var t:TaskVo in _loc3_)
|
||||
{
|
||||
if(!t.complete && !t.canFinish() && !t.closed && t.stepVo.position.indexOf(pos) == 0 && t.stepVo.canShow())
|
||||
{
|
||||
if(!(t.stepVo.position != pos && Table.game_setting.closePosCheckType2 != true))
|
||||
{
|
||||
break;
|
||||
}
|
||||
if(t.stepVo.position.charAt(pos.length) == "_")
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function hasTaskByOtherCity(curcity:int) : Boolean
|
||||
{
|
||||
var i:int = 0;
|
||||
if(!CityVo.checkUnlock(curcity))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var citys:Array = [1,2,3,4,5];
|
||||
citys.splice(citys.indexOf(curcity),1);
|
||||
for each(var t:TaskVo in Master.tasks)
|
||||
{
|
||||
if(t.recieved && !t.complete && !t.canFinish())
|
||||
{
|
||||
i = 0;
|
||||
while(i < citys.length)
|
||||
{
|
||||
if(t.stepVo.position.indexOf("city" + citys[i]) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getTaskById(id:int) : TaskVo
|
||||
{
|
||||
var t:Object = ArrayUtil.getElementByValue(Master.tasks,"id",id);
|
||||
if(t != null)
|
||||
{
|
||||
return t as TaskVo;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getTaskByType(typeId:String) : TaskVo
|
||||
{
|
||||
var a:Object = null;
|
||||
if(typeId == "1001002")
|
||||
{
|
||||
trace(1);
|
||||
a = Master.tasks;
|
||||
}
|
||||
var t:Object = ArrayUtil.getElementByValue(Master.tasks,"typeId",typeId);
|
||||
if(t != null)
|
||||
{
|
||||
return t as TaskVo;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getTaskByPosition(pos:String) : TaskVo
|
||||
{
|
||||
var i:int = 0;
|
||||
var t:TaskVo = null;
|
||||
for(i = 0; i < Master.tasks.length; )
|
||||
{
|
||||
t = Master.tasks[i] as TaskVo;
|
||||
if(!t.complete && !t.canFinish() && t.stepVo.position == pos)
|
||||
{
|
||||
return Master.tasks[i];
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getProcessTask(taskid:String) : TaskVo
|
||||
{
|
||||
var i:int = 0;
|
||||
var t:TaskVo = null;
|
||||
for(i = 0; i < Master.tasks.length; )
|
||||
{
|
||||
t = Master.tasks[i] as TaskVo;
|
||||
if(t.typeId == taskid)
|
||||
{
|
||||
return Master.tasks[i];
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function hasTaskFinish() : Boolean
|
||||
{
|
||||
for each(var t:TaskVo in Master.tasks)
|
||||
{
|
||||
if(t.canFinish() && !t.complete)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function checkReceivableTask() : Boolean
|
||||
{
|
||||
var i:int = 0;
|
||||
var rvo:TaskVo = null;
|
||||
var curTaskTypeIds:Array = [];
|
||||
var addNew:Boolean = false;
|
||||
for(i = 0; i < Master.tasks.length; )
|
||||
{
|
||||
curTaskTypeIds.push(Master.tasks[i].typeId);
|
||||
i++;
|
||||
}
|
||||
for(var key:String in Master.history.unlockTask)
|
||||
{
|
||||
if(Table.task_info[key] != null && Table.task_info[key].closed != true && Master.history.passTask[key] == null && curTaskTypeIds.indexOf(key) == -1)
|
||||
{
|
||||
rvo = new TaskVo();
|
||||
rvo.id = 0;
|
||||
rvo.typeId = key;
|
||||
rvo.stepVo = rvo.startStep;
|
||||
rvo.stepVo.isStartStep = true;
|
||||
Master.tasks.push(rvo);
|
||||
addNew = true;
|
||||
}
|
||||
}
|
||||
return addNew;
|
||||
}
|
||||
|
||||
public function autoCheckResetLoopTask() : void
|
||||
{
|
||||
if(resetingLoopTask)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var oldDay:String = MyrCalendar.getDayNumber(Master.history.loopTaskTime * 1000).toString();
|
||||
var newDay:String = MyrCalendar.getDayNumber(TimeCenter.timestamp * 1000 - 10000).toString();
|
||||
if(oldDay != newDay)
|
||||
{
|
||||
resetLoopTask();
|
||||
}
|
||||
}
|
||||
|
||||
public function resetLoopTask() : void
|
||||
{
|
||||
resetingLoopTask = true;
|
||||
NetTask.getIns().resetLoopTask(resetLoopTaskHandler);
|
||||
}
|
||||
|
||||
private function resetLoopTaskHandler(newLoopTask:Object) : void
|
||||
{
|
||||
var t:TaskVo = null;
|
||||
var i:int = 0;
|
||||
Master.history.loopTaskNum = GameMath.loopTaskMaxNum;
|
||||
Master.history.loopTask = newLoopTask;
|
||||
Master.history.loopTaskTime = TimeCenter.timestamp;
|
||||
for(i = 0; i < Master.tasks.length; )
|
||||
{
|
||||
t = Master.tasks[i];
|
||||
if(t.type == TaskType.LOOP_TASK)
|
||||
{
|
||||
Alert.showMsg(lang("委托 {0} 超过了时限。",CP.task(t.name)));
|
||||
Master.tasks.splice(i,1);
|
||||
i--;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if(GuideCenter.getIns().checkFin(GSub.OPEN_XIEHUI))
|
||||
{
|
||||
Alert.showMsg(lang("驯养师协会有新到的委托任务!"));
|
||||
}
|
||||
if(onResetLoopTaskComplete != null)
|
||||
{
|
||||
onResetLoopTaskComplete();
|
||||
onResetLoopTaskComplete = null;
|
||||
}
|
||||
resetingLoopTask = false;
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.LOOP_TASK_UPDATE));
|
||||
}
|
||||
|
||||
public function getLoopTask(taskTypeId:String, city:int, onComplete:Function) : void
|
||||
{
|
||||
onGetLoopTaskComplete = onComplete;
|
||||
getLoopTask_para = {"city":city};
|
||||
NetTask.getIns().getLoopTask(taskTypeId,city,getLoopTaskHandler);
|
||||
}
|
||||
|
||||
private function getLoopTaskHandler(taskData:Object) : void
|
||||
{
|
||||
var newTask:TaskVo = getTaskByTaskData(taskData);
|
||||
Master.tasks.push(newTask);
|
||||
Master.history.loopTaskNum--;
|
||||
ArrayUtil.remove(Master.history.loopTask[getLoopTask_para.city],int(newTask.typeId));
|
||||
Alert.showMsg(lang("接取了委托任务 {0}",CP.task(newTask.name)));
|
||||
getLoopTask_para = null;
|
||||
if(onGetLoopTaskComplete != null)
|
||||
{
|
||||
onGetLoopTaskComplete(newTask);
|
||||
onGetLoopTaskComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function loopTaskResetLeftTime() : int
|
||||
{
|
||||
return MyrCalendar.leftTomorrowSecond(TimeCenter.timestamp * 1000) / 1000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,396 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.myr.GameMath;
|
||||
import net.pixvi.myr.element.battle.BattleMonVo;
|
||||
import net.pixvi.myr.element.battle.BattleTeamVo;
|
||||
import net.pixvi.myr.element.mon.MonsterVo;
|
||||
import net.pixvi.myr.element.team.TeamPositionVo;
|
||||
import net.pixvi.myr.element.team.TeamVo;
|
||||
import net.pixvi.myr.event.MYREvent;
|
||||
import net.pixvi.myr.net.NetTeam;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class TeamCenter extends Singleton
|
||||
{
|
||||
|
||||
private var onMonOnComplete:Function;
|
||||
|
||||
private var monOn_para:Object;
|
||||
|
||||
private var onMonOffComplete:Function;
|
||||
|
||||
private var monOff_para:Object;
|
||||
|
||||
public var teamPos2battleTeamPos:Object = {
|
||||
"0":"1",
|
||||
"1":"4",
|
||||
"2":"2",
|
||||
"3":"5",
|
||||
"4":"6",
|
||||
"5":"7",
|
||||
"6":"8",
|
||||
"7":"9"
|
||||
};
|
||||
|
||||
public var checkTeamVailType:int = 0;
|
||||
|
||||
public function TeamCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : TeamCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(TeamCenter) as TeamCenter;
|
||||
}
|
||||
|
||||
public static function getTeamVoByData(data:Object) : TeamVo
|
||||
{
|
||||
var i:int = 0;
|
||||
var team:TeamVo = new TeamVo();
|
||||
team.teamType = data.teamType;
|
||||
team.teamName = data.teamName;
|
||||
team.monsters = [];
|
||||
for(i = 0; i < data.monsters.length; )
|
||||
{
|
||||
if(Table.team_info[data.teamType][i] != null)
|
||||
{
|
||||
team.monsters.push(data.monsters[i]);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return team;
|
||||
}
|
||||
|
||||
public function startUp() : void
|
||||
{
|
||||
}
|
||||
|
||||
public function getTeamPositionArr(teamName:String) : Array
|
||||
{
|
||||
var i:int = 0;
|
||||
var vo:TeamPositionVo = null;
|
||||
var arr:Array = [];
|
||||
var team:TeamVo = getTeamByTeamName(teamName);
|
||||
for(i = 0; i < team.monsters.length; )
|
||||
{
|
||||
vo = new TeamPositionVo();
|
||||
vo.team = team;
|
||||
vo.position = i;
|
||||
arr.push(vo);
|
||||
i++;
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
public function getTeamByTeamName(name:String) : TeamVo
|
||||
{
|
||||
var getteam:TeamVo = null;
|
||||
for each(var teamvo:TeamVo in Master.teams)
|
||||
{
|
||||
if(teamvo.teamName == name)
|
||||
{
|
||||
getteam = teamvo;
|
||||
}
|
||||
}
|
||||
if(getteam == null)
|
||||
{
|
||||
getteam = new TeamVo();
|
||||
getteam.teamType = "pveBattleTeam";
|
||||
getteam.teamName = name;
|
||||
getteam.monsters = [0,0,0,0,0,0,0,0,0];
|
||||
Master.teams.push(getteam);
|
||||
}
|
||||
return getteam;
|
||||
}
|
||||
|
||||
public function getTeamByTeamType(teamType:String = "battleTeam") : TeamVo
|
||||
{
|
||||
for each(var teamvo:TeamVo in Master.teams)
|
||||
{
|
||||
if(teamvo.teamType == teamType)
|
||||
{
|
||||
return teamvo;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function monOn(teamName:String, position:int, mid:Number, onComplete:Function) : void
|
||||
{
|
||||
onMonOnComplete = onComplete;
|
||||
monOn_para = {
|
||||
"teamName":teamName,
|
||||
"position":position,
|
||||
"mid":mid
|
||||
};
|
||||
NetTeam.getIns().monOn(mid,teamName,position,monOnHandler);
|
||||
}
|
||||
|
||||
private function monOnHandler(re:Object = null) : void
|
||||
{
|
||||
var offMon:MonsterVo = null;
|
||||
var team:TeamVo = getTeamByTeamName(monOn_para.teamName);
|
||||
if(team.monsters[monOn_para.position] > 0)
|
||||
{
|
||||
offMon = MonsterCenter.getIns().getMonById(team.monsters[monOn_para.position]);
|
||||
}
|
||||
team.monsters[monOn_para.position] = monOn_para.mid;
|
||||
if(offMon != null)
|
||||
{
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.MONSTER_REMOVE_TEAM,{"mid":offMon.id}));
|
||||
offMon = null;
|
||||
}
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.MONSTER_ADD_FIGHTSTACK,{"mid":monOn_para.mid}));
|
||||
if(onMonOnComplete != null)
|
||||
{
|
||||
onMonOnComplete();
|
||||
onMonOnComplete = null;
|
||||
}
|
||||
monOn_para = null;
|
||||
}
|
||||
|
||||
public function checkMonsterInTeam(monId:Number) : Boolean
|
||||
{
|
||||
for each(var t:TeamVo in Master.teams)
|
||||
{
|
||||
if(t.monsters.indexOf(monId) != -1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getAllTeamMonsterId() : Array
|
||||
{
|
||||
var arr:Array = [];
|
||||
for each(var t:TeamVo in Master.teams)
|
||||
{
|
||||
arr = arr.concat(t.monsters);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
public function monOff(teamname:String = "", position:int = 1, onComplete:Function = null) : void
|
||||
{
|
||||
onMonOffComplete = onComplete;
|
||||
monOff_para = {
|
||||
"teamname":teamname,
|
||||
"position":position
|
||||
};
|
||||
NetTeam.getIns().monOff(teamname,position,monOffHandler);
|
||||
}
|
||||
|
||||
private function monOffHandler(re:Object = null) : void
|
||||
{
|
||||
var teamVo:TeamVo = getTeamByTeamName(monOff_para.teamname);
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.MONSTER_REMOVE_TEAM,{"mid":teamVo.monsters[monOff_para.position]}));
|
||||
teamVo.monsters[monOff_para.position] = 0;
|
||||
monOff_para = null;
|
||||
if(onMonOffComplete != null)
|
||||
{
|
||||
onMonOffComplete();
|
||||
onMonOffComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function getBattleTeamVo(choseTeamName:String = "") : BattleTeamVo
|
||||
{
|
||||
var i:int = 0;
|
||||
var m:BattleMonVo = null;
|
||||
if(choseTeamName == "")
|
||||
{
|
||||
choseTeamName = (Master.teams[0] as TeamVo).teamName;
|
||||
}
|
||||
var teamVo:TeamVo = getTeamByTeamName(choseTeamName);
|
||||
var battleTeamVo:BattleTeamVo = new BattleTeamVo();
|
||||
battleTeamVo.ap = Master.ap;
|
||||
battleTeamVo.apMax = battleTeamVo.ap;
|
||||
battleTeamVo.numMax = TeamCenter.getIns().fightMonsterNum;
|
||||
battleTeamVo.team = 1;
|
||||
battleTeamVo.name = Master.name;
|
||||
for(i = 0; i < teamVo.monsters.length; )
|
||||
{
|
||||
if(teamVo.monsters[i] > 0)
|
||||
{
|
||||
m = MonsterCenter.getIns().getBattleMonVoByMid(teamVo.monsters[i]);
|
||||
if(m != null)
|
||||
{
|
||||
m.team = 1;
|
||||
m.from = "master";
|
||||
m.apRecovery = true;
|
||||
battleTeamVo.mons.push(m);
|
||||
m.teamPos = teamPos2battleTeamPos[i];
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return battleTeamVo;
|
||||
}
|
||||
|
||||
public function checkTeamLegal(teamName:String, show:Boolean = false) : Object
|
||||
{
|
||||
var illegal:Array = null;
|
||||
var team:TeamVo = null;
|
||||
var mons:Array = null;
|
||||
var max:int = 0;
|
||||
var cur:int = 0;
|
||||
if(Table.team_info.teamMonTypes[teamName] != null)
|
||||
{
|
||||
illegal = [];
|
||||
team = TeamCenter.getIns().getTeamByTeamName(teamName);
|
||||
mons = MonsterCenter.getIns().getMonByIds(team.monsters);
|
||||
for each(var mon:MonsterVo in mons)
|
||||
{
|
||||
if(Table.team_info.teamMonTypes[teamName].indexOf(mon.type) == -1)
|
||||
{
|
||||
illegal.push(mon);
|
||||
}
|
||||
}
|
||||
if(illegal.length > 0)
|
||||
{
|
||||
if(show)
|
||||
{
|
||||
Alert.showMsg(lang("队伍中有不符合类型规定的魔物。"));
|
||||
}
|
||||
return illegal;
|
||||
}
|
||||
}
|
||||
if(Table.team_info.teamStar[teamName] != null)
|
||||
{
|
||||
max = int(Table.team_info.teamStar[teamName]);
|
||||
cur = TeamCenter.getIns().getTeamAllStar(teamName);
|
||||
if(max != 0 && cur > max)
|
||||
{
|
||||
Alert.showMsg(lang("队伍中的魔物星级总数已超出规定。"));
|
||||
return cur - max;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getTeamAllStar(teamName:String) : int
|
||||
{
|
||||
var i:int = 0;
|
||||
var m:MonsterVo = null;
|
||||
var count:int = 0;
|
||||
var teamVo:TeamVo = getTeamByTeamName(teamName);
|
||||
for(i = 0; i < teamVo.monsters.length; )
|
||||
{
|
||||
if(teamVo.monsters[i] > 0)
|
||||
{
|
||||
m = MonsterCenter.getIns().getMonById(teamVo.monsters[i]);
|
||||
count += m.star;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public function checkTeamVail(teamName:String = "", show:Boolean = false) : Boolean
|
||||
{
|
||||
var teamvo:TeamVo = null;
|
||||
var mon:MonsterVo = null;
|
||||
teamvo = getTeamByTeamName(teamName);
|
||||
var num:int = 0;
|
||||
for each(var s:int in teamvo.monsters)
|
||||
{
|
||||
if(s > 0)
|
||||
{
|
||||
mon = MonsterCenter.getIns().getMonById(s);
|
||||
if(mon.inExploreTeam)
|
||||
{
|
||||
checkTeamVailType = 1;
|
||||
if(show)
|
||||
{
|
||||
Alert.showMsg(lang("战阵中的魔物正在外出探索。"));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
num++;
|
||||
}
|
||||
}
|
||||
if(num > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
checkTeamVailType = 0;
|
||||
if(show)
|
||||
{
|
||||
Alert.showMsg(lang("战阵中没有可用的魔物。"));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function checkTeamHasEmpty(teamName:String = "") : Boolean
|
||||
{
|
||||
var teamvo:TeamVo = null;
|
||||
if(teamName == "")
|
||||
{
|
||||
teamName = Master.curBattleTeam;
|
||||
}
|
||||
teamvo = getTeamByTeamName(teamName);
|
||||
if(teamvo.hasEmpty() > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getFightStackMonsters(teamName:String = "") : Array
|
||||
{
|
||||
var mons:Array = [];
|
||||
var teamVo:TeamVo = getTeamByTeamName(teamName);
|
||||
for each(var mid:Number in teamVo.monsters)
|
||||
{
|
||||
if(mid > 0)
|
||||
{
|
||||
mons.push(MonsterCenter.getIns().getMonById(mid));
|
||||
}
|
||||
}
|
||||
return mons;
|
||||
}
|
||||
|
||||
public function get fightMonsterNum() : int
|
||||
{
|
||||
var j:int = 0;
|
||||
var i:int = 0;
|
||||
for(j = 0; Table.team_info.battleTeam[j.toString()] != null; )
|
||||
{
|
||||
if(Master.level >= Table.team_info.battleTeam[j].level)
|
||||
{
|
||||
i++;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
if(i > 4)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
public function getTeamZdl(teamName:String) : int
|
||||
{
|
||||
var i:int = 0;
|
||||
var mon:MonsterVo = null;
|
||||
var zdl:int = 0;
|
||||
var teamVo:TeamVo = getTeamByTeamName(teamName);
|
||||
for(i = 0; i < teamVo.monsters.length; )
|
||||
{
|
||||
if(teamVo.monsters[i] > 0)
|
||||
{
|
||||
mon = MonsterCenter.getIns().getMonById(teamVo.monsters[i]);
|
||||
zdl += GameMath.zl_monVo(mon);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return zdl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.common.driver.ClockDriver;
|
||||
import net.pixvi.myr.net.NetSystem;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class TimeCenter
|
||||
{
|
||||
|
||||
private var onStartTimeSynchroComplete:Function;
|
||||
|
||||
public function TimeCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : TimeCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(TimeCenter);
|
||||
}
|
||||
|
||||
public static function get timestamp() : Number
|
||||
{
|
||||
return ClockDriver.getInstance().timestamp;
|
||||
}
|
||||
|
||||
public function startTimeSynchro(onsynchroComplete:Function = null) : void
|
||||
{
|
||||
onStartTimeSynchroComplete = onsynchroComplete;
|
||||
NetSystem.getIns().synchroTime(startTimeSynchroHandler);
|
||||
}
|
||||
|
||||
private function startTimeSynchroHandler(timeSecond:Number) : void
|
||||
{
|
||||
ClockDriver.getInstance().timestamp = timeSecond;
|
||||
if(onStartTimeSynchroComplete != null)
|
||||
{
|
||||
onStartTimeSynchroComplete();
|
||||
onStartTimeSynchroComplete = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package net.pixvi.myr.element
|
||||
{
|
||||
import net.pixvi.common.system.language.lang;
|
||||
|
||||
public class MonsterElement
|
||||
{
|
||||
|
||||
public static var elementNameDic:Object = {
|
||||
"1":"水",
|
||||
"2":"火",
|
||||
"3":"地",
|
||||
"4":"风",
|
||||
"5":"无"
|
||||
};
|
||||
|
||||
public static var elementDesDic:Object = {
|
||||
"1":"水属性<br/>克制火属性<br/>被地属性克制",
|
||||
"2":"火属性<br/>克制风属性<br/>被水属性克制",
|
||||
"3":"地属性<br/>克制水属性<br/>被风属性克制",
|
||||
"4":"风属性<br/>克制地属性<br/>被火属性克制",
|
||||
"5":"不克制任何属性<br/>不被任何属性克制"
|
||||
};
|
||||
|
||||
public static var elementBossDes:Object = {
|
||||
"1":"【地属性伤害+15%】",
|
||||
"2":"【水属性伤害+15%】",
|
||||
"3":"【风属性伤害+15%】",
|
||||
"4":"【火属性伤害+15%】"
|
||||
};
|
||||
|
||||
public function MonsterElement()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getElementName(element:int) : String
|
||||
{
|
||||
return lang(elementNameDic[element]);
|
||||
}
|
||||
|
||||
public static function getElementTip(element:int) : String
|
||||
{
|
||||
return lang(elementDesDic[element]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package net.pixvi.myr.element
|
||||
{
|
||||
import net.pixvi.common.utils.PiObject;
|
||||
|
||||
public class SettingVo extends PiObject
|
||||
{
|
||||
|
||||
public var quality:int = 3;
|
||||
|
||||
public var openBgm:Boolean = true;
|
||||
|
||||
public var openEffect:Boolean = true;
|
||||
|
||||
public var liuhaiMode:Boolean = false;
|
||||
|
||||
public var openVocal:Boolean = true;
|
||||
|
||||
public var quickSkill:Boolean = true;
|
||||
|
||||
public var globalVolume:Number = 1;
|
||||
|
||||
public function SettingVo()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
package net.pixvi.myr.element.achi
|
||||
{
|
||||
public class AchiType
|
||||
{
|
||||
|
||||
public static var HUNTER:String = "hunter";
|
||||
|
||||
public static var FEED:String = "feed";
|
||||
|
||||
public static var COLLECTION:String = "collection";
|
||||
|
||||
public static var LIB:String = "lib";
|
||||
|
||||
public static var EQUIP:String = "equipLib";
|
||||
|
||||
public static var STAGE:String = "stage";
|
||||
|
||||
public static var STARS:String = "stars";
|
||||
|
||||
public static var MONEY:String = "money";
|
||||
|
||||
public static var PULL_MENU:String = "pullMenu";
|
||||
|
||||
public static var LEVEL:String = "level";
|
||||
|
||||
public static var STAGE_LEVELS:String = "stageLevel";
|
||||
|
||||
public static var ENTANGLE:String = "entangle";
|
||||
|
||||
public static var ITEM:String = "item";
|
||||
|
||||
public static var NONE:String = "none";
|
||||
|
||||
public static var SKIN:String = "skin";
|
||||
|
||||
public static var CHECK_DAY:String = "check";
|
||||
|
||||
public static var CHECK_DAY_TOTAL:String = "checkTotal";
|
||||
|
||||
public static var achiTypeObject:Object = {
|
||||
"hunter":{
|
||||
"type":1001001,
|
||||
"num":100
|
||||
},
|
||||
"feed":{
|
||||
"type":1001001,
|
||||
"num":10
|
||||
},
|
||||
"collection":{"types":[1001001,2002001]},
|
||||
"stage":{
|
||||
"stage":"0101",
|
||||
"level":"1"
|
||||
},
|
||||
"stars":{
|
||||
"num":5,
|
||||
"city":1
|
||||
},
|
||||
"money":{"num":1000},
|
||||
"pullMenu":{"num":50},
|
||||
"battleCount":{"num":50},
|
||||
"lib":{"num":10},
|
||||
"equipLib":{"num":10},
|
||||
"level":{"level":10},
|
||||
"stageLevel":{"stageLevels":{"0101":["2","3"]}},
|
||||
"entangle":{
|
||||
"num":1,
|
||||
"star":"12345",
|
||||
"level":"1"
|
||||
},
|
||||
"item":{
|
||||
"itemType":"10001",
|
||||
"num":"1"
|
||||
},
|
||||
"none":{"passGuide":""},
|
||||
"skin":{"num":10},
|
||||
"check":{"num":10},
|
||||
"checkTotal":{"num":100}
|
||||
};
|
||||
|
||||
public static var achiTypeDes:Object = {
|
||||
"hunter":{"des":"狩猎{type}魔物{num}只"},
|
||||
"feed":{"des":"养成{type}成年魔物{num}只"},
|
||||
"collection":{"des":"图鉴解锁目标全部魔物{types[...]}"},
|
||||
"stage":{"des":"通过关卡{stage}的{level}难度探索"},
|
||||
"stars":{"des":"累积获得{city}区域的关卡星星{num}个"},
|
||||
"money":{"des":"累积赚取{num}金币"},
|
||||
"pullMenu":{"des":"玩弄背包挂件{num}次"},
|
||||
"battleCount":{"des":"累积进行了战斗{num}次"},
|
||||
"lib":{"des":"总解锁的魔物图鉴数量{num}"},
|
||||
"equipLib":{"des":"总解锁的装备图鉴数量{num}"},
|
||||
"level":{"des":"当角色达到{level}级时可完成成就"},
|
||||
"stageLevel":{"des":"当通过制定关卡的指定难度时,完成成就"},
|
||||
"entangle":{"des":"{star}星级范围的魔物累计达到或超过{level}羁绊{num}只,成就完成"},
|
||||
"item":{"des":"拥有类型{itemType}道具{num}个时,完成成就"},
|
||||
"none":{"des":"完成指引{guidePass}时可完成成就"},
|
||||
"skin":{"des":"收集到{num}个皮肤时完成"},
|
||||
"check":{"des":"连续获得补给{num}天时完成"},
|
||||
"checkTotal":{"des":"累计获得补给{num}天时完成"}
|
||||
};
|
||||
|
||||
public function AchiType()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,324 @@
|
||||
package net.pixvi.myr.element.achi
|
||||
{
|
||||
import net.pixvi.common.utils.PiObject;
|
||||
import net.pixvi.myr.center.BagCenter;
|
||||
import net.pixvi.myr.center.GuideCenter;
|
||||
import net.pixvi.myr.center.LibCenter;
|
||||
import net.pixvi.myr.center.Master;
|
||||
import net.pixvi.myr.center.StageCenter;
|
||||
import net.pixvi.myr.center.Table;
|
||||
import net.pixvi.myr.element.mon.MonsterVo;
|
||||
import net.pixvi.myr.element.reward.RewardVo;
|
||||
import net.pixvi.pfw.utils.ArrayUtil;
|
||||
|
||||
public class AchiVo extends PiObject
|
||||
{
|
||||
|
||||
public var id:int;
|
||||
|
||||
public var isComplete:Boolean = false;
|
||||
|
||||
public var showComplete:Boolean = false;
|
||||
|
||||
public function AchiVo()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(id:int) : void
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public function get next() : Array
|
||||
{
|
||||
return table().next;
|
||||
}
|
||||
|
||||
public function get name() : String
|
||||
{
|
||||
return table().name;
|
||||
}
|
||||
|
||||
public function get des() : String
|
||||
{
|
||||
return table().des;
|
||||
}
|
||||
|
||||
public function get reward() : Object
|
||||
{
|
||||
return table().reward;
|
||||
}
|
||||
|
||||
public function get closed() : Boolean
|
||||
{
|
||||
if(table().closed == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return table().closed;
|
||||
}
|
||||
|
||||
public function get rewardvo() : RewardVo
|
||||
{
|
||||
var r:RewardVo = new RewardVo();
|
||||
r.setByObject(reward);
|
||||
return r;
|
||||
}
|
||||
|
||||
public function get desOfProcess() : String
|
||||
{
|
||||
var stars:String = null;
|
||||
var num:int = 0;
|
||||
var cur:* = 0;
|
||||
var target:int = 0;
|
||||
switch(type)
|
||||
{
|
||||
case AchiType.COLLECTION:
|
||||
cur = LibCenter.getIns().getNumUnlockByMonTypes(ArrayUtil.split(achiPara.types,",",true));
|
||||
target = int(achiPara.types.length);
|
||||
break;
|
||||
case AchiType.FEED:
|
||||
if(Master.history.numFeedMonsters[achiPara.type] == null)
|
||||
{
|
||||
Master.history.numFeedMonsters[achiPara.type] = 0;
|
||||
}
|
||||
cur = int(Master.history.numFeedMonsters[achiPara.type]);
|
||||
target = int(achiPara.num);
|
||||
break;
|
||||
case AchiType.SKIN:
|
||||
if(Master.history.unlockSkins == null)
|
||||
{
|
||||
cur = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
cur = int(Master.history.unlockSkins.length);
|
||||
}
|
||||
target = int(achiPara.num);
|
||||
break;
|
||||
case AchiType.HUNTER:
|
||||
if(Master.history.numKillMonsters[achiPara.type] == null)
|
||||
{
|
||||
Master.history.numKillMonsters[achiPara.type] = 0;
|
||||
}
|
||||
cur = int(Master.history.numKillMonsters[achiPara.type]);
|
||||
target = int(achiPara.num);
|
||||
break;
|
||||
case AchiType.MONEY:
|
||||
cur = int(Master.history.numAddMoney);
|
||||
target = int(achiPara.num);
|
||||
break;
|
||||
case AchiType.STAGE:
|
||||
cur = 0;
|
||||
target = 1;
|
||||
break;
|
||||
case AchiType.STARS:
|
||||
cur = StageCenter.getIns().countStars();
|
||||
target = int(achiPara.num);
|
||||
break;
|
||||
case AchiType.PULL_MENU:
|
||||
cur = int(Master.history.pullMenu);
|
||||
target = int(achiPara.num);
|
||||
break;
|
||||
case AchiType.ENTANGLE:
|
||||
stars = achiPara.star;
|
||||
num = 0;
|
||||
for each(var m:MonsterVo in Master.monsters)
|
||||
{
|
||||
if(m.entangle && stars.indexOf(m.star.toString()) >= 0)
|
||||
{
|
||||
num++;
|
||||
}
|
||||
}
|
||||
cur = num;
|
||||
target = int(achiPara.num);
|
||||
break;
|
||||
case AchiType.LEVEL:
|
||||
cur = int(Master.level);
|
||||
target = int(achiPara.level);
|
||||
break;
|
||||
case AchiType.ITEM:
|
||||
cur = BagCenter.getIns().getNum(achiPara.itemType);
|
||||
target = int(achiPara.num);
|
||||
break;
|
||||
case AchiType.STAGE_LEVELS:
|
||||
target = 0;
|
||||
cur = 0;
|
||||
for(var key:String in achiPara.stageLevels)
|
||||
{
|
||||
for each(var slv:String in achiPara.stageLevels[key])
|
||||
{
|
||||
if(StageCenter.getIns().isStagePass(key,int(slv)))
|
||||
{
|
||||
cur++;
|
||||
}
|
||||
target++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return cur + "/" + target;
|
||||
}
|
||||
|
||||
public function get achiPara() : Object
|
||||
{
|
||||
return table().achiPara;
|
||||
}
|
||||
|
||||
public function get achiType() : String
|
||||
{
|
||||
return table().achiType;
|
||||
}
|
||||
|
||||
public function get achiTag() : String
|
||||
{
|
||||
return table().tag;
|
||||
}
|
||||
|
||||
public function get type() : String
|
||||
{
|
||||
return table().achiType;
|
||||
}
|
||||
|
||||
public function get hide() : Boolean
|
||||
{
|
||||
return table().hide;
|
||||
}
|
||||
|
||||
public function table() : Object
|
||||
{
|
||||
return Table.achi_info[id];
|
||||
}
|
||||
|
||||
public function canFinish() : Boolean
|
||||
{
|
||||
var cur:int = 0;
|
||||
var target:int = 0;
|
||||
var stars:String = null;
|
||||
var num:int = 0;
|
||||
var itemnum:int = 0;
|
||||
var daynum:int = 0;
|
||||
daynum = 0;
|
||||
switch(type)
|
||||
{
|
||||
case AchiType.COLLECTION:
|
||||
return LibCenter.getIns().checkUnlocks(ArrayUtil.split(achiPara.types));
|
||||
case AchiType.FEED:
|
||||
if(Master.history.numFeedMonsters[achiPara.type] == null)
|
||||
{
|
||||
Master.history.numFeedMonsters[achiPara.type] = 0;
|
||||
}
|
||||
return Master.history.numFeedMonsters[achiPara.type] >= achiPara.num;
|
||||
case AchiType.HUNTER:
|
||||
if(Master.history.numKillMonsters[achiPara.type] == null)
|
||||
{
|
||||
Master.history.numKillMonsters[achiPara.type] = 0;
|
||||
}
|
||||
return Master.history.numKillMonsters[achiPara.type] >= achiPara.num;
|
||||
case AchiType.MONEY:
|
||||
return Master.history.numAddMoney >= achiPara.num;
|
||||
case AchiType.STAGE:
|
||||
if(Master.history.passStage[achiPara.stage] == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(Master.history.passStage[achiPara.stage][1] == true)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case AchiType.STARS:
|
||||
return StageCenter.getIns().countStars() >= achiPara.num;
|
||||
case AchiType.PULL_MENU:
|
||||
return Master.history.pullMenu >= achiPara.num;
|
||||
case AchiType.LEVEL:
|
||||
return Master.level >= achiPara.level;
|
||||
case AchiType.STAGE_LEVELS:
|
||||
loop0:
|
||||
for(var key:String in achiPara.stageLevels)
|
||||
{
|
||||
var _loc11_:int = 0;
|
||||
var _loc10_:* = achiPara.stageLevels[key];
|
||||
do
|
||||
{
|
||||
for each(var slv:String in _loc10_)
|
||||
{
|
||||
}
|
||||
continue loop0;
|
||||
}
|
||||
while(StageCenter.getIns().isStagePass(key,int(slv)));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
case AchiType.SKIN:
|
||||
cur = 0;
|
||||
if(Master.history.unlockSkins == null)
|
||||
{
|
||||
cur = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
cur = int(Master.history.unlockSkins.length);
|
||||
}
|
||||
target = int(achiPara.num);
|
||||
if(target <= cur)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case AchiType.ENTANGLE:
|
||||
stars = achiPara.star;
|
||||
num = 0;
|
||||
for each(var m:MonsterVo in Master.monsters)
|
||||
{
|
||||
if(m.entangle && m.entangleLevel >= int(achiPara.level) && stars.indexOf(m.star.toString()) >= 0)
|
||||
{
|
||||
num++;
|
||||
}
|
||||
}
|
||||
if(num >= achiPara.num)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case AchiType.ITEM:
|
||||
itemnum = BagCenter.getIns().getNum(achiPara.itemType);
|
||||
if(itemnum >= achiPara.num)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case AchiType.CHECK_DAY:
|
||||
daynum = int(Master.activityHistory.dailyGiftCount);
|
||||
if(daynum >= achiPara.num)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case AchiType.CHECK_DAY:
|
||||
daynum = int(Master.activityHistory.dailyGiftSignCount);
|
||||
if(daynum >= achiPara.num)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case AchiType.NONE:
|
||||
if(achiPara.passGuide != null)
|
||||
{
|
||||
return GuideCenter.getIns().checkFin(achiPara.passGuide);
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package net.pixvi.myr.element.alchemy
|
||||
{
|
||||
import net.pixvi.common.utils.PiObject;
|
||||
import net.pixvi.myr.GameMath;
|
||||
import net.pixvi.myr.center.AlchemyCenter;
|
||||
import net.pixvi.myr.center.TimeCenter;
|
||||
|
||||
public class AlchemyStackVo extends PiObject
|
||||
{
|
||||
|
||||
public var id:int;
|
||||
|
||||
public var endTime:int;
|
||||
|
||||
public var itemTypes:Array = [];
|
||||
|
||||
public var starting:Boolean = false;
|
||||
|
||||
private var _formulaLevel:int = -1;
|
||||
|
||||
public function AlchemyStackVo()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function finish() : Boolean
|
||||
{
|
||||
if(leftTime() == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function leftTime() : int
|
||||
{
|
||||
var time:int = endTime - TimeCenter.timestamp;
|
||||
if(time < 0)
|
||||
{
|
||||
time = 0;
|
||||
}
|
||||
return time;
|
||||
}
|
||||
|
||||
public function curFormulaLevelInfo() : Object
|
||||
{
|
||||
return GameMath.alchemyFormulaCost[formulaLevel.toString()];
|
||||
}
|
||||
|
||||
public function checkFormula() : Boolean
|
||||
{
|
||||
return AlchemyCenter.getIns().checkAlchemyFormula(itemTypes);
|
||||
}
|
||||
|
||||
public function get formulaLevel() : int
|
||||
{
|
||||
if(_formulaLevel == -1)
|
||||
{
|
||||
_formulaLevel = AlchemyCenter.getIns().getFormulaLevel(itemTypes);
|
||||
}
|
||||
return _formulaLevel;
|
||||
}
|
||||
|
||||
public function process() : Number
|
||||
{
|
||||
return 1 - leftTime() / curFormulaLevelInfo().time;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package net.pixvi.myr.element.alchemy
|
||||
{
|
||||
import net.pixvi.common.system.language.lang;
|
||||
|
||||
public class EquipType
|
||||
{
|
||||
|
||||
public static var _partNameDic:Object;
|
||||
|
||||
public function EquipType()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function get partNameDic() : Object
|
||||
{
|
||||
if(_partNameDic == null)
|
||||
{
|
||||
_partNameDic = {
|
||||
"1":lang("武器"),
|
||||
"2":lang("防具"),
|
||||
"3":lang("饰品"),
|
||||
"4":lang("头部装饰"),
|
||||
"5":lang("身体装饰")
|
||||
};
|
||||
}
|
||||
return _partNameDic;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package net.pixvi.myr.element.alchemy
|
||||
{
|
||||
import net.pixvi.myr.center.Table;
|
||||
|
||||
public class MaterialType
|
||||
{
|
||||
|
||||
public function MaterialType()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function get materialDic() : Object
|
||||
{
|
||||
return Table.setting.materialDic;
|
||||
}
|
||||
|
||||
public static function getMaterialsTip(types:Array) : Array
|
||||
{
|
||||
var i:int = 0;
|
||||
var o2:Object = null;
|
||||
var materials:Array = [];
|
||||
var allmat:Object = {};
|
||||
for each(var type:int in types)
|
||||
{
|
||||
for each(var o:Object in Table.item_info[type].material)
|
||||
{
|
||||
if(allmat[o.name] == null)
|
||||
{
|
||||
allmat[o.name] = 0;
|
||||
}
|
||||
var _loc10_:* = o.name;
|
||||
var _loc11_:Number = allmat[_loc10_] + int(o.value);
|
||||
allmat[_loc10_] = _loc11_;
|
||||
}
|
||||
}
|
||||
for(var key:String in allmat)
|
||||
{
|
||||
materials.push({
|
||||
"name":key,
|
||||
"value":int(allmat[key])
|
||||
});
|
||||
}
|
||||
materials.sortOn("value",2 | 0x10);
|
||||
var final:Array = [];
|
||||
for(i = 0; i < materials.length; )
|
||||
{
|
||||
o2 = materials[i];
|
||||
final.push(materialDic[o2.name] + "×" + o2.value);
|
||||
i++;
|
||||
}
|
||||
return final;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
package net.pixvi.myr.element.bag
|
||||
{
|
||||
import net.pixvi.common.utils.PiObject;
|
||||
|
||||
public class BagVo extends PiObject
|
||||
{
|
||||
|
||||
public var items:Array = [];
|
||||
|
||||
public var level:int = 1;
|
||||
|
||||
public function BagVo()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function sellableItems() : Array
|
||||
{
|
||||
var i:int = 0;
|
||||
var arr:Array = [];
|
||||
for(i = 0; i < items.length; )
|
||||
{
|
||||
if(items[i].itemType != ItemType.TYPE_EQUIP && items[i].itemType != ItemType.TYPE_EGG && items[i].sellable)
|
||||
{
|
||||
arr.push(items[i]);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
public function alchemyMaterialItems() : Array
|
||||
{
|
||||
var vo:ItemVo = null;
|
||||
var i:int = 0;
|
||||
var arr:Array = [];
|
||||
var equip:Array = [];
|
||||
for(i = 0; i < items.length; )
|
||||
{
|
||||
vo = items[i];
|
||||
if(vo.itemType == ItemType.TYPE_MATERIAL)
|
||||
{
|
||||
if(vo.sellable && vo.showNum > 0)
|
||||
{
|
||||
arr.push(items[i]);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
public function removeItem(id:Number) : ItemVo
|
||||
{
|
||||
var i:int = 0;
|
||||
for(i = 0; i < items.length; )
|
||||
{
|
||||
if(items[i].id == id)
|
||||
{
|
||||
return items.splice(i,1)[0];
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function isFull() : Boolean
|
||||
{
|
||||
if(items.length >= getSpace())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getSpace() : int
|
||||
{
|
||||
return 1000;
|
||||
}
|
||||
|
||||
public function getItemArr() : Array
|
||||
{
|
||||
var i:int = 0;
|
||||
var arr:Array = [];
|
||||
for(i = 0; i < items.length; )
|
||||
{
|
||||
if(items[i].itemType != ItemType.TYPE_EQUIP && items[i].itemType != ItemType.TYPE_EGG)
|
||||
{
|
||||
arr.push(items[i]);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
public function getItemArrUseable() : Array
|
||||
{
|
||||
var i:int = 0;
|
||||
var arr:Array = [];
|
||||
for(i = 0; i < items.length; )
|
||||
{
|
||||
if(items[i].itemType != ItemType.TYPE_EQUIP && items[i].itemType != ItemType.TYPE_EGG && items[i].useable)
|
||||
{
|
||||
arr.push(items[i]);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
public function getItemArrQuality(quality:int) : Array
|
||||
{
|
||||
var i:int = 0;
|
||||
var arr:Array = [];
|
||||
for(i = 0; i < items.length; )
|
||||
{
|
||||
if(items[i].itemType != ItemType.TYPE_EQUIP && items[i].itemType != ItemType.TYPE_EGG && items[i].quality == quality)
|
||||
{
|
||||
arr.push(items[i]);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
public function getEquipArr(part:int = -1, quality:int = 0) : Array
|
||||
{
|
||||
var i:int = 0;
|
||||
var arr:Array = [];
|
||||
for(i = 0; i < items.length; )
|
||||
{
|
||||
if(items[i].itemType == ItemType.TYPE_EQUIP && !items[i].isUsed && (part == -1 || items[i].part == part) && (quality == 0 || items[i].quality == quality))
|
||||
{
|
||||
arr.push(items[i]);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
public function getEggArr() : Array
|
||||
{
|
||||
var i:int = 0;
|
||||
var arr:Array = [];
|
||||
for(i = 0; i < items.length; )
|
||||
{
|
||||
if(items[i].itemType == ItemType.TYPE_EGG)
|
||||
{
|
||||
arr.push(items[i]);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package net.pixvi.myr.element.bag
|
||||
{
|
||||
public class BuildMaterialVo
|
||||
{
|
||||
|
||||
public var cores:Object;
|
||||
|
||||
public var materials:Object;
|
||||
|
||||
public function BuildMaterialVo()
|
||||
{
|
||||
super();
|
||||
cores = {};
|
||||
materials = {};
|
||||
}
|
||||
|
||||
public function buildByItemVoArr(items:Array) : void
|
||||
{
|
||||
var j:int = 0;
|
||||
for each(var item:ItemVo in items)
|
||||
{
|
||||
if(cores[item.type] == null)
|
||||
{
|
||||
cores[item.type] = 0;
|
||||
}
|
||||
cores[item.type]++;
|
||||
for(j = 0; j < item.material.length; )
|
||||
{
|
||||
if(materials[item.material[j].name] == null)
|
||||
{
|
||||
materials[item.material[j].name] = 0;
|
||||
}
|
||||
var _loc4_:* = item.material[j].name;
|
||||
var _loc5_:Number = materials[_loc4_] + int(item.material[j].value);
|
||||
materials[_loc4_] = _loc5_;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package net.pixvi.myr.element.bag
|
||||
{
|
||||
public class EquipBuildVo
|
||||
{
|
||||
|
||||
public var type:int;
|
||||
|
||||
public var material:Array;
|
||||
|
||||
public var core:Array;
|
||||
|
||||
public var chance:int;
|
||||
|
||||
public function EquipBuildVo()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function check(buildMaterialVo:BuildMaterialVo) : Boolean
|
||||
{
|
||||
var i:int = 0;
|
||||
var j:int = 0;
|
||||
for(i = 0; i < core.length; )
|
||||
{
|
||||
if(buildMaterialVo.cores[core[i].name] == null || buildMaterialVo.cores[core[i].name] < core[i].value)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
for(j = 0; j < material.length; )
|
||||
{
|
||||
if(buildMaterialVo.materials[material[j].name] == null || buildMaterialVo.materials[material[j].name] < material[j].value)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
package net.pixvi.myr.element.bag
|
||||
{
|
||||
import net.pixvi.myr.center.Table;
|
||||
import net.pixvi.myr.element.mon.MonsterVo;
|
||||
|
||||
public class EquipLimitVo
|
||||
{
|
||||
|
||||
public var type:int = 0;
|
||||
|
||||
public var element:int = 0;
|
||||
|
||||
public var group:int = 0;
|
||||
|
||||
public function EquipLimitVo()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function onData(data:Object) : void
|
||||
{
|
||||
if(data.type != null)
|
||||
{
|
||||
type = data.type;
|
||||
}
|
||||
if(data.element != null)
|
||||
{
|
||||
element = data.element;
|
||||
}
|
||||
if(data.group != null)
|
||||
{
|
||||
group = data.group;
|
||||
}
|
||||
}
|
||||
|
||||
public function hasLimit() : Boolean
|
||||
{
|
||||
if(type == 0 && element == 0 && group == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function check(vo:MonsterVo) : Boolean
|
||||
{
|
||||
if(type != 0 && type != vo.type)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(element != 0 && element != vo.element)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(group != 0 && group != vo.group)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getDes() : String
|
||||
{
|
||||
var des:String = "";
|
||||
if(type != 0)
|
||||
{
|
||||
des = MonsterVo.getName(type) + " 专属";
|
||||
}
|
||||
else if(element != 0)
|
||||
{
|
||||
des = "属性限定:" + Table.monster_setting.element[element].name;
|
||||
}
|
||||
else if(group != 0)
|
||||
{
|
||||
des = "物种限定:" + Table.monster_setting.group[group].name;
|
||||
}
|
||||
return des;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,305 @@
|
||||
package net.pixvi.myr.element.bag
|
||||
{
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.myr.center.Table;
|
||||
import net.pixvi.myr.element.alchemy.EquipType;
|
||||
import net.pixvi.pfw.utils.Paster;
|
||||
import net.pixvi.pfw.utils.PointLocker;
|
||||
import net.pixvi.pfw.utils.Saver;
|
||||
|
||||
public class EquipVo extends ItemVo
|
||||
{
|
||||
|
||||
public static var EQUIP_PARAS:Array = ["atk","def","hp","dex","crit","atkSpd","atkVim","selfCure","apCostSave","deadBoom","atkStun","defStun","atkPoi","atkPoiDmg","skillCooldown","sunFire","moonHeal","thorns"];
|
||||
|
||||
public var isUsed:Boolean = false;
|
||||
|
||||
public var atk:PointLocker;
|
||||
|
||||
public var def:PointLocker;
|
||||
|
||||
public var hp:PointLocker;
|
||||
|
||||
public var dex:PointLocker;
|
||||
|
||||
public var crit:PointLocker;
|
||||
|
||||
public var atkSpd:PointLocker;
|
||||
|
||||
public var atkVim:PointLocker;
|
||||
|
||||
public var selfCure:PointLocker;
|
||||
|
||||
public var deadBoom:PointLocker;
|
||||
|
||||
public var atkStun:PointLocker;
|
||||
|
||||
public var atkStunTime:PointLocker;
|
||||
|
||||
public var atkStunType:int = 1;
|
||||
|
||||
public var defStun:PointLocker;
|
||||
|
||||
public var defStunTime:PointLocker;
|
||||
|
||||
public var defStunType:int = 1;
|
||||
|
||||
public var atkPoi:PointLocker;
|
||||
|
||||
public var atkPoiDmg:PointLocker;
|
||||
|
||||
public var atkPoiType:int = 1;
|
||||
|
||||
public var apCostSave:PointLocker;
|
||||
|
||||
public var skillCooldown:PointLocker;
|
||||
|
||||
public var sunFire:PointLocker;
|
||||
|
||||
public var moonHeal:PointLocker;
|
||||
|
||||
public var thorns:PointLocker;
|
||||
|
||||
private var limit:EquipLimitVo;
|
||||
|
||||
public function EquipVo()
|
||||
{
|
||||
super();
|
||||
atk = new PointLocker();
|
||||
def = new PointLocker();
|
||||
hp = new PointLocker();
|
||||
dex = new PointLocker();
|
||||
crit = new PointLocker();
|
||||
atkSpd = new PointLocker();
|
||||
atkVim = new PointLocker();
|
||||
selfCure = new PointLocker();
|
||||
deadBoom = new PointLocker();
|
||||
atkStun = new PointLocker();
|
||||
atkStunTime = new PointLocker();
|
||||
defStun = new PointLocker();
|
||||
defStunTime = new PointLocker();
|
||||
atkPoi = new PointLocker();
|
||||
atkPoiDmg = new PointLocker();
|
||||
apCostSave = new PointLocker();
|
||||
skillCooldown = new PointLocker();
|
||||
sunFire = new PointLocker();
|
||||
moonHeal = new PointLocker();
|
||||
thorns = new PointLocker();
|
||||
num = 1;
|
||||
}
|
||||
|
||||
public static function getAbilityEffectDes(obj:Object, paraNameMode:Boolean = false) : Array
|
||||
{
|
||||
var s:Array = [];
|
||||
var paraName:Array = [];
|
||||
if(obj.spWord != null && Table.monster_setting.spWordDes[obj.spWord] != null)
|
||||
{
|
||||
paraName.push(Table.monster_setting.spWordDes[obj.spWord]);
|
||||
s.push(Paster.font(Table.monster_setting.spWordDes[obj.spWord],"#ff3300"));
|
||||
}
|
||||
if(obj.atk.val > 0)
|
||||
{
|
||||
paraName.push(lang("攻击"));
|
||||
s.push(lang("攻击") + "+" + Math.round(obj.atk.val).toString());
|
||||
}
|
||||
if(obj.def.val > 0)
|
||||
{
|
||||
paraName.push(lang("防御"));
|
||||
s.push(lang("防御") + "+" + Math.round(obj.def.val).toString());
|
||||
}
|
||||
if(obj.hp.val > 0)
|
||||
{
|
||||
paraName.push(lang("生命"));
|
||||
s.push(lang("生命") + "+" + Math.round(obj.hp.val).toString());
|
||||
}
|
||||
if(obj.dex.val > 0)
|
||||
{
|
||||
paraName.push(lang("敏捷"));
|
||||
s.push(lang("敏捷") + "+" + Math.round(obj.dex.val).toString());
|
||||
}
|
||||
if(obj.crit.val > 0)
|
||||
{
|
||||
paraName.push(lang("暴击"));
|
||||
s.push(lang("暴击") + "+" + Math.round(obj.crit.val).toString() + "%");
|
||||
}
|
||||
if(obj.atkSpd.val > 0)
|
||||
{
|
||||
paraName.push(lang("攻速"));
|
||||
s.push(lang("攻速") + "+" + Math.round(obj.atkSpd.val).toString() + "%");
|
||||
}
|
||||
if(obj.skillCooldown.val > 0)
|
||||
{
|
||||
paraName.push(lang("冷却时间"));
|
||||
s.push(lang("冷却时间") + "-" + Math.round(obj.skillCooldown.val).toString() + "%");
|
||||
}
|
||||
if(obj.apCostSave.val > 0)
|
||||
{
|
||||
paraName.push(lang("移动消耗"));
|
||||
s.push(lang("移动消耗") + "-" + obj.apCostSave.val);
|
||||
}
|
||||
if(obj.thorns.val > 0)
|
||||
{
|
||||
paraName.push(lang("反伤"));
|
||||
s.push(lang("反伤") + obj.thorns.val + "%");
|
||||
}
|
||||
if(obj.selfCure.val > 0)
|
||||
{
|
||||
paraName.push(lang("自愈"));
|
||||
s.push(Paster.font(lang("自愈") + Math.round(obj.selfCure.val).toString(),"#ff66ff"));
|
||||
}
|
||||
if(obj.atkVim.val > 0)
|
||||
{
|
||||
paraName.push("吸血");
|
||||
s.push(Paster.font("吸血" + Math.round(obj.atkVim.val).toString() + "%","#ff66ff"));
|
||||
}
|
||||
if(obj.deadBoom.val > 0)
|
||||
{
|
||||
paraName.push("自爆");
|
||||
s.push(Paster.font("自爆" + Math.round(obj.deadBoom.val).toString(),"#ff66ff"));
|
||||
}
|
||||
if(obj.atkPoi.val > 0)
|
||||
{
|
||||
paraName.push(obj.atkPoiType == 1 ? lang("中毒") : lang("流血"));
|
||||
s.push(Paster.font((obj.atkPoiType == 1 ? lang("中毒") : lang("流血")) + Math.round(obj.atkPoi.val).toString() + "%(" + obj.atkPoiDmg.val + "/s)","#ff66ff"));
|
||||
}
|
||||
if(obj.atkStun.val > 0)
|
||||
{
|
||||
paraName.push(obj.atkStunType == 1 ? lang("攻击眩晕") : lang("攻击冰冻"));
|
||||
s.push(Paster.font((obj.atkStunType == 1 ? lang("攻击眩晕") : lang("攻击冰冻")) + Math.round(obj.atkStun.val).toString() + "%(" + obj.atkStunTime.val + "s)","#ff66ff"));
|
||||
}
|
||||
if(obj.defStun.val > 0)
|
||||
{
|
||||
paraName.push(obj.defStunType == 1 ? lang("反击眩晕") : lang("反击冰冻"));
|
||||
s.push(Paster.font((obj.defStunType == 1 ? lang("反击眩晕") : lang("反击冰冻")) + Math.round(obj.defStun.val).toString() + "%(" + obj.defStunTime.val + "s)","#ff66ff"));
|
||||
}
|
||||
if(obj.sunFire.val > 0)
|
||||
{
|
||||
paraName.push(lang("灼烧光环"));
|
||||
s.push(Paster.font(lang("灼烧光环") + Math.round(obj.sunFire.val).toString(),"#ff66ff"));
|
||||
}
|
||||
if(obj.moonHeal.val > 0)
|
||||
{
|
||||
paraName.push(lang("治疗光环"));
|
||||
s.push(Paster.font(lang("治疗光环") + Math.round(obj.moonHeal.val).toString(),"#ff66ff"));
|
||||
}
|
||||
if(paraNameMode)
|
||||
{
|
||||
return paraName;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
public function get hideo() : Boolean
|
||||
{
|
||||
return Saver.getAuto(id + "hideo");
|
||||
}
|
||||
|
||||
public function set hideo(val:Boolean) : void
|
||||
{
|
||||
return Saver.saveAuto(id + "hideo",val);
|
||||
}
|
||||
|
||||
public function get buildMaterial() : Array
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function get buildCore() : Array
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function get chance() : int
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function get effectMovs() : Array
|
||||
{
|
||||
return table().effectMovs;
|
||||
}
|
||||
|
||||
public function buildAuto(float:Number = 0) : void
|
||||
{
|
||||
var ranPara:Array = ["atk","def","hp","dex","crit","atkSpd","atkVim","selfCure","deadBoom","atkStun","defStun","atkPoi","atkPoiDmg","skillCooldown","sunFire","moonHeal","thorns"];
|
||||
var staticPara:Array = ["atkStunTime","atkStunType","defStunTime","defStunType","atkPoiType","apCostSave"];
|
||||
for each(var k:String in ranPara)
|
||||
{
|
||||
this[k].val = (1 + float) * getTable()[k];
|
||||
}
|
||||
for each(var k2:String in staticPara)
|
||||
{
|
||||
if(this[k2] is PointLocker)
|
||||
{
|
||||
this[k2].val = getTable()[k2];
|
||||
}
|
||||
else
|
||||
{
|
||||
this[k2] = getTable()[k2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getTable() : Object
|
||||
{
|
||||
return Table.item_info[type];
|
||||
}
|
||||
|
||||
public function get part() : int
|
||||
{
|
||||
return table().part;
|
||||
}
|
||||
|
||||
public function set part(val:int) : void
|
||||
{
|
||||
}
|
||||
|
||||
public function get position() : Object
|
||||
{
|
||||
return table().position;
|
||||
}
|
||||
|
||||
public function set position(val:Object) : void
|
||||
{
|
||||
}
|
||||
|
||||
public function getTip() : String
|
||||
{
|
||||
return name + "<br/>" + Paster.font(effectDes(true).join(","),"#be3cd5",18,true);
|
||||
}
|
||||
|
||||
public function effectDes(paraNameMode:Boolean = false) : Array
|
||||
{
|
||||
return getAbilityEffectDes(this,paraNameMode);
|
||||
}
|
||||
|
||||
public function getLimit() : EquipLimitVo
|
||||
{
|
||||
if(limit != null)
|
||||
{
|
||||
return limit;
|
||||
}
|
||||
if(table().limit == null)
|
||||
{
|
||||
limit = new EquipLimitVo();
|
||||
}
|
||||
else
|
||||
{
|
||||
limit = new EquipLimitVo();
|
||||
limit.onData(table().limit);
|
||||
}
|
||||
return limit;
|
||||
}
|
||||
|
||||
public function get spWord() : String
|
||||
{
|
||||
return table().spWord;
|
||||
}
|
||||
|
||||
public function get typeName() : String
|
||||
{
|
||||
return EquipType.partNameDic[part.toString()];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
package net.pixvi.myr.element.bag
|
||||
{
|
||||
import net.pixvi.common.system.language.lang;
|
||||
|
||||
public class ItemType
|
||||
{
|
||||
|
||||
public static var TYPE_USEABLE:int = 1;
|
||||
|
||||
public static var TYPE_TOOL:int = 2;
|
||||
|
||||
public static var TYPE_MATERIAL:int = 3;
|
||||
|
||||
public static var TYPE_OTHER:int = 4;
|
||||
|
||||
public static var TYPE_EQUIP:int = 5;
|
||||
|
||||
public static var TYPE_EGG:int = 6;
|
||||
|
||||
public static var _equipDic:Object;
|
||||
|
||||
public static var _equipQuality:Object;
|
||||
|
||||
public static var typeDic:Array = [{
|
||||
"itemType":1,
|
||||
"name":"使用",
|
||||
"editname":"1.使用"
|
||||
},{
|
||||
"itemType":2,
|
||||
"name":"消耗",
|
||||
"editname":"2.消耗"
|
||||
},{
|
||||
"itemType":3,
|
||||
"name":"材料",
|
||||
"editname":"3.材料"
|
||||
},{
|
||||
"itemType":4,
|
||||
"name":"其他",
|
||||
"editname":"4.其他"
|
||||
},{
|
||||
"itemType":5,
|
||||
"name":"装备",
|
||||
"editname":"5.装备"
|
||||
},{
|
||||
"itemType":6,
|
||||
"name":"蛋",
|
||||
"editname":"6.装备"
|
||||
}];
|
||||
|
||||
public static var itemUseAction:Object = {
|
||||
"getTi":{
|
||||
"max":10,
|
||||
"min":1
|
||||
},
|
||||
"getKe":{
|
||||
"max":10,
|
||||
"min":2
|
||||
},
|
||||
"getMoney":{
|
||||
"max":100,
|
||||
"mon":3
|
||||
},
|
||||
"reward":{},
|
||||
"vipCard":{"day":30}
|
||||
};
|
||||
|
||||
public function ItemType()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function get equipDic() : Object
|
||||
{
|
||||
if(_equipDic == null)
|
||||
{
|
||||
_equipDic = {
|
||||
"1":lang("武器"),
|
||||
"2":lang("防具"),
|
||||
"3":lang("饰品"),
|
||||
"4":lang("头部"),
|
||||
"5":lang("身体")
|
||||
};
|
||||
}
|
||||
return _equipDic;
|
||||
}
|
||||
|
||||
public static function get equipQuality() : Object
|
||||
{
|
||||
if(_equipQuality == null)
|
||||
{
|
||||
_equipQuality = {
|
||||
"1":{
|
||||
"name":lang("普通"),
|
||||
"color":"#ffffff"
|
||||
},
|
||||
"2":{
|
||||
"name":lang("精致"),
|
||||
"color":"#9cff00"
|
||||
},
|
||||
"3":{
|
||||
"name":lang("极品"),
|
||||
"color":"#66ffff"
|
||||
},
|
||||
"4":{
|
||||
"name":lang("史诗"),
|
||||
"color":"#ff66ff"
|
||||
},
|
||||
"5":{
|
||||
"name":lang("传说"),
|
||||
"color":"#ffff00"
|
||||
}
|
||||
};
|
||||
}
|
||||
return _equipQuality;
|
||||
}
|
||||
|
||||
public static function getName(itemType:int) : String
|
||||
{
|
||||
return typeDic[itemType - 1].name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,290 @@
|
||||
package net.pixvi.myr.element.bag
|
||||
{
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.common.utils.PiObject;
|
||||
import net.pixvi.myr.CP;
|
||||
import net.pixvi.myr.GameMath;
|
||||
import net.pixvi.myr.center.Master;
|
||||
import net.pixvi.myr.center.Table;
|
||||
import net.pixvi.myr.element.mon.EggVo;
|
||||
import net.pixvi.pfw.utils.PointLocker;
|
||||
import net.pixvi.pfw.utils.Saver;
|
||||
|
||||
public class ItemVo extends PiObject
|
||||
{
|
||||
|
||||
private static var _feedLock:Object = null;
|
||||
|
||||
public var id:Number;
|
||||
|
||||
public var type:int;
|
||||
|
||||
public var _num:PointLocker = new PointLocker();
|
||||
|
||||
public var itemdata:Object;
|
||||
|
||||
public var usingNum:int = 0;
|
||||
|
||||
public function ItemVo()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getImgSrc(type:int) : String
|
||||
{
|
||||
return "data/img/item/item_" + type + ".png";
|
||||
}
|
||||
|
||||
public static function getOrnamentImgSrc(type:int) : String
|
||||
{
|
||||
return "data/img/item/item_" + type + "_o.png";
|
||||
}
|
||||
|
||||
public static function getMaxNum(type:int) : int
|
||||
{
|
||||
return Table.item_info[type].maxNum;
|
||||
}
|
||||
|
||||
public static function getName(type:int) : String
|
||||
{
|
||||
return Table.item_info[type].name;
|
||||
}
|
||||
|
||||
public static function getQuality(type:int) : int
|
||||
{
|
||||
return Table.item_info[type].quality;
|
||||
}
|
||||
|
||||
public static function getItemType(type:int) : int
|
||||
{
|
||||
if(Table.monster_info[type] != null)
|
||||
{
|
||||
return ItemType.TYPE_EGG;
|
||||
}
|
||||
if(GameMath.ModeTrace && Table.item_info[type] == null)
|
||||
{
|
||||
Alert.yes("error","拥有不存在的道具[" + type + "]");
|
||||
}
|
||||
return Table.item_info[type].itemType;
|
||||
}
|
||||
|
||||
public static function getFrom(type:int) : String
|
||||
{
|
||||
return Table.item_info[type].from;
|
||||
}
|
||||
|
||||
public static function getTip(type:int, showName:Boolean = true) : String
|
||||
{
|
||||
if(Table.item_info[type].from != null && Table.item_info[type].from != "")
|
||||
{
|
||||
return "<b>" + Table.item_info[type].name + "</b><br/><center>" + Table.item_info[type].des + "<br/><center>" + CP.item(Table.item_info[type].from) + "</center>";
|
||||
}
|
||||
return "<b>" + Table.item_info[type].name + "</b><br/><center>" + Table.item_info[type].des;
|
||||
}
|
||||
|
||||
public function get num() : int
|
||||
{
|
||||
return _num.val;
|
||||
}
|
||||
|
||||
public function get showNum() : int
|
||||
{
|
||||
return _num.val - usingNum;
|
||||
}
|
||||
|
||||
public function get feedLock() : Boolean
|
||||
{
|
||||
if(_feedLock == null)
|
||||
{
|
||||
if(Saver.getAuto("feedLock" + Master.id) != null)
|
||||
{
|
||||
_feedLock = Saver.getAuto("feedLock" + Master.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
_feedLock = {};
|
||||
}
|
||||
}
|
||||
if(_feedLock[id] == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return _feedLock[id];
|
||||
}
|
||||
|
||||
public function set feedLock(lock:Boolean) : void
|
||||
{
|
||||
if(_feedLock == null)
|
||||
{
|
||||
_feedLock = {};
|
||||
}
|
||||
_feedLock[id] = lock;
|
||||
Saver.saveAuto("feedLock" + Master.id,_feedLock);
|
||||
}
|
||||
|
||||
public function set num(value:int) : void
|
||||
{
|
||||
_num.val = value;
|
||||
}
|
||||
|
||||
public function get name() : String
|
||||
{
|
||||
return table().name;
|
||||
}
|
||||
|
||||
public function get para() : Object
|
||||
{
|
||||
if(table() == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return table().para;
|
||||
}
|
||||
|
||||
public function get itemType() : int
|
||||
{
|
||||
if(Table.monster_info[type] != null)
|
||||
{
|
||||
return ItemType.TYPE_EGG;
|
||||
}
|
||||
return table().itemType;
|
||||
}
|
||||
|
||||
public function get delayDay() : int
|
||||
{
|
||||
if(this is EggVo)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if(table().delayDay == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return table().delayDay;
|
||||
}
|
||||
|
||||
public function get des() : String
|
||||
{
|
||||
return table().des;
|
||||
}
|
||||
|
||||
public function get bz() : String
|
||||
{
|
||||
if(table().bz == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return table().bz;
|
||||
}
|
||||
|
||||
public function get desWithFrom() : String
|
||||
{
|
||||
if(table().from != null && table().from != "")
|
||||
{
|
||||
return des + "<br/><center>" + CP.item(from) + "</center>";
|
||||
}
|
||||
return des;
|
||||
}
|
||||
|
||||
public function get from() : String
|
||||
{
|
||||
if(table() == null)
|
||||
{
|
||||
return lang("获取:未知");
|
||||
}
|
||||
return lang("获取:{0}",table().from);
|
||||
}
|
||||
|
||||
public function get maxNum() : int
|
||||
{
|
||||
if(itemType == ItemType.TYPE_EQUIP)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 2147483647;
|
||||
}
|
||||
|
||||
public function get imgsrc() : String
|
||||
{
|
||||
return getImgSrc(type);
|
||||
}
|
||||
|
||||
public function get quality() : int
|
||||
{
|
||||
return table().quality;
|
||||
}
|
||||
|
||||
public function get sellable() : Boolean
|
||||
{
|
||||
return table().sellable;
|
||||
}
|
||||
|
||||
public function get useable() : Boolean
|
||||
{
|
||||
return table().useable;
|
||||
}
|
||||
|
||||
public function get sellMoney() : int
|
||||
{
|
||||
return table().sellMoney;
|
||||
}
|
||||
|
||||
public function table() : Object
|
||||
{
|
||||
return Table.item_info[type];
|
||||
}
|
||||
|
||||
public function get popular() : int
|
||||
{
|
||||
return table().popular;
|
||||
}
|
||||
|
||||
public function get material() : Array
|
||||
{
|
||||
return table().material;
|
||||
}
|
||||
|
||||
public function loadItemData(itemData:Object) : void
|
||||
{
|
||||
this.id = itemData.id;
|
||||
this.type = itemData.typeId;
|
||||
this.num = itemData.num;
|
||||
}
|
||||
|
||||
public function getQ(q:int = 1) : int
|
||||
{
|
||||
if(quality == q)
|
||||
{
|
||||
return 9000000 + type;
|
||||
}
|
||||
return quality * 1000000 + type;
|
||||
}
|
||||
|
||||
public function get q1() : int
|
||||
{
|
||||
return getQ(1);
|
||||
}
|
||||
|
||||
public function get q2() : int
|
||||
{
|
||||
return getQ(2);
|
||||
}
|
||||
|
||||
public function get q3() : int
|
||||
{
|
||||
return getQ(3);
|
||||
}
|
||||
|
||||
public function get q4() : int
|
||||
{
|
||||
return getQ(4);
|
||||
}
|
||||
|
||||
public function get q5() : int
|
||||
{
|
||||
return getQ(5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
package net.pixvi.myr.element.battle
|
||||
{
|
||||
import flash.geom.Rectangle;
|
||||
import net.pixvi.common.utils.Cooldowner;
|
||||
import net.pixvi.myr.battle.view.BattleMon;
|
||||
|
||||
public class BaseBattleArea
|
||||
{
|
||||
|
||||
public var id:String;
|
||||
|
||||
public var type:String;
|
||||
|
||||
public var para:Object;
|
||||
|
||||
public var rec:Rectangle;
|
||||
|
||||
public var cooldown:Cooldowner;
|
||||
|
||||
public function BaseBattleArea()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function buildByObject(obj:Object) : void
|
||||
{
|
||||
this.id = obj.id;
|
||||
this.type = obj.type;
|
||||
this.para = obj.para;
|
||||
this.rec = new Rectangle(obj.x,obj.y,obj.w,obj.h);
|
||||
init();
|
||||
}
|
||||
|
||||
public function init() : void
|
||||
{
|
||||
}
|
||||
|
||||
public function pause() : void
|
||||
{
|
||||
if(cooldown != null)
|
||||
{
|
||||
cooldown.pause();
|
||||
}
|
||||
}
|
||||
|
||||
public function resume() : void
|
||||
{
|
||||
if(cooldown != null)
|
||||
{
|
||||
cooldown.resume();
|
||||
}
|
||||
}
|
||||
|
||||
public function autoMon(mon:BattleMon) : void
|
||||
{
|
||||
if(rec.contains(mon.x,mon.y))
|
||||
{
|
||||
activity(mon);
|
||||
}
|
||||
}
|
||||
|
||||
public function activity(mon:BattleMon) : void
|
||||
{
|
||||
}
|
||||
|
||||
public function cd() : Boolean
|
||||
{
|
||||
if(cooldown == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return cooldown.cooldown;
|
||||
}
|
||||
|
||||
public function activitycd() : void
|
||||
{
|
||||
if(cooldown == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
cooldown.activity();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package net.pixvi.myr.element.battle
|
||||
{
|
||||
import net.pixvi.pfw.utils.ObjectUtil;
|
||||
import net.pixvi.pfw.utils.json.Json;
|
||||
|
||||
public class BattleData
|
||||
{
|
||||
|
||||
public var battlePosition:BattlePosition;
|
||||
|
||||
public var win:Boolean;
|
||||
|
||||
private var _cheatNum:int = 0;
|
||||
|
||||
public var cheatRecords:CheatRecord;
|
||||
|
||||
public var killMonster:Object;
|
||||
|
||||
public var leftTime:int;
|
||||
|
||||
public var killNum:int;
|
||||
|
||||
public var totalDamage:int;
|
||||
|
||||
public var bossDamage:int;
|
||||
|
||||
public var deadNum:int;
|
||||
|
||||
public var aliveNum:int;
|
||||
|
||||
public var apLeft:int;
|
||||
|
||||
public var battleMonIds:Array;
|
||||
|
||||
public function BattleData()
|
||||
{
|
||||
super();
|
||||
cheatRecords = new CheatRecord();
|
||||
}
|
||||
|
||||
public function get cheatNum() : int
|
||||
{
|
||||
return _cheatNum;
|
||||
}
|
||||
|
||||
public function set cheatNum(value:int) : void
|
||||
{
|
||||
_cheatNum = value;
|
||||
}
|
||||
|
||||
public function getObj() : Object
|
||||
{
|
||||
var obj:Object = ObjectUtil.deepClone(this);
|
||||
if(cheatNum > 0)
|
||||
{
|
||||
obj.cheatRecords = Json.encode(obj.cheatRecords);
|
||||
}
|
||||
else
|
||||
{
|
||||
obj.cheatRecords = "";
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package net.pixvi.myr.element.battle
|
||||
{
|
||||
public class BattleFieldVo
|
||||
{
|
||||
|
||||
public var mapObjects:Array = [];
|
||||
|
||||
public var mapPoints:Array = [];
|
||||
|
||||
public var mapAreas:Array = [];
|
||||
|
||||
public var fieldName:String = "default";
|
||||
|
||||
public var fieldMode:Boolean = true;
|
||||
|
||||
public function BattleFieldVo()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,576 @@
|
||||
package net.pixvi.myr.element.battle
|
||||
{
|
||||
import net.pixvi.myr.GameMath;
|
||||
import net.pixvi.myr.battle.BattleModeType;
|
||||
import net.pixvi.myr.center.Table;
|
||||
import net.pixvi.myr.element.mon.MonsterVo;
|
||||
import net.pixvi.myr.panel.battle.BattlePanel;
|
||||
import net.pixvi.myr.view.attack.BaseAttack;
|
||||
import net.pixvi.myr.view.attack.type.AttackType;
|
||||
import net.pixvi.pfw.utils.Mapper;
|
||||
import net.pixvi.pfw.utils.PointLocker;
|
||||
|
||||
public class BattleMonVo
|
||||
{
|
||||
|
||||
public var monsterVo:MonsterVo;
|
||||
|
||||
public var attack:BaseAttack;
|
||||
|
||||
public var ai:int = 0;
|
||||
|
||||
public var ai_search:int = 2;
|
||||
|
||||
public var from:String = "stage";
|
||||
|
||||
public var hpMax:int;
|
||||
|
||||
public var spd_mov:Number = -1;
|
||||
|
||||
public var spd_atk:Number = -1;
|
||||
|
||||
public var spd_atk_add:Number = 0;
|
||||
|
||||
public var atk_dis:Number = -1;
|
||||
|
||||
public var defDama:Number = 0;
|
||||
|
||||
private var _selfCure:PointLocker = new PointLocker();
|
||||
|
||||
private var _atkVim:PointLocker = new PointLocker();
|
||||
|
||||
private var _atkStun:PointLocker = new PointLocker();
|
||||
|
||||
public var atkStunTime:int = 0;
|
||||
|
||||
public var atkStunType:int = 1;
|
||||
|
||||
private var _defStun:PointLocker = new PointLocker();
|
||||
|
||||
public var defStunTime:int = 0;
|
||||
|
||||
public var defStunType:int = 1;
|
||||
|
||||
private var _atkPoi:PointLocker = new PointLocker();
|
||||
|
||||
private var _atkPoiDmg:PointLocker = new PointLocker();
|
||||
|
||||
public var atkPoiType:int = 1;
|
||||
|
||||
public var powDefPercent:Number = 0;
|
||||
|
||||
public var immuDebuff:Boolean = false;
|
||||
|
||||
public var skillCooldown:Number = 0;
|
||||
|
||||
private var _sunFire:PointLocker = new PointLocker();
|
||||
|
||||
private var _moonHeal:PointLocker = new PointLocker();
|
||||
|
||||
private var _deadBoom:PointLocker = new PointLocker();
|
||||
|
||||
private var _thorns:PointLocker = new PointLocker();
|
||||
|
||||
private var _apCostSave:PointLocker = new PointLocker();
|
||||
|
||||
public var pow:Number;
|
||||
|
||||
public var powdef:Number;
|
||||
|
||||
public var level:int;
|
||||
|
||||
public var type:int;
|
||||
|
||||
public var mode:int;
|
||||
|
||||
private var _atk:PointLocker = new PointLocker();
|
||||
|
||||
private var _def:PointLocker = new PointLocker();
|
||||
|
||||
private var _hp:PointLocker = new PointLocker();
|
||||
|
||||
private var _dex:PointLocker = new PointLocker();
|
||||
|
||||
public var crit:Number = 0;
|
||||
|
||||
public var dead:Boolean = false;
|
||||
|
||||
public var apCost:int = 0;
|
||||
|
||||
public var name:String;
|
||||
|
||||
public var element:int = 0;
|
||||
|
||||
private var dataobj:Object;
|
||||
|
||||
public var mid:Number;
|
||||
|
||||
public var buffImmune:Boolean = false;
|
||||
|
||||
public var moveImmune:Boolean = false;
|
||||
|
||||
public var controlImmune:Boolean = false;
|
||||
|
||||
public var countUnit:Boolean = true;
|
||||
|
||||
public var protectTarget:Boolean = false;
|
||||
|
||||
public var destroyTarget:Boolean = false;
|
||||
|
||||
public var summonUnit:Boolean = false;
|
||||
|
||||
public var skill_1:int = -1;
|
||||
|
||||
public var skill_1_lv:int = -1;
|
||||
|
||||
public var skill_1_chance:Number = -1;
|
||||
|
||||
public var skill_2:int = -1;
|
||||
|
||||
public var skill_2_lv:int = -1;
|
||||
|
||||
public var skill_2_chance:Number = -1;
|
||||
|
||||
public var joinPoint:String = "";
|
||||
|
||||
public var joinTime:int = -1;
|
||||
|
||||
public var controller:Array;
|
||||
|
||||
public var teamPos:int;
|
||||
|
||||
public var leader:Boolean;
|
||||
|
||||
public var team:int = 2;
|
||||
|
||||
public var isObject:Boolean = false;
|
||||
|
||||
public var zl:int = 0;
|
||||
|
||||
public var setOScale:Number;
|
||||
|
||||
public var wave:int = 1;
|
||||
|
||||
public var joinAction:String = "auto";
|
||||
|
||||
public var autoTarget:Boolean = true;
|
||||
|
||||
public var equips:Array = [];
|
||||
|
||||
public var attackArea:String = "";
|
||||
|
||||
public var apRecovery:Boolean = false;
|
||||
|
||||
public var bossPoint:int = 0;
|
||||
|
||||
public var abilityScaled:Boolean = false;
|
||||
|
||||
public function BattleMonVo()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function get selfCure() : Number
|
||||
{
|
||||
return _selfCure.val;
|
||||
}
|
||||
|
||||
public function set selfCure(value:Number) : void
|
||||
{
|
||||
_selfCure.val = value;
|
||||
}
|
||||
|
||||
public function get atkVim() : Number
|
||||
{
|
||||
return _atkVim.val;
|
||||
}
|
||||
|
||||
public function set atkVim(value:Number) : void
|
||||
{
|
||||
_atkVim.val = value;
|
||||
}
|
||||
|
||||
public function get atkStun() : Number
|
||||
{
|
||||
return _atkStun.val;
|
||||
}
|
||||
|
||||
public function set atkStun(value:Number) : void
|
||||
{
|
||||
_atkStun.val = value;
|
||||
}
|
||||
|
||||
public function get defStun() : Number
|
||||
{
|
||||
return _defStun.val;
|
||||
}
|
||||
|
||||
public function set defStun(value:Number) : void
|
||||
{
|
||||
_defStun.val = value;
|
||||
}
|
||||
|
||||
public function get atkPoi() : Number
|
||||
{
|
||||
return _atkPoi.val;
|
||||
}
|
||||
|
||||
public function set atkPoi(value:Number) : void
|
||||
{
|
||||
_atkPoi.val = value;
|
||||
}
|
||||
|
||||
public function get atkPoiDmg() : int
|
||||
{
|
||||
return _atkPoiDmg.val;
|
||||
}
|
||||
|
||||
public function set atkPoiDmg(value:int) : void
|
||||
{
|
||||
_atkPoiDmg.val = value;
|
||||
}
|
||||
|
||||
public function get sunFire() : int
|
||||
{
|
||||
return _sunFire.val;
|
||||
}
|
||||
|
||||
public function set sunFire(value:int) : void
|
||||
{
|
||||
_sunFire.val = value;
|
||||
}
|
||||
|
||||
public function get moonHeal() : int
|
||||
{
|
||||
return _moonHeal.val;
|
||||
}
|
||||
|
||||
public function set moonHeal(value:int) : void
|
||||
{
|
||||
_moonHeal.val = value;
|
||||
}
|
||||
|
||||
public function get deadBoom() : int
|
||||
{
|
||||
return _deadBoom.val;
|
||||
}
|
||||
|
||||
public function set deadBoom(value:int) : void
|
||||
{
|
||||
_deadBoom.val = value;
|
||||
}
|
||||
|
||||
public function get thorns() : int
|
||||
{
|
||||
return _thorns.val;
|
||||
}
|
||||
|
||||
public function set thorns(value:int) : void
|
||||
{
|
||||
_thorns.val = value;
|
||||
}
|
||||
|
||||
public function get dex() : int
|
||||
{
|
||||
return _dex.val;
|
||||
}
|
||||
|
||||
public function set dex(value:int) : void
|
||||
{
|
||||
_dex.val = value;
|
||||
}
|
||||
|
||||
public function get def() : int
|
||||
{
|
||||
return _def.val;
|
||||
}
|
||||
|
||||
public function set def(value:int) : void
|
||||
{
|
||||
_def.val = value;
|
||||
}
|
||||
|
||||
public function get atk() : int
|
||||
{
|
||||
return _atk.val;
|
||||
}
|
||||
|
||||
public function set atk(value:int) : void
|
||||
{
|
||||
_atk.val = value;
|
||||
}
|
||||
|
||||
public function buildByMonster(mon:MonsterVo) : void
|
||||
{
|
||||
monsterVo = mon;
|
||||
attack = AttackType.getAttack(monsterVo.atk_type.toString());
|
||||
if(atk_dis == -1)
|
||||
{
|
||||
atk_dis = monsterVo.atk_dis;
|
||||
}
|
||||
if(spd_mov == -1)
|
||||
{
|
||||
spd_mov = monsterVo.spd_move + GameMath.addMovSpdByDex(monsterVo.dex);
|
||||
}
|
||||
if(spd_atk == -1)
|
||||
{
|
||||
spd_atk = monsterVo.spd_atk + GameMath.addAtkSpdByDex(monsterVo.dex);
|
||||
}
|
||||
if(mon.upStar > 0)
|
||||
{
|
||||
skill_1 = mon.skill_1;
|
||||
skill_2 = mon.skill_2;
|
||||
}
|
||||
spd_atk -= 1600 * monsterVo.allAdd("atkSpd") / 100;
|
||||
this.apCost = monsterVo.ap_cost - monsterVo.allAdd("apCostSave");
|
||||
if(this.apCost < 0)
|
||||
{
|
||||
this.apCost = 0;
|
||||
}
|
||||
this.atk = monsterVo.atk;
|
||||
this.def = monsterVo.def;
|
||||
this.dex = monsterVo.dex;
|
||||
this.hpMax = this.hp = monsterVo.hp;
|
||||
this.deadBoom = monsterVo.allAdd("deadBoom");
|
||||
this.level = monsterVo.level;
|
||||
this.mode = monsterVo.mode;
|
||||
this.type = monsterVo.type;
|
||||
this.name = monsterVo.name;
|
||||
this.mid = monsterVo.id;
|
||||
pow = monsterVo.pow + GameMath.addPowByAtk(monsterVo.atk);
|
||||
powdef = monsterVo.powdef + GameMath.addPowDefByHp(monsterVo.hp);
|
||||
zl = GameMath.zl_battleMonVo(this);
|
||||
}
|
||||
|
||||
public function buildSpecialByMonster(monVo:MonsterVo) : void
|
||||
{
|
||||
crit = monsterVo.allAdd("crit");
|
||||
selfCure = monsterVo.allAdd("selfCure");
|
||||
atkVim = monsterVo.allAdd("atkVim");
|
||||
atkStun = monsterVo.allAdd("atkStun");
|
||||
atkStunTime = 2;
|
||||
atkStunType = monsterVo.equipType("atkStun","atkStunType");
|
||||
defStun = monsterVo.allAdd("defStun");
|
||||
defStunTime = 2;
|
||||
defStunType = monsterVo.equipType("defStun","defStunType");
|
||||
atkPoi = monsterVo.allAdd("atkPoi");
|
||||
atkPoiDmg = monsterVo.allAdd("atkPoiDmg");
|
||||
atkPoiType = monsterVo.equipType("atkPoi","atkPoiType");
|
||||
skillCooldown = monsterVo.allAdd("skillCooldown");
|
||||
sunFire = monsterVo.allAdd("sunFire");
|
||||
moonHeal = monsterVo.allAdd("moonHeal");
|
||||
thorns = monsterVo.allAdd("thorns");
|
||||
var spWords:Array = monsterVo.getAllSpWord();
|
||||
for each(var spWord:String in spWords)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public function clone(changeMode:int = -1, changeType:int = -1) : BattleMonVo
|
||||
{
|
||||
var vo:BattleMonVo = new BattleMonVo();
|
||||
var monvo:MonsterVo = this.monsterVo.clone();
|
||||
if(changeMode != -1)
|
||||
{
|
||||
monvo.mode = changeMode;
|
||||
}
|
||||
if(changeType != -1)
|
||||
{
|
||||
monvo.skin = 0;
|
||||
monvo.type = changeType;
|
||||
}
|
||||
vo.buildByMonster(monvo);
|
||||
vo.hp = this.hp;
|
||||
vo.hpMax = this.hpMax;
|
||||
vo.ai = this.ai;
|
||||
vo.ai_search = this.ai_search;
|
||||
if(this.apCost < vo.apCost)
|
||||
{
|
||||
vo.apCost = this.apCost;
|
||||
}
|
||||
vo.atk = this.atk;
|
||||
vo.atk_dis = this.atk_dis;
|
||||
vo.crit = this.crit;
|
||||
vo.def = this.def;
|
||||
vo.dex = this.dex;
|
||||
vo.level = this.level;
|
||||
vo.summonUnit = true;
|
||||
vo.setOScale = this.setOScale;
|
||||
return vo;
|
||||
}
|
||||
|
||||
public function buildByObject(o:Object, scaleAbility:Number = 1, scaleHp:Number = 1) : void
|
||||
{
|
||||
var mon:MonsterVo = null;
|
||||
dataobj = o;
|
||||
Mapper.fillVariables(this,o);
|
||||
if(o.powDefPercent != null && o.powDefPercent > 0)
|
||||
{
|
||||
powDefPercent = o.powDefPercent;
|
||||
}
|
||||
if(o.autoValue == true)
|
||||
{
|
||||
mon = new MonsterVo();
|
||||
monsterVo = mon;
|
||||
mon.init(o.type);
|
||||
mon.buildByArea();
|
||||
mon.level = o.level;
|
||||
mon.setLocalMode(o.mode);
|
||||
buildByMonster(mon);
|
||||
if(o.nicname == "" || o.nicname == null)
|
||||
{
|
||||
this.name = mon.name;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.name = o.nicname;
|
||||
}
|
||||
this.crit += o.crit;
|
||||
}
|
||||
else
|
||||
{
|
||||
monsterVo = new MonsterVo(type);
|
||||
monsterVo.setLocalMode(this.mode);
|
||||
attack = AttackType.getAttack(monsterVo.atk_type.toString());
|
||||
pow = monsterVo.pow;
|
||||
if(o.nicname == "" || o.nicname == null)
|
||||
{
|
||||
this.name = monsterVo.name;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.name = o.nicname;
|
||||
}
|
||||
powdef = monsterVo.powdef;
|
||||
crit = o.crit;
|
||||
zl = GameMath.zl_battleMonVo(this);
|
||||
}
|
||||
this.apCost = monsterVo.ap_cost - this.apCostSave;
|
||||
if(this.apCost < 0)
|
||||
{
|
||||
this.apCost = 0;
|
||||
}
|
||||
if(o.ornaments != null)
|
||||
{
|
||||
equips = o.ornaments;
|
||||
}
|
||||
if(o.apRecovery != null)
|
||||
{
|
||||
apRecovery = o.apRecovery;
|
||||
}
|
||||
if(o.bossPoint != null)
|
||||
{
|
||||
bossPoint = o.bossPoint;
|
||||
}
|
||||
if(!abilityScaled)
|
||||
{
|
||||
if(scaleAbility != 1 || scaleHp != 1)
|
||||
{
|
||||
this.atk *= scaleAbility;
|
||||
this.def *= scaleAbility;
|
||||
this.dex *= scaleAbility;
|
||||
this.deadBoom *= scaleAbility;
|
||||
this.sunFire *= scaleAbility;
|
||||
this.moonHeal *= scaleAbility;
|
||||
this.thorns *= scaleAbility;
|
||||
this.selfCure *= scaleAbility;
|
||||
this.level *= scaleAbility;
|
||||
for each(var c:Object in controller)
|
||||
{
|
||||
if(c.type == "hp")
|
||||
{
|
||||
c.para.hp *= scaleAbility;
|
||||
}
|
||||
else if(c.type == "deadBoom")
|
||||
{
|
||||
c.para.atk *= scaleAbility;
|
||||
}
|
||||
else if(c.type == "monMaker")
|
||||
{
|
||||
if(c.para.hp != null)
|
||||
{
|
||||
c.para.hp *= scaleHp;
|
||||
}
|
||||
if(c.para.hpMax != null)
|
||||
{
|
||||
c.para.hpMax *= scaleHp;
|
||||
}
|
||||
if(c.para.atk != null)
|
||||
{
|
||||
c.para.atk *= scaleAbility;
|
||||
}
|
||||
if(c.para.def != null)
|
||||
{
|
||||
c.para.def *= scaleAbility;
|
||||
}
|
||||
if(c.para.level != null)
|
||||
{
|
||||
c.para.level *= scaleAbility;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.hp *= scaleHp;
|
||||
}
|
||||
}
|
||||
monsterVo.id = o.mid;
|
||||
element = monsterVo.element;
|
||||
hpMax = hp;
|
||||
}
|
||||
|
||||
public function get hp() : int
|
||||
{
|
||||
return _hp.val;
|
||||
}
|
||||
|
||||
public function set hp(val:int) : void
|
||||
{
|
||||
_hp.val = val;
|
||||
}
|
||||
|
||||
public function get apCostSave() : int
|
||||
{
|
||||
return _apCostSave.val;
|
||||
}
|
||||
|
||||
public function set apCostSave(val:int) : void
|
||||
{
|
||||
_apCostSave.val = val;
|
||||
}
|
||||
|
||||
public function checkCheat(checkMon:BattleMonVo) : int
|
||||
{
|
||||
var cheat:int = 0;
|
||||
if(BattlePanel.getIns().battle.battleMode == BattleModeType.PVE)
|
||||
{
|
||||
if(atk * 1.5 < checkMon.atk || def * 1.5 < checkMon.def || hpMax * Table.game_setting.pveHpScale * 1.5 < checkMon.hpMax || dex * 1.5 < checkMon.dex || hpMax * Table.game_setting.pveHpScale * 1.5 < checkMon.hp)
|
||||
{
|
||||
cheat += 20;
|
||||
}
|
||||
}
|
||||
else if(atk * 1.5 < checkMon.atk || def * 1.5 < checkMon.def || hpMax * 1.5 < checkMon.hpMax || dex * 1.5 < checkMon.dex || hpMax * 1.5 < checkMon.hp)
|
||||
{
|
||||
cheat += 20;
|
||||
}
|
||||
if(crit * 1.5 < checkMon.crit || atkVim * 1.5 < checkMon.atkVim || sunFire * 1.5 < checkMon.sunFire || skillCooldown * 1.5 < checkMon.skillCooldown || atkPoi * 1.5 < checkMon.atkPoi || atkStun * 1.5 < checkMon.atkStun || atkPoiDmg * 1.5 < checkMon.atkPoiDmg)
|
||||
{
|
||||
cheat += 20;
|
||||
}
|
||||
return cheat;
|
||||
}
|
||||
|
||||
public function counter(target:BattleMonVo) : Boolean
|
||||
{
|
||||
if(Table.monster_setting.element[monsterVo.element].counter == target.monsterVo.element)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function get hpPercent() : Number
|
||||
{
|
||||
return hp / hpMax;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
package net.pixvi.myr.element.battle
|
||||
{
|
||||
import net.pixvi.myr.center.StageCenter;
|
||||
import net.pixvi.myr.center.Table;
|
||||
import net.pixvi.myr.element.task.TaskStatusType;
|
||||
|
||||
public class BattlePosition
|
||||
{
|
||||
|
||||
public var battleType:String;
|
||||
|
||||
public var stageId:String;
|
||||
|
||||
public var stageLevel:String;
|
||||
|
||||
public var taskTypeId:String;
|
||||
|
||||
public var taskStep:int;
|
||||
|
||||
public function BattlePosition()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function getBattleData() : Object
|
||||
{
|
||||
switch(battleType)
|
||||
{
|
||||
case "stage":
|
||||
return StageCenter.getIns().getStageBattle(stageId,stageLevel);
|
||||
case BattleType.TASK_BATTLE:
|
||||
return Table.task_info[taskTypeId].steps[taskStep].battle;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public function getRewardData() : Object
|
||||
{
|
||||
switch(battleType)
|
||||
{
|
||||
case "stage":
|
||||
return StageCenter.getIns().getStageReward(stageId,stageLevel);
|
||||
case BattleType.TASK_BATTLE:
|
||||
return Table.task_info[taskTypeId].steps[taskStep].reward;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public function isStageBattle() : Boolean
|
||||
{
|
||||
if(battleType == "stage")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if(battleType == BattleType.TASK_BATTLE && Table.task_info[taskTypeId].steps[taskStep].statusType == TaskStatusType.PASS_STAGE)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getStageId() : String
|
||||
{
|
||||
if(battleType == "stage")
|
||||
{
|
||||
return stageId;
|
||||
}
|
||||
if(battleType == BattleType.TASK_BATTLE && Table.task_info[taskTypeId].steps[taskStep].statusType == TaskStatusType.PASS_STAGE)
|
||||
{
|
||||
return Table.task_info[taskTypeId].steps[taskStep].statusValue.stage;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getStageLevel() : String
|
||||
{
|
||||
if(battleType == "stage")
|
||||
{
|
||||
return stageLevel;
|
||||
}
|
||||
if(battleType == BattleType.TASK_BATTLE && Table.task_info[taskTypeId].steps[taskStep].statusType == TaskStatusType.PASS_STAGE)
|
||||
{
|
||||
return Table.task_info[taskTypeId].steps[taskStep].statusValue.level;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,222 @@
|
||||
package net.pixvi.myr.element.battle
|
||||
{
|
||||
import net.pixvi.myr.battle.view.BattleMon;
|
||||
import net.pixvi.myr.panel.battle.BattlePanel;
|
||||
import net.pixvi.pfw.utils.ArrayUtil;
|
||||
import net.pixvi.pfw.utils.Mapper;
|
||||
import net.pixvi.pfw.utils.PointLocker;
|
||||
|
||||
public class BattleTeamVo
|
||||
{
|
||||
|
||||
public static var enemyNormalPointByTeamPos:Object = {
|
||||
"0":"point_team{team}_fore1",
|
||||
"1":"point_team{team}_fore2",
|
||||
"2":"point_team{team}_fore3",
|
||||
"3":"point_team{team}_back1",
|
||||
"4":"point_team{team}_back2",
|
||||
"5":"point_team{team}_back3"
|
||||
};
|
||||
|
||||
public var mons:Array = [];
|
||||
|
||||
public var ai:int = 0;
|
||||
|
||||
public var ai_search:int = 2;
|
||||
|
||||
private var _ap:PointLocker;
|
||||
|
||||
public var apMax:int;
|
||||
|
||||
public var numMax:int;
|
||||
|
||||
public var name:String = "";
|
||||
|
||||
public var numOnStage:int = 0;
|
||||
|
||||
public var buildOver:Boolean = false;
|
||||
|
||||
public var team:int = 2;
|
||||
|
||||
public var wave:int = 1;
|
||||
|
||||
public var waveUnlock:Object = {
|
||||
"0":true,
|
||||
"1":true
|
||||
};
|
||||
|
||||
public var stageMons:Array = [];
|
||||
|
||||
public var deadMons:Array = [];
|
||||
|
||||
public var totalApCost:int = 0;
|
||||
|
||||
public var waitingWave:Boolean = false;
|
||||
|
||||
public function BattleTeamVo()
|
||||
{
|
||||
super();
|
||||
_ap = new PointLocker();
|
||||
}
|
||||
|
||||
public function buildMonster() : void
|
||||
{
|
||||
var k:int = 0;
|
||||
var mon:BattleMon = null;
|
||||
if(buildOver)
|
||||
{
|
||||
return;
|
||||
}
|
||||
k = 0;
|
||||
while(k < mons.length)
|
||||
{
|
||||
mon = new BattleMon();
|
||||
mon.teamVo = this;
|
||||
mon.init(mons[k]);
|
||||
mons[k] = mon;
|
||||
if(mon.team == 2)
|
||||
{
|
||||
if(mon.skill_1 != null)
|
||||
{
|
||||
mon.skill_1.cder.quickCountDown(2);
|
||||
}
|
||||
if(mon.skill_2 != null)
|
||||
{
|
||||
mon.skill_2.cder.quickCountDown(2);
|
||||
}
|
||||
}
|
||||
if(waveUnlock[mon.wave] == null)
|
||||
{
|
||||
waveUnlock[mon.wave] = false;
|
||||
}
|
||||
if(mon.monVo.joinPoint == "" && enemyNormalPointByTeamPos[mon.monVo.teamPos] != null)
|
||||
{
|
||||
mon.monVo.joinPoint = enemyNormalPointByTeamPos[mon.monVo.teamPos];
|
||||
mon.monVo.joinPoint = mon.monVo.joinPoint.replace("{team}",mon.team);
|
||||
}
|
||||
k++;
|
||||
}
|
||||
buildOver = true;
|
||||
}
|
||||
|
||||
public function buildByObject(o:Object, scaleAbility:Number = 1, scaleHp:Number = 1) : void
|
||||
{
|
||||
Mapper.fillVariables(this,o);
|
||||
apMax = ap * 2;
|
||||
buildMonsterArray(mons,scaleAbility,scaleHp);
|
||||
}
|
||||
|
||||
private function buildMonsterArray(arr:Array, scaleAbility:Number = 1, scaleHp:Number = 1) : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var vo:BattleMonVo = null;
|
||||
for(i = 0; i < arr.length; )
|
||||
{
|
||||
if(arr[i] != null)
|
||||
{
|
||||
vo = new BattleMonVo();
|
||||
vo.buildByObject(arr[i],scaleAbility,scaleHp);
|
||||
if(arr[i].mid == "" || arr[i].mid == null)
|
||||
{
|
||||
vo.mid = BattlePanel.getTempMID();
|
||||
}
|
||||
else
|
||||
{
|
||||
vo.mid = arr[i].mid;
|
||||
}
|
||||
arr[i] = vo;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
public function getAllMonster() : Array
|
||||
{
|
||||
var k:int = 0;
|
||||
if(!buildOver)
|
||||
{
|
||||
throw new Error("所有怪物在没有创建前调用!检查代码");
|
||||
}
|
||||
var arr:Array = [];
|
||||
for(k = 0; k < mons.length; )
|
||||
{
|
||||
if(mons[k] != null)
|
||||
{
|
||||
arr.push(mons[k]);
|
||||
}
|
||||
k++;
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
public function getWaitMonster() : Array
|
||||
{
|
||||
return mons;
|
||||
}
|
||||
|
||||
public function monDead(mon:BattleMon) : void
|
||||
{
|
||||
if(mon.monVo.countUnit)
|
||||
{
|
||||
numOnStage--;
|
||||
}
|
||||
ArrayUtil.remove(stageMons,mon);
|
||||
deadMons.push(mon);
|
||||
}
|
||||
|
||||
public function monJoin(mon:BattleMon) : void
|
||||
{
|
||||
ArrayUtil.remove(mons,mon);
|
||||
stageMons.push(mon);
|
||||
if(mon.monVo.countUnit)
|
||||
{
|
||||
numOnStage++;
|
||||
}
|
||||
}
|
||||
|
||||
public function cloneEmptyTeam() : BattleTeamVo
|
||||
{
|
||||
var team:BattleTeamVo = new BattleTeamVo();
|
||||
team.name = "???";
|
||||
team.ai = this.ai;
|
||||
team.ai_search = this.ai_search;
|
||||
team.ap = this.ap;
|
||||
team.apMax = this.apMax;
|
||||
team.buildOver = this.buildOver;
|
||||
team.numMax = this.numMax;
|
||||
team.team = this.team;
|
||||
return team;
|
||||
}
|
||||
|
||||
public function get ap() : int
|
||||
{
|
||||
return _ap.val;
|
||||
}
|
||||
|
||||
public function set ap(value:int) : void
|
||||
{
|
||||
_ap.val = value;
|
||||
}
|
||||
|
||||
public function getAliveNum() : int
|
||||
{
|
||||
var i:int = 0;
|
||||
for each(var mon:BattleMon in stageMons)
|
||||
{
|
||||
if(!mon.monVo.isObject)
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
for each(var mon2:BattleMon in mons)
|
||||
{
|
||||
if(!mon2.monVo.isObject)
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package net.pixvi.myr.element.battle
|
||||
{
|
||||
public class BattleType
|
||||
{
|
||||
|
||||
public static var TASK_BATTLE:String = "task";
|
||||
|
||||
public static const STAGE_BATTLE:String = "stage";
|
||||
|
||||
public static const PVE_BATTLE:String = "pve";
|
||||
|
||||
public static const BOSS_BATTLE:String = "boss";
|
||||
|
||||
public function BattleType()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,259 @@
|
||||
package net.pixvi.myr.element.battle
|
||||
{
|
||||
import flash.geom.Point;
|
||||
import net.pixvi.myr.GameMath;
|
||||
import net.pixvi.myr.center.Table;
|
||||
import net.pixvi.myr.element.reward.RewardVo;
|
||||
import net.pixvi.myr.element.snd.GameSound;
|
||||
import net.pixvi.pfw.utils.ArrayUtil;
|
||||
import net.pixvi.pfw.utils.Mapper;
|
||||
import net.pixvi.pfw.utils.ObjectUtil;
|
||||
import net.pixvi.pfw.utils.Random;
|
||||
|
||||
public class BattleVo
|
||||
{
|
||||
|
||||
public var reward:RewardVo;
|
||||
|
||||
public var builded:Boolean = false;
|
||||
|
||||
public var teams:Array = [];
|
||||
|
||||
public var teamDic:Object = {};
|
||||
|
||||
public var groundType:String = "1";
|
||||
|
||||
public var time:int = 300;
|
||||
|
||||
public var controller:Array = [];
|
||||
|
||||
public var triggers:Array = [];
|
||||
|
||||
public var winType:Array = [1];
|
||||
|
||||
public var loseType:Array = [1,2];
|
||||
|
||||
public var battleField:Object;
|
||||
|
||||
public var battleFieldVo:BattleFieldVo;
|
||||
|
||||
public var mapPoints:Object;
|
||||
|
||||
public var mapAreas:Object;
|
||||
|
||||
public var mapObjects:Object;
|
||||
|
||||
public var protectNum:int = 0;
|
||||
|
||||
public var protectMaxNum:int = 0;
|
||||
|
||||
public var destroyNum:int = 0;
|
||||
|
||||
public var destroyMaxNum:int = 0;
|
||||
|
||||
public var bgm:String = "1";
|
||||
|
||||
public var hideTeamMon:Boolean = false;
|
||||
|
||||
public var getBgm:String;
|
||||
|
||||
public var battleMode:int = 0;
|
||||
|
||||
public var scaleAbility:Number = 1;
|
||||
|
||||
public var scaleHp:Number = 1;
|
||||
|
||||
private var hasInitPve:Boolean = false;
|
||||
|
||||
public function BattleVo()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getBgm(bgm:String) : String
|
||||
{
|
||||
switch(bgm)
|
||||
{
|
||||
default:
|
||||
case "1":
|
||||
break;
|
||||
case "2":
|
||||
return GameSound.bgm_danger;
|
||||
case "3":
|
||||
return GameSound.bgm_battle2;
|
||||
}
|
||||
return GameSound.bgm_battle;
|
||||
}
|
||||
|
||||
public function battleBgm() : String
|
||||
{
|
||||
return BattleVo.getBgm(bgm);
|
||||
}
|
||||
|
||||
public function get rollmapMode() : Boolean
|
||||
{
|
||||
return Table.setting.groundType[groundType].rollMap;
|
||||
}
|
||||
|
||||
public function getTeam(team:int) : BattleTeamVo
|
||||
{
|
||||
return teamDic[team];
|
||||
}
|
||||
|
||||
public function getTeamWaitPointName(team:int) : String
|
||||
{
|
||||
var num:int = 0;
|
||||
while(mapPoints["point_team" + team + "_wait" + (num + 1)] != null)
|
||||
{
|
||||
num++;
|
||||
}
|
||||
return "point_team" + team + "_wait" + Random.integer(1,num);
|
||||
}
|
||||
|
||||
public function buildByObject(o:Object) : void
|
||||
{
|
||||
var obj:Array = null;
|
||||
var area:Array = null;
|
||||
var i:int = 0;
|
||||
var vo:BattleTeamVo = null;
|
||||
o = ObjectUtil.deepClone(o);
|
||||
Mapper.fillVariables(this,o);
|
||||
battleFieldVo = new BattleFieldVo();
|
||||
if(o.scaleAbility != null || o.scaleHp != null)
|
||||
{
|
||||
this.scaleAbility = o.scaleAbility;
|
||||
this.scaleHp = o.scaleHp;
|
||||
for each(var cono:Object in controller)
|
||||
{
|
||||
if(cono.type == "monMaker")
|
||||
{
|
||||
if(cono.para.deadBoom != null)
|
||||
{
|
||||
cono.para.deadBoom *= scaleAbility;
|
||||
}
|
||||
if(cono.para.hp != null)
|
||||
{
|
||||
cono.para.hp *= scaleHp;
|
||||
}
|
||||
if(cono.para.hpMax != null)
|
||||
{
|
||||
cono.para.hpMax *= scaleHp;
|
||||
}
|
||||
if(cono.para.atk != null)
|
||||
{
|
||||
cono.para.atk *= scaleAbility;
|
||||
}
|
||||
if(cono.para.def != null)
|
||||
{
|
||||
cono.para.def *= scaleAbility;
|
||||
}
|
||||
if(cono.para.dex != null)
|
||||
{
|
||||
cono.para.dex *= scaleAbility;
|
||||
}
|
||||
if(cono.para.level != null)
|
||||
{
|
||||
cono.para.level *= scaleAbility;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(o.battleField.fieldMode)
|
||||
{
|
||||
obj = o.battleField.mapObjects;
|
||||
area = o.battleField.mapAreas;
|
||||
o.battleField = ObjectUtil.deepClone(Table.setting.defaultField[o.battleField.fieldName]);
|
||||
o.battleField.mapObjects = ObjectUtil.deepClone(obj);
|
||||
o.battleField.mapAreas = (o.battleField.mapAreas as Array).concat(ObjectUtil.deepClone(area));
|
||||
}
|
||||
Mapper.fillVariables(battleFieldVo,o.battleField);
|
||||
ArrayUtil.allToInt(o.winType);
|
||||
ArrayUtil.allToInt(o.loseType);
|
||||
for(i = 0; i < teams.length; )
|
||||
{
|
||||
vo = new BattleTeamVo();
|
||||
vo.buildByObject(teams[i],scaleAbility,scaleHp);
|
||||
teams[i] = vo;
|
||||
for each(var m:BattleMonVo in vo.mons)
|
||||
{
|
||||
if(m.protectTarget)
|
||||
{
|
||||
protectMaxNum++;
|
||||
}
|
||||
else if(m.destroyTarget)
|
||||
{
|
||||
destroyMaxNum++;
|
||||
}
|
||||
}
|
||||
teamDic[vo.team] = vo;
|
||||
i++;
|
||||
}
|
||||
protectNum = protectMaxNum;
|
||||
destroyNum = destroyMaxNum;
|
||||
if(o.time == -1)
|
||||
{
|
||||
o.time = GameMath.normalBattleTime;
|
||||
}
|
||||
time = o.time;
|
||||
mapPoints = ObjectUtil.tableToObject(battleFieldVo.mapPoints);
|
||||
mapObjects = ObjectUtil.tableToObject(battleFieldVo.mapObjects);
|
||||
mapAreas = ObjectUtil.tableToObject(battleFieldVo.mapAreas);
|
||||
}
|
||||
|
||||
public function fixMonTeamBeforeBuild() : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var nt:BattleTeamVo = null;
|
||||
for each(var t:BattleTeamVo in teams)
|
||||
{
|
||||
for(i = 0; i < t.mons.length; )
|
||||
{
|
||||
if(t.mons[i].team != t.team)
|
||||
{
|
||||
if(teamDic[t.mons[i].team] == null)
|
||||
{
|
||||
nt = t.cloneEmptyTeam();
|
||||
nt.team = t.mons[i].team;
|
||||
teams.push(nt);
|
||||
teamDic[t.mons[i].team] = nt;
|
||||
}
|
||||
teamDic[t.mons[i].team].mons.push(t.mons.splice(i,1)[0]);
|
||||
i--;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getBattleArea() : Object
|
||||
{
|
||||
return mapAreas.area_battlefield;
|
||||
}
|
||||
|
||||
public function getBattleAreaRandomPoint() : Point
|
||||
{
|
||||
var p:Point = new Point();
|
||||
p.x = getBattleArea().x + getBattleArea().w * Math.random();
|
||||
p.y = getBattleArea().y + getBattleArea().h * Math.random();
|
||||
return p;
|
||||
}
|
||||
|
||||
public function initPve() : void
|
||||
{
|
||||
if(!hasInitPve)
|
||||
{
|
||||
for each(var team:BattleTeamVo in teams)
|
||||
{
|
||||
for each(var monvo:BattleMonVo in team.mons)
|
||||
{
|
||||
monvo.hp *= Table.game_setting.pveHpScale;
|
||||
monvo.hpMax = monvo.hp;
|
||||
}
|
||||
team.ap = team.apMax * Table.game_setting.pveApStartScale;
|
||||
}
|
||||
}
|
||||
trace("初始化pve魔物");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package net.pixvi.myr.element.battle
|
||||
{
|
||||
public class CheatRecord
|
||||
{
|
||||
|
||||
public var mons:Array = [];
|
||||
|
||||
public var damages:Array = [];
|
||||
|
||||
public var master:Object;
|
||||
|
||||
public var text:String = "";
|
||||
|
||||
public function CheatRecord()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function addRecord(str:String) : void
|
||||
{
|
||||
if(str.indexOf("skillTable_223") != -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(str.indexOf("skillTable_57") != -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
text += str + "|";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package net.pixvi.myr.element.battle.battlearea
|
||||
{
|
||||
import net.pixvi.common.utils.Cooldowner;
|
||||
import net.pixvi.myr.battle.view.BattleMon;
|
||||
import net.pixvi.myr.element.battle.BaseBattleArea;
|
||||
|
||||
public class BattleAreaHp extends BaseBattleArea
|
||||
{
|
||||
|
||||
public function BattleAreaHp()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
override public function init() : void
|
||||
{
|
||||
cooldown = new Cooldowner(para.interval);
|
||||
}
|
||||
|
||||
override public function activity(mon:BattleMon) : void
|
||||
{
|
||||
if(para.team != null && para.team != mon.team)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(int(para.hp) > 0)
|
||||
{
|
||||
if(para.percentMode)
|
||||
{
|
||||
mon.beCure(4,mon.monVo.hpMax * para.hp,true);
|
||||
}
|
||||
else
|
||||
{
|
||||
mon.beCure(4,para.hp,true);
|
||||
}
|
||||
}
|
||||
else if(para.percentMode)
|
||||
{
|
||||
mon.beHurt(4,null,mon.monVo.hpMax * int(-para.hp),para.realAtk,false,0,0,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
mon.beHurt(4,null,int(-para.hp),para.realAtk,false,0,0,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package net.pixvi.myr.element.battle.battlearea
|
||||
{
|
||||
import net.pixvi.common.utils.Cooldowner;
|
||||
import net.pixvi.myr.battle.view.BattleMon;
|
||||
import net.pixvi.myr.element.battle.BaseBattleArea;
|
||||
|
||||
public class BattleAreaMoveSpeed extends BaseBattleArea
|
||||
{
|
||||
|
||||
public function BattleAreaMoveSpeed()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
override public function init() : void
|
||||
{
|
||||
cooldown = new Cooldowner(para.interval);
|
||||
}
|
||||
|
||||
override public function activity(mon:BattleMon) : void
|
||||
{
|
||||
if(para.team != null && para.team != mon.team)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(para.percentMode)
|
||||
{
|
||||
mon.buff.buff_movespd(para.speed * mon.all_movespd,para.time);
|
||||
}
|
||||
else
|
||||
{
|
||||
mon.buff.buff_movespd(para.speed,para.time);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package net.pixvi.myr.element.battle.battlearea
|
||||
{
|
||||
import net.pixvi.common.utils.Cooldowner;
|
||||
import net.pixvi.myr.battle.view.BattleMon;
|
||||
import net.pixvi.myr.element.battle.BaseBattleArea;
|
||||
|
||||
public class BattleAreaPow extends BaseBattleArea
|
||||
{
|
||||
|
||||
public function BattleAreaPow()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
override public function init() : void
|
||||
{
|
||||
cooldown = new Cooldowner(para.interval);
|
||||
}
|
||||
|
||||
override public function activity(mon:BattleMon) : void
|
||||
{
|
||||
var px:Number = NaN;
|
||||
var py:Number = NaN;
|
||||
if(para.fromX == null)
|
||||
{
|
||||
px = mon.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
px = Number(para.fromX);
|
||||
}
|
||||
if(para.fromY == null)
|
||||
{
|
||||
py = mon.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
py = Number(para.fromY);
|
||||
}
|
||||
mon.givePow(para.pow,px,py,false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user