/**
     * Set up a new controller
     *
     * @param values
     *      A json friendly dictionary containing the parameters for
     *      this controller
     */
    public override void SetValues(IDictionary values)
    {
        if (!"guid_string".Equals((string)values["guid"]))
        {
            MyGuid = (string)values["guid"];
        }
        this.StartIdent();
        MyName     = new LocalizedItem((string)values["file"], (string)values["name"]);
        lastName   = MyName.label;
        MyType     = (string)values["type"];
        TeamNumber = Convert.ToInt32(values["team"]);
        if (values.Contains("count"))
        {
            if (null == unitCounts)
            {
                unitCounts = new Dictionary <string, int>();
            }
            if (!unitCounts.ContainsKey((string)values["name"] + TeamNumber))
            {
                unitCounts.Add((string)values["name"] + TeamNumber, Convert.ToInt32(values["count"]));
            }
            else if (Convert.ToInt32(values["count"]) > unitCounts[(string)values["name"] + TeamNumber])
            {
                unitCounts[(string)values["name"] + TeamNumber] = Convert.ToInt32(values["count"]);
            }
            count = Convert.ToInt32(values["count"]);
        }

        TeamNumber = Convert.ToInt32(values["team"]);

        //GuidList.AddObject(MyGuid, this.gameObject);
        Visibility  = (VisibilityType)Convert.ToInt32(values ["visibility"]);
        Map         = (string)values["map"];
        IsObjective = Convert.ToBoolean(values ["objective"]);
    }
Exemple #2
0
        // filter untranslated items
        private bool ItemFilter(object obj)
        {
            LocalizedItem item = (LocalizedItem)obj;

            return(ShowErrorOnly ? item.Status == LocalizationStatus.Error
                : FilterHideUntranslated(item) && FilterHideMatchingTranslation(item));
        }
        public RestResponse GetItemByName(string name)
        {
            if (ItemTypes.TryGetType(name, out ItemTypes.ItemType itemType))
            {
                Dictionary <string, LocalizedItem> translations = new Dictionary <string, LocalizedItem>();

                foreach (var localization in Localization.LocaleTexts)
                {
                    LocalizedItem localizedItem = new LocalizedItem();

                    if (Localization.TryGetType(localization.Key, itemType, out string localized))
                    {
                        localizedItem.Name = localized;
                    }

                    if (Localization.TryGetTypeUse(localization.Key, itemType, out string localizeduse))
                    {
                        localizedItem.Description = localizeduse;
                    }

                    translations[localization.Key] = localizedItem;
                }

                return(new RestResponse()
                {
                    Content = translations.ToUTF8SerializedJson()
                });
            }
            else
            {
                return(RestResponse.BlankJsonObject);
            }
        }
Exemple #4
0
 public ComboBoxItem(string caption, Sprite image, bool disabled, Action onSelect, LocalizedItem item)
 {
     _caption    = caption;
     _image      = image;
     _isDisabled = disabled;
     OnSelect    = onSelect;
     _localItem  = item;
 }
Exemple #5
0
 private dbItem GetTranslatedDbItem(LocalizedItem item)
 {
     return(new dbItem
     {
         Id = item.TranslatedEntity.Id,
         Name = item.TranslatedEntity.Name,
         Description = item.TranslatedEntity.Description
     });
 }
Exemple #6
0
    public void RefreshTerrainList()
    {
        Debug("Refreshing interface terrain list.");

        terrainSelect.ClearItems();
        terrainSelect.AddItems(new string[] { "" });

        LocalizedItem[] itemList = new LocalizedItem[Terrain.Names.Length];
        for (int i = 0; i < Terrain.Names.Length; i++)
        {
            itemList[i] = new LocalizedItem("UI_Admin", "Text_Map_" + Terrain.Names[i]);
        }
        terrainSelect.AddItems(itemList);

        UpdateSelection();
    }
