protected void Page_Command(Object sender, CommandEventArgs e)
 {
     if (e.CommandName == "NewRecord")
     {
         reqNAME.Enabled = true;
         reqNAME.Validate();
         if (Page.IsValid)
         {
             Guid gID = Guid.Empty;
             try
             {
                 SqlProcs.spTERMINOLOGY_InsertOnly(txtNAME.Text, lstLANGUAGE.SelectedValue, lstMODULE_NAME.SelectedValue, lstLIST_NAME.SelectedValue, Sql.ToInteger(txtLIST_ORDER.Text), txtDISPLAY_NAME.Text);
                 // 01/16/2006 Paul.  Update language cache.
                 if (Sql.IsEmptyString(lstLIST_NAME.SelectedValue))
                 {
                     L10N.SetTerm(lstLANGUAGE.SelectedValue, lstMODULE_NAME.SelectedValue, txtNAME.Text, txtDISPLAY_NAME.Text);
                 }
                 else
                 {
                     L10N.SetTerm(lstLANGUAGE.SelectedValue, lstMODULE_NAME.SelectedValue, lstLIST_NAME.SelectedValue, txtNAME.Text, txtDISPLAY_NAME.Text);
                 }
             }
             catch (Exception ex)
             {
                 SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
                 lblError.Text = ex.Message;
             }
             if (!Sql.IsEmptyGuid(gID))
             {
                 Response.Redirect("default.aspx");
             }
         }
     }
 }
            private static string Description(FrameType type,
                                              CelestialBody selected)
            {
                switch (type)
                {
                case FrameType.BODY_CENTRED_NON_ROTATING:
                    return(L10N.CelestialString(
                               "#Principia_ReferenceFrameSelector_Description_BodyCentredNonRotating",
                               new[] { selected }));

                case FrameType.BARYCENTRIC_ROTATING:
                    return("DEPRECATED");

                case FrameType.BODY_CENTRED_PARENT_DIRECTION:
                    if (selected.is_root())
                    {
                        throw Log.Fatal(
                                  "Describing parent-direction rotating frame of root body");
                    }
                    else
                    {
                        return(L10N.CelestialString(
                                   "#Principia_ReferenceFrameSelector_Description_BodyCentredParentDirection",
                                   new[] { selected, selected.referenceBody }));
                    }

                case FrameType.BODY_SURFACE:
                    return(L10N.CelestialString(
                               "#Principia_ReferenceFrameSelector_Description_BodySurface",
                               new[] { selected }));

                default:
                    throw Log.Fatal("Unexpected type " + type.ToString());
                }
            }
Example #3
0
        private static void AddItems(int count)
        {
            var inventoryScreen = ScreenManager.TopScreen as InventoryGauntletScreen;

            var inventoryVM = inventoryScreen.GetViewModel <SPInventoryVM>();

            var selectedItem = inventoryVM.GetSelectedItem();

            if (selectedItem == null)
            {
                return;
            }

            var index = TaleWorlds.CampaignSystem.PartyBase.MainParty.ItemRoster.FindIndexOfElement(selectedItem.ItemRosterElement.EquipmentElement);

            if (index < 0)
            {
                return;
            }

            TaleWorlds.CampaignSystem.PartyBase.MainParty.ItemRoster.AddToCounts(selectedItem.ItemRosterElement.EquipmentElement, count);

            selectedItem.ItemCount += count;

            var message = string.Format(L10N.GetText("AddItemsMessage"), count, selectedItem.ItemDescription);

            Message.Show(message);
        }
