Esempio n. 1
0
        //////////////////////////////////////////////////////////////////////////
        // ISocketEngineSink

        public override void onEventTCPSocketLink()
        {
            //变量定义


            switch (mMissionType)
            {
            case Type.MISSION_SEND_CHAT_DATA:
            {
                CMD_GP_CHAT kNetInfo = new CMD_GP_CHAT();
                kNetInfo.Init();

                GlobalUserInfo    pGlobalUserInfo = GlobalUserInfo.GetInstance();
                tagGlobalUserData pGlobalUserData = pGlobalUserInfo.GetGlobalUserData();
                kNetInfo.dwUserID = pGlobalUserData.dwUserID;

                Buffer.BlockCopy(pGlobalUserData.szNickName, 0, kNetInfo.szNickName, 0, pGlobalUserData.szNickName.Length);

                var szChatData = Encoding.UTF8.GetBytes(m_chatText);
                Buffer.BlockCopy(szChatData, 0, kNetInfo.szChatData, 0, szChatData.Length);

                Buffer.BlockCopy(pGlobalUserData.szHeadHttp, 0, kNetInfo.szHeadHttp, 0, pGlobalUserData.szHeadHttp.Length);

                var buf = StructConverterByteArray.StructToBytes(kNetInfo);
                send(MsgDefine.MDM_GP_USER_SERVICE, MsgDefine.SUB_GP_LOBBY_CHAT, buf, buf.Length);

                break;
            }

            default:
                stop();
                break;
            }
        }
        void OnFreeScence(byte[] data, int dataSize)
        {
            var typeValue     = typeof(CMD_S_StatusFree);
            int localDataSize = Marshal.SizeOf(typeValue);

            if (dataSize != localDataSize)
            {
                Debug.LogError("OnFreeScence:localDataSize=" + localDataSize + ", serverDataSize=" + dataSize);
                return;
            }

            CMD_S_StatusFree pNetInfo = (CMD_S_StatusFree)StructConverterByteArray.BytesToStruct(data, typeValue);

            GlobalUserInfo    pGlobalUserInfo = GlobalUserInfo.GetInstance();
            tagGlobalUserData pGlobalUserData = pGlobalUserInfo.GetGlobalUserData();

            pGlobalUserData.cbMapIndexRand = pNetInfo.cbMapIndex;
            pGlobalUserData.wRandseed      = pNetInfo.wRandseed;
            pGlobalUserData.wRandseedForRandomGameObject = pNetInfo.wRandseedForRandomGameObject;
            pGlobalUserData.wRandseedForInventory        = pNetInfo.wRandseedForInventory;
            //道具同步
            Array.Copy(pNetInfo.sInventoryList, pGlobalUserData.sInventoryList, pNetInfo.sInventoryList.Length);
            //Buffer.BlockCopy(pNetInfo.sInventoryList, 0, pGlobalUserData.sInventoryList, 0, pNetInfo.sInventoryList.Length);

            Loom.QueueOnMainThread(() =>
            {
                hnManager.LoadHideSeekSceneOfWangHu();
            });
        }
        private bool onSubQueryInfoResult(byte[] data, int size)
        {
            if (size != Marshal.SizeOf(typeof(CMD_GP_CheckInInfo)))
            ///if (size != sizeof(CMD_GP_CheckInInfo))
            {
                ///ASSERT(false);
                return(false);
            }

            CMD_GP_CheckInInfo pNetInfo = (CMD_GP_CheckInInfo)StructConverterByteArray.BytesToStruct(data, typeof(CMD_GP_CheckInInfo));
            ///CMD_GP_CheckInInfo* pNetInfo = (CMD_GP_CheckInInfo*)data;

            GlobalUserInfo    pGlobalUserInfo = GlobalUserInfo.GetInstance();
            tagGlobalUserData pGlobalUserData = pGlobalUserInfo.GetGlobalUserData();

            pGlobalUserData.wSeriesDate   = pNetInfo.wSeriesDate;
            pGlobalUserData.bTodayChecked = (pNetInfo.bTodayChecked != 0);
            //pGlobalUserData.wSeriesDate++;//hack

            if (mIGPSignInMissionSink != null)
            {
                mIGPSignInMissionSink.onSignInQueryInfoResult(pNetInfo);
            }

            stop();


            return(true);
        }
