Пример #1
0
 public void initresult(bool result)
 {
     if (!result)
     {
         clearChilds();
     }
     local_db.Close();
     local_db = null;
 }
Пример #2
0
        public static void GetAbfile2(string from_path, string temp_path)
        {
            byte[] data = new byte[1024];
            if (!File.Exists(from_path))
            {
                return;
            }

            var local_db = new DbRepository <Abfiles>();

            local_db.DataService("vesali.db");
            Abfiles res = local_db.SelectOne <Abfiles>((temp) =>
            {
                if (temp.file_name == get_file_name_from_full_path(from_path))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            });

            if (res == null)
            {
                local_db.Close();
                return;
            }
            local_db.Close();
            byte[]     data1   = Convert.FromBase64String(res.head);
            FileStream FileOut = new FileStream(temp_path, System.IO.FileMode.Create, System.IO.FileAccess.ReadWrite, FileShare.ReadWrite);

            FileOut.Write(data1, 0, data1.Length);

            FileStream FileIn = new FileStream(from_path, System.IO.FileMode.Open, System.IO.FileAccess.Read);
            //将此剩余字节写入temp_path
            int readLen;

            while (true)
            {
                readLen = FileIn.Read(data, 0, data.Length);
                if (readLen <= 0)
                {
                    break;
                }
                FileOut.Write(data, 0, readLen);
            }
            FileOut.Flush();
            FileIn.Close();
            FileOut.Close();

            //            vesal_log.vesal_write_log("load model phase 2 start: " + DateTime.Now.Ticks);
        }
Пример #3
0
        public string getType(string modelId)
        {
            var local_db = new DbRepository <GetStructList>();

            local_db.DataService("vesali.db");
            GetStructList tmpIe = local_db.SelectOne <GetStructList>((tempNo) =>
            {
                if (tempNo.nounNo == modelId)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            });

            if (tmpIe == null)
            {
                local_db.Close();
                return(null);
            }
            local_db.Close();
            string result = null;

            if (tmpIe.nounType == "1")
            {
                int    founded  = 0;
                string jsonPath = Application.persistentDataPath.Substring(0, Application.persistentDataPath.LastIndexOf("AppData") + 7) + "/roaming/Vesal/sign/NewAndOldSign.json";
                Dictionary <int, NewAndOldSign> nao = JsonConvert.DeserializeObject <Dictionary <int, NewAndOldSign> >(File.ReadAllText(jsonPath));
                foreach (NewAndOldSign tmpNao in nao.Values)
                {
                    if (modelId == tmpNao.app_id_old && tmpNao.app_id_new != "")
                    {
                        founded = 1;
                        result  = "newSign@" + tmpNao.app_id_new;
                        break;
                    }
                }
                if (founded == 0)
                {
                    result = "oldSign@" + tmpIe.nounName;
                }
            }
            else
            {
                result = "model";
            }
            return(result);
        }
Пример #4
0
    //读取贴图相关列表
    void ReadTexTable()
    {
        tex_db = new DbRepository <StartStopTex>();

        tex_db.CreateDb(db_path);

        var tmpssp = tex_db.Select <StartStopTex>((ss_id) =>
        {
            if (ss_id != null)
            {
                //DebugLog.DebugLogInfo(ss_id.bone_name+" "+ss_id.main_tex+" "+ ss_id.mask_tex);
                return(true);
            }
            else
            {
                return(false);
            }
        });

        texInfoList = new List <StartStopTex>();

        foreach (StartStopTex tmp in tmpssp)
        {
            if (tmp.bone_name != null)
            {
                texInfoList.Add(tmp);
            }
        }

        tex_db.Close();
    }
Пример #5
0
    List <string> GetNounoNameList(string app_id)
    {
        List <string> submodelList = new List <string>();
        var           local_db     = new DbRepository <GetStructList>();

        //获取名词范围
        local_db.DataService("vesali.db");
        GetStructList tmpIe = local_db.SelectOne <GetStructList>((tempNo) =>
        {
            if (tempNo.nounNo == app_id)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        });

        if (tmpIe == null)
        {
            local_db.Close();
        }
        submodelList = new List <string>(JsonConvert.DeserializeObject <Dictionary <string, float> >(tmpIe.submodelList).Keys);
        return(submodelList);
    }
Пример #6
0
        public void setCacheJson(string r)
        {
            var repository = new RemoteRepository <GetStruct>();

            Debug.Log(r + "-------------------------------------------------------");
            repository.Get <Response <T> >(r, new GetStruct {
                device = SystemInfo.deviceUniqueIdentifier, level = ((int)PublicClass.Quality).ToString(), softVersion = PublicClass.get_version()
            }, (response) =>
            {
                if (response.List != null && response.List.Count != 0)
                {
                    Debug.Log("============读取数据库缓存更新,从远程拉取数据,更新版本号=================== ");
                    var db = new DbRepository <T>();
                    db.DataService("vesali.db");
                    db.DropTable();
                    db.CreateTable();
                    db.InsertAll(response.List);//更新远程数据源
                    db.Close();
                }
                else
                {
                    Debug.Log("-----------------Struct List data is null ");
                    // Debug.Log("============读取数据库缓存=================== ");
                }
            });
        }
