コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SpeechPacket"/> class.
 /// </summary>
 /// <param name="type">The type of speech.</param>
 /// <param name="channelId">The channel type.</param>
 /// <param name="content">The content spoken.</param>
 /// <param name="receiver">Optional. The receiver of the message, if any.</param>
 public SpeechPacket(SpeechType type, ChatChannelType channelId, string content, string receiver = "")
 {
     this.SpeechType  = type;
     this.ChannelType = channelId;
     this.Content     = content;
     this.Receiver    = receiver;
 }
コード例 #2
0
ファイル: Console.cs プロジェクト: Xileck/tibiaapi
 /// <summary>
 /// Create a default message.
 /// </summary>
 /// <param name="text"></param>
 public ChatMessage(string text)
 {
     this.Text = text;
     this.Recipient = "";
     this.Channel = ChatChannel.None;
     this.Type = SpeechType.Say;
 }
コード例 #3
0
ファイル: Console.cs プロジェクト: FaNtA91/pokemonapi
 /// <summary>
 /// Create a default message.
 /// </summary>
 /// <param name="text"></param>
 public ChatMessage(string text)
 {
     this.Text      = text;
     this.Recipient = "";
     this.Channel   = ChatChannel.None;
     this.Type      = SpeechType.Say;
 }
コード例 #4
0
ファイル: Reaction.cs プロジェクト: asyzruffz/Ludum-Dare-38
    void SetSpeech(SpeechType speechType)
    {
        AudioController audioControl = GetComponent <AudioController> ();

        switch (speechType)
        {
        case SpeechType.PlsRememberMe:
            dialog.text = "See you again!";
            audioControl.PlayMusicType("SeeYouLater");
            break;

        case SpeechType.WrongPerson:
            dialog.text = "Sorry, wrong person!";
            audioControl.PlayMusicType("WrongPerson");
            break;

        case SpeechType.FoundYou:
            dialog.text = "Found you!";
            audioControl.PlayMusicType("FoundYou");
            needToNextLvl = true;
            break;
        }

        speech.SetActive(true);
    }
コード例 #5
0
        private void ShowSpeechTypeVariation(SpeechVisualizer visualizer, SpeechTypeSpecification speechTypeSpecification, double deltaTime)
        {
            double time     = 0;
            double lastTime = speechTypeSpecification.TimeSpeechTypeTupleList.Last().Item1;

            visualizer.MarkerList = new List <SoundMarker>();
            while (time < lastTime)
            {
                SoundMarker marker = new SoundMarker();
                marker.Type      = SoundMarkerType.HorizontalLine;
                marker.Thickness = 4;
                marker.Start     = (float)(time - 0.25 * deltaTime);
                marker.End       = (float)(time + 0.25 * deltaTime);
                SpeechType speechType = speechTypeSpecification.GetSpeechType(time);
                if (speechType == SpeechType.Silence)
                {
                    marker.Color = Color.Yellow;
                    marker.Level = 28000;
                }
                else if (speechType == SpeechType.Voiced)
                {
                    marker.Color = Color.Lime;
                    marker.Level = 32000;
                }
                else
                {
                    marker.Color = Color.Red;
                    marker.Level = 30000;
                }
                visualizer.MarkerList.Add(marker);
                time += deltaTime;
            }
            visualizer.Invalidate();
        }
コード例 #6
0
        public void SetSpeechType(int index, SpeechType speechType)
        {
            double time = timeSpeechTypeTupleList[index].Item1;
            Tuple <double, SpeechType> speechTypeTuple = new Tuple <double, SpeechType>(time, speechType);

            timeSpeechTypeTupleList[index] = speechTypeTuple;
        }
コード例 #7
0
        public List <Tuple <int, int, SpeechType> > GetSegmentTypes()
        {
            List <Tuple <int, int, SpeechType> > segmentTypeList = new List <Tuple <int, int, SpeechType> >();
            int        segmentStartIndex = 0;
            int        segmentEndIndex   = -1; // Handles the case in which the speech type is unchanged over the sound.
            SpeechType currentSpeechType = timeSpeechTypeTupleList[0].Item2;

            for (int ii = 1; ii < timeSpeechTypeTupleList.Count; ii++)
            {
                SpeechType speechType = timeSpeechTypeTupleList[ii].Item2;
                if (speechType != currentSpeechType)
                {
                    segmentEndIndex = ii - 1;
                    Tuple <int, int, SpeechType> segmentType =
                        new Tuple <int, int, SpeechType>(segmentStartIndex, segmentEndIndex, currentSpeechType);
                    segmentTypeList.Add(segmentType);
                    currentSpeechType = speechType;
                    segmentStartIndex = ii;
                    segmentEndIndex   = -1; // To make sure that the final segment is included, see below
                }
            }
            if (segmentEndIndex < 0)
            {
                segmentEndIndex = timeSpeechTypeTupleList.Count - 1;
                Tuple <int, int, SpeechType> segmentType =
                    new Tuple <int, int, SpeechType>(segmentStartIndex, segmentEndIndex, currentSpeechType);
                segmentTypeList.Add(segmentType);
            }
            return(segmentTypeList);
        }