Example #4
0
        private void RefreshControls()
        {
            _ctrlID.Text    = $"{_id:000000000000}";
            _ctrlName.Text  = _name;
            _ctrlSize.Text  = _size.Width + "x" + _size.Height;
            _ctrlView.Text  = FlatAlign9Helper.LETTERS[_view];
            _ctrlMusic.Text = _music < 0 ? L10N.T(L10NImpl.STR_MUSIC_NONE) : L10N.TF(L10NImpl.STR_MUSIC_INT, _music + 1);
            switch (_geometry)
            {
            case GameWrapMode.Death:
                _ctrlGeometry.L10NText = L10NImpl.STR_LVLED_CFG_WRAP_INFINITY;
                break;

            case GameWrapMode.Donut:
                _ctrlGeometry.L10NText = L10NImpl.STR_LVLED_CFG_WRAP_DONUT;
                break;

            case GameWrapMode.Reflect:
                _ctrlGeometry.L10NText = L10NImpl.STR_LVLED_CFG_WRAP_REFLECT;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
            private static string SelectorTooltip(FrameType type,
                                                  CelestialBody selected)
            {
                string name = Name(type, selected);

                switch (type)
                {
                case FrameType.BODY_CENTRED_NON_ROTATING:
                    return(L10N.CacheFormat(
                               "#Principia_ReferenceFrameSelector_Tooltip_BodyCentredNonRotating",
                               name,
                               selected.Name()));

                case FrameType.BARYCENTRIC_ROTATING:
                    return("DEPRECATED");

                case FrameType.BODY_CENTRED_PARENT_DIRECTION:
                    return(L10N.CacheFormat(
                               "#Principia_ReferenceFrameSelector_Tooltip_BodyCentredParentDirection",
                               name,
                               selected.Name()));

                case FrameType.BODY_SURFACE:
                    return(L10N.CacheFormat(
                               "#Principia_ReferenceFrameSelector_Tooltip_BodySurface",
                               name,
                               selected.Name()));

                default:
                    throw Log.Fatal("Unexpected type " + type.ToString());
                }
            }
Example #6
0
        protected void DefaultAction_UnreachableAndFullyLocked()
        {
            Owner.HUD.ShowToast("OWNG::LOCKED(MULTI)", L10N.T(L10NImpl.STR_GLOB_WORLDLOCK), 40, FlatColors.Pomegranate, FlatColors.Foreground, 1.5f);
            MainGame.Inst.GDSound.PlayEffectError();

            AddOperation(new ShakeNodeOperation());
        }
Example #7
0
        /// <summary>
        /// Get fw version from firmeware.diydrones.com
        /// </summary>
        /// <param name="fwurl"></param>
        /// <returns></returns>
        void getAPMVersion(object tempin)
        {
            System.Threading.Thread.CurrentThread.CurrentUICulture = L10N.ConfigLang;

            try
            {
                software temp = (software)tempin;

                string baseurl = temp.urlpx4v2;

                if (baseurl == "")
                {
                    return;
                }

                L10N.ReplaceMirrorUrl(ref baseurl);

                Uri url = new Uri(new Uri(baseurl), "git-version.txt");

                log.Info("Get url " + url.ToString());

                updateProgress(-1, Strings.GettingFWVersion);

                WebRequest  wr    = WebRequest.Create(url);
                WebResponse wresp = wr.GetResponse();

                StreamReader sr = new StreamReader(wresp.GetResponseStream());

                while (!sr.EndOfStream)
                {
                    string line = sr.ReadLine();

                    if (line.Contains("APMVERSION:"))
                    {
                        log.Info(line);

                        // get index
                        var index = softwares.IndexOf(temp);
                        // get item to modify
                        var item = softwares[index];
                        // change name
                        item.name = line.Substring(line.IndexOf(':') + 2);
                        // save back to list
                        softwares[index] = item;

                        return;
                    }
                }

                log.Info("no answer");
            }
            catch (Exception ex) { log.Error(ex); }
            finally
            {
                lock (this)
                {
                    ingetapmversion--;
                }
            }
        }
Example #8
0
        protected override void OnUpdate(GameScreen screen, SAMTime gameTime, InputState istate)
        {
            bool trigger = false;

            if (istate.IsKeyExclusiveJustDown(SKeys.AndroidBack))
            {
                istate.SwallowKey(SKeys.AndroidBack, InputConsumer.ScreenAgent);
                trigger = true;
            }
            else if (istate.IsKeyExclusiveJustDown(SKeys.Backspace))
            {
                istate.SwallowKey(SKeys.Backspace, InputConsumer.ScreenAgent);
                trigger = true;
            }

            if (trigger)
            {
                var delta = gameTime.TotalElapsedSeconds - _lastBackClick;

                if (delta < 2f)
                {
                    MainGame.Inst.CleanExit();
                    return;
                }
                else
                {
                    screen.HUD.ShowToast(null, L10N.T(L10NImpl.STR_GLOB_EXITTOAST), 40, FlatColors.Silver, FlatColors.Foreground, 2f);
                }

                _lastBackClick = gameTime.TotalElapsedSeconds;
            }
        }
Example #9
0
        public static void OnApplicationTick()
        {
            try
            {
                if (ScreenManager.TopScreen is InventoryGauntletScreen &&
                    BannerlordCheatsSettings.Instance?.EnableHotkeys == true)
                {
                    if (Keys.IsKeyPressed(InputKey.LeftControl, InputKey.LeftShift, InputKey.X))
                    {
                        Hero.MainHero.ChangeHeroGold(100000);

                        Message.Show(string.Format(L10N.GetText("AddGoldMessage"), 100000));
                    }
                    else if (Keys.IsKeyPressed(InputKey.LeftControl, InputKey.X))
                    {
                        Hero.MainHero.ChangeHeroGold(1000);

                        Message.Show(string.Format(L10N.GetText("AddGoldMessage"), 1000));
                    }
                }
            }
            catch (Exception e)
            {
                SubModule.LogError(e, typeof(EnableHotkeysMoney));
            }
        }
Example #10
0
            private void RenderLowestAltitude(OrbitalElements?elements,
                                              CelestialBody primary)
            {
                double?lowest_distance = elements?.radial_distance.min;

                LabeledField(
                    L10N.CacheFormat("#Principia_OrbitAnalyser_Elements_LowestAltitude"),
                    (lowest_distance - primary?.Radius)?.FormatAltitude());
                double?lowest_primary_distance = primary?.ocean == true
                                          ? primary.Radius
                                          : primary?.pqsController?.radiusMin;
                string altitude_warning =
                    lowest_distance < lowest_primary_distance
            ?
                    L10N.CacheFormat("#Principia_OrbitAnalyser_Warning_Collision")
            : lowest_distance < primary?.pqsController?.radiusMax
                ? L10N.CacheFormat(
                        "#Principia_OrbitAnalyser_Warning_CollisionRisk")
                : lowest_distance < primary?.Radius + primary?.atmosphereDepth
                    ? L10N.CacheFormat(
                        "#Principia_OrbitAnalyser_Warning_Reentry")
                    : "";

                UnityEngine.GUILayout.Label(altitude_warning,
                                            Style.Warning(UnityEngine.GUI.skin.label));
            }
Example #11
0
            private void RenderOrbitGroundTrack(OrbitGroundTrack?ground_track,
                                                CelestialBody primary)
            {
                using (new UnityEngine.GUILayout.HorizontalScope()) {
                    UnityEngine.GUILayout.Label(
                        L10N.CacheFormat(
                            "#Principia_OrbitAnalyser_GroundTrack_LongitudesOfEquatorialCrossings_Prefix"),
                        UnityEngine.GUILayout.ExpandWidth(false));
                    string text = UnityEngine.GUILayout.TextField(
                        $"{ground_track_revolution_}",
                        GUILayoutWidth(2));
                    UnityEngine.GUILayout.Label(
                        L10N.CacheFormat(
                            "#Principia_OrbitAnalyser_GroundTrack_LongitudesOfEquatorialCrossings_Suffix"));
                    if (int.TryParse(text, out int revolution))
                    {
                        ground_track_revolution_ = revolution;
                    }
                }
                var equatorial_crossings = ground_track?.equatorial_crossings;

                LabeledField(
                    L10N.CacheFormat("#Principia_OrbitAnalyser_GroundTrack_AscendingPass"),
                    equatorial_crossings?.longitudes_reduced_to_ascending_pass.
                    FormatEquatorialAngleInterval(primary));
                LabeledField(
                    L10N.CacheFormat("#Principia_OrbitAnalyser_GroundTrack_DescendingPass"),
                    equatorial_crossings?.longitudes_reduced_to_descending_pass.
                    FormatEquatorialAngleInterval(primary));
            }
Example #12
0
        public static void OnApplicationTick()
        {
            if (ScreenManager.TopScreen is GauntletPartyScreen && Keys.IsKeyPressed(InputKey.LeftControl, InputKey.X) && BannerlordCheatsSettings.Instance.EnableHotkeys)
            {
                var partyScreen = ScreenManager.TopScreen as GauntletPartyScreen;

                var partyVM = partyScreen.GetViewModel <PartyVM>();

                var selectedCharacter = partyVM.CurrentCharacter;

                if (selectedCharacter.IsHero || (!selectedCharacter.IsUpgrade1Exists && !selectedCharacter.IsUpgrade2Exists))
                {
                    return;
                }

                var index = PartyBase.MainParty.MemberRoster.FindIndexOfTroop(selectedCharacter.Character);

                var missingXp = selectedCharacter.MaxXP * selectedCharacter.Number - selectedCharacter.CurrentXP;

                PartyBase.MainParty.MemberRoster.AddXpToTroopAtIndex(missingXp, index);

                var newTroop = selectedCharacter.Troop;
                newTroop.Xp             = selectedCharacter.MaxXP * selectedCharacter.Number;
                selectedCharacter.Troop = newTroop;

                selectedCharacter.InitializeUpgrades();

                var message = string.Format(L10N.GetText("AddTroopXpMessage"), selectedCharacter.Name);

                InformationManager.DisplayMessage(new InformationMessage(message, Color.White));
            }
        }
Example #13
0
        private async Task DoUpload()
        {
            var result = await MainGame.Inst.Backend.SetCustomLevelCompleted(MainGame.Inst.Profile, _level.CustomMeta_LevelID, _difficulty, _time);

            if (result.IsError)
            {
                MonoSAMGame.CurrentInst.DispatchBeginInvoke(() =>
                {
                    _btnReupload.IsVisible   = true;
                    _cannonCog.Color         = FlatColors.Alizarin;
                    _cannonCog.RotationSpeed = 0f;
                    _centerLabel.IsVisible   = false;
                });
            }
            else
            {
                MonoSAMGame.CurrentInst.DispatchBeginInvoke(() =>
                {
                    Remove();

                    HUD.AddModal(new HUDSCCMScorePanel_Won(_level, result.Metadata, _difficulty, result.ScoreGain, _time), false);

                    if (result.IsFirstClear)
                    {
                        AchievementPopup.Show(L10N.T(L10NImpl.STR_ACH_FIRSTCLEAR));
                    }
                    else if (result.IsWorldRecord)
                    {
                        AchievementPopup.Show(L10N.T(L10NImpl.STR_ACH_WORLDRECORD));
                    }
                });
            }
        }
Example #14
0
        private void HandleStringsLocalized()
        {
            L10N.LocalizeComboList(m_toolStripComboBoxFilter, "DialogBoxes.QuotationMarksDlg.FilterOptions");

            m_versesWithMissingExpectedQuotesFilterItem = m_toolStripComboBoxFilter.Items[1];
            m_allQuotesFilterItem = m_toolStripComboBoxFilter.Items[2];

            if (m_navigatorViewModel?.Mode != BlocksToDisplay.MissingExpectedQuote &&
                ((m_project.QuoteSystemStatus & QuoteSystemStatus.NotParseReady) > 0 || m_project.QuoteSystemStatus == QuoteSystemStatus.Guessed))
            {
                m_toolStripComboBoxFilter.Items.RemoveAt(2);
                m_toolStripComboBoxFilter.Items.RemoveAt(1);
            }

            SetPromptText();
            SetupQuoteMarksComboBoxes(CurrentQuoteSystem);
            m_xOfYFmt = m_labelXofY.Text;
            if (m_labelXofY.Visible)
            {
                UpdateRelativeNavigationPositionDisplay();
            }
            m_testResultsFmt = m_testResults.Text;
            if (m_project.ProjectState != ProjectState.NeedsQuoteSystemConfirmation)
            {
                ShowTestResults(PercentageOfExpectedQuotesFound(m_project.Books), false);
            }

            Text = string.Format(Text, m_project.Name);
        }
Example #15
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            Utils.SetPageTitle(Page, L10n.Term("Administration.LBL_RENAME_TABS"));
            // 06/04/2006 Paul.  Visibility is already controlled by the ASPX page, but it is probably a good idea to skip the load.
            this.Visible = SplendidCRM.Security.IS_ADMIN;
            if (!this.Visible)
            {
                return;
            }

            // 09/08/2005 Paul. An empty key is valid, so use a separate INSERT field.
            if (txtRENAME.Value == "1")
            {
                try
                {
                    SqlProcs.spMODULES_TAB_Rename(Guid.Empty, txtKEY.Value, ctlSearch.LANGUAGE, txtVALUE.Value);
                    SplendidCache.ClearList(ctlSearch.LANGUAGE, "moduleList");
                    // 01/17/2006 Paul.  Also need to clear the TabMenu.
                    SplendidCache.ClearTabMenu();
                    // 04/20/2006 Paul.  Also clear the term for the list.
                    L10N.SetTerm(ctlSearch.LANGUAGE, String.Empty, "moduleList", txtKEY.Value, txtVALUE.Value);
                    txtRENAME.Value = "";
                    // 09/09/2005 Paul.  Transfer so that viewstate will be reset completely.
                    // 01/04/2005 Paul.  Redirecting to default.aspx will loose the language setting.  Just rebind.
                }
                catch (Exception ex)
                {
                    SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
                    lblError.Text = ex.Message;
                }
            }
            // Must bind in order for LinkButton to get the argument.
            // ImageButton does not work no matter what I try.
            TERMINOLOGY_BindData(true);
        }
Example #16
0
        private const int TEXT_COUNT = 3;         // = next idx

        public static void Init(int lang)
        {
            L10N.Init(lang, TEXT_COUNT, LANG_COUNT);

            // [en-US] [de-DE]

            // Description: Text of error toast. Is shown when the profile/level cuold not be saved because there is no free disk space
            // Usage:       MainGame.cs:184
            L10N.Add(STR_ERR_OUTOFMEMORY, "Saving failed: Disk full", "Speichern fehlgeschlagen: Speicher voll");

            // Description: Text of error toast. Is shown when the sound playback failed. Informs the user that the sound is now disabled until he manually enables them again
            // Usage:       SGSounds.cs:39
            L10N.Add(STR_ERR_SOUNDPLAYBACK, "Sound playback failed. Disabling sounds ...", "Soundwiedergabe fehlgeschlagen. Sounds werden deaktiviert ...");

            // Description: Text of error toast. Is shown when the music playback failed. Informs the user that the music is now disabled until he manually enables them again
            // Usage:       SGSounds.cs:51
            L10N.Add(STR_ERR_MUSICPLAYBACK, "Music playback failed. Disabling music ...", "Musikwiedergabe fehlgeschlagen. Musik wird deaktiviert ...");


            // [en-US] [de-DE]

#if DEBUG
            L10N.Verify();
#endif
        }
Example #17
0
        public static string DateForChatHeader(DateTime date)
        {
            var    ts    = new TimeSpan(DateTime.Now.Ticks - date.Ticks);
            double delta = Math.Abs(ts.TotalSeconds);

            if (date.Date == DateTime.Now.Date)
            {
                return(L10N.Localize("date_Today"));
            }

            if (date.Date.AddDays(1) == DateTime.Now.Date)
            {
                return(L10N.Localize("date_Yesterday"));
            }

            if (date.Date.AddDays(2) == DateTime.Now.Date || delta < 144 * HOUR)
            {
                return(L10N.Localize($"date_{date.DayOfWeek.ToString()}"));
            }

            if (date.Date.Year == DateTime.Now.Year)
            {
                return(L10N.Locale() == "en-US" ? date.ToString("MMM dd") : date.ToString("dd MMM"));
            }

            return(date.Date.ToShortDateString());
        }
Example #18
0
        private void Initialize()
        {
#if DEBUG
            DebugUtils.CreateShortcuts(this);
            DebugDisp = DebugUtils.CreateDisplay(this);
#endif

            _banner1.TargetRect          = new FRectangle(0, 2.5f, 16, 2).AsDeflated(0.25f).InReferenceRaster(1f / GDConstants.TILE_WIDTH);
            _banner1.Text                = L10N.T(L10NImpl.STR_ENDGAME_1);
            _banner1.UseCPUParticles     = false;
            _banner1.AnimationTime       = 4f;
            _banner1.AnimationStartDelay = 5f;
            _banner1.CreateEntities(ParticlePresets.GetConfigLetterFlickerFire());

            _banner2.TargetRect          = new FRectangle(0, 5.5f, 16, 2).AsDeflated(0.25f).InReferenceRaster(1f / GDConstants.TILE_WIDTH);
            _banner2.Text                = L10N.T(L10NImpl.STR_ENDGAME_2);
            _banner2.UseCPUParticles     = false;
            _banner2.AnimationTime       = 4f;
            _banner2.AnimationStartDelay = 9f;
            _banner2.CreateEntities(ParticlePresets.GetConfigLetterFlickerFire());

            Entities.AddEntity(new MouseAreaEntity(this, new FPoint(VIEW_WIDTH / 2f, VIEW_HEIGHT / 2f), new FSize(VIEW_WIDTH * 2, VIEW_HEIGHT * 2), 0)
            {
                Click = LeaveScreen
            });
        }
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                lstLANGUAGE.DataSource = SplendidCache.Languages();
                lstLANGUAGE.DataBind();
                lstLANGUAGE.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
                Utils.SetValue(lstLANGUAGE, L10N.NormalizeCulture(L10n.NAME));

                lstMODULE_NAME.DataSource = SplendidCache.Modules();
                lstMODULE_NAME.DataBind();
                lstMODULE_NAME.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));

                lstLIST_NAME.DataSource = SplendidCache.TerminologyPickLists();
                lstLIST_NAME.DataBind();
                lstLIST_NAME.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
            }
            if (!chkINCLUDE_LISTS.Checked)
            {
                lstLIST_NAME.SelectedIndex = 0;
            }
            lstLIST_NAME.Enabled = chkINCLUDE_LISTS.Checked;
            if (chkGLOBAL_TERMS.Checked)
            {
                lstMODULE_NAME.SelectedIndex = 0;
            }
            lstMODULE_NAME.Enabled = !chkGLOBAL_TERMS.Checked;
        }
