Exemplo n.º 1
0
    //public IEnumerator StartInitWindow()
    //{
    //    yield return new WaitWhile(() => MsgCenter._instance.xml == "");
    //    List<WindoManager> item = NewReadXml.ReadLoyoutXml(MsgCenter.xml);
    //    Debug.Log(MsgCenter._instance.xml);
    //    LoadQiuTexture(MsgCenter._instance.QiuIcon);
    //    LoadQiuTexture(MsgCenter._instance.QiuURL);
    //    LoadWindow(item);
    //}
    /// <summary>
    /// 加载默认场景的XML
    /// </summary>
    /// <param name="path"></param>
    /// <returns></returns>


    /// <summary>
    /// 动态创建窗户
    /// </summary>
    /// <param name="data"></param>
    void LoadWindow(List <WindoManager> data)
    {
        if (WindowList.Count != 0)
        {
            foreach (GameObject temp in WindowList.Values)
            {
                DestroyImmediate(temp);
            }
            WindowList.Clear();
        }

        IsInit = true;

        Debug.Log(data.Count);
        foreach (WindoManager item in data)
        {
            //根据信息生成window
            //如果是窗户
            MsgCenter.DefaultWindo = item;
            if (item.ModleType == 102)
            {
                GameObject WholeCurtain = (GameObject)Instantiate(Resources.Load("WholeCurtain"));
                WholeCurtain.transform.parent = QIU;
                WholeCurtain.name             = item.GroupID;
                //WholeCurtain.transform.localScale = item.Scale;
                WindowList.Add(item.GroupID, WholeCurtain);
                Debug.Log(item.GroupID + "     wwwwwwwwwwwww");
                WholeCurtain.transform.localEulerAngles = new Vector3(item.Rotation.x, item.Rotation.y, item.Rotation.z);
                WholeCurtain.transform.localPosition    = new Vector3(item.Position.x, item.Position.y, item.Position.z);
                Transform chuanghu = WholeCurtain.transform.FindChild("chaunghu");
                chuanghu.localScale        = item.Scale;
                chuanghu.parent.localScale = item.OfferScale;
                string       path = MsgCenter.WWWURL + item.WindowPictureUrl;
                WindoManager wm   = WholeCurtain.GetComponent <WindoManager>();
                wm.InitWindow(item);
                Parent2D     = wm.TwoD;
                ParentMiddle = wm.Middle;
                ParentUp     = wm.Up;
                StartCoroutine(loadWindowPicture(path, chuanghu));
                foreach (WindoManager item2 in data)
                {
                    if (item.GroupID == item2.GroupID && item2.ModleType == 101)
                    {
                        WholeCurtain.transform.FindChild("guadian").localScale = item2.Scale;

                        //if (item.Sequ == "0" && MsgCenter.isSingleInit)
                        //{
                        //    item2.Prod_ID = MsgCenter.S_RProud;
                        //    MsgCenter.isSingleInit = false;
                        //}

                        //string qingqiu = "corp_id=" + "\"" + MsgCenter._instance.nowHouse.Corp_ID + "\"" + " prod_id=" + "\"" + item2.Prod_ID + "\"";
                        //string temp = MsgCenter._instance.start(MsgCenter._instance.strXML("MM404442", "detail", qingqiu));
                        LoadXML(item2, MsgCenter.ReadAndLoadXml("ProduceXML/" + item2.Prod_ID));
                    }
                }
            }
            //不是窗户(家具)
            else
            {
            }
        }
        //Debug.Log(MsgCenter.DefaultWindo.GroupID+"     "+  WindowList[MsgCenter.DefaultWindo.GroupID].transform.name + "     wwwwwwwwwwwww");
        if (WindowList.ContainsKey(MsgCenter.DefaultWindo.GroupID))
        {
            Camera.main.GetComponent <UseCamareController>().Target1.LookAt(WindowList[MsgCenter.DefaultWindo.GroupID].transform);
        }
    }