예제 #1
0
        private void SendBattleChat()
        {
            if ((DateTime.Now - lastChatTime).TotalSeconds <= 5)
            {
                MessageBox.Show("你发言太快了,请坐下来休息一会吧!");
                return;
            }

            string msg = ChatTextBox.Text;

            if (msg.Length > 100)
            {
                MessageBox.Show("你发言字数太多,最多100字");
                return;
            }
            lastChatTime = DateTime.Now;
            string sendMsg = "BATTLE_MESSAGE" + "$" + msg;

            BattleNetManager.Instance.Chat(OLBattleGlobalSetting.Instance.channel, sendMsg);
            ChatTextBox.Text = "";

            string    info = string.Format("[{0}][{1}]:{2}", DateTime.Now.ToString(), "我", msg);
            TextBlock tb   = new TextBlock()
            {
                Text = info, Foreground = new SolidColorBrush(Colors.Yellow), FontSize = 12
            };

            ChatListBox.Items.Add(tb);
            ChatListBox.UpdateLayout();
            ChatListBox.ScrollIntoView(tb);
        }
예제 #2
0
 void MapListBoxItemAdd(int addacc, int num, ChatListBox MapListBox)
 {
     for (int i = 0; i < num; ++i)
     {
         MapListBox.Items[addacc].SubItems.Add(new CCWin.SkinControl.ChatListSubItem());
     }
 }
예제 #3
0
 private void ChatListBoxAutoScroll(object sender, NotifyCollectionChangedEventArgs e)
 {
     try
     {
         ChatListBox.ScrollIntoView(ChatListBox.Items[ChatListBox.Items.Count - 1]);
     }
     catch { }             // если нет элементов / пользователь действует слишком быстро
 }
예제 #4
0
 public void AddNewChatList(string msg)
 {
     Dispatcher.Invoke(() => {
         chatList.Add(msg);
         NotifyPropertyChanged("chatList");
         ChatListBox.ScrollIntoView(ChatListBox.Items[ChatListBox.Items.Count - 1]);
     });
     AddNewLog($"Msg '{msg}'");
 }
 public ClassStartUdpThread(ChatListBox chat)
 {
     this.Chat = chat;
     ListItem = new ChatListItem("我的好友");
     MyNameItem = new ChatListItem("自己");
     HNameItem = new ChatListItem("黑名单");
     Chat.Items.Add(ListItem);
     Chat.Items.Add(MyNameItem);
     Chat.Items.Add(HNameItem);
 }
예제 #6
0
 public void addChatMessage(string message)
 {
     try
     {
         ChatListBox.Invoke((MethodInvoker)(() =>
         {
             ChatListBox.Items.Add(message);
         }));
     }
     catch
     {
         ChatListBox.Items.Add(message);
     }
 }
예제 #7
0
 public MapListBoxInitClass Init(ChatListBox MapListBox, MapPanelEditor mapEditor)
 {
     MapListBox.Items.Clear();
     foreach (string str in this.MapListBoxItemStr)
     {
         MapListBox.Items.Add(new ChatListItem(str));
     }
     foreach (ChatListItem item in MapListBox.Items)
     {
         item.SubItems.Clear();
     }
     InitMapListJudgeTheme(MapListBox, mapEditor);
     RenewComposePlace(MapListBox, mapEditor);
     return(this);
 }
예제 #8
0
        void MapListBoxItemBaseAddAndRenewRange(ChatListBox MapListBox, int addacc, int startid, int endid, MapPanelEditor mapEditor)
        {
            int BaseCount = MapListBox.Items[addacc].SubItems.Count;
            int num       = endid - startid + 1;

            MapListBoxItemAdd(addacc, num, MapListBox);
            for (int i = BaseCount; i < BaseCount + num; ++i)
            {
                MapListBox.Items[addacc].SubItems[i].HeadImage = mapEditor.ThemeBar[mapEditor.ThemeNum][startid];
                MapListBox.Items[addacc].SubItems[i].ID        = (uint)startid;
                MapListBox.Items[addacc].SubItems[i].NicName   =
                    "Hex:" + MapListBox.Items[addacc].SubItems[i].ID.ToString("X2");
                MapListBox.Items[addacc].SubItems[i].PersonalMsg = "十进制代码:" + startid.ToString();
                MapListBox.Items[addacc].SubItems[i].DisplayName = MapListBoxItemStr[addacc] + (i + 1);
                startid++;
            }
        }
예제 #9
0
        private void OKButton_Click(object sender, EventArgs e)
        {
            for (var i = 0; i < ChatListBox.Items.Count; i++)
            {
                var chat        = ((ChatItem)ChatListBox.Items[i]).Chat;
                var itemChecked = ChatListBox.GetItemChecked(i);

                if (itemChecked)
                {
                    ChatFilter.IncludeChat(chat);
                }
                else
                {
                    ChatFilter.ExcludeChat(chat);
                }
            }

            Close();
        }
예제 #10
0
        public void RenewComposePlace(ChatListBox MapListBox, MapPanelEditor mapEditor)
        {
            #region 常用放置
            ADDacc = ComPlaceId;

            MapListBox.Items[ADDacc].SubItems.Clear();
            MapAddNumber = ComposePlace.List.Count;
            MapListBoxItemAdd(ADDacc, MapAddNumber, MapListBox);

            foreach (ComposePlace com in ComposePlace.List)
            {
                com.RenewShowImgAndItemImage();
            }

            for (int i = 0; i < MapAddNumber; ++i)
            {
                MapListBoxComposePlaceItemMessegeRenew(ComposePlace.List[i].ShowImg, ADDacc, i, i, "组合",
                                                       ComposePlace.List[i].Size, MapListBox);
            }

            ++ADDacc;

            #endregion
        }