Esempio n. 4
0
        void modeHeadHttp()
        {
            GlobalUserInfo    pGlobalUserInfo = GlobalUserInfo.GetInstance();
            tagGlobalUserData pGlobalUserData = pGlobalUserInfo.GetGlobalUserData();

            m_kIndividualMission.modifyHeadHttp(pGlobalUserData.szHeadHttp);
        }
Esempio n. 5
0
    // Use this for initialization
    void Start()
    {
        //签到查询
        GameNet.UserInfo.getInstance().QuerySignIn();

        RegisterRaffleWindow = GameObject.Find("RegisterRaffleWindow");
        SignInDayUI          = new GameObject[maxSignInDay];

        if (RegisterRaffleWindow == null)
        {
            return;
        }

        SignInButton = RegisterRaffleWindow.transform.Find("RegisterButton").gameObject;
        //RaffleButton = RegisterRaffleWindow.transform.Find("RaffleButton").gameObject;
        //RaffleImageObj = RegisterRaffleWindow.transform.Find("RaffleImage").gameObject;

        GameNet.GlobalUserInfo    pGlobalUserInfo = GameNet.GlobalUserInfo.GetInstance();
        GameNet.tagGlobalUserData pGlobalUserData = pGlobalUserInfo.GetGlobalUserData();
        PlayCount   = pGlobalUserData.dwPlayCount;
        SeriesDate  = pGlobalUserData.wSeriesDate;
        RaffleCount = pGlobalUserData.dwRaffleCount;
        //System.Random rand = new System.Random();
        //SeriesDate = rand.Next(0,10);
        //SeriesDate = SeriesDate % 5;

        for (int i = 0; i < maxSignInDay; i++)
        {
            SignInDayUI[i] = RegisterRaffleWindow.transform.Find("RegisterImage" + i + "/RegisteredImage").gameObject;
            if (SignInDayUI[i] == null)
            {
                continue;
            }

            if (i < SeriesDate)
            {
                SignInDayUI[i].SetActive(true);
            }
            else
            {
                SignInDayUI[i].SetActive(false);
            }
        }

        // Raffle
        uint minPlayCountToRaffle = RaffleCount * PlayCountPerRaffle;

        if (minPlayCountToRaffle == 0)
        {
            minPlayCountToRaffle = PlayCountPerRaffle;
        }
        if (PlayCount < minPlayCountToRaffle)
        {
            if (RaffleButton != null)
            {
                RaffleButton.GetComponent <Button>().interactable = false;
            }
        }
    }
Esempio n. 6
0
    private void Start()
    {
        publicNotice = GetComponent <Text>();
        if (publicNotice != null)
        {
            GameNet.GlobalUserInfo    pGlobalUserInfo = GameNet.GlobalUserInfo.GetInstance();
            GameNet.tagGlobalUserData pGlobalUserData = pGlobalUserInfo.GetGlobalUserData();

            string szPublicNotice = GameNet.GlobalUserInfo.GBToUtf8(pGlobalUserData.szPublicNotice);
            publicNotice.text = szPublicNotice;
        }
    }
Esempio n. 7
0
        //////////////////////////////////////////////////////////////////////////
        ///
        /// // 登陆
        public bool sendLoginVisitor(CMD_GP_VisitorLogon VisitorAccount)
        {
            GlobalUserInfo    pGlobalUserInfo = GameNet.GlobalUserInfo.GetInstance();
            tagGlobalUserData pGlobalUserData = pGlobalUserInfo.GetGlobalUserData();

            Buffer.BlockCopy(mVisitorAccount.szPassWord, 0, pGlobalUserData.szPassword, 0,
                             mVisitorAccount.szPassWord.Length);

            //发送数据
            var buf = StructConverterByteArray.StructToBytes(mVisitorAccount);

            send(MsgDefine.MDM_GP_LOGON, MsgDefine.SUB_GP_LOGON_VISITOR, buf, buf.Length);
            return(true);
        }
