示例#1
0
 public void SetText()
 {
     while (messageList.Count > 10)
     {
         messageList.RemoveAt(0);
     }
     text.text = "";
     for (int i = messageList.Count - 1; i >= 0; i--)
     {
         MessageLine line = messageList[i];
         if (line.type == LogMessageType.Log)
         {
             text.text += "<color=\"black\">";
             text.text += line.message;
             text.text += "</color>\n";
         }
         else if (line.type == LogMessageType.Warning)
         {
             text.text += "<color=\"blue\">";
             text.text += line.message;
             text.text += "</color>\n";
         }
         else
         {
             text.text += "<color=\"red\">";
             text.text += line.message;
             text.text += "</color>\n";
         }
     }
 }
示例#2
0
 private void Vm_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (e.PropertyName == "Logs")
     {
         this.UpdateGrid(ref logList, vm.Logs.Count, grid, prefab, (i) => {
             logList[i].init(vm.Logs[i]);
         });
     }
     else if (e.PropertyName == "Logs_End")
     {
         mouthDd.interactable = !autoNowday.isOn;
         yearDd.interactable  = !autoNowday.isOn;
         dayDd.interactable   = !autoNowday.isOn;
         nowbtn.interactable  = !autoNowday.isOn;
         weekbtn.interactable = !autoNowday.isOn;
         if (timeOutCo != null)
         {
             StopCoroutine(timeOutCo);
         }
     }
     else if (e.PropertyName == "Login_Failed")
     {
         MessageLine.Show("登录失败".color("red"));
     }
 }
示例#3
0
    public void AddMessage(string message, LogMessageType type)
    {
        MessageLine line = new MessageLine();

        line.message = message;
        line.type    = type;
        messageList.Add(line);
        SetText();
    }
示例#4
0
    // PRIVATE METHODS

    void PrepareList(GUIBase_List list)
    {
        m_MessageList = list;

        m_MessageLines = new MessageLine[m_MessageList.numOfLines];
        for (int idx = 0; idx < m_MessageLines.Length; ++idx)
        {
            m_MessageLines[idx] = new MessageLine(m_MessageList.GetWidgetOnLine(idx), OnMessageAction);
        }
    }
示例#5
0
 private void Awake()
 {
     if (Instance != null && Instance != this)
     {
         DestroyObject(gameObject);
         return;
     }
     Instance = this;
     render   = GetComponent <CanvasRenderer> ();
 }
示例#6
0
        public void TestCorrectLimbusTimeLimit()
        {
            string chatText = "8d,00,00,60808010,00000023,00000023,0028,00,01,02,00,Moogle : Chaaange...job! Kupopopooo!1";

            DateTime timestamp = DateTime.Now;
            ChatLine chatLine  = new ChatLine(chatText, timestamp);

            MessageLine msgLine = new MessageLine(chatLine);

            Assert.That(msgLine.TextOutput, Is.EqualTo("Moogle : Chaaange...job! Kupopopooo!"));
        }
示例#7
0
文件: Lancher.cs 项目: xue-blood/Fufu
    private void Start()
    {
        Config.loadConfig();
        OpenWindow <MainWindow> ();

        if (!Config.name.valid() || !Config.password.valid())
        {
            OpenDialogWindow <SettingWindow> ();
            MessageLine.Show("请输出帐号和密码");
        }
    }
示例#8
0
        public void TestTokenizeTextWithItems()
        {
            string chatText = "55,00,00,80808010,0000265a,00002c51,0022,00,01,02,00,Lans uses a toolbag (shihei).1";

            DateTime timestamp = DateTime.Now;
            ChatLine chatLine  = new ChatLine(chatText, timestamp);

            MessageLine msgLine = new MessageLine(chatLine);

            Assert.That(msgLine.TextOutput, Is.EqualTo("Lans uses a toolbag (shihei)."));
        }
