Flash MX 编程深层次应用-网络连线游戏(2)
作者 佚名技术
来源 服务器技术
浏览
发布时间 2012-07-10
oot.nickname ) { ????????????????????? // 表示就坐在当前台 ????????????????????? _root.chatSocket.send(chatXML); ????????? //先清空对家 ????????????????????? _root.rival = ""; ????????????????????? if (trim(player_left) != "" && player_left != null && trim(player_right) != "" && player_right != null) { ????????????? //如果对家也坐了人就开始下棋了,然后初始化变量 ????????????? //对手名 ??????????????????????????????? _root.rival = player_right; ????????????? //谁先下,左边的红棋先下 ??????????????????????????????? _root.i_run = true; ????????????? //谁拿什么棋,我现在在左边是拿红棋,对手拿右边的蓝棋 ??????????????????????????????? _root.my_LOGO = _root.First_play; ??????????????????????????????? _root.your_logo = _root.Second_play; ????????????? //表示玩家正坐在哪张台 ??????????????????????????????? _root.now_play_table = place; ?????????? ???//开始与对家下棋 ??????????????????????????????? _root.begin_play(_root.nickname,_root.rival); ??????????????????????????????? _root.gotoAndPlay("begin_play"); ????????????????????? } ???????????? } else { ????????????????????? // 表示自己已经坐在其他台,提示玩家要在其他台先起立 ????????????????????? disp_left.gotoAndPlay("display"); ???????????? } ??? } } 右侧按钮 右边按钮的程序与左边理论上是一样的,只是把left换成了right,然后把布尔变量对换。为了大家看得更加清楚,特列出程序如下: on (release){ ??? if (player_right == _root.nickname || trim(player_right) == "" || player_right == null) { ???????????? var chatXML; ???????????? var m_Message; ???????????? var place = Number(this._name.substring(6)); ???????????? place += _parent.table_begin-1; ???????????? sit_table = "Table_"+place; ???????????? chatXML = new XML(); ???????????? m_Message = chatXML.createElement("CMD"); ???????????? m_Message.attributes.VALUE = "SIT"; ???????????? if (player_right == _root.nickname) { ????????????????????? _root.player_right[place] = player_right=""; ????????????????????? _root.myself.PlayStatus = "StandUp"; ????????????????????? m_Message.attributes.PARAM = place+" stand_up "+_root.nickname; ???????????? } else if ((trim(player_right) == "" || player_right == null) && _root.myself.PlayStatus != "SitDown") { ????????????????????? _root.player_right[place] = player_right=_root.nickname; ????????????????????? _root.myself.PlayStatus = "SitDown"; ????????????????????? _root.now_sit_table = place; ????????????????????? m_Message.attributes.PARAM = place+" right "+player_right; ???????????? } ???????????? chatXML.appendChild(m_Message); ???????????? trace (chatXML.toString()); ???????????? // send it!!! ???????????? if (_root.now_sit_table == place && player_left != _root.nickname) { ????????????????????? _root.chatSocket.send(chatXML); ????????????????????? _root.rival = ""; ????????????????????? if (trim(player_left) != "" && player_left != null && trim(player_right) != "" && player_right != null) { ????????????? //如果对家也坐了人就开始下棋,然后初始化变量 ????????????? //对手名 ??????????????????????????????? _root.rival = playe |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
关于Flash MX 编程深层次应用-网络连线游戏(2)的所有评论