Example #20
0
 private void ShowErrorConnection()
 {
     MonoSAMGame.CurrentInst.DispatchBeginInvoke(() =>
     {
         MainGame.Inst.ShowToast("SAPI::CONERR", L10N.T(L10NImpl.STR_API_CONERR), 40, FlatColors.Flamingo, FlatColors.Foreground, 3f);
     });
 }
Example #21
0
        private void OnClick(GameEntityMouseArea sender, SAMTime gameTime, InputState istate)
        {
            if (GDOwner.ZoomState != BistateProgress.Normal && GDOwner.ZoomState != BistateProgress.Expanded)
            {
                return;
            }

#if DEBUG
            if (!NodeEnabled && DebugSettings.Get("UnlockNode"))
            {
                NodeEnabled = true;
            }
#endif
            if (!NodeEnabled)
            {
                MainGame.Inst.GDSound.PlayEffectError();

                if (GDOwner.ZoomState == BistateProgress.Expanded)
                {
                    AddEntityOperation(new ScreenShakeOperation2(this, GDOwner));
                }
                else
                {
                    AddEntityOperation(new ScreenShakeAndCenterOperation2(this, GDOwner));
                }

                Owner.HUD.ShowToast("WN::LOCKED", L10N.T(L10NImpl.STR_GLOB_WORLDLOCK), 40, FlatColors.Pomegranate, FlatColors.Foreground, 1.5f);

                return;
            }

            Owner.AddAgent(new LeaveTransitionGameEndAgent(GDOwner, GDOwner.ZoomState == BistateProgress.Expanded, this));
            MainGame.Inst.GDSound.PlayEffectZoomOut();
        }
