/// <summary> /// 更新游戏信息 /// </summary> /// <param name="_gameInfo">游戏信息结构体</param> public void UpdateGameInfo(HallTransfer.GameInfoS _gameInfo) { if (m_cGameInfo == null) { m_cGameInfo = new CGameItem.CGameInfo(); } m_cGameInfo.ID = _gameInfo.ID; m_cGameInfo.Installed = _gameInfo.Installed; m_cGameInfo.IsHot = _gameInfo.IsHot; m_cGameInfo.IsOpen = _gameInfo.IsOpen; m_cGameInfo.Name = _gameInfo.Name; m_cGameInfo.NeedUpdate = _gameInfo.NeedUpdate; m_cGameInfo.OnlineCnt = _gameInfo.OnlineCnt; m_cGameInfo.SortID = _gameInfo.SortID; m_cGameInfo.TypeID = _gameInfo.TypeID; //UI设置 if (m_sprGameicoSprite != null) { m_sprGameicoSprite.spriteName = "gameico_" + m_cGameInfo.ID.ToString(); } if (m_sprHoticoSprite != null) { m_sprHoticoSprite.gameObject.SetActive(m_cGameInfo.IsHot); } if (m_lblGameLabel != null) { m_lblGameLabel.text = m_cGameInfo.Name.ToString(); } if (m_sprGameName != null) { m_sprGameName.spriteName = "gamename_" + m_cGameInfo.ID.ToString(); } }
/// <summary> /// 添加游戏_休闲版 /// </summary> /// <param name="_gameInfo">游戏信息结构体</param> public void AddGameInfo_Relax(HallTransfer.GameInfoS _gameInfo, int i) { GameObject temp_obj = (GameObject)Instantiate(m_objGameItemPrefab, Vector3.zero, m_objGameItemPrefab.transform.localRotation); temp_obj.transform.name = "GameItem" + i.ToString(); temp_obj.transform.parent = m_objGameGrid.transform; i = (i % m_iCreatGamesNum); if (m_bIsCreatSixGames) { temp_obj.transform.localPosition = m_gameItemPoss[i]; } else { temp_obj.transform.localPosition = m_gameItemPoss[i + 6]; } temp_obj.transform.localScale = Vector3.zero; //temp_obj.SetActive(false); CGameItem gameItem = temp_obj.GetComponent <CGameItem>(); UIEventListener.Get(gameItem.gameObject).onClick = GameBtn_OnClick; gameItem.UpdateGameInfo(_gameInfo); m_lstGameItemList.Add(gameItem); m_lstGameItemList_Relax.Add(temp_obj); }
//通过NodeID分类 public void OnSendNodeItem() { List <SGameNodeItem> tempGameList = GameApp.GameListMgr.FindNodeList(); List <HallTransfer.GameInfoS> gameIDList = new List <HallTransfer.GameInfoS>(); foreach (SGameNodeItem tempName in tempGameList) { //pc if (((tempName.JoinID & 0x01) != 0) && !Application.isMobilePlatform || ((tempName.JoinID & 0x02) != 0) && Application.isMobilePlatform) { HallTransfer.GameInfoS tempNameInfo = new HallTransfer.GameInfoS(); tempNameInfo.TypeID = tempName.KindID; tempNameInfo.ID = tempName.NodeID; tempNameInfo.SortID = tempName.SortID; tempNameInfo.Name = tempName.Name; tempNameInfo.Installed = true; tempNameInfo.NeedUpdate = false; //tempNameInfo.Installed = GameApp.GameMgr.IsGameInstalled((int)tempName.KindID); // tempNameInfo.NeedUpdate = GameApp.GameMgr.IsGameNeedUpdate((int)tempName.KindID); gameIDList.Add(tempNameInfo); } } // HallTransfer.Instance.cnSetGameIDs(gameIDList);//发送游戏列表 CGameManager._instance.SetGameList(gameIDList); }
/// <summary> /// 添加游戏 /// </summary> /// <param name="_gameInfo">游戏信息结构体</param> public void AddGameInfo(HallTransfer.GameInfoS _gameInfo) { GameObject temp_obj = (GameObject)Instantiate(m_objGameItemPrefab, Vector3.zero, m_objGameItemPrefab.transform.localRotation); temp_obj.transform.name = "GameItem" + m_lstGameItemList.Count.ToString(); if (m_objGameGrid.GetComponent <UIGrid>() != null) { m_objGameGrid.GetComponent <UIGrid>().repositionNow = true; } temp_obj.transform.parent = m_objGameGrid.transform; temp_obj.transform.localScale = Vector3.zero; CGameItem gameItem = temp_obj.GetComponent <CGameItem>(); UIEventListener.Get(gameItem.gameObject).onClick = GameBtn_OnClick; gameItem.UpdateGameInfo(_gameInfo); m_lstGameItemList.Add(gameItem); }
/// <summary> /// 游戏按钮响应 /// </summary> /// <param name="_gameItem">游戏信息结构体</param> void GameBtn_OnClick(GameObject _gameItem) { for (int i = 0; i < m_lstGameItemList.Count; i++) { if (_gameItem.GetComponent <CGameItem>() == m_lstGameItemList[i]) { m_lstGameItemList[i].SetCheckedItemUI(); } else { m_lstGameItemList[i].SetNormalGameItemUI(); } } //发消息请求房间列表 if (CGameRoomManger._instance.m_objCurRoomGrid != null) { //房间列表 foreach (Transform child in CGameRoomManger._instance.m_objCurRoomGrid.transform) { if (child != null) { Destroy(child.gameObject, 0); } } } if (HallTransfer.Instance.ncGameBtnClick != null) { m_bolGameBtnClicked = true; //发送gameid m_objCurGameId = _gameItem.GetComponent <CGameItem>().m_cGameInfo.ID.ToString(); if (CGameRoomManger._instance.m_lblGameName != null) { CGameRoomManger._instance.m_lblGameName.text = _gameItem.GetComponent <CGameItem>().m_cGameInfo.Name; } HallTransfer.Instance.ncGameBtnClick(_gameItem.GetComponent <CGameItem>().m_cGameInfo.ID); UIEventListener.Get(CGameDeskManger._instance.m_ReturnBtn.gameObject).onClick = GameBtn_OnClick; HallTransfer.GameInfoS _gameInfo = new HallTransfer.GameInfoS(); _gameInfo.ID = _gameItem.GetComponent <CGameItem>().m_cGameInfo.ID; _gameInfo.Name = _gameItem.GetComponent <CGameItem>().m_cGameInfo.Name; CGameDeskManger._instance.m_ReturnBtn.UpdateGameInfo(_gameInfo); } }