Esempio n. 8
0
//登录完成
        bool onSocketSubLogonFinish(byte[] data, int size)
        {
            stop();

            if (mIGPLoginMissionSink != null)
            {
                mIGPLoginMissionSink.onGPLoginComplete();
            }

            GlobalUserInfo    pGlobalUserInfo = GlobalUserInfo.GetInstance();
            tagGlobalUserData pGlobalUserData = pGlobalUserInfo.GetGlobalUserData();

            pGlobalUserInfo.LoginSucess();
            return(true);
        }
Esempio n. 9
0
 public static long getUserScore()
 {
     if (m_pGlobalUserInfo != null && m_pGlobalUserInfo.GetGlobalUserData() != null)
     {
         return(m_pGlobalUserInfo.GetGlobalUserData().lUserScore);
     }
     else
     {
         return(0);
     }
 }
Esempio n. 10
0
        //发送登陆信息
        public bool sendLoginAccount(CMD_GP_LogonAccounts LoginAccount)
        {
            GlobalUserInfo    pGlobalUserInfo = GameNet.GlobalUserInfo.GetInstance();
            tagGlobalUserData pGlobalUserData = pGlobalUserInfo.GetGlobalUserData();

            Buffer.BlockCopy(LoginAccount.szPassword, 0, pGlobalUserData.szPassword, 0, LoginAccount.szPassword.Length);

            // for Match Time
            Debug.Log("登錄設置kindid");
            LoginAccount.wKindID = GameScene.KIND_ID_JianDe;

            //发送数据
            //var buf = StructConverterByteArray.StructToBytes<CMD_GP_LogonAccounts>(LoginAccount);
            var buf = StructConverterByteArray.StructToBytes(LoginAccount);

            send(MsgDefine.MDM_GP_LOGON, MsgDefine.SUB_GP_LOGON_ACCOUNTS, buf, buf.Length);
            return(true);
        }
        public void SendAwardData(uint dwAwardGlod = 10, byte cbCostType = 0)
        {
            Debug.LogWarning("------------SendAwardData");
            //变量定义
            GlobalUserInfo    pGlobalUserInfo = GlobalUserInfo.GetInstance();
            tagGlobalUserData pGlobalUserData = pGlobalUserInfo.GetGlobalUserData();

            CMD_C_AwardDone kNetInfo = new CMD_C_AwardDone();

            kNetInfo.Init();
            kNetInfo.dwUserID    = pGlobalUserData.dwUserID;
            kNetInfo.dwAwardGold = dwAwardGlod;
            kNetInfo.cbCostType  = cbCostType;
            Buffer.BlockCopy(pGlobalUserData.szPassword, 0, kNetInfo.szPassword, 0, pGlobalUserData.szPassword.Length);
            var buf = StructConverterByteArray.StructToBytes(kNetInfo);

            SendSocketData(HNMJ_Defines.SUB_C_AWARD_DONE, buf, (ushort)buf.Length);
        }
Esempio n. 12
0
        //发送注册信息
        public bool sendRegisterPacket(CMD_GP_RegisterAccounts RegisterAccount)
        {
            GlobalUserInfo    pGlobalUserInfo = GameNet.GlobalUserInfo.GetInstance();
            tagGlobalUserData pGlobalUserData = pGlobalUserInfo.GetGlobalUserData();

            Buffer.BlockCopy(RegisterAccount.szLogonPass, 0, pGlobalUserData.szPassword, 0,
                             RegisterAccount.szLogonPass.Length);

            // for Match Time
            Debug.Log("發送註冊信息");
            RegisterAccount.wKindID = GameScene.KIND_ID_JianDe;

            //发送数据
            var buf = StructConverterByteArray.StructToBytes(RegisterAccount);

            send(MsgDefine.MDM_GP_LOGON, MsgDefine.SUB_GP_REGISTER_ACCOUNTS, buf, buf.Length);
            return(true);
        }
