void OnEnable()
        {
            if (!isInitialized)
            {
                //find dropdown controll
                dropdown = GetComponent <Dropdown>();

                //load resources
                groups = Resources.Load(groupsResourcesPath) as BricksGroups;

                //rebuild dropdown controll
                dropdown.ClearOptions();
                if (groups != null)
                {
                    List <Dropdown.OptionData> options = new List <Dropdown.OptionData>();

                    foreach (var group in groups.groups)
                    {
                        var option = new GroupsDropDownOptionData();

                        var translation = LeanLocalization.GetTranslation(group.translationLabel);
                        option.text    = translation != null ? translation.Text : group.translationLabel;
                        option.groupId = group.groupId;

                        options.Add(option);
                    }

                    var sortedOptions = options.OrderBy(x => x.text).ToList();
                    dropdown.AddOptions(sortedOptions);
                }

                isInitialized = true;
            }
        }
Exemple #2
0
        /// <summary>
        /// Load model from file. Before load clear old one.
        /// </summary>
        /// <param name="fileName">File name.</param>
        void Load(string fileName)
        {
            this.fileName = fileName;

            if (fileName.Contains("file:"))
            {
                fileName = fileName.Substring(7);
            }

            fileName = fileName.Replace("%20", " ");

            ClearModel();
            neverSaved = false;

            try
            {
                Deserialize(fileName);
            }
            catch
            {
                ClearModel();
                Dialog.ShowInfo(
                    LeanLocalization.GetTranslation("LoadFailed").Text,
                    DialogButtonType.ok);
            }
        }
Exemple #3
0
        /// <summary>
        /// Gets translation of button text.
        /// </summary>
        /// <returns>The translated buttontext.</returns>
        /// <param name="buttonType">Button type.</param>
        static string GetTranslatedButtonText(DialogButtonType buttonType)
        {
            string translationKey = "";

            if (buttonType == DialogButtonType.no)
            {
                translationKey = "No";
            }
            else if (buttonType == DialogButtonType.yes)
            {
                translationKey = "Yes";
            }
            else if (buttonType == DialogButtonType.ok)
            {
                translationKey = "OK";
            }
            else if (buttonType == DialogButtonType.cancel)
            {
                translationKey = "Cancel";
            }

            var translation = LeanLocalization.GetTranslation(translationKey);

            if (translation == null)
            {
                return(translationKey);
            }

            return(LeanLocalization.GetTranslation(translationKey).Text);
        }
Exemple #4
0
        /// <summary>
        /// Popu[ file choose dialog and next call sutable import method.
        /// </summary>
        public void Import()
        {
            var label     = LeanLocalization.GetTranslation("Export").Text;
            var fileNames = StandaloneFileBrowser.OpenFilePanel(label, "", "stl", false);

            if (fileNames.Length == 0)
            {
                return;
            }

            if (Path.GetExtension(fileNames[0]).ToLower() == ".stl")
            {
                if (fileNames[0].Contains("file:"))
                {
                    fileNames[0] = fileNames[0].Substring(7);
                }
                fileNames[0] = Decode(fileNames[0]);

                try
                {
                    var meshes = STLImporter.Import(fileNames[0]);
                    var brick  = BrickBuilder.Instansiate(meshes);
                }
                catch (Exception e)
                {
                    Debug.Log(e.Message);

                    Dialog.ShowInfo(
                        LeanLocalization.GetTranslation("ImportFailed").Text,
                        DialogButtonType.ok);
                }
            }
        }
Exemple #5
0
    private void ActionBossKeyClickOnInventory()
    {
        string text = "The house key! I can finally leave to join Daddy on his latest adventure.";

        text = LeanLocalization.GetTranslationText("bossKeyClickText");
        uiManager.UpdateDialog(UIManager.DialogSpeaker.BOSS_KEY, text);
    }
Exemple #6
0
 public void ChangeSlider ()
 {
     int DeltaSleep = Mathf.Abs (MatchThree.main.TimeHour - 10);
     if (SliderSleep.value >= DeltaSleep)
         SliderSleep.value = DeltaSleep;
     TexSleep.text = System.String.Format(LeanLocalization.GetTranslationText("Novel/InBedSleep"), SliderSleep.value, (int)(SliderSleep.value * Parametrs.main.AddEnergy));
 }