示例#9
0
        public void TestTokenizeTextWithAutotranslate()
        {
            string chatText = "05,00,00,8020c0a0,00000018,00000018,0020,00,01,01,00,(Motenten) stuff for ï'Salvageï(";

            DateTime timestamp = DateTime.Now;
            ChatLine chatLine  = new ChatLine(chatText, timestamp);

            MessageLine msgLine = new MessageLine(chatLine);

            Assert.That(msgLine.TextOutput, Is.EqualTo("(Motenten) stuff for [Salvage]"));
        }
示例#10
0
    IEnumerator getLogTimeout()
    {
        yield return(new WaitForSeconds(15));

        MessageLine.Show("请求超时");
        mouthDd.interactable = true;
        yearDd.interactable  = true;
        dayDd.interactable   = true;
        nowbtn.interactable  = true;
        weekbtn.interactable = true;
    }
示例#11
0
        public void TestCorrectItemDrops()
        {
            string chatText = "79,00,00,80c0c050,000026cd,00002cd6,0035,00,01,02,00,yYou find a wind crystal on the Greater Colibri.1";

            DateTime timestamp = DateTime.Now;
            ChatLine chatLine  = new ChatLine(chatText, timestamp);

            MessageLine msgLine = new MessageLine(chatLine);

            Assert.That(msgLine.TextOutput, Is.EqualTo("You find a wind crystal on the Greater Colibri."));
        }
示例#12
0
        public void TestCorrectItemDistribution()
        {
            string chatText = "7f,00,00,80c0c050,0000277a,00002dac,0022,00,01,02,00,Motenten obtains a wind crystal.1";

            DateTime timestamp = DateTime.Now;
            ChatLine chatLine  = new ChatLine(chatText, timestamp);

            MessageLine msgLine = new MessageLine(chatLine);

            Assert.That(msgLine.TextOutput, Is.EqualTo("Motenten obtains a wind crystal."));
        }
示例#13
0
        public void TestTokenizeTextWithKeyItems()
        {
            string chatText = "94,02,00,80808080,00000010,00000010,0033,00,01,00,00,Obtained key item: Healer's attire claim slip.1";

            DateTime timestamp = DateTime.Now;
            ChatLine chatLine  = new ChatLine(chatText, timestamp);

            MessageLine msgLine = new MessageLine(chatLine);

            Assert.That(msgLine.TextOutput, Is.EqualTo("Obtained key item: Healer's attire claim slip."));
        }
示例#14
0
        public void TestCorrectAssaultTimeLimit()
        {
            string chatText = "92,02,00,80808080,00006c88,00007d44,002b,00,01,00,00,?Time remaining: 5 minutes (Earth time).1";

            DateTime timestamp = DateTime.Now;
            ChatLine chatLine  = new ChatLine(chatText, timestamp);

            MessageLine msgLine = new MessageLine(chatLine);

            Assert.That(msgLine.TextOutput, Is.EqualTo("Time remaining: 5 minutes (Earth time)."));
        }
示例#15
0
        public void TestStandardConstruction()
        {
            string chatText =
                "01,00,00,80808080,00000019,00000017,0010,00,01,01,00,Motenten : one";

            DateTime timestamp = DateTime.Now;
            ChatLine chatLine  = new ChatLine(chatText, timestamp);

            MessageLine msgLine = new MessageLine(chatLine);

            Assert.That(msgLine.OriginalText, Is.EqualTo(chatText));
            Assert.That(msgLine.Timestamp, Is.EqualTo(timestamp));
        }
        public MainWindow()
        {
            MyItems = new System.Collections.ObjectModel.ObservableCollection <ListData>();
            InitializeComponent();
            VersionLabel.Text = String.Format("Version: {0}", System.Reflection.Assembly.GetEntryAssembly().GetName().Version);

            log.Info(m => m("Exam Data Import is Starting Up"));
            ActiveMessageLine            = new MessageLine(AddMessageLine);
            ChangeMessageLine            = new MessageLine(UpdateMessageLine);
            ActiveProgress               = new AlterProgress(ProgressChanged);
            ActiveFileName               = new FileName(AddFileName);
            this.messageList.DataContext = MyItems;
        }