Esempio n. 13
0
    private void CheckShowOrHideInput()
    {
        GameNet.GlobalUserInfo    pGlobalUserInfo = GameNet.GlobalUserInfo.GetInstance();
        GameNet.tagGlobalUserData pGlobalUserData = pGlobalUserInfo.GetGlobalUserData();
        if (pGlobalUserData.dwSpreaderID != 0)
        {
            //已经绑定代理人

            if (input != null)
            {
                input.transform.parent.gameObject.SetActive(false);
            }

            if (BindButton != null)
            {
                BindButton.SetActive(false);
            }

            if (BindedInviteNum != null)
            {
                BindedInviteNum.text = Surrogate.IdToInviteCode(pGlobalUserData.dwSpreaderID);
                BindedInviteNum.transform.parent.gameObject.SetActive(true);
            }
        }
        else
        {
            if (input != null)
            {
                input.transform.parent.gameObject.SetActive(true);
            }

            if (BindButton != null)
            {
                BindButton.SetActive(true);
            }

            if (BindedInviteNum != null)
            {
                BindedInviteNum.transform.parent.gameObject.SetActive(false);
            }
        }
    }
Esempio n. 14
0
        /*----------------IGPLoginMissionSink------------------------*/

        public void onGPLoginSuccess()
        {
            UnityEngine.Debug.Log("--IGPLoginMissionSink----------onGPLoginSuccess call---------");
            GlobalUserInfo    pGlobalUserInfo = GlobalUserInfo.GetInstance();
            tagGlobalUserData pGlobalUserData = pGlobalUserInfo.GetGlobalUserData();

            Loom.QueueOnMainThread(() =>
            {
                if (PlayerPrefs.HasKey("LocalHumanInfo"))  //登陆成功清除之前断线位置信息
                {
                    PlayerPrefs.DeleteKey("LocalHumanInfo");
                    PlayerPrefs.Save();
                }

                //PlayerPrefs.SetString("Accounts", Encoding.Default.GetString(pGlobalUserData.szAccounts));
                //PlayerPrefs.SetString("Accounts", Encoding.Default.GetString(pGlobalUserData.szPassword));
                LogIn.ShowNickNameForRegisterWin(false);
                Debug.Log("Go to Hall Scene1");
                SceneManager.LoadScene("GameHall");
            });
        }
Esempio n. 15
0
    // Use this for initialization
    void Start()
    {
        m_dwSpreaderID       = 0;
        m_dwParentSpreaderID = 0;
        m_wSpreaderLevel     = 1;
        m_infoIdxToRemove    = -1;

        m_szSpreaderRealName      = "";
        m_szSpreaderTelNum        = "";
        m_szSpreaderWeiXinAccount = "";

        m_infoItemObjList = new List <GameObject>();
        m_infoItemObjList.Clear();

        m_paymentInfoItemObjList = new List <GameObject>();
        m_paymentInfoItemObjList.Clear();
        m_dTotalGrantFromChildrenBuy = 0;

        if (LogText != null)
        {
            LogText.text = "";
            LogText.gameObject.SetActive(true);
        }

        GameNet.GlobalUserInfo    pGlobalUserInfo = GameNet.GlobalUserInfo.GetInstance();
        GameNet.tagGlobalUserData pGlobalUserData = pGlobalUserInfo.GetGlobalUserData();
        if (SelfInviteCodeText != null)
        {
            string strCode = IdToInviteCode(pGlobalUserData.dwUserID);
            uint   userId  = InviteCodeToId(strCode);
            SelfInviteCodeText.text = string.Format("您的邀请码是:{0}", strCode);
            SelfInviteCodeText.gameObject.SetActive(true);
        }

        //GameNet.tagSpreadersInfo pGlobalSpreadersInfo = pGlobalUserInfo.GetSpreadersInfo();
        //if(pGlobalSpreadersInfo.wItemCount==0)
        //{
        //    GameNet.UserInfo.getInstance().querySpreadersInfo(this);
        //}
    }
        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();   //更新钻石金币
                    }
                });
            }
        }
