Exemplo n.º 1
0
    private void onLoaded(UnityEngine.Object arg1, object arg2)
    {
        GameObject goClone = arg1 as GameObject;
        PageType   page    = (PageType)arg2;

        goClone.SetActive(true);
        goClone.transform.SetParent(uiParant);
        ControllerDic[page].controller.SetData(goClone);

        if (ControllerDic[page].currentType == 0)
        {
            ControllerDic[page].controller.sleep();
            if (DestroyWhenClose == true && ControllerDic[page].destroyable == true)
            {
                ControllerDic[page].skin.SetActive(false);
            }
            else
            {
                ControllerDic[page].state = SimpleLoadedState.None;
                ResourcesPool.Dispos(ControllerDic[page].skin);
            }
        }
        else
        {
            ControllerDic[page].state = SimpleLoadedState.Success;
        }
    }
    public override void exit()
    {
        if (loader != null)
        {
            if (loader.state == SimpleLoadedState.Loading)
            {
                Debug.LogWarning("Cancel loader " + loader.httpUrl);
                loader.Cancel();
            }
            else
            {
            }
            loader = null;
        }

        if (targetObj == selectEmtyObj)
        {
            selectEmtyObj.gameObject.SetActive(false);
        }
        else
        {
            ResourcesPool.Dispos(targetObj);
        }
        //if (targetObj != selectEmtyObj) GameObject.Destroy(targetObj);
        base.exit();
    }
Exemplo n.º 3
0
    public void ClearView()
    {
        OriginalProjectData projectData = new OriginalProjectData();

        projectData.data = new OriginalInputData();
        SetCurrentData(projectData, false);
        ResourcesPool.ClearPool();
        Resources.UnloadUnusedAssets();
        GC.Collect();
    }
Exemplo n.º 4
0
    private void close(PageType page)
    {
        if (ControllerDic.ContainsKey(page) == false)
        {
            Debug.Log(page + "未注册");
            return;
        }
        ControllerDic[page].currentType = 0;
        switch (ControllerDic[page].state)
        {
        case SimpleLoadedState.None:
            break;

        case SimpleLoadedState.Loading:
            break;

        case SimpleLoadedState.Failed:
            //上次加载失败
            break;

        case SimpleLoadedState.Success:
            ControllerDic[page].controller.sleep();
            if (DestroyWhenClose == true && ControllerDic[page].destroyable == true)
            {
                ControllerDic[page].skin.SetActive(false);
            }
            else
            {
                ControllerDic[page].state = SimpleLoadedState.None;
                ResourcesPool.Dispos(ControllerDic[page].skin);
            }
            break;

        default:
            break;
        }
    }
