Beispiel #1
0
        public IEnumerator SSNotifyCharacterOnConnet(Coroutine coroutine,
                                                     ChatService _this,
                                                     SSNotifyCharacterOnConnetInMessage msg)
        {
            var characterId = msg.Request.CharacterId;
            var clientId    = msg.Request.ClientId;
            var proxy       = new ChatProxy(_this, characterId, clientId);

            _this.Proxys[characterId] = proxy;

            var ret = AsyncReturnValue <bool> .Create();

            var subCo = CoroutineFactory.NewSubroutine(OnConnected, coroutine, proxy, ret);

            if (subCo.MoveNext())
            {
                yield return(subCo);
            }
            var isOk = ret.Value;

            ret.Dispose();
            if (isOk)
            {
                msg.Reply((int)ErrorCodes.OK);
                AnchorManager.Instance.CharOnline(characterId, proxy.Character.Name);
            }
            else
            {
                msg.Reply((int)ErrorCodes.ConnectFail);
            }
        }
Beispiel #2
0
    public override void Execute(INotification notification)
    {
        MsgPlayerLevelChanged message = notification.Body as MsgPlayerLevelChanged;

        CfgLanguageProxy languageProxy = Facade.RetrieveProxy(ProxyName.CfgLanguageProxy) as CfgLanguageProxy;
        ChatProxy        chatProxy     = Facade.RetrieveProxy(ProxyName.ChatProxy) as ChatProxy;

        if (!message.m_IsSelf)
        {
            for (uint i = message.m_OldLevel + 1; i <= message.m_NewLevel; i++)
            {
                chatProxy.AddMessage(chatProxy.CurrentChannel, string.Format(languageProxy.GetLocalization(100055), message.m_PlayerName, i));
            }
        }
        else
        {
            for (uint i = message.m_OldLevel + 1; i <= message.m_NewLevel; i++)
            {
                chatProxy.AddMessage(chatProxy.CurrentChannel, string.Format(languageProxy.GetLocalization(100053), i));

                //UNDONE 调升级UI chw
                //EventDispatcher.Global.DispatchEvent(Notifications.MSG_CONFIRM_OPEN, NotifactionTypeEnum.NotifactionTypeEnum_UpgradePanel, true, true, i);
            }
        }
    }
Beispiel #3
0
        /// <summary>
        /// Begins an asynchronous join operation on the underlying <see cref="ChatProxy">ChatProxy</see>
        /// which will call the OnEndJoin() method on completion
        /// </summary>
        /// <param name="p">The <see cref="Common.Person">chatter</see> to try and join with</param>
        public void Connect(Person p)
        {
            InstanceContext site = new InstanceContext(this);

            proxy = new ChatProxy(site);
            IAsyncResult iar = proxy.BeginJoin(p, new AsyncCallback(OnEndJoin), null);
        }
    public override void Execute(INotification notification)
    {
        MsgPlayerDanExpChanged message = (MsgPlayerDanExpChanged)notification.Body;

        ChatProxy chatProxy = Facade.RetrieveProxy(ProxyName.ChatProxy) as ChatProxy;

        chatProxy.AddMessage(ChatChannel.CombatLog, "Add dan exp " + message.m_Exp);
    }
Beispiel #5
0
        /// <summary>
        /// 收到聊天消息
        /// </summary>
        /// <param name="buf"></param>
        private void OnChatMessage(KProtoBuf buf)
        {
            S2C_CHAT_MESSAGE msg = buf as S2C_CHAT_MESSAGE;

            ChatProxy proxy = GameFacade.Instance.RetrieveProxy(ProxyName.ChatProxy) as ChatProxy;

            proxy.AddMessage(s2c_channel(msg.channel), msg.message, msg.fromID, msg.fromName);
        }
 //start the chat proxy which starts the various services
 private void startChat(object sender, RoutedEventArgs e)
 {
     _cp = new ChatProxy(this.ShowMessage, this.ShowStatus, this.ShowStatusMsg, token, patient, settings, username);
     if (_cp.Status)
     {
         chatArea.Text += ("Ready to chat!");
         chatArea.Text += Environment.NewLine;
     }
 }
    public override void Execute(INotification notification)
    {
        MsgTeamErrorInfo message   = (MsgTeamErrorInfo)notification.Body;
        ChatProxy        chatProxy = Facade.RetrieveProxy(ProxyName.ChatProxy) as ChatProxy;

        chatProxy.AddMessage(chatProxy.CurrentChannel, message.m_Error);

        SendNotification(NotificationName.MSG_TEAM_ERROR_INFO, message.m_Error);
    }
