Пример #1
0
        public plyVariables Copy()
        {
            plyVariables plyVariables = new plyVariables();

            this.CopyTo(plyVariables);
            return(plyVariables);
        }
Пример #2
0
 public void CopyTo(plyVariables vars, bool includeValues)
 {
     if (Application.isPlaying)
     {
         Debug.LogError("plyVariables.CopyTo() should not be used at runtime");
     }
     else if (vars.varDefs.Count == 0)
     {
         vars.lastVarIdent = this.lastVarIdent;
         vars.varDefs      = new List <plyVar>();
         for (int i = 0; i < this.varDefs.Count; i++)
         {
             plyVar plyVar = this.varDefs[i].Copy();
             if (!includeValues)
             {
                 plyVar.ClearValue();
             }
             vars.varDefs.Add(plyVar);
         }
     }
     else
     {
         if (vars.lastVarIdent < this.lastVarIdent)
         {
             vars.lastVarIdent = this.lastVarIdent;
         }
         for (int j = 0; j < this.varDefs.Count; j++)
         {
             int num  = this.varDefs[j].ident;
             int num2 = 0;
             while (num2 < vars.varDefs.Count)
             {
                 if (!(this.varDefs[j].name == vars.varDefs[num2].name))
                 {
                     if (num == vars.varDefs[num2].ident)
                     {
                         num = vars.CreateVariableIdent();
                     }
                     num2++;
                     continue;
                 }
                 num = -1;
                 break;
             }
             if (num >= 0)
             {
                 plyVar plyVar2 = this.varDefs[j].Copy();
                 plyVar2.ident = num;
                 if (!includeValues)
                 {
                     plyVar2.ClearValue();
                 }
                 vars.varDefs.Add(plyVar2);
             }
         }
     }
 }
Пример #3
0
        public plyVariables Copy()
        {
            if (Application.isPlaying)
            {
                Debug.LogError("plyVariables.Copy() should not be used at runtime");
                return(null);
            }
            plyVariables plyVariables = new plyVariables();

            this.CopyTo(plyVariables, true);
            return(plyVariables);
        }
Пример #4
0
 public void CopyTo(plyVariables v)
 {
     if (Application.isPlaying)
     {
         Debug.LogError("This can't be done at runtime");
     }
     else
     {
         v.lastVarIdent = this.lastVarIdent;
         v.varDefs      = new List <plyVar>();
         for (int i = 0; i < this.varDefs.Count; i++)
         {
             v.varDefs.Add(this.varDefs[i].Copy());
         }
     }
 }
Пример #5
0
 public void DuplicateTo(plyVariables vars)
 {
     if (Application.isPlaying)
     {
         Debug.LogError("plyVariables.DuplicateTo() should not be used at runtime");
     }
     else if (vars != this)
     {
         plyVariables plyVariables = vars.Copy();
         vars.Clear();
         vars.lastVarIdent = this.lastVarIdent;
         vars.varDefs      = new List <plyVar>();
         for (int i = 0; i < this.varDefs.Count; i++)
         {
             plyVar plyVar = this.varDefs[i].Copy();
             plyVar.ClearValue();
             vars.varDefs.Add(plyVar);
         }
         if (plyVariables.varDefs.Count > 0)
         {
             for (int j = 0; j < vars.varDefs.Count; j++)
             {
                 int num = 0;
                 while (num < plyVariables.varDefs.Count)
                 {
                     if (!(plyVariables.varDefs[num].name == vars.varDefs[j].name))
                     {
                         num++;
                         continue;
                     }
                     if (plyVariables.varDefs[num].ValueHandler.GetType() == vars.varDefs[j].ValueHandler.GetType())
                     {
                         vars.varDefs[j].SetValue(plyVariables.varDefs[num].GetValue());
                     }
                     break;
                 }
             }
         }
         vars._SetDirty();
     }
 }