示例#17
0
        public void RunA1LineTest()
        {
            string      chatText = "1a,ef,91,80707070,00001487,00001772,004b,00,01,02,00,1 of the Hilltroll Red Mage's shadows absorbs the damage and disappears.1";
            ChatLine    chatLine = new ChatLine(chatText);
            MessageLine msgLine  = new MessageLine(chatLine);

            MsgManager.Instance.Reset();

            Message msg = Parser.Parse(msgLine);

            //MsgManager.Instance.Reset();
            EntityManager.Instance.AddEntitiesFromMessage(msg);
            MsgManager.Instance.AddMessageToMessageCollection(msg);
        }
示例#18
0
 void close()
 {
     if (window)
     {
         window.FinishWindow();
     }
     else if (exitGame)
     {
         if (exitnow)
         {
             doclose();
         }
         exitnow = true;
         MessageLine.Show("再点一次" + "退出".color("red"), () => exitnow = false);
     }
 }
示例#19
0
        private void ImageButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //Opens a filedialog where a picture is chosen. (only works for smaller sizes, increase the receive buffer size to send larger files
                OpenFileDialog open = new OpenFileDialog();
                open.Filter = "Image Files(*.jpg; )|*.jpg;";

                if (open.ShowDialog() == true)
                {
                    //Specifices the image source
                    string ImgSrc  = open.FileName;
                    byte[] imgBuff = File.ReadAllBytes(ImgSrc);

                    DataPacket DP = new DataPacket(4, MyUsername, "Image", imgBuff);
                    Db.AddToChatHistory(DP, MyUsername);
                    SocketClass.Send(DP);

                    //Converts the imgbuffer to a picture that can be displayed in the chat
                    using (var ms = new System.IO.MemoryStream(imgBuff))
                    {
                        var image = new BitmapImage();
                        image.BeginInit();
                        image.CacheOption       = BitmapCacheOption.OnLoad; // here
                        image.StreamSource      = ms;
                        image.DecodePixelHeight = 100;
                        image.DecodePixelWidth  = 100;
                        image.EndInit();
                        image.Freeze();

                        Eventaction_DisplayImage(image, new EventArgs());
                    }
                    ConvoBox.Items.Add(DateTime.Now + " Me: " + "Image");
                    MessageLine.Clear();
                }
            }
            catch (SocketException ex)
            {
                MessageBox.Show("A socket error occurred: " + ex.ToString());
                Console.WriteLine(ex.StackTrace);
            }
            catch (Exception ex)
            {
                MessageBox.Show("A error occured: " + ex.ToString());
                Console.WriteLine(ex.StackTrace);
            }
        }
示例#20
0
    // HANDLERS

    void OnUpdateTableRow(GUIBase_Widget widget, int rowIndex, int itemIndex)
    {
        MessageLine row = m_MessageLines[rowIndex];

        if (itemIndex < m_Messages.Length)
        {
            Message message = m_Messages[itemIndex];
            bool    active  = m_ActiveMessage == itemIndex ? true : false;

            row.Show();
            row.Update(message, itemIndex, active);
        }
        else
        {
            row.Hide();
        }
    }