Example #22
0
        private void CreateNewUserLevel(HUDTextButton sender, HUDButtonEventArgs e)
        {
            if (MainGame.Inst.Profile.AccountType == AccountType.Local)
            {
                CreateUserAndShowAnonPanel().EnsureNoError();
                return;
            }
            else if (MainGame.Inst.Profile.AccountType == AccountType.Anonymous)
            {
                ShowAnonPanel();
                HUD.ShowToast(null, L10N.T(L10NImpl.STR_SCCM_NEEDS_ACC), 40, FlatColors.Orange, FlatColors.Foreground, 2f);
                return;
            }

            var waitDialog = new HUDIconMessageBox
            {
                L10NText   = L10NImpl.STR_GENERIC_SERVER_QUERY,
                TextColor  = FlatColors.TextHUD,
                Background = HUDBackgroundDefinition.CreateRounded(FlatColors.BelizeHole, 16),

                IconColor     = FlatColors.Clouds,
                Icon          = Textures.CannonCogBig,
                RotationSpeed = 1f,

                CloseOnClick = false,
            };

            HUD.AddModal(waitDialog, false, 0.7f);

            CreateNewUserLevelInternal(waitDialog).RunAsync();
        }
            private static string SelectorText(FrameType type,
                                               CelestialBody selected)
            {
                string abbreviation = Abbreviation(type, selected);

                if (abbreviation != null)
                {
                    return(abbreviation);
                }
                switch (type)
                {
                case FrameType.BODY_CENTRED_NON_ROTATING:
                    return(L10N.CacheFormat(
                               "#Principia_ReferenceFrameSelector_SelectorText_BodyCentredNonRotating"));

                case FrameType.BARYCENTRIC_ROTATING:
                    return("DEPRECATED");

                case FrameType.BODY_CENTRED_PARENT_DIRECTION:
                    return(L10N.CacheFormat(
                               "#Principia_ReferenceFrameSelector_SelectorText_BodyCentredParentDirection"));

                case FrameType.BODY_SURFACE:
                    return(L10N.CacheFormat(
                               "#Principia_ReferenceFrameSelector_SelectorText_BodySurface"));

                default:
                    throw Log.Fatal("Unexpected type " + type.ToString());
                }
            }
