Ejemplo n.º 1
0
    public void editSetup()
    {
        CommonData       storedata   = controlScript.gameObject.GetComponent <CommonData>();
        StepDetail       detailsteps = storedata.newStrategy.steps[storedata.chosenStepIndex];
        string           createtime  = actionObj.GetComponent <OperatorData>().createTime;
        StepDetailAction tempAction  = new StepDetailAction();

        foreach (StepDetailAction step in detailsteps.detailActions)
        {
            if (step.createTime.Equals(createtime))
            {
                tempAction = step;
            }
        }
        if (tempAction.actionInfo != null)
        {
            addInfoText.text = @"Description";
            existInfo        = tempAction.actionInfo;
        }
        else
        {
            addInfoText.text = @"Description";
            existInfo        = "";
        }
        hasArrow = tempAction.hasArrow;
        if (tempAction.hasArrow)
        {
            AddArrowText.text = @"Arrow";
        }
        else
        {
            AddArrowText.text = @"Arrow";
        }
    }
Ejemplo n.º 2
0
    public void showImageView(StepDetailAction action)
    {
        detailAction = action;
        imagePanel.SetActive(true);
        confirmModifyBtn.SetActive(false);

        if (action.stepImageUrl != null)
        {
            if (File.Exists(DataObj.cachePath + action.stepImageUrl.GetHashCode()))
            {
                StartCoroutine(LoadLocalImage(action.stepImageUrl, screenShotImg));
            }
            else
            {
                StartCoroutine(DownloadImage(action.stepImageUrl, screenShotImg));
            }
        }
        else
        {
            Texture2D texture = new Texture2D(Screen.width, Screen.height);
            texture.LoadImage(detailAction.imageData);

            Sprite sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f));
            screenShotImg.sprite = sprite;
        }

        browsedescText.text = detailAction.actionInfo;
        browsetextObj.SetActive(true);
        if (DataObj.isScan)
        {
            if (DataObj.isUserOwn)
            {
                modifyBtn.SetActive(true);
                deleteBtn.SetActive(true);
                showInfoBtn.SetActive(false);
            }
            else
            {
                modifyBtn.SetActive(false);
                deleteBtn.SetActive(false);
                showInfoBtn.SetActive(true);
                browsetextObj.SetActive(false);
            }
        }
        else
        {
            modifyBtn.SetActive(true);
            deleteBtn.SetActive(true);
            showInfoBtn.SetActive(false);
        }
    }
Ejemplo n.º 3
0
    void createMarkOnMap(StepDetailAction action)
    {
        GameObject parentObj = GameObject.Find(action.parentName);

        Debug.Log("parentObj = " + parentObj);
        GameObject cube = (GameObject)Instantiate(commonPrefab);

        cube.transform.SetParent(parentObj.transform);
        cube.transform.localScale    = action.mainTransform.localscale;
        cube.transform.localPosition = action.mainTransform.localposition;
        cube.transform.localRotation = action.mainTransform.localrotation;


        markOnMaps.Add(cube);
    }
Ejemplo n.º 4
0
    void addMarkOnMap(RaycastHit hit)
    {
        Transform  ghostObjInstance;
        GameObject cube1 = (GameObject)Instantiate(markCommon);

        ghostObjInstance = Instantiate(cube1, cube1.transform.position, Quaternion.identity).GetComponent <Transform>();
        ghostObjInstance.transform.localScale *= scaleChange;
        Debug.Log(scaleChange);
        Vector3 pivotOffsetExtra;
        bool    objPivotIsBase = isPivotInBase(ghostObjInstance, out pivotOffsetExtra);

        if (!objPivotIsBase)
        {
            ghostObjInstance = CreateBasePivot(ghostObjInstance, pivotOffsetExtra);
        }
        Vector3 pos = hit.point;

        ghostObjInstance.position = pos;

        AlignGhostToSurface(ghostObjInstance, hit.normal);

        ghostObjInstance = ghostObjInstance.GetComponent <PivotHelper>().DeletePivot();

        GameObject cube = Instantiate(markCommon, ghostObjInstance.position, ghostObjInstance.rotation);

        Destroy(ghostObjInstance.gameObject);
        Destroy(cube1);
        cube.transform.SetParent(hit.collider.gameObject.transform);
        cube.transform.rotation = hit.collider.gameObject.transform.rotation;
        //cube.transform.localScale = new Vector3(0.012f, 0.012f, 0.012f);
        cube.transform.localScale *= scaleChange;
        gameObject.GetComponent <DpScanMap>().canAddMark           = false;
        gameObject.GetComponent <DpScanMap>().markBtn.interactable = true;

        StepDetailAction action = new StepDetailAction(cube.transform, "Common", gameObject.GetComponent <MapObj>().currentFloorName, hit.collider.gameObject.name);

        action.createTime = System.DateTime.Now.ToString();
        Debug.Log(JsonUtility.ToJson(action));
        gameObject.GetComponent <DpScanMap>().markOnMaps.Add(cube);

        ExitGames.Client.Photon.Hashtable h = new ExitGames.Client.Photon.Hashtable();
        h.Add("marks", JsonUtility.ToJson(action));
        DataObj.lbc.LocalPlayer.SetCustomProperties(h);
    }
