예제 #1
0
파일: Example.cs 프로젝트: reynarzz/UTalk
        private void Handler(TalkEvent talkEvent)
        {
            switch (talkEvent)
            {
            case TalkEvent.Started:
                _spaceText.enabled = false;
                break;

            case TalkEvent.Finished:
                _spaceText.enabled = true;
                break;

            case TalkEvent.PageChanged:
                var pageIndex = _utalk.PageIndex;
                break;
            }
        }
예제 #2
0
        protected override IEnumerator gameEvent()
        {
            alice = GameObject.FindGameObjectWithTag("Alice").GetComponent <Alice_Control>();
            mw    = GameObject.FindGameObjectWithTag("MessageWindow").GetComponent <MessageWindow>();
            mw.show();
            TalkEvent.OnNext(true);
            yield return(mw.next("Hello!!!").ToYieldInstruction());

            yield return(waitForFire.ToYieldInstruction());

            yield return(mw.next("This is The first Event!").ToYieldInstruction());

            yield return(waitForFire.ToYieldInstruction());

            mw.hide();
            TalkEvent.OnNext(false);
            Destroy(gameObject);
            yield return(null);
        }
예제 #3
0
        public void Execute()
        {
            if (Finished || WowInterface.ObjectManager.Player.IsCasting)
            {
                return;
            }

            WowUnit = WowInterface.ObjectManager.WowObjects
                      .OfType <WowUnit>()
                      .Where(e => e.IsGossip && !e.IsDead && DisplayIds.Contains(e.DisplayId))
                      .OrderBy(e => e.Position.GetDistance(WowInterface.ObjectManager.Player.Position))
                      .FirstOrDefault();

            if (WowUnit != null)
            {
                if (WowUnit.Position.GetDistance(WowInterface.ObjectManager.Player.Position) < 3.0)
                {
                    if (TalkEvent.Run())
                    {
                        WowInterface.HookManager.StopClickToMoveIfActive();
                        WowInterface.MovementEngine.Reset();

                        WowInterface.HookManager.UnitOnRightClick(WowUnit);

                        ++Counter;
                        if (Counter > GossipIds.Count)
                        {
                            Counter = 1;
                        }

                        WowInterface.HookManager.UnitSelectGossipOption(GossipIds[Counter - 1]);
                    }
                }
                else
                {
                    WowInterface.MovementEngine.SetMovementAction(MovementAction.Moving, WowUnit.Position);
                }
            }
        }
예제 #4
0
        public void Execute()
        {
            if (Finished || Bot.Player.IsCasting)
            {
                return;
            }

            Unit = Bot.Objects.All
                   .OfType <IWowUnit>()
                   .Where(e => e.IsGossip && !e.IsDead && DisplayIds.Contains(e.DisplayId))
                   .OrderBy(e => e.Position.GetDistance(Bot.Player.Position))
                   .FirstOrDefault();

            if (Unit != null)
            {
                if (Unit.Position.GetDistance(Bot.Player.Position) < 3.0)
                {
                    if (TalkEvent.Run())
                    {
                        Bot.Wow.StopClickToMove();
                        Bot.Movement.Reset();

                        Bot.Wow.InteractWithUnit(Unit);

                        ++Counter;
                        if (Counter > GossipIds.Count)
                        {
                            Counter = 1;
                        }

                        Bot.Wow.SelectGossipOption(GossipIds[Counter - 1]);
                    }
                }
                else
                {
                    Bot.Movement.SetMovementAction(MovementAction.Move, Unit.Position);
                }
            }
        }
예제 #5
0
        //sender methods

        public async void MakeCall(IPEndPoint endPoint, string userName, string receiverName)
        {
            Trace.WriteLine("username: "******"receiver: " + receiverName);

            if (!isCalling)
            {
                remoteEndPointToSendVoice = endPoint;

                isCalling = true;

                if (MakeCallEvent != null)
                {
                    MakeCallEvent.Invoke("Dzwonię do: " + receiverName);
                }

                try
                {
                    Connect(endPoint);
                    string localIp = (((IPEndPoint)hostTcpClient.Client.LocalEndPoint).Address.ToString());
                    if (EncryptedCallSender)
                    {
                        SendText(Commands.Invite + ":" + localIp + ":" + userName + ":" + PrepareDHRequestString());
                    }
                    else
                    {
                        SendText(Commands.Invite + ":" + localIp + ":" + userName);
                    }

                    while (isCalling)
                    {
                        var msg = await ReceiveTextAsync();

                        if (msg.StartsWith(Commands.Busy))
                        {
                            ErrorEvent.Invoke("Zajęte");
                            BusyUserInfoEvent.Invoke("Użytkownik jest w trakcie rozmowy!");
                        }
                        else if (msg.StartsWith(Commands.Reject))
                        {
                            BreakCall();
                        }
                        else if (msg.StartsWith(Commands.Ack))
                        {
                            var msgAfterSplit = msg.Split(new char[] { ':' }, 2);
                            if (msgAfterSplit.Length == 2)
                            {
                                DHServer.HandleResponse(msgAfterSplit[1]);
                                DHKey = DHServer.Key;
                            }

                            if (UDPSenderStart != null)
                            {
                                UDPSenderStart.Invoke(remoteEndPointToSendVoice);
                            }

                            if (UDPListenerStart != null)
                            {
                                UDPListenerStart.Invoke(localEndPoint);
                            }

                            //Akceptacja połączenia - zmiana gui
                            if (TalkEvent != null)
                            {
                                TalkEvent.Invoke(receiverName);
                            }
                        }
                        else
                        {
                            ErrorEvent.Invoke(msg);
                        }
                    }
                }
                catch (Exception e)
                {
                    isCalling = false;

                    if (ErrorEvent != null)
                    {
                        ErrorEvent.Invoke(e.Message);
                    }

                    if (EndCall != null)
                    {
                        EndCall.Invoke();
                    }
                }
            }
        }
예제 #6
0
 private void Start()
 {
     _collider2D = GetComponent <Collider2D>();
     _talkEvent  = GetComponentInChildren <TalkEvent>();
 }