Example #24
0
        protected override void OnClick_UnreachableButCanBeBought()
        {
            if (ForceClickCounter == 0)
            {
                Owner.HUD.ShowToast("ONW1::UNLOCK(MULTI)", L10N.T(L10NImpl.STR_GLOB_UNLOCKTOAST1), 40, FlatColors.Silver, FlatColors.Foreground, 2f);
                ForceClickCounter++;

                MainGame.Inst.GDSound.PlayEffectError();
                AddOperation(new ShakeNodeOperation());
            }
            else if (ForceClickCounter == 1)
            {
                Owner.HUD.ShowToast("ONW1::UNLOCK(MULTI)", L10N.T(L10NImpl.STR_GLOB_UNLOCKTOAST2), 40, FlatColors.Silver, FlatColors.Foreground, 2f);
                ForceClickCounter++;

                MainGame.Inst.GDSound.PlayEffectError();

                AddOperation(new ShakeNodeOperation());
            }
            else if (ForceClickCounter == 2)
            {
                Owner.HUD.ShowToast("ONW1::UNLOCK(MULTI)", L10N.T(L10NImpl.STR_GLOB_UNLOCKTOAST3), 40, FlatColors.Silver, FlatColors.Foreground, 2f);

                MainGame.Inst.Profile.SkipTutorial = true;
                MainGame.Inst.SaveProfile();
                _ustate = WorldUnlockState.OpenAndUnlocked;
                return;
            }
        }
 private static string TargetFrameDescription(Vessel target)
 {
     return(L10N.CacheFormat(
                "#Principia_ReferenceFrameSelector_Description_Target",
                target.vesselName,
                target.orbit.referenceBody.Name()));
 }
        private GDetailSystemDataModel CreateSystemDetail(IDbConnection connection, int id, byte typeId, string name)
        {
            var translate = new L10N();

            translate.InitializeField();
            var type          = _gameTypeService.GetGGameType(connection, typeId);
            var typeTranslate = type.Description;

            translate.En.Description = "Unique Description En " + name + " " + " TypeDescription: " +
                                       typeTranslate.En.Description;
            translate.Es.Description = "Unique Description Es " + name + " " + " TypeDescription: " +
                                       typeTranslate.Es.Description;
            translate.Ru.Description = "Unique Description Ru " + name + " " + " TypeDescription: " +
                                       typeTranslate.Ru.Description;
            translate.En.Name = translate.Es.Name = translate.Ru.Name = name;

            return(new GDetailSystemDataModel
            {
                Id = id,
                TypeId = typeId,
                AllianceId = 1,
                Name = name,
                UserName = Npc.SkagyName,
                Description = translate,
                EnergyBonus = 1
            });
        }
            protected override void RenderWindowContents(int window_id)
            {
                using (new UnityEngine.GUILayout.VerticalScope()) {
                    UnityEngine.GUILayout.Label(
                        L10N.CacheFormat(
                            "#Principia_ReferenceFrameSelector_Description_Heading",
                            Name(),
                            Abbreviation()));
                    UnityEngine.GUILayout.Label(
                        target_frame_selected ? TargetFrameDescription(target)
                                : Description(frame_type, selected_celestial),
                        Style.Multiline(UnityEngine.GUI.skin.label),
                        GUILayoutHeight(3));
                    using (new UnityEngine.GUILayout.HorizontalScope()) {
                        // Left-hand side: tree view of celestials.
                        using (new UnityEngine.GUILayout.VerticalScope(GUILayoutWidth(8))) {
                            RenderSubtree(celestial: Planetarium.fetch.Sun, depth: 0);
                        }

                        // Right-hand side: toggles for reference frame type selection.
                        using (new UnityEngine.GUILayout.VerticalScope()) {
                            RenderSubtreeToggleGrid(Planetarium.fetch.Sun);
                        }
                    }
                }
                UnityEngine.GUI.DragWindow();
            }
