Exemple #1
0
    public static void saveFile()
    {
        SaveFileName sfn = new SaveFileName();

        sfn.structSize = Marshal.SizeOf(sfn);

        sfn.filter = "All Files\0*.*\0\0";

        sfn.file = new string (new char[256]);

        sfn.maxFile = sfn.file.Length;

        sfn.fileTitle = new string (new char[64]);

        sfn.maxFileTitle = sfn.fileTitle.Length;

        sfn.initialDir = UnityEngine.Application.dataPath;

        sfn.title = "Attache file to your email";

        sfn.defExt = "png";
        sfn.flags  = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008;
        //OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST| OFN_ALLOWMULTISELECT|OFN_NOCHANGEDIR

        if (DllSave.GetSaveFileName(sfn))
        {
            //Debug.Log("Nom du fichier a sauvegardé : "+sfn.file);
            Application.CaptureScreenshot(sfn.file, imageSmooth);
        }
    }
    private void OnGUI()
    {
        // This method will show on the screen all the button when we'll login at, as
        if (Network.isServer)
        {
            registerGUI();
            switch (i)
            {
            case 6:
                if (GUI.Button(new Rect(Screen.width - texture.width - 10, 5, texture.width, texture.height), texture))
                {
                    // Here's go the code for regestring new user
                    showInventory = !showInventory;
                }
                break;
            }
        }
        // Log in as Expert (type)
        if (Network.isClient && (cameraBehaviour_scripts.webSelected))
        {
            if ((clientType == "worker" || clientType == "expert") && i < 5)
            {
                switch (i)
                {
                case 1:
                    if (GUI.Button(new Rect(Screen.width - texture.width - 10, 5, texture.width, texture.height), texture))
                    {
                        sendMailBox_scripts.showInventory = !sendMailBox_scripts.showInventory;
                    }
                    break;

                case 2:
                    if (GUI.Button(new Rect(Screen.width - 2 * texture.width - 15, 5, texture.width, texture.height), texture))
                    {
                        screenShot_scripts.saveFile();
                    }
                    break;

                case 4:
                    if (GUI.Button(new Rect(Screen.width - 4 * texture.width - 25, 5, texture.width, texture.height), texture))
                    {
                        SaveFileName ofn = new SaveFileName();

                        ofn.structSize = Marshal.SizeOf(ofn);

                        ofn.filter = "All Files\0*.*\0\0";

                        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 = UnityEngine.Application.dataPath;

                        ofn.title = "Save Report Log";

                        ofn.defExt = "txt";
                        ofn.flags  = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008;                       //OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST| OFN_ALLOWMULTISELECT|OFN_NOCHANGEDIR

                        if (DllSave.GetSaveFileName(ofn))
                        {
                            StartCoroutine(WaitLoad(ofn.file));
                        }
                    }
                    break;
                }
            }
            // Log in as worker (type)
            if (clientType == "worker")
            {
                switch (i)
                {
                case 7:
                    if (GUI.Button(new Rect(Screen.width - 6 * texture.width - 35, 5, texture.width, texture.height), texture))
                    {
                        // Change the voice mode: enale/disable voice recongnition
                        int indexCombo = ARComboBox_scripts.selectedItem_;
                        switch (indexCombo)
                        {
                        case 0:
                            GameObject.Find("Bugatti-Veyron").GetComponent <NetworkView>().RPC("reloadObject", RPCMode.Server, true);
                            break;

                        case 1:
                            GameObject.Find("lamborghini").GetComponent <NetworkView>().RPC("reloadObject", RPCMode.Server, true);
                            break;

                        case 2:
                            GameObject.Find("Car").GetComponent <NetworkView>().RPC("reloadObject", RPCMode.Server, true);
                            break;
                        }
                    }
                    break;
                }
            }
        }
    }