public void SetAvatarVo(AvatarVO value) { if (value != null) { avatarvo = value; readyImg.enabled = avatarvo.isReady; nameText.text = avatarvo.account.uuid + ""; nameText.text = nameText.text.Substring(0, 6).ToString() + ".."; scoreText.text = avatarvo.scores + ""; if (dir != "B") { } } else { headerIcon.preserveAspect = false; nameText.text = ""; readyImg.enabled = false; bankerImg.enabled = false; scoreText.text = ""; ResourcesLoader.Load <Sprite>("BaseAssets/UI_Online/UI_Public/head0", (sprite) => { headerIcon.overrideSprite = sprite; SetHeadSprite(); }); //headerIcon.sprite = Resources.Load("Image/morentouxiang", typeof(Sprite)) as Sprite; headerIcon.preserveAspect = true; } }
public void otherUserJointRoom(ClientResponse response) { Debug.Log("其他人加入房间=>" + response.message); AvatarVO avatar = JsonMapper.ToObject <AvatarVO>(response.message); addAvatarVOToList(avatar); }
private void RoomBackResponse(ClientResponse response) { watingPanel.SetActive(false); if (GlobalDataScript.homePanel != null) { GlobalDataScript.homePanel.GetComponent <HomePanelScript> ().removeListener(); Destroy(GlobalDataScript.homePanel); } if (GlobalDataScript.gamePlayPanel != null) { GlobalDataScript.gamePlayPanel.GetComponent <MyMahjongScript> ().exitOrDissoliveRoom(); } GlobalDataScript.reEnterRoomData = JsonMapper.ToObject <RoomJoinResponseVo> (response.message); for (int i = 0; i < GlobalDataScript.reEnterRoomData.playerList.Count; i++) { AvatarVO itemData = GlobalDataScript.reEnterRoomData.playerList [i]; if (itemData.account.openid == GlobalDataScript.loginResponseData.account.openid) { GlobalDataScript.loginResponseData.account.uuid = itemData.account.uuid; ChatSocket.getInstance().sendMsg(new LoginChatRequest(GlobalDataScript.loginResponseData.account.uuid)); break; } } GlobalDataScript.gamePlayPanel = PrefabManage.loadPerfab("Prefab/Panel_GamePlay"); removeListener(); Destroy(this); Destroy(gameObject); }
public void setAvatarVo(AvatarVO value) { if (value != null) { avatarvo = value; readyImg.enabled = avatarvo.isReady; bankerImg.enabled = avatarvo.main; nameText.text = avatarvo.account.nickname; scoreText.text = avatarvo.scores + ""; if (scoreImg != null) { scoreImg.gameObject.SetActive(true); } offlineImage.transform.gameObject.SetActive(!avatarvo.isOnLine); StartCoroutine(LoadImg()); } else { nameText.text = ""; readyImg.enabled = false; bankerImg.enabled = false; scoreText.text = ""; if (scoreImg != null) { scoreImg.gameObject.SetActive(false); } readyImg.enabled = false; avatarvo = null; // SpriteRenderer spr = gameObject.GetComponent<SpriteRenderer> (); // Texture2D texture =(Texture2D)Resources.Load ("Image/gift"); // Sprite sp = Sprite.Create (texture, spr.sprite.textureRect, new Vector2 (0.5f, 0.5f)); headerIcon.sprite = Resources.Load("Image/morentouxiang", typeof(Sprite)) as Sprite; } }
public void setUIData(AvatarVO userInfo) { headIconPath = userInfo.account.headicon; Ip.text = "IP:" + userInfo.IP; ID.text = "ID:" + userInfo.account.uuid + ""; NickName.text = "昵称:" + userInfo.account.nickname; StartCoroutine(LoadImg()); }
void addAvatarVOToList(AvatarVO avatar) { if (avatarList == null) { avatarList = new List <AvatarVO>(); } avatarList.Add(avatar); setSeat(avatar); }
public void createRoomAddAvatarVO(AvatarVO avatar) { // 设置分数默认为1000 avatar.scores = 1000; addAvatarVOToList(avatar); setRoomRemark(); // 执行准备游戏操作 readyGame(); // 显示自己已经准备游戏 markselfReadyGame(); }
private void OnSocketSubUserEnter(byte[] data, int dataSize) { int len = 0; TagUserInfoHead pUserInfoHead = NetUtil.BytesToStruct <TagUserInfoHead>(data); MyDebug.Log("座位号:" + pUserInfoHead.wChairID + "---------------------" + pUserInfoHead.dwUserID); if (pUserInfoHead.wChairID > 3) { return; } if (GlobalDataScript.roomAvatarVoList == null) { GlobalDataScript.roomAvatarVoList = new List <AvatarVO>(); } for (int i = 0; i < GlobalDataScript.roomAvatarVoList.Count; i++) { if (GlobalDataScript.roomAvatarVoList[i].chairID == pUserInfoHead.wChairID) { GlobalDataScript.roomAvatarVoList[i].account.uuid = (int)pUserInfoHead.dwUserID; GlobalDataScript.roomAvatarVoList[i].account.headicon = GetHeadHttp(pUserInfoHead.szHeadHttp); GlobalDataScript.roomAvatarVoList[i].account.sex = pUserInfoHead.cbGender; GlobalDataScript.roomAvatarVoList[i].chairID = pUserInfoHead.wChairID; GlobalDataScript.roomAvatarVoList[i].tableID = pUserInfoHead.wTableID; return; } } AvatarVO avo = new AvatarVO(); Account acc = new Account(); avo.account = acc; avo.account.uuid = (int)pUserInfoHead.dwUserID; avo.account.headicon = GetHeadHttp(pUserInfoHead.szHeadHttp); avo.account.sex = pUserInfoHead.cbGender; avo.chairID = pUserInfoHead.wChairID; avo.tableID = pUserInfoHead.wTableID; if (pUserInfoHead.dwUserID == GlobalDataScript.loginResponseData.account.uuid) { GlobalDataScript.loginResponseData.account.uuid = avo.account.uuid; GlobalDataScript.loginResponseData.account.headicon = avo.account.headicon; GlobalDataScript.loginResponseData.account.sex = avo.account.sex; GlobalDataScript.loginResponseData.chairID = avo.chairID; GlobalDataScript.loginResponseData.tableID = avo.tableID; } GlobalDataScript.roomAvatarVoList.Add(avo); if (GlobalDataScript.type != ModeType.None) { return; } SetClientResponse(APIS.JOIN_ROOM_NOICE, NetUtil.ObjToJson(avo)); }
/** * 重新初始化数据 */ public void reinitData() { roomVO = new RoomVO(); myAvatarVO = null; playerList = null; remainRoundCount = 0; gameStatus = GameStatus.UNDEFINED; gamingData = null; lotteryDatas = null; isOverByPlayer = false; }
public void loginCallBack(ClientResponse response) { AvatarVO temp = JsonMapper.ToObject <AvatarVO> (response.message); avatarList.Add(temp); string str = ""; for (int i = 0; i < avatarList.Count; i++) { str += "用户名:" + avatarList [i].account.nickname + "\n"; } loginText.text = str; }
public void LoginCallBack(ClientResponse response) { AvatarVO temp = JsonMapper.ToObject <AvatarVO>(response.message); avatarList.Add(temp); string str = ""; for (int i = 0; i < avatarList.Count; i++) { str += string.Format(LocalizationManager.GetInstance.GetValue("KEY.11025"), avatarList[i].account.nickname + "\n"); } loginText.text = str; }
public void setAvatarVo(AvatarVO value) { if (value != null) { avatarvo = value; readyImg.enabled = avatarvo.isReady; bankerImg.enabled = avatarvo.main; //// Add //bianKuang.SetActive(avatarvo.main); //float timerBanker = 5; //timerBanker -= Time.deltaTime; //if (timerBanker < 0) //{ // bianKuangAni.SetBool("IsBanker", false); // bianKuang.SetActive(false); //} //// End nameText.text = avatarvo.account.nickname; scoreText.text = avatarvo.scores + ""; if (scoreImg != null) { scoreImg.gameObject.SetActive(true); } offlineImage.transform.gameObject.SetActive(!avatarvo.isOnLine); StartCoroutine(LoadImg()); } else { nameText.text = ""; readyImg.enabled = false; bankerImg.enabled = false; scoreText.text = ""; if (scoreImg != null) { scoreImg.gameObject.SetActive(false); } readyImg.enabled = false; avatarvo = null; // SpriteRenderer spr = gameObject.GetComponent<SpriteRenderer> (); // Texture2D texture =(Texture2D)Resources.Load ("Image/gift"); // Sprite sp = Sprite.Create (texture, spr.sprite.textureRect, new Vector2 (0.5f, 0.5f)); ShowOrDisShowHeadImage(1); headerIcon.sprite = Resources.Load("Image/head_img_male", typeof(Sprite)) as Sprite; } }
/** * 重新初始化数据 */ public static void reinitData() { isDrag = false; loginResponseData = null; // roomJoinResponseData = null; // roomVo = new RoomCreateVo(); hupaiResponseVo = null; finalGameEndVo = null; roomAvatarVoList = null; surplusTimes = 0; totalTimes = 0; reEnterRoomData = null; singalGameOverList = new List <GameObject>(); isonApplayExitRoomstatus = false; isOverByPlayer = false; loginVo = null; gameOver = false; }
private void setSeat(AvatarVO avatar) { //游戏结束后用的数据,勿删!!! if (avatar.account.uuid == GlobalDataScript.loginResponseData.account.uuid) { playerItems[0].gameObject.SetActive(true); playerItems[0].setAvatarVo(avatar); } else { int myIndex = getMyIndexFromList(); int curAvaIndex = avatarList.IndexOf(avatar); int seatIndex = curAvaIndex - myIndex; if (seatIndex < 0) { if (GlobalDataScript.roomVo.gameType == (int)GameTypePK.Tensanshui && GlobalDataScript.roomVo.typeOfTensanshui == (int)GameType.GameType_Tensanshui) //经典十三水 4人 { seatIndex = 4 + seatIndex; } else if (GlobalDataScript.roomVo.gameType == (int)GameType.GameType_Tensanshui && GlobalDataScript.roomVo.typeOfTensanshui == (int)GameType.GameType_Purecolor) //疯狂纯一色 { seatIndex = 4 + seatIndex; } else if (GlobalDataScript.roomVo.gameType == (int)GameType.GameType_Tensanshui && GlobalDataScript.roomVo.typeOfTensanshui == (int)GameType.GameType_Sevenandthree) //七人加三色 { seatIndex = 5 + seatIndex; } else if (GlobalDataScript.roomVo.gameType == (int)GameType.GameType_Tensanshui && GlobalDataScript.roomVo.typeOfTensanshui == (int)GameType.GameType_SevenmenOverlord) //七人霸王庄 { seatIndex = 10 + seatIndex; } } playerItems[seatIndex].gameObject.SetActive(true); playerItems[seatIndex].setAvatarVo(avatar); } }
private void zhuama(string allMas, List <int> vailedMa) { if (allMas == "" || allMas == null) { return; } if (zhuamaPanel == null) { List <AvatarVO> avatarList = new List <AvatarVO> (); int tempCount = 0; for (int i = 0; i < 4; i++) { AvatarVO avo = new AvatarVO(); avo.account = new Account(); avo.account.uuid = aa.playerItems [i].uuid; avatarList.Add(avo); } zhuamaPanel = PrefabManage.loadPerfab("prefab/Panel_ZhuaMa"); zhuamaPanel.GetComponent <ZhuMaScript> ().arrageMas(allMas, avatarList, vailedMa); } Invoke("frontZhuaMa", 7); }
public void setAvatarVo(AvatarVO value) { if (value != null) { avatarvo = value; readyImg.enabled = avatarvo.ready; bankerImg.enabled = avatarvo.main; nameText.text = avatarvo.account.nickName; scoreText.text = avatarvo.scores + ""; offlineImage.transform.gameObject.SetActive(!avatarvo.onLine); // StartCoroutine(LoadImg()); } else { nameText.text = ""; readyImg.enabled = false; bankerImg.enabled = false; scoreText.text = ""; readyImg.enabled = false; headerIcon.sprite = Resources.Load("Image/morentouxiang", typeof(Sprite)) as Sprite; } }
public void setAvatarVo(AvatarVO value) { if (value != null) { show.SetActive(true); avatarvo = value; readyImg.SetActive(avatarvo.isReady); bankerImg.enabled = avatarvo.main; nameText.text = avatarvo.account.nickname; scoreText.text = avatarvo.scores + ""; offlineImage.transform.gameObject.SetActive(!avatarvo.isOnLine); Sprite tempSp; if (avatarvo.account != null && string.IsNullOrEmpty(avatarvo.account.headicon) == false) { if (GlobalDataScript.imageMap.TryGetValue(avatarvo.account.headicon, out tempSp)) { headerIcon.sprite = tempSp; } else { StartCoroutine(LoadImg()); } } } else { show.SetActive(false); nameText.text = ""; readyImg.SetActive(false); bankerImg.enabled = false; scoreText.text = ""; // SpriteRenderer spr = gameObject.GetComponent<SpriteRenderer> (); // Texture2D texture =(Texture2D)Resources.Load ("Image/gift"); // Sprite sp = Sprite.Create (texture, spr.sprite.textureRect, new Vector2 (0.5f, 0.5f)); headerIcon.sprite = Resources.Load("Image/default_icon", typeof(Sprite)) as Sprite; } }
private void RoomBackResponse(ClientResponse response) { if (GlobalDataScript.gamePlayPanel != null) { GlobalDataScript.gamePlayPanel.GetComponent <MyMahjongScript>().exitOrDissoliveRoom(); } GlobalDataScript.reEnterRoomData = JsonMapper.ToObject <RoomJoinResponseVo>(response.message); for (int i = 0; i < GlobalDataScript.reEnterRoomData.playerList.Count; i++) { AvatarVO itemData = GlobalDataScript.reEnterRoomData.playerList[i]; if (itemData.account.openid == GlobalDataScript.loginResponseData.account.openid) { GlobalDataScript.loginResponseData.account.uuid = itemData.account.uuid; GlobalDataScript.loginResponseData.isOnLine = true; ChatSocket.getInstance().sendMsg(new LoginChatRequest(GlobalDataScript.loginResponseData.account.uuid)); break; } } GlobalDataScript.gamePlayPanel = PrefabManage.loadPerfab("Prefab/Panel_GamePlay"); }
/// <summary> /// 设置当前角色的座位 /// </summary> /// <param name="avatar">Avatar.</param> private void setSeat(AvatarVO avatar) { //游戏结束后用的数据,勿删!!! //GlobalDataScript.palyerBaseInfo.Add (avatar.account.uuid, avatar.account); if (avatar.account.uuid == GlobalDataScript.loginResponseData.account.uuid) { playerItems[0].setAvatarVo(avatar); } else { int myIndex = getMyIndexFromList(); int curAvaIndex = avatarList.IndexOf(avatar); Debug.Log("curAvaIndex=>" + curAvaIndex); int seatIndex = curAvaIndex - myIndex; if (seatIndex < 0) { seatIndex = 4 + seatIndex; } Debug.Log("seatIndex=>" + seatIndex); playerItems[seatIndex].setAvatarVo(avatar); } }
public void setUIData(AvatarVO userInfo) { if (userInfo != null) { headIconPath = userInfo.account.headicon; Ip.text = userInfo.IP; ID.text = userInfo.account.uuid + ""; name.text = userInfo.account.nickname; address.text = userInfo.address; Sprite tempSp; if (string.IsNullOrEmpty(headIconPath) == false) { if (GlobalDataScript.imageMap.TryGetValue(headIconPath, out tempSp)) { headIcon.sprite = tempSp; } else { StartCoroutine(LoadImg()); } } } }
} //加入房间 void createRoomAddAvatarVO(AvatarVO avatar) //创建房间 { avatar.scores = GlobalDataScript.roomVo.initFen_dzpk; addAvatarVOToList(avatar); setRoomRemark(); }
private void RoomBackResponse(ClientResponse response) { if (GlobalDataScript.homePanel != null) { GlobalDataScript.homePanel.GetComponent <HomePanelScript> ().removeListener(); Destroy(GlobalDataScript.homePanel); } GlobalDataScript.reEnterRoomData = JsonMapper.ToObject <RoomCreateVo> (response.message); GlobalDataScript.goldType = GlobalDataScript.reEnterRoomData.goldType; if (GlobalDataScript.gamePlayPanel != null) { if (GlobalDataScript.reEnterRoomData.gameType == (int)GameTypePK.NULL) { GlobalDataScript.gamePlayPanel.GetComponent <MyMahjongScript> ().exitOrDissoliveRoom(); } else if (GlobalDataScript.reEnterRoomData.gameType == (int)GameTypePK.PDK) { GlobalDataScript.gamePlayPanel.GetComponent <MyPDKScript> ().exitOrDissoliveRoom(); } else if (GlobalDataScript.reEnterRoomData.gameType == (int)GameTypePK.DN) { GlobalDataScript.gamePlayPanel.GetComponent <MyDNScript> ().exitOrDissoliveRoom(); } else if (GlobalDataScript.reEnterRoomData.gameType == (int)GameTypePK.DZPK) { GlobalDataScript.gamePlayPanel.GetComponent <MyDZPKScript> ().exitOrDissoliveRoom(); } else if (GlobalDataScript.reEnterRoomData.gameType == (int)GameTypePK.AMH) { GlobalDataScript.gamePlayPanel.GetComponent <MyDZPKScript>().exitOrDissoliveRoom(); } } for (int i = 0; i < GlobalDataScript.reEnterRoomData.playerList.Count; i++) { AvatarVO itemData = GlobalDataScript.reEnterRoomData.playerList [i]; if (itemData.account.openid == GlobalDataScript.loginResponseData.account.openid) { GlobalDataScript.loginResponseData.account.uuid = itemData.account.uuid; GlobalDataScript.loginResponseData.account.roomcard = itemData.account.roomcard; GlobalDataScript.loginResponseData.account.gold = itemData.account.gold; GlobalDataScript.loginResponseData.account.isCheat = itemData.account.isCheat; ChatSocket.getInstance().sendMsg(new LoginChatRequest(GlobalDataScript.loginResponseData.account.uuid)); break; } } if (GlobalDataScript.reEnterRoomData.gameType == (int)GameTypePK.NULL) { GlobalDataScript.gamePlayPanel = PrefabManage.loadPerfab("Prefab/Panel_GamePlay"); } else if (GlobalDataScript.reEnterRoomData.gameType == (int)GameTypePK.PDK) { GlobalDataScript.gamePlayPanel = PrefabManage.loadPerfab("Prefab/Panel_GamePDK"); } else if (GlobalDataScript.reEnterRoomData.gameType == (int)GameTypePK.DN) { GlobalDataScript.gamePlayPanel = PrefabManage.loadPerfab("Prefab/Panel_GameDN"); } else if (GlobalDataScript.reEnterRoomData.gameType == (int)GameTypePK.DZPK) { GlobalDataScript.gamePlayPanel = PrefabManage.loadPerfab("Prefab/Panel_GameDZPK"); } else if (GlobalDataScript.roomVo.gameType == (int)GameTypePK.AMH) { GlobalDataScript.gamePlayPanel = PrefabManage.loadPerfab("Prefab/Panel_GameAMH"); } removeListener(); Destroy(this); Destroy(gameObject); }
/* 玩家掉线后重新连接游戏*/ void reEnterRoom() { if (GlobalDataScript.reEnterRoomData != null) { //显示房间基本信息 GlobalDataScript.roomVo.roundNumber = GlobalDataScript.reEnterRoomData.roundNumber; GlobalDataScript.roomVo.roomId = GlobalDataScript.reEnterRoomData.roomId; GlobalDataScript.roomVo.gameType = GlobalDataScript.reEnterRoomData.gameType; GlobalDataScript.roomVo.initFen_dzpk = GlobalDataScript.reEnterRoomData.initFen_dzpk; setRoomRemark(); //确定自己和其它玩家 avatarList = GlobalDataScript.reEnterRoomData.playerList; GlobalDataScript.loginResponseData = avatarList[getMyIndexFromList()]; GlobalDataScript.count_Players_DN = avatarList.Count; GlobalDataScript.roomAvatarVoList = GlobalDataScript.reEnterRoomData.playerList; for (int i = 0; i < avatarList.Count; i++) { AvatarVO ava = avatarList[i]; setSeat(ava); if (ava.main) { bankerId = i; GlobalDataScript.mainUuid = ava.account.uuid; playerItems[getIndexByDir(getDirection(bankerId))].setbankImgEnable(true);//新一局游戏还没开始庄家是上一局的庄家不显示,因已经准备好,只是别人还没准备好 } if (avatarList[i].account.uuid == GlobalDataScript.loginResponseData.account.uuid && ava.isReady) { ready_Btn.gameObject.SetActive(false); } } GlobalDataScript.loginResponseData.account.roomcard = GlobalDataScript.reEnterRoomData.playerList[getMyIndexFromList()].account.roomcard; int[][] selfPaiArray = GlobalDataScript.loginResponseData.paiArray; if (selfPaiArray == null || selfPaiArray.Length == 0) {//游戏还没有开始 } else {//牌局已开始 ready_Btn.gameObject.SetActive(false); UpdateTimeReStart(); isGameStart = true; setAllPlayerReadImgVisbleToFalse(); cleanGameplayUI(); //initJiaZhuText();//加注按钮赋值,与创建房间的初始分有关 //initSliderZhuArray();//设置滑动条初始数组,与创建房间的初始分有关 initArrayList(); //显示打牌数据 mineList = ToList(selfPaiArray); DisplayHandCard(); for (int i = 0; i < 2; i++) { for (int j = 0; j < avatarList.Count; j++) { if (avatarList[j].scores > GlobalDataScript.roomVo.initFen_dzpk / 100) { int seat = getIndexByDir(getDirection(j)); if (seat == 0) { continue; } GameObject obj = Instantiate(Resources.Load("prefab/dn/HandCard_s_DN")) as GameObject; if (obj != null) { obj.transform.SetParent(handTransformList[seat]); obj.transform.localScale = new Vector3(1, 1, 1); handerCardList[seat].Add(obj); } } } } } } }