コード例 #8
0
        public void FindSpeechTypeVariation(WAVSound sound)
        // , int channel, double frameDuration, double frameShift,
        //                      double lowPassCutoffFrequency, double lowPassRatioThreshold, double energyThreshold, double silenceThreshold)
        {
            WAVFrameSet frameSet = new WAVFrameSet(sound, frameDuration, frameShift);

            speechTypeSpecification = new SpeechTypeSpecification();
            double time = 0;

            for (int ii = 0; ii < frameSet.FrameList.Count; ii++)
            {
                WAVSound   frame      = frameSet.FrameList[ii];
                SpeechType speechType = this.GetFrameSpeechType(frame); //
                // SpeechType speechType = this.GetFrameSpeechType(frame, channel, lowPassCutoffFrequency, lowPassRatioThreshold, energyThreshold, silenceThreshold);
                time = frameSet.StartTimeList[ii] + frameDuration / 2;  // The speech type is assigned to the center of the frame
                speechTypeSpecification.TimeSpeechTypeTupleList.Add(new Tuple <double, SpeechType>(time, speechType));
            }
            // Finally, to make sure that the speech type can be interpolated over the entire sound, set the
            // end values:
            SpeechType firstSpeechType = speechTypeSpecification.TimeSpeechTypeTupleList[0].Item2;

            speechTypeSpecification.TimeSpeechTypeTupleList.Insert(0, new Tuple <double, SpeechType>(0, firstSpeechType));
            SpeechType lastSpeechType = speechTypeSpecification.TimeSpeechTypeTupleList.Last().Item2;
            double     duration       = sound.GetDuration();

            if (speechTypeSpecification.TimeSpeechTypeTupleList.Last().Item1 < duration) // Will ALMOST always be the case, unless the duration is an exact multiple of the frame shift
            {
                speechTypeSpecification.TimeSpeechTypeTupleList.Add(new Tuple <double, SpeechType>(duration, lastSpeechType));
            }
            for (int jj = 0; jj < numberOfAdjustmentSteps; jj++)
            {
                Adjust();
            }
        }
コード例 #9
0
ファイル: Reaction.cs プロジェクト: asyzruffz/Ludum-Dare-38
 public void ReactTowards(Vector3 pos, SpeechType speechType)
 {
     controller.moving = false;
     SetSpeech(speechType);
     transform.rotation = Quaternion.LookRotation(pos - transform.position, transform.up);
     needToBlink        = (speechType == SpeechType.PlsRememberMe || speechType == SpeechType.FoundYou);
 }
コード例 #10
0
 /// <inheritdoc />
 /// <summary>
 ///     Initializes a new instance of the <see cref="T:Tibia.Network.Game.CreatureTalkedEventArgs" /> class.
 /// </summary>
 /// <param name="characterSpawn">The character spawn.</param>
 /// <param name="speechType">Type of the speech.</param>
 /// <param name="receiver">The receiver.</param>
 /// <param name="channelId">The channel identifier.</param>
 /// <param name="message">The message.</param>
 public CreatureTalkedEventArgs(CharacterSpawn characterSpawn, SpeechType speechType, string receiver, ushort channelId, string message)
 {
     CharacterSpawn = characterSpawn;
     SpeechType     = speechType;
     Receiver       = receiver;
     ChannelId      = channelId;
     Message        = message;
 }
コード例 #11
0
    public List <String> speakFact()
    {
        int           len      = Enum.GetNames(typeof(SpeechType)).Length;
        List <String> dialogue = null;
        SpeechType    type     = (SpeechType)UnityEngine.Random.Range(len - 2, len);

        return(speak(type));
    }
コード例 #12
0
ファイル: SpeechFormat.cs プロジェクト: NaphalAXT/WarUOSallos
 public SpeechFormat(string prepend, string prefix, string format, byte messageType, SpeechType speechType)
 {
     this.m_Prepend     = prepend;
     this.m_Prefix      = prefix;
     this.m_Format      = format;
     this.m_MessageType = messageType;
     this.m_SpeechType  = speechType;
 }
コード例 #13
0
 public SpeechCreatedEvent(Guid id, Title title, UrlValue url, Description description, SpeechType type)
 {
     Id          = id.ToString();
     Title       = title;
     Url         = url;
     Description = description;
     Type        = type;
 }