예제 #11
0
        private void InitMapListJudgeTheme(ChatListBox MapListBox, MapPanelEditor mapEditor)
        {
            #region 共有的
            MapListBoxItemBaseAddAndRenewRange((int)MapListBoxItemId.基地与龙种标识, 0, 1, "我方基地", MapListBox, mapEditor);  //0
            MapListBoxItemBaseAddAndRenewRange((int)MapListBoxItemId.基地与龙种标识, 13, 1, "敌方基地", MapListBox, mapEditor); //0
            MapListBoxItemBaseAddAndRenewRange((int)MapListBoxItemId.基地与龙种标识, 24, 1, "我方单位", MapListBox, mapEditor); //0
            MapListBoxItemBaseAddAndRenewRange((int)MapListBoxItemId.基地与龙种标识, 72, 1, "敌方单位", MapListBox, mapEditor); //0

            MapListBoxItemBaseAddAndRenewRange((int)MapListBoxItemId.藤蔓, 1, 3, "藤蔓", MapListBox, mapEditor);         //1 2 3

            MapListBoxItemBaseAddAndRenewRange((int)MapListBoxItemId.树, 4, 1, "树地", MapListBox, mapEditor);          //4

            MapListBoxItemBaseAddAndRenewRange((int)MapListBoxItemId.草地, 5, 4, "草地", MapListBox, mapEditor);         //5 6 7 8

            MapListBoxItemBaseAddAndRenewRange((int)MapListBoxItemId.空地, 9, 1, "空地", MapListBox, mapEditor);         //9

            MapListBoxItemBaseAddAndRenewRange((int)MapListBoxItemId.湿地, 10, 2, "湿地", MapListBox, mapEditor);        //10 11

            MapListBoxItemBaseAddAndRenewRange((int)MapListBoxItemId.坑, 12, 1, "坑", MapListBox, mapEditor);          //12
            //13暂时不可用
            MapListBoxItemBaseAddAndRenewRange((int)MapListBoxItemId.旱地, 14, 1, "旱地", MapListBox, mapEditor);        //14
            MapListBoxItemBaseAddAndRenewRange((int)MapListBoxItemId.旱地, 19, 1, "旱地", MapListBox, mapEditor);        //19

            MapListBoxItemBaseAddAndRenewRange((int)MapListBoxItemId.花地, 15, 3, "花地", MapListBox, mapEditor);        //15 16 17

            MapListBoxItemBaseAddAndRenewRange((int)MapListBoxItemId.死地, 18, 1, "死地", MapListBox, mapEditor);        //18

            MapListBoxItemBaseAddAndRenewRange((int)MapListBoxItemId.火焰, 20, 1, "火焰", MapListBox, mapEditor);        //20

            MapListBoxItemBaseAddAndRenewRange((int)MapListBoxItemId.石头, 21, 2, "石头", MapListBox, mapEditor);        //21 22

            MapListBoxItemBaseAddAndRenewRange((int)MapListBoxItemId.树, 23, 1, "树", MapListBox, mapEditor);          //23

            MapListBoxItemBaseAddAndRenewRange((int)MapListBoxItemId.水面, (int)MapIdDefine.水面Start,
                                               (int)MapIdDefine.水面Count, "水面", MapListBox, mapEditor);//shuiming

            MapListBoxItemBaseAddAndRenewRange((int)MapListBoxItemId.岩浆, (int)MapIdDefine.岩浆Start,
                                               (int)MapIdDefine.岩浆Count, "岩浆", MapListBox, mapEditor);         //yanjaing

            MapListBoxItemBaseAddAndRenewRange((int)MapListBoxItemId.沙地, 191, 1, "沙地", MapListBox, mapEditor); //191

            MapListBoxItemBaseAddAndRenewRange((int)MapListBoxItemId.雪地, 192, 1, "雪地", MapListBox, mapEditor); //192

            #endregion

            #region 单独的

            switch (mapEditor.ThemeNum)
            {
            case (int)MapThemeIdEnum.遗迹主题:
                #region 空地

                #endregion
                #region 草地

                #endregion
                #region 花地

                #endregion
                #region 藤蔓


                #endregion
                #region 湿地


                #endregion
                #region 旱地

                #endregion
                #region 沙地

                #endregion
                #region 雪地

                #endregion
                #region 死地

                #endregion
                #region 树


                #endregion
                #region 石头


                #endregion
                #region 火焰

                #endregion
                #region 坑


                #endregion
                #region 水面

                #endregion
                #region 岩浆


                #endregion
                #region 山地顶

                MapListBoxItemBaseAddAndRenewRange((int)MapListBoxItemId.山地顶,
                                                   121, 167 - 121 + 1, "山地顶", MapListBox, mapEditor);

                MapListBoxItemBaseAddAndRenewRange((int)MapListBoxItemId.山地顶,
                                                   186, 190 - 186 + 1, "山地顶", MapListBox, mapEditor);

                MapListBoxItemBaseAddAndRenewRange((int)MapListBoxItemId.山地顶,
                                                   194, 0 - 0 + 1, "山地顶", MapListBox, mapEditor);

                MapListBoxItemBaseAddAndRenewRange((int)MapListBoxItemId.山地顶,
                                                   197, 0 - 0 + 1, "山地顶", MapListBox, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地顶,
                                                   201, 208, "山地顶", mapEditor);

                #endregion
                #region 山地底

                MapListBoxItemBaseAddAndRenewRange((int)MapListBoxItemId.山地底,
                                                   169, 185 - 169 + 1, "山地底", MapListBox, mapEditor);

                #endregion
                #region 冰面

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.冰面,
                                                   (int)MapIdDefine.冰面Start, (int)MapIdDefine.冰面End, "冰面", mapEditor);

                #endregion
                #region 基地与龙种标识

                #endregion
                #region 常用放置

                #endregion
                break;

            case (int)MapThemeIdEnum.海岸主题:
                #region 空地

                #endregion
                #region 草地

                #endregion
                #region 花地

                #endregion
                #region 藤蔓


                #endregion
                #region 湿地


                #endregion
                #region 旱地

                #endregion
                #region 沙地

                #endregion
                #region 雪地

                #endregion
                #region 死地

                #endregion
                #region 树

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.树,
                                                   194, 197, mapEditor);

                #endregion
                #region 石头

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.石头,
                                                   198, 199, mapEditor);

                #endregion
                #region 火焰

                #endregion
                #region 坑


                #endregion
                #region 水面

                #endregion
                #region 岩浆


                #endregion
                #region 山地顶

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地顶,
                                                   121, 167, "山地顶", mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地顶,
                                                   201, 206, mapEditor);

                #endregion
                #region 山地底

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地底,
                                                   169, 189, "山地底", mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地底,
                                                   207, 208, mapEditor);

                #endregion
                #region 冰面

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.冰面,
                                                   209, 255, mapEditor);

                #endregion
                #region 基地与龙种标识

                #endregion
                #region 常用放置

                #endregion
                break;

            case (int)MapThemeIdEnum.山地主题:
                #region 空地

                #endregion
                #region 草地

                #endregion
                #region 花地

                #endregion
                #region 藤蔓


                #endregion
                #region 湿地


                #endregion
                #region 旱地

                #endregion
                #region 沙地

                #endregion
                #region 雪地

                #endregion
                #region 死地

                #endregion
                #region 树

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.树,
                                                   194, 194, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.树,
                                                   196, 197, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.树,
                                                   201, 202, mapEditor);

                #endregion
                #region 石头

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.石头,
                                                   198, 199, mapEditor);

                #endregion
                #region 火焰

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.火焰,
                                                   190, 190, mapEditor);

                #endregion
                #region 坑


                #endregion
                #region 水面

                #endregion
                #region 岩浆


                #endregion
                #region 山地顶

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地顶,
                                                   121, 167, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地顶,
                                                   203, 214, mapEditor);


                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地顶,
                                                   219, 230, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地顶,
                                                   235, 251, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地顶,
                                                   234, 255, mapEditor);

                #endregion
                #region 山地底

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地底,
                                                   169, 189, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地底,
                                                   193, 193, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地底,
                                                   195, 195, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地底,
                                                   215, 218, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地底,
                                                   231, 234, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地底,
                                                   252, 253, mapEditor);

                #endregion
                #region 冰面


                #endregion
                #region 基地与龙种标识

                #endregion
                #region 常用放置

                #endregion
                break;

            case (int)MapThemeIdEnum.城堡主题:
                #region 空地

                #endregion
                #region 草地

                #endregion
                #region 花地

                #endregion
                #region 藤蔓


                #endregion
                #region 湿地


                #endregion
                #region 旱地

                #endregion
                #region 沙地

                #endregion
                #region 雪地

                #endregion
                #region 死地

                #endregion
                #region 树

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.树,
                                                   195, 196, mapEditor);

                #endregion
                #region 石头

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.石头,
                                                   193, 193, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.石头,
                                                   198, 200, mapEditor);

                #endregion
                #region 火焰

                #endregion
                #region 坑


                #endregion
                #region 水面

                #endregion
                #region 岩浆


                #endregion
                #region 山地顶

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地顶,
                                                   121, 167, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地顶,
                                                   186, 190, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地顶,
                                                   194, 194, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地顶,
                                                   197, 197, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地顶,
                                                   201, 208, mapEditor);

                #endregion
                #region 山地底

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地底,
                                                   169, 185, mapEditor);

                #endregion
                #region 冰面

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.冰面,
                                                   209, 255, mapEditor);

                #endregion
                #region 基地与龙种标识

                #endregion
                #region 常用放置

                #endregion
                break;

            case (int)MapThemeIdEnum.城市主题:
                #region 空地

                #endregion
                #region 草地

                #endregion
                #region 花地

                #endregion
                #region 藤蔓


                #endregion
                #region 湿地


                #endregion
                #region 旱地

                #endregion
                #region 沙地

                #endregion
                #region 雪地

                #endregion
                #region 死地

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地顶,
                                                   182, 182, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地顶,
                                                   212, 220, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地顶,
                                                   201, 211, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地顶,
                                                   221, 236, mapEditor);

                #endregion
                #region 树

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.树,
                                                   194, 197, mapEditor);

                #endregion
                #region 石头

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.石头,
                                                   193, 193, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.石头,
                                                   198, 200, mapEditor);

                #endregion
                #region 火焰

                #endregion
                #region 坑


                #endregion
                #region 水面

                #endregion
                #region 岩浆

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.岩浆,
                                                   241, 244, mapEditor);

                #endregion
                #region 山地顶

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地顶,
                                                   121, 167, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地顶,
                                                   178, 181, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地顶,
                                                   185, 185, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地顶,
                                                   237, 240, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地顶,
                                                   245, 255, mapEditor);

                #endregion
                #region 山地底

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地底,
                                                   169, 177, mapEditor);

                #endregion
                #region 冰面


                #endregion
                #region 基地与龙种标识

                #endregion
                #region 常用放置

                #endregion
                break;

            case (int)MapThemeIdEnum.未来城主题:
                #region 空地

                #endregion
                #region 草地

                #endregion
                #region 花地

                #endregion
                #region 藤蔓


                #endregion
                #region 湿地


                #endregion
                #region 旱地

                #endregion
                #region 沙地

                #endregion
                #region 雪地

                #endregion
                #region 死地

                #endregion
                #region 树

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.树,
                                                   194, 195, mapEditor);

                #endregion
                #region 石头

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.石头,
                                                   193, 193, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.石头,
                                                   196, 200, mapEditor);

                #endregion
                #region 火焰

                #endregion
                #region 坑


                #endregion
                #region 水面

                #endregion
                #region 岩浆


                #endregion
                #region 山地顶

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地顶,
                                                   121, 167, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.石头,
                                                   201, 223, mapEditor);

                #endregion
                #region 山地底

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地底,
                                                   169, 190, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地底,
                                                   224, 255, mapEditor);

                #endregion
                #region 冰面


                #endregion
                #region 基地与龙种标识

                #endregion
                #region 常用放置

                #endregion
                break;

            case (int)MapThemeIdEnum.太空主题:
                #region 空地

                #endregion
                #region 草地

                #endregion
                #region 花地

                #endregion
                #region 藤蔓


                #endregion
                #region 湿地


                #endregion
                #region 旱地

                #endregion
                #region 沙地

                #endregion
                #region 雪地

                #endregion
                #region 死地

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.死地,
                                                   185, 186, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.死地,
                                                   189, 189, "宇宙", mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.死地,
                                                   201, 248, "宇宙", mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.死地,
                                                   255, 255, "宇宙", mapEditor);

                #endregion
                #region 树

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.树,
                                                   188, 188, mapEditor);


                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.树,
                                                   194, 197, mapEditor);

                #endregion
                #region 石头

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.石头,
                                                   187, 187, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.石头,
                                                   193, 193, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.石头,
                                                   198, 200, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.石头,
                                                   249, 254, mapEditor);

                #endregion
                #region 火焰

                #endregion
                #region 坑


                #endregion
                #region 水面

                #endregion
                #region 岩浆


                #endregion
                #region 山地顶

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地顶,
                                                   121, 167, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地顶,
                                                   177, 184, mapEditor);

                #endregion
                #region 山地底

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地底,
                                                   169, 176, mapEditor);

                #endregion
                #region 冰面


                #endregion
                #region 基地与龙种标识

                #endregion
                #region 常用放置

                #endregion
                break;

            case (int)MapThemeIdEnum.异次元主题:
                #region 空地

                #endregion
                #region 草地

                #endregion
                #region 花地

                #endregion
                #region 藤蔓


                #endregion
                #region 湿地


                #endregion
                #region 旱地

                #endregion
                #region 沙地

                #endregion
                #region 雪地

                #endregion
                #region 死地

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.死地,
                                                   185, 185, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.死地,
                                                   188, 189, mapEditor);

                #endregion
                #region 树

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.树,
                                                   194, 197, mapEditor);

                #endregion
                #region 石头

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.石头,
                                                   186, 187, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.石头,
                                                   193, 193, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.石头,
                                                   198, 208, mapEditor);

                #endregion
                #region 火焰

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.火焰,
                                                   190, 190, mapEditor);

                #endregion
                #region 坑


                #endregion
                #region 水面

                #endregion
                #region 岩浆


                #endregion
                #region 山地顶

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地顶,
                                                   121, 167, "山地顶", mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地顶,
                                                   177, 184, mapEditor);

                #endregion
                #region 山地底

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地底,
                                                   169, 176, "山地底", mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地底,
                                                   207, 208, mapEditor);

                #endregion
                #region 冰面

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.冰面,
                                                   209, 255, mapEditor);

                #endregion
                #region 基地与龙种标识

                #endregion
                #region 常用放置

                #endregion
                break;

            case (int)MapThemeIdEnum.博士基地主题:
                #region 空地

                #endregion
                #region 草地

                #endregion
                #region 花地

                #endregion
                #region 藤蔓


                #endregion
                #region 湿地


                #endregion
                #region 旱地

                #endregion
                #region 沙地

                #endregion
                #region 雪地

                #endregion
                #region 死地

                #endregion
                #region 树

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.树,
                                                   195, 196, mapEditor);

                #endregion
                #region 石头

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.石头,
                                                   193, 194, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.石头,
                                                   197, 200, mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.石头,
                                                   219, 229, mapEditor);

                #endregion
                #region 火焰

                #endregion
                #region 坑


                #endregion
                #region 水面

                #endregion
                #region 岩浆


                #endregion
                #region 山地顶

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地顶,
                                                   121, 168, "山地顶", mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地顶,
                                                   201, 218, "山地顶", mapEditor);

                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地顶,
                                                   230, 242, "山地顶", mapEditor);

                #endregion
                #region 山地底


                MapListBoxItemBaseAddAndRenewRange(MapListBox, (int)MapListBoxItemId.山地底,
                                                   169, 176, "山地底", mapEditor);

                #endregion
                #region 冰面


                #endregion
                #region 基地与龙种标识

                #endregion
                #region 常用放置

                #endregion
                break;
            }
            #endregion
        }
