コード例 #1
0
    public void OnClick()//被点击
    {
        panelItemWarehouseController.SwitchItemsItem(gameObject);
        var timeNow = Time.realtimeSinceStartup;

        if (timeNow - timeLastClick < MIN_CLICK_TIME_GAP)//判定为双击
        {
            objManager.LoadObj(objAbsolutePath);
        }
        timeLastClick = timeNow;
    }
コード例 #2
0
    public void ButtonImportModelOnClick()//ImportModel按钮被点击
    {
        CloseFilePanel();
        OpenFileName ofn = new OpenFileName();

        ofn.structSize   = Marshal.SizeOf(ofn);
        ofn.filter       = "3d文件(*.obj)\0*.obj";
        ofn.file         = new string(new char[256]);
        ofn.maxFile      = ofn.file.Length;
        ofn.fileTitle    = new string(new char[64]);
        ofn.maxFileTitle = ofn.fileTitle.Length;
        ofn.initialDir   = Application.streamingAssetsPath.Replace('/', '\\');//默认路径
        ofn.title        = "导入3d模型";
        ofn.flags        = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000008;
        if (LocalDialog.GetOpenFileName(ofn))
        {
            Debug.Log("file: " + ofn.file);
            objManager.LoadObj(ofn.file);
        }
    }