Beispiel #8
0
 /// <summary>
 /// Calls the ChatProxy.Abort (ClientBase&ltIChat&gt.Abort()) and also
 /// the ChatProxy.Close (ClientBase&ltIChat&gt.Close()) methods
 /// </summary>
 public void AbortProxy()
 {
     if (proxy != null)
     {
         proxy.Abort();
         proxy.Close();
         proxy = null;
     }
 }
 //���Ͻ� ����
 private void AbortProxyAndUpdateUI()
 {
     if (proxy != null)
       {
     proxy.Abort();
     proxy.Close();
     proxy = null;
       }
       ShowConnectMenuItem(true);
 }
Beispiel #10
0
 private void AbortProxyAndUpdateUI()
 {
     if (proxy != null)
     {
         proxy.Abort();
         proxy.Close();
         proxy = null;
     }
     ShowConnectMenuItem(true);
 }
Beispiel #11
0
        private void connectToolStripMenuItem_Click(object sender, EventArgs e)
        {
            lstChatters.Items.Clear();
            NickDialog nickDlg = new NickDialog();

            if (nickDlg.ShowDialog() == DialogResult.OK)
            {
                myNick = nickDlg.txtNick.Text;
                nickDlg.Close();
            }

            txtMessage.Focus();
            Application.DoEvents();
            InstanceContext site = new InstanceContext(this);

            proxy = new ChatProxy(site);

            IAsyncResult iar = proxy.BeginJoin(myNick, new AsyncCallback((thisIar) =>
            {
                try
                {
                    string[] list = proxy.EndJoin(thisIar);

                    pwDlg.Invoke((Action)(() =>
                    {
                        if (list == null)
                        {
                            pwDlg.ShowError("Error: Username already exist!");
                            ExitChatSession();
                        }
                        else
                        {
                            pwDlg.Close();
                            ShowConnectMenuItem(false);
                            foreach (string name in list)
                            {
                                lstChatters.Items.Add(name);
                            }
                            AppendText("Connected at " + DateTime.Now.ToString() + " with user name " + myNick + Environment.NewLine);
                        }
                    }));
                }
                catch (Exception ex)
                {
                    pwDlg.Invoke((Action)(() =>
                    {
                        pwDlg.ShowError("Error: Cannot connect to chat!");
                        ExitChatSession();
                    }));
                }
            }), null);

            pwDlg = new PleaseWaitDialog();
            pwDlg.ShowDialog();
        }
Beispiel #12
0
        /// <summary>
        /// 收到错误提示
        /// </summary>
        /// <param name="buf"></param>
        private void OnErrorCode(KProtoBuf buf)
        {
            S2C_ERROR_CODE msg = buf as S2C_ERROR_CODE;

            ChatProxy        chatProxy     = GameFacade.Instance.RetrieveProxy(ProxyName.ChatProxy) as ChatProxy;
            CfgLanguageProxy languageProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgLanguageProxy) as CfgLanguageProxy;

            switch ((KErrorCode)msg.error)
            {
            case KErrorCode.errSendBlackMsg:
                chatProxy.AddMessage(chatProxy.CurrentChannel, languageProxy.GetLocalization(3007));
                break;

            case KErrorCode.errSendNotOnLineMsg:
                chatProxy.AddMessage(chatProxy.CurrentChannel, languageProxy.GetLocalization(3006));
                break;
            }
        }