예제 #12
0
 void MapListBoxComposePlaceItemMessegeRenew(Image img, int addacc, int order, int id, string displayname, Size size, ChatListBox MapListBox)
 {
     MapListBox.Items[addacc].SubItems[order].HeadImage = img;
     MapListBox.Items[addacc].SubItems[order].ID        = (uint)(id + 256);
     MapListBox.Items[addacc].SubItems[order].NicName   =
         "组合放置" + (id + 1).ToString();
     MapListBox.Items[addacc].SubItems[order].PersonalMsg = "组合元素个数:" + size.Width.ToString() + "×" + size.Height.ToString();
     MapListBox.Items[addacc].SubItems[order].DisplayName = displayname;
     //MapListBox.Items[addacc].SubItems[order].PersonalMsg = "";
 }
예제 #13
0
 //头像闪烁
 private void twinkle(ChatListBox listBox, uint id)
 {
     ChatListSubItem[] items = listBox.GetSubItemsById(id); //按照ID查找listbox中的用户
     items[0].IsTwinkle = true;                             //开启闪烁
 }
예제 #14
0
        public override void Initialize()
        {
            Name              = nameof(PrivateMessagingWindow);
            ClientRectangle   = new Rectangle(0, 0, 600, 600);
            BackgroundTexture = AssetLoader.LoadTextureUncached("privatemessagebg.png");

            unknownGameIcon = AssetLoader.TextureFromImage(ClientCore.Properties.Resources.unknownicon);
            adminGameIcon   = AssetLoader.TextureFromImage(ClientCore.Properties.Resources.cncneticon);

            personalMessageColor  = AssetLoader.GetColorFromString(ClientConfiguration.Instance.SentPMColor);
            otherUserMessageColor = AssetLoader.GetColorFromString(ClientConfiguration.Instance.ReceivedPMColor);

            lblPrivateMessaging           = new XNALabel(WindowManager);
            lblPrivateMessaging.Name      = nameof(lblPrivateMessaging);
            lblPrivateMessaging.FontIndex = 1;
            lblPrivateMessaging.Text      = "PRIVATE MESSAGING";

            AddChild(lblPrivateMessaging);
            lblPrivateMessaging.CenterOnParent();
            lblPrivateMessaging.ClientRectangle = new Rectangle(
                lblPrivateMessaging.X, 12,
                lblPrivateMessaging.Width,
                lblPrivateMessaging.Height);

            tabControl                 = new XNAClientTabControl(WindowManager);
            tabControl.Name            = nameof(tabControl);
            tabControl.ClientRectangle = new Rectangle(60, 50, 0, 0);
            tabControl.ClickSound      = new EnhancedSoundEffect("button.wav");
            tabControl.FontIndex       = 1;
            tabControl.AddTab("Messages", 160);
            tabControl.AddTab("Friend List", 160);
            tabControl.AddTab("All Players", 160);
            tabControl.SelectedIndexChanged += TabControl_SelectedIndexChanged;

            lblPlayers                 = new XNALabel(WindowManager);
            lblPlayers.Name            = nameof(lblPlayers);
            lblPlayers.ClientRectangle = new Rectangle(12, tabControl.Bottom + 24, 0, 0);
            lblPlayers.FontIndex       = 1;
            lblPlayers.Text            = "PLAYERS:";

            lbUserList                 = new XNAListBox(WindowManager);
            lbUserList.Name            = nameof(lbUserList);
            lbUserList.ClientRectangle = new Rectangle(lblPlayers.X,
                                                       lblPlayers.Bottom + 6,
                                                       150, Height - lblPlayers.Bottom - 18);
            lbUserList.RightClick             += LbUserList_RightClick;
            lbUserList.SelectedIndexChanged   += LbUserList_SelectedIndexChanged;
            lbUserList.BackgroundTexture       = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1);
            lbUserList.PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED;

            lblMessages                 = new XNALabel(WindowManager);
            lblMessages.Name            = nameof(lblMessages);
            lblMessages.ClientRectangle = new Rectangle(lbUserList.Right + 12,
                                                        lblPlayers.Y, 0, 0);
            lblMessages.FontIndex = 1;
            lblMessages.Text      = "MESSAGES:";

            lbMessages                 = new ChatListBox(WindowManager);
            lbMessages.Name            = nameof(lbMessages);
            lbMessages.ClientRectangle = new Rectangle(lblMessages.X,
                                                       lbUserList.Y,
                                                       Width - lblMessages.X - 12,
                                                       lbUserList.Height - 25);
            lbMessages.BackgroundTexture       = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1);
            lbMessages.PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED;

            tbMessageInput                 = new XNATextBox(WindowManager);
            tbMessageInput.Name            = nameof(tbMessageInput);
            tbMessageInput.ClientRectangle = new Rectangle(lbMessages.X,
                                                           lbMessages.Bottom + 6, lbMessages.Width, 19);
            tbMessageInput.EnterPressed     += TbMessageInput_EnterPressed;
            tbMessageInput.MaximumTextLength = 200;
            tbMessageInput.Enabled           = false;

            playerContextMenu                 = new XNAContextMenu(WindowManager);
            playerContextMenu.Name            = nameof(playerContextMenu);
            playerContextMenu.ClientRectangle = new Rectangle(0, 0, 150, 2);
            playerContextMenu.Disable();
            playerContextMenu.AddItem("Add Friend", PlayerContextMenu_ToggleFriend);
            playerContextMenu.AddItem("Toggle Block", PlayerContextMenu_ToggleIgnore, null, () => (bool)lbUserList.SelectedItem.Tag, null);
            playerContextMenu.AddItem("Invite", PlayerContextMenu_Invite, null, () => !string.IsNullOrEmpty(inviteChannelName));

            notificationBox            = new PrivateMessageNotificationBox(WindowManager);
            notificationBox.Enabled    = false;
            notificationBox.Visible    = false;
            notificationBox.LeftClick += NotificationBox_LeftClick;

            AddChild(tabControl);
            AddChild(lblPlayers);
            AddChild(lbUserList);
            AddChild(lblMessages);
            AddChild(lbMessages);
            AddChild(tbMessageInput);
            AddChild(playerContextMenu);
            WindowManager.AddAndInitializeControl(notificationBox);

            base.Initialize();

            CenterOnParent();

            tabControl.SelectedTab = 0;

            connectionManager.PrivateMessageReceived += ConnectionManager_PrivateMessageReceived;
            connectionManager.UserAdded            += ConnectionManager_UserAdded;
            connectionManager.UserRemoved          += ConnectionManager_UserRemoved;
            connectionManager.UserGameIndexUpdated += ConnectionManager_UserGameIndexUpdated;

            sndMessageSound = new EnhancedSoundEffect("message.wav", 0.0, 0.0, ClientConfiguration.Instance.SoundMessageCooldown);

            sndPrivateMessageSound = new EnhancedSoundEffect("pm.wav", 0.0, 0.0, ClientConfiguration.Instance.SoundPrivateMessageCooldown);

            sndMessageSound.Enabled = UserINISettings.Instance.MessageSound;

            GameProcessLogic.GameProcessExited += SharedUILogic_GameProcessExited;
        }