コード例 #14
0
 public static void AllSpeak(SpeechType speechType)
 {
     ComicBubble[] allb = FindObjectsOfType <ComicBubble>();
     foreach (var b in allb)
     {
         b.Speak(speechType);
     }
 }
        public void EqualityIsFalseWhenObjectsAreDifferentValuesTest()
        {
            //Arrange
            var url1 = new SpeechType(SpeechTypeEnum.Conferences.ToString());
            var url2 = new SpeechType(SpeechTypeEnum.SelfPacedLabs.ToString());

            Assert.False(url1 == url2);
        }
コード例 #16
0
 public void Apply(SpeechCreatedEvent ev)
 {
     Id          = ev.AggregateId;
     Title       = ev.Title;
     Url         = ev.Url;
     Description = ev.Description;
     Type        = ev.Type;
 }
コード例 #17
0
 public Speech(Title title, UrlValue urlValue, Description description, SpeechType type)
 {
     _title          = title?.Value ?? throw new ArgumentNullAggregateException(0, nameof(title));
     _url            = urlValue?.Value ?? throw new ArgumentNullAggregateException(0, nameof(urlValue));
     _description    = description?.Value ?? throw new ArgumentNullAggregateException(0, nameof(description));
     _type           = type != null ? type.IntValue : throw new ArgumentNullAggregateException(0, nameof(type));
     _mediaFileItems = new List <MediaFile>();
     AddDomainEvent(new SpeechCreatedEvent(Id, Title.Value, Url.Value, Description.Value, new Command.SharedKernel.Events.SpeechTypeEnum(type.IntValue, type.StringValue)));
 }
コード例 #18
0
 public Speech(Title title, UrlValue urlValue, Description description, SpeechType type)
 {
     Title           = title ?? throw new ArgumentNullAggregateException(nameof(title));
     Url             = urlValue ?? throw new ArgumentNullAggregateException(nameof(urlValue));
     Description     = description ?? throw new ArgumentNullAggregateException(nameof(description));
     Type            = type ?? throw new ArgumentNullAggregateException(nameof(type));
     _mediaFileItems = new List <MediaFile>();
     AddDomainEvent(new SpeechCreatedEvent(Id, Title, Url, Description, Type));
 }
コード例 #19
0
 public static bool SayIt(string s, SpeechType flags)
 {
         try
         {
             return _Speech.SayIt(s, flags);
         }
         catch { }
     return false;
 }
コード例 #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CreatureSpeechPacket"/> class.
 /// </summary>
 /// <param name="senderName"></param>
 /// <param name="speechType"></param>
 /// <param name="text"></param>
 /// <param name="location"></param>
 /// <param name="channelId"></param>
 /// <param name="time"></param>
 public CreatureSpeechPacket(string senderName, SpeechType speechType, string text, Location location, ChatChannelType channelId, uint time)
 {
     this.SenderName = senderName;
     this.SpeechType = speechType;
     this.Text       = text;
     this.Location   = location;
     this.ChannelId  = channelId;
     this.Time       = time;
 }
コード例 #21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SpeechOperation"/> class.
 /// </summary>
 /// <param name="requestorId">The id of the creature speaking.</param>
 /// <param name="speechType">The type of speech.</param>
 /// <param name="channelType">The type of channel where the speech happens.</param>
 /// <param name="content">The content of the speech.</param>
 /// <param name="receiver">The receiver of the speech, if applicable.</param>
 public SpeechOperation(uint requestorId, SpeechType speechType, ChatChannelType channelType, string content, string receiver)
     : base(requestorId)
 {
     // this.ExhaustionCost = TimeSpan.FromSeconds(1);
     this.Type      = speechType;
     this.ChannelId = channelType;
     this.Content   = content;
     this.Receiver  = receiver;
 }
コード例 #22
0
 public SpeechCreatedEvent(Guid id, Title title, UrlValue url,
                           Description description, SpeechType type)
 {
     AggregateId = id;
     Title       = title;
     Url         = url;
     Description = description;
     Type        = type;
 }
コード例 #23
0
ファイル: Console.cs プロジェクト: FaNtA91/pokemonapi
        /// <summary>
        /// Create a yell or whisper message.
        /// </summary>
        /// <param name="text"></param>
        /// <param name="type"></param>
        public static ChatMessage CreateNormalMessage(string text, SpeechType type)
        {
            ChatMessage cm = new ChatMessage(text);

            cm.Recipient = "";
            cm.Channel   = ChatChannel.None;
            cm.Type      = type;
            return(cm);
        }
コード例 #24
0
 public void SetUniformSpeechType(SpeechType speechType)
 {
     for (int ii = 0; ii < timeSpeechTypeTupleList.Count; ii++)
     {
         double time = timeSpeechTypeTupleList[ii].Item1;
         Tuple <double, SpeechType> speechTypeTuple = new Tuple <double, SpeechType>(time, speechType);
         timeSpeechTypeTupleList[ii] = speechTypeTuple;
     }
 }
