예제 #1
0
 static public int get_draggableCamera(IntPtr l)
 {
     try {
         UIDragCamera self = (UIDragCamera)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.draggableCamera);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #2
0
 static public int set_draggableCamera(IntPtr l)
 {
     try {
         UIDragCamera      self = (UIDragCamera)checkSelf(l);
         UIDraggableCamera v;
         checkType(l, 2, out v);
         self.draggableCamera = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #3
0
    public override void setEnable(bool flag)
    {
        base.setEnable(flag);

        //m_ListView.GetComponent<NvUIBase>().setEnable( flag );

        if (listBaseImage != null)
        {
            listBaseImage.setEnable(flag);
        }

        foreach (NvUIListItemBase item in itemList)
        {
            //GameObject.Destroy( item.gameObject );
            UIDragCamera obj = item.transform.GetComponent <UIDragCamera>();
            if (obj != null)
            {
                obj.enabled = flag;
            }
        }
    }
예제 #4
0
    public btNodeSelectTile CreateNewTile(btInterfaceTreeManager.INODE_TYPE _nodeType)
    {
        if (this.nodeTilePrefab == null)
        {
            Debug.LogError("No node tile prefab defined", this);
            return(null);
        }

        GameObject tileObj = GameObject.Instantiate(this.nodeTilePrefab) as GameObject;

        tileObj.transform.parent     = this.gridTransform;
        tileObj.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);
        btNodeSelectTile tileScript = tileObj.GetComponent <btNodeSelectTile>();

        if (tileScript == null)
        {
            Debug.LogError("Could not find tile script on node tile prefab.", tileObj);
            return(null);
        }
        tileScript.nodeType = _nodeType;

        UIDragCamera dragCameraScript = tileObj.GetComponent <UIDragCamera>();

        if (dragCameraScript == null)
        {
            Debug.LogError("No UIDragCamera script found on tile prefab.", tileObj);
            return(tileScript);
        }
        dragCameraScript.draggableCamera = this.draggableCamera;

        tileScript.buttonScript.nodeType = _nodeType;
        GameObject tempObj = new GameObject();

        tempObj.SetActive(false);
        System.Type type = btInterfaceTreeManager.GetInterfaceNodeType(_nodeType);
        if (type == null)
        {
            Debug.LogError("Could not find matching type for " + _nodeType);
        }
        else
        {
            btInterfaceNode nodeScript   = tempObj.AddComponent(type) as btInterfaceNode;
            string          materialPath = nodeScript.GetIconMaterialPath();
            Object          iconResource = Resources.Load(materialPath);
            if (iconResource == null)
            {
                Debug.LogError("Cannot find material with path \"" + materialPath + "\"");
            }
            else
            {
                Material iconMaterial = iconResource as Material;
                if (iconMaterial == null)
                {
                    Debug.LogError("Resource \"" + iconResource.name
                                   + "\" at path \"" + materialPath
                                   + "\" cannot be converted into a meterial.");
                }
                else
                {
                    tileScript.texture.material = iconMaterial;
                }
            }

            tileScript.label.text = nodeScript.GetDisplayLabel();
        }

        Destroy(tempObj);
        return(tileScript);
    }
예제 #5
0
    private void OnReposition()
    {
        for (int i = 0; i < infoContent.transform.childCount; ++i)
        {
            Destroy(infoContent.transform.GetChild(i).gameObject);
        }
        string[,] array = null;
        if (!string.IsNullOrEmpty(product.details))
        {
            JsonData jd = JsonMapper.ToObject(product.details);
            if (jd.IsArray)
            {
                array = new string[jd.Count + 1, 2];
                for (int i = 0; i < jd.Count; ++i)
                {
                    array[i + 1, 0] = (string)jd[i]["key"];
                    array[i + 1, 1] = (string)jd[i]["value"];
                }
            }
        }
        if (array == null)
        {
            array = new string[1, 2];
        }
        array[0, 0] = "";
        array[0, 1] = product.name;

        UILabel label = labelPrefab.transform.Find("Content").gameObject.GetComponent <UILabel>();

        NGUIText.fontSize  = label.fontSize;
        NGUIText.fontStyle = label.fontStyle;
        NGUIText.rectWidth = label.width;
        NGUIText.Update();

        int        yOffset   = 0;
        int        lineSpace = 15;
        UIViewport vp        = scrollCamera.GetComponent <UIViewport>();
        int        height    = (int)(vp.topLeft.localPosition.y - vp.bottomRight.localPosition.y);

        for (int i = 0; i < array.Length / 2; ++i)
        {
            GameObject row          = NGUITools.AddChild(infoContent, labelPrefab);
            UILabel    nameLabel    = row.transform.Find("Name").gameObject.GetComponent <UILabel>();
            UILabel    contentLabel = row.transform.Find("Content").gameObject.GetComponent <UILabel>();
            nameLabel.text    = array[i, 0];
            contentLabel.text = array[i, 1];
            BoxCollider  bc = row.GetComponent <BoxCollider>();
            UIDragCamera dc = row.GetComponent <UIDragCamera>();
            dc.draggableCamera = scrollCamera.GetComponent <UIDraggableCamera>();
            Vector2 rect = NGUIText.CalculatePrintedSize(array[i, 1]);
            if (i == array.Length / 2 - 1 && Math.Abs(yOffset - (int)rect.y - lineSpace) < height)
            {
                contentLabel.height = height - Math.Abs(yOffset);
            }
            else
            {
                contentLabel.height = (int)rect.y;
            }
            bc.center = new Vector3(0, -(contentLabel.height + lineSpace) / 2, 0);
            bc.size   = new Vector3(bc.size.x, contentLabel.height + lineSpace, 0);
            row.transform.localPosition = new Vector3(0, yOffset, 0);
            yOffset -= (int)rect.y + lineSpace;
        }
    }