Ejemplo n.º 1
0
 private void InitRow(int index, GoodsVO vo)
 {
     dtgvSpGoods.Rows[index].Cells[colGID.Name].Value       = vo.GID__PK;
     dtgvSpGoods.Rows[index].Cells[colGName.Name].Value     = vo.GName;
     dtgvSpGoods.Rows[index].Cells[colShelfLife.Name].Value = vo.ShelfLife;
     dtgvSpGoods.Rows[index].Cells[colSpecs.Name].Value     = vo.Specs;
     dtgvSpGoods.Rows[index].Cells[colCatg.Name].Value      = vo.CatgName;
     dtgvSpGoods.Rows[index].Cells[colRemark.Name].Value    = vo.Remark;
 }
Ejemplo n.º 2
0
    public bool AddProduct(Product product)
    {
        if (productDic.ContainsKey(product.seekId) == true)
        {
            productDic.Remove(product.seekId);
        }
        productDic.Add(product.seekId, product);
        GoodsVO vo = new GoodsVO(GoodsDic.Count, product.modelTexture, product.top, product.assetBundlePath, product.attachType, 1, 0, product.seekId);

        if (GoodsDic.ContainsKey(vo.seekId) == true)
        {
            GoodsDic.Remove(vo.seekId);
        }
        GoodsDic.Add(vo.seekId, vo);
        return(true);
    }
Ejemplo n.º 3
0
    public override void enter()
    {
        base.enter();
        //machine.selectGoods
        targetVO      = mainpagedata.getGoods(machine.selectGoods[0].seekId);
        targetProduct = mainpagedata.getProduct(targetVO.seekId);
        Vector3 size = targetProduct.size;

        targetSize = Vector2.right * size.x + Vector2.up * size.z;
        targetObj  = prefabs.GetNewQuad();
        targetObj.transform.localScale = targetSize;
        targetObj.layer = LayerMask.NameToLayer("UI");
        View2D.Instance.AddProductGameObj(targetVO.id, targetObj);

        if (targetProduct.contentType.StartsWith("door/") == true)
        {
            string type = targetProduct.contentType.Replace("door/", "");
            switch (type)
            {
            case "":
                break;

            default:
                break;
            }
            return;
        }
        if (targetProduct.contentType.StartsWith("window/") == true)
        {
            string type = targetProduct.contentType.Replace("window/", "");
            switch (type)
            {
            case "":
                break;

            default:
                break;
            }
            return;
        }
        LoadTexture();
    }
    private void onloaded(object obj)
    {
        SimpleOutterLoader loader = obj as SimpleOutterLoader;

        if (loader.state == SimpleLoadedState.Failed)
        {
            return;
        }
        Debug.LogWarning("onloaded " + loader.httpUrl);

        GoodsVO vo = loader.bringData as GoodsVO;

        targetObj = loader.loadedData as GameObject;
        if (targetObj == null)
        {
            Debug.LogWarning(loader.uri);
            return;
        }
        selectEmtyObj.gameObject.SetActive(false);
        //targetObj.AddComponent<Goods3DView>();
        targetSize = targetProduct.size;
        //targetProduct = (targetVO.seekId);
        //targetObj.transform.rotation = Quaternion.Euler(Vector3.zero);
        targetObj.transform.parent     = prefabs.parentTran_3D;
        targetObj.transform.localScale = Vector3.one;
        defaultHeight = targetProduct.defaultHeight;
        targetObj.transform.position = selectEmtyObj.transform.position;
        targetObj.transform.rotation = Quaternion.Euler(Vector3.up * (0 - forTop));
        //foreach (Transform item in targetObj.transform)
        //{
        //    if (item.name == "shadow")
        //    {
        //        item.localPosition = Vector3.up * -0.01f;
        //    }
        //}
        //Debug.LogWarning("view3D.AddProductGameObj(targetVO.id, targetObj);");
        //view3D.AddProductGameObj(targetVO.id, targetObj);
    }
    public override void enter()
    {
        base.enter();
        //machine.selectGoods
        targetVO = mainpagedata.getGoods(machine.selectGoods[0].seekId);
        if (targetVO == null)
        {
            Debug.LogError("targetVO == null id = " + machine.selectGoods[0].seekId);
            return;
        }
        targetProduct = mainpagedata.getProduct(targetVO.seekId);
        if (targetProduct == null)
        {
            Debug.LogError("targetProduct == null id = " + machine.selectGoods[0].seekId);
            return;
        }
        GameObject go;

        if (selectEmtyObj == null)
        {
            go                  = GameObject.CreatePrimitive(PrimitiveType.Cube);
            selectEmtyObj       = new GameObject("placeEmtyObj");
            go.transform.parent = selectEmtyObj.transform;
        }
        else
        {
            go = selectEmtyObj.transform.GetChild(0).gameObject;
        }
        selectEmtyObj.gameObject.SetActive(true);
        Vector3 scale = targetProduct.size;

        go.transform.localScale    = scale;
        go.transform.localPosition = scale.y / 2 * Vector3.up;
        targetObj = selectEmtyObj;
        LoadMode();
    }