コード例 #25
0
ファイル: Chat.cs プロジェクト: uoinfusion/Infusion
        private void Say(string message, SpeechType type, Color color, ushort font)
        {
            notifyAction();
            console.Debug(message);

            var keywordIds = keywordParser.GetKeywordIds(message);

            ultimaServer.Say(message, keywordIds, type, color, font, Language);
        }
コード例 #26
0
ファイル: Game.cs プロジェクト: alexisjojo/tibiaezbot
        public bool Say(String words, SpeechType type)
        {
            if(kernel.WorldProtocol != null)
            {
                kernel.WorldProtocol.SendSay(type, words);
                return true;
            }

            return false;
        }
コード例 #27
0
        public static bool Send(Objects.Client client, SpeechType type, string receiver, string message, ChatChannel channel)
        {
            PlayerSpeechPacket p = new PlayerSpeechPacket(client);

            p.SpeechType = type;
            p.Receiver   = receiver;
            p.Message    = message;
            p.ChannelId  = channel;

            return(p.Send());
        }
コード例 #28
0
ファイル: JournalEntry.cs プロジェクト: byterj/phoenix
 public JournalEntry(DateTime time, uint serial, string name, string text, ushort color, SpeechType type, SpeechFont font, JournalEntrySource source)
 {
     TimeStamp = time;
     Serial    = serial;
     Name      = name;
     Text      = text;
     Color     = color;
     Type      = type;
     Font      = font;
     Source    = source;
 }
コード例 #29
0
ファイル: SpeechHues.cs プロジェクト: NaphalAXT/WarUOSallos
 public int this[SpeechType speechType]
 {
     get
     {
         return(this.m_Hues[(int)speechType]);
     }
     set
     {
         this.m_Hues[(int)speechType] = value;
     }
 }
コード例 #30
0
        public static bool Send(Objects.Client client, SpeechType type, string receiver, string message, ChatChannel channel)
        {
            PlayerSpeechPacket p = new PlayerSpeechPacket(client);

            p.SpeechType = type;
            p.Receiver = receiver;
            p.Message = message;
            p.ChannelId = channel;

            return p.Send();
        }
        public void EqualityIsTrueWhenObjectsAreSameValuesTest()
        {
            //Arrange
            var url1 = new SpeechType(SpeechTypeEnum.Conferences.ToString());
            var url2 = new SpeechType(SpeechTypeEnum.Conferences.ToString());

            Assert.Equal(url1, url2);
            Assert.True(url1.Equals(url2));
            Assert.True(url1.Equals((object)url2));
            Assert.Equal(url1.GetHashCode(), url2.GetHashCode());
        }
コード例 #32
0
 public void Speak(SpeechType speechType)
 {
     if (!speaking && Random.value <= probOfSpeech[(int)speechType] / ElementManager.NumPlayers) // no override allowed
     {
         speaking        = true;
         bubbleText.text = GetSpeech(speechType);
         bubble.SetActive(true);
         Invoke("EndSpeak", Random.Range(speechDurationMinMax.x, speechDurationMinMax.y));
         AudioManager.instance.PlaySpeech("speech" + Random.Range(1, 9));
     }
 }
コード例 #33
0
ファイル: JournalEntry.cs プロジェクト: greeduomacro/phoenix
 public JournalEntry(JournalEntry e, string text)
 {
     TimeStamp = e.TimeStamp;
     Serial = e.Serial;
     Name = e.Name;
     Text = text;
     Color = e.Color;
     Type = e.Type;
     Font = e.Font;
     Source = e.Source;
 }
コード例 #34
0
ファイル: JournalEntry.cs プロジェクト: greeduomacro/phoenix
 public JournalEntry(DateTime time, uint serial, string name, string text, ushort color, SpeechType type, SpeechFont font, JournalEntrySource source)
 {
     TimeStamp = time;
     Serial = serial;
     Name = name;
     Text = text;
     Color = color;
     Type = type;
     Font = font;
     Source = source;
 }
コード例 #35
0
    public List <String> speak()
    {
        List <String> dialogue = null;

        if (timer <= 0)
        {
            SpeechType type = ChooseSpeechType();
            dialogue = speak(type);
            timer    = timeBetweenLines;
        }
        return(dialogue);
    }
コード例 #36
0
 public JournalEntry(long id, string name, string message, ObjectId speakerId, ModelId speakerBody, Color color,
                     SpeechType type = SpeechType.Normal)
 {
     Id          = id;
     Name        = name;
     Message     = message;
     SpeakerId   = speakerId;
     SpeakerBody = speakerBody;
     Color       = color;
     Created     = DateTime.UtcNow;
     Type        = type;
 }
