public static void InitConnectedIntro()
 {
     if (SessionClientController.LoginInNewServerIP)
     {
         //Текстовое оповещение о возможном обновлении с сервера
         var form = new Dialog_Input("OCity_SessionCC_InitConnectedIntro_Title".Translate()
                                     , "OCity_SessionCC_InitConnectedIntro_Text".Translate());
         form.PostCloseAction = () =>
         {
             if (form.ResultOK)
             {
                 InitConnected();
             }
             else
             {
                 Disconnected("OCity_DialogInput_Cancele".Translate());
             }
         };
         Find.WindowStack.Add(form);
     }
     else
     {
         InitConnected();
     }
 }
        private void CannalRename()
        {
            var selectCannal = SessionClientController.Data.Chats[lbCannals.SelectedIndex];
            var form         = new Dialog_Input("OCity_Dialog_ChennelRenLabel".Translate(), "OCity_Dialog_ChennelNewName".Translate() + selectCannal.Name, "");

            form.PostCloseAction = () =>
            {
                if (form.ResultOK && form.InputText != null)
                {
                    SessionClientController.Command((connect) =>
                    {
                        connect.PostingChat(selectCannal.Id, "/renameChat '" + form.InputText.Replace("'", "''") + "'");
                    });
                    //to do Сделать старт крутяшки до обновления чата
                }
            };
            Find.WindowStack.Add(form);
        }
        private void CannalDelete()
        {
            var form = new Dialog_Input("OCity_Dialog_ChennelQuit".Translate(), "OCity_Dialog_ChennelQuitCheck".Translate());

            form.PostCloseAction = () =>
            {
                if (form.ResultOK)
                {
                    var selectCannal = SessionClientController.Data.Chats[lbCannals.SelectedIndex];
                    SessionClientController.Command((connect) =>
                    {
                        connect.PostingChat(selectCannal.Id, "/exitChat");
                    });
                    //to do Сделать старт крутяшки до обновления чата
                }
            };
            Find.WindowStack.Add(form);
        }
        private void CannalAdd()
        {
            var form = new Dialog_Input("OCity_Dialog_ChennelCreating".Translate(), "OCity_Dialog_ChennelCreateName".Translate(), "");

            form.PostCloseAction = () =>
            {
                if (form.ResultOK && !string.IsNullOrEmpty(form.InputText) && form.InputText.Replace(" ", "") != "")
                {
                    var mainCannal = SessionClientController.Data.Chats[0];
                    SessionClientController.Command((connect) =>
                    {
                        connect.PostingChat(mainCannal.Id, "/createChat '" + form.InputText.Replace("'", "''") + "'");
                    });
                    //to do Сделать старт крутяшки до обновления чата
                }
            };
            Find.WindowStack.Add(form);
        }
        public void DoTab3Contents(Rect inRect)
        {
            Text.Font = GameFont.Medium;
            Widgets.Label(inRect, "OCity_Dialog_AboutMode".Translate());

            Text.Font = GameFont.Small;
            var chatAreaOuter = new Rect(inRect.x + 150f, inRect.y + 40f, inRect.width - 150f, inRect.height - 30f - 40f);

            AboutBox.Drow(chatAreaOuter);

            var rect2 = new Rect(inRect.x, inRect.y + inRect.height / 2f, 150f, inRect.height - 30f - 40f);

            Text.Font = GameFont.Small;
            List <ListableOption> list2 = new List <ListableOption>();
            ListableOption        item2 = new ListableOption_WebLink("OCity_Dialog_AutorPage".Translate(), "https://steamcommunity.com/sharedfiles/filedetails/?id=1908437382", GeneralTexture.IconForums);

            list2.Add(item2);

            rect2     = new Rect(inRect.x, inRect.y + 30f, 150f, 40f);
            Text.Font = GameFont.Small;
            list2     = new List <ListableOption>();
            item2     = new ListableOption_WebLink("OCity_Dialog_Regame".Translate(), () =>
            {
                var form             = new Dialog_Input("OCity_Dialog_DeleteData".Translate(), "OCity_Dialog_DeleteDataCheck".Translate());
                form.PostCloseAction = () =>
                {
                    if (form.ResultOK)
                    {
                        var mainCannal = SessionClientController.Data.Chats[0];
                        SessionClientController.Command((connect) =>
                        {
                            var res = connect.PostingChat(mainCannal.Id, "/killmyallplease");
                            if (res != null && res.Status == 0)
                            {
                                SessionClientController.Disconnected("OCity_Dialog_DeletedData".Translate());
                            }
                        });
                    }
                };
                Find.WindowStack.Add(form);
            }, GeneralTexture.IconDelTex);
            list2.Add(item2);

            float num = OptionListingUtility.DrawOptionListing(rect2, list2);

            GUI.BeginGroup(rect2);
            if (Current.ProgramState == ProgramState.Entry && Widgets.ButtonImage(new Rect(0f, num + 10f, 64f, 32f), LanguageDatabase.activeLanguage.icon))
            {
                List <FloatMenuOption> list3 = new List <FloatMenuOption>();
                foreach (LoadedLanguage current in LanguageDatabase.AllLoadedLanguages)
                {
                    LoadedLanguage localLang = current;
                    list3.Add(new FloatMenuOption(localLang.FriendlyNameNative, delegate
                    {
                        LanguageDatabase.SelectLanguage(localLang);
                        Prefs.Save();
                    }, MenuOptionPriority.Default, null, null, 0f, null, null));
                }
                Find.WindowStack.Add(new FloatMenu(list3));
            }
            GUI.EndGroup();

            /*
             * var rectCannals = new Rect(inRect.x, inRect.y, 100f, (float)Math.Round((decimal)(inRect.height / 2f * 10f)) / 10f);
             * Widgets.DrawBoxSolid(inRect, new Color(0.2f, 0.2f, 0));
             * Widgets.DrawBoxSolid(rectCannals, new Color(0.4f, 0.4f, 0));
             *
             *
             * Widgets.DrawBoxSolid(new Rect(inRect.x + 110f, inRect.y, inRect.width - 110f, inRect.height - 40f)
             *  , new Color(0.4f, 0, 0));
             *
             * Widgets.DrawBoxSolid(new Rect(inRect.x + 110f, inRect.y + inRect.height - 35f, inRect.width - 110f, 25f)
             *  , new Color(0, 0, 0.4f));
             *
             * Widgets.Label(inRect, "Вкладка 3");
             */
        }