Beispiel #13
0
    public override void Execute(INotification notification)
    {
        MsgPlayerShipExpChanged message = (MsgPlayerShipExpChanged)notification.Body;

        CfgLanguageProxy languageProxy = Facade.RetrieveProxy(ProxyName.CfgLanguageProxy) as CfgLanguageProxy;
        ChatProxy        chatProxy     = Facade.RetrieveProxy(ProxyName.ChatProxy) as ChatProxy;

        chatProxy.AddMessage(ChatChannel.CombatLog, string.Format(languageProxy.GetLocalization(100050), message.m_Exp));

        if (message.m_Exp > 0)
        {
            //UNDONE 获得道具提示  chw

            /*
             *          MsgItemGetting msg = MessageSingleton.Get<MsgItemGetting>();
             *          msg.m_IconName = MissionRewardIconName.GetItemName((int)PackageType.eSpecialAirExp, -1);
             *          msg.m_IconBundle = MissionRewardIconName.GetIconBundle((int)PackageType.eSpecialAirExp, -1);
             *          msg.m_IconName = MissionRewardIconName.GetName((int)PackageType.eSpecialAirExp, -1);
             *          msg.m_Count = message.m_Exp;
             *
             *          SendNotification(NotificationName.ItemGetting, msg);
             */
        }
    }
Beispiel #14
0
 /// <summary>
 /// Calls the ChatProxy.Abort (ClientBase&ltIChat&gt.Abort()) and also
 /// the ChatProxy.Close (ClientBase&ltIChat&gt.Close()) methods
 /// </summary>
 public void AbortProxy()
 {
     if (proxy != null)
     {
         proxy.Abort();
         proxy.Close();
         proxy = null;
     }
 }
Beispiel #15
0
 /// <summary>
 /// Begins an asynchronous join operation on the underlying <see cref="ChatProxy">ChatProxy</see>
 /// which will call the OnEndJoin() method on completion
 /// </summary>
 /// <param name="p">The <see cref="Common.Person">chatter</see> to try and join with</param>
 public void Connect(Person p)
 {
     InstanceContext site = new InstanceContext(this);
     proxy = new ChatProxy(site);
     IAsyncResult iar = proxy.BeginJoin(p, new AsyncCallback(OnEndJoin), null);
 }
 public ChatProxy() : base(NAME)
 {
     instances = this;
 }
Beispiel #17
0
        private void OnConnect(object sender, RoutedEventArgs args)
        {
            InstanceContext site = new InstanceContext(this);
            proxy = new ChatProxy(site);

            // Get Local IP Address
            IPAddress[] localIPs = Dns.GetHostAddresses(Dns.GetHostName());
            myNick = localIPs[1].ToString();

            // Use IP Address as a user name
            IAsyncResult iar = proxy.BeginJoin(myNick, new AsyncCallback(OnEndJoin), null);

            // DisEnable "Connect" button & Enable "Disconnect" button
            // when client is connected with server
            Connect.IsEnabled = false;
            Connect.Visibility = Visibility.Collapsed;

            Disconnect.IsEnabled = true;
            Disconnect.Visibility = Visibility.Visible;

            #region Fade in
            // Create a storyboard to contain the animations.
            Storyboard storyboard = new Storyboard();
            TimeSpan duration = new TimeSpan(0, 0, 5);

            // Create a DoubleAnimation to fade the not selected option control
            DoubleAnimation animation = new DoubleAnimation();

            animation.From = 1.0;
            animation.To = 0.0;
            animation.Duration = new Duration(duration);
            // Configure the animation to target de property Opacity
            Storyboard.SetTargetName(animation, SayHello.Name);
            Storyboard.SetTargetProperty(animation, new PropertyPath(Control.OpacityProperty));
            // Add the animation to the storyboard
            storyboard.Children.Add(animation);

            // Begin the storyboard
            storyboard.Begin(this);

            #endregion
        }
        /// <summary>
        /// �����ϱ�
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void connectToolStripMenuItem_Click(object sender, EventArgs e)
        {
            InstanceContext site = new InstanceContext(this);
              proxy = new ChatProxy(site);
              lstChatters.Items.Clear();
              NickDialog nickDlg = new NickDialog();
              if (nickDlg.ShowDialog() == DialogResult.OK)
              {
            myNick = nickDlg.txtNick.Text;
            nickDlg.Close();
              }

              txtMessage.Focus();

              IAsyncResult iar = proxy.BeginJoin(myNick, new AsyncCallback(OnEndJoin), null);
              pwDlg = new PleaseWaitDialog();
              pwDlg.ShowDialog();
        }