private void CreateRoom(object obj)
 {
     try
     {
         var dialog = new CreateRoomDialog();
         if (dialog.ShowDialog() == true && ClientModel.Api != null)
         {
             ClientModel.Api.Perform(new ClientCreateRoomAction(dialog.Name, dialog.Type));
         }
     }
     catch (SocketException se)
     {
         SelectedRoom.AddSystemMessage(se.Message);
     }
 }
Exemple #2
0
 private void CreateRoom(object obj)
 {
     try
     {
         CreateRoomDialog dialog = new CreateRoomDialog();
         if (dialog.ShowDialog() == true && ClientModel.API != null)
         {
             ClientModel.API.CreateRoom(dialog.Name, dialog.Type);
         }
     }
     catch (SocketException se)
     {
         SelectedRoom.AddSystemMessage(se.Message);
     }
 }
Exemple #3
0
 public void OnGUI()
 {
     DoPagePanel();
     DoModeSelector();
     if (ranking.Count != 0)
     {
         Texture2D[] array = new Texture2D[ranking.Count];
         for (int i = 0; i < ranking.Count; i++)
         {
             if (ranking[i].OrgMap.Thumbnail == null)
             {
                 array[i] = nonAvailable;
             }
             else
             {
                 array[i] = ranking[i].OrgMap.Thumbnail;
             }
         }
         float num = crdMapBtn.y * (float)ranking.Count;
         if (ranking.Count > 0)
         {
             num += (float)(ranking.Count - 1) * crdMapOffset;
         }
         scrollPosition = GUI.BeginScrollView(viewRect: new Rect(0f, 0f, crdFrame.width - 29f, num), position: crdFrame, scrollPosition: scrollPosition, alwaysShowHorizontal: false, alwaysShowVertical: false);
         Vector2 vector = new Vector2(0f, 0f);
         for (int j = 0; j < ranking.Count; j++)
         {
             Rect position = new Rect(vector.x, vector.y, crdMapBtn.x, crdMapBtn.y);
             GUI.BeginGroup(position);
             if (GlobalVars.Instance.MyButton(new Rect(0f, 0f, crdMapBtn.x, crdMapBtn.y), string.Empty, "BtnMapList"))
             {
                 selected = j;
             }
             if (selected == j)
             {
                 GUI.Box(new Rect(0f, 0f, crdMapBtn.x, crdMapBtn.y), string.Empty, "ViewSelected");
             }
             TextureUtil.DrawTexture(crdThumbnail, array[j], ScaleMode.StretchToFill);
             if (ranking[j].OrgMap.Alias.Length > 0)
             {
                 PrintMapInfo(ranking[j].OrgMap);
                 DrawMode(ranking[j].OrgMap.ModeMask);
             }
             if (RegMapManager.Instance.IsDownloaded(ranking[j].OrgMap.Map))
             {
                 TextureUtil.DrawTexture(crdDownloaded, GlobalVars.Instance.iconDownloaded, ScaleMode.StretchToFill);
             }
             if (page == 1 && j < 3)
             {
                 TextureUtil.DrawTexture(crdRank, texRanks[j], ScaleMode.StretchToFill);
             }
             GUI.EndGroup();
             vector.y += crdMapBtn.y + crdMapOffset;
         }
         GUI.EndScrollView();
         GUIContent content = new GUIContent(StringMgr.Instance.Get("CREATE_ROOM").ToUpper(), GlobalVars.Instance.iconJoin);
         if (ChannelManager.Instance.CurChannel.Mode != 3 && RegMapManager.Instance.IsDownloaded(ranking[selected].OrgMap.Map) && GlobalVars.Instance.MyButton3(crdMakeRoomBtn, content, "BtnAction"))
         {
             CreateRoomDialog createRoomDialog = (CreateRoomDialog)DialogManager.Instance.Popup(DialogManager.DIALOG_INDEX.CREATE_ROOM, exclusive: true);
             if (createRoomDialog != null && !createRoomDialog.InitDialog4TeamMatch(ranking[selected].OrgMap.Map, ranking[selected].OrgMap.ModeMask))
             {
                 DialogManager.Instance.Clear();
             }
         }
         if (RegMapManager.Instance.IsDownloaded(ranking[selected].OrgMap.Map))
         {
             content = new GUIContent(StringMgr.Instance.Get("DELETE").ToUpper(), GlobalVars.Instance.iconGarbage);
             if (GlobalVars.Instance.MyButton3(crdSaveBtn, content, "BtnAction"))
             {
                 CSNetManager.Instance.Sock.SendCS_DEL_DOWNLOAD_MAP_REQ(ranking[selected].OrgMap.Map);
             }
         }
         else
         {
             bool enabled = GUI.enabled;
             GUI.enabled = ranking[selected].IsLatest;
             content     = new GUIContent(StringMgr.Instance.Get("SAVE").ToUpper(), GlobalVars.Instance.iconDisk);
             if (GlobalVars.Instance.MyButton3(crdSaveBtn, content, "BtnAction"))
             {
                 ((DownloadFeeDialog)DialogManager.Instance.Popup(DialogManager.DIALOG_INDEX.DOWNLOAD_FEE, exclusive: true))?.InitDialog(ranking[selected].OrgMap);
             }
             GUI.enabled = enabled;
         }
     }
 }
    public void OnGUI()
    {
        DoModeSelector();
        DoPagePanel();
        int num = reg.Count / 4;

        if (reg.Count % 4 > 0)
        {
            num++;
        }
        Rect viewRect = new Rect(0f, 0f, crdMapSize.x * 4f + crdMapOffset.x * 3f, crdMapSize.y * (float)num);

        if (num > 1)
        {
            viewRect.height += crdMapOffset.y * (float)(num - 1);
        }
        VerifyChatView();
        if (chatView)
        {
            crdRegMapRect.height = 300f;
        }
        else
        {
            crdRegMapRect.height = crdRegMapRectTemp.height;
        }
        scrollPosition = GUI.BeginScrollView(crdRegMapRect, scrollPosition, viewRect);
        for (int i = 0; i < num; i++)
        {
            for (int j = 0; j < 4; j++)
            {
                int num2 = 4 * i + j;
                if (num2 < reg.Count)
                {
                    Rect rect     = new Rect((float)j * (crdMapSize.x + crdMapOffset.x), (float)i * (crdMapSize.y + crdMapOffset.y), crdMapSize.x, crdMapSize.y);
                    Rect position = new Rect(rect.x, rect.y, rect.width, rect.width + 4f);
                    if (reg[num2].Thumbnail != null)
                    {
                        if (!reg[num2].Blocked)
                        {
                            TextureUtil.DrawTexture(position, reg[num2].Thumbnail, ScaleMode.StretchToFill);
                        }
                        else
                        {
                            TextureUtil.DrawTexture(position, GlobalVars.Instance.iconBoxGray, ScaleMode.StretchToFill);
                            float num3 = (float)GlobalVars.Instance.iconLockSlot.width;
                            float num4 = (float)GlobalVars.Instance.iconLockSlot.height;
                            float x    = position.x + position.width / 2f - num3 / 2f;
                            float y    = position.y + position.height / 2f - num4 / 2f;
                            TextureUtil.DrawTexture(new Rect(x, y, num3, num4), GlobalVars.Instance.iconLockSlot, ScaleMode.StretchToFill);
                        }
                    }
                    if (GlobalVars.Instance.MyButton(rect, string.Empty, "BoxMapSelectBorder"))
                    {
                        selected = num2;
                        if (reg[selected].Blocked)
                        {
                            MessageBoxMgr.Instance.AddMessage(StringMgr.Instance.Get("NOTICE_BLOCK_MAP"));
                        }
                        if (Time.time - lastClickTime > doubleClickTimeout)
                        {
                            lastClickTime = Time.time;
                        }
                        else
                        {
                            ((MapSettingChangeDlg)DialogManager.Instance.Popup(DialogManager.DIALOG_INDEX.MAP_SETTING_CHANGE, exclusive: true))?.InitDialog(reg[selected]);
                        }
                    }
                    DateTime registeredDate = reg[num2].RegisteredDate;
                    if (registeredDate.Year == DateTime.Today.Year && registeredDate.Month == DateTime.Today.Month && registeredDate.Day == DateTime.Today.Day)
                    {
                        TextureUtil.DrawTexture(new Rect(rect.x, rect.y, (float)GlobalVars.Instance.iconNewmap.width, (float)GlobalVars.Instance.iconNewmap.height), GlobalVars.Instance.iconNewmap, ScaleMode.StretchToFill);
                    }
                    else if ((reg[num2].tagMask & 8) != 0)
                    {
                        TextureUtil.DrawTexture(new Rect(rect.x, rect.y, (float)GlobalVars.Instance.iconglory.width, (float)GlobalVars.Instance.iconglory.height), GlobalVars.Instance.iconglory, ScaleMode.StretchToFill);
                    }
                    else if ((reg[num2].tagMask & 4) != 0)
                    {
                        TextureUtil.DrawTexture(new Rect(rect.x, rect.y, (float)GlobalVars.Instance.iconMedal.width, (float)GlobalVars.Instance.iconMedal.height), GlobalVars.Instance.iconMedal, ScaleMode.StretchToFill);
                    }
                    else if ((reg[num2].tagMask & 2) != 0)
                    {
                        TextureUtil.DrawTexture(new Rect(rect.x, rect.y, (float)GlobalVars.Instance.icongoldRibbon.width, (float)GlobalVars.Instance.icongoldRibbon.height), GlobalVars.Instance.icongoldRibbon, ScaleMode.StretchToFill);
                    }
                    if (reg[num2].IsAbuseMap())
                    {
                        float x2 = rect.x + rect.width - (float)GlobalVars.Instance.iconDeclare.width;
                        TextureUtil.DrawTexture(new Rect(x2, rect.y, (float)GlobalVars.Instance.iconDeclare.width, (float)GlobalVars.Instance.iconDeclare.height), GlobalVars.Instance.iconDeclare, ScaleMode.StretchToFill);
                    }
                    LabelUtil.TextOut(new Vector2(rect.x + crdAlias.x, rect.y + crdAlias.y), reg[num2].Alias, "MiniLabel", GlobalVars.Instance.txtMainColor, GlobalVars.txtEmptyColor, TextAnchor.UpperLeft);
                    if (selected == num2)
                    {
                        TextureUtil.DrawTexture(rect, selectedMapFrame, ScaleMode.StretchToFill);
                    }
                }
            }
        }
        GUI.EndScrollView();
        if (selected >= 0)
        {
            int  num5 = 2;
            Rect rc   = new Rect(crdBtns[num5]);
            if (chatView)
            {
                rc = crdBtns2[num5];
            }
            if (ChannelManager.Instance.CurChannel.Mode != 3 && RegMapManager.Instance.IsDownloaded(reg[selected].Map))
            {
                GUI.enabled = !reg[selected].Blocked;
                if (GlobalVars.Instance.MyButton(rc, StringMgr.Instance.Get("CREATE_ROOM"), "BtnAction"))
                {
                    CreateRoomDialog createRoomDialog = (CreateRoomDialog)DialogManager.Instance.Popup(DialogManager.DIALOG_INDEX.CREATE_ROOM, exclusive: true);
                    if (createRoomDialog != null && !createRoomDialog.InitDialog4TeamMatch(reg[selected].Map, reg[selected].ModeMask))
                    {
                        DialogManager.Instance.Clear();
                    }
                }
                GUI.enabled = true;
                num5--;
            }
            rc = crdBtns[num5];
            if (chatView)
            {
                rc = crdBtns2[num5];
            }
            if (RegMapManager.Instance.IsDownloaded(reg[selected].Map))
            {
                if (GlobalVars.Instance.MyButton(rc, StringMgr.Instance.Get("DELETE"), "BtnAction"))
                {
                    CSNetManager.Instance.Sock.SendCS_DEL_DOWNLOAD_MAP_REQ(reg[selected].Map);
                    selected = -1;
                }
                num5--;
            }
            else
            {
                bool enabled = GUI.enabled;
                GUI.enabled = reg[selected].IsLatest;
                if (GUI.enabled)
                {
                    GUI.enabled = !reg[selected].Blocked;
                }
                if (GlobalVars.Instance.MyButton(rc, StringMgr.Instance.Get("SAVE"), "BtnAction"))
                {
                    ((DownloadFeeDialog)DialogManager.Instance.Popup(DialogManager.DIALOG_INDEX.DOWNLOAD_FEE, exclusive: true))?.InitDialog(reg[selected]);
                }
                num5--;
                GUI.enabled = enabled;
            }
            rc = crdBtns[num5];
            if (chatView)
            {
                rc = crdBtns2[num5];
            }
            GUI.enabled = !reg[selected].Blocked;
            if (GlobalVars.Instance.MyButton(rc, StringMgr.Instance.Get("MAP_SETTING_CHG"), "BtnAction"))
            {
                ((MapSettingChangeDlg)DialogManager.Instance.Popup(DialogManager.DIALOG_INDEX.MAP_SETTING_CHANGE, exclusive: true))?.InitDialog(reg[selected]);
                selected = -1;
            }
            GUI.enabled = true;
        }
    }
 public void OnGUI()
 {
     DoModeSelector();
     RegMap[] array = RegMapManager.Instance.ToArray(subTab, page);
     if (array.Length != 0)
     {
         DoPagePanel(array.Length);
         Texture2D[] array2 = new Texture2D[array.Length];
         for (int i = 0; i < array.Length; i++)
         {
             if (array[i].Thumbnail == null)
             {
                 array2[i] = nonAvailable;
             }
             else
             {
                 array2[i] = array[i].Thumbnail;
             }
         }
         int num = array.Length / 4;
         if (array.Length % 4 > 0)
         {
             num++;
         }
         Rect viewRect = new Rect(0f, 0f, crdMapSize.x * 4f + crdMapOffset.x * 3f, crdMapSize.y * (float)num);
         if (num > 1)
         {
             viewRect.height += crdMapOffset.y * (float)(num - 1);
         }
         VerifyChatView();
         if (chatView)
         {
             crdRegMapRect.height = 300f;
         }
         else
         {
             crdRegMapRect.height = crdRegMapRectTemp.height;
         }
         scrollPosition = GUI.BeginScrollView(crdRegMapRect, scrollPosition, viewRect);
         for (int j = 0; j < num; j++)
         {
             for (int k = 0; k < 4; k++)
             {
                 int num2 = 4 * j + k;
                 if (num2 < array.Length)
                 {
                     Rect rect     = new Rect((float)k * (crdMapSize.x + crdMapOffset.x), (float)j * (crdMapSize.y + crdMapOffset.y), crdMapSize.x, crdMapSize.y);
                     Rect position = new Rect(rect.x, rect.y, rect.width, rect.width + 4f);
                     if (!array[num2].Blocked)
                     {
                         TextureUtil.DrawTexture(position, array2[num2], ScaleMode.StretchToFill);
                     }
                     else
                     {
                         TextureUtil.DrawTexture(position, GlobalVars.Instance.iconBoxGray, ScaleMode.StretchToFill);
                         float num3 = (float)GlobalVars.Instance.iconLockSlot.width;
                         float num4 = (float)GlobalVars.Instance.iconLockSlot.height;
                         float x    = position.x + position.width / 2f - num3 / 2f;
                         float y    = position.y + position.height / 2f - num4 / 2f;
                         TextureUtil.DrawTexture(new Rect(x, y, num3, num4), GlobalVars.Instance.iconLockSlot, ScaleMode.StretchToFill);
                     }
                     string str = "BoxMapSelectBorder";
                     if (GlobalVars.Instance.MyButton(rect, string.Empty, str))
                     {
                         selected = num2;
                         if (array[selected].Blocked)
                         {
                             MessageBoxMgr.Instance.AddMessage(StringMgr.Instance.Get("NOTICE_BLOCK_MAP"));
                         }
                         if (Time.time - lastClickTime > doubleClickTimeout)
                         {
                             lastClickTime = Time.time;
                         }
                         else
                         {
                             ((MapDetailDlg)DialogManager.Instance.Popup(DialogManager.DIALOG_INDEX.MAP_DETAIL, exclusive: true))?.InitDialog(array[selected]);
                         }
                     }
                     DateTime registeredDate = array[num2].RegisteredDate;
                     if (registeredDate.Year == DateTime.Today.Year && registeredDate.Month == DateTime.Today.Month && registeredDate.Day == DateTime.Today.Day)
                     {
                         TextureUtil.DrawTexture(new Rect(rect.x, rect.y, (float)GlobalVars.Instance.iconNewmap.width, (float)GlobalVars.Instance.iconNewmap.height), GlobalVars.Instance.iconNewmap, ScaleMode.StretchToFill);
                     }
                     else if ((array[num2].tagMask & 8) != 0)
                     {
                         TextureUtil.DrawTexture(new Rect(rect.x, rect.y, (float)GlobalVars.Instance.iconglory.width, (float)GlobalVars.Instance.iconglory.height), GlobalVars.Instance.iconglory, ScaleMode.StretchToFill);
                     }
                     else if ((array[num2].tagMask & 4) != 0)
                     {
                         TextureUtil.DrawTexture(new Rect(rect.x, rect.y, (float)GlobalVars.Instance.iconMedal.width, (float)GlobalVars.Instance.iconMedal.height), GlobalVars.Instance.iconMedal, ScaleMode.StretchToFill);
                     }
                     else if ((array[num2].tagMask & 2) != 0)
                     {
                         TextureUtil.DrawTexture(new Rect(rect.x, rect.y, (float)GlobalVars.Instance.icongoldRibbon.width, (float)GlobalVars.Instance.icongoldRibbon.height), GlobalVars.Instance.icongoldRibbon, ScaleMode.StretchToFill);
                     }
                     if (array[num2].IsAbuseMap())
                     {
                         float x2 = rect.x + rect.width - (float)GlobalVars.Instance.iconDeclare.width;
                         TextureUtil.DrawTexture(new Rect(x2, rect.y, (float)GlobalVars.Instance.iconDeclare.width, (float)GlobalVars.Instance.iconDeclare.height), GlobalVars.Instance.iconDeclare, ScaleMode.StretchToFill);
                     }
                     LabelUtil.TextOut(new Vector2(rect.x + crdAlias.x, rect.y + crdAlias.y), array[num2].Alias, "MiniLabel", GlobalVars.Instance.txtMainColor, GlobalVars.txtEmptyColor, TextAnchor.UpperLeft);
                     if (selected == num2)
                     {
                         TextureUtil.DrawTexture(rect, selectedMapFrame, ScaleMode.StretchToFill);
                     }
                 }
             }
         }
         GUI.EndScrollView();
         if (selected >= 0)
         {
             int  num5 = 1;
             Rect rc   = new Rect(crdBtns[num5]);
             if (chatView)
             {
                 rc = crdBtns2[num5];
             }
             GUI.enabled = !array[selected].Blocked;
             GUIContent content = new GUIContent(StringMgr.Instance.Get("CREATE_ROOM").ToUpper(), GlobalVars.Instance.iconJoin);
             if (ChannelManager.Instance.CurChannel.Mode != 3 && GlobalVars.Instance.MyButton3(rc, content, "BtnAction"))
             {
                 CreateRoomDialog createRoomDialog = (CreateRoomDialog)DialogManager.Instance.Popup(DialogManager.DIALOG_INDEX.CREATE_ROOM, exclusive: true);
                 if (createRoomDialog != null && !createRoomDialog.InitDialog4TeamMatch(array[selected].Map, array[selected].ModeMask))
                 {
                     DialogManager.Instance.Clear();
                 }
             }
             num5--;
             GUI.enabled = true;
             rc          = crdBtns[num5];
             if (chatView)
             {
                 rc = crdBtns2[num5];
             }
             content = new GUIContent(StringMgr.Instance.Get("DELETE").ToUpper(), GlobalVars.Instance.iconGarbage);
             if (GlobalVars.Instance.MyButton3(rc, content, "BtnAction"))
             {
                 CSNetManager.Instance.Sock.SendCS_DEL_DOWNLOAD_MAP_REQ(array[selected].Map);
                 selected = 0;
             }
         }
     }
 }
    public override bool DoDialog()
    {
        bool    result = false;
        GUISkin skin   = GUI.skin;

        GUI.skin = GUISkinFinder.Instance.GetGUISkin();
        TextureUtil.DrawTexture(crdIcon, icon, ScaleMode.StretchToFill);
        LabelUtil.TextOut(crdTitle, StringMgr.Instance.Get("MAP_INFO"), "Label", Color.white, GlobalVars.txtEmptyColor, TextAnchor.UpperLeft);
        GUI.Box(crdOutline, string.Empty, "BoxPopLine");
        DrawThumbnail();
        PrintMapInfo();
        Rect rc = crdButtonBase;

        if (GlobalVars.Instance.MyButton(rc, StringMgr.Instance.Get("CANCEL"), "BtnAction"))
        {
            result = true;
        }
        rc.x -= 100f;
        if (CanMakeRoom())
        {
            if (GlobalVars.Instance.MyButton(rc, StringMgr.Instance.Get("CREATE_ROOM"), "BtnAction"))
            {
                UserMapInfo userMapInfo = GetUserMap();
                if (userMapInfo != null)
                {
                    CreateRoomDialog createRoomDialog = (CreateRoomDialog)DialogManager.Instance.Popup(DialogManager.DIALOG_INDEX.CREATE_ROOM, exclusive: true);
                    if (createRoomDialog != null && !createRoomDialog.InitDialog4MapEditorLoad(userMapInfo.Slot))
                    {
                        DialogManager.Instance.Clear();
                    }
                }
                else
                {
                    RegMap regMap = GetRegMap();
                    if (regMap != null)
                    {
                        CreateRoomDialog createRoomDialog2 = (CreateRoomDialog)DialogManager.Instance.Popup(DialogManager.DIALOG_INDEX.CREATE_ROOM, exclusive: true);
                        if (!createRoomDialog2.InitDialog4TeamMatch(regMap.Map, regMap.ModeMask))
                        {
                            DialogManager.Instance.Clear();
                        }
                    }
                }
            }
            rc.x -= 100f;
        }
        if (userMap != null)
        {
            if (GlobalVars.Instance.MyButton(rc, StringMgr.Instance.Get("RENAME_MAP"), "BtnAction"))
            {
                ((RenameMapDlg)DialogManager.Instance.Popup(DialogManager.DIALOG_INDEX.RENAME_MAP, exclusive: true))?.InitDialog(userMap);
            }
            rc.x -= 100f;
        }
        if (this.regMap != null)
        {
            if (RegMapManager.Instance.IsDownloaded(this.regMap.Map))
            {
                if (GlobalVars.Instance.MyButton(rc, StringMgr.Instance.Get("DELETE"), "BtnAction"))
                {
                    CSNetManager.Instance.Sock.SendCS_DEL_DOWNLOAD_MAP_REQ(this.regMap.Map);
                }
                rc.x -= 100f;
            }
            else
            {
                bool enabled = GUI.enabled;
                GUI.enabled = this.regMap.IsLatest;
                if (GlobalVars.Instance.MyButton(rc, StringMgr.Instance.Get("SAVE"), "BtnAction"))
                {
                    ((DownloadFeeDialog)DialogManager.Instance.Popup(DialogManager.DIALOG_INDEX.DOWNLOAD_FEE, exclusive: true))?.InitDialog(this.regMap);
                }
                GUI.enabled = enabled;
                rc.x       -= 100f;
            }
        }
        if (!ContextMenuManager.Instance.IsPopup)
        {
            WindowUtil.EatEvent();
        }
        GUI.skin = skin;
        return(result);
    }