Ejemplo n.º 5
0
    public void deleteImage()
    {
        CommonData storedata   = GetComponent <CommonData>();
        StepDetail detailsteps = storedata.newStrategy.steps[storedata.chosenStepIndex];



        StepDetailAction tempAction = new StepDetailAction();

        foreach (StepDetailAction step in detailsteps.detailActions)
        {
            if (step.createTime.Equals(detailAction.createTime))
            {
                tempAction = step;
            }
        }
        //detailsteps.detailActions = newList;
        detailsteps.detailActions.Remove(tempAction);

        storedata.isUpdated = true;
        imagePanel.SetActive(false);
    }
Ejemplo n.º 6
0
    void deleteAction()
    {
        CommonData storedata   = controlScript.gameObject.GetComponent <CommonData>();
        StepDetail detailsteps = storedata.newStrategy.steps[storedata.chosenStepIndex];
        string     createtime  = actionObj.GetComponent <OperatorData>().createTime;


        StepDetailAction tempAction = new StepDetailAction();

        foreach (StepDetailAction step in detailsteps.detailActions)
        {
            if (step.createTime.Equals(createtime))
            {
                tempAction = step;
            }
        }
        //detailsteps.detailActions = newList;
        detailsteps.detailActions.Remove(tempAction);


        storedata.isUpdated = true;
        Destroy(actionObj);
        this.gameObject.SetActive(false);
    }
Ejemplo n.º 7
0
    //private void LoadByIO()
    //{

    //    //double startTime = (double)Time.time;
    //    //创建文件读取流
    //    FileStream fileStream = new FileStream(Application.persistentDataPath + "/CaptureScreenshot.png", FileMode.Open, FileAccess.Read);
    //    fileStream.Seek(0, SeekOrigin.Begin);
    //    //创建文件长度缓冲区
    //    byte[] bytes = new byte[fileStream.Length];
    //    //读取文件
    //    fileStream.Read(bytes, 0, (int)fileStream.Length);
    //    //释放文件读取流
    //    fileStream.Close();
    //    fileStream.Dispose();
    //    fileStream = null;

    //    //创建Texture
    //  Texture2D texture = new Texture2D(Screen.width, Screen.height);
    //texture.LoadImage(bytes);

    //    //创建Sprite


    //    //startTime = (double)Time.time - startTime;
    //    //Debug.Log("IO加载用时:" + startTime);
    //}



    // Update is called once per frame
    void Update()
    {
        //if (EventSystem.current.IsPointerOverGameObject())
        //{
        //    Debug.Log("当前触摸在UI上");
        //    return;

        //}

        if (fileSaved)
        {
            fileSaved = false;
            CommonData storeData = GetComponent <CommonData>();

            StepDetailAction action = new StepDetailAction();
            action.createTime   = System.DateTime.Now.ToString();
            action.imageType    = true;
            action.actionInfo   = descText.text;
            action.stepImageUrl = tempFile.Url.ToString();
            action.actionType   = "Image";
            action.parentFloor  = "10";
            StepDetail detail = storeData.newStrategy.steps[storeData.chosenStepIndex];
            if (detail.detailActions != null)
            {
                detail.detailActions.Add(action);
            }
            else
            {
                detail.detailActions = new List <StepDetailAction>();
                detail.detailActions.Add(action);
            }



            stepDetailPAnel panelScript = GetComponent <CommonControl>().detailPanel.GetComponent <stepDetailPAnel>();
            panelScript.scrollView.GetComponent <DetailStepScrollview>().storeData = storeData;
            storeData.isUpdated = true;
        }



        if (GetComponent <CommonControl>().canDrawLine)
        {
            if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)
            {
                if (Input.touchCount == 1)
                {
                    Touch touch = Input.touches[0];
                    if (touch.phase == TouchPhase.Began)
                    {
                        clone = (GameObject)Instantiate(lineObj, lineObj.transform.position, Quaternion.identity);
                        lineArray.Add(clone);
                        //获得该物体上的LineRender组件
                        line = clone.GetComponent <LineRenderer>();
                        //设置起始和结束的颜色
                        line.startColor = Color.red;

                        line.endColor = Color.red;
                        //设置起始和结束的宽度
                        line.startWidth = .2f;
                        line.endWidth   = .2f;
                        //计数
                        i = 0;
                    }

                    if (touch.phase == TouchPhase.Moved)
                    {
                        i++;
                        //设置顶点数
                        line.positionCount = i;
                        //设置顶点位置(顶点的索引,将鼠标点击的屏幕坐标转换为世界坐标)
                        line.SetPosition(i - 1, Camera.main.ScreenToWorldPoint(new Vector3(touch.position.x, touch.position.y, 15)));
                    }
                }
            }
            else
            {
                if (Input.GetMouseButtonDown(0))
                {
                    //实例化对象
                    clone = (GameObject)Instantiate(lineObj, lineObj.transform.position, Quaternion.identity);
                    lineArray.Add(clone);
                    //获得该物体上的LineRender组件
                    line = clone.GetComponent <LineRenderer>();
                    //设置起始和结束的颜色
                    line.startColor = Color.red;

                    line.endColor = Color.red;
                    //设置起始和结束的宽度
                    line.startWidth = .2f;
                    line.endWidth   = .2f;
                    //计数
                    i = 0;
                }
                if (Input.GetMouseButton(0))
                {
                    //每一帧检测,按下鼠标的时间越长,计数越多
                    i++;
                    //设置顶点数
                    line.positionCount = i;
                    //设置顶点位置(顶点的索引,将鼠标点击的屏幕坐标转换为世界坐标)
                    line.SetPosition(i - 1, Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 15)));
                }
            }
        }
    }
