示例#1
0
    /// <summary>
    /// 发送验证码请求登陆
    /// nState = 1登陆 2绑定 3解绑
    /// </summary>
    public void SendCodeApplyLogin(uint ncode, byte nState)
    {
        if (!NetWorkClient.GetInstance().IsSocketConnected)
        {
            HallMain.ConnectLoginServer();
        }

        UMessage           LoginMsg  = new UMessage((uint)GameCity.EMSG_ENUM.CrazyCityMsg_CHECKINDENTIFYING);
        CheckCodeLogin_Msg msg_Check = new CheckCodeLogin_Msg();

        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            msg_Check.nPlatform = 1;
        }
        else if (Application.platform == RuntimePlatform.Android)
        {
            msg_Check.nPlatform = 2;
        }
        else
        {
            msg_Check.nPlatform = 0;
        }

        msg_Check.nBindOrLogin = nState;
        msg_Check.nCode        = ncode;
        msg_Check.smachinecode = SystemInfo.deviceUniqueIdentifier;

        msg_Check.SetSendData(LoginMsg);

        NetWorkClient.GetInstance().SendMsg(LoginMsg);
    }
示例#2
0
 private void LoginNetReconnectCallBack(object param)
 {
     if (HallMain.ConnectLoginServer())
     {
         LoginNetReconnectTimer.SetDeleteFlag(true);
     }
 }
示例#3
0
    void LocalFire(GameObject target)
    {
        if (BelongRole == null || BelongRole.m_nTotalCoin < m_nBulletCost)
        {
            LocalFireFail();
            return;
        }

        UMessage msg = new UMessage((uint)GameCity.EMSG_ENUM.CCMsg_FISHING_CM_APPLYFIRE);

        msg.Add(GameMain.hall_.GetPlayerId());
        msg.Add(transform.eulerAngles.z);
        msg.Add((byte)m_Data.m_szBulletPoint.Length);
        msg.Add(++m_nBulletId);
        HallMain.SendMsgToRoomSer(msg);

        OnFire(target, m_nBulletId);

        if (m_FireSound != null)
        {
            m_FireSound.volume = AudioManager.Instance.SoundVolume;
            m_FireSound.loop   = false;
            m_FireSound.Play();
        }

        BelongRole.UpdateInfoUI(BelongRole.m_nTotalCoin - m_nBulletCost);
    }
示例#4
0
    /// <summary>
    /// 获取验证码
    /// </summary>
    void OnBtn_GetCode(EventTriggerType eventtype, object button, PointerEventData eventData)
    {
        if (eventtype == EventTriggerType.PointerClick)
        {
            CustomAudio.GetInstance().PlayCustomAudio(1002);

            if (CanvasObj == null)
            {
                CanvasObj = GameObject.Find("Canvas/Root");
            }

            InputField PhonePanel = CanvasObj.transform.Find("Login").Find("Panel_PhoneLogin")
                                    .Find("InputField_PhoneNum").gameObject.GetComponent <InputField>();

            long phonenum = 0;
            if (!long.TryParse(PhonePanel.text, out phonenum))
            {
                CCustomDialog.OpenCustomConfirmUI(1003);
                return;
            }

            if (!GameCommon.CheckPhoneIsAble(PhonePanel.text))
            {
                CCustomDialog.OpenCustomConfirmUI(1003);
                return;
            }

            if (phonenum > 0)
            {
                if (!NetWorkClient.GetInstance().IsSocketConnected)
                {
                    HallMain.ConnectLoginServer();
                }
                SendApplyGetCode(phonenum, 1);

                //if(MobileCodeTimer == null)
                MobileCodeTimer = new CTimerPersecondCall(60f, UpdataGetCodeBtnText);
                xTimeManger.Instance.RegisterTimer(MobileCodeTimer);

                GameObject PhoneLogin = CanvasObj.transform.Find("Login").Find("Panel_PhoneLogin").gameObject;
                if (null != PhoneLogin)
                {
                    Button btn    = PhoneLogin.transform.Find("Button_GetCode").gameObject.GetComponent <Button>();
                    Image  btnimg = PhoneLogin.transform.Find("Button_GetCode").gameObject.GetComponent <Image>();
                    btn.interactable     = false;
                    btnimg.raycastTarget = false;

                    Text strCode = PhoneLogin.transform.Find("Button_GetCode").Find("Text_GetCode").gameObject.GetComponent <Text>();
                    strCode.text = "60S可重新获取";
                }
            }
        }
    }