Exemple #7
0
    private void ActionTeddyBearClickOnInventory()
    {
        if (GameManager.Instance.swapper.CantSwapReason != null)
        {
            //TODO
            uiManager.UpdateDialog(UIManager.DialogSpeaker.TEDDY, GameManager.Instance.swapper.CantSwapReason);
        }
        else
        {
            switchAsked = true;

            if (GameManager.Instance.swapper.World.Equals(World.Real))
            {
                string text = "Maïna, Maïna, let's visit the wonderful imaginary world!";
                text = LeanLocalization.GetTranslationText("teddyBearClickRealText");
                uiManager.UpdateDialog(UIManager.DialogSpeaker.TEDDY, text);
            }
            else
            {
                string text = "If you're sure you want to go back to the boring real world...";
                text = LeanLocalization.GetTranslationText("teddyBearClickImaginaryText");
                uiManager.UpdateDialog(UIManager.DialogSpeaker.TEDDY, text);
            }
        }
    }
Exemple #8
0
    public void ChangeNalog()
    {
        int random = Random.Range(1, 5);

        Debug.Log("random = " + random);
        double Incrise = System.Math.Round(Random.Range(IncriseNalogiInOneMin, IncriseNalogiInOneMax), 2);

        switch (random)
        {
        case 1:
            if (Nalogi > 0.4)
            {
                Nalogi              -= Incrise;
                TexNameNalog.text    = LeanLocalization.GetTranslationText("Parametrs/CNNalogName");
                TexDescriptions.text = LeanLocalization.GetTranslationText("Parametrs/CNNalogDes");
                TexIncrease.text     = System.String.Format(LeanLocalization.GetTranslationText("Parametrs/CNNalogIncr"), (int)(Incrise * 100));
                TexNewNalog.text     = System.String.Format(LeanLocalization.GetTranslationText("Parametrs/CNNalogNewNalog"), (100 - (int)(Nalogi * 100)));
            }
            else
            {
                TexNameNalog.text    = LeanLocalization.GetTranslationText("Parametrs/CNNotName");
                TexDescriptions.text = LeanLocalization.GetTranslationText("Parametrs/CNNotDes");
                TexIncrease.text     = "'_'";
                TexNewNalog.text     = "";
            }
            break;

        case 2:
            NDS += Incrise;
            TexNameNalog.text    = LeanLocalization.GetTranslationText("Parametrs/CNNDSName");
            TexDescriptions.text = LeanLocalization.GetTranslationText("Parametrs/CNNDSDes");
            TexIncrease.text     = System.String.Format(LeanLocalization.GetTranslationText("Parametrs/CNNDSIncr"), (int)(Incrise * 100));
            TexNewNalog.text     = System.String.Format(LeanLocalization.GetTranslationText("Parametrs/CNNDSNewNalog"), ((int)(NDS * 100) - 100));
            break;

        case 3:
            Priceincrease       += Incrise;
            TexNameNalog.text    = LeanLocalization.GetTranslationText("Parametrs/CNPriceName");
            TexDescriptions.text = LeanLocalization.GetTranslationText("Parametrs/CNPriceDes");
            TexIncrease.text     = System.String.Format(LeanLocalization.GetTranslationText("Parametrs/CNPriceIncr"), (int)(Incrise * 100));
            TexNewNalog.text     = System.String.Format(LeanLocalization.GetTranslationText("Parametrs/CNPriceNewNalog"), ((int)(Priceincrease * 100) - 100));
            break;

        case 4:
            Rentincrease        += Incrise;
            TexNameNalog.text    = LeanLocalization.GetTranslationText("Parametrs/CNRentName");
            TexDescriptions.text = LeanLocalization.GetTranslationText("Parametrs/CNRentDes");
            TexIncrease.text     = System.String.Format(LeanLocalization.GetTranslationText("Parametrs/CNRentIncr"), (int)(Incrise * 100));
            TexNewNalog.text     = System.String.Format(LeanLocalization.GetTranslationText("Parametrs/CNRentNewNalog"), ((int)(Rentincrease * 100) - 100));
            break;

        default:
            TexNameNalog.text    = LeanLocalization.GetTranslationText("Parametrs/CNNotName");
            TexDescriptions.text = LeanLocalization.GetTranslationText("Parametrs/CNNotDes");
            TexIncrease.text     = "'_'";
            TexNewNalog.text     = "";
            break;
        }
    }
