Exemple #1
0
    public void Select(bool isSelect)
    {
        Tool.GetChildInDepth("Select", this.gameObject).SetActive(isSelect);

        if (isSelect)
        {
            if (selectScannerGrid != null)
            {
                selectScannerGrid.Select(false);
            }
            selectScannerGrid = this;
            Tool.GetChildInDepth("MaskInputField", SingletonTMono <Scanners> .Instance.maskUI).GetComponent <InputField> ().text = buildingID;
        }
        else
        {
            selectScannerGrid = null;
        }

        this.bSelect = isSelect;
    }
    /// <summary>
    /// Loads the color sampler objects from a JSON.
    /// </summary>
    private void LoadScannerSettings()
    {
        LoadBuildingSetting();

        LoadDock0Setting();

        Debug.Log("Loading color sampling settings from  " + _colorSettingsFileName);

        string dataAsJson = JsonParser.loadJSON(_colorSettingsFileName, _debug);

        if (String.IsNullOrEmpty(dataAsJson))
        {
            Debug.Log("No such file: " + _colorSettingsFileName);
            return;
        }



        colorSettings = JsonUtility.FromJson <ColorSettings>(dataAsJson);

        if (colorSettings == null)
        {
            return;
        }
        if (colorSettings.color == null)
        {
            return;
        }

        for (int i = 0; i < colorSettings.color.Count; i++)
        {
            sampleColors[i] = colorSettings.color[i];
            colorRefSpheres[(ColorClassifier.SampleColor)i].GetComponent <Renderer>().material.color = colorSettings.color[i];
            colorRefSpheres[(ColorClassifier.SampleColor)i].transform.localPosition = new Vector3(colorSettings.color[i].r, colorSettings.color[i].g, colorSettings.color[i].b);
        }

        _gridParent.transform.position = colorSettings.gridPosition;

        //dock.SetDockPosition(colorSettings.dockPosition);

        //if (colorSettings.maskPointData != null && maskerList != null)
        //{
        //    int maskIndex = 0;

        //    for (int x = 0; x < numOfScannersX; x++)
        //    {
        //        for (int y = 0; y < numOfScannersY; y++)
        //        {
        //            if (maskIndex < colorSettings.maskPointData.Count)
        //                //maskerList[x, y].SetMask(colorSettings.mask[maskIndex] == 1 ? true : false);
        //                maskerList[x, y].SetMask(colorSettings.maskPointData[maskIndex]);

        //            maskIndex++;
        //        }
        //    }
        //}


        if (colorSettings.girdDataList != null)
        {
            this.groupList.Clear();
            foreach (GridData data in this.colorSettings.girdDataList)
            {
                GameObject go = (GameObject)GameObject.Instantiate(Resources.Load("Grid"));
                go.transform.position = data.position;
                go.transform.parent   = this.transform;
                ScannerGridGroup gridGroup = go.GetComponent <ScannerGridGroup>();
                gridGroup.buildingID = data.buildingID;
                gridGroup.SetScale(data.scale);
                gridGroup.Select(false);
                this.groupList.Add(gridGroup);
                go.GetComponent <ScannerGridGroup>().SetIsShow(SingletonTMono <Scanners> .Instance.bShowGrid);
            }
        }
    }