Exemple #1
0
 private void InitConstant()
 {
     if (DataBindingWindow.varEdLabels == null || DataBindingWindow.varEditors == null)
     {
         DataBindingWindow.varEditors = new List <plyVarEd>();
         plyVariablesEditor.LoadVarEds();
         foreach (plyVarEd value in plyVariablesEditor.editors.Values)
         {
             if (!((plyVarEdAttribute)value.nfo).UsesAdvancedEditor)
             {
                 DataBindingWindow.varEditors.Add(value);
             }
         }
         DataBindingWindow.varEdLabels = new GUIContent[DataBindingWindow.varEditors.Count];
         for (int i = 0; i < DataBindingWindow.varEditors.Count; i++)
         {
             DataBindingWindow.varEdLabels[i] = new GUIContent(((plyVarEdAttribute)DataBindingWindow.varEditors[i].nfo).VarTypeName);
         }
     }
     this.varTypeIdx = -1;
     if (this.databinding.dataContext == DataBinding.DataContext.Constant && this.databinding.constant != null)
     {
         Type type = this.databinding.constant.ValueHandler.GetType();
         for (int j = 0; j < DataBindingWindow.varEditors.Count; j++)
         {
             plyVarEdAttribute plyVarEdAttribute = (plyVarEdAttribute)DataBindingWindow.varEditors[j].nfo;
             if (type == plyVarEdAttribute.TargetType)
             {
                 this.currVarEd  = DataBindingWindow.varEditors[j];
                 this.varTypeIdx = j;
                 break;
             }
         }
     }
     if (this.varTypeIdx == -1)
     {
         this.varTypeIdx                = 0;
         this.currVarEd                 = DataBindingWindow.varEditors[0];
         this.databinding.constant      = plyVar.Create(this.currVarEd.nfo.TargetType);
         this.databinding.constant.name = "constant";
     }
 }
Exemple #2
0
 private void Init(ConstantValueProvider Target)
 {
     if (ConstantValueProviderEd.varEdLabels == null || ConstantValueProviderEd.varEditors == null)
     {
         ConstantValueProviderEd.varEditors = new List <plyVarEd>();
         plyVariablesEditor.LoadVarEds();
         foreach (plyVarEd value in plyVariablesEditor.editors.Values)
         {
             if (!((plyVarEdAttribute)value.nfo).UsesAdvancedEditor)
             {
                 ConstantValueProviderEd.varEditors.Add(value);
             }
         }
         ConstantValueProviderEd.varEdLabels = new GUIContent[ConstantValueProviderEd.varEditors.Count];
         for (int i = 0; i < ConstantValueProviderEd.varEditors.Count; i++)
         {
             ConstantValueProviderEd.varEdLabels[i] = new GUIContent(((plyVarEdAttribute)ConstantValueProviderEd.varEditors[i].nfo).VarTypeName);
         }
     }
     if (this.currVarEd == null)
     {
         this.selectedEdType = Target.constant.ValueHandler.GetType();
         for (int j = 0; j < ConstantValueProviderEd.varEditors.Count; j++)
         {
             plyVarEdAttribute plyVarEdAttribute = (plyVarEdAttribute)ConstantValueProviderEd.varEditors[j].nfo;
             if (this.selectedEdType == plyVarEdAttribute.TargetType)
             {
                 this.currVarEd  = ConstantValueProviderEd.varEditors[j];
                 this.varTypeIdx = j;
                 break;
             }
         }
     }
     if (this.varTypeIdx < 0)
     {
         this.varTypeIdx      = 0;
         this.currVarEd       = ConstantValueProviderEd.varEditors[0];
         Target.constant      = plyVar.Create(this.currVarEd.nfo.TargetType);
         Target.constant.name = "constant";
     }
 }