Ejemplo n.º 6
0
    public override void enter()
    {
        base.enter();
        target = (viewTarget as GoodsView).data;
        //machine.selectGoods
        targetObj     = viewTarget.gameObject;
        targetVO      = mainpagedata.getGoods(target.seekId);
        targetProduct = mainpagedata.getProduct(target.seekId);
        Vector3 size = targetProduct.size;

        targetSize   = Vector2.right * size.x + Vector2.up * size.z;
        targetOffset = size.x / viewTarget.transform.localScale.x * Vector3.right
                       + size.z / viewTarget.transform.localScale.y * Vector3.up;
        OptionsController.Instance.selectMachine = goods2Dmachine;
        //MainPageUIController.Instance;
        if (rotateObj == null)
        {
            rotateObj = prefabs.GetNewInstance_rotate();
        }
        rotateObj.SetActive(true);
        rotateObj.transform.position = viewTarget.transform.TransformPoint(targetOffset / 2 - Vector3.forward);
        goods2Dmachine.setState(EditTypeOnSelect.Free);
        downed = false;
    }
Ejemplo n.º 7
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);
            }
        }
    }
Ejemplo n.º 8
0
    private void LoadMode(ProductData productData)
    {
        GoodsVO vo = mainPageData.getGoods(productData.seekId);

        if (vo == null)
        {
            Debug.LogWarning("proxy.getGood(id) == null seekId = " + productData.seekId);
            return;
        }

        Vector3 size    = mainPageData.getProduct(vo.seekId).size;
        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 = -0.001f + productData.height;
        }
        break;

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

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

        default:    //不吸附
            break;
        }

        GameObject instanceObj;
        Vector3    pos;
        GoodsView  goodsView;

        if (productData.type == 2)
        {
            instanceObj = prefabs.GetNewInstance_doorwhiteground().gameObject;
            //float width = size.z;
            instanceObj.transform.localScale = Vector2.right * size.x + Vector2.up * size.z;
            instanceObj.layer = LayerMask.NameToLayer("UI");
            AddProductGameObj(productData.id, instanceObj);

            productData.setData(instanceObj, size, y, true);
            pos   = instanceObj.transform.localPosition;
            pos.z = -5;
            instanceObj.transform.localPosition = pos;
            goodsView = instanceObj.GetComponent <GoodsView>();
            goodsView.SetData(productData);
            if (productData.hide == true)
            {
                instanceObj.SetActive(false);
            }
            else
            {
                instanceObj.SetActive(true);
            }
            goodsViewList.Add(goodsView);
            return;
        }
        instanceObj = prefabs.GetNewQuad();
        //float width = size.z;
        instanceObj.transform.localScale = Vector2.right * size.x + Vector2.up * size.z;
        instanceObj.layer = LayerMask.NameToLayer("UI");
        AddProductGameObj(productData.id, instanceObj);

        productData.setData(instanceObj, size, y, true);
        pos   = instanceObj.transform.localPosition;
        pos.z = -5;
        instanceObj.transform.localPosition = pos;
        goodsView = instanceObj.GetComponent <GoodsView>();
        goodsView.SetData(productData);
        if (productData.hide == true)
        {
            instanceObj.SetActive(false);
        }
        else
        {
            instanceObj.SetActive(true);
        }
        goodsViewList.Add(goodsView);
        SetTextureTool.SetTexture(instanceObj, vo.uri2D, vo.seekId);
        //AssetBoundleLoader loader = new AssetBoundleLoader(vo.modelUri, LoadDataType.assetBoundle, onLoaded, new object[2] { vo, product });
        //loader.Load();
    }
