示例#1
0
        private void LoadXml()
        {
            var nameUs = LocaleEditor.GetObjectName(Object.Lot);
            var nameGb = LocaleEditor.GetObjectName(Object.Lot, Locale.GreatBritain);
            var nameDe = LocaleEditor.GetObjectName(Object.Lot, Locale.Germany);

            NameUs.text = nameUs ?? "";
            NameGb.text = nameGb ?? "";
            NameDe.text = nameDe ?? "";

            NameUs.onEndEdit.RemoveAllListeners();
            NameGb.onEndEdit.RemoveAllListeners();
            NameDe.onEndEdit.RemoveAllListeners();

            NameUs.onEndEdit.AddListener(s =>
            {
                LocaleEditor.SetObjectName(Object.Lot, s);

                var row                = ObjectTable.Rows.First(o => (int)o.Fields[0].Value == Object.Lot);
                row.Fields[1].Value    = s;
                row.Fields[1].DataType = DataType.Text;
            });

            NameGb.onEndEdit.AddListener(s => { LocaleEditor.SetObjectName(Object.Lot, s, Locale.GreatBritain); });
            NameDe.onEndEdit.AddListener(s => { LocaleEditor.SetObjectName(Object.Lot, s, Locale.Germany); });
        }
示例#2
0
        public void LoadMission(int missionId)
        {
            ApplicationTitle.text = $"Mission Editor - {missionId}";

            MissionId = missionId;

            var texts = (MissionTextType[])Enum.GetValues(typeof(MissionTextType));

            for (var index = 0; index < _localeEntries.Length; index++)
            {
                var localeEntry = _localeEntries[index];
                var textType    = texts[index];

                var value = LocaleEditor.GetMissionText(missionId, textType);

                localeEntry.text         = value;
                localeEntry.interactable = true;

                foreach (var text in localeEntry.GetComponentsInChildren <TextMeshProUGUI>())
                {
                    switch (text.name)
                    {
                    case "Name":
                        text.text = value;
                        break;

                    case "Id":
                        text.text = textType.ToString();
                        break;
                    }
                }

                localeEntry.onEndEdit.RemoveAllListeners();

                localeEntry.onEndEdit.AddListener(s =>
                {
                    LocaleEditor.SetMissionText(missionId, textType, s);
                    LocaleEditor.SetMissionText(missionId, textType, s, Locale.Germany);
                    LocaleEditor.SetMissionText(missionId, textType, s, Locale.GreatBritain);
                });
            }

            RaycastCover.SetActive(false);
            ObjectInput.SetActive(false);
        }