Esempio n. 17
0
        //////////////////////////////////////////////////////////////////////////
        // ISocketEngineSink

        public override void onEventTCPSocketLink()
        {
            //变量定义
            GlobalUserInfo    pGlobalUserInfo = GlobalUserInfo.GetInstance();
            tagGlobalUserData pGlobalUserData = pGlobalUserInfo.GetGlobalUserData();

            switch (mMissionType)
            {       // 查询
            case Type.MISSION_RAFFLE:
            {
                CMD_GP_RaffleDone kNetInfo = new CMD_GP_RaffleDone();
                kNetInfo.Init();

                kNetInfo.dwUserID     = pGlobalUserData.dwUserID;
                kNetInfo.dwRaffleGold = m_dwRaffleGold;

                Buffer.BlockCopy(pGlobalUserData.szPassword, 0, kNetInfo.szPassword, 0, pGlobalUserData.szPassword.Length);
                ///strncpy(kNetInfo.szPassword, pGlobalUserData->szPassword, countarray(kNetInfo.szPassword));

                var MachineID = DF.shared().GetMachineID();
                if (MachineID != null)
                {
                    Buffer.BlockCopy(MachineID, 0, kNetInfo.szMachineID, 0, MachineID.Length);
                }
                ///strncpy(kNetInfo.szMachineID, DF::shared()->GetMachineID(), countarray(kNetInfo.szMachineID));

                var buf = StructConverterByteArray.StructToBytes(kNetInfo);
                send(MsgDefine.MDM_GP_USER_SERVICE, MsgDefine.SUB_GP_RAFFLE_DONE, buf, buf.Length);
                ///send(MDM_GP_USER_SERVICE, SUB_GP_RAFFLE_DONE, &kNetInfo, sizeof(CMD_GP_CheckInDone));

                break;
            }

            default:
                stop();
                break;
            }
        }
Esempio n. 18
0
        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);
        }
Esempio n. 19
0
    // Update is called once per frame
    void Update()
    {
        GameNet.GlobalUserInfo    pGlobalUserInfo = GameNet.GlobalUserInfo.GetInstance();
        GameNet.tagGlobalUserData pGlobalUserData = pGlobalUserInfo.GetGlobalUserData();
        if (SeriesDate != pGlobalUserData.wSeriesDate)
        {
            SeriesDate = pGlobalUserData.wSeriesDate;

            ///SignInDayUI[SeriesDate].SetActive(true);
            for (int i = 0; i < maxSignInDay; i++)
            {
                if (SignInDayUI[i] == null)
                {
                    continue;
                }

                if (i < SeriesDate)
                {
                    SignInDayUI[i].SetActive(true);
                }
                else
                {
                    SignInDayUI[i].SetActive(false);
                }
            }
        }
        //if(PlayCount != pGlobalUserData.dwPlayCount)
        //{
        //    PlayCount = pGlobalUserData.dwPlayCount;
        //}
        //if (RaffleCount != pGlobalUserData.dwRaffleCount)
        //{
        //    RaffleCount = pGlobalUserData.dwRaffleCount;
        //}

        //uint minPlayCountToRaffle = RaffleCount * PlayCountPerRaffle;
        //if (minPlayCountToRaffle == 0)
        //{
        //    minPlayCountToRaffle = PlayCountPerRaffle;
        //}
        //if (PlayCount >= minPlayCountToRaffle)
        //{
        //    RaffleButton.GetComponent<Button>().interactable = true;
        //}
        //else
        //{
        //    RaffleButton.GetComponent<Button>().interactable = false;
        //}

        if (m_brot)
        {
            m_timer -= Time.deltaTime;
            if (m_timer <= 0.0f)
            {
                m_timer = 0.01f;
                //every 0.1s
                float temv = m_initV - m_tcount * m_deltav;
                RaffleImageObj.transform.Rotate(new Vector3(0, 0, temv));

                m_tcount += 1;
            }
            if (m_tcount >= m_endcount)
            {
                m_brot = false;
            }
        }
    }
