PageRenderTime 32ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 1ms

/com/lele/Manager/GameManager.as

https://gitlab.com/Treeky-NULL/LezaiNiubi
ActionScript | 944 lines | 837 code | 26 blank | 81 comment | 30 complexity | 25535080c8dc28783b508ea81a7565b0 MD5 | raw file
  1. package com.lele.Manager
  2. {
  3. import com.lele.Container.ActivityContainer;
  4. import com.lele.Container.AppContainer;
  5. import com.lele.Container.ContainerBase;
  6. import com.lele.Controller.Avatar.Events.NetWorkController_NetPlayerUnit_Event;
  7. import com.lele.Manager.Interface.IApplicationManager;
  8. import com.lele.Manager.Interface.IApplyAppContainer;
  9. import com.lele.Manager.Interface.ICommand;
  10. import com.lele.Controller.Avatar.ActionSuggest;
  11. import com.lele.Container.EffectContainer;
  12. import com.lele.Container.InteractContainer;
  13. import com.lele.Controller.Avatar.CAvatar;
  14. import com.lele.Controller.NetWorkController;
  15. import com.lele.Link.*;
  16. import com.lele.Data.GloableData;
  17. import com.lele.Manager.Events.*;
  18. import com.lele.Manager.Interface.INetManager;
  19. import com.lele.Manager.Interface.IReport;
  20. import com.lele.Map.RuntimeActor;
  21. import com.lele.Plugin.Console.ConsoleWindow;
  22. import com.lele.Plugin.FpsTool.Fps;
  23. import com.lele.Plugin.RoadFind.RoadFinder;
  24. import flash.display.DisplayObject;
  25. import flash.display.Loader;
  26. import flash.display.MovieClip;
  27. import flash.display.SpreadMethod;
  28. import flash.display.Sprite;
  29. import flash.events.Event;
  30. import flash.events.IEventDispatcher;
  31. import flash.events.TimerEvent;
  32. import flash.system.Security;
  33. import flash.utils.getQualifiedClassName;
  34. import flash.net.URLRequest;
  35. import flash.text.TextField;
  36. import flash.geom.Point;
  37. import flash.utils.Timer;
  38. /**
  39. * ...
  40. * @author Lele
  41. */
  42. public class GameManager extends Sprite implements IReport,IApplyAppContainer,ICommand,IEventDispatcher//存在加载速度不协调造成的bug
  43. {
  44. //通用事件接口
  45. private static var _eventDispatcher:IEventDispatcher;
  46. //管理器
  47. private var _mapManager:MapManager;
  48. private var _resourceManager:ResourceManager;
  49. private var _soundManager:SoundManager;
  50. private var _uiManager:UIManager;
  51. private var _playerManager:PlayerManager;
  52. private var _acitvityManager:ActivityManager;
  53. private static var _appManager:ApplicationManager;
  54. private static var _netManager:NetManager;
  55. private var _interactManager:InteractManager;
  56. //中间数据集
  57. private var _dataBridge:Object;
  58. //显示对象容器
  59. private var _uiContainer:Sprite;
  60. private var _mapsContainer:Sprite;
  61. private var _appContainer:AppContainer;
  62. private var _movieContainer:ActivityContainer;
  63. private var _effectContainer:EffectContainer;
  64. private var _uiHighContainer:Sprite;//主要是加载进度条
  65. private var _interactContainer:InteractContainer;
  66. private var _debugContainer:Sprite;
  67. //网络配置
  68. private var _ip:String="127.0.0.1"; //"115.159.27.206"
  69. private var _port:int = 51888;
  70. //debug窗口
  71. private var _textField:TextField;
  72. //console窗口
  73. private var _console:ConsoleWindow;
  74. //flags
  75. private var _beginFlag:Boolean = true;//是否首次打开
  76. //接口
  77. private static var _iCommand:ICommand;
  78. //接口临时数据
  79. private var _changeMapCallBack:Function;
  80. public function GameManager()
  81. {
  82. _eventDispatcher = this;
  83. GloableData.MaxRoadMapSize = new Point(1920, 1920);
  84. GloableData.FocalPoint = new Point(960 / 2, 540 / 2);
  85. GloableData.AvatarPosition = new Point(0, 0);
  86. GloableData.MapOffSetX = 0;
  87. GloableData.MapOffSetY = 0;
  88. GloableData.Environment = "net";
  89. GloableData.HasLogin = false;
  90. GloableData.CurrentMap = "Map001";
  91. GloableData.CurrentWeather = "Sun";
  92. GloableData.CurrentWeatherStrength = 0;
  93. GloableData.Version = "0.5.3";
  94. GloableData.MasterMode = true;
  95. GloableData.VipNetEnable = true;
  96. GloableData.ActivityConditionTime = 500;
  97. GloableData.ThrowItemHurt = 0.1;
  98. if (GloableData.Environment == "net")
  99. {
  100. _ip = "121.42.202.168";
  101. //加载安全策略文件
  102. //Security.loadPolicyFile("http://"+_ip+"/crossdomain.xml");
  103. }
  104. _uiContainer = new Sprite();//四只容器管理不同层次
  105. _mapsContainer = new Sprite();
  106. _effectContainer = new EffectContainer();
  107. _uiHighContainer = new Sprite();
  108. _appContainer = new AppContainer();//应用层
  109. _movieContainer = new ActivityContainer();
  110. _debugContainer = new Sprite();
  111. _interactContainer = new InteractContainer();//交互提示tip
  112. _dataBridge = new Object();
  113. _resourceManager = new ResourceManager(this);
  114. _mapManager = new MapManager(_resourceManager, this);
  115. _soundManager = new SoundManager(_resourceManager,this);
  116. _uiManager = new UIManager(_resourceManager, this);
  117. _playerManager = new PlayerManager(_resourceManager, this);
  118. _appManager = new ApplicationManager(_resourceManager, this, this);
  119. _acitvityManager = new ActivityManager(_resourceManager, this,_movieContainer);
  120. _netManager = new NetManager(_ip, _port, this);
  121. _interactManager = new InteractManager(this, _interactContainer);
  122. _dataBridge.spawnPoint = new Point(637, 332);//连接出生点状态的数据,以后还有更多
  123. {//创建Debug容器
  124. _textField = new TextField();
  125. _textField.width = 100;
  126. _textField.y = 60;
  127. var color:uint = 4294967295;
  128. _textField.text = "摩尔庄园2 \nalpha v"+GloableData.Version+"\nDebug窗口:\n";
  129. _textField.textColor = color;
  130. if(GloableData.MasterMode)
  131. _debugContainer.addChild(_textField);
  132. //创建FPS
  133. var fps:Fps = new Fps();
  134. fps.y = 0;
  135. fps.x = 65;
  136. if (GloableData.MasterMode)
  137. _debugContainer.addChild(fps);
  138. //创建Console
  139. if (GloableData.MasterMode)
  140. {
  141. _console = new ConsoleWindow(this);
  142. _debugContainer.addChild(_console);
  143. _console.On();
  144. }
  145. }
  146. AddAllDisplay();
  147. //初始化加载消息框,登录界面,和摩尔创建界面
  148. _appManager.LoadApp(AppDataLink.GetUrlByName("Dialog"), _appContainer.GetContainer());
  149. _appManager.LoadStartApp(AppDataLink.GetUrlByName("StartApp"), _appContainer.GetContainer());
  150. _appManager.LoadApp(AppDataLink.GetUrlByName("CreateMoleApp"), _appContainer.GetContainer());
  151. //预连接
  152. _netManager.Connect();
  153. //接口
  154. _iCommand = this;
  155. }
  156. public static function GetEventDispatcher():IEventDispatcher
  157. {
  158. return _eventDispatcher;
  159. }
  160. public function OnReport(evt:Event):void
  161. {
  162. if (evt is ManagerEventBase)
  163. {
  164. var event:ManagerEventBase = evt as ManagerEventBase;
  165. switch(event.EvtType)
  166. {
  167. case Player_Game_ManagerEvent.PLAYERLOADED:
  168. {
  169. TextFieldHandle("玩家资源加载完毕");
  170. ShowAndPlay();
  171. return;
  172. }
  173. case Map_Game_ManagerEvent.MAPLOADED:
  174. {
  175. TextFieldHandle("地图数据加载完毕");
  176. ShowAndPlay();//判断加载是否完成,若完成则开始
  177. return;
  178. }
  179. case Sound_Game_ManagerEvent.SOUNDLOADEDEVENT:
  180. {
  181. TextFieldHandle("音频数据加载完毕");
  182. ShowAndPlay();
  183. return;
  184. }
  185. case UI_Game_ManagerEvent.LOADINGBARLOADEDEVENT:
  186. {
  187. _uiManager.highUIContainer = _uiHighContainer;//设置最高容器
  188. _playerManager.LoadAndStart("Animation/AnimationData.swf");
  189. _uiManager.LoadUI("UI/WorldMap.swf", _uiHighContainer,true,"Map");
  190. _uiManager.LoadUI("UI/ToolBar.swf", _uiContainer, true, "MAP");//暂时这样放,本身这样就是暂时的
  191. _interactManager.LoadRes("UI/InterectRes.swf");
  192. _mapManager.LoadAndStart(MapDataLink.Map001, _mapsContainer,true,"MAP");//传递进回调函数,当加载完成
  193. _soundManager.LoadMusic(MediaDataLink.Map001MediaData, true, "MAP");
  194. return;
  195. }
  196. case UI_Game_ManagerEvent.UILOADEDEVENT:
  197. {
  198. TextFieldHandle("UI元素加载完毕");
  199. ShowAndPlay();
  200. return;
  201. }
  202. case Map_Game_ManagerEvent.REMOVE_MAP://移除地图,在换地图之后执行
  203. {
  204. _soundManager.UnLoadSound(MediaDataLink.GetUrlByName(GloableData.CurrentMap + "MediaData"));
  205. _mapsContainer.removeChild((evt as Map_Game_ManagerEvent)._map as DisplayObject);
  206. return;
  207. }
  208. case Resource_Game_ManagerEvent.LOADINGPROCESSEVENT:
  209. {
  210. var temp:UI_Game_ManagerEvent = new UI_Game_ManagerEvent(UI_Game_ManagerEvent.LOADINGPROCESSEVENT);
  211. temp._isComplete = (event as Resource_Game_ManagerEvent)._isComplete;
  212. temp._process = (event as Resource_Game_ManagerEvent)._process;
  213. temp._type = (event as Resource_Game_ManagerEvent)._type;
  214. _uiManager.OnPostProgess(temp);
  215. return;
  216. }
  217. case Map_Game_ManagerEvent.CHANGE_MAP:
  218. {
  219. ChangeMap((evt as Map_Game_ManagerEvent).CHANGE_MAP_targetMap, (evt as Map_Game_ManagerEvent).CHANGE_MAP_spawnPoint);
  220. return;
  221. /*//发送未在地图上事件即设置服务器的对应Unit Update为false
  222. var disEvt:Net_Game_ManagerEvent = new Net_Game_ManagerEvent(Net_Game_ManagerEvent.DISUPDATE_GAME);
  223. _netManager.OnReceive(disEvt);
  224. _effectContainer.Shoot(_mapsContainer, _uiContainer);//as3有BUG一旦用容器去绘制图形就会导致对象保存丢失
  225. _effectContainer.UnShowAndTurnDark();
  226. RemoveAllDisplay(); //As有奇葩bug会删除所有东西
  227. AddAllDisplay();
  228. var cme:Map_Game_ManagerEvent = evt as Map_Game_ManagerEvent;
  229. trace(cme.CHANGE_MAP_sourceMap);
  230. trace(cme.CHANGE_MAP_targetMap);
  231. var target:String = cme.CHANGE_MAP_targetMap;
  232. _dataBridge.spawnPoint = cme.CHANGE_MAP_spawnPoint;//dataBridge是跨越地图沟通的数据
  233. _soundManager.SmoothCloseByName(cme.CHANGE_MAP_sourceMap + "MediaData");
  234. _soundManager.LoadMusic(MediaDataLink.GetUrlByName(target+"MediaData"), true, "MAP");
  235. _mapManager.UnLoadMap();
  236. _playerManager.ResetAvatar();
  237. _mapManager.LoadAndStart(MapDataLink.GetUrlByName(target), _mapsContainer, true, "MAP");
  238. //清除网络玩家
  239. var callCleanNetPlayer:Player_Game_ManagerEvent = new Player_Game_ManagerEvent(Player_Game_ManagerEvent.CALLCLEANNETPLAYER);
  240. _playerManager.OnReceive(callCleanNetPlayer);
  241. GloableData.CurrentMap = cme.CHANGE_MAP_targetMap;
  242. return;*/
  243. }
  244. case UI_Game_ManagerEvent.CALLMAPMANAGERCHANGEMAP:
  245. {
  246. GotoMap([(evt as UI_Game_ManagerEvent).CALLMAPMANAGERCHANGEMAP_targetMap, (evt as UI_Game_ManagerEvent).CALLMAPMANAGERCHANGEMAP_spawnPoint]);
  247. return;
  248. var mapEvt:MapData_Map_ManagerEvent = new MapData_Map_ManagerEvent(MapData_Map_ManagerEvent.CHANGE_MAP);
  249. mapEvt.CHANGE_MAP_spawnPoint = (evt as UI_Game_ManagerEvent).CALLMAPMANAGERCHANGEMAP_spawnPoint;
  250. mapEvt.CHANGE_MAP_targetMap = (evt as UI_Game_ManagerEvent).CALLMAPMANAGERCHANGEMAP_targetMap;
  251. mapEvt.CHANGE_MAP_sourceMap = (evt as UI_Game_ManagerEvent).CALLMAPMANAGERCHANGEMAP_sourceMap;
  252. _mapManager.OnReport(mapEvt);
  253. //GloableData.CurrentMap = mapEvt.CHANGE_MAP_targetMap;
  254. return;
  255. }
  256. case Map_Game_ManagerEvent.CALLLOADAPP:
  257. {
  258. _appManager.LoadStartApp(AppDataLink.GetUrlByName((evt as Map_Game_ManagerEvent).CALLLOADAPP_appName), _appContainer.GetContainer());
  259. return;
  260. }
  261. case UI_Game_ManagerEvent.CALLLOADAPP:
  262. {
  263. _appManager.LoadStartApp((evt as UI_Game_ManagerEvent).CALLLOADAPP_url, _appContainer.GetContainer(),(evt as UI_Game_ManagerEvent).CALLLOADAPP_useUI,(evt as UI_Game_ManagerEvent).CALLLOADAPP_uiType,(evt as UI_Game_ManagerEvent).CALLLOADAPP_params);
  264. return;
  265. }
  266. case UI_Game_ManagerEvent.CALLUNLOADAPP:
  267. {
  268. var Man:AppData_App_ManagerEvent = new AppData_App_ManagerEvent(AppData_App_ManagerEvent.CLOSE);
  269. Man.CLOSE_url = (evt as UI_Game_ManagerEvent).CALLUNLOADAPP_url;
  270. _appManager.OnReport(Man);
  271. return;
  272. }
  273. case UI_Game_ManagerEvent.SHOWFRIENDLIST:
  274. {
  275. var param:Array = new Array();
  276. param[0] = 1;
  277. _appManager.StartApp("FriendsApp", param);
  278. return;
  279. }
  280. case App_Game_ManagerEvent.CALLDOACTION://向PlayerManager发出做动作指令
  281. {
  282. var doAction:Player_Game_ManagerEvent = new Player_Game_ManagerEvent(Player_Game_ManagerEvent.CALLDOACTION_GAME);
  283. doAction.CALLDOACTION_GAME_actionName = (evt as App_Game_ManagerEvent).CALLDOACTION_actionName;
  284. _playerManager.OnReceive(doAction);
  285. //同时向服务器消息动作命令
  286. var netAcEvt:Net_Game_ManagerEvent = new Net_Game_ManagerEvent(Net_Game_ManagerEvent.NETDOACTION_GAME);
  287. netAcEvt.NETDOACTION_GAME_name = ActionSuggest.SuggestAction((evt as App_Game_ManagerEvent).CALLDOACTION_actionName);
  288. netAcEvt.NETDOACTION_GAME_dir = "dd";
  289. _netManager.OnReceive(netAcEvt);
  290. return;
  291. }
  292. case App_Game_ManagerEvent.SUBMITARTICLE:
  293. {
  294. var subArt:Net_Game_ManagerEvent = new Net_Game_ManagerEvent(Net_Game_ManagerEvent.SUBMITARTICLE_GAME);
  295. subArt.SUBMITARTICLE_GAME_head = (evt as App_Game_ManagerEvent).SUBMITARTICLE_head;
  296. subArt.SUBMITARTICLE_GAME_body = (evt as App_Game_ManagerEvent).SUBMITARTICLE_body;
  297. _netManager.OnReceive(subArt);
  298. return;
  299. }
  300. case App_Game_ManagerEvent.GOTOLOGIN:
  301. {
  302. _appManager.LoadStartApp(AppDataLink.GetUrlByName("LoginPanelApp"), _appContainer.GetContainer());
  303. return;
  304. }
  305. case App_Game_ManagerEvent.GOTOREGIST:
  306. {
  307. _appManager.LoadStartApp(AppDataLink.GetUrlByName("ApplyPanelApp"), _appContainer.GetContainer());
  308. return;
  309. }
  310. case App_Game_ManagerEvent.LOGIN://直接连接并尝试登录,远程挂起等待二次登录
  311. {
  312. _netManager.DisConnect();//之前预连接
  313. _netManager.Connect();
  314. GloableData.TempID = (evt as App_Game_ManagerEvent).LOGIN_id;
  315. GloableData.TempPWD = (evt as App_Game_ManagerEvent).LOGIN_pwd;
  316. var delate:Timer = new Timer(2000, 1);
  317. delate.addEventListener(TimerEvent.TIMER, DelateLogin);
  318. delate.start();
  319. return;
  320. }
  321. case App_Game_ManagerEvent.CREATACCOUNT:
  322. {
  323. _netManager.DisConnect();//之前预连接
  324. _netManager.Connect();
  325. GloableData.TempPWD = (evt as App_Game_ManagerEvent).CREATACCOUNT_pwd;
  326. var delate:Timer = new Timer(2000, 1);
  327. delate.addEventListener(TimerEvent.TIMER, DelateCreatAccount);
  328. delate.start();
  329. return;
  330. }
  331. case App_Game_ManagerEvent.CREATEMOLE:
  332. {
  333. var ncm:Net_Game_ManagerEvent = new Net_Game_ManagerEvent(Net_Game_ManagerEvent.CREATEMOLE_GAME);
  334. ncm.CREATEMOLE_GAME_color = (evt as App_Game_ManagerEvent).CREATEMOLE_color;
  335. ncm.CREATEMOLE_GAME_name = (evt as App_Game_ManagerEvent).CREATEMOLE_name;
  336. _netManager.OnReceive(ncm);
  337. return;
  338. }
  339. case App_Game_ManagerEvent.ONTHROWITEM:
  340. {
  341. var top:Player_Game_ManagerEvent = new Player_Game_ManagerEvent(Player_Game_ManagerEvent.ONTHROWITEM_GAME);
  342. top.ONTHROWITEM_GAME_owner = "this";
  343. top.ONTHROWITEM_GAME_actionDir = (evt as App_Game_ManagerEvent).ONTHROWITEM_actionDir;
  344. top.ONTHROWITEM_GAME_actionName = (evt as App_Game_ManagerEvent).ONTHROWITEM_actionName;
  345. top.ONTHROWITEM_GAME_aimStyle = (evt as App_Game_ManagerEvent).ONTHROWITEM_aimStyle;
  346. top.ONTHROWITEM_GAME_blood = (evt as App_Game_ManagerEvent).ONTHROWITEM_blood;
  347. top.ONTHROWITEM_GAME_itemStyle = (evt as App_Game_ManagerEvent).ONTHROWITEM_itemStyle;
  348. _playerManager.OnReceive(top);
  349. return;
  350. }
  351. case App_Game_ManagerEvent.NCHATLISTDATAS:
  352. {
  353. var targetArray:Array;
  354. var te:Array=_playerManager.GetNetPlayerData();
  355. if (te.length > 4)
  356. {
  357. targetArray = new Array();
  358. var select:int;
  359. for (var a:int = 0; a < 4; a++ )
  360. {
  361. select = Math.round((Math.random() * (te.length - 1)));
  362. targetArray.push(te[select]);
  363. te.splice(select, 1);
  364. }
  365. }
  366. else { targetArray = te; }
  367. var dataBack:App_Game_ManagerEvent = new App_Game_ManagerEvent(App_Game_ManagerEvent.NCHATLISTDATAS_GAME);
  368. dataBack.NCHATLISTDATAS_GAME_data = targetArray;
  369. _appManager.OnReceive(dataBack);
  370. return;
  371. }
  372. case App_Game_ManagerEvent.ONDRESSCHANGE:
  373. {//更新装扮
  374. var netChange:Net_Game_ManagerEvent = new Net_Game_ManagerEvent(Net_Game_ManagerEvent.CHANGEDRESS_GAME);
  375. netChange.CHANGEDRESS_GAME_HENHSC = GloableData.MoleDress_Hat + "|" + GloableData.MoleDress_Eyes + "|" + GloableData.MoleDress_Necklace+"|" + GloableData.MoleDress_Hand + "|" + GloableData.MoleDress_Shoes + "|" + GloableData.MoleDress_Cloth + "|";
  376. _netManager.OnReceive(netChange);
  377. //更新本地的
  378. _playerManager.RefreshPlayerDress();
  379. var toPlayer:Player_Game_ManagerEvent = new Player_Game_ManagerEvent(Player_Game_ManagerEvent.CALLDOACTION_GAME);
  380. toPlayer.CALLDOACTION_GAME_actionName = "cce";
  381. _playerManager.OnReceive(toPlayer);
  382. return;
  383. }
  384. case Player_Game_ManagerEvent.LOADSTARTAPP:
  385. {
  386. _appManager.LoadStartApp(AppDataLink.GetUrlByName((evt as Player_Game_ManagerEvent).LOADSTARTAPP_name),
  387. _appContainer.GetContainer(), (evt as Player_Game_ManagerEvent).LOADSTARTAPP_useUI,
  388. (evt as Player_Game_ManagerEvent).LOADSTARTAPP_uiType, (evt as Player_Game_ManagerEvent).LOADSTARTAPP_params);
  389. return;
  390. }
  391. case Player_Game_ManagerEvent.LOCALPLAYERDOACTION://同上的网络部分
  392. {
  393. //向服务器消息动作命令
  394. var netAcEvt:Net_Game_ManagerEvent = new Net_Game_ManagerEvent(Net_Game_ManagerEvent.NETDOACTION_GAME);
  395. netAcEvt.NETDOACTION_GAME_name = (evt as Player_Game_ManagerEvent).LOCALPLAYERDOACTION_name;
  396. netAcEvt.NETDOACTION_GAME_dir = (evt as Player_Game_ManagerEvent).LOCALPLAYERDOACTION_dir;
  397. _netManager.OnReceive(netAcEvt);
  398. return;
  399. }
  400. case Player_Game_ManagerEvent.CALLADDNETPLAYERTOMAP:
  401. {
  402. _mapManager.AddNetPlayerToMap((evt as Player_Game_ManagerEvent).CALLADDNETPLAYERTOMAP_iavatar,(evt as Player_Game_ManagerEvent).CALLADDNETPLAYERTOMAP_controller);
  403. return;
  404. }
  405. case Player_Game_ManagerEvent.LOCALPLAYERMOVE:
  406. {
  407. var ng:Net_Game_ManagerEvent = new Net_Game_ManagerEvent(Net_Game_ManagerEvent.LOCALPLAYERMOVE_GAME);
  408. ng.LOCALPLAYERMOVE_GAME_target = (evt as Player_Game_ManagerEvent).LOCALPLAYERMOVE_target;
  409. _netManager.OnReceive(ng);
  410. return;
  411. }
  412. case Player_Game_ManagerEvent.CALLMAPREMOVENETPLAYER:
  413. {
  414. _mapManager.RemoveNetAvatarFromMap((evt as Player_Game_ManagerEvent).CALLMAPREMOVENETPLAYER_avatar);
  415. return;
  416. }
  417. case Player_Game_ManagerEvent.INTERACTMOUSECLICK:
  418. {
  419. _interactManager.MouseClickMode((evt as Player_Game_ManagerEvent).INTERACTMOUSECLICK_style, (evt as Player_Game_ManagerEvent).INTERACTMOUSECLICK_callBack);
  420. return;
  421. }
  422. case Player_Game_ManagerEvent.ADDITEMTOMAPFRONT:
  423. {
  424. _mapManager.AddItemToMapFront((evt as Player_Game_ManagerEvent).ADDITEMTOMAPFRONT_sprite);
  425. return;
  426. }
  427. case Player_Game_ManagerEvent.CALLNETTHROWITEM:
  428. {
  429. var netThrow:Net_Game_ManagerEvent = new Net_Game_ManagerEvent(Net_Game_ManagerEvent.CALLNETTHROWITEM_GAME);
  430. netThrow.CALLNETTHROWITEM_GAME_action = (evt as Player_Game_ManagerEvent).CALLNETTHROWITEM_action;
  431. netThrow.CALLNETTHROWITEM_GAME_blood = (evt as Player_Game_ManagerEvent).CALLNETTHROWITEM_blood;
  432. netThrow.CALLNETTHROWITEM_GAME_dir = (evt as Player_Game_ManagerEvent).CALLNETTHROWITEM_dir;
  433. netThrow.CALLNETTHROWITEM_GAME_itemStyle = (evt as Player_Game_ManagerEvent).CALLNETTHROWITEM_itemStyle;
  434. netThrow.CALLNETTHROWITEM_GAME_position = (evt as Player_Game_ManagerEvent).CALLNETTHROWITEM_position;
  435. _netManager.OnReceive(netThrow);
  436. return;
  437. }
  438. case Player_Game_ManagerEvent.LOCALMAPCLICKED:
  439. {
  440. _interactManager.OnMapClick((evt as Player_Game_ManagerEvent).LOCALMAPCLICKED_position);
  441. return;
  442. }
  443. case Net_Game_ManagerEvent.DOACTION:
  444. {
  445. var tempToPlayer:Player_Game_ManagerEvent = new Player_Game_ManagerEvent(Player_Game_ManagerEvent.NETAVATARACTION_GAME);
  446. tempToPlayer.NETAVATARACTION_GAME_ID = (evt as Net_Game_ManagerEvent)._playerID;
  447. tempToPlayer.NETAVATARACTION_GAME_name = (evt as Net_Game_ManagerEvent).DOACTION_name;
  448. tempToPlayer.NETAVATARACTION_GAME_direction = (evt as Net_Game_ManagerEvent).DOACTION_direction;
  449. _playerManager.OnReceive(tempToPlayer);
  450. return;
  451. }
  452. case Net_Game_ManagerEvent.ADDNETPLAYER:
  453. {
  454. var toPlayer:Player_Game_ManagerEvent = new Player_Game_ManagerEvent(Player_Game_ManagerEvent.ADDNETPLAYER_GAME);
  455. toPlayer.ADDNETPLAYER_GAME_color = (evt as Net_Game_ManagerEvent).ADDNETPLAYER_color;
  456. toPlayer.ADDNETPLAYER_GAME_name = (evt as Net_Game_ManagerEvent).ADDNETPLAYER_name;
  457. toPlayer.ADDNETPLAYER_GAME_ID = (evt as Net_Game_ManagerEvent)._playerID;
  458. toPlayer.ADDNETPLAYER_GAME_spownPoint = (evt as Net_Game_ManagerEvent).ADDNETPLAYER_spownPoint;
  459. toPlayer.ADDNETPLAYER_GAME_map = (evt as Net_Game_ManagerEvent).ADDNETPLAYER_map;
  460. toPlayer.ADDNETPLAYER_GAME_dress = (evt as Net_Game_ManagerEvent).ADDNETPLAYER_dress;
  461. _playerManager.OnReceive(toPlayer);
  462. return;
  463. }
  464. case Net_Game_ManagerEvent.REMOVENETPLAYER:
  465. {
  466. var toPlayer:Player_Game_ManagerEvent = new Player_Game_ManagerEvent(Player_Game_ManagerEvent.REMOVENETPLAYER_GAME);
  467. toPlayer.REMOVENETPLAYER_GAME_ID = (evt as Net_Game_ManagerEvent)._playerID;
  468. _playerManager.OnReceive(toPlayer);
  469. return;
  470. }
  471. case Net_Game_ManagerEvent.LOGINRESULT:
  472. {
  473. TextFieldHandle("登录信息:");
  474. if ((evt as Net_Game_ManagerEvent).LOGINRESULT_result == "2")
  475. {
  476. TextFieldHandle("登录成功!");
  477. GloableData.HasLogin = true;
  478. //加载数据
  479. //UI进度条加载
  480. //返回结果数据
  481. var tempArray:Array = new Array();
  482. tempArray.push(false);
  483. var appBack:App_Game_ManagerEvent = new App_Game_ManagerEvent(App_Game_ManagerEvent.ARGTOAPP_GAME);
  484. appBack.ARGTOAPP_GAME_name = "LoginPanelApp";
  485. appBack.ARGTOAPP_GAME_args = tempArray;
  486. _appManager.OnReceive(appBack);
  487. //关闭登录应用
  488. var closeAppEvt:App_Game_ManagerEvent = new App_Game_ManagerEvent(App_Game_ManagerEvent.CLOSEAPP_GAME);
  489. closeAppEvt.CLOSEAPP_GAME_name = "LoginPanelApp";
  490. _appManager.OnReceive(closeAppEvt);
  491. //请求摩尔登录基础数据
  492. var moleLogin:Net_Game_ManagerEvent = new Net_Game_ManagerEvent(Net_Game_ManagerEvent.APPLYMOLELOGININFO);
  493. _netManager.OnReceive(moleLogin);
  494. }
  495. else
  496. {
  497. var tempArray:Array = new Array();
  498. tempArray.push(false);
  499. var appBack:App_Game_ManagerEvent = new App_Game_ManagerEvent(App_Game_ManagerEvent.ARGTOAPP_GAME);
  500. appBack.ARGTOAPP_GAME_name = "LoginPanelApp";
  501. appBack.ARGTOAPP_GAME_args = tempArray;
  502. _appManager.OnReceive(appBack);
  503. var str:String = "";
  504. switch((evt as Net_Game_ManagerEvent).LOGINRESULT_result)
  505. {
  506. case "0":
  507. str = "登陆请求错误,我也不知道这是什么造成的!。";
  508. break;
  509. case "1":
  510. str = "你的账号已经登陆了,有可能是服务器坏了。";
  511. break;
  512. case "3":
  513. str = "你的游戏版本和目前服务器支持的版本不符,清空浏览器缓存试试!";
  514. break;
  515. case "4":
  516. str = "账号或密码错误,重新输入试试!";
  517. break;
  518. }
  519. ApplicationManager.GetIDialog().ShowDialog("emoy", "sad", str, null);
  520. TextFieldHandle(str);
  521. }
  522. return;
  523. }
  524. case Net_Game_ManagerEvent.NETPLAYERMOVE://网络玩家移动
  525. {
  526. var plevm:Player_Game_ManagerEvent = new Player_Game_ManagerEvent(Player_Game_ManagerEvent.NETPLAYERMOVE_GAME);
  527. plevm.NETPLAYERMOVE_GAME_ID = (evt as Net_Game_ManagerEvent)._playerID;
  528. plevm.NETPLAYERMOVE_GAME_target = (evt as Net_Game_ManagerEvent).NETPLAYERMOVE_point;
  529. _playerManager.OnReceive(plevm);
  530. return;
  531. }
  532. case Net_Game_ManagerEvent.NETCHATMSG://网络玩家说
  533. {
  534. var pla:Player_Game_ManagerEvent = new Player_Game_ManagerEvent(Player_Game_ManagerEvent.SHOWMSG_GAME);
  535. pla.SHOWMSG_GAME_id = (evt as Net_Game_ManagerEvent)._playerID;
  536. pla.SHOWMSG_GAME_msg = (evt as Net_Game_ManagerEvent).NETCHATMSG_msg;
  537. _playerManager.OnReceive(pla);
  538. return;
  539. }
  540. case Net_Game_ManagerEvent.CHANGEWEATHER://改变天气
  541. {
  542. _mapManager.ChangeWeather((evt as Net_Game_ManagerEvent).CHANGEWEATHER_weather, (evt as Net_Game_ManagerEvent).CHANGEWEATHER_strength);
  543. GloableData.CurrentWeather = (evt as Net_Game_ManagerEvent).CHANGEWEATHER_weather;
  544. GloableData.CurrentWeatherStrength = (evt as Net_Game_ManagerEvent).CHANGEWEATHER_strength;
  545. OnWeatherChange();
  546. return;
  547. }
  548. case Net_Game_ManagerEvent.CREATACCOUNTRESULT:
  549. {
  550. var backEvt:App_Game_ManagerEvent = new App_Game_ManagerEvent(App_Game_ManagerEvent.CREATACCOUNTRESULT_GAME);
  551. backEvt.CREATACCOUNTRESULT_GAME_id = (evt as Net_Game_ManagerEvent).CREATACCOUNTRESULT_id;
  552. backEvt.CREATACCOUNTRESULT_GAME_result = (evt as Net_Game_ManagerEvent).CREATACCOUNTRESULT_result;
  553. _appManager.OnReceive(backEvt);
  554. return;
  555. }
  556. case Net_Game_ManagerEvent.MOLEBASEINFO:
  557. {
  558. if ((evt as Net_Game_ManagerEvent).MOLEBASEINFO_num == 0)//需要注册
  559. {
  560. _appManager.StartApp("CreateMoleApp");
  561. return;
  562. }
  563. //此时为正常登录
  564. GloableData.MoleColor = (evt as Net_Game_ManagerEvent).MOLEBASEINFO_color;
  565. GloableData.MoleName = (evt as Net_Game_ManagerEvent).MOLEBASEINFO_name;
  566. var dressStr:Array = (evt as Net_Game_ManagerEvent).MOLEBASEINFO_dress.split("|");
  567. GloableData.MoleDress_Hat = dressStr[0];
  568. GloableData.MoleDress_Eyes = dressStr[1];
  569. GloableData.MoleDress_Necklace = dressStr[2];
  570. GloableData.MoleDress_Hand = dressStr[3];
  571. GloableData.MoleDress_Shoes = dressStr[4];
  572. GloableData.MoleDress_Cloth = dressStr[5];
  573. _uiManager.LoadUI("UI/LoadingBar.swf", _uiHighContainer);//先加载进度条,然后加载其余ui和玩家,再加载地图,最后加载音频
  574. return;
  575. }
  576. case Net_Game_ManagerEvent.NETTHROWITEM:
  577. {
  578. var top:Player_Game_ManagerEvent = new Player_Game_ManagerEvent(Player_Game_ManagerEvent.ONTHROWITEM_GAME);
  579. top.ONTHROWITEM_GAME_actionDir = (evt as Net_Game_ManagerEvent).NETTHROWITEM_dir;
  580. top.ONTHROWITEM_GAME_actionName = (evt as Net_Game_ManagerEvent).NETTHROWITEM_action;
  581. top.ONTHROWITEM_GAME_blood = (evt as Net_Game_ManagerEvent).NETTHROWITEM_blood;
  582. top.ONTHROWITEM_GAME_itemStyle = (evt as Net_Game_ManagerEvent).NETTHROWITEM_itemStyle;
  583. top.ONTHROWITEM_GAME_owner = (evt as Net_Game_ManagerEvent).NETTHROWITEM_id;
  584. top.ONTHROWITEM_GAME_position = (evt as Net_Game_ManagerEvent).NETTHROWITEM_position;
  585. _playerManager.OnReceive(top);
  586. return;
  587. }
  588. case Net_Game_ManagerEvent.CREATEMOLEBACK:
  589. {
  590. if ((evt as Net_Game_ManagerEvent).CREATEMOLEBACK_result)
  591. {
  592. //关闭创建摩尔页面
  593. var close:App_Game_ManagerEvent = new App_Game_ManagerEvent(App_Game_ManagerEvent.CLOSEAPP_GAME);
  594. close.CLOSEAPP_GAME_name = "CreateMoleApp";
  595. _appManager.OnReceive(close);
  596. //请求MoleBaseInfo
  597. var moleLogin:Net_Game_ManagerEvent = new Net_Game_ManagerEvent(Net_Game_ManagerEvent.APPLYMOLELOGININFO);
  598. _netManager.OnReceive(moleLogin);
  599. return;
  600. }
  601. //否则失败的话
  602. /*var back:App_Game_ManagerEvent = new App_Game_ManagerEvent(App_Game_ManagerEvent.ARGTOAPP_GAME);
  603. var temps:Array = new Array();
  604. temps.push(false);
  605. back.ARGTOAPP_GAME_name = "CreateMoleApp";
  606. back.ARGTOAPP_GAME_args = temps;
  607. _appManager.OnReceive(back);*/
  608. _appManager.ShowDialog("emoy", "sad", "创建摩尔失败,请稍后再试", null);
  609. return;
  610. }
  611. case Net_Game_ManagerEvent.NCHANGEDRESS:
  612. {
  613. var nc:Player_Game_ManagerEvent = new Player_Game_ManagerEvent(Player_Game_ManagerEvent.NCHANGEDRESS_GAME);
  614. nc.NCHANGEDRESS_GAME_HENHSC = (evt as Net_Game_ManagerEvent).NCHANGEDRESS_HENHSC;
  615. nc.NCHANGEDRESS_GAME_id = (evt as Net_Game_ManagerEvent).NCHANGEDRESS_id;
  616. _playerManager.OnReceive(nc);
  617. return;
  618. }
  619. case UI_Game_ManagerEvent.PASSDIALOGSTYLE:
  620. {
  621. var pgm:Player_Game_ManagerEvent = new Player_Game_ManagerEvent(Player_Game_ManagerEvent.PASSDIALOGSTYLE_GAME);
  622. pgm.PASSDIALOGSTYLE_GAME_body = (evt as UI_Game_ManagerEvent).PASSDIALOGSTYLE_body;
  623. _playerManager.OnReceive(pgm);
  624. return;
  625. }
  626. case UI_Game_ManagerEvent.SHOWMSG:
  627. {
  628. var pl:Player_Game_ManagerEvent = new Player_Game_ManagerEvent(Player_Game_ManagerEvent.SHOWMSG_GAME);
  629. pl.SHOWMSG_GAME_id = "local";
  630. pl.SHOWMSG_GAME_msg = (evt as UI_Game_ManagerEvent).SHOWMSG_msg;
  631. _playerManager.OnReceive(pl);
  632. //同时向网络播报
  633. var mss:Net_Game_ManagerEvent = new Net_Game_ManagerEvent(Net_Game_ManagerEvent.NETCHATMSG_GAME);
  634. mss.NETCHATMSG_GAME_msg = (evt as UI_Game_ManagerEvent).SHOWMSG_msg;
  635. _netManager.OnReceive(mss);
  636. return;
  637. }
  638. }
  639. }
  640. if (evt is DebugEvent)
  641. {
  642. TextFieldHandle((evt as DebugEvent).Log);
  643. }
  644. }
  645. private function OnConnect(evt:TimerEvent)
  646. {
  647. _netManager.Connect();
  648. (evt.target as Timer).removeEventListener(TimerEvent.TIMER, OnConnect);
  649. }
  650. private function DelateCreatAccount(evt:TimerEvent)
  651. {
  652. CreatAccount(GloableData.TempPWD);
  653. (evt.target as Timer).removeEventListener(TimerEvent.TIMER, DelateCreatAccount);
  654. }
  655. private function CreatAccount(pwd:String)
  656. {
  657. var evttt:Net_Game_ManagerEvent = new Net_Game_ManagerEvent(Net_Game_ManagerEvent.CREATACCOUNT_GAME);
  658. evttt.CREATACCOUNT_GAME_pwd = pwd;
  659. _netManager.OnReceive(evttt);
  660. }
  661. private function OnLogin(evt:TimerEvent)
  662. {
  663. Login( ((uint)(Math.random() * 100000000)).toString(), ((uint)(Math.random() * 100000000)).toString());
  664. (evt.target as Timer).removeEventListener(TimerEvent.TIMER, OnLogin);
  665. }
  666. private function DelateLogin(evt:TimerEvent)
  667. {
  668. Login(GloableData.TempID, GloableData.TempPWD);
  669. (evt.target as Timer).removeEventListener(TimerEvent.TIMER, DelateLogin);
  670. }
  671. private function Login(id:String,pwd:String)
  672. {
  673. //测试代码
  674. if (GloableData.HasLogin) { TextFieldHandle("重复登录!"); return; }
  675. var evtTEmp:Net_Game_ManagerEvent = new Net_Game_ManagerEvent(Net_Game_ManagerEvent.LOGININ);
  676. evtTEmp.LOGININ_GAME_playerKey = id;
  677. evtTEmp.LOGININ_GAME_playerSecret = pwd;
  678. _netManager.OnReceive(evtTEmp);
  679. TextFieldHandle("发送连接请求");
  680. }
  681. private function OnDelayStart()//在开始时基础组件加载完成调用
  682. {
  683. _appManager.LoadStartApp(AppDataLink.GetUrlByName("FriendsApp"), _appContainer.GetContainer());//加载聊天玩家信息应用组件
  684. _appManager.LoadStartApp(AppDataLink.GetUrlByName("LittleNoteApp"), _appContainer.GetContainer());//加载小纸条基础应用组件
  685. //临时代码
  686. _acitvityManager.LoadStartActivity("Activity/AConfig053.xml");
  687. //临时代码
  688. }
  689. private function ChangeMap(target:String,spawnPoing:Point)
  690. {
  691. //发送未在地图上事件即设置服务器的对应Unit Update为false
  692. var disEvt:Net_Game_ManagerEvent = new Net_Game_ManagerEvent(Net_Game_ManagerEvent.DISUPDATE_GAME);
  693. _netManager.OnReceive(disEvt);
  694. _effectContainer.Shoot(_mapsContainer, _uiContainer);//as3有BUG一旦用容器去绘制图形就会导致对象保存丢失
  695. _effectContainer.UnShowAndTurnDark();
  696. RemoveAllDisplay(); //As有奇葩bug会删除所有东西
  697. AddAllDisplay();
  698. _dataBridge.spawnPoint = spawnPoing;//dataBridge是跨越地图沟通的数据
  699. _soundManager.SmoothCloseByName(GloableData.CurrentMap + "MediaData");
  700. _soundManager.LoadMusic(MediaDataLink.GetUrlByName(target+"MediaData"), true, "MAP");
  701. _mapManager.UnLoadMap();
  702. _playerManager.ResetAvatar();
  703. _mapManager.LoadAndStart(MapDataLink.GetUrlByName(target), _mapsContainer, true, "MAP");
  704. //清除网络玩家
  705. var callCleanNetPlayer:Player_Game_ManagerEvent = new Player_Game_ManagerEvent(Player_Game_ManagerEvent.CALLCLEANNETPLAYER);
  706. _playerManager.OnReceive(callCleanNetPlayer);
  707. GloableData.CurrentMap = target;
  708. }
  709. public static function GetICommand():ICommand
  710. {
  711. return _iCommand;
  712. }
  713. public function GetAppContainer():Sprite
  714. {
  715. return _appContainer.GetContainer();
  716. }
  717. public function RemoveAllDisplay()
  718. {
  719. for (var a:int = 0; a < this.numChildren; a++ )
  720. {
  721. this.removeChildAt(a);
  722. }
  723. }
  724. public function AddAllDisplay()
  725. {
  726. this.addChild(_mapsContainer);
  727. this.addChild(_uiContainer);
  728. //appContainerUsed to here
  729. this.addChild(_effectContainer);
  730. this.addChild(_uiHighContainer);
  731. this.addChild(_movieContainer);
  732. this.addChild(_appContainer);
  733. this.addChild(_interactContainer);
  734. this.addChild(_debugContainer);
  735. }
  736. public function ShowAndPlay()//called when change map
  737. {
  738. if (_resourceManager.IsLoading) { return; }
  739. //游戏的基础实现部分
  740. _effectContainer.ShowAndTurnBright();
  741. //这里只先播放音乐,背景音在天气数据加载后播放
  742. _soundManager.SmoothOnMusic();
  743. _uiManager.StartUIByUrl("UI/ToolBar.swf");
  744. _playerManager.ResetPlayer();
  745. _mapManager.AddPlayerToMap(_playerManager.playerAvatar, _dataBridge.spawnPoint, false, _playerManager.playerController);
  746. //发送基础数据
  747. var evtos:Net_Game_ManagerEvent = new Net_Game_ManagerEvent(Net_Game_ManagerEvent.NETUPDATE_GAME);
  748. evtos.NETUPDATE_GAME_map =GloableData.CurrentMap;
  749. evtos.NETUPDATE_GAME_position = _dataBridge.spawnPoint;
  750. _netManager.OnReceive(evtos);
  751. //请求地图天气
  752. var callWeather:Net_Game_ManagerEvent = new Net_Game_ManagerEvent(Net_Game_ManagerEvent.WEATHER_GAME);
  753. _netManager.OnReceive(callWeather);
  754. //请求所有区域玩家数据
  755. var evtapply:Net_Game_ManagerEvent = new Net_Game_ManagerEvent(Net_Game_ManagerEvent.NETPLAYERLISTAPPLY_GAME);
  756. evtapply.NETPLAYERLISTAPPLY_GAME_map = GloableData.CurrentMap;
  757. _netManager.OnReceive(evtapply);
  758. //执行大型组件初始化
  759. if (_beginFlag) { OnDelayStart(); }
  760. _beginFlag = false;
  761. //执行回调函数
  762. if (_changeMapCallBack != null) { _changeMapCallBack(); _changeMapCallBack = null; }
  763. dispatchEvent(new APIEvent(APIEvent.OnMapChange));
  764. }
  765. private function OnWeatherChange()//当天气改变
  766. {
  767. _soundManager.SmoothOnSound();
  768. }
  769. private function TextFieldHandle(str:String)
  770. {
  771. if (!GloableData.MasterMode) { return; }
  772. var txF:TextField = (_debugContainer.getChildAt(0) as TextField);
  773. txF.text = _textField.text + "\n" + str;
  774. }
  775. public static function get NetManagerFuncer():INetManager
  776. {
  777. return _netManager;
  778. }
  779. public static function get ApplicationManagerFuncer():IApplicationManager
  780. {
  781. return _appManager;
  782. }
  783. //api
  784. public function ShowMsg(args:Array)//(msg:String)
  785. {
  786. var ui_game:UI_Game_ManagerEvent = new UI_Game_ManagerEvent(UI_Game_ManagerEvent.SHOWMSG);
  787. ui_game.SHOWMSG_msg = args[0];
  788. OnReport(ui_game);
  789. }
  790. public function GotoMap(args:Array)//(map:String,spawnPoint:Point,callBack_changed:Function=null)
  791. {
  792. ChangeMap(args[0], args[1]);
  793. _changeMapCallBack = args[2];
  794. }
  795. public function AddActorToMap(args:Array)//(actor:RuntimeActor, place:Point, callBack_onClick:Function = null )
  796. {
  797. args[0].x += args[1].x;
  798. args[0].y += args[1].y;
  799. args[0].onClick = args[2];
  800. _mapManager.AddActorToMap(args[0]);
  801. }
  802. public function AddActorUrlToMap(args:Array)//(packUrl:String,item:String, place:Point, callBack_onClick:Function = null)
  803. {
  804. var loader:Loader = new Loader();
  805. loader.contentLoaderInfo.addEventListener(Event.COMPLETE, function(evt:Event)
  806. {
  807. var target:Class = loader.contentLoaderInfo.applicationDomain.getDefinition(args[1]) as Class;
  808. var tar:RuntimeActor = new target();
  809. tar.x += args[2].x;
  810. tar.y += args[2].y;
  811. tar.onClick = args[3];
  812. _mapManager.AddActorToMap(tar);
  813. });
  814. var request:URLRequest = new URLRequest(args[0]);
  815. loader.load(request);
  816. }
  817. public function CloseCurrentMapSound(args:Array=null)//(callBack:Function = null)
  818. {
  819. _soundManager.SmoothCloseByName(GloableData.CurrentMap + "MediaData");
  820. if (args != null&&args[0]!=null) { args[0](); }
  821. }
  822. public function PlayMp3(args:Array)//(url:String,times:int,callBack:Function = null)
  823. {
  824. _soundManager.LoadPlayMp3(args[0], args[1]);
  825. if (args[2] != null) { args[2](); }
  826. }
  827. public function PlayApp(args:Array)//(url:String, param:Array=null,callBack:Function = null)
  828. {
  829. _appManager.LoadStartApp(args[0], _appContainer.GetContainer(), true, "ITEM", args[1]);
  830. if (args[2] != null) { args[2](); }
  831. }
  832. public function PlayMovie(args:Array)//(url:String,callBack:Function = null)//param 第一个,如果param有,则为OnFinish回调!
  833. {
  834. _acitvityManager.LoadPlayMovie(args[0],false,"NULL",args[1]);
  835. }
  836. public function PlayActivity(args:Array)//(url:String)
  837. {
  838. _acitvityManager.LoadStartActivity(args[0]);
  839. }
  840. public function CloseMp3(args:Array=null)//(callBack:Function = null)
  841. {
  842. _soundManager.CloseMp3();
  843. if (args != null&&args[0]!=null ) { args[0](); }
  844. }
  845. public function MoveTo(args:Array)
  846. {
  847. _playerManager.MoveTo(args[0]);
  848. }
  849. public function DoAction(args:Array)
  850. {
  851. _playerManager.playerController.DoAction(args[0], args[1], args[2]);
  852. var netAcEvt:Net_Game_ManagerEvent = new Net_Game_ManagerEvent(Net_Game_ManagerEvent.NETDOACTION_GAME);
  853. netAcEvt.NETDOACTION_GAME_name = ActionSuggest.SuggestAction(args[0]);
  854. netAcEvt.NETDOACTION_GAME_dir = args[1];
  855. _netManager.OnReceive(netAcEvt);
  856. }
  857. public function InitMisDialog(args:Array)//icoUrl:Array,place:Array, name:String, msg:Array, options:Array, callBacks:Array
  858. {
  859. _acitvityManager.InitMisDialog(args[0], args[1], args[2], args[3], args[4], args[5],args[6]);
  860. }
  861. public function ShowMisDialog(args:Array = null)//显示dialog
  862. {
  863. _acitvityManager.ShowMisDialog();
  864. }
  865. public function HideMisDialog(args:Array = null)//隐藏dialog
  866. {
  867. _acitvityManager.HideMisDialog();
  868. }
  869. public function DisposeMisDialog(args:Array = null)//销毁dialog
  870. {
  871. _acitvityManager.DisposeMisDialog();
  872. }
  873. public function TurnDark(args:Array = null)//画面变暗
  874. {
  875. _effectContainer.TurnDark();
  876. }
  877. public function TurnBright(args:Array = null)//画面变亮
  878. {
  879. _effectContainer.TurnBright();
  880. }
  881. public function ShowToolBar(args:Array = null)
  882. {
  883. _uiManager.ShowToolBar();
  884. }
  885. public function HideToolBar(args:Array = null)
  886. {
  887. _uiManager.HideToolBar();
  888. }
  889. public function ShowDialog(args:Array)// type:emoy mis url:/emo: txt: callBack:
  890. {
  891. _appManager.ShowDialog(args);
  892. }
  893. public function UpdateMapPosition(args:Array = null)
  894. {
  895. _mapManager.UpdateMapPosition();
  896. }
  897. public function AttachTo(args:Array) // sp:sprite id:string
  898. {
  899. _playerManager.AttachTo(args[0], args[1]);
  900. }
  901. public function GetNetPort(args:Array):String //callbackFunction
  902. {
  903. return _netManager.GetPrivateNetPort(args[0]);
  904. }
  905. public function NetSend(args:Array) //(evtName:String, length:String, pv:String, id:String)
  906. {
  907. _netManager.PrivateSendStr(args[0], args[1], args[2], args[3]);
  908. }
  909. public function ReleaseNetPort(args:Array) //id:String
  910. {
  911. _netManager.Release(args[0]);
  912. }
  913. }
  914. }