예제 #15
0
        public override void Initialize()
        {
            Name              = nameof(PrivateMessagingWindow);
            ClientRectangle   = new Rectangle(0, 0, 600, 600);
            BackgroundTexture = AssetLoader.LoadTextureUncached("privatemessagebg.png");

            unknownGameIcon = AssetLoader.TextureFromImage(ClientCore.Properties.Resources.unknownicon);
            adminGameIcon   = AssetLoader.TextureFromImage(ClientCore.Properties.Resources.cncneticon);

            personalMessageColor  = AssetLoader.GetColorFromString(ClientConfiguration.Instance.SentPMColor);
            otherUserMessageColor = AssetLoader.GetColorFromString(ClientConfiguration.Instance.ReceivedPMColor);

            lblPrivateMessaging           = new XNALabel(WindowManager);
            lblPrivateMessaging.Name      = nameof(lblPrivateMessaging);
            lblPrivateMessaging.FontIndex = 1;
            lblPrivateMessaging.Text      = "PRIVATE MESSAGING";

            AddChild(lblPrivateMessaging);
            lblPrivateMessaging.CenterOnParent();
            lblPrivateMessaging.ClientRectangle = new Rectangle(
                lblPrivateMessaging.X, 12,
                lblPrivateMessaging.Width,
                lblPrivateMessaging.Height);

            tabControl                 = new XNAClientTabControl(WindowManager);
            tabControl.Name            = nameof(tabControl);
            tabControl.ClientRectangle = new Rectangle(34, 50, 0, 0);
            tabControl.ClickSound      = new EnhancedSoundEffect("button.wav");
            tabControl.FontIndex       = 1;
            tabControl.AddTab("Messages", UIDesignConstants.BUTTON_WIDTH_133);
            tabControl.AddTab("Friend List", UIDesignConstants.BUTTON_WIDTH_133);
            tabControl.AddTab("All Players", UIDesignConstants.BUTTON_WIDTH_133);
            tabControl.AddTab("Recent Players", UIDesignConstants.BUTTON_WIDTH_133);
            tabControl.SelectedIndexChanged += TabControl_SelectedIndexChanged;

            lblPlayers                 = new XNALabel(WindowManager);
            lblPlayers.Name            = nameof(lblPlayers);
            lblPlayers.ClientRectangle = new Rectangle(12, tabControl.Bottom + 24, 0, 0);
            lblPlayers.FontIndex       = 1;
            lblPlayers.Text            = DEFAULT_PLAYERS_TEXT;

            lbUserList                 = new XNAListBox(WindowManager);
            lbUserList.Name            = nameof(lbUserList);
            lbUserList.ClientRectangle = new Rectangle(lblPlayers.X,
                                                       lblPlayers.Bottom + 6,
                                                       LB_USERS_WIDTH, Height - lblPlayers.Bottom - 18);
            lbUserList.RightClick             += LbUserList_RightClick;
            lbUserList.SelectedIndexChanged   += LbUserList_SelectedIndexChanged;
            lbUserList.BackgroundTexture       = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1);
            lbUserList.PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED;
            lbUserList.DoubleLeftClick        += UserList_LeftDoubleClick;

            lblMessages                 = new XNALabel(WindowManager);
            lblMessages.Name            = nameof(lblMessages);
            lblMessages.ClientRectangle = new Rectangle(lbUserList.Right + 12,
                                                        lblPlayers.Y, 0, 0);
            lblMessages.FontIndex = 1;
            lblMessages.Text      = "MESSAGES:";

            lbMessages                 = new ChatListBox(WindowManager);
            lbMessages.Name            = nameof(lbMessages);
            lbMessages.ClientRectangle = new Rectangle(lblMessages.X,
                                                       lbUserList.Y,
                                                       Width - lblMessages.X - 12,
                                                       lbUserList.Height - 25);
            lbMessages.BackgroundTexture       = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1);
            lbMessages.PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED;
            lbMessages.RightClick += ChatListBox_RightClick;

            tbMessageInput                 = new XNATextBox(WindowManager);
            tbMessageInput.Name            = nameof(tbMessageInput);
            tbMessageInput.ClientRectangle = new Rectangle(lbMessages.X,
                                                           lbMessages.Bottom + 6, lbMessages.Width, 19);
            tbMessageInput.EnterPressed     += TbMessageInput_EnterPressed;
            tbMessageInput.MaximumTextLength = 200;
            tbMessageInput.Enabled           = false;

            mclbRecentPlayerList = new RecentPlayerTable(WindowManager, connectionManager);
            mclbRecentPlayerList.ClientRectangle   = new Rectangle(lbUserList.X, lbUserList.Y, lbMessages.Right - lbUserList.X, lbUserList.Height);
            mclbRecentPlayerList.PlayerRightClick += RecentPlayersList_RightClick;
            mclbRecentPlayerList.Disable();

            globalContextMenu            = new GlobalContextMenu(WindowManager, connectionManager, cncnetUserData, this);
            globalContextMenu.JoinEvent += PlayerContextMenu_JoinUser;

            notificationBox            = new PrivateMessageNotificationBox(WindowManager);
            notificationBox.Enabled    = false;
            notificationBox.Visible    = false;
            notificationBox.LeftClick += NotificationBox_LeftClick;

            AddChild(tabControl);
            AddChild(lblPlayers);
            AddChild(lbUserList);
            AddChild(lblMessages);
            AddChild(lbMessages);
            AddChild(tbMessageInput);
            AddChild(mclbRecentPlayerList);
            AddChild(globalContextMenu);
            WindowManager.AddAndInitializeControl(notificationBox);

            base.Initialize();

            CenterOnParent();

            tabControl.SelectedTab = MESSAGES_INDEX;

            privateMessageHandler.PrivateMessageReceived += PrivateMessageHandler_PrivateMessageReceived;
            connectionManager.UserAdded            += ConnectionManager_UserAdded;
            connectionManager.UserRemoved          += ConnectionManager_UserRemoved;
            connectionManager.UserGameIndexUpdated += ConnectionManager_UserGameIndexUpdated;

            sndMessageSound = new EnhancedSoundEffect("message.wav", 0.0, 0.0, ClientConfiguration.Instance.SoundMessageCooldown);

            sndPrivateMessageSound = new EnhancedSoundEffect("pm.wav", 0.0, 0.0, ClientConfiguration.Instance.SoundPrivateMessageCooldown);

            sndMessageSound.Enabled = UserINISettings.Instance.MessageSound;

            GameProcessLogic.GameProcessExited += SharedUILogic_GameProcessExited;
        }
