Beispiel #1
0
    private void OnLoadUpdateZipComplete(object data, string item)
    {
        AssetBundle ab = data as AssetBundle;
        // GameObject obj = ab.LoadAsset(item) as GameObject;
        GameObject go = null;

        Object[] objs = ab.LoadAllAssets();
        foreach (var obj in objs)
        {
            if (obj is GameObject)
            {
                go = (GameObject)Instantiate(obj);
                break;
            }
        }
        go.layer = 11;
        foreach (Transform child in go.transform)
        {
            child.gameObject.layer = 11;
        }
        go.AddComponent <MeshCollider>();
        MsgCenter.Go = go;
        string Name = ((int)EnumToolV2.GetEnumName <ProdKind>(CurtainData.ModuleType)).ToString();

        go.name = Name;
        //清楚当前字典的该组件的信息
        MsgCenter.RemoveValue(Name);

        MsgCenter.AddInfomation(MsgCenter.nowWidow.name, Name, go);
        /*为窗帘赋值*/
        CurtainManager temp = null;

        if (go.GetComponent <CurtainManager>() == null)
        {
            temp = go.AddComponent <CurtainManager>();
            //temp.ModuleType = Name;
        }
        temp.Material = go.GetComponent <MeshRenderer>().material;
        temp.InitCurtain(CurtainData);
        go.GetComponent <MeshRenderer>().material = temp.Material;
        if (temp.TextureURL != "")
        {
            StartCoroutine(loadCurtainPicture(InitServerConfig.Instance.m_servers[0] + temp.TextureURL, go.transform));
        }
        /*         */
        if (item.Contains("UP"))
        {
            go.transform.parent = ParentUp;
        }
        else if (item.Contains("Middle"))
        {
            go.transform.parent = ParentMiddle;
        }
        if (go.name == "8" || go.name == "14" || go.name == "3")
        {
            Material[] Alpha_Material = new Material[1];
            Alpha_Material[0] = new Material(Resources.Load <Shader>("Alpha-Diffuse"));
            go.GetComponent <MeshRenderer>().materials  = Alpha_Material;
            go.GetComponent <CurtainManager>().Material = Alpha_Material[0];
        }
        go.transform.localPosition    = Vector3.zero;
        go.transform.localEulerAngles = Vector3.zero;
        go.transform.localScale       = Vector3.one;
        if (go.GetComponent <ChangeTexture>() == null)
        {
            go.AddComponent <ChangeTexture>();
        }

        if (MsgCenter.Target != ProdKind.Null)
        {
            MsgCenter._changeTexture = go.GetComponent <ChangeTexture>();
        }
        RefreshWinCompoment(go, false);
        ab.Unload(false);
    }