示例#5
0
    void OnClickQuickMatch()
    {
        CustomAudio.GetInstance().PlayCustomAudio(1002);
        CCustomDialog.OpenCustomWaitUI("正在进入...");

        UMessage msg = new UMessage((uint)GameCity.EMSG_ENUM.CrazyCityMsg_CM_APPLYQUITSTARTGAME);

        msg.Add((byte)GameMain.hall_.GameBaseObj.GetGameType());
        msg.Add(GameMain.hall_.CurRoomIndex);
        msg.Add(GameMain.hall_.GetPlayerId());
        HallMain.SendMsgToRoomSer(msg);
    }
示例#6
0
    void OnClickDeskReady()
    {
        CustomAudio.GetInstance().PlayCustomAudio(1002);

        TableTfm.Find("bottom/Button_Ready").GetComponent <Button>().interactable = false;

        UMessage msg = new UMessage((uint)GameCity.EMSG_ENUM.CrazyCityMsg_CM_APPLYREADY);

        msg.Add((byte)GameMain.hall_.GameBaseObj.GetGameType());
        msg.Add(GameMain.hall_.GetPlayerId());
        HallMain.SendMsgToRoomSer(msg);
    }
示例#7
0
    // Use this for initialization
    void Start()
    {
        //Debug.Log("start");

        InitManager();
        LoadLua();

        testmobilehotfix();

        hall_ = new HallMain();
        hall_.Start();
    }
示例#8
0
    void OnHit(GameObject obj, Vector3 hitpoint, Canvas cv)
    {
        Fishing_Fish fish = obj.GetComponent <Fishing_Fish>();

        if (fish == null)
        {
            return;
        }

        Destroy(gameObject);

        GameObject prefab = (GameObject)OwnerCannon.BelongRole.GameBase.FishingAssetBundle.LoadAsset(m_szNet);

        Vector3   pos  = GameFunction.WorldToLocalPointInRectangle(hitpoint, Camera.main, cv, cv.worldCamera);
        Transform root = cv.transform.Find("Root");

        GameObject explosion = (GameObject)Instantiate(prefab, pos, Quaternion.identity);

        explosion.transform.SetParent(root, false);
        OwnerCannon.BelongRole.GameBase.m_AddItems.Add(explosion);

        prefab = (GameObject)OwnerCannon.BelongRole.GameBase.FishingAssetBundle.LoadAsset("FishHit");
        GameObject bubble = (GameObject)Instantiate(prefab, pos, Quaternion.identity);

        bubble.transform.SetParent(root, false);
        OwnerCannon.BelongRole.GameBase.m_AddItems.Add(bubble);

        GameMain.WaitForCall(1f, () =>
        {
            OwnerCannon.BelongRole.GameBase.m_AddItems.Remove(explosion);
            Destroy(explosion);

            OwnerCannon.BelongRole.GameBase.m_AddItems.Remove(bubble);
            Destroy(bubble);
        });

        bool bLocal = m_Id != 0;

        fish.OnHit(bLocal);

        if (bLocal)//local player send
        {
            UMessage msg = new UMessage((uint)GameCity.EMSG_ENUM.CCMsg_FISHING_CM_FIRERESULT);
            msg.Add(GameMain.hall_.GetPlayerId());
            msg.Add(fish.m_nOnlyId);
            msg.Add(m_Id);
            HallMain.SendMsgToRoomSer(msg);
        }
    }
示例#9
0
    void OnClickSit(ushort desk, sbyte sit)
    {
        CustomAudio.GetInstance().PlayCustomAudio(1002);

        DebugLog.Log("Click desk:" + desk + " sit:" + sit);

        CCustomDialog.OpenCustomWaitUI("正在进入...");

        UMessage msg = new UMessage((uint)GameCity.EMSG_ENUM.CrazyCityMsg_CM_APPLYENTERROOMANDSIT);

        msg.Add((byte)GameMain.hall_.GameBaseObj.GetGameType());
        msg.Add(GameMain.hall_.GetPlayerId());
        msg.Add(desk);
        msg.Add(sit);
        HallMain.SendMsgToRoomSer(msg);
    }