コード例 #37
0
        public static void Add(
            NetworkMessage message,
            string senderName,
            ushort senderLevel,
            SpeechType speechType,
            string text,
            Location location,
            ChatChannel channelId,
            uint time
            )
        {
            message.AddByte((byte)ServerPacketType.CreatureSpeech);

            message.AddUInt32(0x00000000);
            message.AddString(senderName);
            message.AddUInt16(senderLevel);
            message.AddByte((byte)speechType);

            switch (speechType)
            {
                case SpeechType.Say:
                case SpeechType.Whisper:
                case SpeechType.Yell:
                case SpeechType.MonsterSay:
                case SpeechType.MonsterYell:
                case SpeechType.PrivateNPCToPlayer:
                    message.AddLocation(location);
                    break;
                case SpeechType.ChannelRed:
                case SpeechType.ChannelRedAnonymous:
                case SpeechType.ChannelOrange:
                case SpeechType.ChannelYellow:
                case SpeechType.ChannelWhite:
                    message.AddUInt16((ushort)channelId);
                    break;
                case SpeechType.RuleViolationReport:
                    message.AddUInt32(time);
                    break;
                default:
                    break;

            }

            message.AddString(text);
        }
コード例 #38
0
ファイル: PacketBuilder.cs プロジェクト: greeduomacro/phoenix
        public static byte[] CharacterSpeechAscii(uint serial, ushort model, string name, SpeechType type, SpeechFont font, ushort color, string text)
        {
            // For security reasons
            if (text.Length > Core.MaxSpeechLenght)
                text = text.Remove(Core.MaxSpeechLenght);

            PacketWriter writer = new PacketWriter(0x1C);

            writer.WriteBlockSize();
            writer.Write(serial);
            writer.Write(model);
            writer.Write((byte)type);
            writer.Write(color);
            writer.Write((ushort)font);
            writer.WriteAsciiString(name, 30);
            writer.WriteAsciiString(text);

            return writer.GetBytes();
        }
コード例 #39
0
ファイル: Console.cs プロジェクト: Xileck/tibiaapi
 /// <summary>
 /// Create a yell or whisper message.
 /// </summary>
 /// <param name="text"></param>
 /// <param name="type"></param>
 public static ChatMessage CreateNormalMessage(string text, SpeechType type)
 {
     ChatMessage cm = new ChatMessage(text);
     cm.Recipient = "";
     cm.Channel = ChatChannel.None;
     cm.Type = type;
     return cm;
 }
コード例 #40
0
ファイル: PacketBuilder.cs プロジェクト: greeduomacro/phoenix
        public static byte[] SpeechRequestUnicode(SpeechType type, SpeechFont font, ushort color, string text)
        {
            // For security reasons
            if (text.Length > Core.MaxSpeechLenght)
                text = text.Remove(Core.MaxSpeechLenght);

            PacketWriter writer = new PacketWriter(0xAD);

            writer.WriteBlockSize();
            writer.Write((byte)type);
            writer.Write(color);
            writer.Write((ushort)font);
            writer.WriteAsciiString("CSY", 4);
            writer.WriteUnicodeString(text);

            return writer.GetBytes();
        }
コード例 #41
0
ファイル: Connection.cs プロジェクト: henriqueuller/sharpot
 public void SendCreatureSpeech(Creature creature, SpeechType speechType, string message)
 {
     NetworkMessage outMessage = new NetworkMessage();
     CreatureSpeechPacket.Add(
         outMessage,
         creature.Name,
         1,
         speechType,
         message,
         creature.Tile.Location,
         ChatChannel.None,
         0000
     );
     Send(outMessage);
 }
コード例 #42
0
ファイル: Enums.cs プロジェクト: FaNtA91/pokemonapi
 public static SpeechTypeInfo GetSpeechTypeInfo(ushort version, SpeechType speechType)
 {
     return enumToSpeechTypeInfoPre100[speechType];
 }
コード例 #43
0
 public void SendSay(SpeechType type, String text)
 {
     lock (serverSendMsg)
     {
         serverSendMsg.Reset();
         serverSendMsg.AddByte(0x96);
         serverSendMsg.AddByte((byte)type);
         serverSendMsg.AddString(text);
         send();
     }
 }
コード例 #44
0
ファイル: Enums.cs プロジェクト: sindromexd/simplebot
 public static SpeechTypeInfo GetSpeechTypeInfo(ushort version, SpeechType speechType)
 {
     if (version >= 861)
     {
         return enumToSpeechTypeInfo861[speechType];
     }
     else
     {
         return enumToSpeechTypeInfoPre861[speechType];
     }
 }
