void Load() { if (_strings != null) { return; } var settings = Resolve <ISettings>(); var filename = Path.Combine(settings.BasePath, "data", "strings.json"); var rawJson = disk.ReadAllText(filename); var json = JsonConvert.DeserializeObject < Dictionary <string, Dictionary <string, string> > > (rawJson); _strings = json.ToDictionary( x => Enum.TryParse(x.Key, true, out Base.UAlbionString id) ? TextId.From(id) : throw new InvalidOperationException( $"When loading UAlbion strings, the key {x.Key} did not match any Base.UAlbionString entry."), x => x.Value.ToDictionary( y => ShortLanguageNames[y.Key], y => y.Value )); }
public void HideText(TextId textId) { SubTexts[(int)textId].Text.StartWritingToBuffer(); SubTexts[(int)textId].Text.FinishWritingToBuffer(); LastTextIDWritten = textId; LastWrittenWasImageInsteadOfText = false; }
public override int GetHashCode() { int hash = 1; if (ScoutId.Length != 0) { hash ^= ScoutId.GetHashCode(); } if (TrainerId != 0L) { hash ^= TrainerId.GetHashCode(); } if (TextId.Length != 0) { hash ^= TextId.GetHashCode(); } if (Priority != 0) { hash ^= Priority.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public static StringId ResolveTextId(TextId id) { var result = AssetMapping.Global.TextIdToStringId(id); return(result.HasValue ? new StringId(result.Value.Item1, result.Value.Item2) : new StringId(id, 0)); }
public static IEvent TransformForCompiler(IEvent e, TextId stringContext) { if (e is ScriptTextEvent text) { return(new MapTextEvent(stringContext, text.TextId, text.Location, text.Speaker)); } return(e); }
public EventSource(AssetId assetId, TextId textSource, TriggerTypes trigger, int x = 0, int y = 0) { // Trigger = TalkTo for NPC, UseItem for item, Action for event set, Default for none AssetId = assetId; TextSource = textSource; Trigger = trigger; X = x; Y = y; }
public SeriesId(string extendedSeriesId) { var parts = extendedSeriesId.Split('^'); TextId = parts[0]; UUID = TextId.MD5Bytes(); KeyType = parts.Length > 1 ? parts[1] : ""; ValueType = parts.Length > 2 ? parts[2] : ""; }
public override int GetHashCode() { unchecked { int hashCode = PrecursorMz.GetHashCode(); hashCode = (hashCode * 397) ^ (TextId != null ? TextId.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (int)Extractor; return(hashCode); } }
private void AtIdSupplement_Shown(object sender, EventArgs e) { TextId.Text = startChar; if (!MyCommon.IsNullOrEmpty(this.StartsWith)) { TextId.Text += this.StartsWith.Substring(0, this.StartsWith.Length); } TextId.SelectionStart = TextId.Text.Length; TextId.Focus(); }
private void AtIdSupplement_Shown(object sender, EventArgs e) /*Handles this.Shown*/ { TextId.Text = startChar; if (!string.IsNullOrEmpty(_StartsWith)) { TextId.Text += _StartsWith.Substring(0, _StartsWith.Length); } TextId.SelectionStart = TextId.Text.Length; TextId.Focus(); }
public void SetText(TextId textId, string Text, string tooltip) { ArcenDoubleCharacterBuffer buffer = SubTexts[(int)textId].Text.StartWritingToBuffer(); buffer.Add(Text); SubTexts[(int)textId].Text.FinishWritingToBuffer(); SubTexts[(int)textId].Tooltip = tooltip; LastTextIDWritten = textId; LastWrittenWasImageInsteadOfText = false; }
public object Serdes(object existing, AssetInfo config, AssetMapping mapping, ISerializer s) { if (s == null) { throw new ArgumentNullException(nameof(s)); } var bytes = s.ByteArray(null, null, (int)s.BytesRemaining); var text = Encoding.UTF8.GetString(bytes); return (JsonConvert.DeserializeObject <IDictionary <Base.UAlbionString, string> >(text) .ToDictionary(x => TextId.From(x.Key), x => x.Value)); }
private void LimparTela() { TextNomeProduto.Clear(); TextGrupoCadastro.Clear(); TextDescricao.Clear(); TextPrecoVenda.Clear(); TextPrecoCusto.Clear(); TextEstoque.Clear(); TextNCM.Clear(); TextLocalizacao.Clear(); TextCodigoB.Clear(); TextId.Clear(); }
public string getTranslation(TextId textId) { string result = "MISSING_TRANLATION!!!"; if (translations.ContainsKey(textId)) { Dictionary <LanguageId, string> langlPack = translations[textId]; if (langlPack.ContainsKey(ControlInfo.getInstance().CurrentLang)) { result = langlPack[ControlInfo.getInstance().CurrentLang]; } } return(result); }
public static DoorEvent Serdes(DoorEvent e, AssetMapping mapping, ISerializer s, TextId textSourceId) { if (s == null) { throw new ArgumentNullException(nameof(s)); } e ??= new DoorEvent(textSourceId); e.PickDifficulty = s.UInt8(nameof(PickDifficulty), e.PickDifficulty); e.Key = ItemId.SerdesU16(nameof(Key), e.Key, AssetType.Item, mapping, s); e.OpenedText = s.UInt8(nameof(OpenedText), e.OpenedText); e.UnlockedText = s.UInt8(nameof(UnlockedText), e.UnlockedText); e.DoorId = DoorId.SerdesU16(nameof(DoorId), e.DoorId, mapping, s); // Usually 100+ return(e); }
protected override void Subscribed() { var languageButtons = new List <IUiElement>(); void SetLanguage(string language) => Raise(new SetLanguageEvent(language)); var languages = new List <(string, string)>(); var modApplier = Resolve <IModApplier>(); foreach (var kvp in modApplier.Languages.OrderBy(x => x.Value.ShortName)) { if (HasLanguageFiles(kvp.Key)) { languages.Add((kvp.Key, kvp.Value.ShortName)); } } foreach (var(language, shortName) in languages) { languageButtons.Add(new Button(shortName).OnClick(() => SetLanguage(language))); } var elements = new List <IUiElement> { new Spacing(156, 2), new Label(TextId.From(Base.UAlbionString.LanguageLabel)), new HorizontalStack(languageButtons), new Spacing(0, 2), new Label((TextId)Base.SystemText.Options_MusicVolume), new Slider(() => _musicVolume, x => _musicVolume = x, 0, 127), new Spacing(0, 2), new Label((TextId)Base.SystemText.Options_FXVolume), new Slider(() => _fxVolume, x => _fxVolume = x, 0, 127), new Spacing(0, 2), new Label((TextId)Base.SystemText.Options_CombatTextDelay), new Slider(() => _combatDelay, x => _combatDelay = x, 1, 50), new Spacing(0, 2), new Button(Base.SystemText.MsgBox_OK).OnClick(SaveAndClose), new Spacing(0, 2), }; var stack = new VerticalStack(elements); AttachChild(new DialogFrame(stack)); var settings = Resolve <ISettings>(); _musicVolume = settings.Audio.MusicVolume; _fxVolume = settings.Audio.FxVolume; _combatDelay = settings.Gameplay.CombatDelay; }
public override void HandleSubTextMouseover(SubText SubText) { int index = this.SubTexts.IndexOf(SubText); if (index < 0) { return; } TextId id = (TextId)index; string idAsString = id.ToString(); string tooltip = SubText.Tooltip; switch (id) { case TextId.FuelOrPower: GameEntityTypeData typeData = this.TypeToBuild; if (typeData == null) { return; } else if (typeData.BalanceStats.SquadFuelConsumption > 0) { idAsString = "Fuel"; } else if (typeData.BalanceStats.SquadPowerConsumption > 0) { idAsString = "Power"; } else { return; } break; case TextId.Attack: case TextId.Defense: tooltip = tooltip.Replace("{0}", ExternalConstants.Instance.Balance_DamageMultiplierWhenCounteringDefense.ReadableString); break; } string key = "EntityTooltipPanel_" + idAsString; if (!Language.Current.Contains(key)) { return; } Window_AtMouseTooltipPanel.bPanel.Instance.SetText(Language.Current.GetValue(key) + tooltip); }
internal static string GetLocalizedText(TextId textId, params object[] args) { string result = null; if ((int)textId > 49000 && (int)textId < 50000)//filter out the mediaportal strings. { string isoCode = GUILocalizeStrings.GetCultureName(GUILocalizeStrings.CurrentLanguage()); result = Translator.GetLocalizedText(isoCode, textId); } if (result == null) { result = GUILocalizeStrings.Get((int)textId, args); } return result == null ? String.Empty : result; }
internal static string GetLocalizedText(TextId textId, params object[] args) { string result = null; if ((int)textId > 49000 && (int)textId < 50000)//filter out the mediaportal strings. { string isoCode = GUILocalizeStrings.GetCultureName(GUILocalizeStrings.CurrentLanguage()); result = Translator.GetLocalizedText(isoCode, textId); } if (result == null) { result = GUILocalizeStrings.Get((int)textId, args); } return(result == null ? String.Empty : result); }
public void SetText(TextId textId, int NumericValue, string tooltip) { string suffix = ArcenExternalUIUtilities.GetRoundedNumberWithSuffix(ref NumericValue, false); ArcenDoubleCharacterBuffer buffer = SubTexts[(int)textId].Text.StartWritingToBuffer(); buffer.Add(NumericValue); if (suffix.Length > 0) { buffer.Add(suffix); } SubTexts[(int)textId].Text.FinishWritingToBuffer(); SubTexts[(int)textId].Tooltip = tooltip; LastTextIDWritten = textId; LastWrittenWasImageInsteadOfText = false; }
IEnumerable <TextBlock> BuildHoverText(TextId id, Func <ICharacterSheet, int> getValue, Func <ICharacterSheet, int> getMax) { var party = Resolve <IParty>(); var tf = Resolve <ITextFormatter>(); var member = party[_activeCharacter]?.Apparent; if (member == null) { yield break; } var block = tf.Format(id).GetBlocks().First(); block.Text += $" {getValue(member)} / {getMax(member)}"; yield return(block); }
public override int GetHashCode() { int hash = 1; if (ScoutEpId.Length != 0) { hash ^= ScoutEpId.GetHashCode(); } if (ScoutId.Length != 0) { hash ^= ScoutId.GetHashCode(); } if (U3 != 0) { hash ^= U3.GetHashCode(); } if (TextId.Length != 0) { hash ^= TextId.GetHashCode(); } if (GemType != 0) { hash ^= GemType.GetHashCode(); } if (Cost != 0) { hash ^= Cost.GetHashCode(); } if (ScoutQuantity != 0) { hash ^= ScoutQuantity.GetHashCode(); } if (U8 != 0) { hash ^= U8.GetHashCode(); } if (ItemSetId != 0L) { hash ^= ItemSetId.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
protected override void Subscribed() { var languageButtons = new List <IUiElement>(); void SetLanguage(GameLanguage language) => Raise(new SetLanguageEvent(language)); void AddLang(string label, GameLanguage language) { if (HasLanguageFiles(language)) { languageButtons.Add(new Button(label).OnClick(() => SetLanguage(language))); } } AddLang("EN", GameLanguage.English); AddLang("DE", GameLanguage.German); AddLang("FR", GameLanguage.French); var elements = new List <IUiElement> { new Spacing(156, 2), new Label(TextId.From(Base.UAlbionString.LanguageLabel)), new HorizontalStack(languageButtons), new Spacing(0, 2), new Label((TextId)Base.SystemText.Options_MusicVolume), new Slider(() => _musicVolume, x => _musicVolume = x, 0, 127), new Spacing(0, 2), new Label((TextId)Base.SystemText.Options_FXVolume), new Slider(() => _fxVolume, x => _fxVolume = x, 0, 127), new Spacing(0, 2), new Label((TextId)Base.SystemText.Options_CombatTextDelay), new Slider(() => _combatDelay, x => _combatDelay = x, 1, 50), new Spacing(0, 2), new Button(Base.SystemText.MsgBox_OK).OnClick(SaveAndClose), new Spacing(0, 2), }; var stack = new VerticalStack(elements); AttachChild(new DialogFrame(stack)); var settings = Resolve <ISettings>(); _musicVolume = settings.Audio.MusicVolume; _fxVolume = settings.Audio.FxVolume; _combatDelay = settings.Gameplay.CombatDelay; }
public string GetText(TextId id) { foreach (var entry in _entries) { if (id == entry.ID) { foreach (var t in entry.AllTexts) { if (t.LanguagueIndex == _currentLanguageId) { return(t.Text); } } } } return(String.Empty); }
public override int GetHashCode() { int hash = 1; if (ItemId != 0L) { hash ^= ItemId.GetHashCode(); } if (TextId != 0) { hash ^= TextId.GetHashCode(); } if (ImageId.Length != 0) { hash ^= ImageId.GetHashCode(); } if (Rarity != 0) { hash ^= Rarity.GetHashCode(); } if (U5 != 0) { hash ^= U5.GetHashCode(); } if (U6 != 0) { hash ^= U6.GetHashCode(); } if (EggLotGroupId != 0) { hash ^= EggLotGroupId.GetHashCode(); } if (Time != 0) { hash ^= Time.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hash = 1; if (BoxSearchId != 0) { hash ^= BoxSearchId.GetHashCode(); } if (ScheduleId.Length != 0) { hash ^= ScheduleId.GetHashCode(); } if (ItemId != 0L) { hash ^= ItemId.GetHashCode(); } if (BannerId != 0) { hash ^= BannerId.GetHashCode(); } if (U5.Length != 0) { hash ^= U5.GetHashCode(); } if (TextId.Length != 0) { hash ^= TextId.GetHashCode(); } if (U7 != 0) { hash ^= U7.GetHashCode(); } if (U8 != 0) { hash ^= U8.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public static string GetLocalizedText(string isoCode, TextId textId) { try { if (IsValidIsoCode(isoCode)) { if (!isoCode.Equals(_currentIsoCode) || FileContentHasChanged()) { LoadTranslations(isoCode); } if (_translatons.ContainsKey((int)textId)) { return _translatons[(int)textId]; } else { if (_currentIsoCode != _fallBackIsoCode) { Log.Error("ARGUS Translator: No translation found for id {0}, fallback to english !!", (int)textId); if (!_shortIsoFallBackFileLoaded && IsValidShortIsoCode(_fallBackIsoCode)) { Log.Info("ARGUS Translator: Load the english fallback file"); string tmpIsoCode = GetShortIsoCode(_fallBackIsoCode); _shortIsoFallBackFileLoaded = LoadFile(GetIsoFileName(tmpIsoCode), out _shortIsoFileTimeStamp, false, true); } if (_translatonsFallBack.ContainsKey((int)textId)) { return _translatonsFallBack[(int)textId]; } } Log.Error("ARGUS Translator: No english translation found for id {0} !!", (int)textId); } } } catch { } return null; }
void FillData() { //авторизация EventWaitHandle handler = new EventWaitHandle(false, EventResetMode.AutoReset); api.Authorize(handler); handler.WaitOne(); //данные о залогинившемся //TextKey.Invoke(new Action<string>(TextKey.AppendText), api.Get_access_code()); //textAccess_token.Invoke(new Action<string>(textAccess_token.AppendText), api.Get_access_token()); json_clases.USER res = api.GetUserInfo(api.Get_user_id(), 100)[0]; TextId.Invoke(new Action <string>(TextId.AppendText), res.id.ToString()); TextFirst_name.Invoke(new Action <string>(TextFirst_name.AppendText), res.first_name); TextLast_name.Invoke(new Action <string>(TextLast_name.AppendText), res.last_name); Avatar.Image = LoadImage(res.photo_100); //загрузка диалогов int dialogcount = 25; dialogsProgress.Maximum = dialogcount; dialogsProgress.Visible = true; Dictionary <int, MESSAGE> dialogs = api.LoadDialogs(20); DataGridViewRow [] rows = new DataGridViewRow[dialogcount]; DataTable dt = dialogs_data.Tables[0]; MESSAGE part; dialog_list.Visible = false; for (int i = 0; i < dialogs.Count; i++) { part = dialogs.ElementAt(i).Value; dt.Rows.Add(imageToByteArray( LoadImage(part.avatar_uri)), part.name, part.text, part.user_id); dialogsProgress.PerformStep(); } dialog_list.Visible = true; }
public static string GetLocalizedText(string isoCode, TextId textId) { try { if (IsValidIsoCode(isoCode)) { if (!isoCode.Equals(_currentIsoCode) || FileContentHasChanged()) { LoadTranslations(isoCode); } if (_translatons.ContainsKey((int)textId)) { return(_translatons[(int)textId]); } else { if (_currentIsoCode != _fallBackIsoCode) { Log.Error("ARGUS Translator: No translation found for id {0}, fallback to english !!", (int)textId); if (!_shortIsoFallBackFileLoaded && IsValidShortIsoCode(_fallBackIsoCode)) { Log.Info("ARGUS Translator: Load the english fallback file"); string tmpIsoCode = GetShortIsoCode(_fallBackIsoCode); _shortIsoFallBackFileLoaded = LoadFile(GetIsoFileName(tmpIsoCode), out _shortIsoFileTimeStamp, false, true); } if (_translatonsFallBack.ContainsKey((int)textId)) { return(_translatonsFallBack[(int)textId]); } } Log.Error("ARGUS Translator: No english translation found for id {0} !!", (int)textId); } } } catch { } return(null); }
public static EventLayout Compile(string script, TextId stringContext, List <(string, IGraph)> steps = null)
DoorEvent(TextId textSourceId) => TextSource = textSourceId;
public InventoryChestPane(ChestId id) { On <InventoryChangedEvent>(e => { if (e.Id != new InventoryId(_id)) { return; } UpdateBackground(); }); _id = id; _background = new UiSpriteElement(Base.Picture.OpenChestWithGold); var backgroundStack = new FixedPositionStack(); backgroundStack.Add(_background, 0, 0); AttachChild(backgroundStack); var slotSpans = new IUiElement[InventoryHeight]; for (int j = 0; j < InventoryHeight; j++) { var slotsInRow = new IUiElement[InventoryWidth]; for (int i = 0; i < InventoryWidth; i++) { int index = j * InventoryWidth + i; slotsInRow[i] = new LogicalInventorySlot(new InventorySlotId(_id, (ItemSlotId)((int)ItemSlotId.Slot0 + index))); } slotSpans[j] = new HorizontalStack(slotsInRow); } var slotStack = new VerticalStack(slotSpans); var slotHalfFrame = new ButtonFrame(slotStack) { Theme = ButtonTheme.InventoryOuterFrame, Padding = -1 }; var goldButton = new LogicalInventorySlot(new InventorySlotId(_id, ItemSlotId.Gold)); var foodButton = new LogicalInventorySlot(new InventorySlotId(_id, ItemSlotId.Rations)); var takeAllButton = new Button( (UiElement) new UiTextBuilder(TextId.From(Base.UAlbionString.TakeAll)).Center() ).OnClick(() => Raise(new InventoryTakeAllEvent(_id))); var header = new Header(Base.SystemText.Chest_Chest); var moneyAndFoodStack = new HorizontalStack(goldButton, takeAllButton, foodButton); var stack = new VerticalStack( header, slotHalfFrame, new Spacing(0, 78), moneyAndFoodStack ) { Greedy = false }; AttachChild(stack); }
private void ShowRecordingNotifyDialog(SchedulerServiceAgent tvSchedulerAgent, Channel currentChannel, string text, TextId headingTextId) { if (!_enableRecNotification) { GUIDialogNotify dlgNotify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY); if (dlgNotify != null) { string logo = Utility.GetLogoImage(currentChannel, tvSchedulerAgent); dlgNotify.Reset(); dlgNotify.ClearAll(); dlgNotify.SetImage(logo); dlgNotify.SetHeading(Utility.GetLocalizedText(headingTextId)); dlgNotify.SetText(text); dlgNotify.TimeOut = 5; _notifyDialogVisible = true; dlgNotify.DoModal(GUIWindowManager.ActiveWindow); _notifyDialogVisible = false; } } }
/// <summary> /// 文字列を設定する /// </summary> /// <param name="id">文字列ID</param> /// <param name="text">登録する文字列</param> /// <param name="fileName">文字列定義ファイル名</param> public static void SetText(TextId id, string text, string fileName) { string key = KeyStrings[(int) id]; SetText(key, text, fileName); }
/// <summary> /// 文字列を取得する /// </summary> /// <param name="id">文字列ID</param> /// <returns>取得した文字列</returns> public static string GetText(TextId id) { string key = KeyStrings[(int) id]; return GetText(key); }