Exemple #7
0
    public void Awake()
    {
        Transform HealthLabel = transform.Find("HealthLabel");

        HMInput = HealthLabel.FindChild("HMInput").GetComponent <InputField>();
        NDInput = HealthLabel.FindChild("NDInput").GetComponent <InputField>();
        NWInput = HealthLabel.FindChild("NWInput").GetComponent <InputField>();
        NMInput = HealthLabel.FindChild("NMInput").GetComponent <InputField>();

        HMInput.text = GlobalSettings.GetHealthThresholdForHalfMovement().ToString();
        NDInput.text = GlobalSettings.GetHealthThresholdForNoDetectors().ToString();
        NWInput.text = GlobalSettings.GetHealthThresholdForNoWeapons().ToString();
        NMInput.text = GlobalSettings.GetHealthThresholdForNoMovement().ToString();

        LanguageManager langManager = GameObject.FindObjectOfType <LanguageManager> ();

        localDropdown.OnSelectionChanged += (int index) => {
            if (index == EN)
            {
                langManager.english();
            }
            else if (index == SP)
            {
                langManager.spanish();
            }
            else if (index == FR)
            {
                langManager.french();
            }
            else if (index == IT)
            {
                langManager.italian();
            }
            else if (index == JP)
            {
                langManager.japanese();
            }
        };

        LocalizedItem[] weathers = new LocalizedItem[Weather.GetWeathers().Count];
        foreach (int i in Weather.GetWeathers().Keys)
        {
            weathers[i] = new LocalizedItem("UI_Admin", "Text_WeatherType_" + Weather.GetWeathers()[i].WeatherType);
        }
        weatherDropdown.AddItems(weathers);
    }
    public void FillWeaponDropdown(GameObject unit)
    {
        WepDropdown.ClearItems();
        AttackController uat = unit.GetComponent <AttackController>();

        LocalizedItem[] stringlist = new LocalizedItem[uat.GetWeapons().Count];
        int             listidx    = 0;

        foreach (string key in uat.GetWeapons().Keys)
        {
            int i = key.LastIndexOf("-");
            stringlist[listidx++] = new LocalizedItem(unit.tag.Equals("Marine") ? "Marine_Weapon" : "Weapons", key.Substring(0, i), key.Substring(i));
        }
        WepDropdown.AddItems(stringlist);
        WepDropdown.SelectedIndex = 0;
        if (stringlist.Length > 0)
        {
            FillWeaponFields(stringlist [WepDropdown.SelectedIndex].ToString());
        }
    }
 public string getString(LocalizedItem item)
 {
     return(getString(item.file, item.label) + item.append);
 }
Exemple #10
0
 private bool FilterHideMatchingTranslation(LocalizedItem item)
 {
     return(HideMatchingTranslation == false ||
            item.TranslatedEntity == null ||
            item.Status != LocalizationStatus.Equal);
 }