Exemple #9
0
    protected override bool PerformAction()
    {
        string text = "The sofa is in the way!";

        text = LeanLocalization.GetTranslationText("sofaPerformActionText");
        GameManager.Instance.ui.UpdateDialog(UIManager.DialogSpeaker.MAINA, text);
        return(false);
    }
Exemple #10
0
    private void Start()
    {
        string text = "You're a naughty girl! I told you not to leave the house. To teach you some manners, you're grounded and you'll stay in your room until your majority!";

        text = LeanLocalization.GetTranslationText("motherIntroText");
        GameManager.Instance.ui.UpdateDialog(UIManager.DialogSpeaker.MOTHER, text);
        EventManager.Instance.OnDialogClosed += PlayMainaDialogue;
    }
Exemple #11
0
    protected override bool PerformAction()
    {
        string text = "OUCH!! This light is much too bright to be picked up!";

        text = LeanLocalization.GetTranslationText("lighthouseText");
        GameManager.Instance.ui.UpdateDialog(UIManager.DialogSpeaker.MAINA, text);
        return(true);
    }
Exemple #12
0
 /// <summary>
 /// Ask i shure to clear model and do it.
 /// </summary>
 public void New()
 {
     Dialog.ShowQuesttion(
         LeanLocalization.GetTranslation("UnsavedQuestion").Text,
         DialogButtonType.no,
         DialogButtonType.yes,
         DoNew);
 }
Exemple #13
0
    private void PlayMainaDialogue()
    {
        string text = "Mummy is really too mean. If only Daddy was still here.... I have to escape to find him!";

        text = LeanLocalization.GetTranslationText("mainaMotherIntroText");
        GameManager.Instance.ui.UpdateDialog(UIManager.DialogSpeaker.MAINA, text);
        EventManager.Instance.OnDialogClosed -= PlayMainaDialogue;
    }
Exemple #14
0
    protected override bool PerformAction()
    {
        string text = "Yeah! The key to freedom!";

        text = LeanLocalization.GetTranslationText("motherBedroomPerformActionRealText");
        GameManager.Instance.ui.UpdateDialog(UIManager.DialogSpeaker.MAINA, text);
        EventManager.Instance.ItemPickUp(InventoryManager.BOSS_KEY_GO_NAME);
        return(true);
    }
Exemple #15
0
 private void OnEnable()
 {
     CountProduct.text    = System.String.Format(LeanLocalization.GetTranslationText("Novel/IceBoxCountProduct"), Parametrs.main.numproducts);
     PayProduct.text      = System.String.Format(LeanLocalization.GetTranslationText("Novel/IceBoxPayProduct"), Parametrs.main.NumProductPay);
     CountCoffee.text     = System.String.Format(LeanLocalization.GetTranslationText("Novel/IceBoxCountCoffee"), Parametrs.main.numcoffee);
     PayCoffee.text       = System.String.Format(LeanLocalization.GetTranslationText("Novel/IceBoxPayCoffee"), Parametrs.main.NumProductPay);
     TexPriceProduct.text = System.String.Format(LeanLocalization.GetTranslationText("Novel/IceBoxTexPriceProduct"), (int)(Parametrs.main.PriceProduct * Parametrs.main.Priceincrease * Parametrs.main.NDS));
     TexPriceCoffee.text  = System.String.Format(LeanLocalization.GetTranslationText("Novel/IceBoxTexPriceCoffee"), (int)(Parametrs.main.PriceCoffee * Parametrs.main.Priceincrease * Parametrs.main.NDS));
 }
Exemple #16
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.CompareTag("Player") && GameManager.Instance.swapper.CantSwapReason == null)
     {
         string text = "We can't leave now, we're in the middle of the river!";
         text = LeanLocalization.GetTranslationText("cantSwapReasonText");
         GameManager.Instance.swapper.CantSwapReason = text;
     }
 }