Ejemplo n.º 8
0
    public void OnPlayerPropertiesUpdate(Player targetPlayer, Hashtable changedProps)
    {
        updateTeammatePanel();
        Debug.Log(targetPlayer.NickName);
        foreach (var key in changedProps.Keys)
        {
            Debug.Log(key + "  " + changedProps[key]);
        }
        if (changedProps.ContainsKey("follow"))
        {
            if (changedProps["follow"].Equals(ParseUser.CurrentUser["nickName"]) && !targetPlayer.NickName.Equals(ParseUser.CurrentUser["nickName"]))
            {
                followed = true;
            }
            else
            {
                followed = false;
            }
        }



        if (chosenPlayer != null)
        {
            if (targetPlayer.NickName.Equals(chosenPlayer) && !targetPlayer.NickName.Equals(ParseUser.CurrentUser["nickName"]))
            {
                Hashtable newprops = changedProps;


                if (newprops.ContainsKey("camera"))
                {
                    Camera.main.transform.position = JsonUtility.FromJson <Vector3>(newprops["camera"] as string);
                }


                if (newprops.ContainsKey("floor"))
                {
                    if (!newprops["floor"].Equals(oldFloorName))
                    {
                        oldFloorName = newprops["floor"] as string;
                        gameObject.GetComponent <MapObj>().createMapWithName(oldFloorName);
                    }
                }
                if (newprops.ContainsKey("rotation"))
                {
                    if (gameObject.GetComponent <MapObj>().wholeMapObj != null)
                    {
                        gameObject.GetComponent <MapObj>().wholeMapObj.transform.rotation = JsonUtility.FromJson <Quaternion>(newprops["rotation"] as string);
                    }
                    else
                    {
                        gameObject.GetComponent <MapObj>().displayFloor.transform.rotation = JsonUtility.FromJson <Quaternion>(newprops["rotation"] as string);
                    }
                }
                if (newprops.ContainsKey("scale"))
                {
                    if (gameObject.GetComponent <MapObj>().wholeMapObj != null)
                    {
                        gameObject.GetComponent <MapObj>().wholeMapObj.transform.localScale = JsonUtility.FromJson <Vector3>(newprops["scale"] as string);
                    }
                    else
                    {
                        gameObject.GetComponent <MapObj>().displayFloor.transform.localScale = JsonUtility.FromJson <Vector3>(newprops["scale"] as string);
                    }
                }


                if (newprops.ContainsKey("marks"))
                {
                    StepDetailAction action = JsonUtility.FromJson <StepDetailAction>(newprops["marks"] as string);
                    if (action.createTime.CompareTo(lastDate) == 1)
                    {
                        lastDate = action.createTime;
                        createMarkOnMap(action);
                    }
                }
            }
        }
    }
