标签:
using System.Net.Sockets; using System.Net; using System.Threading; using System.IO; using System.Xml; using System; using System.Text; using System.Collections; using System.Collections.Generic; using System.Reflection; using System.Diagnostics; using com.miracle9.game.entity; using com.miracle9.game.bean; using Constant; using MessageControlSpace; using UnityEngine; using System.Collections; using GameConfig; namespace MySocket { public class Transmit//建立一个公共类 { public Transmit()//定义构造函数 { } private CreateSocket m_CreateSocket; //定义Socket连接 public void TransmitGetPoint(CreateSocket MyCreateSocket) { m_CreateSocket = MyCreateSocket; } public void PostMsgControl(Hashtable table) { String method = table["method"].ToString(); object[] args = table["args"] as object[]; Console.WriteLine(); // NGUIDebug.Log("method=" + method); // UnityEngine.Debug.Log("method============================" + method); //根据报文ID来进行转发 if (method == "sendServerTime") { //服务器和客户端的连接已经建立好,界面可以发送数据了 if (gameInfo.getInstance().Key != "") { //注意: 需要分状态 与服务器保持一致 ////////////NGUIDEbug.Log("UserId=" + gameInfo.getInstance().UserId); NetMngr.GetSingleton().MyCreateSocket.SendCheckLogin(gameInfo.getInstance().UserId, gameInfo.getInstance().Pwd, (int)gameInfo.getInstance().currentState < 1 ? 1 : (int)gameInfo.getInstance().currentState); } gameInfo.getInstance().Key = "sendServerTime"; } else if (method == "checkLogin")//3.2服务器反馈给客户端报文信息 { DoCheckLogin(args); } else if (method == "roomInfo")//4.1.2 服务器发送某一个游戏房间内的详细信息给客户端 { DoRoomInfo(args); } else if (method == "updateRoomInfo")//5.3.1游戏服务器向客户端发送更新某一个房间内的信息 { DoUpdateRoomInfo(args); } else if (method == "requestSeat")//6.1.2服务器通知客户端玩家进入桌的信息信息 { DoRequestSeat(args); } else if (method == "updateDeskInfo")//6.3.1服务器通知客户端更新某一张游戏桌子内部的详细信息 { DoUpdateDeskInfo(args); } else if (method == "gameScore")//7.1.3服务器发送给客户端当前的游戏分值 { DoGameScore(args); } else if (method == "notFired")//7.2.2服务器判断分不够发炮则通知发炮玩家不能发炮操作 { DoNotFired(args); } else if (method == "fired")//7.2.3服务器判断分够发炮则通知其他同桌客户端玩家进行发炮操作 { DoFired(args); } else if (method == "gunHitFish")//7.3.2服务器通知客户端炮弹和鱼碰撞结果 { FishPoolMngr.GetSingleton().Write(method); DoGunHitFish(args); } else if (method == "newFishGroup")//7.5.1服务器通知客户端玩家出鱼阵型 { DoNewFishGroup(args); } else if (method == "newFish") //7.5.2服务器通知客户端玩家出鱼 { DoNewFish(args); } else if (method == "forbitFired")//7.6.1服务器通知客户端玩家禁止发炮 { DoForbitFired(args); } else if (method == "clearFish")//7.6.2服务器通知客户端玩家清场 { DoClearFish(args,false); } else if (method == "scrollMessage")//7.7.1服务器通知客户端玩家显示滚动信息 { DoScrollMessage(args); } else if (method == "playerInfo")//7.8.2服务器通知客户端被请求玩家的具体信息 { DoPlayerInfo(args); } else if (method == "sendChat")//7.9.2服务器发送聊天信息给客户端 { DoSendChat(args); } else if (method == "gameShutup")//8.1.1服务器向客户端发送:全局禁言标志 { DoGameShutup(args); } else if (method == "userShutup")//8.1.2服务器向客户端发送:个人禁言标志 { DoUserShutup(args); } else if (method == "userAward")//8.2.1服务器向客户端发送:请确认领取游戏币 { DoUserAward(args); } else if (method == "heart")//8.3.1服务器和客户端之间的网络心跳 { //DoHeart(args); } else if (method == "gameGold")//8.4.1服务器通知游戏客户端当前的游戏币 { DoGameGold(args); } else if (method == "expeGold")//8.4.2服务器通知游戏客户端用户的体验币数量 { DoExpeGold(args); } else if (method == "addExpeGoldAuto")//8.5.2服务器给客户端关于申请自动赠送体验币的反馈 { DoAddExpeGoldAuto(args); } else if (method == "overflow")//9.1.1服务器通知客户端爆机了 { DoOverflow(args); } else if (method == "quitToLogin")//9.2.1服务器通知客户端关闭游戏进程,退出至网络大厅的登录界面 { DoQuitToLogin(args); } else if (method == "quitToRoom")//9.3.1游戏服务器通知客户端退出至选桌界面 { DoQuitToRoom(args); } else if (method == "NetThread/NetDown") { //界面模块接收到网络模块的通知,断线了 DoNetDown(args); } else if (method == "lockFish")//7.10.2服务器反馈锁定信息给客户端 { FishPoolMngr.GetSingleton().Write(method); DoLockFish(args); } else if (method == "unLockFish")//7.10.4 服务器反馈解锁信息给客户端 { FishPoolMngr.GetSingleton().Write(method); DoUnLockFish(args); } else if (method == "unLockScreen")//7.11 服务器通知客户端解除定屏炸弹 { DoUnLockScreen(args); } else { Console.WriteLine("recv No Message Type!"); } } /*从后台切回的过滤处理*/ public void SelectPostMsgControl(Hashtable table)//最小化之后切回到后台处理 { String method = table["method"].ToString(); object[] args = table["args"] as object[]; Console.WriteLine(); Console.WriteLine("Method: " + method); //根据报文ID来进行转发 if (method == "sendServerTime") { //服务器和客户端的连接已经建立好,界面可以发送数据了 if(gameInfo.getInstance().Key != "") NetMngr.GetSingleton().MyCreateSocket.SendCheckLogin(gameInfo.getInstance().UserId, gameInfo.getInstance().Pwd, (int)gameInfo.getInstance().currentState); gameInfo.getInstance().Key = "sendServerTime"; } else if (method == "checkLogin")//3.2服务器反馈给客户端报文信息 { DoCheckLogin(args); } else if (method == "roomInfo")//4.1.2 服务器发送某一个游戏房间内的详细信息给客户端 { DoRoomInfo(args); } /* else if (method == "enterDesk")//5.1.2服务器通知客户端玩家进入桌的信息信息 { DoEnterDesk(args); }*/ else if (method == "updateRoomInfo")//5.3.1游戏服务器向客户端发送更新某一个房间内的信息 { DoUpdateRoomInfo(args); } else if (method == "deskOnlineNumber")//5.4.1服务器通知客户端某个房间中某张桌子上的在线人数 { DoDeskOnlineNumber(args); } else if (method == "requestSeat")//6.1.2服务器通知客户端玩家进入桌的信息信息 { DoRequestSeat(args); } else if (method == "updateDeskInfo")//6.3.1服务器通知客户端更新某一张游戏桌子内部的详细信息 { DoUpdateDeskInfo(args); } else if (method == "gameScore")//7.1.3服务器发送给客户端当前的游戏分值 { //DoGameScore(args); } else if (method == "notFired")//7.2.2服务器判断分不够发炮则通知发炮玩家不能发炮操作 { //DoNotFired(args); } else if (method == "fired")//7.2.3服务器判断分够发炮则通知其他同桌客户端玩家进行发炮操作 { //DoFired(args); } else if (method == "gunHitfish")//7.3.2服务器通知客户端炮弹和鱼碰撞结果 { //DoGunHitFish(args); } else if (method == "newFishGroup")//7.5.1服务器通知客户端玩家出鱼阵型 { //DoNewFishGroup(args); } else if (method == "newFish")//7.5.2服务器通知客户端玩家出鱼 { //DoNewFish(args); } else if (method == "forbitFired")//7.6.1服务器通知客户端玩家禁止发炮 { //DoForbitFired(args); } else if (method == "clearFish")//7.6.2服务器通知客户端玩家清场 { //DoClearFish(args, true); } else if (method == "scrollMessage")//7.7.1服务器通知客户端玩家显示滚动信息 { DoScrollMessage(args); } else if (method == "playerInfo")//7.8.2服务器通知客户端被请求玩家的具体信息 { DoPlayerInfo(args); } else if (method == "sendChat")//7.9.2服务器发送聊天信息给客户端 { DoSendChat(args); } else if (method == "gameShutup")//8.1.1服务器向客户端发送:全局禁言标志 { DoGameShutup(args); } else if (method == "userShutup")//8.1.2服务器向客户端发送:个人禁言标志 { DoUserShutup(args); } else if (method == "userAward")//8.2.1服务器向客户端发送:请确认领取游戏币 { DoUserAward(args); } else if (method == "heart")//8.3.1服务器和客户端之间的网络心跳 { //DoHeart(args); } else if (method == "gameGold")//8.4.1服务器通知游戏客户端当前的游戏币 { DoGameGold(args); } else if (method == "expeGold")//8.4.2服务器通知游戏客户端用户的体验币数量 { DoExpeGold(args); } else if (method == "addExpeGoldAuto")//8.5.2服务器给客户端关于申请自动赠送体验币的反馈 { DoAddExpeGoldAuto(args); } else if (method == "overFlow")//9.1.1服务器通知客户端爆机了 { DoOverflow(args); } else if (method == "quitToLogin")//9.2.1服务器通知客户端关闭游戏进程,退出至网络大厅的登录界面 { DoQuitToLogin(args); } else if (method == "quitToRoom")//9.3.1游戏服务器通知客户端退出至选桌界面 { DoQuitToRoom(args); } else if (method == "NetThread/NetDown") { //界面模块接收到网络模块的通知,断线了 DoNetDown(args); } else if (method == "lockFish")//7.10.2服务器反馈锁定信息给客户端 { //DoLockFish(args); } else if (method == "unLockFish")//7.10.4 服务器反馈解锁信息给客户端 { // DoUnLockFish(args); } else if (method == "unLockScreen")//7.11 服务器通知客户端解除定屏炸弹 { //DoUnLockScreen(args); } else { Console.WriteLine("recv No Message Type!"); } } //-------------------- //各种解析转发函数 //-------------------- private void DoNetDown(object[] args) { //////////////NGUIDEbug.Log("DoNetDown"); //界面模块接收到网络模块的通知,断线了,30秒未连接上则需要关闭游戏进程,退出至网络大厅登录界面 if (m_CreateSocket.GetRelineCount() < 200) { m_CreateSocket.CreateReceiveThread(); } else { Console.WriteLine("30秒重连失败,网络断开,请重新登录网络大厅..."); //your code tipManage.getInstance().ShowTip(TipType.Net_ConnectionError);//显示提示框 } } /// <summary> /// 3.2服务器响应客户端登陆请求 /// </summary> /// <param name="args"></param> private void DoCheckLogin(object[] args) { //接收到登录的反馈信息 Console.WriteLine("**********1*********DoCheckLogin**************************************"); bool isLogin = false;//是否允许登录 int messageStatus = 0;//不允许登录的原因:0表示不匹配、1表示冻结、2表示服务器维护 bool isShutup = false;//游戏大厅是否全局禁言:true表示全局禁言、false没有禁言 User user = new User();//登录成功时,反馈的用户信息 bool special = false; Dictionary<string, object> map = args[0] as Dictionary<string, object>; isLogin = (bool)(map["isLogin"]); Console.WriteLine("isLogin: " + isLogin); messageStatus = (int)(map["messageStatus"]); Console.WriteLine("messageStatus: " + messageStatus); //////////////NGUIDEbug.Log("isLogin=" + messageStatus); //////////////NGUIDEbug.Log("isLogin=" + isLogin); if (isLogin)//如果允许登楼为true { isShutup = (bool)(map["isShutup"]); Console.WriteLine("isShutup: " + isShutup); special = (bool)(map["special"]); Console.WriteLine("special:" + special); //user = (User)(map["user"] as User); //将User对象用字典型包装,并赋值给自定义的user变量 Dictionary<string, object> userDictionary = (map["user"]) as Dictionary<string, object>; user.id = (int)userDictionary["id"];//玩家ID user.username = (string)userDictionary["username"];//账号 user.nickname = (string)userDictionary["nickname"];//昵称 user.sex = (((String)userDictionary["sex"]).ToCharArray())[0];//性别 男or女 user.level = (int)userDictionary["level"];//游戏等级 user.gameGold = (int)userDictionary["gameGold"];//游戏币 user.expeGold = (int)userDictionary["expeGold"];//体验币 user.photoId = (int)userDictionary["photoId"];//头像编号:1-4 user.overflow = (int)userDictionary["overflow"];//玩家当前是否爆机,1-爆机;0-没有爆机。 user.gameScore = (int)userDictionary["gameScore"];//游戏分值 user.expeScore = (int)userDictionary["expeScore"];//体验币 user.type = (int)userDictionary["type"];//玩家类型:0-普通玩家;1-游客
if (user.overflow == 1)//玩家爆机时的处理 tipManage.getInstance().ShowTip(TipType.CoinOverFlow);//填出提示框 else //玩家没有爆机处理 {//服务器传递的状态赋值给游戏中状态 gameInfo.getInstance().IsSpecial = special; gameInfo.getInstance().createUser(user); gameInfo.getInstance().IsGameShuUp = isShutup; } } else//如果不允许登楼的情况下 { if (messageStatus == 0)//不匹配的情况下 { #if UNITY_ANDROID && !UNITY_EDITOR AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity"); jo.Call("startGameHall",true); #endif #if UNITY_STANDALONE_WIN Application.Quit();//退出游戏,用来退出当前的程序 #endif } else if (messageStatus == 1)//冻结的情况下 tipManage.getInstance().ShowTip(TipType.Game_UserIdFrozen);//提示框 else//服务器维护的情况下 tipManage.getInstance().ShowTip(TipType.ServerUpdate); } Console.WriteLine("**********2*********DoCheckLogin**************************************"); } /// <summary> /// 4.1.1服务器发送某一个游戏房间内的详细信息给客户端 /// </summary> /// <param name="args"></param> private void DoRoomInfo(object[] args) { Console.WriteLine("**********1*********DoRoomInfo**************************************"); int nDeskCount = 0;//表示该游戏房间中桌子列表信息 Dictionary<string, object> map = args[0] as Dictionary<string, object>; nDeskCount = (map["FishDesk"] as Array).Length; Console.WriteLine("nDeskCount:" + nDeskCount); User user = new User(); if (nDeskCount > 0)//当有桌子的情况下 { //房间里的桌子列表 OverFishDesk[] deskList = new OverFishDesk[nDeskCount]; int []userCountArr = new int[nDeskCount]; //桌子的人数组成一个人数数组 for (int i = 0; i < nDeskCount; i++)//遍历每张桌子 { userCountArr[i] = 0;//初始化桌子的人数为0 Dictionary<string, object> deskDic = new Dictionary<string, object>(); deskDic = (map["FishDesk"] as Array).GetValue(i) as Dictionary<string, object>; deskList[i] = new OverFishDesk(); deskList[i].id = (int)deskDic["id"];//桌子的ID deskList[i].roomId = (int)deskDic["roomId"];//桌子所属的房间号(即练习厅还是竞技厅) deskList[i].name = (string)deskDic["name"];//桌子的名字 deskList[i].minGold = (int)deskDic["minGold"];//桌子所带的最小金币 deskList[i].maxGunValue = (int)deskDic["maxGunValue"];//最大炮值 deskList[i].minGunValue = (int)deskDic["minGunValue"];//最小炮值 deskList[i].addstepGunValue = (int)deskDic["addstepGunValue"];//增加炮值得幅度 deskList[i].exchange = (int)deskDic["exchange"];//桌子的改变 deskList[i].onceExchangeValue=(int)deskDic["onceExchangeValue"];//桌子的参数的改变//-------------Seat--------------------------------- for (int nSeatId = 0; nSeatId < 4; nSeatId++)//遍历桌子的人员信息 { Dictionary<string, object> seatDic = new Dictionary<string, object>(); seatDic = (deskDic["seats"] as Array).GetValue(nSeatId) as Dictionary<string, object>; deskList[i].seats[nSeatId] = new Seat(); deskList[i].seats[nSeatId].id = (int)seatDic["id"];//座位ID号 deskList[i].seats[nSeatId].isFree = (bool)seatDic["isFree"];//这个座位号是否为空(是否已做人) deskList[i].seats[nSeatId].gunValue = (int)seatDic["gunValue"];//这个座位的炮值 // UnityEngine.Debug.Log("8888888888888888888888888fdfffffffff"+deskList[i].seats[nSeatId].gunValue); if (!deskList[i].seats[nSeatId].isFree)//当这个座位不为空,即已坐人 { userCountArr[i]++;人数加一(统计人数) Dictionary<string, object> userDictionary = (seatDic["user"]) as Dictionary<string, object>; deskList[i].seats[nSeatId].user.id = (int)userDictionary["id"];//玩家ID deskList[i].seats[nSeatId].user.username = (string)userDictionary["username"];//账号 deskList[i].seats[nSeatId].user.nickname = (string)userDictionary["nickname"];//昵称 deskList[i].seats[nSeatId].user.sex = (((String)userDictionary["sex"]).ToCharArray())[0];//性别 男or女 deskList[i].seats[nSeatId].user.level = (int)userDictionary["level"];//游戏等级 deskList[i].seats[nSeatId].user.gameGold = (int)userDictionary["gameGold"];//游戏币 deskList[i].seats[nSeatId].user.expeGold = (int)userDictionary["expeGold"];//游戏分值 deskList[i].seats[nSeatId].user.photoId = (int)userDictionary["photoId"];//头像编号:1-4 deskList[i].seats[nSeatId].user.overflow = (int)userDictionary["overflow"];//玩家当前是否爆机,1-爆机;0-没有爆机。 deskList[i].seats[nSeatId].user.gameScore = (int)userDictionary["gameScore"];//体验币 deskList[i].seats[nSeatId].user.expeScore = (int)userDictionary["expeScore"];//体验分值 deskList[i].seats[nSeatId].user.type = (int)userDictionary["type"];//玩家类型:0-普通玩家;1-游客 } else { Console.WriteLine("Seat" + (nSeatId + 1) + ":该座位上没有人!!!"); } } } gameInfo.getInstance().updateTableList(deskList);//每发生人员变化,都要根据服务器初始化桌子列表 for (int i = 0; i < nDeskCount; i++)//遍历每张桌子统计人数 { gameInfo.getInstance().updateTableUserNumber(deskList[i].id, userCountArr[i]);//更新桌子的人数(桌子的ID号,统计人数) } } else//没有桌子 { tipManage.getInstance().ShowTip(TipType.RoomEmpty);//提示框 NetMngr.GetSingleton().MyCreateSocket.SendLeaveRoom(1);//离开房间 } } /// <summary> /// 5.3.1游戏服务器向客户端发送更新某一个房间内的信息 /// </summary> /// <param name="args"></param> private void DoUpdateRoomInfo(object[] args) { int nDeskCount = 0;//表示该游戏房间中桌子列表信息 nDeskCount = (args[0] as Array).Length; Console.WriteLine("nDeskCount:" + nDeskCount); User user = new User(); if (nDeskCount > 0) { //房间里的桌子列表 OverFishDesk[] deskList = new OverFishDesk[nDeskCount]; int[] userCountArr = new int[nDeskCount]; for (int i = 0; i < nDeskCount; i++) { userCountArr[i] = 0; int userCount = 0; //deskList[i] = (OverFishDesk)((map["FishDesk"] as Array).GetValue(i)); Dictionary<string, object> deskDic = new Dictionary<string, object>(); deskDic = (args[0] as Array).GetValue(i) as Dictionary<string, object>; deskList[i] = new OverFishDesk(); deskList[i].id = (int)deskDic["id"]; deskList[i].roomId = (int)deskDic["roomId"]; deskList[i].name = (string)deskDic["name"]; deskList[i].minGold = (int)deskDic["minGold"]; deskList[i].maxGunValue = (int)deskDic["maxGunValue"]; deskList[i].minGunValue = (int)deskDic["minGunValue"]; deskList[i].addstepGunValue = (int)deskDic["addstepGunValue"]; deskList[i].exchange = (int)deskDic["exchange"]; deskList[i].onceExchangeValue = (int)deskDic["onceExchangeValue"]; for (int nSeatId = 0; nSeatId < 4; nSeatId++) { Dictionary<string, object> seatDic = new Dictionary<string, object>(); seatDic = (deskDic["seats"] as Array).GetValue(nSeatId) as Dictionary<string, object>; deskList[i].seats[nSeatId] = new Seat(); deskList[i].seats[nSeatId].id = (int)seatDic["id"]; deskList[i].seats[nSeatId].isFree = (bool)seatDic["isFree"]; deskList[i].seats[nSeatId].gunValue = (int)seatDic["gunValue"]; if (!deskList[i].seats[nSeatId].isFree) { userCountArr[i]++; userCount++; Dictionary<string, object> userDictionary = (seatDic["user"]) as Dictionary<string, object>; deskList[i].seats[nSeatId].user.id = (int)userDictionary["id"];//玩家ID deskList[i].seats[nSeatId].user.username = (string)userDictionary["username"];//账号 deskList[i].seats[nSeatId].user.nickname = (string)userDictionary["nickname"];//昵称 deskList[i].seats[nSeatId].user.sex = (((String)userDictionary["sex"]).ToCharArray())[0];//性别 男or女 deskList[i].seats[nSeatId].user.level = (int)userDictionary["level"];//游戏等级 deskList[i].seats[nSeatId].user.gameGold = (int)userDictionary["gameGold"];//游戏币 deskList[i].seats[nSeatId].user.expeGold = (int)userDictionary["expeGold"];//体验币 deskList[i].seats[nSeatId].user.photoId = (int)userDictionary["photoId"];//头像编号:1-4 deskList[i].seats[nSeatId].user.overflow = (int)userDictionary["overflow"];//玩家当前是否爆机,1-爆机;0-没有爆机。 deskList[i].seats[nSeatId].user.gameScore = (int)userDictionary["gameScore"];//游戏分值 deskList[i].seats[nSeatId].user.expeScore = (int)userDictionary["expeScore"];//体验币 deskList[i].seats[nSeatId].user.type = (int)userDictionary["type"];//玩家类型:0-普通玩家;1-游客 } else { Console.WriteLine("Seat" + (nSeatId + 1) + ":该座位上没有人!!!"); } gameInfo.getInstance().updateTableUserNumber(nSeatId, userCount);//更新本张桌子的在线人数 } } gameInfo.getInstance().updateTableList(deskList);//更新桌子列表 // public void updateCurUsers(Seat[] netSeats)//根据服务器信息初始化桌子上的用户信息 for (int i = 0; i < nDeskCount; i++) { gameInfo.getInstance().updateTableUserNumber(deskList[i].id, userCountArr[i]);//更新桌子的在线人数 } } Console.WriteLine("**********2*********DoRoomInfo**************************************"); } private void DoDeskOnlineNumber(object[] args)//在线人数 { Console.WriteLine("**********1*********DoDeskOnlineNumber**************************************"); int deskId = 0; int onlineNumber = 0; Dictionary<string, object> map = args[0] as Dictionary<string, object>; deskId = (int)(map["deskId"]); onlineNumber = (int)(map["onlineNumber"]);
gameInfo.getInstance().updateTableUserNumber(deskId,onlineNumber);//在线人数的处理 } /// <summary> /// 6.1.2服务器通知客户端玩家进入桌的信息 /// </summary> /// <param name="args"></param> private void DoRequestSeat(object[] args) { Console.WriteLine("**********1*********DoRequestSeat**************************************"); bool bCanSeat = false;//可不可以坐 int messageStatus = 0;//不可以登陆 int bgId = 0; int seatId = 0; Dictionary<string, object> map = args[0] as Dictionary<string, object>; bCanSeat = (bool)(map["bCanSeat"]); if (!bCanSeat)//可以坐 { messageStatus = (int)(map["messageStatus"]);解析当前状态 Console.WriteLine("messageStatus:" + messageStatus); // seatId = (int)(map["seatId"]); //Console.WriteLine("seatId:" + seatId); } else//不可以做 { seatId = (int)(map["seatId"]); Console.WriteLine("seatId:" + seatId); bgId = (int)(map["bgId"]); Console.WriteLine("bgId:" + bgId); gameInfo.getInstance().User.SeatIndex = seatId;//当前座位信息赋值给任务座位。表示怀疑 }
//因为玩家一坐下话,就要进入游戏 if (!NetMngr.GetSingleton().IsGameSceneLoadOk)//没有加载好新的游戏场景 { //记录玩家所处游戏场景 NetMngr.GetSingleton().mSceneBg = bgId; } else { SceneBgMngr.GetSingleton().SetScene(bgId);//加载新的游戏场景 } if (bCanSeat)//坐下成功 gameInfo.getInstance().UIScene.enterGame();//加载场景 else if (messageStatus == 0)//此桌不存在 tipManage.getInstance().ShowTip(TipType.TableDeleted);提示框 else if (messageStatus == 1)//游戏币不足 { if (gameInfo.getInstance().User.RoomId == 2)//竞技厅 tipManage.getInstance().ShowTip(TipType.SelectTable_CreditBelowRistrict); else //练习厅 tipManage.getInstance().ShowTip(TipType.SelectTable_SendExpCoin); } else if (messageStatus == 2)//此桌有人 tipManage.getInstance().ShowTip(TipType.SelectSeat_NotEmpty); Console.WriteLine("**********2*********DoRequestSeat**************************************"); } /// <summary> /// 6.3.1服务器通知客户端更新某一张游戏桌子内部的详细信息 /// </summary> /// <param name="args"></param> private void DoUpdateDeskInfo(object[] args) { Console.WriteLine("**********1*********DoUpdateDeskInfo**************************************"); Dictionary<string, object> map = args[0] as Dictionary<string, object>; int nDeskId = 0;//桌子ID int nSeatCount = 0; nDeskId = (int)(map["deskId"]); nSeatCount = (map["Seat"] as Array).Length; User user = new User(); //座位列表 if (nSeatCount > 0)//有桌子 { Seat[] seatList = new Seat[nSeatCount]; int count = 0; for (int i = 0; i < nSeatCount; i++)//遍历此张桌子的人 { Dictionary<string, object> seatDic = new Dictionary<string, object>(); seatDic = (map["Seat"] as Array).GetValue(i) as Dictionary<string, object>; seatList[i] = new Seat(); seatList[i].id = (int)seatDic["id"]; seatList[i].isFree = (bool)seatDic["isFree"]; seatList[i].gunValue = (int)seatDic["gunValue"]; if (!seatList[i].isFree)//此桌有人 { count++;//统计在线人数 Dictionary<string, object> userDic = (seatDic["user"]) as Dictionary<string, object>; seatList[i].user.id = (int)userDic["id"];//玩家ID seatList[i].user.username = (string)userDic["username"];//账号 seatList[i].user.nickname = (string)userDic["nickname"];//昵称 seatList[i].user.sex = (((String)userDic["sex"]).ToCharArray())[0];//性别 男or女 seatList[i].user.level = (int)userDic["level"];//游戏等级 seatList[i].user.gameGold = (int)userDic["gameGold"];//游戏币 seatList[i].user.expeGold = (int)userDic["expeGold"];//体验币 seatList[i].user.photoId = (int)userDic["photoId"];//头像编号:1-4 seatList[i].user.overflow = (int)userDic["overflow"];//玩家当前是否爆机,1-爆机;0-没有爆机。 seatList[i].user.gameScore = (int)userDic["gameScore"];//游戏分值 seatList[i].user.expeScore = (int)userDic["expeScore"];//体验币 seatList[i].user.type = (int)userDic["type"];//玩家类型:0-普通玩家;1-游客 } else { Console.WriteLine("Seat" + (seatList[i].id) + ":该座位上没有人!!!"); } } gameInfo.getInstance().updateOtherUsers(seatList, nDeskId);//更新其它玩家信息(根据服务器初始化其它用户信息) gameInfo.getInstance().updateTableUserNumber(nDeskId, count);//更新在线人数 } else { //不存在座位 Console.WriteLine("该游戏桌子上没有座位!!!"); //your code } Console.WriteLine("**********2*********DoUpdateDeskInfo**************************************"); }
//服务器发送给当前客户端的游戏分值 private void DoGameScore(object[] args) { Console.WriteLine("**********1*********DoGameScore**************************************"); int gameScore = (int) args[0] ; Console.WriteLine("gameScore: " + gameScore); gameInfo.getInstance().updateUser("gameScore", gameScore);//更加服务器跟新用户信息 }
//服务器判断分不够发泡则通知发泡玩家不能发泡操作 private void DoNotFired(object[] args) { Console.WriteLine("**********1*********DoNotfired**************************************"); int nGunId = 0; int nSeatid = 0; int nTotalScore = 0; Dictionary<string, object> map = args[0] as Dictionary<string, object>; nGunId = (int)(map["gunId"]); Console.WriteLine("gunId: " + nGunId); nSeatid = (int)(map["seatId"]); Console.WriteLine("seatId: " + nSeatid); nTotalScore = (int)(map["totalScore"]); Console.WriteLine("totalScore: " + nTotalScore); Console.WriteLine("**********2********DoNotfired**************************************"); }
//可以发炮 private void DoFired(object[] args) { //Console.WriteLine("**********1*********DoFired**************************************"); int nGunId = 0; int nSeatId = 0; int nGunValue = 0; double fRot = 0; bool bX2Gun = false; int nTtotalScore = 0; Dictionary<string, object> map = args[0] as Dictionary<string, object>; nGunId = (int)(map["gunId"]);//炮的ID Console.WriteLine("gunId: " + nGunId); nSeatId = (int)(map["seatId"]);//座位号 Console.WriteLine("seatId: " + nSeatId); nTtotalScore = (int)(map["totalScore"]);//分值 Console.WriteLine("totalScore: " + nTtotalScore); nGunValue = (int)(map["gunValue"]);//炮值 Console.WriteLine("gunValue: " + nGunValue); fRot = (double)(map["fRot"]); Console.WriteLine("fRot: " + fRot); bX2Gun = (bool)(map["bX2Gun"]); Console.WriteLine("bX2Gun: " + bX2Gun); //your code if (NetMngr.GetSingleton().IsGameSceneLoadOk && !GameCommon.GameParameter.G_bTest && nSeatId != GameMngr.GetSingleton().mPlayerSeatID) { BulletPoolMngr.GetSingleton().LanchBullet(nSeatId, (float)fRot, nGunValue, bX2Gun); } Console.WriteLine("**********2*********DoFired**************************************"); if (gameInfo.getInstance().currentState == GameState.On_Game) gameInfo.getInstance().GameScene.updateWhenFired(nSeatId, nTtotalScore, nGunValue, (float)fRot); Console.WriteLine("**********2*********DoFired**************************************"); } private void DoGunHitFish(object[] args) { //////////////NGUIDEbug.Log("DoGunHitFish"); Console.WriteLine("**********1*********DoGunHitFish**************************************"); int nSeatId = 0; int nGunId = 0; int nGunValue = 0; int nFishDeadScore = 0; int nTotalScore = 0; int nHitFishCount = 0; int nLimitFishCount = 0; bool bCreateX2Gun = false; bool bDeadBomb = false; Dictionary<string, object> map = args[0] as Dictionary<string, object>; nSeatId = (int)(map["seatId"]); Console.WriteLine("seatId: " + nSeatId); nGunId = (int)(map["gunId"]); Console.WriteLine("gunId: " + nGunId); nGunValue = (int)(map["gunValue"]); Console.WriteLine("gunValue: " + nGunValue); nFishDeadScore = (int)(map["fishDeadScore"]); Console.WriteLine("fishDeadScore: " + nFishDeadScore); nTotalScore = (int)(map["totalScore"]); Console.WriteLine("totalScore: " + nTotalScore); nHitFishCount = (int)(map["hitFishCount"]); Console.WriteLine("hitFishCount: " + nHitFishCount); bCreateX2Gun = (bool)(map["bCreateX2Gun"]); Console.WriteLine("bCreateX2Gun: " + bCreateX2Gun); bDeadBomb = (bool)(map["bDeadBomb"]); Console.WriteLine("bDeadBomb: " + bDeadBomb); if (gameInfo.getInstance().currentState == GameState.On_Game) gameInfo.getInstance().GameScene.updateWhenDead(nSeatId, nTotalScore, nFishDeadScore, nGunValue); if (bCreateX2Gun && nSeatId == GameMngr.GetSingleton().mPlayerSeatID) { if (NetMngr.GetSingleton().IsGameSceneLoadOk) { //gggg 服务器需要提供获得离子炮的鱼信息 BulletPoolMngr.GetSingleton().SetLizi(); } } { int hitFishCount = (map["HitFish1"] as Array).Length; if (nHitFishCount != hitFishCount) { Console.WriteLine("nHitFishCount error "); } if (hitFishCount > 0) { HitFish[] hitFishList = new HitFish[hitFishCount]; for (int i = 0; i < hitFishCount; i++) { // hitfishList[i] = (HitFish)((map["HitFish1"] as Array).GetValue(i)); Dictionary<string, object> fishDic = new Dictionary<string, object>(); fishDic = (map["HitFish1"] as Array).GetValue(i) as Dictionary<string, object>; hitFishList[i] = new HitFish(); hitFishList[i].fishId = (int)fishDic["fishId"]; hitFishList[i].fishType = (int)fishDic["fishType"]; hitFishList[i].fx = (double)fishDic["fx"]; hitFishList[i].fy = (double)fishDic["fy"]; hitFishList[i].bet = (int)fishDic["bet"]; if (hitFishList[i] == null) { UnityEngine.Debug.Log("@Transmit hitfishList[i] == null with i: " + i + ", with nHitFishCount: " + nHitFishCount); } if (!GameCommon.GameParameter.G_bTest //&& hitfishList[i] != null && NetMngr.GetSingleton().IsGameSceneLoadOk && FishPoolMngr.GetSingleton() != null && EffectMngr.GetSingleton() != null) { //UnityEngine.Debug.Log("fish die with seatid: " + seatid); FishPoolMngr.GetSingleton().SetFishDie(hitFishList[i].fishId, nGunValue, hitFishList[i].fishType, hitFishList[i].bet, nSeatId, new UnityEngine.Vector3((float)hitFishList[i].fx, (float)hitFishList[i].fy, 0f)); //add by 2015/1/15去掉离子炮卡片 if (bCreateX2Gun && i == 0)/*有离子炮 选择第一条鱼的位置飘回*/ { EffectMngr.GetSingleton().PlayLiziCardFly(nSeatId, new UnityEngine.Vector3((float)hitFishList[i].fx, (float)hitFishList[i].fy, 0f)); } } } } } if (bDeadBomb) { nLimitFishCount = (int)(map["limitFishCount"]); Console.WriteLine("limitFishCount: " + nLimitFishCount); int nDeadBombFishCount = (map["HitFish2"] as Array).Length; if (nLimitFishCount != nDeadBombFishCount) { Console.WriteLine("nDeadKnifeFishCount error "); } if (nDeadBombFishCount > 0) { HitFish[] hitFishList = new HitFish[nDeadBombFishCount]; for (int i = 0; i < nDeadBombFishCount; i++) { Dictionary<string, object> fishDic = new Dictionary<string, object>(); fishDic = (map["HitFish2"] as Array).GetValue(i) as Dictionary<string, object>; hitFishList[i] = new HitFish(); hitFishList[i].fishId = (int)fishDic["fishId"]; hitFishList[i].fishType = (int)fishDic["fishType"]; hitFishList[i].fx = (double)fishDic["fx"]; hitFishList[i].fy = (double)fishDic["fy"]; if (!GameCommon.GameParameter.G_bTest && FishPoolMngr.GetSingleton() != null && EffectMngr.GetSingleton() != null) { FishPoolMngr.GetSingleton().SetFishDie(hitFishList[i].fishId, nGunValue, hitFishList[i].fishType, hitFishList[i].bet, nSeatId, new UnityEngine.Vector3((float)hitFishList[i].fx, (float)hitFishList[i].fy, 0f)); } } } } Console.WriteLine("**********2*********DoGunHitFish**************************************"); } private void DoNewFishGroup(object[] args) { Console.WriteLine("**********1*********DoNewfishGroup**************************************"); int nFishGroupType = (int)args[0]; Console.WriteLine("fishGroupType: " + nFishGroupType); //your code SceneBgMngr.GetSingleton().BigFishFormatReset(); Formation.GetSingleton().ShowFormation((GameCommon.FORMATION)(nFishGroupType)); if (gameInfo.getInstance().currentState == GameState.On_Game) gameInfo.getInstance().GameScene.hideTip(); Console.WriteLine("**********2********DoNewfishGroup**************************************"); } private void DoNewFish(object[] args) { Console.WriteLine("**********1*********DoNewfish**************************************"); int nFishType = 0; int nNewFishCount = 0; int nFishRealTypeCount = 0;//珊瑚鱼32或一箭双雕39的真实类型 FishPathType fishPathType = new FishPathType(); Dictionary<string, object> map = args[0] as Dictionary<string, object>; nNewFishCount = (int)(map["newFishCount"]); // Console.WriteLine("newFishCount: " + nNewFishCount); nFishType = (int)(map["fishType"]); Console.WriteLine("fishType: " + nFishType); nFishRealTypeCount = (map["fishRealType"] as Array).Length; GameCommon.FISH_TYPE[] DoubleKill = null; if (nFishRealTypeCount > 0) { DoubleKill = new GameCommon.FISH_TYPE[nFishRealTypeCount]; int[] nFishRealTypeList = new int[nFishRealTypeCount]; for (int i = 0; i < nFishRealTypeCount; i++) { nFishRealTypeList[i] = (int)((map["fishRealType"] as Array).GetValue(i)); // Console.WriteLine("fishRealType:" + nFishRealTypeList[i]); DoubleKill[i] = (GameCommon.FISH_TYPE)nFishRealTypeList[i]; if (nFishType == (int)GameCommon.FISH_TYPE.Fish_Double_Kill) { //NGUIDebug.Log("DoubleKill[0]=" + DoubleKill[0] + " DoubleKill[1]=" + DoubleKill[1]); } } } int nFishCount = (map["FishPathType"] as Array).Length; if (nNewFishCount != nFishCount) { // Console.WriteLine("newFishCount error "); } if (nFishCount > 0) { FishPathType[] fishList = new FishPathType[nFishCount]; for (int i = 0; i < nFishCount; i++) { Dictionary<string, object> fishDic = new Dictionary<string, object>(); fishDic = (map["FishPathType"] as Array).GetValue(i) as Dictionary<string, object>; fishList[i] = new FishPathType(); fishList[i].fishId = (int)fishDic["fishId"]; fishList[i].newFishPathType = (int)fishDic["newFishPathType"]; //FishPoolMngr.GetSingleton().Write(fishList[i]); } for (int i = 0; i < nFishCount; i++) { Console.WriteLine("fishId:" + fishPathType.fishId); Console.WriteLine("newFishPathType:" + fishPathType.newFishPathType); //your code } ////////////////NGUIDEbug.Log("nFishType=" + nFishType + " nFishCount=" + nFishCount); //for (int k = 0; k < fishList.Length; k++) // //////////////NGUIDEbug.Log("fishList=" + fishList[k].newFishPathType + " k=" + k); if (nFishType != (int)GameCommon.FISH_TYPE.Fish_TYPE_NONE) { // UnityEngine.Debug.Log("fishid: " + fishList[0].fishid); // UnityEngine.Debug.Log("ishList[0].newFishPathType: " + fishList[0].newFishPathType); // UnityEngine.Debug.Log("newFishCount: " + newFishCount); ////////////////NGUIDEbug.Log("StatisticFishNew---: " + StatisticFishNew); ////////////////NGUIDEbug.Log("StatisticFishNew---: " + StatisticFishDead); if (NetMngr.GetSingleton().IsGameSceneLoadOk && FishPoolMngr.GetSingleton() != null && !GameCommon.GameParameter.G_bTest) { //nFishType = (int)GameCommon.FISH_TYPE.Fish_Zebra; if (nFishType == (int)GameCommon.FISH_TYPE.Fish_CoralReefs && DoubleKill != null)//珊瑚礁// { FishPoolMngr.GetSingleton().CreateCoralReefsFish((GameCommon.FISH_TYPE)DoubleKill[0], fishList[0].newFishPathType, fishList[0].fishId); } else if (nFishType == (int)GameCommon.FISH_TYPE.Fish_Double_Kill && DoubleKill != null) { FishPoolMngr.GetSingleton().CreateFish((GameCommon.FISH_TYPE)nFishType, fishList[0].newFishPathType, fishList[0].fishId, nNewFishCount, DoubleKill); } else { FishPoolMngr.GetSingleton().CreateFish((GameCommon.FISH_TYPE)nFishType, fishList[0].newFishPathType, fishList[0].fishId, nNewFishCount); } if (gameInfo.getInstance().CountTime)//定屏时出鱼解除锁定,如网络信号不好,客户端没有接收到报文 FishPoolMngr.GetSingleton().UnFixAllFish(); //FishPoolMngr.GetSingleton().Write(fishList[0].fishId, nNewFishCount); } } if (gameInfo.getInstance().currentState == GameState.On_Game) gameInfo.getInstance().GameScene.hideTip(); } //your code Console.WriteLine("**********2*********DoNewfish**************************************");//*/ } private void DoClearFish(object[] args, bool isBackGround) { Console.WriteLine("**********1*********DoClearfish**************************************"); int nBgId = (int)args[0]; Console.WriteLine("**********2*********DoClearfish**************************************"); //your code if(NetMngr.GetSingleton().IsGameSceneLoadOk) { if(!isBackGround) SceneBgMngr.GetSingleton().ChangeScene(nBgId); else//从后台切回,直接设置场景 SceneBgMngr.GetSingleton().SetScene(nBgId); } } private void DoForbitFired(object[] args) { Console.WriteLine("**********1*********DoForbitFired**************************************"); Console.WriteLine("**********2*********DoForbitFired**************************************"); //your code //逻辑故障 服务器gggg if(NetMngr.GetSingleton().IsGameSceneLoadOk) { BulletPoolMngr.GetSingleton().mIsFireEnableBySvr = false; } } private void DoScrollMessage(object[] args) { Console.WriteLine("**********1*********DoScrollMessage**************************************"); string message = (string)args[0]; Console.WriteLine("message: " + message); //your code Console.WriteLine("**********2*********DoScrollMessage**************************************"); if (gameInfo.getInstance().currentState == GameState.On_Game) gameInfo.getInstance().GameScene.addNotice(message); } private void DoPlayerInfo(object[] args) { Console.WriteLine("**********1*********DoPlayerInfo**************************************"); int nSeatId = 0; int nHonor = 0; User user = new User(); Dictionary<string, object> map = args[0] as Dictionary<string, object>; nSeatId = (int)(map["seatId"]); Console.WriteLine("seatId: " + nSeatId); nHonor = (int)(map["honor"]); Console.WriteLine("honor: " + nHonor); Dictionary<string, object> userDic = (map["user"]) as Dictionary<string, object>; user.id = (int)userDic["id"];//玩家ID user.username = (string)userDic["username"];//账号 user.nickname = (string)userDic["nickname"];//昵称 user.sex = (((String)userDic["sex"]).ToCharArray())[0];//性别 男or女 user.level = (int)userDic["level"];//游戏等级 user.gameGold = (int)userDic["gameGold"];//游戏币 user.expeGold = (int)userDic["expeGold"];//体验币 user.photoId = (int)userDic["photoId"];//头像编号:1-4 user.overflow = (int)userDic["overflow"];//玩家当前是否爆机,1-爆机;0-没有爆机。 user.gameScore = (int)userDic["gameScore"];//游戏分值 user.expeScore = (int)userDic["expeScore"];//体验币 user.type = (int)userDic["type"];//玩家类型:0-普通玩家;1-游客 // user.promoterName = (int)userDic["promoterName"];;//推广员账号 Console.WriteLine("user.id: " + user.id); Console.WriteLine("user.username: " + user.username); Console.WriteLine("user.nickname: " + user.nickname); Console.WriteLine("user.sex: " + user.sex); Console.WriteLine("user.level: " + user.level); Console.WriteLine("user.gameGold: " + user.gameGold); Console.WriteLine("user.expeGold: " + user.expeGold); Console.WriteLine("user.photoId: " + user.photoId); Console.WriteLine("user.overflow: " + user.overflow); Console.WriteLine("user.type:" + user.type); // Console.WriteLine("user.promoterName:" + user.promoterName); Console.WriteLine("**********2********DoPlayerInfo**************************************"); //your code gameInfo.getInstance().getPersonInfo(new userInfo(user), nHonor); } private void DoSendChat(object[] args) { Console.WriteLine("**********1*********DoSendChat**************************************"); int chatType = 0; int senderSeatId = 0; string chatMessage; Dictionary<string, object> map = args[0] as Dictionary<string, object>; chatType = (int)(map["chatType"]); Console.WriteLine("chatType: " + chatType); senderSeatId = (int)(map["senderSeatId"]); Console.WriteLine("senderSeatId: " + senderSeatId); chatMessage = (string)(map["chatMessage"]); Console.WriteLine("chatMessage: " + chatMessage); //your code Console.WriteLine("**********2*********DoSendChat**************************************"); if (gameInfo.getInstance().currentState == GameState.On_Game) gameInfo.getInstance().GameScene.updateChatInfo(chatType, senderSeatId, chatMessage); } /// <summary> /// 8.8.1服务器向客户端发送:全局禁言标志 /// </summary> /// <param name="args"></param> private void DoGameShutup(object[] args) { Console.WriteLine("**********1*********DoGameShutup**************************************"); bool forbidFlag = (bool)args[0]; Console.WriteLine("forbidFlag: " + forbidFlag); Console.WriteLine("**********2*********DoGameShutup**************************************"); //your code gameInfo.getInstance().IsGameShuUp = forbidFlag; } /// <summary> /// 8.1.2服务器向客户端发送:个人禁言标志 /// </summary> /// <param name="args"></param> private void DoUserShutup(object[] args) { Console.WriteLine("**********1*********DoUserShutup**************************************"); bool forbidFlag = (bool)args[0]; Console.WriteLine("forbidFlag: " + forbidFlag); //your code Console.WriteLine("**********2*********DoUserShutup**************************************"); gameInfo.getInstance().IsUserShutUp = forbidFlag; } /// <summary> /// 8.2.1服务器向客户端发送:请确认领取游戏币 /// </summary> /// <param name="args"></param> private void DoUserAward(object[] args) { Console.WriteLine("**********1*********DoUserAward**************************************"); int nGold = (int)args[0]; Console.WriteLine("gold: " + nGold); //your code Console.WriteLine("**********2*********DoUserAward**************************************"); gameInfo.getInstance().updateUser("gameCoin", nGold); //tipManage.getInstance().ShowTip(TipType.GivingCoin, nGold); gameInfo.getInstance().RecGivingCoin(nGold); } /// <summary> /// 8.4.1服务器通知游戏客户端当前的游戏币 /// </summary> /// <param name="args"></param> private void DoGameGold(object[] args) { Console.WriteLine("**********1*********DoGameGold**************************************"); ////客户端接受到当前的游戏币数量 int nGameGold = 0;//当前游戏币 nGameGold = (int)args[0]; Console.WriteLine("gameGold: " + nGameGold); //your code Console.WriteLine("**********2*********DoGameGold**************************************"); //////////////NGUIDEbug.Log("nGameGold=" + nGameGold); gameInfo.getInstance().updateUser("gameCoin", nGameGold); } /// <summary> /// 8.4.2服务器通知游戏客户端用户的体验币数量 /// </summary> /// <param name="args"></param> private void DoExpeGold(object[] args) { Console.WriteLine("**********1*********DoExpeGold**************************************"); ///客户端接受到当前体验币的数量 int nExpeGold = 0; nExpeGold = (int)args[0]; Console.WriteLine("nExpeGold: " + nExpeGold); Console.WriteLine("**********2*********DoExpeGold**************************************"); //your code gameInfo.getInstance().updateUser("testCoin", nExpeGold); } private void DoAddExpeGoldAuto(object[] args) { Console.WriteLine("**********1*********DoAddExpeGoldAuto**************************************"); bool bOk = (bool)args[0]; Console.WriteLine("bOk: " + bOk); Console.WriteLine("**********2*********DoAddExpeGoldAuto**************************************"); //your code soundManage.getInstance().playButtonMusic(buttonMusicType.getTestCoin); tipManage.getInstance().ShowTip(TipType.ApplyForExpCoin_Success); } private void DoOverflow(object[] args) { Console.WriteLine("**********1*********DoOverflow**************************************"); Console.WriteLine("**********2*********DoOverflow**************************************"); tipManage.getInstance().ShowTip(TipType.CoinOverFlow); //your code } private void DoQuitToLogin(object[] args) { Console.WriteLine("**********1*********DoQuitToLogin**************************************"); int type = (int)args[0]; Console.WriteLine("type: " + type); Console.WriteLine("**********2*********DoQuitToLogin**************************************"); //your code switch (type) { case 1: tipManage.getInstance().ShowTip(TipType.ServerUpdate); break; case 2: tipManage.getInstance().ShowTip(TipType.Game_UserIdFrozen); break; case 3: tipManage.getInstance().ShowTip(TipType.UserIdDeleted); break; case 4: tipManage.getInstance().ShowTip(TipType.UserIdRepeative); break; case 5: tipManage.getInstance().ShowTip(TipType.UserPwdChanged); break; case 6: tipManage.getInstance().ShowTip(TipType.LoseTheServer); break; default: break; } if (gameInfo.getInstance().currentState == GameState.On_Game) { gameInfo.getInstance().GameScene.HideProfile(); } } private void DoQuitToRoom(object[] args) { Console.WriteLine("**********1*********DoQuitToRoom**************************************"); int type = (int)args[0]; Console.WriteLine("type: " + type); Console.WriteLine("**********2*********DoQuitToRoom**************************************"); //your code if (type == 1) tipManage.getInstance().ShowTip(TipType.TableDeleted); else if (type == 2) tipManage.getInstance().ShowTip(TipType.TableConfigChanged); else tipManage.getInstance().ShowTip(TipType.LongTimeNoHandle); if (gameInfo.getInstance().currentState == GameState.On_Game) { gameInfo.getInstance().GameScene.HideProfile(); } } //8.3心跳 private void DoHeart(object[] args) { m_CreateSocket.SendHeart(); } //7.10.2服务器反馈锁定信息给客户端 private void DoLockFish(object[] args) { Console.WriteLine("**********1*********DoLockFish**************************************"); bool bIsLockFish = false; int nFishId = 0; int nSeatId = 0; Dictionary<string, object> map = args[0] as Dictionary<string, object>; bIsLockFish = (bool)(map["isLockFish"]); Console.WriteLine("isLockFish: " + bIsLockFish); nFishId = (int)(map["fishId"]); Console.WriteLine("fishId: " + nFishId); nSeatId = (int)(map["seatId"]); Console.WriteLine("seatId: " + nSeatId); FishPoolMngr.GetSingleton().LockFish(nFishId, nSeatId, bIsLockFish); Console.WriteLine("**********2*********DoLockFish**************************************"); //your code } // 7.10.4 服务器反馈解锁信息给客户端 private void DoUnLockFish(object[] args) { Console.WriteLine("**********1*********DoUnLockFish**************************************"); int nFishId = 0; int nSeatId = 0; Dictionary<string, object> map = args[0] as Dictionary<string, object>; nFishId = (int)(map["fishId"]); Console.WriteLine("fishId: " + nFishId); nSeatId = (int)(map["seatId"]); Console.WriteLine("seatId: " + nSeatId); Console.WriteLine("**********2*********DoUnLockFish**************************************"); //your code FishPoolMngr.GetSingleton().UnLockFish(nFishId, nSeatId); } //7.11 解除定屏炸弹 private void DoUnLockScreen(object[] args) { Console.WriteLine("**********1*********unLockScreen**************************************"); FishPoolMngr.GetSingleton().UnFixAllFish(); Console.WriteLine("**********1*********unLockScreen**************************************"); } } }
标签:
原文地址:http://www.cnblogs.com/heisaijuzhen/p/4281019.html