예제 #16
0
 public void MessageCallBack(string message)
 {
     ChatListBox.Items.Add(message);
     ChatListBox.ScrollIntoView(ChatListBox.Items[ChatListBox.Items.Count - 1]);
 }
        private void RootCanvas_Loaded(object sender, System.Windows.RoutedEventArgs e)
        {
            if (!Configer.Instance.Debug)
            {
                AccountText.Text      = "";
                PasswordText.Password = "";
            }


            //掉线
            BattleNetManager.Instance.OnDroppedNotify += (s, ee) =>
            {
                MessageBox.Show("与服务器断开连接。");
                Status = OnlineStatus.NotLogin;
            };

            //聊天
            BattleNetManager.Instance.OnNewChatNotify += (s, ee) =>
            {
                //MessageBox.Show("chat notify:" + ee.Message);

                if (ee.Channel == "ALL")
                {
                    string    msg = string.Format("[{0}][{1}]:{2}", DateTime.Now.ToString(), ee.User.Name, ee.Message);
                    TextBlock tb  = new TextBlock()
                    {
                        Text = msg, Foreground = new SolidColorBrush(Colors.White), FontSize = 12
                    };
                    ChatListBox.Items.Add(tb);
                    ChatListBox.UpdateLayout();
                    ChatListBox.ScrollIntoView(tb);
                }
                else if (ee.Channel == Me.Channel)
                {
                    string msg  = ee.Message;
                    string cmd  = msg.Split(new char[] { '#' })[0];
                    string uuid = "";
                    if (msg.Split(new char[] { '#' }).Length > 1)
                    {
                        uuid = msg.Split(new char[] { '#' })[1];
                    }


                    if (cmd == "CREATE_GAME")
                    {
                        //string targetChannel = ee.User.Channel;
                        //if (MessageBox.Show(
                        //    string.Format("玩家{0}邀请你进行游戏,是否接收?", ee.User.Name),
                        //    "游戏邀请",
                        //    MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                        //{
                        //    BattleNetManager.Instance.JoinChannel(new string[] { "ALL", Me.Channel, uuid }, (isJoinned, timeout) =>
                        //    {
                        //        //初始化战场,由于异步IO,必须在发送消息之前处理
                        //        OLBattleGlobalSetting.Instance.init(uuid);

                        //        BattleNetManager.Instance.Chat(targetChannel, "YES#" + uuid);
                        //        //开始战斗
                        //        GameBegin(uuid, ee.User, 2);
                        //    });

                        //}
                        //else
                        //{
                        //    BattleNetManager.Instance.Chat(targetChannel, "NO#" + uuid);
                        //}
                        BeInvitedToGame(ee.User, uuid);
                    }
                    else if (cmd == "YES")
                    {
                        if (Status == OnlineStatus.InHost)
                        {
                            BattleNetManager.Instance.JoinChannel(new string[] { "ALL", Me.Channel, uuid }, (isJoinned, timeout) =>
                            {
                                //开始战斗
                                GameBegin(uuid, ee.User, 1);
                            });
                        }
                    }
                    else if (cmd == "NO")
                    {
                        if (Status == OnlineStatus.InHost)
                        {
                            MessageBox.Show("对方拒绝了你的请求");
                        }
                        //MatchButton.IsEnabled = true;
                        //MatchButton.Content = "发起对战";
                        return;
                    }
                }
            };

            //战斗
            BattleNetManager.Instance.OnNewChatNotify += (s, ee) =>
            {
                //MessageBox.Show("battle notify:" + ee.Message);
                if (ee.Channel != OLBattleGlobalSetting.Instance.channel)
                {
                    return;
                }

                string msg  = ee.Message;
                string cmd  = msg.Split(new char[] { '$' })[0];
                string data = "";
                if (msg.Split(new char[] { '$' }).Length > 1)
                {
                    data = msg.Split(new char[] { '$' })[1];
                }

                switch (cmd)
                {
                case "SELECT_ROLE_RESULT":
                    //MessageBox.Show("你的对手已经选人完毕!");
                    uiHost.battleFieldContainer.loadOLBattleEnemyConfirm(data);
                    break;

                case "LOADING_FINISH":
                    OLBattleGlobalSetting.Instance.enemyLoadFinish = true;
                    break;

                case "OL_BATTLE_DATA":
                    //MessageBox.Show(data);
                    uiHost.battleFieldContainer.field.OLDataDisplay(data);
                    break;

                case "BATTLE_MESSAGE":
                    string    battleMsg = string.Format("[{0}][{1}]:{2}", DateTime.Now.ToString(), ee.User.Name, data);
                    TextBlock tb        = new TextBlock()
                    {
                        Text = battleMsg, Foreground = new SolidColorBrush(Colors.White), FontSize = 12
                    };
                    uiHost.battleFieldContainer.ChatListBox.Items.Add(tb);
                    uiHost.battleFieldContainer.ChatListBox.UpdateLayout();
                    uiHost.battleFieldContainer.ChatListBox.ScrollIntoView(tb);
                    break;
                }
            };

            RefreshTimer.Interval = TimeSpan.FromSeconds(5);
            RefreshTimer.Tick    += new EventHandler(RefreshTimer_Tick);
            RefreshTimer.Stop();
        }
