예제 #1
0
        private void _onPacketArrived(Int32 _stream_id, PacketType _packet_type, GC_LoginFailedMsg _msg)
        {
            switch ((GC_LoginFailedMsg.ReasonInfo)_msg.Reason)
            {
            case GC_LoginFailedMsg.ReasonInfo.RET_SUCCESS:
            case GC_LoginFailedMsg.ReasonInfo.RET_SUCCESS_WITH_ITEM:
                break;

            case GC_LoginFailedMsg.ReasonInfo.ERROR_HAS_LOGINED:
            {
                string tip = Locale.Instance[string.Format("Login@{0}", (GC_LoginFailedMsg.ReasonInfo)(_msg.Reason)).ToString()];
                NetManager.Instance.RequestDisConnect();
                UI_MessageBox.Show(tip, Locale.Instance["Common@Confirm"], Locale.Instance["Common@Cancel"], () =>
                    {
                        SignalSystem.FireSignal(SignalId.Login_ForceLogin);
                    });
            }
            break;

            default:
            {
                string tip = Locale.Instance[string.Format("Login@{0}", (GC_LoginFailedMsg.ReasonInfo)(_msg.Reason)).ToString()];
                if (tip == string.Empty)
                {
                    UI_MessageBox.Show(((GC_LoginFailedMsg.ReasonInfo)(_msg.Reason)).ToString());
                }
                else
                {
                    UI_MessageBox.Show(tip);
                }
            }
            break;
            }
            WaitForResponse.Release();
        }
예제 #2
0
    private void _onLoginButtonClick()
    {
        if (m_edit_account.text == string.Empty)
        {
            UI_MessageBox.Show(Locale.Instance["Login@PleaseInputAccount"]);
            return;
        }
        if (m_edit_password.text == string.Empty)
        {
            UI_MessageBox.Show(Locale.Instance["Login@PleaseInputPassword"]);
            return;
        }
        CG_LoginRequestMsg msg = new CG_LoginRequestMsg();

        msg.PlatformID     = 0;
        msg.PlayerName     = m_edit_account.text;
        msg.PlayerPassword = m_edit_password.text;
        var bt = Encoding.UTF8.GetBytes(UnityEngine.SystemInfo.deviceUniqueIdentifier);

        msg.Mac      = BitConverter.ToUInt64(bt, 0);
        msg.Md5      = MD5Helper.GetMD5Hash(bt);
        msg.NameType = 0;
        msg.Version  = 17696793;
        NetManager.Instance.SendMsg(msg);
        LoginSystem.Instance.CurAccount  = msg.PlayerName;
        LoginSystem.Instance.CurPassword = msg.PlayerPassword;
        WaitForResponse.Retain();
    }
예제 #3
0
 public override void Exit()
 {
     WaitForResponse.Release();
     NetManager.Instance.Unregister <ConnectMsg>();
     NetManager.Instance.Unregister <DisconnectMsg>();
     m_time_out.Stop();
 }
예제 #4
0
        public static async Task Maindo(SocketMessage arg)
        {
            if (Economy.CountProductForUser(Product.flower, arg.Author.Id) > 0)
            {
                var User = arg.MentionedUsers.Count >= 1 ? arg.MentionedUsers.First() : null;
                if (User == null)
                {
                    await arg.Channel.SendMessageAsync("Please mention a user to give the flower to!");

                    var WFR = new WaitForResponse()
                    {
                        TimeLimitS = 15,
                        ChannelId  = arg.Channel.Id,
                        UserId     = arg.Author.Id
                    };
                    var Msg = await WFR.Start();

                    User = Msg.MentionedUsers.Count > 0 ? Msg.MentionedUsers.First() : null;
                }
                await arg.Channel.SendMessageAsync($"You gave {User.Mention} a flower! <3");

                Economy.ChangeProductCountForUser(Product.flower, -1, arg.Author.Id);
                Economy.ChangeProductCountForUser(Product.flower, 1, User.Id);
            }
            else
            {
                await arg.Channel.SendMessageAsync($"You need to buy flowers first! `{Program.Prefix}buy flower`");
            }
        }
예제 #5
0
        private static async Task <bool> SetupX(SocketMessage arg, string Message)
        {
            try
            {
                var WFR = new WaitForResponse()
                {
                    TimeLimitS = 60, ChannelId = arg.Channel.Id, UserId = arg.Author.Id
                };
                await arg.Channel.SendMessageAsync(Message);

                var CusRespReply = await WFR.Start();

                if (CusRespReply != null && CusRespReply.Content.ToLower().Contains("yes"))
                {
                    await CusRespReply.AddReactionAsync(new Emoji("✅"));
                }
                else
                {
                    await CusRespReply.AddReactionAsync(new Emoji("❌"));
                }
                return(CusRespReply == null ? false : CusRespReply.Content.ToLower().Contains("yes"));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            return(false);
        }
예제 #6
0
        private void _onPacketArrived(Int32 _stream_id, PacketType _packet_type, GC_LoginOKNoPlayer _msg)
        {
            WaitForResponse.Release();
            UI_MessageBox.Show(Locale.Instance["Login@NoPlayer"]);

            //登陆成功后更新本地配置中的账户名
            LocalConfigSystem.Instacne.UpdateCurAccount(CurAccount);
            LocalConfigSystem.Instacne.Update("CurrentPassword", CurPassword);
        }
예제 #7
0
        private void _onPacketArrived(Int32 _stream_id, PacketType _packet_type, GC_LoginOK _msg)
        {
            WaitForResponse.Release();
            Log.Info("收到玩家数据");
            MainPlayer.Instance.InitializePlayerInfo(_msg.PlayerInfo);
            SignalSystem.FireSignal(SignalId.Login_Success);

            //登陆成功后更新本地配置中的账户名
            LocalConfigSystem.Instacne.UpdateCurAccount(CurAccount);
            LocalConfigSystem.Instacne.Update("CurrentPassword", CurPassword);
        }
예제 #8
0
    private void _forceLogin(SignalId _signal_id, SignalParameters _parameters)
    {
        CG_ForceLoginRequestMsg msg = new CG_ForceLoginRequestMsg();

        msg.PlatformID     = 0;
        msg.PlayerName     = m_edit_account.text;
        msg.PlayerPassword = m_edit_password.text;
        var bt = Encoding.UTF8.GetBytes(UnityEngine.SystemInfo.deviceUniqueIdentifier);

        msg.Mac      = BitConverter.ToUInt64(bt, 0);
        msg.Md5      = MD5Helper.GetMD5Hash(bt);
        msg.NameType = 0;
        NetManager.Instance.SendMsg(msg);
        WaitForResponse.Retain();
    }
예제 #9
0
            public override void Enter()
            {
                WaitForResponse.Retain();
                NetManager.Instance.Register <ConnectMsg>(_onGameSrvConnected);
                NetManager.Instance.Register <DisconnectMsg>(_onGameSrvDisconnected);
                IPAddress ip;

                if (!IPAddress.TryParse("192.168.100.200", out ip))
                {
                    throw new ServerInfoException(ServerInfoException.ErrorType.IpParseError);
                }
                IPEndPoint ip_end = new IPEndPoint(ip, 12345);

                Entity.m_net_client_gamesrv.Connect(ip_end);

                if (m_time_out == null)
                {
                    m_time_out = Timer.CreateTimer(10000);
                    m_time_out.eventTimesUp += _onTimeOut;
                }
                m_time_out.Start();
                m_time_out_tip = "GameSrvConnectTimeOut";
            }