Ejemplo n.º 9
0
    public void buttonClicked(GameObject btnObj)
    {
        if (DataObj.isDp)
        {
            ExitGames.Client.Photon.Hashtable h = new ExitGames.Client.Photon.Hashtable();
            h.Add("operator", btnObj.name);
            DataObj.lbc.LocalPlayer.SetCustomProperties(h);

            gameObject.SetActive(false);
            return;
        }

        controlScript.canAddOperation = false;

        OperatorObj operatorobj = new OperatorObj();

        foreach (OperatorObj op in operators)
        {
            if (op.name.Equals(btnObj.name))
            {
                operatorobj = op;
            }
        }


        GameObject cube1 = (GameObject)Instantiate(operatorobj.operatorPrefab);

        ghostObjInstance = Instantiate(cube1, cube1.transform.position, Quaternion.identity).GetComponent <Transform>();
        ghostObjInstance.transform.localScale *= controlScript.scaleChange;
        Debug.Log(controlScript.scaleChange);
        Vector3 pivotOffsetExtra;
        bool    objPivotIsBase = controlScript.isPivotInBase(ghostObjInstance, out pivotOffsetExtra);

        if (!objPivotIsBase)
        {
            ghostObjInstance = controlScript.CreateBasePivot(ghostObjInstance, pivotOffsetExtra);
        }
        Vector3 pos = rayhit.point;

        ghostObjInstance.position = pos;

        controlScript.AlignGhostToSurface(ghostObjInstance, rayhit.normal);

        ghostObjInstance = ghostObjInstance.GetComponent <PivotHelper>().DeletePivot();

        GameObject cube = Instantiate(operatorobj.operatorPrefab, ghostObjInstance.position, ghostObjInstance.rotation);

        Destroy(ghostObjInstance.gameObject);
        Destroy(cube1);
        cube.transform.SetParent(hitobject.transform);
        cube.transform.rotation = hitobject.transform.rotation;
        //cube.transform.localScale = new Vector3(0.012f, 0.012f, 0.012f);
        cube.transform.localScale *= controlScript.scaleChange;

        string currentFloor = controlScript.gameObject.GetComponent <MapObj>().currentFloorName;

        StepDetailAction action = new StepDetailAction(cube.transform, "Operator", currentFloor, hitobject.name);

        action.createTime = System.DateTime.Now.ToString();
        action.actionName = operatorobj.name;
        CommonData storeData = controlScript.gameObject.GetComponent <CommonData>();
        StepDetail detail    = storeData.newStrategy.steps[storeData.chosenStepIndex];

        if (detail.detailActions != null)
        {
            detail.detailActions.Add(action);
        }
        else
        {
            detail.detailActions = new List <StepDetailAction>();
            detail.detailActions.Add(action);
        }

        OperatorData cubeData = cube.GetComponent <OperatorData>();

        cubeData.createTime  = action.createTime;
        cubeData.actionName  = operatorobj.name;
        cubeData.parentFloor = currentFloor;
        cubeData.actionType  = "Operator";

        stepDetailPAnel panelScript = controlScript.detailPanel.GetComponent <stepDetailPAnel>();

        panelScript.scrollView.GetComponent <DetailStepScrollview>().storeData = storeData;

        storeData.Operators.Add(cube);


        Debug.Log(JsonUtility.ToJson(storeData));
        storeData.isUpdated = true;

        //controlScript.alreadyHavepoint = false;
        this.gameObject.SetActive(false);
    }