示例#21
0
        public void TestAddMultipleMessageLines()
        {
            string chatText1 = "cd,03,00,8050ff60,0000003a,00000039,0084,00,01,00,01,@Slice of desron slice of foy slice of chelolo hmm where did i put it AHA! Essence of minmin Leftover sandwich yum (Nov. 29, 2008 ";
            string chatText2 = "cd,03,00,8050ff60,0000003a,0000003a,000d,00,01,00,00,@9:59:15pm)";

            DateTime timestamp = DateTime.Now;
            ChatLine chatLine1 = new ChatLine(chatText1, timestamp);
            ChatLine chatLine2 = new ChatLine(chatText2, timestamp.AddSeconds(1));

            Message     msg = new Message();
            MessageLine msgLine;

            msgLine = new MessageLine(chatLine1);
            msg.AddMessageLine(msgLine);
            msgLine = new MessageLine(chatLine2);
            msg.AddMessageLine(msgLine);

            // This particular message is a linkshell message.  Adjust based on known
            // parsing rules.
            msg.SetMessageCategory(MessageCategoryType.Chat);
            Assert.That(msg.ChatDetails, Is.Not.Null);
            msg.ChatDetails.ChatMessageType = ChatMessageType.Linkshell;
            msg.ChatDetails.ChatSpeakerName = "-Linkshell-";
            msg.ChatDetails.ChatSpeakerType = SpeakerType.Unknown;


            Assert.That(msg.Timestamp, Is.EqualTo(timestamp));

            Assert.That(msg.MessageCategory, Is.EqualTo(MessageCategoryType.Chat));
            Assert.That(msg.MessageID, Is.EqualTo(0x3a));
            Assert.That(msg.MessageCode, Is.EqualTo(0xcd));
            Assert.That(msg.ExtraCode1, Is.EqualTo(0x03));
            Assert.That(msg.ExtraCode2, Is.EqualTo(0x00));


            Assert.That(msg.PreviousMessageText, Is.Empty);
            Assert.That(msg.CurrentMessageText, Is.EqualTo("Slice of desron slice of foy slice of chelolo hmm where did i put it AHA! Essence of minmin Leftover sandwich yum (Nov. 29, 2008 9:59:15pm)"));
            Assert.That(msg.CompleteMessageText, Is.EqualTo("Slice of desron slice of foy slice of chelolo hmm where did i put it AHA! Essence of minmin Leftover sandwich yum (Nov. 29, 2008 9:59:15pm)"));

            msg.SetParseSuccess(true);

            Assert.That(msg.PreviousMessageText, Is.EqualTo("Slice of desron slice of foy slice of chelolo hmm where did i put it AHA! Essence of minmin Leftover sandwich yum (Nov. 29, 2008 9:59:15pm)"));
            Assert.That(msg.CurrentMessageText, Is.Empty);
            Assert.That(msg.CompleteMessageText, Is.EqualTo("Slice of desron slice of foy slice of chelolo hmm where did i put it AHA! Essence of minmin Leftover sandwich yum (Nov. 29, 2008 9:59:15pm)"));
        }
示例#22
0
        public void TestConvertJapaneseChars()
        {
            string chatText = "0d,00,00,80ff5000,000001fa,0000021b,001c,00,01,01,00,(Konychanz) HP‰©F‚¢‚¶‚á‚È‚¢‚©EEE‚—";

            DateTime timestamp = DateTime.Now;
            ChatLine chatLine  = new ChatLine(chatText, timestamp);

            MessageLine msgLine = new MessageLine(chatLine);

            Assert.That(msgLine.MessageCode, Is.EqualTo(0x0d));
            Assert.That(msgLine.ExtraCode1, Is.EqualTo(0x00));
            Assert.That(msgLine.ExtraCode2, Is.EqualTo(0x00));
            Assert.That(msgLine.TextColor, Is.EqualTo(0x80ff5000));
            Assert.That(msgLine.EventSequence, Is.EqualTo(0x000001fa));
            Assert.That(msgLine.UniqueSequence, Is.EqualTo(0x0000021b));
            Assert.That(msgLine.TextLength, Is.EqualTo(0x001c));
            Assert.That(msgLine.MessageCategoryNumber, Is.EqualTo(0x01));
            Assert.That(msgLine.MessageCategory, Is.EqualTo(MessageCategoryType.Chat));
            Assert.That(msgLine.TextOutput, Is.EqualTo("(Konychanz) HP黄色いじゃないか・・・w"));
        }
示例#23
0
        public void TestTokenizeBaseline()
        {
            string chatText = "01,00,00,80808080,00000019,00000017,0010,00,01,01,00,Motenten : one";

            DateTime timestamp = DateTime.Now;
            ChatLine chatLine  = new ChatLine(chatText, timestamp);

            MessageLine msgLine = new MessageLine(chatLine);

            Assert.That(msgLine.MessageCode, Is.EqualTo(0x01));
            Assert.That(msgLine.ExtraCode1, Is.EqualTo(0x00));
            Assert.That(msgLine.ExtraCode2, Is.EqualTo(0x00));
            Assert.That(msgLine.TextColor, Is.EqualTo(0x80808080));
            Assert.That(msgLine.EventSequence, Is.EqualTo(0x00000019));
            Assert.That(msgLine.UniqueSequence, Is.EqualTo(0x00000017));
            Assert.That(msgLine.TextLength, Is.EqualTo(0x0010));
            Assert.That(msgLine.MessageCategoryNumber, Is.EqualTo(0x01));
            Assert.That(msgLine.MessageCategory, Is.EqualTo(MessageCategoryType.Chat));
            Assert.That(msgLine.TextOutput, Is.EqualTo("Motenten : one"));
        }