Exemple #11
0
    public String GetValueForItem(LocalizedItem item)
    {
        String value = String.Empty;

        switch (culture.Name)
        {
        case "pl-PL":
            switch (item)
            {
            case LocalizedItem.ButtonDecompose:
                value = "Podziel";
                break;

            case LocalizedItem.ButtonExit:
                value = "Wyjdź";
                break;

            case LocalizedItem.ButtonClear:
                value = "Wyczyść";
                break;

            case LocalizedItem.ButtonCancel:
                value = "Przerwij";
                break;

            case LocalizedItem.TextDecomposeCompleted:
                value = "Zakończyłem dzielenie %i. stronicowego pliku.";
                break;

            case LocalizedItem.TextCancelling:
                value = "Przerywam dzielenie ...";
                break;

            case LocalizedItem.TextDecomposeCompletedPartial:
                value = "Dzielenie zostało przerwane. Wyniki dostępne częściowo.";
                break;

            case LocalizedItem.TextSearchResultCleared:
                value = "Wyczyściłem wyniki poprzedniego wyszukiwania.";
                break;

            case LocalizedItem.TextSearchStarted:
                value = "Rozpoczynam dekompozycję %i. stronicowego pliku .pdf ...";
                break;

            case LocalizedItem.TextAppName:
                value = "Tiffer .pdfów v. %s";
                break;

            case LocalizedItem.TextFile:
                value = "Plik wejściowy:";
                break;

            case LocalizedItem.TextDestFolder:
                value = "Katalog wynikowy:";
                break;

            case LocalizedItem.TextResults:
                value = "Wyniki szukania:";
                break;

            case LocalizedItem.TextShowFoundOnly:
                value = "pokaż tylko znalezione";
                break;

            case LocalizedItem.TextPdfDocument:
                value = "dokument .pdf";
                break;

            case LocalizedItem.TextPages:
                value = "strony";
                break;

            case LocalizedItem.TextAuthor:
                value = "Autor:";
                break;

            case LocalizedItem.ErrorMissingFolder:
                value = "Błąd. Wskaż katalog do przeszukania.";
                break;

            case LocalizedItem.ErrorNonExistentFolder:
                value = "Błąd. Podany katalog nie istnieje lub nie jest dostępny do odczytu.";
                break;

            case LocalizedItem.ErrorMissingFile:
                value = "Błąd. Podaj plik .pdf do rozłożenia.";
                break;

            default:
                value = String.Empty;
                break;
            }
            break;

        default:
            switch (item)
            {
            case LocalizedItem.ButtonDecompose:
                value = "Decompose";
                break;

            case LocalizedItem.ButtonExit:
                value = "Exit";
                break;

            case LocalizedItem.ButtonClear:
                value = "Clear";
                break;

            case LocalizedItem.ButtonCancel:
                value = "Cancel";
                break;

            case LocalizedItem.TextDecomposeCompleted:
                value = "Decompose of %i page file has been completed.";
                break;

            case LocalizedItem.TextCancelling:
                value = "Cancelling decompose...";
                break;

            case LocalizedItem.TextDecomposeCompletedPartial:
                value = "Decompose has been canceled. Partial results are available.";
                break;

            case LocalizedItem.TextSearchResultCleared:
                value = "Previous search results cleared.";
                break;

            case LocalizedItem.TextSearchStarted:
                value = "I am decomposing %i page .pdf file now ...";
                break;

            case LocalizedItem.TextAppName:
                value = ".pdf tiffer v. %s";
                break;

            case LocalizedItem.TextFile:
                value = "Input file:";
                break;

            case LocalizedItem.TextDestFolder:
                value = "Output folder:";
                break;

            case LocalizedItem.TextResults:
                value = "Search results:";
                break;

            case LocalizedItem.TextShowFoundOnly:
                value = "show found only";
                break;

            case LocalizedItem.TextPdfDocument:
                value = ".pdf document";
                break;

            case LocalizedItem.TextPages:
                value = "pages";
                break;

            case LocalizedItem.TextAuthor:
                value = "Author:";
                break;

            case LocalizedItem.ErrorMissingFolder:
                value = "Error. Please provide a folder to be searched.";
                break;

            case LocalizedItem.ErrorMissingFile:
                value = "Error. Please provide .pdf file to decompose.";
                break;

            case LocalizedItem.ErrorNonExistentFolder:
                value = "Error. The given folder does not exist or is not readable.";
                break;

            default:
                value = String.Empty;
                break;
            }
            break;
        }
        return(value);
    }
 private bool FilterHideMatchingTranslation(LocalizedItem item)
 {
     return HideMatchingTranslation == false
         || item.TranslatedEntity == null
         || item.Status != LocalizationStatus.Equal;
 }
Exemple #13
0
 private bool FilterHideUntranslated(LocalizedItem item)
 {
     return(HideTranslated == false || string.IsNullOrEmpty(item.DatabaseEntity.Name));
 }
 /**
  * Sets the name of the object.
  *
  * @param newName
  *      The new unique name for the unit
  */
 public void SetName(LocalizedItem newName)
 {
     MyName = newName;
 }
 /**
  * Sets additional values in the identidy controller.
  *
  * TODO Figure out why this AND SetValues exist and are different.
  *
  * @param name
  *      The new name of the unit
  * @param type
  *      The new type of the unit
  * @param symbol
  *      The new symbol for the unit
  */
 public void SetIdentity(LocalizedItem name, string type, string symbol)
 {
     this.MyName = name;
     this.MyType = type;
     this.Symbol = symbol;
 }
 private bool FilterHideUntranslated(LocalizedItem item)
 {
     return HideTranslated == false || string.IsNullOrEmpty(item.DatabaseEntity.Name);
 }