예제 #18
0
 public ChatListItemCollection(ChatListBox owner)
 {
     this.owner = owner;
 }
예제 #19
0
 //头像闪烁
 private void twinkle(ChatListBox listBox,uint id)
 {
     ChatListSubItem[] items=listBox.GetSubItemsById(id);//按照ID查找listbox中的用户
     items[0].IsTwinkle = true;//开启闪烁
 }
예제 #20
0
 void MapListBoxItemMessegeRenew(int addacc, int order, int id, string displayname, ChatListBox MapListBox, MapPanelEditor mapEditor)
 {
     MapListBox.Items[addacc].SubItems[order].HeadImage = mapEditor.ThemeBar[mapEditor.ThemeNum][id];
     MapListBox.Items[addacc].SubItems[order].ID        = (uint)id;
     MapListBox.Items[addacc].SubItems[order].NicName   =
         "Hex:" + MapListBox.Items[addacc].SubItems[order].ID.ToString("X2");
     MapListBox.Items[addacc].SubItems[order].PersonalMsg = "十进制代码:" + id.ToString();
     MapListBox.Items[addacc].SubItems[order].DisplayName = displayname;
     //MapListBox.Items[addacc].SubItems[order].PersonalMsg = "";
 }
예제 #21
0
        public override void Initialize()
        {
            Name = "MultiplayerGameLobby";

            base.Initialize();

            InitPlayerOptionDropdowns();

            ReadyBoxes = new XNACheckBox[MAX_PLAYER_COUNT];

            int readyBoxX = GameOptionsIni.GetIntValue(Name, "PlayerReadyBoxX", 7);
            int readyBoxY = GameOptionsIni.GetIntValue(Name, "PlayerReadyBoxY", 4);

            for (int i = 0; i < MAX_PLAYER_COUNT; i++)
            {
                XNACheckBox chkPlayerReady = new XNACheckBox(WindowManager);
                chkPlayerReady.Name            = "chkPlayerReady" + i;
                chkPlayerReady.Checked         = false;
                chkPlayerReady.AllowChecking   = false;
                chkPlayerReady.ClientRectangle = new Rectangle(readyBoxX, ddPlayerTeams[i].ClientRectangle.Y + readyBoxY,
                                                               0, 0);

                PlayerOptionsPanel.AddChild(chkPlayerReady);

                chkPlayerReady.DisabledClearTexture   = chkPlayerReady.ClearTexture;
                chkPlayerReady.DisabledCheckedTexture = chkPlayerReady.CheckedTexture;

                ReadyBoxes[i] = chkPlayerReady;
                ddPlayerSides[i].AddItem("Spectator", AssetLoader.LoadTexture("spectatoricon.png"));
            }

            ddGameMode.ClientRectangle = new Rectangle(
                MapPreviewBox.ClientRectangle.X - 12 - ddGameMode.ClientRectangle.Width,
                MapPreviewBox.ClientRectangle.Y, ddGameMode.ClientRectangle.Width,
                ddGameMode.ClientRectangle.Height);

            lblGameModeSelect.ClientRectangle = new Rectangle(
                btnLaunchGame.ClientRectangle.X, ddGameMode.ClientRectangle.Y + 1,
                lblGameModeSelect.ClientRectangle.Width, lblGameModeSelect.ClientRectangle.Height);

            lbMapList.ClientRectangle = new Rectangle(btnLaunchGame.ClientRectangle.X,
                                                      MapPreviewBox.ClientRectangle.Y + 23,
                                                      MapPreviewBox.ClientRectangle.X - btnLaunchGame.ClientRectangle.X - 12,
                                                      MapPreviewBox.ClientRectangle.Height - 23);

            lbChatMessages                 = new ChatListBox(WindowManager);
            lbChatMessages.Name            = "lbChatMessages";
            lbChatMessages.ClientRectangle = new Rectangle(lbMapList.ClientRectangle.Left,
                                                           GameOptionsPanel.ClientRectangle.Y,
                                                           lbMapList.ClientRectangle.Width, GameOptionsPanel.ClientRectangle.Height - 24);
            lbChatMessages.DrawMode          = PanelBackgroundImageDrawMode.STRETCHED;
            lbChatMessages.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1);
            lbChatMessages.LineHeight        = 16;

            tbChatInput                 = new XNASuggestionTextBox(WindowManager);
            tbChatInput.Name            = "tbChatInput";
            tbChatInput.Suggestion      = "Type here to chat..";
            tbChatInput.ClientRectangle = new Rectangle(lbChatMessages.ClientRectangle.Left,
                                                        lbChatMessages.ClientRectangle.Bottom + 3,
                                                        lbChatMessages.ClientRectangle.Width, 21);
            tbChatInput.MaximumTextLength = 150;
            tbChatInput.EnterPressed     += TbChatInput_EnterPressed;

            btnLockGame                 = new XNAClientButton(WindowManager);
            btnLockGame.Name            = "btnLockGame";
            btnLockGame.ClientRectangle = new Rectangle(btnLaunchGame.ClientRectangle.Right + 12,
                                                        btnLaunchGame.ClientRectangle.Y, 133, 23);
            btnLockGame.Text       = "Lock Game";
            btnLockGame.LeftClick += BtnLockGame_LeftClick;

            AddChildToFirstIndex(lbChatMessages);
            AddChildToFirstIndex(tbChatInput);
            AddChild(btnLockGame);

            MapPreviewBox.LocalStartingLocationSelected += MapPreviewBox_LocalStartingLocationSelected;
            MapPreviewBox.StartingLocationApplied       += MapPreviewBox_StartingLocationApplied;

            InitializeWindow();

            sndJoinSound     = new PrioritizedSound("joingame.wav");
            sndLeaveSound    = new PrioritizedSound("leavegame.wav");
            sndMessageSound  = new PrioritizedSound("message.wav");
            sndGetReadySound = new PrioritizedSound("getready.wav", 0.0, 0.0, 5.0f);

            if (SavedGameManager.AreSavedGamesAvailable())
            {
                fsw = new FileSystemWatcher(ProgramConstants.GamePath + "Saved Games", "*.NET");
                fsw.EnableRaisingEvents = false;
                fsw.Created            += fsw_Created;
                fsw.Changed            += fsw_Created;
            }
            else
            {
                Logger.Log("MultiplayerGameLobby: Saved games are not available!");
            }

            CenterOnParent();

            // To move the lblMapAuthor label into its correct position
            // if it was moved in the theme description INI file
            LoadDefaultMap();
        }