示例#10
0
    /// <summary>
    /// 请求发送验证码
    /// </summary>
    public void SendApplyGetCode(long nPhoneNum, byte nState)
    {
        if (!NetWorkClient.GetInstance().IsSocketConnected)
        {
            HallMain.ConnectLoginServer();
        }

        UMessage        LoginMsg  = new UMessage((uint)GameCity.EMSG_ENUM.CrazyCityMsg_MOBILELOGIN);
        MobileLogin_Msg msg_login = new MobileLogin_Msg();

        msg_login.nState     = nState;
        msg_login.nMobileNum = nPhoneNum;
        msg_login.SetSendData(LoginMsg);

        NetWorkClient.GetInstance().SendMsg(LoginMsg);
    }
示例#11
0
 public void SetUIAsLast()
 {
     if (m_nBystanderRoom > 0)
     {
         UMessage msg = new UMessage((uint)GameCity.EMSG_ENUM.CrazyCityMsg_APPLYTOBEONLOOKER);
         msg.Add(GameMain.hall_.GetPlayerId());
         msg.Add((uint)(GameKind_Enum.GameKind_CzMahjong));
         msg.Add(m_nBystanderRoom);
         HallMain.SendMsgToRoomSer(msg);
     }
     else
     {
         RoomTfm.SetAsLastSibling();
         if (TableTfm)
         {
             TableTfm.SetAsLastSibling();
             TableTfm.Find("bottom/Button_Ready").gameObject.SetActive(true);
         }
     }
 }
示例#12
0
    public void OnClickLevel(byte nAdd)
    {
        if (m_Cannon == null)
        {
            return;
        }

        UMessage msg = new UMessage((uint)GameCity.EMSG_ENUM.CCMsg_FISHING_CM_CHANGECANNONLEVEL);

        msg.Add(GameMain.hall_.GetPlayerId());
        msg.Add(nAdd);
        HallMain.SendMsgToRoomSer(msg);

        if (nAdd > 0)
        {
            m_LvAddBtn.interactable = false;
        }
        else
        {
            m_LvSubBtn.interactable = false;
        }
    }
示例#13
0
    /// <summary>
    /// unionid码登陆
    /// </summary>
    /// <param name="unionid"></param>
    private void UnionIdLogin(string unionid)
    {
        if (!NetWorkClient.GetInstance().IsSocketConnected)
        {
            HallMain.ConnectLoginServer();
        }
        CCustomDialog.OpenCustomWaitUI(1008);

        UMessage unionLoginMsg = new UMessage((uint)GameCity.EMSG_ENUM.CrazyCityMsg_PLAYERLOGIN);

        MessageLogin ml_ = new MessageLogin();

        ml_.smachinecode = SystemInfo.deviceUniqueIdentifier;
        ml_.sVersion     = GameMain.Instance.GetAppVersion();

        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            ml_.nPlatform = 1;
        }
        else if (Application.platform == RuntimePlatform.Android)
        {
            ml_.nPlatform = 2;
        }
        else
        {
            ml_.nPlatform = 0;
        }
        unionLoginMsg.Add((int)0);
        unionLoginMsg.Add(ml_.smachinecode);
        unionLoginMsg.Add(ml_.sVersion);
        unionLoginMsg.Add(ml_.nPlatform);
        unionLoginMsg.Add((byte)1);
        unionLoginMsg.Add(unionid);
        //unionLoginMsg.Add();
        //unionLoginMsg.Add(CWechatUserAuth.GetInstance().GetUserNickname());

        NetWorkClient.GetInstance().SendMsg(unionLoginMsg);
    }
示例#14
0
    /// <summary>
    /// 请求登陆
    /// </summary>
    public void RequestLogin(LoginType logintype = LoginType.LoginType_Guest)
    {
        if (logintype != LoginType.LoginType_LastOne)
        {
            enLoginType = logintype;
        }

        CCustomDialog.OpenCustomWaitUI(1008);
        if (!NetWorkClient.GetInstance().IsSocketConnected)
        {
            if (!HallMain.ConnectLoginServer())
            {
                if (LoginNetReconnectTimer == null)
                {
                    LoginNetReconnectTimer = new CTimerCirculateCall(3.0f, LoginNetReconnectCallBack);
                }
                xTimeManger.Instance.RegisterTimer(LoginNetReconnectTimer);
                return;
            }
        }

        if (bHavedGetGateServr)
        {
            if (enLoginType == LoginType.LoginType_Guest)
            {
                GuestLogin();
            }
            else if (enLoginType == LoginType.LoginType_Wechat)
            {
                WeChatAuthLogin();
            }
            else if (enLoginType == LoginType.LoginTyee_WechatQRCode)
            {
                WeChatAuthLogin();
            }
        }
    }