Ejemplo n.º 10
0
    private void Update()
    {
        if (saveSucceed)
        {
            saveSucceed = false;
            if (DataObj.isDp)
            {
                DataObj.isJoin = false;
                DataObj.lbc.OpLeaveRoom(false);
                DataObj.lbc.Disconnect();
            }
            DataObj.isScan      = false;
            DataObj.isBrowseMap = false;
            DataObj.isDp        = false;
            DataObj.shouHud     = false;
            DataObj.isRecommend = false;
            SceneManager.LoadScene(0);
        }


        if (fileSaved)
        {
            fileSaved = false;
            saveAfterFileupload();
        }


        if (!tempCurrentFloorName.Equals(gameObject.GetComponent <MapObj>().currentFloorName))
        {
            tempCurrentFloorName = gameObject.GetComponent <MapObj>().currentFloorName;
            createOperatorOnMap();
        }

        //电脑操作
        if (EventSystem.current.IsPointerOverGameObject())
        {
            //Debug.Log("当前触摸在UI上");
            return;
        }
        else
        {
            //Debug.Log("当前没有触摸在UI上");
        }


        if (Input.touchCount == 0)
        {
            return;
        }
        //if (Input.GetMouseButtonUp(0))
        if (Input.GetTouch(0).phase == TouchPhase.Began)
        {
            Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position);
            //Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            //Debug.Log(ray);
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit))
            {
                //Debug.Log(hit.point);

                if (hit.collider.gameObject.tag.Equals("Operator"))
                {
                    //Debug.Log("11121212121");
                    if (canAddOperation)
                    {
                        canAddOperation = false;
                        return;
                    }
                    else if (detailPanel == null)
                    {
                        return;
                    }
                    else
                    {
                        if (DataObj.isScan && DataObj.isUserOwn == false)
                        {
                            StepDetail       detailsteps = storedData.newStrategy.steps[storedData.chosenStepIndex];
                            string           createtime  = hit.collider.gameObject.GetComponent <OperatorData>().createTime;
                            StepDetailAction tempAction  = new StepDetailAction();

                            foreach (StepDetailAction step in detailsteps.detailActions)
                            {
                                if (step.createTime.Equals(createtime))
                                {
                                    tempAction = step;
                                }
                            }

                            MNPopup mNPopup = new MNPopup("Info", tempAction.actionInfo);
                            mNPopup.AddAction("Ok", () => { Debug.Log("Ok action callback"); });
                            mNPopup.Show();
                        }
                        else
                        {
                            if (arrowControl == false)
                            {
                                EditPanelobj.SetActive(true);
                                EditPanelobj.GetComponent <HandelAction>().actionObj     = hit.collider.gameObject;
                                EditPanelobj.GetComponent <HandelAction>().controlScript = this;
                                EditPanelobj.GetComponent <HandelAction>().editSetup();
                            }
                        }
                    }
                }

                if (gameObject.GetComponent <DpScanMap>().canAddMark)
                {
                    addMarkOnMap(hit);
                    gameObject.GetComponent <DpScanMap>().canAddMark = false;
                }

                if (canAddOperation && OperatorChoosePanel.activeSelf == false)
                {
                    OperatorChoosePanel.SetActive(true);
                    OperatorChoosePanel.GetComponent <OperatorChoose>().controlScript = this;
                    OperatorChoosePanel.GetComponent <OperatorChoose>().hitPoint      = hit.point;
                    OperatorChoosePanel.GetComponent <OperatorChoose>().hitobject     = hit.collider.gameObject;
                    OperatorChoosePanel.GetComponent <OperatorChoose>().rayhit        = hit;
                    //canAddOperation = false;
                }
            }
        }
    }
Ejemplo n.º 11
0
    public void createOperatorOnMap()
    {
        if (storedData == null)
        {
            return;
        }

        if (storedData.newStrategy.steps.Count == 0)
        {
            return;
        }
        List <StepDetailAction> detailActions = storedData.newStrategy.steps[storedData.chosenStepIndex].detailActions;

        foreach (GameObject item in storedData.Operators)
        {
            Destroy(item);
        }
        storedData.Operators = new List <GameObject>();

        if (detailActions != null && IndetailActions)
        {
            for (int i = 0; i < detailActions.Count; i++)
            {
                StepDetailAction action = detailActions[i];
                //string currentfloorName = gameObject.GetComponent<MapObj>().currentFloorName;
                if (action.parentFloor.Equals(tempCurrentFloorName) && action.actionType.Equals("Operator"))
                {
                    OperatorObj operatorobj = new OperatorObj();
                    foreach (OperatorObj op in OperatorChoosePanel.GetComponent <OperatorChoose>().operators)
                    {
                        if (op.name.Equals(action.actionName))
                        {
                            operatorobj = op;
                        }
                    }


                    GameObject parentObj = GameObject.Find(action.parentName);
                    Debug.Log("parentObj = " + parentObj);
                    GameObject cube = (GameObject)Instantiate(operatorobj.operatorPrefab);
                    cube.transform.SetParent(parentObj.transform);
                    cube.transform.localScale    = action.mainTransform.localscale;
                    cube.transform.localPosition = action.mainTransform.localposition;
                    cube.transform.localRotation = action.mainTransform.localrotation;

                    if (action.hasArrow)
                    {
                        GameObject arrow = (GameObject)Instantiate(directionArrowPrefab);
                        arrow.name = "arrow";
                        arrow.transform.SetParent(cube.transform);
                        arrow.transform.localScale    = action.directionTransform.localscale;
                        arrow.transform.localPosition = action.directionTransform.localposition;
                        arrow.transform.localRotation = action.directionTransform.localrotation;
                    }


                    OperatorData cubeData = cube.GetComponent <OperatorData>();
                    cubeData.createTime  = action.createTime;
                    cubeData.actionName  = operatorobj.name;
                    cubeData.parentFloor = action.parentFloor;
                    cubeData.actionType  = action.actionType;
                    cubeData.localscale  = action.mainTransform.localscale;

                    storedData.Operators.Add(cube);
                    storedData.isUpdated = true;
                }
            }
        }
        if (operatorCreateTime != null)
        {
            bigSizeWhenchosen(operatorCreateTime);
        }
    }