コード例 #45
0
ファイル: UO.Speech.cs プロジェクト: greeduomacro/phoenix
 /// <summary>
 /// Says the specified type.
 /// </summary>
 /// <param name="type">The type.</param>
 /// <param name="color">The color.</param>
 /// <param name="format">The format.</param>
 /// <param name="args">The args.</param>
 public static void Say(SpeechType type, ushort color, string format, params object[] args)
 {
     string text = String.Format(format, args);
     SayInternal(type, color, text);
 }
コード例 #46
0
ファイル: Enums.cs プロジェクト: FaNtA91/pokemonapi
 public SpeechTypeInfo(SpeechType speechType, byte value, AdditionalSpeechData data)
 {
     this.SpeechType = speechType;
     this.Value = value;
     this.AdditionalSpeechData = data;
 }
コード例 #47
0
ファイル: UO.Speech.cs プロジェクト: greeduomacro/phoenix
        private static void PrintInternal(string speaker, string text, ushort color, SpeechFont font, SpeechType type)
        {
            if (text != null) {
                string[] lines = text.Split('\n');
                for (int i = 0; i < lines.Length; i++) {
                    byte[] data;

                    if (UseUnicodePrint)
                        data = PacketBuilder.CharacterSpeechUnicode(0xFFFFFFFF, 0xFFFF, speaker, type, font, color, lines[i]);
                    else
                        data = PacketBuilder.CharacterSpeechAscii(0xFFFFFFFF, 0xFFFF, speaker, type, font, color, lines[i]);

                    Core.SendToClient(data, true);
                }
            }
        }
コード例 #48
0
 /// <summary>
 /// Send a private or normal message.
 /// </summary>
 /// <param name="client"></param>
 /// <param name="senderName"></param>
 /// <param name="senderLevel"></param>
 /// <param name="speechType"></param>
 /// <param name="position"></param>
 /// <returns></returns>
 public static bool Send(Objects.Client client, string senderName, ushort senderLevel, string message, SpeechType speechType, Objects.Location position)
 {
     return Send(client, senderName, senderLevel, message, speechType, ChatChannel.None, position, 0);
 }
コード例 #49
0
 /// <summary>
 /// Send a rule violation message.
 /// </summary>
 /// <param name="client"></param>
 /// <param name="senderName"></param>
 /// <param name="senderLevel"></param>
 /// <param name="speechType"></param>
 /// <param name="time"></param>
 /// <returns></returns>
 public static bool Send(Objects.Client client, string senderName, ushort senderLevel, string message, SpeechType speechType, uint time)
 {
     return Send(client, senderName, senderLevel, message, speechType, ChatChannel.None, Objects.Location.Invalid, time);
 }
コード例 #50
0
ファイル: UO.Speech.cs プロジェクト: greeduomacro/phoenix
        /// <summary>
        /// Says the internal.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="color">The color.</param>
        /// <param name="text">The text.</param>
        private static void SayInternal(SpeechType type, ushort color, string text)
        {
            string[] lines = text.Split('\n');
            for (int i = 0; i < lines.Length; i++) {
                string line = "";

                for (int x = 0; x < lines[i].Length; x++) {
                    if (lines[i][x] >= ' ')
                        line += lines[i][x];
                }

                byte[] data = PacketBuilder.SpeechRequestUnicode(type, SpeechFont.Normal, color, line);
                Core.SendToServer(data, true);
            }
        }
コード例 #51
0
ファイル: Connection.cs プロジェクト: henriqueuller/sharpot
 public void SendChannelSpeech(string sender, SpeechType type, ChatChannel channelId, string message)
 {
     NetworkMessage outMessage = new NetworkMessage();
     CreatureSpeechPacket.Add(
         outMessage,
         sender,
         1,
         type,
         message,
         null,
         channelId,
         0
     );
     Send(outMessage);
 }
コード例 #52
0
ファイル: VoteManager.cs プロジェクト: PawelGGJ/TribalDancer
   public void Shout(string message, SpeechType speechType)
   {
      var dialogBubble = GetComponent<DialogBubble>();

      dialogBubble.ShowBubble(dialogBubble, message, speechType);
   }
コード例 #53
0
 /// <summary>
 /// Send a generic message.
 /// </summary>
 /// <param name="client"></param>
 /// <param name="senderName"></param>
 /// <param name="senderLevel"></param>
 /// <param name="speechType"></param>
 /// <param name="channelId"></param>
 /// <param name="position"></param>
 /// <param name="time"></param>
 /// <returns></returns>
 public static bool Send(Objects.Client client, string senderName, ushort senderLevel, string message, SpeechType speechType, ChatChannel channelId, Objects.Location position, uint time)
 {
     CreatureSpeechPacket p = new CreatureSpeechPacket(client);
     p.SenderName = senderName;
     p.SenderLevel = senderLevel;
     p.Message = message;
     p.SpeechType = speechType;
     p.ChannelId = channelId;
     p.Position = position;
     p.Time = time;
     return p.Send();
 }
