public void ComponentDeserialize(Component cmp, BinaryNode node)
    {
        SphereCollider sphereCollider = cmp as SphereCollider;

        sphereCollider.center    = UnityBasetypeSerializer.BytesToVector3(GameSerializer.GetBinaryAttribute(node, "center"));
        sphereCollider.radius    = UnityBasetypeSerializer.BytesToFloat(GameSerializer.GetBinaryAttribute(node, "radius"));
        sphereCollider.isTrigger = bool.Parse(GameSerializer.GetAttribute(node, "trigger"));
    }
    public void ComponentDeserialize(Component cmp, BinaryNode node)
    {
        BoxCollider collider = cmp as BoxCollider;

        collider.center    = UnityBasetypeSerializer.BytesToVector3(GameSerializer.GetBinaryAttribute(node, "center"));
        collider.size      = UnityBasetypeSerializer.BytesToVector3(GameSerializer.GetBinaryAttribute(node, "size"));
        collider.isTrigger = bool.Parse(GameSerializer.GetAttribute(node, "trigger"));
    }
    private static void LoadRecursionTwice(GameObject parentGo, BinaryNode domNode, GameObject go)
    {
        if (domNode == domNode.OwnerDocument.Root)
        {
            GameSerializer.LoadComponets(domNode, go);
            int num = -1;
            for (int i = 0; i < domNode.GetChildNum(); i++)
            {
                BinaryNode child = domNode.GetChild(i);
                if (child.GetName() == "CHD")
                {
                    num++;
                    GameObject gameObject = go.transform.GetChild(num).gameObject;
                    if (!(gameObject == null))
                    {
                        GameSerializer.LoadRecursionTwice(null, child, gameObject);
                    }
                }
            }
        }
        else
        {
            BinaryNode parentNode = domNode.ParentNode;
            for (int j = 0; j < parentNode.GetChildNum(); j++)
            {
                BinaryNode child2 = parentNode.GetChild(j);
                if (!(child2.GetName() != "CHD"))
                {
                    string attribute = GameSerializer.GetAttribute(child2, "ON");
                    if (!(attribute != go.name))
                    {
                        GameSerializer.LoadComponets(child2, go);
                        if (child2.GetChildNum() > 0 && go.transform.childCount > 0)
                        {
                            BinaryNode child3 = child2.GetChild(0);
                            for (int k = 0; k < go.transform.childCount; k++)
                            {
                                GameObject gameObject2 = go.transform.GetChild(k).gameObject;
                                GameSerializer.LoadRecursionTwice(null, child3, gameObject2);
                            }
                        }
                        domNode = child2;
                    }
                }
            }
        }
        string nodeAttr = GameSerializer.GetNodeAttr(domNode, "DIS");

        if (nodeAttr != null)
        {
            go.SetActive(false);
        }
        else
        {
            go.SetActive(true);
        }
    }
    public void ComponentDeserialize(Component cmp, BinaryNode node)
    {
        CapsuleCollider capsuleCollider = cmp as CapsuleCollider;

        capsuleCollider.center    = UnityBasetypeSerializer.BytesToVector3(GameSerializer.GetBinaryAttribute(node, "center"));
        capsuleCollider.radius    = UnityBasetypeSerializer.BytesToFloat(GameSerializer.GetBinaryAttribute(node, "radius"));
        capsuleCollider.height    = UnityBasetypeSerializer.BytesToFloat(GameSerializer.GetBinaryAttribute(node, "height"));
        capsuleCollider.direction = UnityBasetypeSerializer.BytesToInt(GameSerializer.GetBinaryAttribute(node, "dir"));
        capsuleCollider.isTrigger = bool.Parse(GameSerializer.GetAttribute(node, "trigger"));
    }
Exemplo n.º 5
0
    public void ComponentDeserialize(Component o, BinaryNode node)
    {
        RectTransform rectTransform = o as RectTransform;

        rectTransform.localScale    = new Vector3(float.Parse(GameSerializer.GetAttribute(node, "SX")), float.Parse(GameSerializer.GetAttribute(node, "SY")), float.Parse(GameSerializer.GetAttribute(node, "SZ")));
        rectTransform.localRotation = new Quaternion(float.Parse(GameSerializer.GetAttribute(node, "RX")), float.Parse(GameSerializer.GetAttribute(node, "RY")), float.Parse(GameSerializer.GetAttribute(node, "RZ")), float.Parse(GameSerializer.GetAttribute(node, "RW")));
        rectTransform.anchorMin     = new Vector2(float.Parse(GameSerializer.GetAttribute(node, "anchorMinX")), float.Parse(GameSerializer.GetAttribute(node, "anchorMinY")));
        rectTransform.anchorMax     = new Vector2(float.Parse(GameSerializer.GetAttribute(node, "anchorMaxX")), float.Parse(GameSerializer.GetAttribute(node, "anchorMaxY")));
        rectTransform.offsetMin     = new Vector2(float.Parse(GameSerializer.GetAttribute(node, "offsetMinX")), float.Parse(GameSerializer.GetAttribute(node, "offsetMinY")));
        rectTransform.offsetMax     = new Vector2(float.Parse(GameSerializer.GetAttribute(node, "offsetMaxX")), float.Parse(GameSerializer.GetAttribute(node, "offsetMaxY")));
    }