Ejemplo n.º 12
0
    // Update is called once per frame
    void Update()
    {
        if (btnclicked)
        {
            if (storeData.gameObject.GetComponent <MapObj>().currentFloorName.Equals(storeData.gameObject.GetComponent <CommonControl>().tempCurrentFloorName))
            {
                GameObject displayMap = storeData.gameObject.GetComponent <CommonControl>().displayMap;
                //displayMap.transform.Rotate(0, -tempRotation.y * Time.deltaTime, 0, Space.Self);
                //displayMap.transform.Rotate(-tempRotation.x * Time.deltaTime, 0, 0, Space.World);

                displayMap.transform.rotation = Quaternion.Lerp(displayMap.transform.rotation, tempRotation, 7 * Time.deltaTime);
                if (displayMap.transform.rotation == tempRotation)
                {
                    btnclicked = false;
                    if (DataObj.isUserOwn)
                    {
                        storeData.gameObject.GetComponent <CommonControl>().SimpleShowOrHide();
                    }
                    else
                    {
                        storeData.gameObject.GetComponent <CommonControl>().ShowSelectionMenu();
                    }
                }
                storeData.gameObject.GetComponent <CommonControl>().bigSizeWhenchosen(storeData.gameObject.GetComponent <CommonControl>().operatorCreateTime);
                //storeData.gameObject.GetComponent<CommonControl>().ShowSelectionMenu();
            }
        }

        if (storeData != null)
        {
            if (storeData.isUpdated)
            {
                storeData.isUpdated = false;

                foreach (Transform button in transform.GetComponentsInChildren <Transform>())
                {
                    if (button.gameObject.tag.Equals("DetailStep"))
                    {
                        Destroy(button.gameObject);
                    }
                }

                StepDetail stepDetail = storeData.newStrategy.steps[storeData.chosenStepIndex];
                if (stepDetail.detailActions != null)
                {
                    for (int i = 0; i < stepDetail.detailActions.Count; i++)
                    {
                        GameObject newBtn = (GameObject)Instantiate(buttonPrefab);
                        newBtn.transform.SetParent(transform);
                        newBtn.transform.localScale = new Vector3(1f, 1f, 1f);
                        StepDetailAction action = stepDetail.detailActions[i];
                        DetailStep       item   = newBtn.GetComponent <DetailStep>();
                        item.btnTitle.text = "Click button and tap Operator to add information";
                        item.btnCreateTime = action.createTime;
                        Debug.Log(action.actionName);
                        if (action.imageType)
                        {
                            if (action.stepImageUrl != null)
                            {
                                if (File.Exists(DataObj.cachePath + action.stepImageUrl.GetHashCode()))
                                {
                                    StartCoroutine(LoadLocalImage(action.stepImageUrl, item.btnIcon));
                                }
                                else
                                {
                                    StartCoroutine(DownloadImage(action.stepImageUrl, item.btnIcon));
                                }
                                StartCoroutine(DownloadImage(action.stepImageUrl, item.btnIcon));
                            }
                            else
                            {
                                Texture2D texture = new Texture2D(Screen.width, Screen.height);
                                texture.LoadImage(action.imageData);

                                Sprite sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f));
                                item.btnIcon.sprite = sprite;
                            }
                        }
                        else
                        {
                            item.btnIcon.sprite = Resources.Load <Sprite>("Images/OperatorImage/" + action.actionName);
                        }
                        item.scrollviewScript = this;
                        if (action.actionInfo != null)
                        {
                            item.btnTitle.text = action.actionInfo;
                        }
                    }
                }
            }
        }
    }