Exemple #17
0
    public String GetValueForItem(LocalizedItem item)
    {
        String value = String.Empty;

        switch (culture.Name)
        {
        case "pl-PL":
            switch (item)
            {
            case LocalizedItem.ButtonSearch:
                value = "Szukaj";
                break;

            case LocalizedItem.ButtonExit:
                value = "Wyjdź";
                break;

            case LocalizedItem.ButtonClear:
                value = "Wyczyść";
                break;

            case LocalizedItem.ButtonCancel:
                value = "Przerwij";
                break;

            case LocalizedItem.TextSearchCompleted:
                value = "Zakończyłem przeszukiwanie %i plików.";
                break;

            case LocalizedItem.TextSearchCompletedNoFiles:
                value = "W podanym katalogu nie znalazłem plików .pdf.";
                break;

            case LocalizedItem.TextCancelling:
                value = "Przerywam przeszukiwanie ...";
                break;

            case LocalizedItem.TextSearchCompletedPartial:
                value = "Wyszukiwanie zostało przerwane. Prezentuję częściowe wyniki.";
                break;

            case LocalizedItem.TextSearchResultCleared:
                value = "Wyczyściłem wyniki poprzedniego wyszukiwania.";
                break;

            case LocalizedItem.TextSearchStarted:
                value = "Rozpoczynam przeszukiwanie %i plików .pdf ...";
                break;

            case LocalizedItem.TextAppName:
                value = "Przeszukiwacz .pdfów v. %s";
                break;

            case LocalizedItem.TextFolder:
                value = "Katalog:";
                break;

            case LocalizedItem.TextPhrase:
                value = "Fraza do znalezienia:";
                break;

            case LocalizedItem.TextResults:
                value = "Wyniki szukania:";
                break;

            case LocalizedItem.TextShowFoundOnly:
                value = "pokaż tylko znalezione";
                break;

            case LocalizedItem.TextPdfDocument:
                value = "dokument .pdf";
                break;

            case LocalizedItem.TextPages:
                value = "strony";
                break;

            case LocalizedItem.TextAuthor:
                value = "Autor:";
                break;

            case LocalizedItem.ErrorMissingFolder:
                value = "Błąd. Wskaż katalog do przeszukania.";
                break;

            case LocalizedItem.ErrorNonExistentFolder:
                value = "Błąd. Podany katalog nie istnieje lub nie jest dostępny do odczytu.";
                break;

            case LocalizedItem.ErrorMissingPhrase:
                value = "Błąd. Podaj frazę do znalezienia.";
                break;

            case LocalizedItem.ErrorException:
                value = "Błąd. %s.";
                break;

            default:
                value = String.Empty;
                break;
            }
            break;

        default:
            switch (item)
            {
            case LocalizedItem.ButtonSearch:
                value = "Search";
                break;

            case LocalizedItem.ButtonExit:
                value = "Exit";
                break;

            case LocalizedItem.ButtonClear:
                value = "Clear";
                break;

            case LocalizedItem.ButtonCancel:
                value = "Cancel";
                break;

            case LocalizedItem.TextSearchCompleted:
                value = "Search in %i files has been completed.";
                break;

            case LocalizedItem.TextSearchCompletedNoFiles:
                value = "No .pdf files found in the given folder.";
                break;

            case LocalizedItem.TextCancelling:
                value = "Cancelling search ...";
                break;

            case LocalizedItem.TextSearchCompletedPartial:
                value = "Search has been canceled. Partial results are presented.";
                break;

            case LocalizedItem.TextSearchResultCleared:
                value = "Previous search results cleared.";
                break;

            case LocalizedItem.TextSearchStarted:
                value = "I am searching through %i .pdf files now ...";
                break;

            case LocalizedItem.TextAppName:
                value = ".pdf searcher v. %s";
                break;

            case LocalizedItem.TextFolder:
                value = "Folder:";
                break;

            case LocalizedItem.TextPhrase:
                value = "Phrase to be found:";
                break;

            case LocalizedItem.TextResults:
                value = "Search results:";
                break;

            case LocalizedItem.TextShowFoundOnly:
                value = "show found only";
                break;

            case LocalizedItem.TextPdfDocument:
                value = ".pdf document";
                break;

            case LocalizedItem.TextPages:
                value = "pages";
                break;

            case LocalizedItem.TextAuthor:
                value = "Author:";
                break;

            case LocalizedItem.ErrorMissingFolder:
                value = "Error. Please provide a folder to be searched.";
                break;

            case LocalizedItem.ErrorMissingPhrase:
                value = "Error. Please provide a needle to be found in .pdf haystack.";
                break;

            case LocalizedItem.ErrorNonExistentFolder:
                value = "Error. The given folder does not exist or is not readable.";
                break;

            case LocalizedItem.ErrorException:
                value = "Error. No access to %s.";
                break;

            default:
                value = String.Empty;
                break;
            }
            break;
        }
        return(value);
    }
 private dbItem GetTranslatedDbItem(LocalizedItem item)
 {
     return new dbItem
         {
             Id = item.TranslatedEntity.Id,
             Name = item.TranslatedEntity.Name,
             Description = item.TranslatedEntity.Description
         };
 }