private static void LoadComponets(BinaryNode domNode, GameObject go)
 {
     for (int i = 0; i < domNode.GetChildNum(); i++)
     {
         BinaryNode child = domNode.GetChild(i);
         if (!(child.GetName() != "Cop"))
         {
             string    nodeAttr  = GameSerializer.GetNodeAttr(child, "Type");
             Component component = go.GetComponent(nodeAttr);
             if (!(component == null))
             {
                 string nodeAttr2 = GameSerializer.GetNodeAttr(child, "DIS");
                 if (nodeAttr2 != null && component is Behaviour)
                 {
                     Behaviour behaviour = (Behaviour)component;
                     behaviour.enabled = false;
                 }
                 ICustomizedComponentSerializer componentSerlizer = GameSerializer.GetComponentSerlizer(component.GetType());
                 if (componentSerlizer != null)
                 {
                     componentSerlizer.ComponentDeserialize(component, child);
                 }
                 else
                 {
                     MemberInfo[] members = component.GetType().GetMembers();
                     for (int j = 0; j < members.Length; j++)
                     {
                         if (GameSerializer.IsMINeedExport(members[j]))
                         {
                             BinaryNode binaryNode = child.SelectSingleNode(members[j].get_Name());
                             if (binaryNode != null)
                             {
                                 object @object = GameSerializer.GetObject(binaryNode);
                                 try
                                 {
                                     if (@object != null)
                                     {
                                         GameSerializer.SetMIValue(members[j], component, @object);
                                     }
                                 }
                                 catch (Exception var_11_F4)
                                 {
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
 private static void LoadComponets(BinaryNode domNode, GameObject go)
 {
     for (int i = 0; i < domNode.GetChildNum(); i++)
     {
         BinaryNode child = domNode.GetChild(i);
         if (child.GetName() == "Cop")
         {
             string    nodeAttr = GetNodeAttr(child, "Type");
             Component cmp      = go.GetComponent(nodeAttr);
             if (cmp != null)
             {
                 if ((GetNodeAttr(child, "DIS") != null) && (cmp is Behaviour))
                 {
                     Behaviour behaviour = (Behaviour)cmp;
                     behaviour.enabled = false;
                 }
                 ICustomizedComponentSerializer componentSerlizer = GetComponentSerlizer(cmp.GetType());
                 if (componentSerlizer != null)
                 {
                     componentSerlizer.ComponentDeserialize(cmp, child);
                 }
                 else
                 {
                     MemberInfo[] members = cmp.GetType().GetMembers();
                     for (int j = 0; j < members.Length; j++)
                     {
                         if (IsMINeedExport(members[j]))
                         {
                             BinaryNode currNode = child.SelectSingleNode(members[j].Name);
                             if (currNode != null)
                             {
                                 object obj2 = GetObject(currNode);
                                 try
                                 {
                                     if (obj2 != null)
                                     {
                                         SetMIValue(members[j], cmp, obj2);
                                     }
                                 }
                                 catch (Exception)
                                 {
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }