Example #1
0
    /// <summary>
    /// 执行新的命令
    /// </summary>
    public void ExecutiveCommand(BaseCommand command)
    {
        if (CloseCommandCompent)
        {
            return;
        }
        indexId++;
        CommandList db_command = new CommandList
        {
            id        = indexId,
            modelInfo = Vesal_DirFiles.Object2Bytes(new SceneModelState()),
        };

        local_db.DataService("Command.db");
        local_db.Insert(db_command);
        local_db.Close();
        DebugLog.DebugLogInfo("插入命令 " + indexId);
        command.ExecuteCommand();
        this.CanOperaCommand(true);
    }
Example #2
0
    IEnumerator ScreenShot(string shotname)
    {
        //关闭页面
        SetBookmarkPanel(false);

#if UNITY_EDITOR || UNITY_STANDALONE_WIN
        ScreenCapture.CaptureScreenshot(PublicClass.filePath + shotname + ".png");
        yield return(new WaitForSeconds(0.7f));
#else
        //截屏获取图片
        Application.CaptureScreenshot(shotname + ".png");      //截屏
        while (true)
        {
            if (!File.Exists(PublicClass.filePath + shotname + ".png"))
            {
                yield return(null);
            }
            else
            {
                break;
            }
        }
#endif
        yield return(null);

        DebugLog.DebugLogInfo("截屏");
        string imagePath = string.Empty;
        // #if UNITY_EDITOR
        //         imagePath = shotname + ".png";
        // #else
        imagePath = PublicClass.filePath + shotname + ".png";
        // #endif
        DebugLog.DebugLogInfo("截屏保存路径:" + imagePath);
        //记录数据

        //创建一个新书签,传入当前时间为id,书签名称,装载图片数据流,序列化模型状态,开关状态以及摄像机参数
        BookMarkInfo bookMarkInfo = new BookMarkInfo()
        {
            //id = index,
            bookmarkType    = PublicClass.app.app_id,
            bookmarkName    = shotname,
            type            = (MainConfig.isSaveFixBookmarkMode) ? "0" : "1",
            bookmarkPicture = File.ReadAllBytes(imagePath),
            modelState      = Vesal_DirFiles.Object2Bytes(new SceneModelState()),
            btnState        = Vesal_DirFiles.Object2Bytes(new SceneBtnState()),
            cameraParams    = Vesal_DirFiles.Object2Bytes(new CameraParams())
        };
        BookMark bookMark = new BookMark();
        bookMark.markInfo = bookMarkInfo;

        //插入书签封装类对象
        if (MainConfig.isSaveFixBookmarkMode)
        {
            local_db.DataService("FixCommand.db");
        }
        else
        {
            local_db.DataService("Command.db");
        }
        local_db.Insert(bookMarkInfo);
        local_db.Close();
        //.insertOne<Customer, int>(customer, customer._id);
        DebugLog.DebugLogInfo("创建书签 " + shotname);
        BaseCommand command = new PlayerCommand();
        command.ExecuteCommand();
        DebugLog.DebugLogInfo("书签信息 " + bookMarkInfo.bookmarkName);

        //书签列表
        BookmarkList.Add(bookMark);

        CreateBookmarkPanel();

        SetBookmarkPanel(true);
    }
Example #3
0
    IEnumerator ScreenShot(string shotname)
    {
        //关闭页面
        //  SetBookmarkPanel(false);
        Debug.Log("11111111111111111111111");
        BookMarkInfo bookMarkInfo = new BookMarkInfo()
        {
            //id = index,
            bookmarkType = PublicClass.app.app_id,
            bookmarkName = shotname,
            //  bookmarkPicture = File.ReadAllBytes(imagePath),
            modelState   = Vesal_DirFiles.Object2Bytes(new SceneModelState()),
            btnState     = Vesal_DirFiles.Object2Bytes(new SceneBtnState()),
            cameraParams = Vesal_DirFiles.Object2Bytes(new CameraParams())
        };
        BookMark bookMark = new BookMark();

        bookMark.markInfo = bookMarkInfo;

        //插入书签封装类对象
        // local_db.DataService("Command.db");
        // local_db.Insert(bookMarkInfo);
        //  local_db.Close();
        //.insertOne<Customer, int>(customer, customer._id);
        DebugLog.DebugLogInfo("创建书签 " + shotname);
        BaseCommand command = new PlayerCommand();

        command.ExecuteCommand();
        DebugLog.DebugLogInfo("书签信息 " + bookMarkInfo);

        string strJson = JsonConvert.SerializeObject(bookMarkInfo);
        // StateData.Instance.StatePath.Add(strJson);

        //string path = @PublicClass.filePath + "StateSave/" + PublicClass.app.app_id+".Json";
        string       path = @PublicClass.BookMarkPath + PublicClass.app.app_id + ".Json";
        StreamWriter sw;
        FileInfo     file = new FileInfo(path);

        if (!file.Exists)
        {
            //如果此文件不存在则创建
            sw = file.CreateText();
        }
        else
        {
            //如果此文件存在则打开
            file.Delete();
            sw = file.CreateText();
        }
        sw.WriteLine(strJson);
        //注意释放资源
        sw.Close();
        sw.Dispose();


        yield return(0);

        Debug.Log("保存完成");
        yield return(null);
        //记录数据

        //创建一个新书签,传入当前时间为id,书签名称,装载图片数据流,序列化模型状态,开关状态以及摄像机参数
    }