958 lines
32 KiB
ActionScript
958 lines
32 KiB
ActionScript
package com
|
||
{
|
||
import com.comfig.CommonData;
|
||
import com.comfig.DataConfig;
|
||
import com.comfig.PathConfig;
|
||
import com.common.App;
|
||
import com.control.ConnectService;
|
||
import com.control.castle.event.AllQueueEvent;
|
||
import com.control.castle.event.CastleBuildEvent;
|
||
import com.control.castle.event.CastleEvent;
|
||
import com.control.castle.event.CastleLevelUpEvent;
|
||
import com.control.castle.event.CastleWallEvent;
|
||
import com.control.data.ReturnBean;
|
||
import com.control.login.event.GetGameInfoEvent;
|
||
import com.control.tech.event.TechUpEvent;
|
||
import com.data.DataModoule;
|
||
import com.data.GameData;
|
||
import com.data.MemeberShip;
|
||
import com.data.data.city.CastleBuilding;
|
||
import com.data.data.items.AddSpeed;
|
||
import com.events.BroadEvent;
|
||
import com.events.BroadEventManage;
|
||
import com.events.DevEvent;
|
||
import com.events.EventUtils;
|
||
import com.net.ChatConnect1;
|
||
import com.net.ChatType;
|
||
import com.net.event.ChatEvent;
|
||
import com.newdata.user.NewUserData;
|
||
import com.utils.TimerManager;
|
||
import com.utils.Utils;
|
||
import com.view.Control;
|
||
import com.view.EconomicInside;
|
||
import com.view.EffectManager;
|
||
import com.view.MilitaryInside;
|
||
import com.view.TownInside;
|
||
import com.view.UIListManage;
|
||
import com.view.cache.BuildCache;
|
||
import com.view.mc.button.BuildControlBar;
|
||
import com.view.newui.UIConfig;
|
||
import com.view.ui.BarFactory;
|
||
import com.view.ui.BaseBuild;
|
||
import com.view.ui.buff.BuffManager;
|
||
import com.view.ui.buildlist.TimerInfo;
|
||
import com.view.ui.chat.UserControl;
|
||
import com.view.ui.countybattle.CountryFightView;
|
||
import com.view.ui.login.NewRoleUI;
|
||
import com.view.ui.message.MessageBoxUI;
|
||
import com.view.ui.teach.TechBuildUI;
|
||
import com.view.ui.wall.CityWallUI;
|
||
import com.view.world.World;
|
||
import flash.display.Bitmap;
|
||
import flash.display.BitmapData;
|
||
import flash.display.DisplayObject;
|
||
import flash.display.MovieClip;
|
||
import flash.display.SimpleButton;
|
||
import flash.display.Sprite;
|
||
import flash.display.Stage;
|
||
import flash.events.Event;
|
||
import flash.events.MouseEvent;
|
||
import flash.system.ApplicationDomain;
|
||
import flash.utils.setTimeout;
|
||
|
||
public class InstallFace
|
||
{
|
||
|
||
private static var instance:InstallFace;
|
||
|
||
private var _stage:Stage;
|
||
|
||
private var _loaderInfo:ApplicationDomain;
|
||
|
||
public var tip_bg:Sprite;
|
||
|
||
private var townStatus:int;
|
||
|
||
private var mapSprite:Sprite;
|
||
|
||
private var worldSprite:Sprite;
|
||
|
||
private var controlSprite:Sprite;
|
||
|
||
private var _currCasId:int;
|
||
|
||
public var _castleType:String;
|
||
|
||
public var isValid:Boolean;
|
||
|
||
private var _realWidth:int;
|
||
|
||
private var _realHeight:int;
|
||
|
||
private var _isConnect:Boolean = true;
|
||
|
||
public var currStatus:int = 2;
|
||
|
||
private var countryFightView:CountryFightView;
|
||
|
||
private var chatConnect:ChatConnect1;
|
||
|
||
public function InstallFace()
|
||
{
|
||
super();
|
||
this.isValid = Utils.isValid();
|
||
this.addEvent();
|
||
}
|
||
|
||
public static function getInstance() : InstallFace
|
||
{
|
||
if(instance == null)
|
||
{
|
||
return instance = new InstallFace();
|
||
}
|
||
return instance;
|
||
}
|
||
|
||
public function set loaderInfo(param1:ApplicationDomain) : void
|
||
{
|
||
this._loaderInfo = param1;
|
||
}
|
||
|
||
public function get loaderInfo() : ApplicationDomain
|
||
{
|
||
return this._loaderInfo;
|
||
}
|
||
|
||
public function get stage() : Stage
|
||
{
|
||
return this._stage;
|
||
}
|
||
|
||
public function set stage(param1:Stage) : void
|
||
{
|
||
this._stage = param1;
|
||
this._stage.stageFocusRect = false;
|
||
this.stage.addEventListener(Event.RESIZE,this.reSizeWindow);
|
||
}
|
||
|
||
public function get currCasId() : int
|
||
{
|
||
return this._currCasId;
|
||
}
|
||
|
||
public function set currCasId(param1:int) : void
|
||
{
|
||
this._currCasId = param1;
|
||
}
|
||
|
||
public function get isConnect() : Boolean
|
||
{
|
||
return this._isConnect;
|
||
}
|
||
|
||
public function set isConnect(param1:Boolean) : void
|
||
{
|
||
this._isConnect = param1;
|
||
}
|
||
|
||
public function get realWidth() : int
|
||
{
|
||
if(this._realWidth == 0)
|
||
{
|
||
this.reSizeWindow(null);
|
||
}
|
||
return this._realWidth;
|
||
}
|
||
|
||
public function get realHeight() : int
|
||
{
|
||
return this._realHeight;
|
||
}
|
||
|
||
public function addMc(param1:DisplayObject) : void
|
||
{
|
||
this._stage.addChild(param1);
|
||
}
|
||
|
||
public function removeMc(param1:DisplayObject) : void
|
||
{
|
||
if(Boolean(param1) && this._stage.contains(param1))
|
||
{
|
||
this._stage.removeChild(param1);
|
||
}
|
||
}
|
||
|
||
private function init() : void
|
||
{
|
||
this.tip_bg = this.getSprite(UIConfig.tip_bg);
|
||
this.stage.addEventListener(MouseEvent.CLICK,this.stageClickEvent);
|
||
EventUtils.getInstance();
|
||
}
|
||
|
||
private function reSizeWindow(param1:Event) : void
|
||
{
|
||
this._realWidth = this.stage.stageWidth;
|
||
this._realHeight = this.stage.stageHeight;
|
||
if(this._realWidth > CommonData.STAGE_MAX_WIDTH)
|
||
{
|
||
this._realWidth = CommonData.STAGE_MAX_WIDTH;
|
||
}
|
||
if(this._realHeight > CommonData.STAGE_MAX_HEIGHT)
|
||
{
|
||
this._realHeight = CommonData.STAGE_MAX_HEIGHT;
|
||
}
|
||
}
|
||
|
||
public function enterGameCheck() : void
|
||
{
|
||
this.init();
|
||
if(NewUserData.getAccount().userId > 0)
|
||
{
|
||
ConnectService.getInstance().loginService.getGameData();
|
||
this.sendNotice();
|
||
}
|
||
else
|
||
{
|
||
this.createRole();
|
||
}
|
||
}
|
||
|
||
private function addControl() : void
|
||
{
|
||
this.controlSprite = new Sprite();
|
||
this.mapSprite = new Sprite();
|
||
this.worldSprite = new Sprite();
|
||
this.addMc(this.worldSprite);
|
||
this.addMc(this.mapSprite);
|
||
this.addMc(this.controlSprite);
|
||
this.controlSprite.addChild(Control.getInstance());
|
||
}
|
||
|
||
private function createRole() : void
|
||
{
|
||
var _loc1_:NewRoleUI = new NewRoleUI();
|
||
this._stage.addChild(_loc1_);
|
||
}
|
||
|
||
private function getGameDataResult(param1:GetGameInfoEvent) : void
|
||
{
|
||
this.enterGame();
|
||
}
|
||
|
||
private function enterGame() : void
|
||
{
|
||
this.addControl();
|
||
this.enterCity();
|
||
}
|
||
|
||
public function enterCity() : void
|
||
{
|
||
this._currCasId = DataModoule.getInstance().userMgr.castle.casId;
|
||
this._castleType = "main";
|
||
this.townStatus = DataConfig.STATUS_IN;
|
||
var _loc1_:TownInside = TownInside.getInstance();
|
||
this.mapSprite.addChild(_loc1_);
|
||
this.getAllQueue();
|
||
}
|
||
|
||
private function getAllQueue() : void
|
||
{
|
||
ConnectService.getInstance().castleService.listAllQueue();
|
||
}
|
||
|
||
private function stageClickEvent(param1:MouseEvent) : void
|
||
{
|
||
BuildControlBar.getInstance().clear();
|
||
var _loc2_:UserControl = UserControl.getInstance();
|
||
if(this.stage.contains(_loc2_))
|
||
{
|
||
this.stage.removeChild(_loc2_);
|
||
}
|
||
}
|
||
|
||
public function enterCastle(param1:String, param2:int) : void
|
||
{
|
||
var _loc3_:MilitaryInside = null;
|
||
var _loc4_:EconomicInside = null;
|
||
var _loc5_:TownInside = null;
|
||
this._currCasId = param2;
|
||
this._castleType = param1;
|
||
if(this.mapSprite.contains(TownInside.getInstance()))
|
||
{
|
||
this.mapSprite.removeChild(TownInside.getInstance());
|
||
}
|
||
if(this.mapSprite.contains(MilitaryInside.getInstance()))
|
||
{
|
||
this.mapSprite.removeChild(MilitaryInside.getInstance());
|
||
}
|
||
if(this.mapSprite.contains(EconomicInside.getInstance()))
|
||
{
|
||
this.mapSprite.removeChild(EconomicInside.getInstance());
|
||
}
|
||
if(param1 == "military")
|
||
{
|
||
_loc3_ = MilitaryInside.getInstance();
|
||
if(!this.mapSprite.contains(_loc3_))
|
||
{
|
||
this.mapSprite.addChild(_loc3_);
|
||
}
|
||
_loc3_.setCastleId(param2);
|
||
}
|
||
if(param1 == "economic")
|
||
{
|
||
_loc4_ = EconomicInside.getInstance();
|
||
if(!this.mapSprite.contains(_loc4_))
|
||
{
|
||
this.mapSprite.addChild(_loc4_);
|
||
}
|
||
_loc4_.setCastleId(param2);
|
||
}
|
||
if(param1 == "main")
|
||
{
|
||
_loc5_ = TownInside.getInstance();
|
||
if(!this.mapSprite.contains(_loc5_))
|
||
{
|
||
this.mapSprite.addChild(_loc5_);
|
||
}
|
||
_loc5_.getCastleBuildList();
|
||
}
|
||
ConnectService.getInstance().castleService.changeCurrCity(param2);
|
||
}
|
||
|
||
private function addEvent() : void
|
||
{
|
||
ConnectService.getInstance().addEventListener(CastleBuildEvent.ADD_SPEED_OK,this.addSpeedResult);
|
||
ConnectService.getInstance().addEventListener(TechUpEvent.ADDSPEED_OK,this.addSpeedTechResult);
|
||
ConnectService.getInstance().addEventListener(CastleWallEvent.WALL_ADDSPEED,this.addSpeedWallResult);
|
||
ConnectService.getInstance().addEventListener(CastleBuildEvent.BUILD_UP_OK,this.upBuildOkResult);
|
||
ConnectService.getInstance().addEventListener(CastleBuildEvent.BUILD_NEW,this.createNewBuildResult);
|
||
ConnectService.getInstance().addEventListener(CastleBuildEvent.BUILD_UP,this.upBuildResult);
|
||
ConnectService.getInstance().addEventListener(CastleBuildEvent.BUILD_DESTROY,this.destroyBuildResult);
|
||
ConnectService.getInstance().addEventListener(CastleBuildEvent.BUILD_CANCEL,this.cancelBuildResult);
|
||
ConnectService.getInstance().addEventListener(AllQueueEvent.AllQueue,this.getAllQueueResult);
|
||
ConnectService.getInstance().addEventListener(CastleLevelUpEvent.CASTLE_LEVELUP,this.castleLevelUpResult);
|
||
ConnectService.getInstance().addEventListener(TechUpEvent.UP_BEGIN,this.techLevelUpResult);
|
||
ConnectService.getInstance().addEventListener(TechUpEvent.UP_OVER,this.techUpOverResult);
|
||
ConnectService.getInstance().addEventListener(TechUpEvent.CANCEL_OVER,this.techCancelResult);
|
||
ConnectService.getInstance().addEventListener(CastleWallEvent.WALL_PRODUCTARMY,this.productArmyResult);
|
||
ConnectService.getInstance().addEventListener(CastleWallEvent.WALL_PRODUCTOVER,this.productArmyOverResult);
|
||
ConnectService.getInstance().addEventListener(CastleWallEvent.WALL_CANCEL,this.cancelWallResult);
|
||
ConnectService.getInstance().addEventListener(GetGameInfoEvent.getData,this.getGameDataResult);
|
||
Utils.g_events.addEventListener(DevEvent.CASTLEMOVE,this.moveCastleSucc);
|
||
ConnectService.getInstance().addEventListener(CastleEvent.CASTLE_changeBranchCastleType,this.changesucc);
|
||
}
|
||
|
||
private function changesucc(param1:CastleEvent) : void
|
||
{
|
||
MessageBoxUI.getInstance().reLogin("转换成功,现在请重新登陆游戏");
|
||
}
|
||
|
||
private function moveCastleSucc(param1:DevEvent) : void
|
||
{
|
||
MessageBoxUI.getInstance().reLogin("迁城成功,请重新登录游戏");
|
||
}
|
||
|
||
private function moveCastleSuccF(param1:DevEvent) : void
|
||
{
|
||
Utils.g_events.removeEventListener(DevEvent.CASTLECHANGE,this.moveCastleSuccF);
|
||
if(this.currStatus == 1)
|
||
{
|
||
World.getInstance().moveCastleSuccF(MemeberShip.getMainCastle().posX,MemeberShip.getMainCastle().posY);
|
||
}
|
||
}
|
||
|
||
private function addSpeedResult(param1:CastleBuildEvent) : void
|
||
{
|
||
var _loc2_:CastleBuilding = param1.castleBuild;
|
||
BuildCache.getInstance().updateCastleBuild(_loc2_);
|
||
var _loc3_:BaseBuild = this.getBaseBuild(_loc2_.casId,_loc2_.posNo);
|
||
if(_loc2_.upTime <= 0)
|
||
{
|
||
_loc2_.isUp = false;
|
||
TimerManager.getInstance().deleteBuildTime(_loc2_.posNo + "_" + _loc2_.casBuiId);
|
||
TimerManager.getInstance().refresh();
|
||
if(_loc3_)
|
||
{
|
||
_loc3_.castleBuild = _loc2_;
|
||
_loc3_.setUpOkStatus();
|
||
}
|
||
}
|
||
else
|
||
{
|
||
_loc2_.isUp = true;
|
||
TimerManager.getInstance().updateBuildTime(_loc2_.posNo + "_" + _loc2_.casBuiId,_loc2_.upTime);
|
||
}
|
||
}
|
||
|
||
private function addSpeedTechResult(param1:TechUpEvent) : void
|
||
{
|
||
var _loc2_:AddSpeed = param1.addSpeed;
|
||
var _loc3_:Object = param1.obj;
|
||
if(_loc3_ == null)
|
||
{
|
||
TimerManager.getInstance().deleteSkillTime("tech_" + _loc2_.id);
|
||
TimerManager.getInstance().refresh();
|
||
}
|
||
else
|
||
{
|
||
TimerManager.getInstance().updateTechTime("tech_" + _loc2_.id,_loc3_.remainTime);
|
||
}
|
||
}
|
||
|
||
private function addSpeedWallResult(param1:CastleWallEvent) : void
|
||
{
|
||
var _loc2_:AddSpeed = param1.addSpeed;
|
||
var _loc3_:Object = param1.wallObject;
|
||
if(_loc3_ == null)
|
||
{
|
||
TimerManager.getInstance().deleteWallTime("wall_" + _loc2_.id);
|
||
TimerManager.getInstance().refresh();
|
||
}
|
||
else
|
||
{
|
||
TimerManager.getInstance().updateWallTime("wall_" + _loc2_.id,_loc3_.time);
|
||
}
|
||
}
|
||
|
||
private function upBuildOkResult(param1:CastleBuildEvent) : void
|
||
{
|
||
var _loc2_:int = int(param1.obj.casId);
|
||
var _loc3_:String = param1.obj.posNo;
|
||
var _loc4_:int = int(param1.obj.casBuiId);
|
||
var _loc5_:CastleBuilding = param1.castleBuild;
|
||
if(_loc5_ != null)
|
||
{
|
||
_loc5_.isUp = false;
|
||
}
|
||
if(_loc5_ != null)
|
||
{
|
||
BuildCache.getInstance().updateCastleBuild(_loc5_);
|
||
}
|
||
else
|
||
{
|
||
BuildCache.getInstance().delCastleBuild(_loc2_,_loc3_);
|
||
}
|
||
var _loc6_:BaseBuild = this.getBaseBuild(_loc2_,_loc3_);
|
||
if(_loc6_)
|
||
{
|
||
if(_loc5_)
|
||
{
|
||
_loc6_.castleBuild = _loc5_;
|
||
}
|
||
_loc6_.setUpOkStatus();
|
||
if(_loc5_ == null)
|
||
{
|
||
this.delBuild(_loc2_,_loc3_);
|
||
}
|
||
}
|
||
TimerManager.getInstance().deleteBuildTime(_loc3_ + "_" + _loc4_);
|
||
TimerManager.getInstance().refresh();
|
||
}
|
||
|
||
private function createNewBuildResult(param1:CastleBuildEvent) : void
|
||
{
|
||
var _loc4_:BaseBuild = null;
|
||
var _loc2_:CastleBuilding = param1.castleBuild;
|
||
BuildCache.getInstance().updateCastleBuild(_loc2_);
|
||
var _loc3_:TimerInfo = this.getBuildTime(_loc2_);
|
||
if(_loc2_.casId == this.currCasId)
|
||
{
|
||
if(this._castleType == "military")
|
||
{
|
||
_loc4_ = MilitaryInside.getInstance().createNewBuild(_loc2_);
|
||
_loc4_.setUpStatus();
|
||
_loc3_.process1 = _loc4_.processDo;
|
||
}
|
||
if(this._castleType == "economic")
|
||
{
|
||
_loc4_ = EconomicInside.getInstance().createNewBuild(_loc2_);
|
||
_loc4_.setUpStatus();
|
||
_loc3_.process1 = _loc4_.processDo;
|
||
}
|
||
if(this._castleType == "main")
|
||
{
|
||
_loc4_ = TownInside.getInstance().createNewBuild(_loc2_);
|
||
_loc4_.setUpStatus();
|
||
_loc3_.process1 = _loc4_.processDo;
|
||
}
|
||
}
|
||
TimerManager.getInstance().setBuildTimerEvent(_loc3_);
|
||
}
|
||
|
||
private function upBuildResult(param1:CastleBuildEvent) : void
|
||
{
|
||
if(param1.result == ReturnBean.STATUS_4)
|
||
{
|
||
MessageBoxUI.getInstance().addMessage(param1.msg);
|
||
return;
|
||
}
|
||
var _loc2_:CastleBuilding = param1.castleBuild;
|
||
BuildCache.getInstance().updateCastleBuild(_loc2_);
|
||
var _loc3_:BaseBuild = this.getBaseBuild(_loc2_.casId,_loc2_.posNo);
|
||
var _loc4_:TimerInfo = this.getBuildTime(_loc2_);
|
||
if(_loc3_)
|
||
{
|
||
_loc3_.castleBuild = _loc2_;
|
||
_loc3_.setUpStatus();
|
||
_loc4_.process1 = _loc3_.processDo;
|
||
}
|
||
TimerManager.getInstance().setBuildTimerEvent(_loc4_);
|
||
}
|
||
|
||
private function destroyBuildResult(param1:CastleBuildEvent) : void
|
||
{
|
||
var _loc2_:CastleBuilding = param1.castleBuild;
|
||
BuildCache.getInstance().updateCastleBuild(_loc2_);
|
||
var _loc3_:BaseBuild = this.getBaseBuild(_loc2_.casId,_loc2_.posNo);
|
||
var _loc4_:TimerInfo = this.getBuildTime(_loc2_,false);
|
||
if(_loc3_)
|
||
{
|
||
_loc3_.castleBuild = _loc2_;
|
||
_loc3_.setUpStatus();
|
||
_loc4_.process1 = _loc3_.processDo;
|
||
}
|
||
TimerManager.getInstance().setBuildTimerEvent(_loc4_);
|
||
}
|
||
|
||
private function cancelBuildResult(param1:CastleBuildEvent) : void
|
||
{
|
||
var _loc2_:CastleBuilding = param1.castleBuild;
|
||
BuildCache.getInstance().updateCastleBuild(_loc2_);
|
||
var _loc3_:BaseBuild = this.getBaseBuild(_loc2_.casId,_loc2_.posNo);
|
||
_loc2_.isUp = false;
|
||
if(_loc3_)
|
||
{
|
||
if(_loc2_.level > 0)
|
||
{
|
||
_loc3_.castleBuild = _loc2_;
|
||
}
|
||
_loc3_.setUpOkStatus();
|
||
if(_loc2_.level == 0)
|
||
{
|
||
this.delBuild(_loc2_.casId,_loc2_.posNo);
|
||
}
|
||
}
|
||
TimerManager.getInstance().deleteBuildTime(_loc2_.posNo + "_" + _loc2_.casBuiId);
|
||
TimerManager.getInstance().refresh();
|
||
}
|
||
|
||
private function getAllQueueResult(param1:AllQueueEvent) : void
|
||
{
|
||
var _loc2_:Array = param1.allQueueArr;
|
||
TimerManager.getInstance().setAllQueue(_loc2_);
|
||
}
|
||
|
||
private function castleLevelUpResult(param1:CastleLevelUpEvent) : void
|
||
{
|
||
var _loc2_:String = param1.cityUrl;
|
||
if(this._castleType == "main")
|
||
{
|
||
TownInside.getInstance().casLvUp(_loc2_);
|
||
}
|
||
BuffManager.getInstance().update();
|
||
}
|
||
|
||
private function techLevelUpResult(param1:TechUpEvent) : void
|
||
{
|
||
var _loc2_:TechBuildUI = UIListManage.getInstance().getClass(TechBuildUI) as TechBuildUI;
|
||
var _loc3_:TimerInfo = this.getTechTime(param1.obj);
|
||
if(_loc2_)
|
||
{
|
||
_loc2_.techLevelUp(param1.obj);
|
||
_loc3_.process1 = _loc2_.processDo;
|
||
}
|
||
TimerManager.getInstance().setBuildTimerEvent(_loc3_,2);
|
||
}
|
||
|
||
private function techUpOverResult(param1:TechUpEvent) : void
|
||
{
|
||
}
|
||
|
||
private function techCancelResult(param1:TechUpEvent) : void
|
||
{
|
||
TimerManager.getInstance().deleteSkillTime("tech_" + param1.obj);
|
||
TimerManager.getInstance().refresh();
|
||
}
|
||
|
||
private function productArmyResult(param1:CastleWallEvent) : void
|
||
{
|
||
var _loc5_:Boolean = false;
|
||
var _loc2_:Object = param1.wallObject;
|
||
var _loc3_:TimerInfo = this.getWallTime(_loc2_);
|
||
var _loc4_:CityWallUI = UIListManage.getInstance().getClass(CityWallUI) as CityWallUI;
|
||
if(_loc4_)
|
||
{
|
||
_loc5_ = _loc4_.contains(_loc4_.page1);
|
||
if(_loc5_)
|
||
{
|
||
_loc4_.page1.addProductArmy(_loc2_);
|
||
_loc3_.process1 = _loc4_.page1.buildWallMc.setTime;
|
||
}
|
||
}
|
||
TimerManager.getInstance().setBuildTimerEvent(_loc3_,3);
|
||
}
|
||
|
||
private function productArmyOverResult(param1:CastleWallEvent) : void
|
||
{
|
||
}
|
||
|
||
private function cancelWallResult(param1:CastleWallEvent) : void
|
||
{
|
||
TimerManager.getInstance().deleteWallTime("wall_" + param1.wallObject.id);
|
||
TimerManager.getInstance().refresh();
|
||
}
|
||
|
||
private function getWallTime(param1:Object) : TimerInfo
|
||
{
|
||
var _loc2_:TimerInfo = new TimerInfo();
|
||
_loc2_.timerId = "wall_" + param1.id;
|
||
_loc2_.timerName = param1.army.armyName;
|
||
_loc2_.upStr = "建造中";
|
||
_loc2_.queId = param1.id;
|
||
_loc2_.timeType = 3;
|
||
_loc2_.timerLevel = 0;
|
||
_loc2_.nextLevel = 0;
|
||
_loc2_.timerNeed = param1.time;
|
||
return _loc2_;
|
||
}
|
||
|
||
private function getTechTime(param1:Object) : TimerInfo
|
||
{
|
||
var _loc2_:TimerInfo = new TimerInfo();
|
||
_loc2_.timerId = "tech_" + param1.queId;
|
||
_loc2_.timerName = param1.techName;
|
||
_loc2_.upStr = "研究中";
|
||
_loc2_.queId = param1.queId;
|
||
_loc2_.timeType = 2;
|
||
_loc2_.type = param1.entName;
|
||
_loc2_.timerLevel = param1.currLv;
|
||
_loc2_.nextLevel = param1.toLevel;
|
||
_loc2_.timerNeed = param1.remainTime;
|
||
return _loc2_;
|
||
}
|
||
|
||
private function getBuildTime(param1:CastleBuilding, param2:Boolean = true) : TimerInfo
|
||
{
|
||
var _loc3_:TimerInfo = new TimerInfo();
|
||
_loc3_.timerId = param1.posNo + "_" + param1.casBuiId;
|
||
_loc3_.timerName = param1.building.buiName;
|
||
_loc3_.queId = param1.buildQueue.queId;
|
||
_loc3_.timeType = 1;
|
||
_loc3_.timerLevel = param1.level;
|
||
_loc3_.casId = param1.casId;
|
||
if(param2)
|
||
{
|
||
_loc3_.upStr = "建造中";
|
||
_loc3_.nextLevel = param1.level + 1;
|
||
}
|
||
else
|
||
{
|
||
_loc3_.upStr = "拆除中";
|
||
_loc3_.nextLevel = param1.level - 1;
|
||
}
|
||
_loc3_.timerNeed = param1.upTime + 1;
|
||
return _loc3_;
|
||
}
|
||
|
||
private function getBaseBuild(param1:int, param2:String) : BaseBuild
|
||
{
|
||
var _loc3_:BaseBuild = null;
|
||
if(this.currCasId == param1)
|
||
{
|
||
if(this._castleType == "military")
|
||
{
|
||
_loc3_ = MilitaryInside.getInstance().getBuildByPosNo(param2) as BaseBuild;
|
||
}
|
||
if(this._castleType == "economic")
|
||
{
|
||
_loc3_ = EconomicInside.getInstance().getBuildByPosNo(param2) as BaseBuild;
|
||
}
|
||
if(this._castleType == "main")
|
||
{
|
||
_loc3_ = TownInside.getInstance().getBuildByPosNo(param2) as BaseBuild;
|
||
}
|
||
}
|
||
return _loc3_;
|
||
}
|
||
|
||
private function delBuild(param1:int, param2:String) : void
|
||
{
|
||
if(this.currCasId == param1)
|
||
{
|
||
if(this._castleType == "military")
|
||
{
|
||
MilitaryInside.getInstance().delBuildyPosNo(param2);
|
||
}
|
||
if(this._castleType == "economic")
|
||
{
|
||
EconomicInside.getInstance().delBuildyPosNo(param2);
|
||
}
|
||
if(this._castleType == "main")
|
||
{
|
||
TownInside.getInstance().delBuildyPosNo(param2);
|
||
}
|
||
}
|
||
}
|
||
|
||
public function setBuildNameView() : void
|
||
{
|
||
if(this._castleType == "military")
|
||
{
|
||
MilitaryInside.getInstance().setBuildNameView();
|
||
}
|
||
if(this._castleType == "economic")
|
||
{
|
||
EconomicInside.getInstance().setBuildNameView();
|
||
}
|
||
if(this._castleType == "main")
|
||
{
|
||
TownInside.getInstance().setBuildNameView();
|
||
}
|
||
}
|
||
|
||
public function toWorld() : void
|
||
{
|
||
this.currStatus = 1;
|
||
if(Boolean(this.countryFightView) && this.worldSprite.contains(this.countryFightView))
|
||
{
|
||
this.worldSprite.removeChild(this.countryFightView);
|
||
}
|
||
Control.getInstance().toWorld(true);
|
||
this.mapSprite.visible = false;
|
||
var _loc1_:World = World.getInstance();
|
||
this.worldSprite.addChild(_loc1_);
|
||
}
|
||
|
||
public function toTown() : void
|
||
{
|
||
this.currStatus = 2;
|
||
if(Boolean(this.countryFightView) && this.worldSprite.contains(this.countryFightView))
|
||
{
|
||
this.worldSprite.removeChild(this.countryFightView);
|
||
}
|
||
var _loc1_:World = World.getInstance();
|
||
if(this.worldSprite.contains(_loc1_))
|
||
{
|
||
this.worldSprite.removeChild(_loc1_);
|
||
}
|
||
Control.getInstance().toWorld(false);
|
||
this.mapSprite.visible = true;
|
||
}
|
||
|
||
public function toCountryFight() : void
|
||
{
|
||
this.currStatus = 3;
|
||
var _loc1_:World = World.getInstance();
|
||
if(Boolean(_loc1_) && this.worldSprite.contains(_loc1_))
|
||
{
|
||
this.worldSprite.removeChild(_loc1_);
|
||
}
|
||
if(this.countryFightView == null)
|
||
{
|
||
this.countryFightView = new CountryFightView();
|
||
}
|
||
this.worldSprite.addChild(this.countryFightView);
|
||
}
|
||
|
||
public function connectToserver() : void
|
||
{
|
||
this.chatConnect = new ChatConnect1();
|
||
this.chatConnect.connect(PathConfig.getInstance().getServerIp(),PathConfig.getInstance().getServerPort());
|
||
this.chatConnect.addEventListener(ChatEvent.MESSAGE,this.getMessFromSer);
|
||
}
|
||
|
||
public function getChatConnect() : ChatConnect1
|
||
{
|
||
return this.chatConnect;
|
||
}
|
||
|
||
public function loginByUserId() : void
|
||
{
|
||
if(NewUserData.getAccount().userId > 0)
|
||
{
|
||
this.chatConnect.login();
|
||
}
|
||
}
|
||
|
||
private function getMessFromSer(param1:ChatEvent) : void
|
||
{
|
||
var _loc2_:BroadEvent = null;
|
||
var _loc3_:Array = null;
|
||
var _loc4_:Object = null;
|
||
switch(param1.messId)
|
||
{
|
||
case ChatType.type_1:
|
||
if(Control.instance != null)
|
||
{
|
||
Control.getInstance().chatMainUI.printWorldMess(param1.mess);
|
||
}
|
||
break;
|
||
case ChatType.type_2:
|
||
if(Control.instance != null)
|
||
{
|
||
Control.getInstance().chatMainUI.printCountryMess(param1.mess);
|
||
}
|
||
break;
|
||
case ChatType.type_3:
|
||
if(Control.instance != null)
|
||
{
|
||
Control.getInstance().chatMainUI.printUnionMess(param1.mess);
|
||
}
|
||
break;
|
||
case ChatType.type_4:
|
||
if(Control.instance != null)
|
||
{
|
||
Control.getInstance().chatMainUI.printUserMess(param1.mess);
|
||
}
|
||
break;
|
||
case ChatType.type_5:
|
||
if(Control.instance != null)
|
||
{
|
||
Control.getInstance().sysMessUI.printMess(param1.mess);
|
||
}
|
||
break;
|
||
case ChatType.type_8:
|
||
this.chatConnect.close();
|
||
MessageBoxUI.getInstance().reLogin();
|
||
break;
|
||
case ChatType.type_9:
|
||
_loc2_ = new BroadEvent(BroadEvent.HEXAGRAM_EVENT);
|
||
_loc2_.msg = param1.mess;
|
||
BroadEventManage.getInstance().dispatchEvent(_loc2_);
|
||
break;
|
||
case ChatType.type_10:
|
||
Control.getInstance().sysMessUI.titleMsg(param1.mess);
|
||
break;
|
||
case ChatType.type_11:
|
||
EffectManager.getInstance().dispatchEvent(new Event(param1.mess));
|
||
break;
|
||
case ChatType.type_12:
|
||
_loc3_ = param1.mess.split("[-]");
|
||
_loc4_ = new Object();
|
||
_loc4_.name = _loc3_[0];
|
||
_loc4_.cons = _loc3_[1];
|
||
if(BarFactory.instance == null)
|
||
{
|
||
BarFactory.getInstance();
|
||
}
|
||
Utils.g_events.dispatchEvent(new DevEvent(DevEvent.NewPlayerEvent,_loc4_));
|
||
if(NewUserData.getUser() != null && MemeberShip.getCurrCasId() > 0)
|
||
{
|
||
ConnectService.getInstance().castleService.calcuDevData();
|
||
}
|
||
break;
|
||
case ChatType.type_13:
|
||
this.chatConnect.close();
|
||
MessageBoxUI.getInstance().reLogin(param1.mess);
|
||
break;
|
||
case ChatType.type_14:
|
||
if(Control.instance != null)
|
||
{
|
||
Control.getInstance().sysMessUI.titleMsg(param1.mess);
|
||
}
|
||
break;
|
||
case ChatType.type_15:
|
||
GameData.onLineUser.setOnlineUser(param1.mess);
|
||
break;
|
||
case ChatType.type_16:
|
||
if(Control.instance != null)
|
||
{
|
||
Control.getInstance().sysMessUI.userTitleMsg(param1.mess);
|
||
}
|
||
break;
|
||
case ChatType.type_17:
|
||
if(Control.instance != null)
|
||
{
|
||
Control.getInstance().sysMessUI.kingLoginMsg(param1.mess);
|
||
}
|
||
break;
|
||
case ChatType.type_20:
|
||
if(Control.instance != null)
|
||
{
|
||
}
|
||
break;
|
||
case ChatType.type_21:
|
||
if(Control.instance != null)
|
||
{
|
||
Control.getInstance().sysMessUI.broadcastMsg(param1.mess);
|
||
}
|
||
break;
|
||
case ChatType.type_22:
|
||
if(Control.instance != null)
|
||
{
|
||
this.chatConnect.sendHeartConnect();
|
||
}
|
||
}
|
||
}
|
||
|
||
private function sendNotice() : void
|
||
{
|
||
setTimeout(function():void
|
||
{
|
||
var _loc1_:String = "<font color=\'#FF8080\'>【系统公告】</font><font color=\'#46FF46\'>本游戏一切充值请联系QQ:" + GameData.getConfigMap().QQ + "。欢迎加入讨论群:" + GameData.getConfigMap().QQUN + "</font>";
|
||
Control.getInstance().chatMainUI.printWorldMess(_loc1_);
|
||
},60000);
|
||
}
|
||
|
||
public function getSprite(param1:String) : Sprite
|
||
{
|
||
var _loc2_:Sprite = null;
|
||
_loc2_ = App.createSprite(param1,this._loaderInfo);
|
||
if(_loc2_ == null)
|
||
{
|
||
_loc2_ = null;
|
||
}
|
||
return _loc2_;
|
||
}
|
||
|
||
private function createClip(param1:String) : MovieClip
|
||
{
|
||
var _loc2_:MovieClip = null;
|
||
_loc2_ = App.createMc(param1,this._loaderInfo);
|
||
if(_loc2_ == null)
|
||
{
|
||
_loc2_ = null;
|
||
}
|
||
return _loc2_;
|
||
}
|
||
|
||
public function getMovieClip(param1:String) : MovieClip
|
||
{
|
||
return this.createClip(param1);
|
||
}
|
||
|
||
public function getPng(param1:String) : BitmapData
|
||
{
|
||
var _loc2_:BitmapData = null;
|
||
_loc2_ = App.createPng(param1,this._loaderInfo);
|
||
if(_loc2_ == null)
|
||
{
|
||
_loc2_ = null;
|
||
}
|
||
return _loc2_;
|
||
}
|
||
|
||
public function getBitMap(param1:String) : Bitmap
|
||
{
|
||
return new Bitmap(this.getPng(param1));
|
||
}
|
||
|
||
public function getButton(param1:String) : SimpleButton
|
||
{
|
||
var _loc2_:SimpleButton = null;
|
||
_loc2_ = App.createButton(param1,this._loaderInfo);
|
||
if(_loc2_ == null)
|
||
{
|
||
_loc2_ = null;
|
||
}
|
||
return _loc2_;
|
||
}
|
||
|
||
public function getClass(param1:String) : Class
|
||
{
|
||
return App.getClass(param1,this._loaderInfo);
|
||
}
|
||
}
|
||
}
|
||
|