Example #28
0
        private void OnClickUnlock(HUDTextButton sender, HUDButtonEventArgs e)
        {
            try
            {
                var r = MainGame.Inst.GDBridge.IAB.StartPurchase(GDConstants.IAB_MULTIPLAYER);
                switch (r)
                {
                case PurchaseResult.ProductNotFound:
                    SAMLog.Error("MMP::IAB-PNF", "Product not found", "_iabCode -> " + GDConstants.IAB_MULTIPLAYER);
                    Owner.HUD.ShowToast("MMP:ERR1", L10N.T(L10NImpl.STR_IAB_BUYERR), 40, FlatColors.Pomegranate, FlatColors.Foreground, 2.5f);
                    break;

                case PurchaseResult.NotConnected:
                    Owner.HUD.ShowToast("MMP:ERR2", L10N.T(L10NImpl.STR_IAB_BUYNOCONN), 40, FlatColors.Orange, FlatColors.Foreground, 2.5f);
                    break;

                case PurchaseResult.CurrentlyInitializing:
                    Owner.HUD.ShowToast("MMP:ERR3", L10N.T(L10NImpl.STR_IAB_BUYNOTREADY), 40, FlatColors.Orange, FlatColors.Foreground, 2.5f);
                    break;

                case PurchaseResult.PurchaseStarted:
                    SAMLog.Info("MMP::IAB-BUY", "PurchaseStarted");
                    break;

                default:
                    SAMLog.Error("MMP::EnumSwitch_OCU", "OnClickBuy()", "r -> " + r);
                    break;
                }
            }
            catch (Exception ex)
            {
                SAMLog.Error("MMP::IAB_CALL", ex);
            }
        }
Example #29
0
        public static string GetCallerName(int callerId)
        {
            #if DEBUG
            var realm = Realm.GetInstance(new RealmConfiguration {
                ShouldDeleteIfMigrationNeeded = true
            });
            #else
            var realm = Realm.GetInstance();
            #endif

            var members = realm.All <GetUsersInDivisionModel>();
            var caller  = members.Where(x => x.UserId == callerId)?.FirstOrDefault();

            string fullname = string.Empty;

            if (caller != null)
            {
                fullname = $"{caller?.FirstName} {caller?.LastName} - {caller?.Position}";
            }
            else
            {
                fullname = L10N.Localize("Call_Anonym");
            }

            return(fullname);
        }