Пример #7
0
    public static void opera_condition(string db_path, Action <List <T> > ac)
    {
        DbRepository <T> temp_db = new DbRepository <T>();

        temp_db.CreateDb(db_path);
        temp_db.CreateTable();
        //db 原数据
        List <T> mask_name_list = new List <T>();
        var      tmpssp         = temp_db.Select <T>((ss_id) =>
        {
            if (ss_id != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        });

        foreach (var item in tmpssp)
        {
            mask_name_list.Add(item);
        }
        Debug.Log("写入mask texture 数据成功");
        temp_db.Close();
        ac(mask_name_list);
    }
Пример #8
0
        public void setCache_dbPath(string r, string path, bool is_append = false)
        {
            var repository = new RemoteRepository <GetStruct>();

            repository.Get <Response <T> >(r, (response) =>
            {
                Debug.Log(JsonConvert.SerializeObject(response));
                if (response.List != null && response.List.Count != 0)
                {
                    Debug.Log("============读取数据库缓存更新,从远程拉取数据,更新版本号=================== ");
                    var db = new DbRepository <T>();
                    db.CreateDb(path);
                    if (!is_append)
                    {
                        db.DropTable();
                    }
                    db.CreateTable();
                    db.InsertAll(response.List);//更新远程数据源
                    db.Close();
                }
                else
                {
                    Debug.Log("Struct List data is null ");
                }
            });
        }
Пример #9
0
    public static List <string> get_table_list(string dbfile)
    {
        List <string>          tablelist = new List <string>();
        DbRepository <FixTabs> temp_db;

        temp_db = new DbRepository <FixTabs>();
        temp_db.DataService(dbfile);
        temp_db.CreateTable();
        IEnumerable <FixTabs> res = temp_db.Select <FixTabs>((temp_fbx) =>
        {
            if (temp_fbx.tab_name != "")
            {
                return(true);
            }
            else
            {
                return(false);
            }
        });

        if (res.GetEnumerator().MoveNext())
        {
            foreach (FixTabs item in res)
            {
                if (item.tab_name != "")
                {
                    tablelist.Add(item.tab_name);
                }
            }
        }
        temp_db.Close();
        return(tablelist);
    }
Пример #10
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);
    }
Пример #11
0
    private void Start()
    {
        if (CloseBookMarkComponet)
        {
            return;
        }
        BookmarkList = new List <BookMark>();
        //获取本地db库, 记录mark数据表,生成
        local_db = new DbRepository <BookMarkInfo>();
        local_db.DataService("Command.db");
        local_db.CreateTable();
        local_db.Close();

        local_db.DataService("FixCommand.db");
        local_db.CreateTable();
        local_db.Close();

        ReadBookMark();
        //ReadJson(PublicClass.BookMarkPath);
    }
Пример #12
0
    public static void update_noun_no_info_db(string dbfile)
    {
        DbRepository <noun_no_info> temp_db;

        temp_db = new DbRepository <noun_no_info>();
        temp_db.DataService(dbfile);
        temp_db.CreateTable();
        IEnumerable <noun_no_info> res = temp_db.Select <noun_no_info>((temp_fbx) =>
        {
            if (temp_fbx.sn_id != "")
            {
                return(true);
            }
            else
            {
                return(false);
            }
        });


        if (res.GetEnumerator().MoveNext())
        {
            DbRepository <noun_no_info> anim_db;
            anim_db = new DbRepository <noun_no_info>();
            anim_db.DataService("vesali.db");
            foreach (noun_no_info item in res)
            {
                noun_no_info fbx_info = anim_db.SelectOne <noun_no_info>((temp_fbx_anim) =>
                {
                    if (temp_fbx_anim.sn_id == item.sn_id)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                });


                if (fbx_info != null)
                {
                    anim_db.Update(item);
                }
                else
                {
                    anim_db.Insert(item);
                }
            }
            anim_db.Close();
        }
        temp_db.Close();
    }