Exemple #17
0
    private void ActionTeddyBearOnAdd()
    {
        string text = "Maïna! I'm so happy to see you. I thought you would leave me in that dreaded toy-box forever.";

        text = LeanLocalization.GetTranslationText("teddyBearAddRealText");
        uiManager.UpdateDialog(UIManager.DialogSpeaker.TEDDY, text);
        int inventoryPosition = InventoryHasObject(TEDDY_BEAR_GO_NAME);

        uiManager.SetInventoryItemAtPosition(inventoryPosition, TEDDY_BEAR_GO_NAME);
    }
Exemple #18
0
        /// <summary>
        /// Popup file choose dialog and call suitable export methothod acording to choosed file type.
        /// </summary>
        public void Export()
        {
            var label       = LeanLocalization.GetTranslation("Export").Text;
            var newFileName = StandaloneFileBrowser.SaveFilePanel(label, "", fileName, "stl");

            if (newFileName != "")
            {
                STLExporter.Export(newFileName, new GameObject[] { gameObject }, FileType.Binary);
            }
        }
Exemple #19
0
        /// <summary>
        /// Build dimencsion properties
        /// </summary>
        /// <param name="brick">Brick.</param>
        public void PrepareProperties(AgaQBrick brick)
        {
            Clear();

            if (brick.dimensionGroup == null)
            {
                return;
            }

            int index = 0;

            foreach (var dimension in brick.dimensionGroup.dimensions)
            {
                GameObject propertyObject;

                if (dimension.paramType == Bricks.DimensionsGroups.DimensionParamType.boolean)
                {
                    propertyObject = Instantiate(DimensionBoolPropertyPrefab);
                }
                else if (dimension.paramType == Bricks.DimensionsGroups.DimensionParamType.floatNumber ||
                         dimension.paramType == Bricks.DimensionsGroups.DimensionParamType.integerNumber)
                {
                    propertyObject = Instantiate(DimensionNumberPropertyPrefab);
                }
                else
                {
                    propertyObject = Instantiate(DimensionStringPropertyPrefab);
                }

                propertyObject.transform.SetParent(transform);
                var propertyScript = propertyObject.GetComponent <InspectorDimensionProperty>();
                propertyScript.ConfigureProperty(brick, index);
                properties.Add(propertyScript);
                index++;
            }

            //load description image
            string imagePath   = brick.dimensionGroup.translationImageResourcePath;
            var    translation = LeanLocalization.GetTranslation(imagePath);

            if (translation != null)
            {
                imagePath = translation.Text;
                if (Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor)
                {
                    imagePath = imagePath.Replace('/', '\\');
                }

                var sprite = Resources.Load <Sprite>(imagePath);
                if (sprite != null)
                {
                    descriptionImage.SetImage(sprite);
                }
            }
        }
Exemple #20
0
    private void Init()
    {
        var gameModeSettings = Mediator.Instance.GameConfig.GameModeSettings.Find(mode => mode.GameModeType == _enumType);

        _energyRequiredField.text = $"-{gameModeSettings.EnergyRequired}";

        string minRateText          = $"{LeanLocalization.GetTranslationText("MinRate")} {gameModeSettings.MinRate}";
        string minRateFormattedText = minRateText.Replace('\n', ' ');

        _minRateField.text = minRateFormattedText;
    }
Exemple #21
0
        /// <summary>
        /// Open file dialog than load choosen model.
        /// </summary>
        public void Load()
        {
            var label     = LeanLocalization.GetTranslation("Open").Text;
            var fileNames = StandaloneFileBrowser.OpenFilePanel(label, "", "aga", false);

            if (fileNames.Length > 0 && fileNames[0] != "")
            {
                Load(fileNames[0]);
                JointsUtils.RebuildJoints();
            }
        }
Exemple #22
0
        /// <summary>
        /// Clear model.
        /// </summary>
        /// <param name="answer">If set to <c>true</c> clear, otherwise not.</param>
        void DoNew(bool answer)
        {
            if (answer)
            {
                //reset model name
                fileName   = LeanLocalization.GetTranslation("Untitled").Text;
                neverSaved = true;

                ClearModel();
            }
        }
