예제 #1
0
        public IdentifierControlView(string label, AbstractMaterialNode node, PropertyInfo propertyInfo)
        {
            var style = Resources.Load <StyleSheet>("Styles/Controls/IdentifierControlView");

            if (style)
            {
                styleSheets.Add(style);
            }

            m_Node         = node;
            m_PropertyInfo = propertyInfo;
            if (propertyInfo.PropertyType != typeof(string))
            {
                throw new ArgumentException("Property must be of type string.", "propertyInfo");
            }

            label = label ?? ObjectNames.NicifyVariableName(propertyInfo.Name);
            if (!string.IsNullOrEmpty(label))
            {
                Add(new Label(label));
            }

            var strField = new IdentifierField()
            {
                value = (string)m_PropertyInfo.GetValue(m_Node, null)
            };

            strField.RegisterValueChangedCallback(OnChange);
            Add(strField);
        }
예제 #2
0
 private void MoveToDefaultTranslation(IdentifierField fields)
 {
     if (View.isTranslationInitialized)
     {
         View.UpdateTranslationView(fields);
         View.GotoStep(ProviderWizardStep.DefaultTranslation);
     }
     else
     {
         Language language = CurrentManager.GetDefaultLanguage();
         if (language != null)
         {
             View.InitializeTranslation(0, language.Id, fields);
             View.GotoStep(ProviderWizardStep.DefaultTranslation);
         }
     }
 }