示例#15
0
    public void ChangeLockFish(Fishing_Fish fish)
    {
        if (fish == null)
        {
            return;
        }

        if (LockFish != null)
        {
            LockFish.Unlock(m_nIndex);
        }

        LockFish = fish;

        LockFish.Lock(m_nIndex);

        if (IsLocal())
        {
            UMessage msg = new UMessage((uint)GameCity.EMSG_ENUM.CCMsg_FISHING_CM_TRACECHANGETARGET);
            msg.Add(GameMain.hall_.GetPlayerId());
            msg.Add(LockFish.m_nOnlyId);
            HallMain.SendMsgToRoomSer(msg);
        }
    }
示例#16
0
    public void OnClickReturn(int index)//0:离开房间 1:继续 2:分享 3:退出
    {
        CustomAudio.GetInstance().PlayCustomAudio(1002);
        if (index == 0)
        {
            CCustomDialog.OpenCustomWaitUI("正在离开...");

            UMessage msg = new UMessage((uint)GameCity.EMSG_ENUM.CrazyCityMsg_CM_APPLYLEAVEROOMANDSIT);
            msg.Add((byte)GameMain.hall_.GameBaseObj.GetGameType());
            msg.Add(GameMain.hall_.GetPlayerId());
            HallMain.SendMsgToRoomSer(msg);
        }
        else if (index == 1)
        {
            GameMain.hall_.GameBaseObj.OnDisconnect(false);
            OnClickSit(0, -1);
        }
        else if (index == 3)
        {
            UMessage msg = new UMessage((uint)GameCity.EMSG_ENUM.CrazyCityMsg_CM_PLAYERLEAVEROOMSER);
            msg.Add(GameMain.hall_.GetPlayerId());
            HallMain.SendMsgToRoomSer(msg);
        }
    }
示例#17
0
 /// <summary>
 /// 游戏初始函数
 /// </summary>
 public virtual void Initialization()
 {
     HallMain.AdaptiveUI();
 }
示例#18
0
    void CheckDeskInView(bool send)
    {
        if (m_bUpdateDesk)
        {
            return;
        }

        float pos    = (1f - m_Scroll.verticalScrollbar.value) * (1f - m_fScreenHRatio);
        float posEnd = pos + m_fScreenHRatio;
        uint  begin  = (uint)(pos / m_fDeskHRatio);

        begin = begin * m_nDeskNumPerRow + 1;
        uint end = (uint)(posEnd / m_fDeskHRatio);

        end = (end + 1) * m_nDeskNumPerRow;
        if (end > m_nDeskNum)
        {
            end = m_nDeskNum;
        }

        if (send)
        {
            DebugLog.LogWarning("Inview:" + begin + "-" + end);

            ushort start = 0;
            ushort stop  = 0;
            for (uint i = begin; i <= end; i++)
            {
                RoomDeskInfo di = m_dictIndexDesks[i];
                if (!di.m_bInited)
                {
                    if (start == 0)
                    {
                        start = (ushort)i;
                    }
                }
                else if (start != 0)
                {
                    stop = (ushort)(i - 1);
                }
            }

            if (stop == 0)
            {
                stop = (ushort)end;
            }

            if (start != 0)
            {
                UMessage msg = new UMessage((uint)GameCity.EMSG_ENUM.CrazyCityMsg_CM_UPDATEBEFOREHANDROOMINFO);
                msg.Add((byte)GameMain.hall_.GameBaseObj.GetGameType());
                msg.Add(GameMain.hall_.CurRoomIndex);
                msg.Add(start);
                msg.Add((ushort)(stop - start + 1));
                HallMain.SendMsgToRoomSer(msg);

                DebugLog.Log("Request desk info:" + start + "-" + stop + "level:" + GameMain.hall_.CurRoomIndex);
            }
        }
        else
        {
            foreach (var di in m_dictIndexDesks)
            {
                di.Value.Show(di.Key >= begin && di.Key <= end);
            }
        }
    }