Ejemplo n.º 9
0
    private void OnSelected(MyEvent obj)
    {
        UnityIOSMsg.removeListioner(IOSEvent.SelectGoods, OnSelected);
        object[]                 objs      = obj.data as object[];
        List <Product>           products  = objs[0] as List <Product>;
        List <SelectProductData> goodsList = objs[1] as List <SelectProductData>;

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

        selectList.Clear();
        selectMaterialList.Clear();
        for (int i = 0; i < goodsList.Count; i++)
        {
            Product product = mainpageData.getProduct(goodsList[i].seekId);
            if (product.productType == "FloorTiles" || product.productType == "Wallpapers")
            {
                selectMaterialList.Add(goodsList[i]);
            }
            else if (product.productType == "3D")
            {
                selectList.Add(goodsList[i]);
            }
        }
        if (selectList.Count == 0)
        {
            return;
        }

        undoHelper.save();

        data.RemoveProduct(target);
        inputMachine.selectGoods = selectList;
        if (selectList.Count == 1 && selectList[0].count == 1)
        {
            if (inputMachine.currentInputIs2D)
            {
                inputMachine.setState(PlaceGoodsState2D.NAME);
            }
            else
            {
                inputMachine.setState(PlaceGoodsState3D.NAME);
            }
        }
        else
        {
            Vector3 pos = Vector3.zero;
            for (int i = 0; i < data.pointList.Count; i++)
            {
                Vector2 v2 = data.pointList[i].pos;
                if (pos.z < v2.y)
                {
                    pos.z = v2.y;
                }
                if (pos.x < v2.x)
                {
                    pos.x = v2.x;
                }
            }
            pos.x += 2;
            for (int i = 0; i < selectList.Count; i++)
            {
                SelectProductData selectProductData = selectList[i];
                GoodsVO           vo      = mainpageData.getGoods(selectProductData.seekId);
                Product           product = mainpageData.getProduct(selectProductData.seekId);
                pos.y = product.defaultHeight;

                Vector3 temppos = pos;
                for (int k = 0; k < selectProductData.count; k++)
                {
                    temppos.x += 2;
                    ProductData productData = data.AddProduct(vo.id, temppos, 0, product, null, vo.type);
                }

                pos.z -= 1;
            }
            RefreshView();
            if (inputMachine.currentInputIs2D)
            {
                inputMachine.setState(FreeState2D.NAME);
            }
            else
            {
                inputMachine.setState(FreeState3D.NAME);
            }
        }
    }
    private void onloadedBforClone(GameObject prefab, object bringData)
    {
        BoxCollider boxColli = prefab.AddComponent <BoxCollider>();
        GoodsVO     vo       = bringData as GoodsVO;
        Product     product  = mainpagedata.getProduct(vo.seekId);

        boxColli.size   = product.size;
        boxColli.center = boxColli.center + Vector3.up * (boxColli.size.y / 2 - boxColli.center.y);
        Bounds bounds = default(Bounds);

        foreach (Transform item in prefab.transform)
        {
            Renderer renderer = item.GetComponent <Renderer>();
            if (renderer == null)
            {
                continue;
            }
            if (item.name == "shadow")
            {
                //if (product.entityType == "flooring")
                //{
                item.gameObject.SetActive(false);
                //}
                //else {
                //    Shader shader = Shader.Find("Unlit/Transparent Colored");
                //    renderer.sharedMaterial.shader = shader;
                //}
            }
            else if (item.name == "snap_plane")
            {
                renderer.enabled = false;
                //item.gameObject.AddComponent<BoxCollider>();
            }
            else
            {
                if (item.name == "glass")
                {
                    Shader   shader   = Shader.Find("Standard");
                    Material material = renderer.sharedMaterial;
                    material.shader = shader;
                    material.SetFloat("_Metallic", 0.1f);
                    material.SetFloat("_Glossiness", 0.88f);

                    //RenderingMode.Transparent:
                    material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
                    material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
                    material.SetInt("_ZWrite", 0);
                    material.DisableKeyword("_ALPHATEST_ON");
                    material.DisableKeyword("_ALPHABLEND_ON");
                    material.EnableKeyword("_ALPHAPREMULTIPLY_ON");
                    material.renderQueue = 3000;

                    //item.gameObject.AddComponent<BoxCollider>();
                }
                else
                {
                    Shader shader = Shader.Find("Unlit/Transparent Cutout");
                    renderer.sharedMaterial.shader = shader;
                }
                MeshFilter meshFilter = item.gameObject.GetComponent <MeshFilter>();
                if (meshFilter == null)
                {
                    continue;
                }
                Bounds meshBounds = meshFilter.sharedMesh.bounds;
                if (bounds == default(Bounds))
                {
                    bounds = meshBounds;
                }
                else
                {
                    float minx = bounds.min.x;
                    float minz = bounds.min.z;
                    float maxx = bounds.max.x;
                    float maxz = bounds.max.z;
                    if (meshBounds.min.x < minx)
                    {
                        minx = meshBounds.min.x;
                    }
                    if (meshBounds.min.z < minz)
                    {
                        minz = meshBounds.min.z;
                    }
                    if (meshBounds.max.x > maxx)
                    {
                        maxx = meshBounds.max.x;
                    }
                    if (meshBounds.max.z > maxz)
                    {
                        maxz = meshBounds.max.z;
                    }
                    bounds.center  = Vector3.right * (maxx + minx) / 2 + Vector3.forward * (maxz + minz) / 2;
                    bounds.extents = Vector3.right * (maxx - minx) / 2 + Vector3.forward * (maxz - minz) / 2;
                }
            }
        }
        if (product.contentTypeDetail.StartsWith("folding door") == true)
        {
            return;
        }
        if (bounds != default(Bounds))
        {
            Vector3 center = prefab.transform.InverseTransformPoint(bounds.center);
            center.y = 0;
            foreach (Transform item in prefab.transform)
            {
                item.localPosition = -center;
            }
        }
    }
    public override void mUpdate()
    {
        base.mUpdate();
        if (uguiHitUI.uiHited == true)
        {
            return;
        }

        Ray ray = inputCamera.ScreenPointToRay(Input.mousePosition);

        Vector2 pos = ray.origin;

        if (lastMousePos == pos && Input.GetMouseButtonDown(0) == false)
        {
            return;
        }
        lastMousePos = pos;

        Vector3 world = Vector3.one;

        int count = Physics.RaycastNonAlloc(ray, hits);

        if (count > 1 || (count == 1 && hits[0].collider.gameObject != targetObj))
        {
            float dis = float.MaxValue;
            for (int i = 0; i < count; i++)
            {
                if (hits[i].collider.gameObject == targetObj)
                {
                    continue;
                }
                float itemDis = Vector3.Distance(hits[i].point, inputCamera.transform.position);
                if (itemDis < dis)
                {
                    dis     = itemDis;
                    world   = hits[i].point;
                    world.y = 0;
                }
            }
        }
        else
        {
            Vector3 v3  = inputCamera.transform.position;
            Vector3 v32 = ray.origin;
            world.y = 0;
            float lerp = (world.y - v32.y) / (v3.y - v32.y);
            world.x = lerp * (v3.x - v32.x) + v32.x;
            world.z = lerp * (v3.z - v32.z) + v32.z;
        }

        float Angle = -targetObj.transform.rotation.eulerAngles.y + forTop;

        world.y = targetProduct.defaultHeight;

        switch (targetVO.type)
        {
        case 1:    //吸附墙
        {
            Adsorb(ref world, ref Angle);
        }
        break;

        case 2:    //门窗
        {
            //if (targetProduct.entityType == "window")
            //{
            //    world.y = 1;
            //}
            Inlay(ref world, ref Angle);
        }
        break;

        case 3:    //吊顶
        {
            world.y = defaultSetting.DefaultHeight - targetSize.y + targetProduct.defaultHeight;
        }
        break;

        case 4:    //地毯
        {
            world.y = -0.001f + targetProduct.defaultHeight;
        }
        break;

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

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

        default:    //不吸附
            break;
        }

        targetObj.transform.position = world;
        if (Input.GetMouseButtonDown(0))
        {
            undoHelper.save();
            GoodsVO     vo          = mainpagedata.getGoods(machine.selectGoods[0].seekId);
            ProductData productData = data.AddProduct(vo.id, world, Angle, targetProduct, targetWall, targetVO.type);
            RefreshView();//必须先刷新
            ToSelectGoodsState(productData);
        }
    }
    public override void enter()
    {
        base.enter();
        if (viewTarget == null)
        {
            target        = viewData as ProductData;
            targetWall    = target.targetWall;
            targetProduct = mainpagedata.getProduct(target.seekId);
            targetSize    = targetProduct.size;
            targetVO      = mainpagedata.getGoods(target.seekId);
            optionsController.selectMachine = selectGoods3DMachine;

            GameObject go;
            if (selectEmtyObj == null)
            {
                go                  = GameObject.CreatePrimitive(PrimitiveType.Cube);
                selectEmtyObj       = new GameObject("selectEmtyObj");
                go.transform.parent = selectEmtyObj.transform;
            }
            else
            {
                go = selectEmtyObj.transform.GetChild(0).gameObject;
            }
            selectEmtyObj.gameObject.SetActive(true);
            Vector3 size = targetProduct.size;
            go.transform.localScale    = size;
            go.transform.localPosition = size.y / 2 * Vector3.up;
            targetObj = selectEmtyObj;

            Vector3 v3 = target.position;
            v3.y = target.height;
            switch (targetVO.type)
            {
            case 3:    //吊顶
            {
                v3.y = target.height - targetSize.y;
            }
            break;

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

            case 5:    //天花板
            {
                v3.y = target.height - 0.001f;
            }
            break;

            default:
                break;
            }
            targetObj.transform.position = v3;

            string outUrl = targetVO.modelUri;
            loader = LoaderPool.WaitOutterLoad(outUrl, SimpleLoadDataType.prefabAssetBundle, onloaded, null);
            //在3D刷新时移除 3D自己刷新会去加载拥有的模型  若不加入 加载过程中被刷新会在加载完成时候出现多余项
            view3D.loaders.Add(loader);
            return;
        }
        target        = (viewTarget as Goods3DView).data;
        targetWall    = target.targetWall;
        targetVO      = mainpagedata.getGoods(target.seekId);
        targetProduct = mainpagedata.getProduct(target.seekId);
        targetSize    = targetProduct.size;
        optionsController.selectMachine = selectGoods3DMachine;
        targetObj = viewTarget.gameObject;

        RefreshRotateAndMoveHeight(true);

        selectGoods3DMachine.setState(EditTypeOnSelect.Free);

        cameraMachion.addEventListener(CameraEvent.ViewChange, OnViewChange);
    }