Example #30
0
        public static void OnApplicationTick()
        {
            if (ScreenManager.TopScreen is GauntletCharacterDeveloperScreen && Keys.IsKeyPressed(InputKey.LeftControl, InputKey.F) && BannerlordCheatsSettings.Instance.EnableHotkeys)
            {
                var charVM = ScreenManager.TopScreen.GetViewModel <CharacterDeveloperVM>();

                var currentHero = charVM.CurrentCharacter.Hero;

                currentHero.HeroDeveloper.UnspentFocusPoints++;

                charVM.CurrentCharacter.UnspentCharacterPoints++;

                var message = string.Format(L10N.GetText("AddUnspentFocusPointMessage"), currentHero.Name);

                InformationManager.DisplayMessage(new InformationMessage(message, Color.White));
            }
            else if (ScreenManager.TopScreen is GauntletCharacterDeveloperScreen && Keys.IsKeyPressed(InputKey.LeftControl, InputKey.G) && BannerlordCheatsSettings.Instance.EnableHotkeys)
            {
                var charVM = ScreenManager.TopScreen.GetViewModel <CharacterDeveloperVM>();

                var currentHero = charVM.CurrentCharacter.Hero;

                currentHero.HeroDeveloper.UnspentAttributePoints++;

                charVM.CurrentCharacter.UnspentAttributePoints++;

                var message = string.Format(L10N.GetText("AddUnspentAttributePointMessage"), currentHero.Name);

                InformationManager.DisplayMessage(new InformationMessage(message, Color.White));
            }
        }
Example #31
0
		public L10N GetL10n()
		{
            
			if ( L10n == null )
			{

				L10n = Context.Items["L10n"] as L10N;
				if ( L10n == null )
				{
					string sCULTURE  = Sql.ToString(Session["USER_SETTINGS/CULTURE" ]);
					L10n = new L10N(sCULTURE);
				}
			}
			return L10n;
		}
Example #32
0
		public L10N GetL10n()
		{
			// 08/30/2005   Attempt to get the L10n & T10n objects from the parent page. 
			// If that fails, then just create them because they are required. 
			if ( L10n == null )
			{
				// 04/30/2006   Use the Context to store pointers to the localization objects.
				// This is so that we don't need to require that the page inherits from SplendidPage. 
				// A port to DNN prompted this approach. 
				L10n = Context.Items["L10n"] as L10N;
				if ( L10n == null )
				{
					string sCULTURE  = Sql.ToString(Session["USER_SETTINGS/CULTURE" ]);
					L10n = new L10N(sCULTURE);
				}
			}
			return L10n;
		}
Example #33
0
        private void UserLogin(string userName,string password) {

            bool bValidUser = false;

            try
            {

                // 02/20/2011   Skip the login if the user has been locked. 
                // 04/16/2013   Throw an exception so that we can track lockout count failures in the error log. 
                //if (SplendidInit.LoginFailures(Application, userName) >= Crm.Password.LoginLockoutCount(Application))
                //{
                //    L10N L10n = new L10N("en-US");
                //    throw (new Exception(L10n.Term("Users.ERR_USER_LOCKED_OUT")));
                //}
                // 04/16/2013   Allow system to be restricted by IP Address. 
                if (SplendidInit.InvalidIPAddress(Application, Request.UserHostAddress))
                {
                    L10N L10n = new L10N("en-US");
                    throw (new Exception(L10n.Term("Users.ERR_INVALID_IP_ADDRESS")));
                }

                bValidUser = SplendidInit.LoginUser(userName, password, String.Empty, String.Empty, String.Empty, false, false);
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                //trError.Visible = true;
                lblError.Text = ex.Message;
                return;
            }
            // 09/12/2006   Move redirect outside try/catch to avoid catching "Thread was being aborted" exception. 
            if (bValidUser)
            {
                // 02/22/2011   The login redirect is also needed after the change password. 
                LoginRedirect();
                return;
            }
            else
            {
                //trError.Visible = true;
                lblError.Text = "提示:用户名或密码错误。";
            }
        }