Exemple #23
0
    public string LuckFixDevice()
    {
        GameWins++;
        string text;

        switch ((int)((LevelProfile.main.level - 1) / 3f) + 1)
        {
        case 1:
            MatchThree.main.coffeevarka = true;
            text = LeanLocalization.GetTranslationText("Parametrs/WorkCoffe");
            break;

        case 2:
            MatchThree.main.multvarka = true;
            text = LeanLocalization.GetTranslationText("Parametrs/WorkMulti");
            break;

        case 3:
            MatchThree.main.icebox = true;
            text = LeanLocalization.GetTranslationText("Parametrs/WorkIcebox");
            break;

        case 4:
            MatchThree.main.shower = true;
            text = LeanLocalization.GetTranslationText("Parametrs/WorkShow");
            break;

        case 5:
            MatchThree.main.bed = true;
            text = LeanLocalization.GetTranslationText("Parametrs/Workbed");
            break;

        case 6:
            MatchThree.main.computer = true;
            flowchart.SetBooleanVariable("HaveCompDialog", false);
            text = LeanLocalization.GetTranslationText("Parametrs/Workcomp");
            break;

        case 7:
            IncriseMoneyInOne = System.Math.Round(IncriseMoneyInOne, 2);
            text          = System.String.Format(LeanLocalization.GetTranslationText("Parametrs/WorkcompUp"), (int)(IncriseMoneyInOne * 100));
            IncriseMoney += IncriseMoneyInOne;
            break;

        default:
            Debug.LogError("Ошибка увеличения параметра");
            text = "Ошибка увеличения параметра";
            break;
        }

        return(text);
    }
Exemple #24
0
        /// <summary>
        /// Prepare property to display given dimension
        /// </summary>
        /// <param name="brick">Brick.</param>
        /// <param name="index">Property index.</param>
        public virtual void ConfigureProperty(AgaQBrick brick, int index)
        {
            this.brick     = brick;
            groupPropIndex = index;
            values         = brick.dimensionGroup.GetPropertyValues(index);

            //set label
            var    translationKey  = brick.dimensionGroup.dimensions[index].translationLabel;
            var    translation     = LeanLocalization.GetTranslation(translationKey);
            string translatedLabel = translation == null ? translationKey : translation.Text;

            labelText.text = translatedLabel;
        }
 private void OnEnable()
 {
     Days.text         = System.String.Format(LeanLocalization.GetTranslationText("Novel/StatisticDays"), MatchThree.main.LifeDays);
     Wins.text         = System.String.Format(LeanLocalization.GetTranslationText("Novel/StatisticWins"), Parametrs.main.GameWins);
     Money.text        = System.String.Format(LeanLocalization.GetTranslationText("Novel/StatisticMoney"), Parametrs.main.MoneyProfit);
     MoneyMinus.text   = System.String.Format(LeanLocalization.GetTranslationText("Novel/StatisticMoneyMinus"), Parametrs.main.MoneyOutgo);
     MoneyProfit.text  = System.String.Format(LeanLocalization.GetTranslationText("Novel/StatisticMoneyProfit"), (int)(Parametrs.main.AddMoney * Parametrs.main.Nalogi * Parametrs.main.IncriseMoney));
     PayRent.text      = System.String.Format(LeanLocalization.GetTranslationText("Novel/StatisticPayRent"), (int)(Parametrs.main.Rentincrease * Parametrs.main.Rent));
     Nalog.text        = System.String.Format(LeanLocalization.GetTranslationText("Novel/StatisticNalog"), (100 - (int)(Parametrs.main.Nalogi * 100)));
     NDS.text          = System.String.Format(LeanLocalization.GetTranslationText("Novel/StatisticNDS"), ((int)(Parametrs.main.NDS * 100) - 100));
     PriceIncrise.text = System.String.Format(LeanLocalization.GetTranslationText("Novel/StatisticPriceIncrise"), ((int)(Parametrs.main.Priceincrease * 100) - 100));
     RentIncrise.text  = System.String.Format(LeanLocalization.GetTranslationText("Novel/StatisticRentIncrise"), ((int)(Parametrs.main.Rentincrease * 100) - 100));
 }
        protected override void OnInspector()
        {
            TARGET tgt; TARGET[] tgts; GetTargets(out tgt, out tgts);

            LeanLocalization.UpdateTranslations();

            if (Draw("currentLanguage", "The language that is currently being used by this instance.") == true)
            {
                Each(tgts, t => t.CurrentLanguage = serializedObject.FindProperty("currentLanguage").stringValue, true);
            }
            Draw("saveLoad", "This allows you to control if/how this component's <b>CurrentLanguage</b> setting should save/load.\n\nNone = Only the <b>DetectLanguage</b> and <b>DefaultLanguage</b> settings will be used.\n\nWhenChanged = If the <b>CurrentLanguage</b> gets manually changed, automatically save/load it to PlayerPrefs?\n\nNOTE: This save data can be cleared with <b>ClearSave</b> context menu option.");

            Separator();

            Draw("detectLanguage", "How should the cultures be used to detect the user's device language?");
            BeginDisabled(true);
            BeginIndent();
            switch (tgt.DetectLanguage)
            {
            case LeanLocalization.DetectType.SystemLanguage:
                EditorGUILayout.TextField("SystemLanguage", Application.systemLanguage.ToString());
                break;

            case LeanLocalization.DetectType.CurrentCulture:
                EditorGUILayout.TextField("CurrentCulture", System.Globalization.CultureInfo.CurrentCulture.ToString());
                break;

            case LeanLocalization.DetectType.CurrentUICulture:
                EditorGUILayout.TextField("CurrentUICulture", System.Globalization.CultureInfo.CurrentUICulture.ToString());
                break;
            }
            EndIndent();
            EndDisabled();
            Draw("defaultLanguage", "If the application is started and no language has been loaded or auto detected, this language will be used.");

            Separator();

            DrawPrefabs(tgt);

            Separator();

            DrawLanguages();

            Separator();

            DrawTokens();

            Separator();

            DrawTranslations();
        }
