ME3Explorer.UnrealHelper.UPropertyReader.FindObjectProperty C# (CSharp) Method

FindObjectProperty() public method

public FindObjectProperty ( string s, List p ) : int
s string
p List
return int
        public int FindObjectProperty(string s, List<Property> p)
        {
            int ret = -1;
            for (int i = 0; i < p.Count; i++)
                if (p[i].name == s)
                    ret = i;
            if (ret != -1)
                ret = PropToInt(p[ret].raw) - 1;
            return ret;
        }

Usage Example

示例#1
0
 public void LoadStaticMeshActors()
 {
     for (int i = 0; i < UStatActors.Count; i++)
     {
         int entry = UPR.FindObjectProperty("StaticMeshComponent", UStatActors[i].props);
         if (entry >= 0 && entry < pcc.Header.ExportCount)
         {
             UStaticMeshComponent t = new UStaticMeshComponent(pcc.EntryToBuff(entry), pcc.names);
             t.UPR = UPR;
             t.Deserialize();
             LevelProperties LP = UStatActors[i].LP;
             GlobalTransform g  = new GlobalTransform();
             if (i == 21)
             {
             }
             entry = UPR.FindProperty("location", UStatActors[i].props);
             if (entry != -1)
             {
                 g.loc = PropToVector3(UStatActors[i].props[entry + 1].raw);
             }
             entry = UPR.FindProperty("Rotator", UStatActors[i].props);
             if (entry != -1)
             {
                 g.rot = PropToCYPRVector3(UStatActors[i].props[entry].raw);
             }
             entry = UPR.FindProperty("DrawScale3D", UStatActors[i].props);
             if (entry != -1)
             {
                 g.scl = PropToVector3(UStatActors[i].props[entry + 1].raw);
             }
             else
             {
                 g.scl = new Vector3(1, 1, 1);
             }
             entry = UPR.FindProperty("DrawScale", UStatActors[i].props);
             if (entry != -1)
             {
                 g.scl2 = BitConverter.ToSingle(UStatActors[i].props[entry + 1].raw, UStatActors[i].props[entry + 1].raw.Length - 4);
             }
             else
             {
                 g.scl2 = 1;
             }
             LP.GT   = g;
             t.LP    = LP;
             t.index = entry;
             UStatComp.Add(t);
         }
     }
 }