Example #34
0
        //protected HiddenField hiddenOpenId;
        //protected HiddenField hiddenAccessToken;
        //protected HiddenField hiddenNickname;

        //public bool IsQQLogin { get; set; }

        protected void Page_Command(Object sender, CommandEventArgs e)
        {
            if (e.CommandName == "Login")
            {
                trForgotError.Visible = false;
                lblForgotError.Text = String.Empty;
                if (Page.IsValid)
                {
                    bool bValidUser = false;
                    try
                    {
                        //windows集成登录(开发环境)
                        if (Security.IsWindowsAuthentication())
                        {
                            bValidUser = true;
                        }
                        else
                        {
                            //检查用户名和密码是否为空
                            if (txtUSER_NAME.Text.Trim().Length == 0 || txtPASSWORD.Text.Trim().Length == 0)
                            {
                                this.lblError.Text = "提示:请输入用户名和密码。";
                                return;
                            }
                            else//看看是否具有角色或者管理员
                            {
                                //是否有效用户
                                //bool IsValidRight = false;

                                //禁止没有角色的用户
                                //SqlProcs.spTaoqi_CheckUserHaveRoleOrAdmin(txtUSER_NAME.Text.Trim(), ref  IsValidRight);
                                /*
                                if (!IsValidRight)
                                {
                                    this.lblError.Text = "提示:您没有访问权限,请联系管理员!";
                                    return;
                                }*/
                            }
                        }


                        // 02/20/2011   Skip the login if the user has been locked. 
                        // 04/16/2013   Throw an exception so that we can track lockout count failures in the error log. 
                        //if (SplendidInit.LoginFailures(Application, txtUSER_NAME.Text) >= Crm.Password.LoginLockoutCount(Application))
                        //{
                        //    L10N L10n = new L10N("en-US");
                        //    throw (new Exception(L10n.Term("Users.ERR_USER_LOCKED_OUT")));
                        //}
                        // 04/16/2013   Allow system to be restricted by IP Address. 
                        if (SplendidInit.InvalidIPAddress(Application, Request.UserHostAddress))
                        {
                            L10N L10n = new L10N("en-US");
                            throw (new Exception(L10n.Term("Users.ERR_INVALID_IP_ADDRESS")));
                        }
                        bValidUser = SplendidInit.LoginUser(txtUSER_NAME.Text, txtPASSWORD.Text, String.Empty, String.Empty, String.Empty, false, false);
                    }
                    catch (Exception ex)
                    {
                        SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                        //trError.Visible = true;
                        lblError.Text = ex.Message;
                        return;
                    }
                    // 09/12/2006   Move redirect outside try/catch to avoid catching "Thread was being aborted" exception. 
                    if (bValidUser)
                    {
                        // 02/22/2011   The login redirect is also needed after the change password. 
                        LoginRedirect();
                        return;
                    }
                    else
                    {
                        //trError.Visible = true;
                        lblError.Text = "提示:用户名或密码错误。";
                    }
                }
            }
            else if (e.CommandName == "ForgotPassword")
            {
                //trError.Visible = false;
                lblError.Text = String.Empty;
                pnlForgotPassword.Style.Remove("display");
                try
                {
                    txtFORGOT_USER_NAME.Text = txtFORGOT_USER_NAME.Text.Trim();
                    txtFORGOT_EMAIL.Text = txtFORGOT_EMAIL.Text.Trim();
                    if (!Security.IsWindowsAuthentication())
                    {
                        DbProviderFactory dbf = DbProviderFactories.GetFactory(Application);
                        using (IDbConnection con = dbf.CreateConnection())
                        {
                            con.Open();
                            string sSQL;
                            sSQL = "select *                            " + ControlChars.CrLf
                                 + "  from vwUSERS                      " + ControlChars.CrLf
                                 + " where lower(USER_NAME) = @USER_NAME" + ControlChars.CrLf
                                 + "   and lower(EMAIL1   ) = @EMAIL1   " + ControlChars.CrLf;
                            using (IDbCommand cmd = con.CreateCommand())
                            {
                                cmd.CommandText = sSQL;
                                Sql.AddParameter(cmd, "@USER_NAME", txtFORGOT_USER_NAME.Text.ToLower());
                                Sql.AddParameter(cmd, "@EMAIL1", txtFORGOT_EMAIL.Text.ToLower());
                                using (IDataReader rdr = cmd.ExecuteReader())
                                {
                                    //string sApplicationPath = Sql.ToString(Application["rootURL"]);
                                    Guid gUSER_LOGIN_ID = Guid.Empty;
                                    if (rdr.Read())
                                    {
                                        MailMessage mail = new MailMessage();
                                        string sFromName = Sql.ToString(Application["CONFIG.fromname"]);
                                        string sFromAddress = Sql.ToString(Application["CONFIG.fromaddress"]);
                                        if (!Sql.IsEmptyString(sFromAddress) && !Sql.IsEmptyString(sFromName))
                                            mail.From = new MailAddress(sFromAddress, sFromName);
                                        else
                                            mail.From = new MailAddress(sFromAddress);
                                        mail.To.Add(new MailAddress(txtFORGOT_EMAIL.Text));
                                        // 10/05/2008   If there are no recipients, then exit early. 
                                        if (mail.To.Count == 0 && mail.CC.Count == 0 && mail.Bcc.Count == 0)
                                            return;

                                        Guid gPASSWORD_ID = Guid.Empty;
                                        SqlProcs.spUSERS_PASSWORD_LINK_InsertOnly(ref gPASSWORD_ID, txtFORGOT_USER_NAME.Text);

                                        string sSiteURL = Crm.Config.SiteURL(Application);
                                        string sResetURL = sSiteURL + "Users/ChangePassword.aspx?ID=" + gPASSWORD_ID.ToString();
                                        string sSubject = L10n.Term("Users.LBL_RESET_PASSWORD_SUBJECT");
                                        if (Sql.IsEmptyString(sSubject))
                                            sSubject = "Reset your password";
                                        string sBodyHtml = L10n.Term("Users.LBL_RESET_PASSWORD_BODY");
                                        if (Sql.IsEmptyString(sBodyHtml))
                                        {
                                            sBodyHtml += "<p>A password reset was requested.</p>\n";
                                            sBodyHtml += "<p>Please click the following link to reset your password:</p>\n";
                                            sBodyHtml += "<p><a href=\"{0}\">{0}</a></p>\n";
                                        }
                                        if (sBodyHtml.IndexOf("{0}") < 0)
                                        {
                                            sBodyHtml += "<p><a href=\"{0}\">{0}</a></p>\n";
                                        }
                                        sBodyHtml = String.Format(sBodyHtml, sResetURL);
                                        mail.Subject = sSubject;
                                        mail.Body = sBodyHtml;
                                        mail.IsBodyHtml = true;
                                        mail.BodyEncoding = System.Text.Encoding.UTF8;

                                        //SmtpClient client = EmailUtils.CreateSmtpClient(Application);
                                        //client.Send(mail);
                                        trForgotError.Visible = true;
                                        lblForgotError.Text = L10n.Term("Users.LBL_RESET_PASSWORD_STATUS");
                                    }
                                    else
                                    {
                                        trForgotError.Visible = true;
                                        lblForgotError.Text = L10n.Term("Users.ERR_INVALID_FORGOT_PASSWORD");
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                    trForgotError.Visible = true;
                    lblForgotError.Text = ex.Message;
                    return;
                }
            }
        }