Exemplo n.º 5
0
    protected override void RefreshGameObjs()
    {
        base.RefreshGameObjs();

        SetGameObjCountEquleList(data.wallList.Count, wallLines, prefabs.GetNewInstance_grey);

        SetGameObjCountEquleList(data.wallList.Count, wallsideLines, prefabs.GetNewInstance_black, 2);

        SetGameObjCountEquleList(data.wallList.Count, wallEndLines, prefabs.GetNewInstance_black, 2);

        SetGameObjCountEquleList(data.pointList.Count, wallPoints, prefabs.GetNewInstance_point);

        SetGameObjCountEquleList(data.wallList.Count, showLenLines, prefabs.GetNewInstance_line, 2);

        SetGameObjCountEquleList(data.wallList.Count, showLenPoints, prefabs.GetNewInstance_fork, 4);

        SetGameObjCountEquleList(data.wallList.Count, showWords, prefabs.GetNewInstance_text, 2);

        SetGameObjCountEquleList(data.roomList.Count, floors, prefabs.GetNewInstance_floor);

        SetGameObjCountEquleList(data.roomList.Count, areas, prefabs.GetNewInstance_area);

        SetGameObjCountEquleList(selectPackedProductdatas.Count, selectPackedproducts, prefabs.GetNewInstance_selectGoods);

        for (int i = 0; i < showLenLines.Count; i++)
        {
            showLenLines[i].gameObject.SetActive(false);
        }
        for (int i = 0; i < showLenPoints.Count; i++)
        {
            showLenPoints[i].gameObject.SetActive(false);
        }
        for (int i = 0; i < showWords.Count; i++)
        {
            showWords[i].gameObject.SetActive(false);
        }



        for (int i = 0; i < data.productDataList.Count; i++)
        {
            int id = data.productDataList[i].id;
            if (products.ContainsKey(id) == false)
            {
                products.Add(id, new List <GameObject>());
            }
        }
        goodsViewList.Clear();
        removeListId.Clear();
        foreach (int id in products.Keys)
        {
            hasIndexList.Clear();
            for (int i = 0; i < data.productDataList.Count; i++)
            {
                ProductData productData = data.productDataList[i];
                if (productData.id == id)
                {
                    hasIndexList.Add(i);
                    if (products.ContainsKey(id) && products[id].Count >= hasIndexList.Count)
                    {
                        GameObject go   = products[id][hasIndexList.Count - 1];
                        Vector3    size = mainPageData.getProduct(productData.seekId).size;
                        GoodsVO    vo   = mainPageData.getGoods(productData.seekId);
                        ResourcesPool.DisposTexture(go);
                        SetTextureTool.SetTexture(go, vo.uri2D, vo.seekId);
                        Product product = mainPageData.getProduct(vo.seekId);
                        float   y       = productData.height;
                        switch (productData.type)
                        {
                        case 2:    //门窗
                        {
                            //if (product.entityType == "window")
                            //{
                            //    y = 1;
                            //}
                        }
                        break;

                        case 3:    //吊顶
                        {
                            if (product == null)
                            {
                                break;
                            }
                            y = defaultSetting.DefaultHeight + productData.height - product.size.y;
                        }
                        break;

                        case 4:    //地毯
                        {
                            y = productData.height + -0.001f;
                        }
                        break;

                        case 5:    //天花板
                        {
                            y = defaultSetting.DefaultHeight + productData.height - 0.001f;
                        }
                        break;

                        case 6:    //吸附各个平面 暂时不做
                        {
                            //world3d.y = defaultSetting.DefaultHeight - 0.01f;
                        }
                        break;

                        default:    //不吸附
                            break;
                        }
                        productData.setData(go, size, y, true);
                        GoodsView goodsView = go.GetComponent <GoodsView>();
                        goodsView.SetData(productData);
                        if (selectObjData == productData)
                        {
                            if (selectGoods == null)
                            {
                                selectGoods = prefabs.GetNewInstance_selectGoods().gameObject;
                            }
                            selectGoods.transform.localRotation = go.transform.localRotation;
                            selectGoods.transform.localScale    = go.transform.localScale;
                            selectGoods.transform.localPosition = go.transform.localPosition - Vector3.forward;
                            selectGoods.SetActive(true);
                            if (productData.hide == true)
                            {
                                selectGoods.SetActive(false);
                            }
                        }
                        for (int k = 0; k < selectPackedProductdatas.Count; k++)
                        {
                            if (selectPackedProductdatas[k] == productData)
                            {
                                GameObject obj = selectPackedproducts[k];
                                //if (obj == null) obj = prefabs.GetNewInstance_selectGoods().gameObject;
                                obj.transform.localRotation = go.transform.localRotation;
                                obj.transform.localScale    = go.transform.localScale;
                                obj.transform.localPosition = go.transform.localPosition - Vector3.forward;
                                obj.SetActive(true);
                                if (productData.hide == true)
                                {
                                    obj.SetActive(false);
                                }
                                break;
                            }
                        }

                        if (productData.hide == true)
                        {
                            go.SetActive(false);
                        }
                        else
                        {
                            go.SetActive(true);
                        }
                        goodsViewList.Add(goodsView);
                    }
                }
            }
            int minCount = hasIndexList.Count < products[id].Count ? hasIndexList.Count : products[id].Count;
            for (int i = minCount; i < products[id].Count; i++)
            {
                GameObject.DestroyImmediate(products[id][i], true);
                products[id].RemoveAt(i);
                i--;
            }
            for (int i = minCount; i < hasIndexList.Count; i++)
            {
                int         index   = hasIndexList[i];
                ProductData product = data.productDataList[index];
                LoadMode(product);
            }
            if (products[id].Count == 0)
            {
                removeListId.Add(id);
            }
        }

        if ((selectObjData == null || selectObjData is ProductData == false) && selectGoods != null)
        {
            selectGoods.SetActive(false);
        }

        for (int i = 0; i < removeListId.Count; i++)
        {
            products.Remove(removeListId[i]);
        }

        if (inputWallLengths.Count == 0)
        {
            for (int i = 0; i < 5; i++)
            {
                GameObject go = prefabs.GetNewInstance_inputWallLength().gameObject;
                go.AddComponent <SetLengthHandleView>();
                go.SetActive(false);
                inputWallLengths.Add(go);
            }
        }
    }