Esempio n. 1
0
        void Update()
        {
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                if (!PlatformBase.sdkInterface.OnExit())
                {
                    MsgBoxPanel.ShowMsgBox(string.Empty, (string)ApplicationConst.dictStaticText["25"], 2, new MsgBoxPanel.MsgCallback(() => { ApplicationEntry.HandleExit(); }), null, "ExitGame");
                }
            }
#if UNITY_IOS || UNITY_ANDROID
            else if (ApplicationConst.bGM)
            {
                fCurZ = Input.acceleration.z;
                if (fCurZ > 0f)
                {
                    fTempZ = fCurZ - fLastZ;
                    fLastZ = fCurZ;
                    if (fTempZ > 0.8f && null != GMPanel.GetInst())
                    {
                        GMPanel.GetInst().OpenPanel();
                    }
                }
            }
#elif UNITY_STANDALONE
            else if (ApplicationConst.bGM && Input.GetKeyDown(KeyCode.F12))
            {
                if (null != GMPanel.GetInst())
                {
                    GMPanel.GetInst().BeShowWnd();
                }
            }
#endif
        }
Esempio n. 2
0
 public void OnClickCoin()
 {
     if (PlayerData.Coin < int.Parse(Coin))
     {
         MsgBoxPanel.ShowMsgBox("Warning", string.Format("Not enough Coins !"), 1);
         return;
     }
     MsgBoxPanel.MsgCallback OnOk = () => { CommonCommand.ExecuteLongMain(Client2ServerList.GetInst().C2S_STORE_BUY_HERO, new ArrayList()
         {
             (byte)HeroId, true
         }); };
     MsgBoxPanel.ShowMsgBox("Buy Hero", string.Format("Spend {0} Coins to buy {1} ?", Coin, Name.text), 2, OnOk);
 }
Esempio n. 3
0
        public const int SCONNECT_EXCEPTION = 4;                //短连接错误(登陆)

        public override void ProcessMessage(ConnectBase conn, ByteBuffer data)
        {
            int errCode;
            int moduleId = data.readByte();

            switch (moduleId)
            {
            case SCONNECT_EXCEPTION:
                errCode = data.readInt();
                MsgBoxPanel.MsgCallback Reconnect = () =>
                {
                    ConnectShort co = (ConnectShort)conn;
                    SocketHandler.GetInst().ShortSend(co.m_Data, co.m_bFlag, co.m_bNeedEncrypt);
                    SocketHandler.ShortSendBackFun();
                };
                MsgBoxPanel.ShowMsgBox(errCode.ToString(), (string)ApplicationConst.dictStaticText["22"], 1, Reconnect);
                break;

            default:
                break;
            }
        }
Esempio n. 4
0
        private void OnDefaultLogin()
        {
            string account = accountInput.text;

            if (account == string.Empty)
            {
                if (!accountPanel.activeSelf)
                {
                    accountPanel.SetActive(true);
                }
                else
                {
                    MsgBoxPanel.ShowMsgBox(string.Empty, ConfigData.GetStaticText("15001"), 1);
                }

                return;
            }

            PlayerInfo.Account = account;
            PlayerInfo.Token   = passwordInput.text;

            OnPlatformLogin();
        }
Esempio n. 5
0
        private const int LONG_MESSAGE_END   = 5;               //长链接消息结束

        public override void ProcessMessage(ConnectBase conn, ByteBuffer data)
        {
            int type, errCode;
            int moduleId = data.readByte();

            switch (moduleId)
            {
            case LONG_CONNECTED:
                type = data.readByte();
                if (type == 0)
                {
                    LoginPanel.GetInst().OnPlatformLogin();
                }
                else
                {
                    CommonCommand.ExecuteLongBattle(Client2ServerList.GetInst().C2S_BATTLE_LOGIN, new ArrayList()
                    {
                        PlayerData.PlayerId
                    });
                }

                //ConnectLong.GetInst().ConnectedFunc();
                break;

            case LCONNECT_EXCEPTION:
                type    = data.readByte();
                errCode = data.readInt();
                if (10049 == errCode ||                                 //Cannot assign requested address
                    10051 == errCode ||                                 //Network is unreachable
                    10054 == errCode ||                                 //Connection reset by peer
                    10057 == errCode ||                                 //Socket is not connected
                    10058 == errCode ||                                 //Cannot send after socket shutdown
                    10060 == errCode ||                                 //Connection timed out
                    10061 == errCode ||                                 //Connection refused
                    0 == errCode)                                       //Directly send error
                {
                    if (type == 0)
                    {
                        ApplicationEntry.ToLoginScene();
                    }
                }
                else if (10053 != errCode)
                {
                    Debug.LogError(string.Format("LCONNECT_EXCEPTION-Code:{0}", errCode));
                }
                break;

            case SCONNECT_EXCEPTION:
                errCode = data.readInt();
                MsgBoxPanel.MsgCallback Reconnect = () =>
                {
                    ConnectShort co = (ConnectShort)conn;
                    SocketHandler.GetInst().ShortSend(co.m_Data, co.m_bFlag, co.m_bNeedEncrypt);
                    SocketHandler.ShortSendBackFun();
                };
                MsgBoxPanel.ShowMsgBox(string.Empty, (string)ApplicationConst.dictStaticText["22"], 1, Reconnect);
                break;

            case LONG_MESSAGE_END:
                Connecting.GetInst().ForceHide();
                break;

            default:
                break;
            }
        }