예제 #22
0
        void MapListBoxItemMessegeRenewRange(int addacc, int startid, string displayname, ChatListBox MapListBox, MapPanelEditor mapEditor)
        {
            int startless = startid - 1;

            foreach (CCWin.SkinControl.ChatListSubItem item in MapListBox.Items[addacc].SubItems)
            {
                item.HeadImage   = mapEditor.ThemeBar[mapEditor.ThemeNum][startid];
                item.ID          = (uint)startid;
                item.NicName     = "Hex:" + item.ID.ToString("X2");
                item.PersonalMsg = "十进制代码:" + item.ID.ToString();
                item.DisplayName = displayname + (startid - startless).ToString();
                //item.PersonalMsg = "";
                startid++;
            }
        }
        public override void Initialize()
        {
            Name              = "PrivateMessagingWindow";
            ClientRectangle   = new Rectangle(0, 0, 600, 600);
            BackgroundTexture = AssetLoader.LoadTextureUncached("privatemessagebg.png");

            unknownGameIcon = AssetLoader.TextureFromImage(ClientCore.Properties.Resources.unknownicon);
            adminGameIcon   = AssetLoader.TextureFromImage(ClientCore.Properties.Resources.cncneticon);

            personalMessageColor  = AssetLoader.GetColorFromString(ClientConfiguration.Instance.SentPMColor);
            otherUserMessageColor = AssetLoader.GetColorFromString(ClientConfiguration.Instance.ReceivedPMColor);

            lblPrivateMessaging           = new XNALabel(WindowManager);
            lblPrivateMessaging.Name      = "lblPrivateMessaging";
            lblPrivateMessaging.FontIndex = 1;
            lblPrivateMessaging.Text      = "PRIVATE MESSAGING";

            AddChild(lblPrivateMessaging);
            lblPrivateMessaging.CenterOnParent();
            lblPrivateMessaging.ClientRectangle = new Rectangle(
                lblPrivateMessaging.ClientRectangle.X, 12,
                lblPrivateMessaging.ClientRectangle.Width,
                lblPrivateMessaging.ClientRectangle.Height);

            tabControl                 = new XNAClientTabControl(WindowManager);
            tabControl.Name            = "tabControl";
            tabControl.ClientRectangle = new Rectangle(60, 50, 0, 0);
            tabControl.SoundOnClick    = AssetLoader.LoadSound("button.wav");
            tabControl.FontIndex       = 1;
            tabControl.AddTab("Messages", 160);
            tabControl.AddTab("Friend List", 160);
            tabControl.AddTab("All Players", 160);
            tabControl.SelectedIndexChanged += TabControl_SelectedIndexChanged;

            lblPlayers                 = new XNALabel(WindowManager);
            lblPlayers.Name            = "lblPlayers";
            lblPlayers.ClientRectangle = new Rectangle(12, tabControl.ClientRectangle.Bottom + 24, 0, 0);
            lblPlayers.FontIndex       = 1;
            lblPlayers.Text            = "PLAYERS:";

            lbUserList                 = new XNAListBox(WindowManager);
            lbUserList.Name            = "lbUserList";
            lbUserList.ClientRectangle = new Rectangle(lblPlayers.ClientRectangle.X,
                                                       lblPlayers.ClientRectangle.Bottom + 6,
                                                       150, ClientRectangle.Height - lblPlayers.ClientRectangle.Bottom - 18);
            lbUserList.RightClick           += LbUserList_RightClick;
            lbUserList.SelectedIndexChanged += LbUserList_SelectedIndexChanged;
            lbUserList.BackgroundTexture     = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1);
            lbUserList.DrawMode              = PanelBackgroundImageDrawMode.STRETCHED;

            lblMessages                 = new XNALabel(WindowManager);
            lblMessages.Name            = "lblMessages";
            lblMessages.ClientRectangle = new Rectangle(lbUserList.ClientRectangle.Right + 12,
                                                        lblPlayers.ClientRectangle.Y, 0, 0);
            lblMessages.FontIndex = 1;
            lblMessages.Text      = "MESSAGES:";

            lbMessages                 = new ChatListBox(WindowManager);
            lbMessages.Name            = "lbMessages";
            lbMessages.ClientRectangle = new Rectangle(lblMessages.ClientRectangle.X,
                                                       lbUserList.ClientRectangle.Y,
                                                       ClientRectangle.Width - lblMessages.ClientRectangle.X - 12,
                                                       lbUserList.ClientRectangle.Height - 25);
            lbMessages.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1);
            lbMessages.DrawMode          = PanelBackgroundImageDrawMode.STRETCHED;

            tbMessageInput                 = new XNATextBox(WindowManager);
            tbMessageInput.Name            = "tbMessageInput";
            tbMessageInput.ClientRectangle = new Rectangle(lbMessages.ClientRectangle.X,
                                                           lbMessages.ClientRectangle.Bottom + 6, lbMessages.ClientRectangle.Width, 19);
            tbMessageInput.EnterPressed     += TbMessageInput_EnterPressed;
            tbMessageInput.MaximumTextLength = 200;
            tbMessageInput.Enabled           = false;

            playerContextMenu                 = new PlayerContextMenu(WindowManager);
            playerContextMenu.Name            = "playerContextMenu";
            playerContextMenu.ClientRectangle = new Rectangle(0, 0, 150, 2);
            playerContextMenu.Enabled         = false;
            playerContextMenu.Visible         = false;
            playerContextMenu.AddItem("Add Friend");
            playerContextMenu.OptionSelected += PlayerContextMenu_OptionSelected;

            notificationBox         = new PrivateMessageNotificationBox(WindowManager);
            notificationBox.Enabled = false;
            notificationBox.Visible = false;

            AddChild(tabControl);
            AddChild(lblPlayers);
            AddChild(lbUserList);
            AddChild(lblMessages);
            AddChild(lbMessages);
            AddChild(tbMessageInput);
            AddChild(playerContextMenu);
            WindowManager.AddAndInitializeControl(notificationBox);

            base.Initialize();

            CenterOnParent();

            try
            {
                friendList = File.ReadAllLines(ProgramConstants.GamePath + FRIEND_LIST_PATH).ToList();
            }
            catch
            {
                Logger.Log("Loading friend list failed!");
                friendList = new List <string>();
            }

            tabControl.SelectedTab = 0;

            connectionManager.PrivateMessageReceived += ConnectionManager_PrivateMessageReceived;

            sndMessageSound = new EnhancedSoundEffect("message.wav");

            sndPrivateMessageSound = new EnhancedSoundEffect("pm.wav");

            sndMessageSound.Enabled = UserINISettings.Instance.MessageSound;

            GameProcessLogic.GameProcessExited += SharedUILogic_GameProcessExited;
        }