コード例 #54
0
ファイル: DialogBubble.cs プロジェクト: PawelGGJ/TribalDancer
	//show the right bubble on the current character
	public void ShowBubble(DialogBubble vcharacter, string message, SpeechType speechType)
	{
      if (message != null)
      {
         vBubble = new List<PixelBubble> {new PixelBubble
		      {
		         vMessage = message,
               vMessageForm = BubbleType.Rectangle,
               vBodyColor = new Color(0,0,0,0),
               vBorderColor = new Color(0, 0, 0, 0),
               vClickToCloseBubble = false,
               vFontColor = Color.white,
               vFontSize = 20
		      }};

         if (speechType == SpeechType.Blood)
            vBubble.First().vFontColor = Color.red;
         if (speechType == SpeechType.Quake)
            vBubble.First().vFontColor = Color.yellow;
         if (speechType == SpeechType.Flip)
            vBubble.First().vFontColor = Color.cyan;

         if (speechType == SpeechType.GodVotingRequest || speechType == SpeechType.GodVotingResolved)
         {
            vBubble.First().vFontSize = 30;
            vBubble.First().vFontColor = Color.white;
         }
         vActiveBubble = vBubble[0];
      }

		bool gotonextbubble = true;

		//if vcurrentbubble is still there, just close it
		if (vActiveBubble != null) {
			if (vActiveBubble.vClickToCloseBubble) {
				//get the function to close bubble
				Appear vAppear = vcharacter.vCurrentBubble.GetComponent<Appear> ();
				vAppear.valpha = 0f;
				vAppear.vTimer = 0f; //instantly
				vAppear.vchoice = false; //close bubble
				
				//check if last bubble
				if (vActiveBubble == vcharacter.vBubble.Last ())
					vcharacter.IsTalking = false;
			}
		}
		
		foreach (PixelBubble vBubble in vcharacter.vBubble)
		{
			//make sure the bubble isn't already opened
			if (vcharacter.vCurrentBubble == null)
			{
				//make the character in talking status
				vcharacter.IsTalking = true;
				
				//cut the message into 24 characters
				string vTrueMessage = "";
				string cLine = "";
				int vLimit = 24;
				if (vBubble.vMessageForm == BubbleType.Round)
					vLimit = 16;
				
				//cut each word in a text in 24 characters.
				foreach (string vWord in vBubble.vMessage.Split(' '))
				{
					if (cLine.Length + vWord.Length > vLimit)
					{
						vTrueMessage += cLine+System.Environment.NewLine;  
						
						//add a line break after
						cLine = ""; //then reset the current line
					}
					
					//add the current word with a space
					cLine += vWord+" ";
				}
				
				//add the last word
				vTrueMessage += cLine;
				GameObject vBubbleObject = null;
				
				//create a rectangle or round bubble
				if (vBubble.vMessageForm == BubbleType.Rectangle)
				{
					//create bubble
					vBubbleObject = Instantiate(Resources.Load<GameObject> ("Customs/BubbleRectangle"));
				   float offset = vBubble.vMessage.Length < vLimit ? 0.3f : -.15f;
               vBubbleObject.transform.position = vcharacter.transform.position + new Vector3(offset, 0.5f, 0f); //move a little bit the teleport particle effect
				}
				else 
				{
					//create bubble
					vBubbleObject = Instantiate(Resources.Load<GameObject> ("Customs/BubbleRound"));
               vBubbleObject.transform.position = vcharacter.transform.position + new Vector3(-0.5f, 0.5f, 0f); //move a little bit the teleport particle effect
				}

				//show the mouse and wait for the user to left click OR NOT (if not, after 10 sec, it disappear)
				vBubbleObject.GetComponent<Appear>().needtoclick = vBubble.vClickToCloseBubble;

            Color vNewBodyColor = new Color(vBubble.vBodyColor.r, vBubble.vBodyColor.g, vBubble.vBodyColor.b, vBubble.vBodyColor.a);
            Color vNewBorderColor = new Color(vBubble.vBorderColor.r, vBubble.vBorderColor.g, vBubble.vBorderColor.b, vBubble.vBorderColor.a);
				Color vNewFontColor = new Color(vBubble.vFontColor.r, vBubble.vFontColor.g, vBubble.vFontColor.b, 255f);
			   int fontSize = vBubble.vFontSize;

				//get all image below the main Object
				foreach (Transform child in vBubbleObject.transform)
				{
					SpriteRenderer vRenderer = child.GetComponent<SpriteRenderer> ();
					TextMesh vTextMesh = child.GetComponent<TextMesh> ();
					
					if (vRenderer != null && child.name.Contains("Body"))
					{
						//change the body color
						vRenderer.color = vNewBodyColor;
						
						if (vRenderer.sortingOrder < 10)
							vRenderer.sortingOrder = 1500;
					}
					else if (vRenderer != null && child.name.Contains("Border"))
					{
						//change the border color
						vRenderer.color = vNewBorderColor;
						if (vRenderer.sortingOrder < 10)
							vRenderer.sortingOrder = 1501;
					} 
					else if (vTextMesh != null && child.name.Contains("Message"))
					{
						//change the message and show it in front of everything
						vTextMesh.color = vNewFontColor;
						vTextMesh.text = vTrueMessage;
                  Font biancoRegularFont = (Font)Resources.Load<Font>("Biancoenero Regular.otf");
					   vTextMesh.font = biancoRegularFont;
					   vTextMesh.fontSize = fontSize;
						child.GetComponent<MeshRenderer>().sortingOrder = 1550;
						
						Transform vMouseIcon = child.FindChild("MouseIcon");
						if (vMouseIcon != null && !vBubble.vClickToCloseBubble)
							vMouseIcon.gameObject.SetActive(false);
					}
					
					//disable the mouse icon because it will close by itself
					if (child.name == "MouseIcon" && !vBubble.vClickToCloseBubble)
						child.gameObject.SetActive(false);
					else
						vActiveBubble =  vBubble; //keep the active bubble and wait for the Left Click
				}
				
				vcharacter.vCurrentBubble = vBubbleObject; //attach it to the player
				vBubbleObject.transform.parent = vcharacter.transform; //make him his parent
			} else if (vActiveBubble == vBubble && vActiveBubble.vClickToCloseBubble)
			{
				gotonextbubble = true;
				vcharacter.vCurrentBubble = null;
			}
		}
	}	