示例#19
0
    public void ReadPlayerData(UMessage playerData, ref float nLeftTime)
    {
        peopleNumber.Clear();
        GameList.Clear();

        PlayerName    = playerData.ReadString();
        PlayerID      = playerData.ReadUInt();
        PlayerIconId  = playerData.ReadUInt();
        PlayerIconUrl = playerData.ReadString();
        PlayerSexSign = playerData.ReadByte();
        PlayerCoin    = playerData.ReadLong();
        PlayerDiamond = playerData.ReadUInt();
        PlayerLottery = playerData.ReadLong();
        PlayerVipLv   = playerData.ReadByte();
        FlagValue     = playerData.ReadByte();
        IsChangeName  = (FlagValue & (0x1 << (int)AllOneLifeSign_Enum.AllOneLifeSign_ChangeName)) > 0;

        GuildID = playerData.ReadUInt();
        if (GuildID > 0)
        {
            GuildName = playerData.ReadString();
        }

        momentsid = playerData.ReadUInt();
        if (momentsid > 0)
        {
            momentName = playerData.ReadString();
        }
        Debug.Log("moments id:" + momentsid.ToString() + "momentsName:" + momentName);
        //GameIDFlag = playerData.ReadUInt();
        byte     gameNum = playerData.ReadByte();
        GameInfo gameInfo;

        for (byte index = 0; index < gameNum; index++)
        {
            gameInfo        = new GameInfo();
            gameInfo.gameId = playerData.ReadByte();
            peopleNumber.Add(gameInfo.gameId, playerData.ReaduShort());

            //if (gameInfo.gameId == 7 || gameInfo.gameId == 13) //GameKind_LandLords,GameKind_GuanDan
            {
                byte nNum = playerData.ReadByte();
                for (byte k = 0; k < nNum; k++)
                {
                    gameInfo.describeList.Add(playerData.ReadString());
                }
            }
            GameList.Add(gameInfo);
        }

        RechargeTotal    = (uint)playerData.ReadLong();
        nPayPlatform     = playerData.ReadUInt();
        BindMobileNumber = playerData.ReadLong();

        nGameMode_Before = playerData.ReadShort();
        if (nGameMode_Before > -1)
        {
            if (nGameMode_Before == 0)
            {
                //GameReason_Match
                nGameKind_Before      = playerData.ReadUInt();
                byGameSerIndex_Before = playerData.ReadByte();
                HallMain.SetRoomSerIndex(byGameSerIndex_Before);
            }
            else
            {
                // GameReason_Contest  GameReason_Appoint
                nGameKind_Before      = playerData.ReadByte();
                nSpecilID_Before      = playerData.ReadUInt();
                byGameSerIndex_Before = playerData.ReadByte();
                HallMain.SetRoomSerIndex(byGameSerIndex_Before);
                nSpecilID2_Before  = playerData.ReadUInt();
                nSpecilSign_Before = playerData.ReadByte();
            }
        }

        nLeftTime     = playerData.ReadSingle();
        nIsBindInvite = playerData.ReadByte();
        if (nIsBindInvite > 0 && nIsBindInvite < 200)
        {
            nIsBindAward   = playerData.ReadByte();
            nTodayAward    = playerData.ReadUInt();
            nTomorrowAward = playerData.ReadUInt();
        }

        newcomerGift  = playerData.ReadInt();
        discountsGift = playerData.ReadInt();
        newcomertime  = playerData.ReadSingle();

        weekSign            = playerData.ReadByte();
        weekAdd             = playerData.ReadByte();
        addUpWard           = playerData.ReadByte();
        ShopExchangeTurnOff = playerData.ReadBool();

        signedContests.Clear();
        byte length = playerData.ReadByte();

        for (int index = 0; index < length; index++)
        {
            signedContests.Add(playerData.ReadUInt());
        }

        creditScore      = playerData.ReadUInt();
        UnreceivedRedBag = playerData.ReadSingle();
        ReceivedRedBag   = playerData.ReadSingle();
        mailNumber       = playerData.ReadByte();
        itemNumber       = playerData.ReadByte();

        length = playerData.ReadByte();
        byte nKind = 0;

        for (int index = 0; index < length; index++)
        {
            nKind = playerData.ReadByte();
            MasterScoreKindArray[nKind] = playerData.ReadSingle();
        }

        NeedSign           = playerData.ReadByte();//0签到过 1未签到
        SignAward          = playerData.ReadUInt();
        ChessContestNumber = playerData.ReadByte();

        return;
    }