Esempio n. 1
0
 protected void OnEnable()
 {
     translatorBehaviour = GetComponent <TranslatorBehaviour>();
     confirmation        = GetComponent <ConfirmationPopupBehaviour>();
     translateDataUI     = GetComponent <TranslateDataUIElement>();
     Subscribe();
 }
        public void Initialize(TranslateData translateData, ConfirmationPopupBehaviour confirmationPopupBehaviour)
        {
            CleanUp();

            this.translateData = translateData;
            this.confirmation  = confirmationPopupBehaviour;

            // Set up bindings.
            disposables.Add(new InputFieldBinding(projectNameField, () => translateData.Name, delegate(string value)
            {
                value = value.Trim(' ');
                UpdateProjectName(value);
                SetDirty(true);
            }));
            disposables.Add(new InputFieldBinding(projectDescriptionField, () => translateData.Description, delegate(string value) { translateData.Description = value; SetDirty(true); }));
            disposables.Add(new ButtonBinding(projectDescriptionCollapseButton, () => projectDescriptionField.gameObject.SetActive(!projectDescriptionField.gameObject.activeSelf)));
            disposables.Add(new ButtonBinding(addTranslateSheetButton, delegate
            {
                TranslateSheetData sheetData = new TranslateSheetData();
                translateData.TranslateSheets.Add(sheetData);
                AddTranslateSheetUIElement(sheetData);
            }));

            // Set up UI.
            SetDirty(false);
            UpdateProjectName();
            BuildUI();
        }