コード例 #55
0
        public void Talk(string Message, SpeechType Type, int Emoticon, string TargetUserName)
        {
            UnSuppress();

            MessageAmount++;

            if (!IsPet)
            {
                if (!GetRoom().GetRoomEngine().CheckPetCommand(GetClient(), Message))
                {
                    if ((DateTime.Now - LastMessage).TotalSeconds < 4)
                    {
                        if (MessageAmount > 6)
                        {
                            Response Flood = new Response(27);
                            Flood.AppendInt32(BrickEngine.GetConfigureFile().CallIntKey("flood.penalty.seconds"));
                            GetClient().SendResponse(Flood);
                            return;
                        }
                    }
                    else
                    {
                        MessageAmount = 0;
                    }
                }

                LastMessage = DateTime.Now;
            }

            if (Message.StartsWith(":"))
            {
                List<string> Params = Message.Split(' ').ToList();

                string RawCommand = Params[0];

                // Make sure the 'Command' is removed.
                Params.Remove(RawCommand);

                string CleanCommand = RawCommand.Substring(1);

                if (BrickEngine.GetCommandHandler().HandleCommand(CleanCommand, GetClient(), Params))
                {
                    return;
                }
            }

            if (!IsPet)
            {
                BrickEngine.GetChatlogHandler().AddChatlog(HabboId, RoomId, Message);
            }

            VirtualRoomUser Target = null;

            if (Type.Equals(SpeechType.Whisper) && TargetUserName.Length > 0)
            {
                if (TargetUserName.Length <= 0)
                {
                    return;
                }
                else
                {
                    int TargetHabboId = BrickEngine.GetUserReactor().GetId(TargetUserName);

                    Target = GetRoom().GetRoomEngine().GetUserByHabboId(TargetHabboId);
                }
            }

            int Header = 0;

            if (Type.Equals(SpeechType.Talk))
            {
                Header = 24;
            }
            else if (Type.Equals(SpeechType.Shout))
            {
                Header = 26;
            }
            else if (Type.Equals(SpeechType.Whisper))
            {
                Header = 25;
            }

            if (Type.Equals(SpeechType.Whisper))
            {
                if (Target != null)
                {

                    Response Response = new Response(Header);

                    Response.AppendInt32(VirtualId);
                    Response.AppendStringWithBreak(BrickEngine.GetWordFilterHandler().FilterMessage(Target.GetClient(), Message));
                    Response.AppendInt32(Emoticon);
                    Response.AppendBoolean(false);

                    // Check Receiver & Send to Receiver
                    if (!Target.GetClient().GetUser().HasIgnoredUser(HabboId))
                    {
                        Target.GetClient().SendResponse(Response);
                    }

                    // Make sure you won't forget yourself.
                    GetClient().SendResponse(Response);
                }
            }
            else
            {
                GetRoom().GetRoomEngine().BroadcastChatResponse(HabboId, VirtualId, Header, Emoticon, Message);
            }
        }