Ejemplo n.º 13
0
    /// <summary>
    /// 临时模拟
    /// </summary>
    private void TempDo()
    {
        TextAsset                asset          = Resources.Load <TextAsset>("addGoods");
        MsgFromIOS               iosMsg         = (MsgFromIOS)asset.text;
        List <Product>           products       = new List <Product>();
        List <SelectProductData> selectproducts = new List <SelectProductData>();

        if (iosMsg.code == "201002")
        {
            List <object> list = iosMsg.info.goodsArr as List <object>;

            for (int i = 0; i < list.Count; i++)
            {
                MsgFromIOS.GoodsInfo info = new MsgFromIOS.GoodsInfo();
                info.Deserialize(list[i] as Dictionary <string, object>);
                //goodsList.Add(info);
                SelectProductData selctproduct = new SelectProductData();
                info.WriteToSelectProductData(selctproduct);
                //info.WriteToProduct(product);
                products.Add(info.model);
                selectproducts.Add(selctproduct);
            }
        }
        {
            for (int i = 0; i < products.Count; i++)
            {
                mainpageData.AddProduct(products[i]);
            }
            selectproducts[2].count = 2;
            List <SelectProductData> list = new List <SelectProductData>()
            {
                selectproducts[1],
                selectproducts[2],
                selectproducts[3],
                /*selectproducts[4],*/
                selectproducts[5],
                selectproducts[6],
                selectproducts[7],
                selectproducts[8],
                selectproducts[9],
            };
            inputMachine.selectGoods = list;

            undoHelper.save();

            if (list.Count == 1 && list[0].count == 1)
            {
                if (inputMachine.currentInputIs2D)
                {
                    inputMachine.setState(PlaceGoodsState2D.NAME);
                }
                else
                {
                    inputMachine.setState(PlaceGoodsState3D.NAME);
                }
            }
            else
            {
                Vector3 pos = Vector3.zero;
                for (int i = 0; i < originalInputData.pointList.Count; i++)
                {
                    Vector2 v2 = originalInputData.pointList[i].pos;
                    if (pos.z < v2.y)
                    {
                        pos.z = v2.y;
                    }
                    if (pos.x < v2.x)
                    {
                        pos.x = v2.x;
                    }
                }
                pos.x += 2;
                for (int i = 0; i < list.Count; i++)
                {
                    SelectProductData selectProductData = list[i];
                    GoodsVO           vo      = mainpageData.getGoods(selectProductData.seekId);
                    Product           product = mainpageData.getProduct(selectProductData.seekId);
                    pos.y = product.defaultHeight;

                    Vector3 temppos = pos;
                    for (int k = 0; k < selectProductData.count; k++)
                    {
                        temppos.x += 2;
                        ProductData productData = originalInputData.AddProduct(vo.id, temppos, 0, product, null, vo.type);
                    }

                    pos.z -= 1;
                }
                RefreshView();
                if (inputMachine.currentInputIs2D)
                {
                    inputMachine.setState(FreeState2D.NAME);
                }
                else
                {
                    inputMachine.setState(FreeState3D.NAME);
                }
            }
        }
    }