Exemple #27
0
 protected override bool PerformAction()
 {
     if (GameManager.Instance.inventory.InventoryObjectOwned(InventoryManager.BOX_SHIP_GO_NAME))
     {
         return(base.PerformAction());
     }
     else
     {
         string text = "I can't go further, I can't swim in the river!";
         text = LeanLocalization.GetTranslationText("bedroomLandingAreaText");
         GameManager.Instance.ui.UpdateDialog(UIManager.DialogSpeaker.MAINA, text);
         return(false);
     }
 }
Exemple #28
0
 private void ActionTorchLightOnAdd()
 {
     if (GameManager.Instance.swapper.World.Equals(World.Real))
     {
         string text = "Let there be light!";
         text = LeanLocalization.GetTranslationText("torchLightAddRealText");
         uiManager.UpdateDialog(UIManager.DialogSpeaker.TORCH_LIGHT, text);
         int inventoryPosition = InventoryHasObject(TORCH_LIGHT_GO_NAME);
         uiManager.SetInventoryItemAtPosition(inventoryPosition, TORCH_LIGHT_GO_NAME);
     }
     else
     {
         Debug.LogError("SHOULD NOT HAPPEN");
     }
 }
Exemple #29
0
 public virtual void Init(int scoreValue, bool isShowedUsername = false)
 {
     if (scoreValue == 1)
     {
         _scoreField.text = $"{scoreValue} {LeanLocalization.GetTranslationText("Score/OnePoint")}";
     }
     else if (scoreValue > 1 && scoreValue < 5)
     {
         _scoreField.text = $"{scoreValue} {LeanLocalization.GetTranslationText("Score/Points")}";
     }
     else
     {
         _scoreField.text = $"{scoreValue} {LeanLocalization.GetTranslationText("Score/MorePoints")}";
     }
 }
Exemple #30
0
        /// <summary>
        /// Popup choose filename dialog and save model.
        /// </summary>
        public void SaveAs()
        {
            if (name == "")
            {
                name = LeanLocalization.GetTranslation("Untitled").Text;
            }

            var label       = LeanLocalization.GetTranslation("SaveAs").Text;
            var newFileName = StandaloneFileBrowser.SaveFilePanel(label, "", fileName, "aga");

            if (fileName != "")
            {
                Save(newFileName);
            }
        }