示例#24
0
        public void RunA2LineTest()
        {
            string      chatText1 = "a3,00,00,80c08080,000003ec,00000485,003c,00,01,02,00,Vixx hits the Vanguard Enchanter for 90 points of damage.1";
            string      chatText2 = "bb,00,00,8090c0f0,0000040b,000004ad,003f,00,01,02,00,Additional effect: 3 TP drained from the Vanguard Enchanter.1";
            ChatLine    chatLine1 = new ChatLine(chatText1);
            MessageLine msgLine1  = new MessageLine(chatLine1);
            ChatLine    chatLine2 = new ChatLine(chatText2);
            MessageLine msgLine2  = new MessageLine(chatLine2);

            MsgManager.Instance.Reset();

            Message msg1 = Parser.Parse(msgLine1);

            //MsgManager.Instance.Reset();
            EntityManager.Instance.AddEntitiesFromMessage(msg1);
            MsgManager.Instance.AddMessageToMessageCollection(msg1);

            // Save msg1 in MsgManager
            Message msg = Parser.Parse(msgLine2);
        }
示例#25
0
        public void TestAddMessageLine()
        {
            string chatText = "94,02,00,80808080,00000010,00000010,0033,00,01,00,00,Obtained key item: Healer's attire claim slip.1";

            DateTime timestamp = DateTime.Now;
            ChatLine chatLine  = new ChatLine(chatText, timestamp);

            MessageLine msgLine = new MessageLine(chatLine);

            Message msg = new Message();

            msg.AddMessageLine(msgLine);

            Assert.That(msg.Timestamp, Is.EqualTo(timestamp));

            Assert.That(msg.MessageCategory, Is.EqualTo(MessageCategoryType.System));
            Assert.That(msg.MessageID, Is.EqualTo(0x10));
            Assert.That(msg.MessageCode, Is.EqualTo(0x94));
            Assert.That(msg.ExtraCode1, Is.EqualTo(0x02));
            Assert.That(msg.ExtraCode2, Is.EqualTo(0x00));

            Assert.That(msg.PreviousMessageText, Is.Empty);
            Assert.That(msg.CurrentMessageText, Is.EqualTo("Obtained key item: Healer's attire claim slip."));
            Assert.That(msg.CompleteMessageText, Is.EqualTo("Obtained key item: Healer's attire claim slip."));

            msg.SetParseSuccess(false);

            Assert.That(msg.IsParseSuccessful, Is.False);
            Assert.That(msg.PreviousMessageText, Is.Empty);
            Assert.That(msg.CurrentMessageText, Is.EqualTo("Obtained key item: Healer's attire claim slip."));
            Assert.That(msg.CompleteMessageText, Is.EqualTo("Obtained key item: Healer's attire claim slip."));

            msg.SetParseSuccess(true);

            Assert.That(msg.IsParseSuccessful, Is.True);
            Assert.That(msg.PreviousMessageText, Is.EqualTo("Obtained key item: Healer's attire claim slip."));
            Assert.That(msg.CurrentMessageText, Is.Empty);
            Assert.That(msg.CompleteMessageText, Is.EqualTo("Obtained key item: Healer's attire claim slip."));
        }
示例#26
0
 private void SendButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         //Creates a packet with the specific messages and sends it.
         DataPacket DP = new DataPacket(0, MyUsername, MessageLine.Text, new byte[1]);
         Db.AddToChatHistory(DP, MyUsername);
         SocketClass.Send(DP);
         ConvoBox.Items.Add(DateTime.Now + " Me: " + MessageLine.Text);
         MessageLine.Clear();
     }
     catch (SocketException ex)
     {
         MessageBox.Show("A socket error occurred: " + ex.ToString());
         Console.WriteLine(ex.StackTrace);
     }
     catch (Exception ex)
     {
         MessageBox.Show("A error occured: " + ex.ToString());
         Console.WriteLine(ex.StackTrace);
     }
 }