Example #6
0
        public void DoTab2Contents(Rect inRect)
        {
            Text.Font = GameFont.Medium;
            Widgets.Label(inRect, "OCity_Dialog_AboutMode".Translate());

            Text.Font = GameFont.Small;
            //var chatTextSize = Text.CalcSize(InfoTabText);
            var chatAreaOuter = new Rect(inRect.x + 150f, inRect.y + 40f, inRect.width - 150f, inRect.height - 30f - 40f);
            var chatAreaInner = new Rect(0, 0
                                         , /*inRect.width - (inRect.x + 50f)*/ chatAreaOuter.width - ListBox <string> .WidthScrollLine
                                         , 0 /*chatTextSize.y*/);

            chatAreaInner.height = Text.CalcHeight(AboutTabText, chatAreaInner.width);

            InfoScrollPosition = GUI.BeginScrollView(chatAreaOuter, InfoScrollPosition, chatAreaInner);
            GUILayout.BeginArea(chatAreaInner);
            GUILayout.TextField(AboutTabText, "Label");
            GUILayout.EndArea();
            GUI.EndScrollView();

            var rect2 = new Rect(inRect.x, inRect.y + inRect.height / 2f, 150f, inRect.height - 30f - 40f);

            Text.Font = GameFont.Small;
            List <ListableOption> list2 = new List <ListableOption>();
            ListableOption        item2 = new ListableOption_WebLink("OCity_Dialog_AutorPage".Translate(), "https://vk.com/rimworldonline", IconForums);

            list2.Add(item2);
            float num = OptionListingUtility.DrawOptionListing(rect2, list2);

            rect2     = new Rect(inRect.x, inRect.y + 30f, 150f, 40f);
            Text.Font = GameFont.Small;
            list2     = new List <ListableOption>();
            item2     = new ListableOption_WebLink("OCity_Dialog_Regame".Translate(), () =>
            {
                var form             = new Dialog_Input("OCity_Dialog_DeleteData".Translate(), "OCity_Dialog_DeleteDataCheck".Translate());
                form.PostCloseAction = () =>
                {
                    if (form.ResultOK)
                    {
                        var mainCannal = SessionClientController.Data.Chats[0];
                        SessionClientController.Command((connect) =>
                        {
                            if (connect.PostingChat(mainCannal.Id, "/killmyallpleace"))
                            {
                                SessionClientController.Disconnected("OCity_Dialog_DeletedData".Translate());
                            }
                        });
                    }
                };
                Find.WindowStack.Add(form);
            }, IconDelTex);
            list2.Add(item2);
            num = OptionListingUtility.DrawOptionListing(rect2, list2);

            /*
             * GUI.BeginGroup(rect2);
             * if (Current.ProgramState == ProgramState.Entry && Widgets.ButtonImage(new Rect(0f, num + 10f, 64f, 32f), LanguageDatabase.activeLanguage.icon))
             * {
             *  List<FloatMenuOption> list3 = new List<FloatMenuOption>();
             *  foreach (LoadedLanguage current in LanguageDatabase.AllLoadedLanguages)
             *  {
             *      LoadedLanguage localLang = current;
             *      list3.Add(new FloatMenuOption(localLang.FriendlyNameNative, delegate
             *      {
             *          LanguageDatabase.SelectLanguage(localLang);
             *          Prefs.Save();
             *      }, MenuOptionPriority.Default, null, null, 0f, null, null));
             *  }
             *  Find.WindowStack.Add(new FloatMenu(list3));
             * }
             * GUI.EndGroup();
             */

            /*
             * var rectCannals = new Rect(inRect.x, inRect.y, 100f, (float)Math.Round((decimal)(inRect.height / 2f * 10f)) / 10f);
             * Widgets.DrawBoxSolid(inRect, new Color(0.2f, 0.2f, 0));
             * Widgets.DrawBoxSolid(rectCannals, new Color(0.4f, 0.4f, 0));
             *
             *
             * Widgets.DrawBoxSolid(new Rect(inRect.x + 110f, inRect.y, inRect.width - 110f, inRect.height - 40f)
             *  , new Color(0.4f, 0, 0));
             *
             * Widgets.DrawBoxSolid(new Rect(inRect.x + 110f, inRect.y + inRect.height - 35f, inRect.width - 110f, 25f)
             *  , new Color(0, 0, 0.4f));
             *
             * Widgets.Label(inRect, "Вкладка 3");
             */
        }