예제 #24
0
        public override void Initialize()
        {
            ClientRectangle = new Rectangle(0, 0, WindowManager.RenderResolutionX - 64,
                                            WindowManager.RenderResolutionY - 64);

            Name = "CnCNetLobby";
            BackgroundTexture = AssetLoader.LoadTexture("cncnetlobbybg.png");
            localGameID       = ClientConfiguration.Instance.LocalGame;
            localGame         = gameCollection.GameList.Find(g => g.InternalName.ToUpper() == localGameID.ToUpper());

            btnNewGame                 = new XNAClientButton(WindowManager);
            btnNewGame.Name            = "btnNewGame";
            btnNewGame.ClientRectangle = new Rectangle(12, ClientRectangle.Height - 29, 133, 23);
            btnNewGame.Text            = "Create Game";
            btnNewGame.AllowClick      = false;
            btnNewGame.LeftClick      += BtnNewGame_LeftClick;

            btnJoinGame                 = new XNAClientButton(WindowManager);
            btnJoinGame.Name            = "btnJoinGame";
            btnJoinGame.ClientRectangle = new Rectangle(btnNewGame.ClientRectangle.Right + 12,
                                                        btnNewGame.ClientRectangle.Y, 133, 23);
            btnJoinGame.Text       = "Join Game";
            btnJoinGame.AllowClick = false;
            btnJoinGame.LeftClick += BtnJoinGame_LeftClick;

            btnLogout                 = new XNAClientButton(WindowManager);
            btnLogout.Name            = "btnLogout";
            btnLogout.ClientRectangle = new Rectangle(ClientRectangle.Width - 145, btnNewGame.ClientRectangle.Y,
                                                      133, 23);
            btnLogout.Text       = "Log Out";
            btnLogout.LeftClick += BtnLogout_LeftClick;

            lbGameList                 = new GameListBox(WindowManager, localGameID);
            lbGameList.Name            = "lbGameList";
            lbGameList.ClientRectangle = new Rectangle(btnNewGame.ClientRectangle.X,
                                                       41, btnJoinGame.ClientRectangle.Right - btnNewGame.ClientRectangle.X,
                                                       btnNewGame.ClientRectangle.Top - 47);
            lbGameList.DrawMode            = PanelBackgroundImageDrawMode.STRETCHED;
            lbGameList.BackgroundTexture   = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1);
            lbGameList.DoubleLeftClick    += LbGameList_DoubleLeftClick;
            lbGameList.AllowMultiLineItems = false;

            lbPlayerList                 = new XNAListBox(WindowManager);
            lbPlayerList.Name            = "lbPlayerList";
            lbPlayerList.ClientRectangle = new Rectangle(ClientRectangle.Width - 202,
                                                         20, 190,
                                                         btnLogout.ClientRectangle.Top - 26);
            lbPlayerList.DrawMode          = PanelBackgroundImageDrawMode.STRETCHED;
            lbPlayerList.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1);
            lbPlayerList.LineHeight        = 16;
            lbPlayerList.DoubleLeftClick  += LbPlayerList_DoubleLeftClick;
            lbPlayerList.RightClick       += LbPlayerList_RightClick;

            playerContextMenu                 = new PlayerContextMenu(WindowManager);
            playerContextMenu.Name            = "playerContextMenu";
            playerContextMenu.ClientRectangle = new Rectangle(0, 0, 150, 2);
            playerContextMenu.Enabled         = false;
            playerContextMenu.Visible         = false;
            playerContextMenu.AddItem("Private Message");
            playerContextMenu.AddItem("Add Friend");
            playerContextMenu.OptionSelected += PlayerContextMenu_OptionSelected;

            lbChatMessages                 = new ChatListBox(WindowManager);
            lbChatMessages.Name            = "lbChatMessages";
            lbChatMessages.ClientRectangle = new Rectangle(lbGameList.ClientRectangle.Right + 12, lbGameList.ClientRectangle.Y,
                                                           lbPlayerList.ClientRectangle.Left - lbGameList.ClientRectangle.Right - 24, lbPlayerList.ClientRectangle.Height);
            lbChatMessages.DrawMode          = PanelBackgroundImageDrawMode.STRETCHED;
            lbChatMessages.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1);
            lbChatMessages.LineHeight        = 16;

            tbChatInput                 = new XNATextBox(WindowManager);
            tbChatInput.Name            = "tbChatInput";
            tbChatInput.ClientRectangle = new Rectangle(lbChatMessages.ClientRectangle.X,
                                                        btnNewGame.ClientRectangle.Y, lbChatMessages.ClientRectangle.Width,
                                                        btnNewGame.ClientRectangle.Height);
            tbChatInput.Enabled           = false;
            tbChatInput.MaximumTextLength = 200;
            tbChatInput.EnterPressed     += TbChatInput_EnterPressed;

            lblColor                 = new XNALabel(WindowManager);
            lblColor.Name            = "lblColor";
            lblColor.ClientRectangle = new Rectangle(lbChatMessages.ClientRectangle.X, 14, 0, 0);
            lblColor.FontIndex       = 1;
            lblColor.Text            = "YOUR COLOR:";

            ddColor                 = new XNAClientDropDown(WindowManager);
            ddColor.Name            = "ddColor";
            ddColor.ClientRectangle = new Rectangle(lblColor.ClientRectangle.X + 95, 12,
                                                    150, 21);

            chatColors = connectionManager.GetIRCColors();

            foreach (IRCColor color in connectionManager.GetIRCColors())
            {
                if (!color.Selectable)
                {
                    continue;
                }

                XNADropDownItem ddItem = new XNADropDownItem();
                ddItem.Text      = color.Name;
                ddItem.TextColor = color.XnaColor;
                ddItem.Tag       = color;

                ddColor.AddItem(ddItem);
            }

            int selectedColor = UserINISettings.Instance.ChatColor;

            ddColor.SelectedIndex = selectedColor >= ddColor.Items.Count || selectedColor < 0
                ? ClientConfiguration.Instance.DefaultPersonalChatColorIndex:
                                    selectedColor;
            SetChatColor();
            ddColor.SelectedIndexChanged += DdColor_SelectedIndexChanged;

            ddCurrentChannel                 = new XNAClientDropDown(WindowManager);
            ddCurrentChannel.Name            = "ddCurrentChannel";
            ddCurrentChannel.ClientRectangle = new Rectangle(
                lbChatMessages.ClientRectangle.Right - 200,
                ddColor.ClientRectangle.Y, 200, 21);
            ddCurrentChannel.SelectedIndexChanged += DdCurrentChannel_SelectedIndexChanged;
            ddCurrentChannel.AllowDropDown         = false;

            lblCurrentChannel                 = new XNALabel(WindowManager);
            lblCurrentChannel.Name            = "lblCurrentChannel";
            lblCurrentChannel.ClientRectangle = new Rectangle(
                ddCurrentChannel.ClientRectangle.X - 150,
                ddCurrentChannel.ClientRectangle.Y + 2, 0, 0);
            lblCurrentChannel.FontIndex = 1;
            lblCurrentChannel.Text      = "CURRENT CHANNEL:";

            InitializeGameList();

            AddChild(btnNewGame);
            AddChild(btnJoinGame);
            AddChild(btnLogout);

            AddChild(lbPlayerList);
            AddChild(lbChatMessages);
            AddChild(lbGameList);
            AddChild(tbChatInput);
            AddChild(lblColor);
            AddChild(ddColor);
            AddChild(lblCurrentChannel);
            AddChild(ddCurrentChannel);
            AddChild(playerContextMenu);

            base.Initialize();

            WindowManager.CenterControlOnScreen(this);

            PostUIInit();
        }