示例#27
0
        public void TestTokenizeTimestampPluginLOG3()
        {
            DateTime timestamp = DateTime.Now.ToUniversalTime();

            DateTime pluginTimestamp = DateTime.Today;

            pluginTimestamp = pluginTimestamp.AddHours(12);
            pluginTimestamp = pluginTimestamp.AddMinutes(15);
            pluginTimestamp = pluginTimestamp.AddSeconds(10);
            pluginTimestamp = pluginTimestamp.ToUniversalTime();

            string chatText = "01,00,00,80808080,00000019,00000017,0010,00,01,01,00,ú[12:15:10] Motenten : one";

            ChatLine chatLine = new ChatLine(chatText, timestamp);

            Monitor.Instance.SetParseMode(DataSource.Log);

            MessageLine msgLine = new MessageLine(chatLine);

            Assert.That(msgLine.TextOutput, Is.EqualTo("Motenten : one"));
            Assert.That(msgLine.Timestamp, Is.EqualTo(pluginTimestamp));
        }
示例#28
0
        public void TestTokenizeTimestampPluginLOGCorruptedConversion()
        {
            DateTime timestamp = DateTime.Now.ToUniversalTime();

            DateTime pluginTimestamp = DateTime.Today;

            pluginTimestamp = pluginTimestamp.AddHours(0);
            pluginTimestamp = pluginTimestamp.AddMinutes(40);
            pluginTimestamp = pluginTimestamp.AddSeconds(54);
            pluginTimestamp = pluginTimestamp.ToUniversalTime();

            string chatText = "01,00,00,80808080,00000009,00000009,001c,00,01,01,00,・00:40:54] Aluri : hello";

            ChatLine chatLine = new ChatLine(chatText, timestamp);

            Monitor.Instance.SetParseMode(DataSource.Log);

            MessageLine msgLine = new MessageLine(chatLine);

            Assert.That(msgLine.TextOutput, Is.EqualTo("Aluri : hello"));
            Assert.That(msgLine.Timestamp, Is.EqualTo(pluginTimestamp));
        }
示例#29
0
    IEnumerator getVersion()
    {
        if (Lancher.Instance == null)
        {
            yield break;
        }
        var www = UnityWebRequest.Get(Lancher.Instance.versionUrl);

        yield return(www.Send());

        if (www.isError)
        {
            yield break;
        }
        string raw = www.downloadHandler.text;

        if (!raw.valid())
        {
            yield break;
        }
        Debug.Log(raw);

        var json = MiniJSON.Json.Deserialize(raw) as Dictionary <string, object>;

        if (json.ContainsKey(Lancher.Instance.platform))
        {
            var plat = json[Lancher.Instance.platform] as Dictionary <string, object>;

            // 版本
            if (plat.ContainsKey("version"))
            {
                var ver = plat["version"] as string;
                Debug.Log("version : " + ver.color("red"));
                if (ver != Lancher.Instance.version)
                {
                    // url
                    if (plat.ContainsKey("url"))
                    {
                        var urls = plat["url"] as List <object>;
                        if (urls != null)
                        {
                            for (int i = 0; i < urls.Count; i++)
                            {
                                var hww = UnityWebRequest.Head(urls[i] as string);
                                yield return(hww.Send());

                                if (!hww.isDone || hww.responseCode == 404)
                                {
                                    Debug.Log("Url no existed:" + urls[i].ToString().color("red"));
                                    continue;
                                }

                                base.url  = urls[i] as string;
                                text.text = "更新\n" + ver.color("red");
                                MessageLine.Show("有新版本: " + ver.color("cayn"));
                                Debug.Log("new version url : " + base.url.color("red"));
                                break;
                            }
                        }
                    }
                }
            }
        }

        yield return(new WaitForSeconds(60));

        url = "";
    }