Esempio n. 20
0
//登录成功
        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);
        }
Esempio n. 21
0
        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);
        }
        void OnPlayScence(byte[] data, int dataSize)
        {
            //旁观者或者重连

            var typeValue     = typeof(CMD_S_StatusPlay);
            int localDataSize = Marshal.SizeOf(typeValue);

            if (dataSize != localDataSize)
            {
                Debug.LogError("OnPlayScence:localDataSize=" + localDataSize + ", serverDataSize=" + dataSize);
                return;
            }

            CMD_S_StatusPlay pNetInfo = (CMD_S_StatusPlay)StructConverterByteArray.BytesToStruct(data, typeValue);

            GlobalUserInfo    pGlobalUserInfo = GlobalUserInfo.GetInstance();
            tagGlobalUserData pGlobalUserData = pGlobalUserInfo.GetGlobalUserData();

            pGlobalUserData.cbMapIndexRand = pNetInfo.cbMapIndex;
            pGlobalUserData.wRandseed      = pNetInfo.wRandseed;
            pGlobalUserData.wRandseedForRandomGameObject = pNetInfo.wRandseedForRandomGameObject;
            pGlobalUserData.wRandseedForInventory        = pNetInfo.wRandseedForInventory;
            //道具同步
            Array.Copy(pNetInfo.sInventoryList, pGlobalUserData.sInventoryList, pNetInfo.sInventoryList.Length);
            //Buffer.BlockCopy(pNetInfo.sInventoryList, 0, pGlobalUserData.sInventoryList, 0, pNetInfo.sInventoryList.Length);

            //旁观者
            int             nStatus = SocketDefines.US_NULL;
            IClientUserItem pMeItem = CServerItem.get().GetMeUserItem();

            if (pMeItem != null)
            {
                nStatus = pMeItem.GetUserStatus();
            }

            if (nStatus == SocketDefines.US_LOOKON)
            {
                Loom.QueueOnMainThread(() =>
                {
                    hnManager.LoadHideSeekSceneOfWangHu();
                });
            }
            else
            {
                //mChen add, temp
                Loom.QueueOnMainThread(() =>
                {
                    hnManager.LoadHideSeekSceneOfWangHu();
                });

                if (false)//if (!hnManager.bEnteredGameScene)
                {
                    //没进入游戏场景

                    //强杀进程后进来

                    Debug.LogError("OnPlayScence : 在大厅重连?强杀进程后回来?  cbGameStatus=" + pNetInfo.cbGameStatus + " UserStatus=" + nStatus + " bEnteredGameScene=" + hnManager.bEnteredGameScene);

                    //在大厅重连?
                    Loom.QueueOnMainThread(() =>
                    {
                        //hnManager.LoadHideSeekSceneOfWangHu();
                        //hnManager.SetLoading(false);

                        hnManager.StartOrStopGameSceneHeartBeat(false);
                        hnManager.LeaveRoom();
                        hnManager.LeaveGameToHall();
                        //CServerItem.get().IntermitConnect(true);
                    });
                }
            }

            //重连

            byte cbGameStatus = pNetInfo.cbGameStatus;

            Debug.Log("OnPlayScence : cbGameStatus=" + cbGameStatus + " UserStatus=" + nStatus + " bEnteredGameScene=" + hnManager.bEnteredGameScene);

            //mChen add, for HideSeek:
            //if (nStatus != SocketDefines.US_LOOKON && !hnManager.bEnteredGameScene)
            //{
            //    //在大厅重连?
            //    StartOrStopGameSceneHeartBeat(false);
            //    CServerItem.get().IntermitConnect(true);
            //    hnManager.LeaveRoom();
            //}

            defaultState();
        }