void Start() { if (hnManager == null) { hnManager = GameObject.FindObjectOfType <HNGameManager>(); } }
public GameBase(HNGameManager ma) { m_kIndividualMission = new CGPIndividualMission(System.Text.Encoding.Default.GetBytes(LoginScene.m_strServerIP), LoginScene.m_nLogonServerPort); m_kIndividualMission.setMissionSink(this); hnManager = ma; }
void Start() { if (hnGameManager == null) { hnGameManager = GameObject.FindObjectOfType <HNGameManager>(); } if (gamePlayUI_HT == null) { gamePlayUI_HT = GameObject.Find("CanvasGamePaly_demo"); } //if (listChatTextObj == null) //{ // listChatTextObj = new List<GameObject>(); // GameObject ChatTexts = gamePlayUI_HT.transform.Find("Chat/Texts").gameObject; // if (ChatTexts.transform.childCount > 0) // { // for (int i = 0; i < ChatTexts.transform.childCount; i++) // { // GameObject chat = ChatTexts.transform.GetChild(i).gameObject; // listChatTextObj.Add(chat); // } // listChatTextObj.Reverse(); // } //} }
// Use this for initialization void Start() { //scoreText默认值 scoreIdx = 0; scoreMark = baseScores[scoreIdx]; scoreText.text = scoreMark.ToString(); hnGameManager = GameObject.FindObjectOfType <HNGameManager>(); }
void Start() { hnGameManager = GameObject.FindObjectOfType <HNGameManager>(); AllRecordsWin.SetActive(true); DetailRecordWin.SetActive(false); recordsList = new List <GameObject>(); detailList = new List <GameObject>(); UpdateAllRecords(); }
void Start() { hnGameManager = GameObject.FindObjectOfType <HNGameManager>(); for (int i = 0; i < 9; i++) { cardValueToClipMap.Add(i + 11, i); cardValueToClipMap.Add(i + 21, i + 9); cardValueToClipMap.Add(i + 31, i + 18); } for (int i = 0; i < 4; i++) { cardValueToClipMap.Add(i + 41, i + 27); } for (int i = 0; i < 3; i++) { cardValueToClipMap.Add(i + 45, i + 31); } //init m_soundClipInfos m_cardClipInfos for (int place = (int)Sound_Place.Place_Start; place < (int)Sound_Place.PlaceNum; place++) { for (int iGender = 0; iGender < 2; iGender++) { string clipFilePlath = "Sounds/" + m_soundPlaceName[place] + "/"; if (iGender == 1) { clipFilePlath = clipFilePlath + "Male/"; } else { clipFilePlath = clipFilePlath + "Female/"; } for (int soundId = (int)Sound_Defines.Sound_Start; soundId < (int)Sound_Defines.SOUND_Num; soundId++) { string soundClipFilePlath = clipFilePlath + m_soundClipName[soundId]; m_soundClipInfos[place, iGender, soundId].clipFilePlath = soundClipFilePlath; } for (int cardClipId = 0; cardClipId < 9 + 9 + 9 + 7 + 1; cardClipId++) { string cardClipFilePlath = clipFilePlath + m_cardClipName[cardClipId]; m_cardClipInfos[place, iGender, cardClipId].clipFilePlath = cardClipFilePlath; } } } for (int effectId = (int)Sound_Effect_Defines.Sound_EFFECT_Start; effectId < (int)Sound_Effect_Defines.SOUND_EFFECT_Num; effectId++) { m_soundEffect[effectId].clipFilePlath = "Sounds/Effects/" + m_soundEffectClipName[effectId]; } for (int bgmId = (int)Sound_BGM_Difines.BGM1; bgmId < (int)Sound_BGM_Difines.BGM_Num; bgmId++) { m_BGM[bgmId].clipFilePlath = "Sounds/BGM/" + (bgmId + 1); } }
public static GameManagerBaseNet InstanceBase() { if (ms_pkInstanceBase == null) { ms_pkInstanceBase = new GameManagerBaseNet(); hnManager = GameObject.FindObjectOfType <HNGameManager>(); } return(ms_pkInstanceBase); }
public HNPrivateScenceBase(HNGameManager ma) { m_iJoinCout = (0); m_eLinkAction = (Type_LinkAction.Type_Link_NULL); m_kCreatePrivateNet = new CMD_GR_Create_Private(); m_kPrivateInfo = new CMD_GR_Private_Info(); m_kPrivateRoomInfo = new CMD_GF_Private_Room_Info(); CServerItem.get().SetServerPrivateSink(this); hnManager = ma; }
public bool SendCard(int cardValue, int dataIndex) { if (m_pLocal.GetChairID() == m_iCurrentUser && getGameState() == MJState.HNMJ_STATE_PLAYING && (m_pLocal.m_bCanDirectSendCard)) { preRemovedIndex = dataIndex; //if (m_kTouchSrcPos.y == HNMJPlayer::CARD_UP_POSY) { SendOutCard(HNGameManager.GetCardValueByte(cardValue)); } return(true); } return(false); }
public void OnLeaveMatchButtonClick() { if (_leaveMatchButton != null) { _leaveMatchButton.SetActive(false); } if (_showRoomUsersBtn != null) { _showRoomUsersBtn.SetActive(false); } if (m_hnGameManager == null) { m_hnGameManager = GameObject.FindObjectOfType <HNGameManager>(); } if (GameManager.s_gameSingleMultiType == GameSingleMultiType.SingleGame) { m_hnGameManager.StopSingleGame(); m_hnGameManager.LeaveGameToHall(); return; } int nStatus = SocketDefines.US_NULL; IClientUserItem pMeItem = null; if (CServerItem.get() != null) { pMeItem = CServerItem.get().GetMeUserItem(); } if (pMeItem != null) { nStatus = pMeItem.GetUserStatus(); } if (true)//if (nStatus == SocketDefines.US_LOOKON) { m_hnGameManager.PopLeaveRoomWindow(); } else { //_joinMatchButton.active = true; m_hnGameManager.DismissBtnClicked(); if (GameManager.s_NetWorkClient != null) { GameManager.s_NetWorkClient.LeaveMatchToRoom(); } } HideMatchStartCountDown(); HideWaitToJoinNextMatchLabel(); }
public void InitUserInfo(int recordIdx, ref tagUserInfo uInfo, int iIndex) { uInfo.wTableID = uInfo.wLastTableID = 0; var trueChairID = m_allRecords[recordIdx].localUserID; var cout = iIndex; while (--cout >= 0) { trueChairID = HNGameManager.getNextPlayerChairID(trueChairID); } uInfo.wChairID = (ushort)trueChairID; //userinfo里的内容是先存本人,然后其他人,所以索引和iIndex相同 uInfo.dwUserID = m_allRecords[recordIdx].userInfo[iIndex].IUserId; uInfo.cbGender = m_allRecords[recordIdx].userInfo[iIndex].BGender; Buffer.BlockCopy(m_allRecords[recordIdx].userInfo[iIndex].NickName, 0, uInfo.szNickName, 0, m_allRecords[recordIdx].userInfo[iIndex].NickName.Length); }
// Use this for initialization void Start() { hnManager = FindObjectOfType <HNGameManager>(); //Log框 GameObject serverLogObj = GameObject.Find("ServerLog"); if (serverLogObj != null) { serverLogObj.SetActive(true); DontDestroyOnLoad(serverLogObj.transform.parent.gameObject); m_serverLogText = serverLogObj.transform.Find("ServerLogText").GetComponent <Text>(); if (m_serverLogText != null) { m_serverLogText.text = ""; } } }
// Use this for initialization void Start() { //Check ipv6 m_bIsIpv6 = false; if (gameObject.name == "LandButton") { AddressFamily family = AddressFamily.InterNetwork; //ipv4转ipv6 - 苹果ios #if !UNITY_EDITOR && UNITY_IPHONE IPAddress[] address = Dns.GetHostAddresses("www.baidu.com"); if (address[0].AddressFamily == AddressFamily.InterNetworkV6) { family = AddressFamily.InterNetworkV6; Debug.Log("Is InterNetworkV6"); } else { family = AddressFamily.InterNetwork; Debug.Log("Is InterNetwork"); } #endif if (family == AddressFamily.InterNetworkV6) { m_bIsIpv6 = true; Image image = gameObject.GetComponent <Image>(); if (image != null) { image.sprite = Resources.Load("LandButtons/Button_GameIn", typeof(Sprite)) as Sprite; } } } var dddb = Loom.Current; hnManager = GameObject.FindObjectOfType <HNGameManager>(); eventHandle = GameObject.FindObjectOfType <EventHandle>(); //CustomNameWindow= GameObject.Find("Canvas/CustomNameWindow").gameObject; CustomNameWindow = gameObject.transform.parent.transform.Find("CustomNameWindow").gameObject; }
// Use this for initialization void Start() { Debug.Log("UIManager Start()"); if (m_hnGameManager == null) { m_hnGameManager = GameObject.FindObjectOfType <HNGameManager>(); } m_Canvas = GameObject.Find("CanvasGamePaly_demo"); _loseUIPopup = GameObject.Find("LosePopup"); HideLoseUI(); GameObject pickupTooFarTextObj = GameObject.Find("PickupTooFarText"); //_pickupTooFarText = pickupTooFarTextObj.GetComponent<Text>(); HidePickupTooFarText(); _pickupWrongUI = GameObject.Find("PickupWrongUI"); HidePickupWrongUI(); // Multi UI _matchStartCountDownUI = GameObject.Find("MatchStartCountDown"); //WQ changge //_matchStartCountDownText = _matchStartCountDownUI.GetComponent<Text>(); //_matchStartCountDownUI.active = false; //_joinMatchButton = GameObject.Find("JoinMatchButton"); //_joinMatchButton.active = false; _leaveMatchButton = GameObject.Find("LeaveMatchButton"); if (_leaveMatchButton != null) { _leaveMatchButton.SetActive(true); } _showRoomUsersBtn = GameObject.Find("ShowRoomUsersBtn"); if (_showRoomUsersBtn != null) { _showRoomUsersBtn.SetActive(false); } _backMatchButton = m_Canvas.transform.Find("BackMatchButton").gameObject; if (_backMatchButton != null) { _backMatchButton.SetActive(true); } _MiddleTips = m_Canvas.transform.Find("MiddleTips").gameObject; if (_MiddleTips != null) { _MiddleTips.SetActive(false); } _ManualControlTips = m_Canvas.transform.Find("ManualControlTips").gameObject; if (_ManualControlTips != null) { _ManualControlTips.SetActive(false); } _Glod = m_Canvas.transform.Find("Glod").gameObject; if (_Glod != null) { _Glod.SetActive(true); } _StatusTips = m_Canvas.transform.Find("StatusTips").gameObject; if (_StatusTips != null) { _StatusTips.SetActive(false); } TimeTip = m_Canvas.transform.Find("Time/TimeCount").gameObject; HideCount = m_Canvas.transform.Find("Time/UserCountBackground/HideCount").GetComponent <Text>(); TaggerCount = m_Canvas.transform.Find("Time/UserCountBackground/TaggerCount").GetComponent <Text>(); ControlSpriteR = m_Canvas.transform.Find("ControlSpriteR").gameObject; Sprite ctrName = Resources.Load <Sprite>("UI/Joystick/Conctrol"); if (ControlSpriteR != null) { ControlSpriteR.GetComponent <Image>().sprite = ctrName; } //GameStatusDeal(); //输赢窗口 LosePopup = m_Canvas.transform.Find("LosePopup").gameObject; WinPopup = m_Canvas.transform.Find("WinPopup").gameObject; }
void Start() { hnGameManager = GameObject.FindObjectOfType <HNGameManager>(); }
void Start() { //mChen add, try to fix返回大厅后,有小概率HideTeam会剩余一个没清除 GameObjectsManager.GetInstance().ClearPlayers(); m_fDeltaTimeAfterLastClick = 0f; Debug.Log("startcj"); Canvas = GameObject.Find("Canvas"); DiamondNum = Canvas.transform.Find("Diamond/DiamondCount").GetComponent <Text>(); GlodNum = Canvas.transform.Find("Glod/GlodCount").GetComponent <Text>(); StoreDiamonNum = Canvas.transform.Find("Window/StoreWindow/Diamond/DiamondCount").GetComponent <Text>(); StoreGlodNum = Canvas.transform.Find("Window/StoreWindow/Glod/GlodCount").GetComponent <Text>(); ExpNum = Canvas.transform.Find("Experience/ExperienceFill").GetComponent <Image>(); ExpNumTxt = Canvas.transform.Find("Experience/Level").GetComponent <Text>(); Name = Canvas.transform.Find("User/Name").GetComponent <Text>(); Name.text = GlobalUserInfo.getNickName(); ID = Canvas.transform.Find("User/ID").GetComponent <Text>(); ID.text = GlobalUserInfo.getUserID().ToString(); RoomIdValue = 0; hnGameManager = GameObject.FindObjectOfType <HNGameManager>(); //GameHall场景隐藏GameLogoUI hnGameManager.gameplayUIETC.SetActive(false); hnGameManager.gamePlayUI_HT.SetActive(false); HeadImage = Canvas.transform.Find("User/UserMask/UserImage").GetComponent <Image>(); if (hnGameManager != null) { //Sound Slider musicSlider = transform.Find("SetupWindow/Music/Slider").GetComponent <Slider>(); if (musicSlider != null) { musicSlider.value = hnGameManager.BackgroundAudioSource.volume; } Slider soundSlider = transform.Find("SetupWindow/Sound/Slider").GetComponent <Slider>(); if (soundSlider != null) { soundSlider.value = hnGameManager.GlobalEffectAudioSource.volume; } //Rule hnGameManager.m_baseScore = 1; hnGameManager.m_cbPlayCoutIdex = 0; hnGameManager.m_cbPlayCostTypeIdex = 1; //mChen add, for HideSeek hnGameManager.m_cbGameEndReason = HNMJ_Defines.GER_NOT_END; } //控制方案切换 ControlCase = Canvas.transform.Find("Window/SetupWindow/ControlCase").GetComponent <Button>(); ControlCase.gameObject.GetComponent <Image>().sprite = Resources.Load("UI/EasyTouchCase/" + HNGameManager.ControlCase, typeof(Sprite)) as Sprite; ControlCase.onClick.RemoveAllListeners(); ControlCase.onClick.AddListener(() => { HNGameManager.ControlCase++; HNGameManager.ControlCase %= 4; ControlCase.gameObject.GetComponent <Image>().sprite = Resources.Load("UI/EasyTouchCase/" + HNGameManager.ControlCase, typeof(Sprite)) as Sprite; }); //ControlType.Add(Canvas.transform.Find("Window/SetupWindow/Joystick/ChangeWindow/BackImage/Joystick1").gameObject.GetComponent<Toggle>()); //ControlType.Add(Canvas.transform.Find("Window/SetupWindow/Joystick/ChangeWindow/BackImage/Joystick2").gameObject.GetComponent<Toggle>()); UpdateControlType(); UserInfo.getInstance().reqAccountInfo(); }
//登录成功 bool onSocketSubLogonSuccess(byte[] data, int size) { //登陆成功 CMD_GP_LogonSuccess pData = (CMD_GP_LogonSuccess)StructConverterByteArray.BytesToStruct(data, typeof(CMD_GP_LogonSuccess)); // for Match Time Loom.QueueOnMainThread(() => { if (hnManager == null) { hnManager = GameObject.FindObjectOfType <HNGameManager>(); } hnManager.m_matchStartTime = pData.MatchStartTime; hnManager.m_matchEndTime = pData.MatchEndTime; }); //变量定义 GlobalUserInfo pGlobalUserInfo = GameNet.GlobalUserInfo.GetInstance(); tagGlobalUserData pGlobalUserData = pGlobalUserInfo.GetGlobalUserData(); pGlobalUserData.lUserScore = pData.lUserScore; pGlobalUserData.lUserInsure = pData.lUserInsure; // for签到 pGlobalUserData.wSeriesDate = pData.wSeriesDate; // 已打场次,for抽奖 pGlobalUserData.dwPlayCount = pData.dwPlayCount; //WQ add,抽奖记录 pGlobalUserData.dwRaffleCount = pData.dwRaffleCount; pGlobalUserData.dwPlayCountPerRaffle = pData.dwPlayCountPerRaffle; // 代理 pGlobalUserData.iSpreaderLevel = pData.iSpreaderLevel; // -1:不是代理人 // for HideSeek:查询警察模型库 pGlobalUserData.lModelIndex0 = pData.lModelIndex0; pGlobalUserData.bGPIsForAppleReview = (pData.cbGPIsForAppleReview != 0); //WQ 头像Http string szHeadHttp = GlobalUserInfo.GBToUtf8(pData.szHeadHttp); Buffer.BlockCopy(pData.szHeadHttp, 0, pGlobalUserData.szHeadHttp, 0, pData.szHeadHttp.Length); //WQ add,公告信息 string szPublicNotice = GlobalUserInfo.GBToUtf8(pData.szPublicNotice); Buffer.BlockCopy(pData.szPublicNotice, 0, pGlobalUserData.szPublicNotice, 0, pData.szPublicNotice.Length); //保存信息 pGlobalUserData.wFaceID = pData.wFaceID; pGlobalUserData.cbGender = pData.cbGender; pGlobalUserData.dwUserID = pData.dwUserID; pGlobalUserData.dwGameID = pData.dwGameID; pGlobalUserData.dwSpreaderID = pData.dwSpreaderID; pGlobalUserData.dwExperience = pData.dwExperience; pGlobalUserData.cbInsureEnabled = pData.cbInsureEnabled; Debug.Log("onSocketSubLogonSuccess " + Encoding.Default.GetString(pData.szNickName)); Buffer.BlockCopy(pData.szNickName, 0, pGlobalUserData.szNickName, 0, pData.szNickName.Length); // strcpy(pGlobalUserData.szNickName, utility::a_u8((char*)pData.szNickName).c_str()); Buffer.BlockCopy(pData.szAccounts, 0, pGlobalUserData.szAccounts, 0, pData.szAccounts.Length); // strncpy(pGlobalUserData.szAccounts, ((char*)pData.szAccounts), countarray(pGlobalUserData.szAccounts)); //金币信息 pGlobalUserInfo.upPlayerInfo(); if (mIGPLoginMissionSink != null) { mIGPLoginMissionSink.onGPLoginSuccess(); } return(true); }
IEnumerator DirectShareIcon(Platform p) { yield return(new WaitForEndOfFrame()); HNGameManager.Share(p); }
void Start() { hnManger = GameObject.Find("HNGameManager").GetComponent <HNGameManager>(); eventHandle = GameObject.FindObjectOfType <EventHandle>(); }
public GameScene(HNGameManager ma) : base(ma) { init(); }
//用户事件 //用户进入 public virtual void OnEventUserEnter(IClientUserItem pIClientUserItem, bool bLookonUser) { if (HNGameManager.LockObjOfLoadScene == null) { Debug.LogError("HNGameManager.LockObjOfLoadScene == null"); HNGameManager.LockObjOfLoadScene = new object(); } lock (HNGameManager.LockObjOfLoadScene) { GamePlayer pPlayer = getGamePlayerByUserItem(pIClientUserItem); if (pPlayer != null) { pPlayer.upPlayerInfo(); return; } } if (CServerItem.get() == null) { Debug.LogError("OnEventUserEnter:ServerItem.get() == null"); return; } IClientUserItem pMeItem = CServerItem.get().GetMeUserItem(); if (pMeItem == null) { return; } if (pMeItem.GetTableID() != pIClientUserItem.GetTableID()) { return; } if (pIClientUserItem.GetUserStatus() == SocketDefines.US_LOOKON) { return; } //UI Log string strNickName = GlobalUserInfo.GBToUtf8(pIClientUserItem.GetNickName()); Debug.Log("---------------------OnEventUserEnter:" + strNickName); String[] strName = strNickName.Split(new char[] { '\0' }, StringSplitOptions.RemoveEmptyEntries); if (strName.Length > 0) { Loom.QueueOnMainThread(() => { if (ChatSystem.GetInstance != null) { ChatSystem.GetInstance.ShowChatText("通知", strName[0] + " 加入了房间!"); } }); } if (CServerItem.get().GetMeUserItem() == pIClientUserItem) { Debug.Log("OnEventUserEnter:Local Player Enter"); if (m_pSelfPlayer == null) { Debug.Log("---------------------Disconnect back 2 ?: Try to Create Local Player"); //GameObject LocalTaggerObj = GameObject.Find("Player/TaggerTeam/LocalTagger"); //GameObject.Destroy(LocalTaggerObj); //删除Human //GameObjectsManager.GetInstance().ClearPlayers(false); m_pSelfPlayer = CreatePlayer(pIClientUserItem); Loom.QueueOnMainThread(() => { if (hnManager == null) { hnManager = GameObject.FindObjectOfType <HNGameManager>(); } if (hnManager != null) { if (m_pSelfPlayer != null) { int nChairId = m_pSelfPlayer.GetChairID();//m_pSelfPlayer hnManager.LocalUserEnter(nChairId); } } }); addGamePlayerToList(m_pSelfPlayer); } upSelfPlayerInfo(); int iIdex = 0; while (true) { IClientUserItem pTempUserItem = CServerItem.get().GetTableUserItem((ushort)iIdex); iIdex++; if (pTempUserItem == null) { break; } if (pTempUserItem.GetTableID() != pMeItem.GetTableID()) { continue; } if (pTempUserItem.GetUserStatus() == SocketDefines.US_LOOKON) { continue; } if (m_bEnterGetUserInfo) { m_kIndividualMission.query((int)pIClientUserItem.GetUserID(), false); } if (pTempUserItem == pIClientUserItem) { continue; } GamePlayer pTempPlayer = CreatePlayer(pTempUserItem); addGamePlayerToList(pTempPlayer); } } else { if (m_pSelfPlayer != null || pMeItem.GetUserStatus() == SocketDefines.US_LOOKON) { GamePlayer pTempPlayer = CreatePlayer(pIClientUserItem); addGamePlayerToList(pTempPlayer); } } if (m_bEnterGetUserInfo) { m_kIndividualMission.query((int)pIClientUserItem.GetUserID(), false); } }
// Use this for initialization protected void Start() { m_hnGameManager = GameObject.FindObjectOfType <HNGameManager>(); if (gameObject.tag == "LocalHuman") { _controller = transform.GetComponent <CharacterController>(); if (_controller == null) { _controller = gameObject.AddComponent <CharacterController>(); Renderer render = null; if (TeamType == PlayerTeam.PlayerTeamType.HideTeam) { GameObject ModelObj = gameObject.transform.GetChild(0).gameObject; if (ModelObj.transform.childCount == 0) //整体模型 { render = ModelObj.GetComponent <Renderer>(); } else if (ModelObj.transform.childCount > 0) //多段模型 { render = ModelObj.transform.GetChild(0).GetComponent <Renderer>(); } } if (render != null) { float min = render.bounds.size.x; if (min > render.bounds.size.y) { min = render.bounds.size.y; } if (min > render.bounds.size.z) { min = render.bounds.size.z; } _controller.radius = min / 2f; _controller.height = render.bounds.size.y; _controller.center = new Vector3(0, _controller.height / 2f, 0); _controller.skinWidth = _controller.radius * 0.1f; _controller.minMoveDistance = 0; _controller.stepOffset = _controller.height * 0.3f / 2; } else { _controller.height = 1.7f; _controller.center = new Vector3(0, _controller.height / 2f, 0); _controller.skinWidth = _controller.radius * 0.1f; _controller.minMoveDistance = 0; _controller.stepOffset = _controller.height * 0.3f / 2; } } SetJumpSpeed(_controller); } // Disable local human rendering: if (IsLocalHuman() && TeamType == PlayerTeam.PlayerTeamType.TaggerTeam) { //DisableModelDisplay();//mChen } if (TeamType == PlayerTeam.PlayerTeamType.HideTeam) { if (_controller) { //_controller.height = 1f; } } if (_controller) { //_controller.stepOffset = 0.1f; } m_lastPlayerPos = transform.position; }
public void StartRecord(HNGameManager hnGameManager) { Debug.LogError("StartRecord"); return; #if UNITY_STANDALONE if (HNGameManager.m_iLocalChairID != 0) { return; } #endif var kernel = (GameScene)CServerItem.get().GetClientKernelSink(); CurrentRecordCount = PlayerPrefs.GetInt("RecordNum", 0); var dirStr = ""; var trueRecord = CurrentRecordCount; if (kernel.getPlayCount() == 1)//新的一场游戏 { CurrentRecordCount++; PlayerPrefs.SetInt("RecordNum", CurrentRecordCount); DirectoryInfo dInfo = new DirectoryInfo(Application.persistentDataPath + string.Format("/{0}", DateTime.Now.ToString("yyyyMMddhhmmss"))); dInfo.Create(); Debug.Log("creating saved Dir :" + dInfo.FullName); if (CurrentRecordCount > MaxRecordCount) { trueRecord = (CurrentRecordCount % (MaxRecordCount + 1)) + 1; //删除之前的文件夹 dirStr = PlayerPrefs.GetString(string.Format("RecordFile{0}", trueRecord)); Debug.Log("deleting saved dir :" + dirStr); var oldDirInfo = new DirectoryInfo(dirStr); oldDirInfo.Delete(true); } else { trueRecord = CurrentRecordCount; } Debug.Log("dir full name " + dInfo.FullName); PlayerPrefs.SetString(string.Format("RecordFile{0}", trueRecord), dInfo.FullName); dirStr = dInfo.FullName; FileStream fInfo = new FileStream(string.Format("{0}/recordInfo.save", dInfo.FullName), FileMode.OpenOrCreate); bwWriter = new BinaryWriter(fInfo); bwWriter.Write(hnGameManager.TempRoomId); bwWriter.Write(hnGameManager.CreateUserID); bwWriter.Write(hnGameManager.totalcount); bwWriter.Write(HNGameManager.m_iLocalChairID); userInfoStorages = new UserInfoStorage[4]; hnGameManager.SaveUserInfo(ref userInfoStorages); savedUserInfoData = new UserInfoStruct[4]; for (int i = 0; i < userInfoStorages.Length; i++) { savedUserInfoData[i] = new UserInfoStruct { BGender = userInfoStorages[i].BGender, IUserId = userInfoStorages[i].IUserId, NickName = new byte[SocketDefines.LEN_NICKNAME] }; var nickBuf = Encoding.UTF8.GetBytes(userInfoStorages[i].NickName); Buffer.BlockCopy(nickBuf, 0, savedUserInfoData[i].NickName, 0, SocketDefines.LEN_NICKNAME); var infoBuf = StructConverterByteArray.StructToBytes(savedUserInfoData[i]); bwWriter.Write(infoBuf, 0, infoBuf.Length); } bwWriter.Flush(); bwWriter.Close(); fInfo.Close(); } else { if (CurrentRecordCount > MaxRecordCount) { trueRecord = (CurrentRecordCount % (MaxRecordCount + 1)) + 1; } Debug.Log("True record is " + trueRecord); dirStr = PlayerPrefs.GetString(string.Format("RecordFile{0}", trueRecord)); } fs = new FileStream(string.Format("{0}/recordInfo.save", dirStr), FileMode.Append); bwWriter = new BinaryWriter(fs); bwWriter.Write(DateTime.Now.ToString("yyyyMMddhhmmss")); bwWriter.Flush(); bwWriter.Close(); fs.Close(); Debug.Log("dirStr path: " + dirStr); //DirectoryInfo dInfo = new DirectoryInfo(Application.persistentDataPath); //var files = dInfo.GetFiles() fs = new FileStream(string.Format("{0}/{1}.save", dirStr, hnGameManager.nowcount), FileMode.OpenOrCreate); Debug.Log("writing saved file :" + fs.Name); bwWriter = new BinaryWriter(fs); bRecording = true; msgQueue.Clear(); }