//提示消息(对话框方式??)0:确认 1:确认,取消 public int InsertPromptString(byte[] pszString, int iButtonType) { string strLog = GlobalUserInfo.GBToUtf8(pszString); GameSceneUIHandler.ShowLog(strLog); return(1); }
public void onGPLoginFailure(uint iErrorCode, byte[] szDescription) { if (iErrorCode == 3 || iErrorCode == 1) //账号未注册 { Loom.QueueOnMainThread(() => { LogIn.ShowNickNameForRegisterWin(true); }); //RegisterAccount(); } else if (iErrorCode == 7) //注册冲突问题,需要重新修改 { string strDescribe = GlobalUserInfo.GBToUtf8(szDescription); GameSceneUIHandler.ShowLog(strDescribe); } else { Debug.Log(Encoding.Default.GetString(szDescription)); //TimeManager::Instance().addCerterTimeCB(TIME_CALLBACK(HNScenceManager::InHomeScence, HNScenceManager::pInstance()), 3.0f); Loom.QueueOnMainThread(() => { SceneManager.LoadScene("GameLand"); }); } Loom.QueueOnMainThread(() => { if (PlayerPrefs.HasKey("ChoosedModelIndex")) { PlayerPrefs.DeleteKey("ChoosedModelIndex"); PlayerPrefs.Save(); } }); }
//系统消息(窗口输出) public bool InsertSystemStringScript(byte[] pszString) { string strLog = GlobalUserInfo.GBToUtf8(pszString); Debug.Log(strLog); GameSceneUIHandler.ShowLog(strLog); return(true); }
//普通消息(窗口输出) public bool InsertNormalString(byte[] pszString) { //NoticeMsg::Instance().ShowTopMsg(utility::a_u8(pszString)); string strLog = GlobalUserInfo.GBToUtf8(pszString); Debug.Log(strLog); GameSceneUIHandler.ShowLog(strLog); return(true); }
//系统消息(窗口输出) public bool InsertSystemString(byte[] pszString) { string strLog = Encoding.Default.GetString(pszString); Debug.Log(strLog); String[] str = strLog.Split(new string[] { "[", "]" }, StringSplitOptions.RemoveEmptyEntries); if (str.Length != 1) { int time = int.Parse(str[1]); if (time == 200) //Play-200s { Debug.Log("Play SOUND_TIPS_START_SEEK"); Loom.QueueOnMainThread(() => { hnManager.PlaySoundEffect(-1, (int)AudioManager.Sound_Effect_Defines.SOUND_TIPS_START_SEEK); }); } else if (time == 45 || time == 100) //Hide-45s,Play-100s,Play-45s { Debug.Log("Play SOUND_TIPS_STARTOREND"); Loom.QueueOnMainThread(() => { hnManager.PlaySoundEffect(-1, (int)AudioManager.Sound_Effect_Defines.SOUND_TIPS_STARTOREND); }); if (time == 45) { IClientUserItem pMeItem = CServerItem.get().GetMeUserItem(); byte Gamestate = CServerItem.get().GetGameStatus(); if (Gamestate == SocketDefines.GAME_STATUS_PLAY) { if (UIManager.GetInstance() != null) { UIManager.GetInstance().ShowMiddleTips("警察进入无敌状态"); } } } } else if (time == 5 || time == 4 || time == 3 || time == 2 || time == 1) { Debug.Log("Play SOUND_TIME_SEC"); Loom.QueueOnMainThread(() => { hnManager.PlaySoundEffect(-1, (int)AudioManager.Sound_Effect_Defines.SOUND_TIME_SEC); }); } } strLog = GlobalUserInfo.GBToUtf8(pszString); GameSceneUIHandler.ShowLog(strLog); return(true); }
public void OnSubAwardData(byte[] pBuffer, ushort wDataSize) { Debug.LogWarning("------------OnSubAwardData"); var typeValue = typeof(CMD_S_AwardResult); if (wDataSize != Marshal.SizeOf(typeValue)) { Debug.LogError("数据长度不符合"); return; } CMD_S_AwardResult pNetInfo = (CMD_S_AwardResult)StructConverterByteArray.BytesToStruct(pBuffer, typeValue); string strLog = GlobalUserInfo.GBToUtf8(pNetInfo.szNotifyContent); Debug.Log("OnSubAwardData: " + strLog); GlobalUserInfo pGlobalUserInfo = GlobalUserInfo.GetInstance(); tagGlobalUserData pGlobalUserData = pGlobalUserInfo.GetGlobalUserData(); if (pNetInfo.bSuccessed == 0) //成功 { //Success if (pNetInfo.cbCostType == 0) //奖励金币 { GlobalUserInfo.setUserScore(pNetInfo.lScore); GameSceneUIHandler.ShowLog("奖励10枚金币"); } else //奖励钻石 { GlobalUserInfo.setUserInsure(pNetInfo.lScore); GameSceneUIHandler.ShowLog("奖励10颗钻石"); } Loom.QueueOnMainThread(() => { if (UIManager.GetInstance() != null) { UIManager.GetInstance().UpdateUIInfo(); //更新钻石金币 } }); } }
private bool onSubRaffleResult(byte[] data, int size) { CMD_GP_RaffleResult pNetInfo = (CMD_GP_RaffleResult)StructConverterByteArray.BytesToStruct(data, typeof(CMD_GP_RaffleResult)); ///CMD_GP_RaffleResult* pNetInfo = (CMD_GP_RaffleResult*)data; string strLog = GlobalUserInfo.GBToUtf8(pNetInfo.szNotifyContent); //string strLog2 = Encoding.Default.GetString(pNetInfo.szNotifyContent); //string strLog3 = Encoding.GetEncoding(936).GetString(pNetInfo.szNotifyContent); //string strLog4 = Encoding.UTF8.GetString(pNetInfo.szNotifyContent); Debug.Log("CGPRaffleMission::onSubRaffleResult:" + strLog); GameSceneUIHandler.ShowLog(strLog); GlobalUserInfo pGlobalUserInfo = GlobalUserInfo.GetInstance(); tagGlobalUserData pGlobalUserData = pGlobalUserInfo.GetGlobalUserData(); if (pNetInfo.bSuccessed != 0) { //Success pGlobalUserData.lUserInsure = pNetInfo.lScore; pGlobalUserData.dwPlayCount = pNetInfo.dwPlayCount; pGlobalUserData.dwRaffleCount = pNetInfo.dwRaffleCount; pGlobalUserInfo.upPlayerInfo(); } stop(); //if (mIGPSignInMissionSink != null) //{ // mIGPSignInMissionSink.onSignInDoneResult(pNetInfo); //} return(true); }
//用户信息 //用户进入 public void OnGRUserEnter(IClientUserItem pIClientUserItem) { Debug.Log("GameManager::OnGRUserEnter: " + GlobalUserInfo.GBToUtf8(pIClientUserItem.GetNickName())); }
//登录成功 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); }
public void OnSubInventoryConsumption(byte[] pBuffer, ushort wDataSize) { Debug.LogWarning("------------OnSubInventoryConsumption"); var typeValue = typeof(CMD_S_InventoryConsumptionInfoResult); if (wDataSize != Marshal.SizeOf(typeValue)) { Debug.LogError("数据长度不符合"); return; } CMD_S_InventoryConsumptionInfoResult InfoResult = (CMD_S_InventoryConsumptionInfoResult)StructConverterByteArray.BytesToStruct(pBuffer, typeValue); string str = GlobalUserInfo.GBToUtf8(InfoResult.szDescribeString); Debug.Log("onSubInventoryConsumptionResult: " + str); if (InfoResult.cbSuccess == 0) //成功 { long ScoreNow = 0; if (InfoResult.cbCostType == 0) //金币 { ScoreNow = GlobalUserInfo.getUserScore(); GlobalUserInfo.setUserScore(InfoResult.dwFinalScore); } else //钻石 { ScoreNow = GlobalUserInfo.getUserInsure(); GlobalUserInfo.setUserInsure(InfoResult.dwFinalScore); } Loom.QueueOnMainThread(() => { if (InfoResult.cbItemID == (byte)ControlManager.InventoryItemID.Stealth) //开启隐身冷却时间 { if (UIManager.GetInstance() != null) { UIManager.GetInstance().StartColdTime(ControlManager.GetInstance().StealthButton, 60); } } if (UIManager.GetInstance() != null) { UIManager.GetInstance().UpdateUIInfo(); //更新钻石金币 if (InfoResult.cbCostType == 0) //金币 { if (ScoreNow != GlobalUserInfo.getUserScore()) { UIManager.GetInstance().ShowMiddleTips(str); } } else //钻石 { if (ScoreNow != GlobalUserInfo.getUserInsure()) { UIManager.GetInstance().ShowMiddleTips(str); } } } }); } else { GameSceneUIHandler.ShowLog(str); } }
private bool onSubDoneResult(byte[] data, int size) { CMD_GP_CheckInResult pNetInfo = (CMD_GP_CheckInResult)StructConverterByteArray.BytesToStruct(data, typeof(CMD_GP_CheckInResult)); ///CMD_GP_CheckInResult* pNetInfo = (CMD_GP_CheckInResult*)data; string strLog = GlobalUserInfo.GBToUtf8(pNetInfo.szNotifyContent); Debug.Log("CGPSignInMission::onSubDoneResult:" + strLog); GameSceneUIHandler.ShowLog(strLog); GlobalUserInfo pGlobalUserInfo = GlobalUserInfo.GetInstance(); tagGlobalUserData pGlobalUserData = pGlobalUserInfo.GetGlobalUserData(); if (pNetInfo.bSuccessed != 0) { //Success if (pNetInfo.bType == 0) { //签到结果返回 pGlobalUserData.wSeriesDate = pNetInfo.wSeriesDate; award(); } else { Loom.QueueOnMainThread(() => { HNGameManager.GetInstance.PlaySoundEffect(-1, (int)AudioManager.Sound_Effect_Defines.SOUND_SIGNGIN_AWARED); }); } pGlobalUserData.lUserInsure = pNetInfo.lScore; pGlobalUserInfo.upPlayerInfo(); //刷新UI Loom.QueueOnMainThread(() => { if (CreateOrJoinRoom.GetInstance != null) { CreateOrJoinRoom.GetInstance.UpdateInfo(); } }); } else { stop(); } if (pNetInfo.bType == 0) { //签到结果返回 } else { //签到奖励返回 stop(); } if (mIGPSignInMissionSink != null) { mIGPSignInMissionSink.onSignInDoneResult(pNetInfo); } return(true); }
//用户事件 //用户进入 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); } }