Пример #13
0
    public static void update_RightMenuModel_db(string dbfile)
    {
        DbRepository <RightMenuModel> temp_db;

        temp_db = new DbRepository <RightMenuModel>();
        temp_db.DataService(dbfile);
        temp_db.CreateTable();
        IEnumerable <RightMenuModel> res = temp_db.Select <RightMenuModel>((temp_fbx) =>
        {
            if (temp_fbx.rm_id >= 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        });


        if (res.GetEnumerator().MoveNext())
        {
            DbRepository <RightMenuModel> anim_db;
            anim_db = new DbRepository <RightMenuModel>();
            anim_db.DataService("vesali.db");
            foreach (RightMenuModel item in res)
            {
                RightMenuModel fbx_info = anim_db.SelectOne <RightMenuModel>((temp_fbx_anim) =>
                {
                    if (temp_fbx_anim.rm_id == item.rm_id)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                });


                if (fbx_info != null)
                {
                    anim_db.Update(item);
                }
                else
                {
                    anim_db.Insert(item);
                }
            }
            anim_db.Close();
        }
        temp_db.Close();
    }
Пример #14
0
    public static void update_condition(List <T> struct_lsit, string db_path)
    {
        DbRepository <T> temp_db = new DbRepository <T>();

        temp_db.CreateDb(db_path);
        foreach (var item in struct_lsit)
        {
            temp_db.Update(item);
        }
        Debug.Log("写入mask texture 数据成功");
        temp_db.Close();
    }
Пример #15
0
    public static void update_GetTextureModelList_db(string dbfile)
    {
        DbRepository <GetTextureModelList> temp_db;

        temp_db = new DbRepository <GetTextureModelList>();
        temp_db.DataService(dbfile);
        temp_db.CreateTable();
        IEnumerable <GetTextureModelList> res = temp_db.Select <GetTextureModelList>((temp_fbx) =>
        {
            if (temp_fbx.tex_name != "")
            {
                return(true);
            }
            else
            {
                return(false);
            }
        });


        if (res.GetEnumerator().MoveNext())
        {
            DbRepository <GetTextureModelList> anim_db;
            anim_db = new DbRepository <GetTextureModelList>();
            anim_db.DataService("vesali.db");
            foreach (GetTextureModelList item in res)
            {
                GetTextureModelList fbx_info = anim_db.SelectOne <GetTextureModelList>((temp_fbx_anim) =>
                {
                    if (temp_fbx_anim.tex_name == item.tex_name)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                });


                if (fbx_info != null)
                {
                    anim_db.Update(item);
                }
                else
                {
                    anim_db.Insert(item);
                }
            }
            anim_db.Close();
        }
        temp_db.Close();
    }
Пример #16
0
    //贴图记录工具
    public static void SetTextureDataToDB(string texture_path, string db_fullname)
    {
        print("<Color=#00ff00> db路径 :" + db_fullname + " </color>");
        List <string> list = new List <string>();

        list.AddRange(Vesal_DirFiles.GetAllDirInfoFromPath(texture_path));
        print("<Color=#00ff00> 贴图列表长度 :" + list.Count + "</color>");
        DbRepository <texture_mask> temp_db = new DbRepository <texture_mask>();

        // temp_db.DataService("StartStop.db");
        temp_db.CreateDb(db_fullname);
        temp_db.CreateTable();
        //db 原数据
        List <string> mask_name_list = new List <string>();
        var           tmpssp         = temp_db.Select <texture_mask>((ss_id) =>
        {
            if (ss_id != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        });

        for (int i = 0; i < list.Count; i++)
        {
            texture_mask temp_mask = new texture_mask
            {
                id       = i + 1,
                name     = Vesal_DirFiles.get_file_name_from_full_path(list[i]),
                tex_data = File.ReadAllBytes(list[i]),// Vesal_DirFiles.Object2Bytes(new SceneModelState()),
            };
            bool has_record = false;
            foreach (texture_mask tmp in tmpssp)
            {
                if (temp_mask.name == tmp.name)
                {
                    temp_db.Update(temp_mask);
                    has_record = true;
                    print("update : " + temp_mask.name);
                }
            }
            if (has_record == false)
            {
                temp_db.Insert(temp_mask);
            }
        }

        Debug.Log("写入mask texture 数据成功");
        temp_db.Close();
    }
Пример #17
0
        public static void GetAbfile_Synchronize(string from_path, string temp_path)
        {
            if (!File.Exists(from_path))
            {
                UnityEngine.Debug.LogError("!File.Exists : " + from_path);
                return;
            }
            var local_db = new DbRepository <Abfiles>();

            local_db.DataService("vesali.db");
            Abfiles res = local_db.SelectOne <Abfiles>((temp) => {
                if (temp.file_name == get_file_name_from_full_path(from_path))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            });

            if (res == null)
            {
                UnityEngine.Debug.LogError("res == null");
                local_db.Close();
                return;
            }

            byte[] data = new byte[1024];
            data = Convert.FromBase64String(res.head);

            FileStream FileOut = new FileStream(temp_path, System.IO.FileMode.Create);

            FileOut.Write(data, 0, 1024);

            FileStream FileIn = new FileStream(from_path, System.IO.FileMode.Open);
            //将此剩余字节写入temp_path
            int readLen;

            while (true)
            {
                readLen = FileIn.Read(data, 0, data.Length);
                if (readLen <= 0)
                {
                    break;
                }

                FileOut.Write(data, 0, readLen);
            }

            FileOut.Close();
            FileIn.Close();
        }
Пример #18
0
    public static void Update_db_table(string dbfile)
    {
        DbRepository <T> temp_db;

        temp_db = new DbRepository <T>();
        temp_db.DataService(dbfile);
        temp_db.CreateTable();
        IEnumerable <T> res = temp_db.Select <T>((temp_fbx) =>
        {
            if (temp_fbx != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        });

        if (res.GetEnumerator().MoveNext())
        {
            DbRepository <T> anim_db;
            anim_db = new DbRepository <T>();
            anim_db.DataService("vesali.db");
            foreach (T item in res)
            {
                T fbx_info = anim_db.SelectOne <T>((temp_fbx_anim) =>
                {
                    // if (temp_fbx_anim.ab_name == item.ab_name)
                    // {
                    //     return true;
                    // }
                    // else
                    // {
                    return(false);
                    // }
                });


                if (fbx_info != null)
                {
                    anim_db.Update(item);
                }
                else
                {
                    anim_db.Insert(item);
                }
            }
            anim_db.Close();
        }
        temp_db.Close();
    }
Пример #19
0
    //从数据库中读取起止点相关信息,并将起点颜色信息,止点颜色信息提取出来
    void ReadSSPTable()
    {
        Model[] models = SceneModels.instance.Get_scope_models();
        local_db = new DbRepository <StartStopInfo>();
        local_db.CreateDb(db_path);
        var tmpssp = local_db.Select <StartStopInfo>((mod_name) =>
        {
            if (mod_name != null)
            {
                //DebugLog.DebugLogInfo(string.Format("起点({0},{1},{2}),止点({3},{4},{5})", mod_name.qr, mod_name.qg, mod_name.qb, mod_name.zr, mod_name.zg, mod_name.zb));
                return(true);
            }
            else
            {
                return(false);
            }
        });

        sspInfoList = new List <StartStopInfo>();

        foreach (StartStopInfo tmp in tmpssp)
        {
            for (int i = 0; i < models.Length; i++)
            {
                if (tmp.mod_name == models[i].name)
                {
                    sspInfoList.Add(tmp);
                }
            }
        }

        local_db.Close();
        for (int i = 0; i < sspInfoList.Count; i++)
        {
            StartStopPoint point = new StartStopPoint(sspInfoList[i]);
            sspList.Add(point);


            GameObject tempMark = Instantiate(Resources.Load <GameObject>("Prefab/SSPElement"));
            // DebugLog.DebugLogInfo("读取下方菜单预制体");
            tempMark.transform.SetParent(Parent.transform);
            tempMark.transform.localScale    = Vector3.one;
            tempMark.transform.localPosition = new Vector3(tempMark.transform.localPosition.x, tempMark.transform.localPosition.y, 1);
            // Debug.Log(tempMark);
            tempMark.GetComponent <StartStopElement>().SetData(sspInfoList[i]);
            tempMark.GetComponentInChildren <Text>().text = sspInfoList[i].ch_name;
            sspEleList.Add(tempMark.GetComponent <StartStopElement>());

            //muscleList.Add(sspInfoList[i].ch_name);
        }
    }
Пример #20
0
 void Start()
 {
     if (CloseCommandCompent)
     {
         return;
     }
     local_db = new DbRepository <CommandList>();
     //获取名词范围
     local_db.DataService("Command.db");
     local_db.DropTable();
     local_db.CreateTable();
     local_db.Close();
     indexId = 0;
 }
Пример #21
0
    void ReadTextureAB(string filepath)
    {
        //read db  return texture name
        DbRepository <texture_table> temp_db = new DbRepository <texture_table>();

        temp_db.CreateDb(filepath + "Sign_old.db");
        IEnumerable <texture_table> aculist = temp_db.Select <texture_table>((tmp) =>
        {
            if (tmp != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        });

        foreach (var item in aculist)
        {
            if (!name_texture_dic.ContainsKey(item.model_name))
            {
                name_texture_dic.Add(item.model_name, item.tex_name);
            }
        }
        print("name_texture_dic  list " + name_texture_dic.Count);
        temp_db.Close();

        //load ab --find texture with name --
        AssetBundle texture_bundle  = null;
        AssetBundle texture_bundle2 = null;

#if UNITY_EDITOR || UNITY_STANDALONE_WIN
        texture_bundle  = AssetBundle.LoadFromFile(filepath + "bonetex.pc");
        texture_bundle2 = AssetBundle.LoadFromFile(filepath + "hearttex.pc");
#elif UNITY_IOS
        texture_bundle = AssetBundle.LoadFromFile(filepath + "bonetex.ios");
#else
        texture_bundle = AssetBundle.LoadFromFile(filepath + "bonetex.android");
#endif
        texture_list  = texture_bundle.LoadAllAssets <Texture>();
        texture_list2 = texture_bundle2.LoadAllAssets <Texture>();
        print("texture_list count : " + texture_list.Length);

        if (texture_bundle != null)
        {
            texture_bundle.Unload(false);
            texture_bundle2.Unload(false);
        }
    }
Пример #22
0
    //获取公共资源列表
    public static List <Download_Vesal_info> GetStructInfo(asset_platform platform)
    {
        print("当前平台:" + Enum.GetName(typeof(asset_platform), platform));
        List <Download_Vesal_info> list = new List <Download_Vesal_info>();
        var local_db = new DbRepository <CommonAssetLib>();

        local_db.DataService("vesali.db");
        var tmpIe = local_db.Select <CommonAssetLib>((tempNo) =>
        {
            if (tempNo.url != null && tempNo.platform == Enum.GetName(typeof(asset_platform), platform))
            {
                // DebugLog.DebugLogInfo("公共资源 名称:" + tempNo.ab_name + " " + tempNo.url + " version " + tempNo.version);
                return(true);
            }
            else
            {
                return(false);
            }
        });

        foreach (var i in tmpIe)
        {
            Download_Vesal_info temp_info = new Download_Vesal_info();


            if ((PublicClass.Quality == Run_Quality.POOL) && PublicTools.isTargetInSourceList(i.ab_name, PublicClass.low_res_ablist, ',') && (i.type == "AB"))
            {
                temp_info.url  = i.url.Insert(i.url.LastIndexOf(i.ab_name), "s_");
                temp_info.name = "s_" + i.ab_name;
            }
            else
            {
                temp_info.name = i.ab_name;
                temp_info.url  = i.url;
            }
            temp_info.version        = i.version;
            temp_info.isNeedDownload = false;
            temp_info.type           = i.type;
            temp_info.instance       = null;
            temp_info.source         = null;
            // print(temp_info.name);
            list.Add(temp_info);
        }
        local_db.Close();
        return(list);
    }
Пример #23
0
    public void UpdateModelInfo()
    {
        //读取所有模型信息
        DebugLog.DebugLogInfo("--------------------ReadModelInfo");
        //连接本地数据库
        var local_db = new DbRepository <GetSubModel>();

        local_db.DataService("vesali.db");
        var dbs = local_db.Select <GetSubModel>((tempt) =>
        {
            return(true);
        });

        if (PublicClass.infoDic == null)
        {
            Debug.Log("init info dic faile");
        }
        foreach (var i in dbs)
        {
            if (PublicClass.infoDic.ContainsKey(i.name))
            {
                continue;
            }
            ModelInfo tempInfo = new ModelInfo();
            tempInfo.ModelName = i.name;
            tempInfo.English   = i.enName;
            tempInfo.model_Id  = i.submodelId;
            tempInfo.littleMap = i.partitionName; // "Abdomen";
            // Debug.Log(i.partitionName);
            try
            {
                tempInfo.Note    = i.description;
                tempInfo.Chinese = i.chName;
            }
            catch { }
            try
            {
                PublicClass.infoDic.Add(tempInfo.ModelName, tempInfo);
            }
            catch { Debug.Log("重复 " + tempInfo.ModelName); }
        }
        local_db.Close();

        DebugLog.DebugLogInfo(PublicClass.infoDic.Count + "  总文档长度");
    }
Пример #24
0
    public static void Model_AB_dic_update()
    {
        PublicClass.Model_AB_dic.Clear();
        var local_db = new DbRepository <AbInfo>();

        local_db.DataService("vesali.db");
        var dbs = local_db.Select <AbInfo>((tempt) =>
        {
            return(true);
        });

        foreach (var i in dbs)
        {
            string[] submodellist = i.submodel_list.Split(',');
            foreach (string model in submodellist)
            {
                if (!PublicClass.Model_AB_dic.ContainsKey(model))
                {
                    PublicClass.Model_AB_dic.Add(model, i.ab_name);
                }
            }
        }
        local_db.Close();
    }
Пример #25
0
    //获取ablist
    public string SearchPublicAppAblist(string app_id, string platform, string version, string level)
    {
        string ab_list        = string.Empty;
        var    stuct_local_db = new DbRepository <GetStructAbList>();

        //获取名词范围
        stuct_local_db.DataService("vesali.db");
        GetStructAbList stuct_tmpSt = stuct_local_db.SelectOne <GetStructAbList>((tempNo) =>
        {
            if (tempNo.app_id == app_id && tempNo.level == level)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        });

        if (stuct_tmpSt != null)
        {
            ab_list = stuct_tmpSt.ab_list;
            if (stuct_tmpSt.replace_app_id != "" && stuct_tmpSt.replace_app_id != null)
            {
                app_id = stuct_tmpSt.replace_app_id;
            }
        }
        else
        {
            DebugLog.DebugLogInfo("GetStructAbList no id: " + PublicClass.app.app_id);
        }

        stuct_local_db.Close();

        return(app_id + "|" + ab_list);
    }
Пример #26
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);
    }
Пример #27
0
    bool showTissueModel()
    {
        isShowTissueModel = false;
        DbRepository <GetStructList> local_db2;

        //local_db2 = new DbRepository<MotorAnatomy_submodel>();
        local_db2 = new DbRepository <GetStructList>();
        local_db2.DataService("vesali.db");
        Debug.Log(PublicClass.app.signModelName);
        GetStructList scope_Ie = local_db2.SelectOne <GetStructList>((tempNo) =>
        {
            if (tempNo.nounName == PublicClass.app.tissueModelName)
            {
                Debug.Log(tempNo.nounName);
                //DebugLog.DebugLogInfo(ss_id.bone_name+" "+ss_id.main_tex+" "+ ss_id.mask_tex);
                return(true);
            }
            else
            {
                return(false);
            }
        });


        List <GetStructList> texInfoList = new List <GetStructList>();

        List <string> initList = SceneModels.instance.getListByObj(scope_Ie);//getListByNo(nounNo);

        if (initList.Count == 0)
        {
            return(false);
        }
        Vector3 campos = PublicTools.Str2Vector3(scope_Ie.camPos);

        //  Camera.main.transform.parent.localPosition = PublicTools.Str2Vector3(texInfoList[0].camParentPos);

        Debug.Log(PublicTools.Str2Vector3(scope_Ie.camPos));
        Debug.Log(initList.Count);
        local_db2.Close();
        bool ishave = false;

        XT_AllButton.Instance.OpenMultipleModel();
        foreach (string tmp in initList)
        {
            if (SceneModels.instance.IsChooseModelByName(tmp))
            {
                ishave = true;
            }
        }
        if (ishave)
        {
            // XT_AllButton.Instance.TranslucentOther();
            XT_AllButton.Instance.ISO();
            foreach (string tmp in initList)
            {
                SceneModels.instance.ChooseModelByName(tmp);
            }
            XT_AllButton.Instance.OpenMultipleModel();

            if (campos != null)
            {
                Camera.main.transform.localPosition = campos;
                Interaction.instance.setParamValue2();
            }
        }
        //  XT_MouseFollowRotation.instance.To_360();
        isShowSignModel = false;
        return(true);
    }
Пример #28
0
    public void loaddb()
    {
        local_db = new DbRepository <MotorAnatomy>();
        local_db.DataService(db_path);
        string id     = PublicClass.app.app_id;
        var    tmpssp = local_db.SelectOne <MotorAnatomy>((tmp) =>
        {
            if (tmp.ID == id)
            {
                //DebugLog.DebugLogInfo(ss_id.bone_name+" "+ss_id.main_tex+" "+ ss_id.mask_tex);
                return(true);
            }
            else
            {
                return(false);
            }
        });

        local_db.Close();
        Debug.Log(tmpssp.MuscleName);
        string[]             modelname = tmpssp.MuscleName.Split(',');
        List <System.String> listS     = new List <System.String>(modelname);

        local_db2 = new DbRepository <MotorAnatomy_submodel>();
        local_db2.DataService(db_path);
        var tmpssp2 = local_db2.Select <MotorAnatomy_submodel>((tmp) =>
        {
            if (listS.Exists(p => p == tmp.ModelName))
            {
                //DebugLog.DebugLogInfo(ss_id.bone_name+" "+ss_id.main_tex+" "+ ss_id.mask_tex);
                return(true);
            }
            else
            {
                return(false);
            }
        });

        local_db.Close();
        List <MotorAnatomy_submodel> texInfoList = new List <MotorAnatomy_submodel>();

        foreach (MotorAnatomy_submodel tmp in tmpssp2)
        {
            texInfoList.Add(tmp);
        }
        int num = texInfoList.Count;

        muscleEng = new string[num];
        muscleCng = new string[num];

        for (int i = 0; i < num; i++)
        {
            muscleEng[i] = texInfoList[i].ModelName;
            muscleCng[i] = texInfoList[i].ChineseName;
        }


        InitModel(tmpssp);
        InitTimeLine(tmpssp);
        InitPos(tmpssp);
        InitText(tmpssp);
        try
        {
            testPlayLoad.Close();
        }
        catch (System.Exception)
        {
        }
    }
Пример #29
0
    void ReadAcuTable()
    {
        local_db = new DbRepository <AcupointInfo>();
        local_db.CreateDb(db_path);
        var tmpssp = local_db.Select <AcupointInfo>((tmp) =>
        {
            if (tmp.sm_type != null)
            {
                //DebugLog.DebugLogInfo(ss_id.bone_name+" "+ss_id.main_tex+" "+ ss_id.mask_tex);
                return(true);
            }
            else
            {
                return(false);
            }
        });

        acuInfoList     = new List <AcupointInfo>();
        jingluoInfoList = new List <AcupointInfo>();
        foreach (AcupointInfo tmp in tmpssp)
        {
            if (tmp.sm_type == "XW")
            {
                acuInfoList.Add(tmp);
            }
            else if (tmp.sm_type == "JL")
            {
                jingluoInfoList.Add(tmp);
            }
        }
        local_db.Close();
        List <string> jingmaiList = new List <string>();

        string[] ids_array = null;
        DbRepository <AcuListInfo> temp_db = new DbRepository <AcuListInfo>();

        temp_db.CreateDb(db_path);
        IEnumerable <AcuListInfo> aculist = temp_db.Select <AcuListInfo>((tmp) =>
        {
            if (tmp != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        });

        foreach (var item in aculist)
        {
            if (item.noun_no == PublicClass.app.app_id)
            {
                ids_array = item.ids.Split(',');
                string[] temp_str = item.line_list.Split(',');
                for (int i = 0; i < temp_str.Length; i++)
                {
                    jingmaiList.Add(temp_str[i]);
                }
                break;
            }
        }
        print("jingmai  list " + jingmaiList.Count);

        temp_db.Close();
        acuPosList = new List <Transform>();

        SetSecondchildActived(PublicClass.Transform_temp, jingmaiList);

        List <string> jingmai_name_list = new List <string>();

        for (int i = 0; i < jingmaiList.Count; i++)
        {
            Transform tmp_trans  = GameObject.Find(jingmaiList[i]).transform;
            int[]     temp_trans = new int[tmp_trans.childCount];
            for (int j = 0; j < temp_trans.Length; j++)
            {
                jingmai_name_list.Add(tmp_trans.GetChild(j).name);
            }
        }

        for (int i = 0; i < acuInfoList.Count; i++)
        {
            if (jingmai_name_list.Contains(acuInfoList[i].sm_name))
            {
                //读取小球位置生成小球
                Transform tran = GameObject.Find(acuInfoList[i].sm_name).transform;
                acuPosList.Add(tran);
                GameObject gobj = Instantiate(sphere, tran);
                gobj.transform.localPosition = Vector3.zero;
                gobj.transform.localScale    = gobj.transform.localScale * 0.35f;
                gobj.GetComponent <SphereCollider>().radius = 0.7f;
                acpoint_dic.Add(tran.position, acuInfoList[i].sm_ch_name);

                //读取下方菜单预制体生成菜单
                GameObject tempMark = Instantiate(Resources.Load <GameObject>("Prefab/ACUElement"));
                // DebugLog.DebugLogInfo("读取下方菜单预制体");
                tempMark.transform.SetParent(acuParent.transform);
                tempMark.transform.localScale    = Vector3.one;
                tempMark.transform.localPosition = new Vector3(tempMark.transform.localPosition.x, tempMark.transform.localPosition.y, 1);
                Debug.Log(tempMark);
                tempMark.GetComponent <AcuElement>().SetData(acuInfoList[i]);

                tempMark.GetComponentInChildren <Text>().text = acuInfoList[i].sm_ch_name;
                acuEleList.Add(tempMark.GetComponent <AcuElement>());
            }
        }

        for (int j = 0; j < jingluoInfoList.Count; j++)
        {
            GameObject tempMark = Instantiate(Resources.Load <GameObject>("Prefab/MerElement"));
            // DebugLog.DebugLogInfo("读取下方菜单预制体");
            tempMark.transform.SetParent(merParent.transform);
            tempMark.transform.localScale    = Vector3.one;
            tempMark.transform.localPosition = new Vector3(tempMark.transform.localPosition.x, tempMark.transform.localPosition.y, 1);
            Debug.Log(tempMark);
            tempMark.GetComponent <MerElement>().SetData(jingluoInfoList[j]);

            tempMark.GetComponentInChildren <Text>().text = jingluoInfoList[j].sm_ch_name;
            merEleList.Add(tempMark.GetComponent <MerElement>());
        }
        Debug.Log(merEleList.Count);
    }
Пример #30
0
    // Update is called once per frame
    void Update()
    {
        if (PublicClass.app.app_type != "sign_acu")
        {
            return;
        }

#if UNITY_DEBUG
        if (Input.GetKeyDown(KeyCode.T))
        {
            MakeStaticDBTable <AcupointInfo> .SetTextureDataToDB(PublicClass.filePath + "StartStop", db_path);
        }


        if (Input.GetKeyDown(KeyCode.F1))
        {
            //http://118.24.119.234:8083/vesal-jiepao-test/v1/app/xml/getTempAcupoint
            // MakeStaticDBTable<AcupointInfo>.sign_UpdateTable(PublicClass.server_ip + "v1/app/xml/getTempAcupoint", db_path);
// http://118.24.119.234:8083/vesal-jiepao-test/v1/app/xml/getTempAcupoint?type=acu
// http://118.24.119.234:8083/vesal-jiepao-test/v1/app/xml/getTempAcupoint?type=noun
            // MakeStaticDBTable<AcupointInfo>.sign_UpdateTable(PublicClass.server_ip + "v1/app/xml/getTempAcupoint?type=acu", db_path,true);
            // MakeStaticDBTable<AcuListInfo>.sign_UpdateTable(PublicClass.server_ip + "v1/app/xml/getTempAcupoint?type=noun", db_path,true);

            string db_path = PublicClass.filePath + "sign_ssp_path/StartStop_1.db";
            MakeStaticDBTable <StartStopInfo> .opera_condition(db_path, (list) => {
                //list startstopinfo
                List <string> opera_list = new List <string>();
                foreach (var item in list)
                {
                    if (item.qr == "0")
                    {
                        opera_list.Add(item.mod_name);
                        print(item.mod_name + " info missing ");
                    }
                }
            });
        }


        if (Input.GetKeyDown(KeyCode.R))
        {
            Debug.Log("r已被按下");
            for (int i = 0; i < acuEleList.Count; i++)
            {
                Debug.Log("进入循环,查找目前记录的物体");
                if (acuEleList[i].gameObject.GetComponent <Image>().color == new Color(33 / 255.0f, 167 / 255.0f, 212 / 255.0f, 85 / 255.0f))
                {
                    camera_params str = new camera_params();
                    str.camera_pos   = new vector3();
                    str.camera_pos.x = Camera.main.transform.position.x;
                    str.camera_pos.y = Camera.main.transform.position.y;
                    str.camera_pos.z = Camera.main.transform.position.z;

                    str.camera_parent_rot   = new vector3();
                    str.camera_parent_rot.x = Camera.main.transform.parent.transform.eulerAngles.x;
                    str.camera_parent_rot.y = Camera.main.transform.parent.transform.eulerAngles.y;
                    str.camera_parent_rot.z = Camera.main.transform.parent.transform.eulerAngles.z;

                    str.camera_parent_pos   = new vector3();
                    str.camera_parent_pos.x = Camera.main.transform.parent.transform.position.x;
                    str.camera_parent_pos.y = Camera.main.transform.parent.transform.position.y;
                    str.camera_parent_pos.z = Camera.main.transform.parent.transform.position.z;

                    acuInfoList[i].camera_params = JsonConvert.SerializeObject(str);
                    // sspInfoList[i].app_id="SA0C01001";
                    Debug.Log("记录摄像机数据成功");
                }
            }
        }

        if (Input.GetKeyDown(KeyCode.W))
        {
            // local_db.DataService("StartStop.db");
            local_db.CreateDb(db_path);
            UpdateSSPTable();
            Debug.Log("写入摄像机数据成功");
            local_db.Close();
        }
#endif


        //将显示框的位置设置为物体位置的屏幕坐标
        //Debug.Log(objPos);
        //showinfoBG.transform.position = Camera.main.WorldToScreenPoint(objPos);
        txtPos = Camera.main.WorldToScreenPoint(objPos);

        showinfoBG.rectTransform.anchoredPosition = new Vector2(txtPos.x / Screen.width * ScreenData.instance.high, txtPos.y / Screen.height * ScreenData.instance.width) + new Vector2(100, 50);
        //Debug.Log(showinfoBG.rectTransform.localPosition);
        // Debug.Log(showinfoBG.rectTransform.anchoredPosition);

        //Debug.Log(txtPos);
        //showinfoBG.rectTransform.pivot = new Vector2(0.5f, 0.5f);

        //Debug.Log(showinfoBG.transform.position);
        if (ChooseModel.CheckGuiRaycastObjects())
        {
            return;
        }
        if (Input.GetMouseButtonDown(0))
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit))
            {
                if (acpoint_dic.ContainsKey(hit.transform.position))
                {
                    ExpPanel.SetActive(true);
                    MenuPanel.SetActive(false);
                    isListOpen = false;

                    //for (int i = 0; i < acuInfoList.Count; i++)
                    //               {
                    //                   if(GameObject.Find(acuInfoList[i].sm_name)!=null)
                    //                   ToNormalState(GameObject.Find(acuInfoList[i].sm_name).GetComponentInChildren<MeshRenderer>().material);


                    //               }
                    if (lastSphere != null)
                    {
                        ToNormalState(lastSphere.GetComponentInChildren <MeshRenderer>().material);
                        //test.lastMuscle.SetActive(false);
                    }

                    //lastTrans = currentTrans;
                    //currentTrans = hit.transform;
                    objPos = hit.transform.position;
                    showinfoBG.gameObject.SetActive(true);
                    showTxt.text = acpoint_dic[hit.transform.position];
                    //ToSelectState(currentTrans.GetComponent<MeshRenderer>().material);
                    currentSphere = hit.transform.gameObject;
                    ToSelectState(hit.transform.GetComponent <MeshRenderer>().material);
                    lastSphere = currentSphere;

                    //if(lastTrans!=null)
                    //ToNormalState (lastTrans.GetComponent<MeshRenderer>().material);
                    for (int i = 0; i < acuInfoList.Count; i++)
                    {
                        if (acuInfoList[i].sm_ch_name == acpoint_dic[hit.transform.position])
                        {
                            //print(acuInfoList[i].sm_ch_name);
                            acuChName.text = acuInfoList[i].sm_ch_name;

                            acuCode.text = acuInfoList[i].iso_code;
                            acuDes.text  = string.Format("<size=48><color=#00FFFF>定位</color></size>:\r\n{0}\r\n<size=48><color=#00FFFF>主治</color></size>:\r\n{1}\r\n<size=48><color=#00FFFF>操作</color></size>:\r\n{2}", acuInfoList[i].position, acuInfoList[i].cure, acuInfoList[i].handle);
                        }
                    }
                }
            }
            else
            {
                for (int i = 0; i < acuInfoList.Count; i++)
                {
                    if (GameObject.Find(acuInfoList[i].sm_name) != null)
                    {
                        ToNormalState(GameObject.Find(acuInfoList[i].sm_name).GetComponentInChildren <MeshRenderer>().material);
                    }
                }
                showinfoBG.gameObject.SetActive(false);
            }
        }
    }