public JsonResult Themmoi2(CMT cmt2)
 {
     if (ModelState.IsValid)
     {
         if (Session["file"] != null)
         {
             cmt2.fileCMT = (string)Session["file"];
         }
         db.CMTs.Add(cmt2);
         db.SaveChanges();
         //Cập nhật lại bảng học sinh
         if (Session["id_HS"] != null)
         {
             int     id_HS   = (int)Session["id_HS"];
             HOCSINH hocsinh = db.HOCSINHs.Find(id_HS);
             hocsinh.SoCMT           = cmt2.SoCMT;
             db.Entry(hocsinh).State = System.Data.Entity.EntityState.Modified;
             db.SaveChanges();
         }
         if (Session["id_hsDetail"] != null)
         {
             Session["chuyenTab"] = 2;
             return(Json((int)Session["id_hsDetail"], JsonRequestBehavior.AllowGet));
         }
         return(Json("Thêm thành công!", JsonRequestBehavior.AllowGet));
     }
     return(Json("Thêm thất bại!", JsonRequestBehavior.AllowGet));
 }
Example #2
0
 public void Dispose()
 {
   if (m_disp != null)
     m_disp.Dispose();
   m_disp = null;
   m_parent = null;
 }
 public LoiModel(CMT cmt, GIAYKHAISINH giaykhaisinh, BANGTOTNGHIEP bangtotnghiep, HOCBA hocba)
 {
     this.cmt           = cmt;
     this.giaykhaisinh  = giaykhaisinh;
     this.bangtotnghiep = bangtotnghiep;
     this.hocba         = hocba;
 }
Example #4
0
        public ActionResult ChitietCMT(int id_hs)
        {
            HOCSINH hocsinh = db.HOCSINHs.SingleOrDefault(n => n.id == id_hs);

            ViewBag.ctHocSinh = hocsinh.TenHS;
            CMT cmt = db.CMTs.SingleOrDefault(n => n.SoCMT == hocsinh.SoCMT);

            return(View(cmt));
        }
        public MovieMaidIKTrack(Maid maid) : base()
        {
            this.maid    = maid;
            this.targets = new Dictionary <string, Transform>();

            foreach (string targetName in TARGET_NAMES)
            {
                targets[targetName] = CMT.SearchObjName(maid.body0.m_Bones.transform, targetName, true);
            }
        }
        public ActionResult Detail()
        {
            ModelQuyenNguoiDung quyenNguoiDung = Session["QuyenNguoiDung"] as ModelQuyenNguoiDung;

            if (quyenNguoiDung != null && (quyenNguoiDung.Quyen.Ten == "QuanLyThongTinHocSinh" || quyenNguoiDung.Quyen.Ten == "Admin"))
            {
                int     id_hs   = (int)Session["id_hsDetail"];
                HOCSINH hocsinh = db.HOCSINHs.Find(id_hs);
                CMT     cmt     = db.CMTs.SingleOrDefault(n => n.SoCMT == hocsinh.SoCMT);
                return(View(cmt));
            }
            return(RedirectToAction("Index", "Home"));
        }
Example #7
0
        private static void MoveTargetCard(ThumShot thum, Maid maid)
        {
            var transform = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 HeadNub");

            if (transform != null)
            {
                thum.transform.position = transform.TransformPoint(transform.localPosition + cameraOffset);
                thum.transform.rotation = transform.rotation * Quaternion.Euler(90f, 0f, 90f);
            }
            else
            {
                Debug.LogError("Failed to find maid's head!");
            }
        }
        public ActionResult SuaCMT(string soCMT, int loaiCMT)
        {
            ModelQuyenNguoiDung quyenNguoiDung = Session["QuyenNguoiDung"] as ModelQuyenNguoiDung;

            if (quyenNguoiDung != null && (quyenNguoiDung.Quyen.Ten == "QuanLyThongTinHocSinh" || quyenNguoiDung.Quyen.Ten == "Admin"))
            {
                Session["file"] = null;
                CMT cmt = db.CMTs.Find(soCMT);
                ViewBag.LoaiCMT = loaiCMT;
                HOCSINH hs = db.HOCSINHs.SingleOrDefault(n => n.SoCMT == soCMT);
                ViewBag.id_hs        = hs.id;
                Session["chuyenTab"] = 2;
                return(View(cmt));
            }
            return(RedirectToAction("Index", "Home"));
        }
        public JsonResult ChinhSuaLoiNgaySinh(List <string> listKey)
        {
            try
            {
                LoiModel  chitietLoi = new LoiModel();
                int       idLoi      = Int32.Parse(listKey[0]);
                TABLE_LOI tableLoi   = db.TABLE_LOI.Find(idLoi);
                string    typeLoi    = tableLoi.TypeLOI;
                if (listKey[1] != null)
                {
                    DateTime NgaySinhCMT = DateTime.Parse(listKey[1]);
                    CMT      cmt         = db.CMTs.Find(tableLoi.So_CMT);
                    cmt.NgaySinh        = NgaySinhCMT;
                    db.Entry(cmt).State = EntityState.Modified;
                }

                if (listKey[2] != null)
                {
                    DateTime     NgaySinhGKS = DateTime.Parse(listKey[2]);
                    GIAYKHAISINH gks         = db.GIAYKHAISINHs.Find(tableLoi.id_GKS);
                    gks.NgaySinh        = NgaySinhGKS;
                    db.Entry(gks).State = EntityState.Modified;
                }

                if (listKey[3] != null)
                {
                    DateTime      NgaySinhBTN = DateTime.Parse(listKey[3]);
                    BANGTOTNGHIEP btn         = db.BANGTOTNGHIEPs.Find(tableLoi.id_BTN);
                    btn.NgaySinh        = NgaySinhBTN;
                    db.Entry(btn).State = EntityState.Modified;
                }

                if (listKey[4] != null)
                {
                    DateTime NgaySinhHB = DateTime.Parse(listKey[4]);
                    HOCBA    hocba      = db.HOCBAs.Find(tableLoi.id_HB);
                    hocba.NgaySinh        = NgaySinhHB;
                    db.Entry(hocba).State = EntityState.Modified;
                }
                db.SaveChanges();
                return(Json(true, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                return(Json(e, JsonRequestBehavior.AllowGet));
            }
        }
Example #10
0
        // Stops all animations, locks eye & head position so that the Maid
        // is looking straight forward and applies transformations to a Maid's
        // armature to put her into a T-pose.
        public static void ApplyTPose(this Maid maid)
        {
            Animation anim = maid.body0.m_Bones.GetComponent <Animation>();

            if (anim.enabled)
            {
                maid.body0.m_Bones.GetComponent <Animation>().enabled = false;
                maid.body0.Face.AnimationStop();
                maid.EyeToReset();
                maid.LockHeadAndEye(true);
                maid.boMabataki = false;
                maid.body0.Face.morph.EyeMabataki = 0f;
                maid.body0.Face.morph.FixBlendValues_Face();

                Transform rootTransform = maid.body0.m_Bones.transform;

                foreach (var boneName in TPoseBonesToReset)
                {
                    Transform transform = CMT.SearchObjName(rootTransform, boneName);
                    transform.localRotation = Quaternion.identity;
                }

                foreach (var entry in TPoseBoneTransformRotations)
                {
                    CMT.SearchObjName(rootTransform, entry.Key).localRotation *= entry.Value;
                }

                foreach (var dbone in maid.body0.m_Bones.GetComponentsInChildren <DynamicBone>())
                {
                    if (!dbone.enabled)
                    {
                        Debug.Log($"Dynamic Bone {dbone.name} is already disabled");
                    }
                    dbone.enabled = false;
                }
            }
            else
            {
                maid.body0.m_Bones.GetComponent <Animation>().enabled = true;
                maid.LockHeadAndEye(false);
                maid.boMabataki = true;
                foreach (var dbone in maid.body0.m_Bones.GetComponentsInChildren <DynamicBone>())
                {
                    dbone.enabled = true;
                }
            }
        }
Example #11
0
 private void TargetObjectChangeCheck()
 {
     if (Setting.targetSelectMode == 0)
     {
         if (CommonUIData.maid == null || CommonUIData.slotNo == -2)
         {
             CommonUIData.SetObject(null);
         }
         else if (CommonUIData.slotNo == -1)
         {
             CommonUIData.SetObject(CommonUIData.maid.body0.m_Bones);
         }
         else
         {
             CommonUIData.SetObject(CommonUIData.maid.body0.goSlot[CommonUIData.slotNo].obj);
         }
     }
     if (!(this.targetObj == CommonUIData.obj) || (this.targetObj == null && this.braList != null))
     {
         this.targetObj = CommonUIData.obj;
         this.Clear();
         if (this.targetObj)
         {
             Transform[] fromBones;
             if (Setting.targetSelectMode == 0 && CommonUIData.slotNo == -1)
             {
                 fromBones = (from bone in CommonUIData.maid.body0.goSlot[0].obj.GetComponentInChildren <SkinnedMeshRenderer>().bones
                              where bone != null
                              select CMT.SearchObjName(CommonUIData.obj.transform, bone.name, true) into bone
                              where bone != null
                              select bone).ToArray <Transform>();
             }
             else
             {
                 SkinnedMeshRenderer componentInChildren = this.targetObj.GetComponentInChildren <SkinnedMeshRenderer>();
                 if (componentInChildren == null)
                 {
                     return;
                 }
                 fromBones = (from bone in componentInChildren.bones
                              where bone != null
                              select bone).ToArray <Transform>();
             }
             this.CopyBoneConstruction(this.targetObj.transform, fromBones);
         }
     }
 }
Example #12
0
        public webcamForm()
        {
            InitializeComponent();

            mTracker = new CMT();

            try
            {
                capture = new Capture();
                captureInProgress = true;
            }
            catch (NullReferenceException e)
            {
                Console.WriteLine(e.StackTrace);
            }
            Application.Idle += ProcessFrame;
        }
        public JsonResult ChinhSuaLoiHoTen(List <string> listKey)
        {
            LoiModel  chitietLoi = new LoiModel();
            int       idLoi      = Int32.Parse(listKey[0]);
            string    TenHS      = listKey[1];
            string    TenCMT     = listKey[2];
            string    TenGKS     = listKey[3];
            string    TenBTN     = listKey[4];
            string    TenHB      = listKey[5];
            TABLE_LOI tableLoi   = db.TABLE_LOI.Find(idLoi);
            string    typeLoi    = tableLoi.TypeLOI;

            if (TenHS != null)
            {
                HOCSINH hocsinh = db.HOCSINHs.Find(tableLoi.id_HS);
                hocsinh.TenHS           = TenHS;
                db.Entry(hocsinh).State = System.Data.Entity.EntityState.Modified;
            }
            if (TenCMT != null)
            {
                CMT cmt = db.CMTs.Find(tableLoi.So_CMT);
                cmt.HoTen           = TenCMT;
                db.Entry(cmt).State = System.Data.Entity.EntityState.Modified;
            }
            if (TenGKS != null)
            {
                GIAYKHAISINH gks = db.GIAYKHAISINHs.Find(tableLoi.id_GKS);
                gks.HoTen           = TenGKS;
                db.Entry(gks).State = System.Data.Entity.EntityState.Modified;
            }
            if (TenBTN != null)
            {
                BANGTOTNGHIEP btn = db.BANGTOTNGHIEPs.Find(tableLoi.id_BTN);
                btn.HoTen           = TenBTN;
                db.Entry(btn).State = System.Data.Entity.EntityState.Modified;
            }
            if (TenHB != null)
            {
                HOCBA hocba = db.HOCBAs.Find(tableLoi.id_HB);
                hocba.HoTen           = TenHB;
                db.Entry(hocba).State = System.Data.Entity.EntityState.Modified;
            }
            db.SaveChanges();
            return(Json(true, JsonRequestBehavior.AllowGet));
        }
Example #14
0
        // Token: 0x06000063 RID: 99 RVA: 0x00007EC4 File Offset: 0x000060C4
        public Texture2D ThumShot(Camera camera, Maid f_maid)
        {
            int       width     = 138;
            int       height    = 200;
            Transform transform = CMT.SearchObjName(f_maid.body0.m_Bones.transform, "Bip01 HeadNub", true);

            camera.transform.position = transform.TransformPoint(transform.localPosition + new Vector3(0.38f, 1.07f, 0f));
            camera.transform.rotation = transform.rotation * Quaternion.Euler(90f, 0f, 90f);
            camera.fieldOfView        = 30f;
            RenderTexture renderTexture = new RenderTexture(width, height, 24, RenderTextureFormat.ARGB32);

            renderTexture.filterMode   = FilterMode.Bilinear;
            renderTexture.antiAliasing = 8;
            RenderTexture f_rtSub = new RenderTexture(width, height, 0, RenderTextureFormat.ARGB32);
            Texture2D     result  = this.RenderThum(camera, renderTexture, f_rtSub, width, height);

            this.Restore();
            return(result);
        }
Example #15
0
        public MaidTransforms(TBody body)
        {
            Body  = body.GetBone("Bip01");
            FootL = body.GetBone("Bip01 L Foot");
            FootR = body.GetBone("Bip01 R Foot");

            ToesL = new[]
            {
                CMT.SearchObjName(FootL, "Bip01 L Toe0"),
                CMT.SearchObjName(FootL, "Bip01 L Toe1"),
                CMT.SearchObjName(FootL, "Bip01 L Toe2"),
            };
            ToesR = new[]
            {
                CMT.SearchObjName(FootR, "Bip01 R Toe0"),
                CMT.SearchObjName(FootR, "Bip01 R Toe1"),
                CMT.SearchObjName(FootR, "Bip01 R Toe2"),
            };
        }
        public string ReturnHoten(int id_loi)
        {
            TABLE_LOI tb_loi = db.TABLE_LOI.Find(id_loi);

            if (tb_loi.id_HS > 0)
            {
                HOCSINH hs = db.HOCSINHs.Find(tb_loi.id_HS);
                return(hs.TenHS);
            }
            else
            {
                if (tb_loi.So_CMT != null)
                {
                    CMT cmt = db.CMTs.Find(tb_loi.So_CMT);
                    return(cmt.HoTen);
                }
                else
                {
                    if (tb_loi.id_GKS > 0)
                    {
                        GIAYKHAISINH gks = db.GIAYKHAISINHs.Find(tb_loi.id_GKS);
                        return(gks.HoTen);
                    }
                    else
                    {
                        if (tb_loi.id_BTN > 0)
                        {
                            BANGTOTNGHIEP btn = db.BANGTOTNGHIEPs.Find(tb_loi.id_BTN);
                            return(btn.HoTen);
                        }
                        else
                        {
                            if (tb_loi.id_HB > 0)
                            {
                                HOCBA hb = db.HOCBAs.Find(tb_loi.id_HB);
                                return(hb.HoTen);
                            }
                        }
                    }
                }
            }
            return(null);
        }
 public JsonResult UpLoadFileCMT()
 {
     if (System.Web.HttpContext.Current.Request.Files.AllKeys.Any())
     {
         var file = Request.Files["HelpSectionFile"];
         //lưu tên file
         var fileName = Path.GetFileName(file.FileName);
         //lưu đường dẫn
         var path = Path.Combine(Server.MapPath("~/Content/filePDF"), fileName);
         // file is uploaded
         var type = file.ContentType;
         if (System.IO.File.Exists(path))
         {
             ViewBag.Thongbao = "File đã tồn tại";
         }
         else
         {
             if (type == "application/docx" || type == "application/pdf")
             {
                 file.SaveAs(path);
             }
         }
         Session["file"] = fileName;
         if (Session["id_hsDetail"] != null)
         {
             int     id_hs   = (int)Session["id_hsDetail"];
             HOCSINH hocsinh = db.HOCSINHs.Find(id_hs);
             if (hocsinh.SoCMT != null)
             {
                 CMT cmt = db.CMTs.Find(hocsinh.SoCMT);
                 cmt.fileCMT          = fileName;
                 db.Entry(cmt).State  = System.Data.Entity.EntityState.Modified;
                 Session["chuyenTab"] = 2;
                 db.SaveChanges();
                 return(Json(hocsinh.id, JsonRequestBehavior.AllowGet));
             }
         }
         return(Json(fileName, JsonRequestBehavior.AllowGet));
     }
     Session["file"] = null;
     return(Json("Khong", JsonRequestBehavior.AllowGet));
 }
        // Stops all animations, locks eye & head position so that the Maid
        // is looking straight forward and applies transformations to a Maid's
        // armature to put her into a T-pose.
        public static void ApplyTPose(this Maid maid)
        {
            maid.body0.m_Bones.GetComponent <Animation>().Stop();
            maid.body0.Face.AnimationStop();
            maid.EyeToReset();
            maid.LockHeadAndEye(true);

            Transform rootTransform = maid.body0.m_Bones.transform;

            foreach (var boneName in TPoseBonesToReset)
            {
                Transform transform = CMT.SearchObjName(rootTransform, boneName);
                transform.localRotation = Quaternion.identity;
            }

            foreach (var entry in TPoseBoneTransformRotations)
            {
                CMT.SearchObjName(rootTransform, entry.Key).localRotation *= entry.Value;
            }
        }
Example #19
0
        public void lateupdateFunc(int m, Maid maid, bool isArm, bool isLeft)
        {
            if (bIKAttach.ContainsKey(m) && bIKAttach[m])
            {
                //公式撮影でアタッチ対象のメイドさんがいなくなった場合
                if (goIKTarget[m] == null)
                {
                    Debuginfo.Log(LogLabel + "IK is null!");

                    GameObject tempIKTarget = new GameObject();
                    tempIKTarget.transform.parent = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01", true);
                    goIKTarget[m] = tempIKTarget;
                    goIKTarget[m].transform.position = trIKBones[m][2].position;

                    //if(trTargetIKBones.ContainsKey(m))
                    //   trTargetIKBones.Remove(m);
                }
                else if (goIKTarget[m].activeInHierarchy == false)
                {
                    //複数撮影でアタッチ対象のメイドさんがいなくなった場合
                    Debuginfo.Log(LogLabel + "IK is invisible!");

                    goIKTarget[m].transform.parent   = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01", true);
                    goIKTarget[m].transform.position = trIKBones[m][2].position;
                }

                if (isArm)
                {
                    if (isLeft && (maid.body0.tgtHandL != null || maid.body0.tgtHandL_AttachName != string.Empty))
                    {
                        return;
                    }
                    else if (maid.body0.tgtHandR != null || maid.body0.tgtHandR_AttachName != string.Empty)
                    {
                        return;
                    }
                }

                IK[m].Proc(trIKBones[m][0], trIKBones[m][1], trIKBones[m][2], goIKTarget[m].transform.position);
            }
        }
Example #20
0
        public frmTrackMain()
        {
            //Console.WriteLine("STARTING CMT");

            if(display)
            {
                InitializeComponent();
                File.Create(@"CMT_Timings\totals.txt");
                File.Create(@"CMT_Timings\process.txt");
                File.Create(@"CMT_Timings\keypoints.txt");
            }

            FileInfo assembly = new FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location);

            mTracker = new CMT();
            // Connect external delegate functions
            mTracker.ExtractKeypoints = new CMT.ExtractKeypointDelegate(ExternalBRISKKeypoints);
            mTracker.ExtractKeypointDescriptors = new CMT.ExtractKeypointDescriptorDelegate(ExternalBRISKDescriptors);
            mTracker.OpticalFlowFunction = new CMT.ComputeOpticalFlowDelegate(ExternalComputeLKOpticalFlow);

            mTracker.EstimateScale = true;
            mTracker.EstimateRotation = false;

            mROIMode = false;
            mTopLeft = false;
            mBottomRight = false;
            mCaptureTimer = new System.Timers.Timer(33);
            mCaptureTimer.AutoReset = false;
            mCaptureTimer.Elapsed += mCaptureTimer_Elapsed;
            //mCaptureTimer.Start();

            //overlay.MouseDown += overlay_MouseDown;

            // Start Tracking Code for MatLab Toolkit
            //isTracking = true;
            //while(isTracking)
            //{
                tracking();
            //}
        }
        public ActionResult SuaCMT(CMT cmt)
        {
            ModelQuyenNguoiDung quyenNguoiDung = Session["QuyenNguoiDung"] as ModelQuyenNguoiDung;

            if (quyenNguoiDung != null && (quyenNguoiDung.Quyen.Ten == "QuanLyThongTinHocSinh" || quyenNguoiDung.Quyen.Ten == "Admin"))
            {
                if (ModelState.IsValid)
                {
                    if (Session["file"] != null)
                    {
                        cmt.fileCMT = (string)Session["file"];
                    }
                    HOCSINH hs = db.HOCSINHs.SingleOrDefault(n => n.SoCMT == cmt.SoCMT);
                    db.Entry(cmt).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                    Session["chuyenTab"] = 2;
                    return(RedirectToAction("DetailChung/" + hs.id, "HocSinh"));
                }
                return(View(cmt));
            }
            return(RedirectToAction("Index", "Home"));
        }
        // GET: GiayTo
        public ActionResult Giaynhaphoc(int id)
        {
            ModelQuyenNguoiDung quyenNguoiDung = Session["QuyenNguoiDung"] as ModelQuyenNguoiDung;

            if (quyenNguoiDung != null && (quyenNguoiDung.Quyen.Ten == "QuanLyHoSo" || quyenNguoiDung.Quyen.Ten == "Admin"))
            {
                Session["chuyenTab"] = null;
                HOCSINH hs = db.HOCSINHs.Find(id);
                ViewBag.id_hsss = hs.id;
                ViewBag.sdt     = hs.sdt;
                CMT   cmt = db.CMTs.Find(hs.SoCMT);
                HOCBA hb  = db.HOCBAs.Find(hs.id_HB);
                if (cmt != null)
                {
                    ViewBag.tenhs        = dich.ReplaceUnicode(cmt.HoTen);
                    ViewBag.noisinh      = dich.ReplaceUnicode(cmt.QueQuan);
                    ViewBag.noithuongtru = dich.ReplaceUnicode(cmt.NoiThuongTru);
                }
                if (hb != null)
                {
                    ViewBag.noisonghientai = dich.ReplaceUnicode(hb.NoiSongHienTai);
                    ViewBag.gioiTinh       = hb.GioiTinh;
                    ViewBag.ngaySinh       = hb.NgaySinh;
                }

                // dua ra danh sach thanh vien gia dinh
                List <HoKhau> listHK = db.HoKhaus.Where(n => n.id_hs == id).ToList();
                ViewBag.dstv = listHK;
                //giay nhap hoc
                GiayNhapHoc giaynhaphoc = db.GiayNhapHocs.SingleOrDefault(n => n.id_hs == hs.id);
                if (giaynhaphoc != null)
                {
                    View(giaynhaphoc);
                }
                return(View());
            }

            return(RedirectToAction("Index", "Home"));
        }
        public ActionResult SuaCMT(CMT cmt) //chú ý kh lấy đc id_hs=> update bảng học sinh khi đã chỉnh sửa
        {
            ModelQuyenNguoiDung quyenNguoiDung = Session["QuyenNguoiDung"] as ModelQuyenNguoiDung;

            if (quyenNguoiDung != null && (quyenNguoiDung.Quyen.Ten == "QuanLyThongTinHocSinh" || quyenNguoiDung.Quyen.Ten == "Admin"))
            {
                if (ModelState.IsValid)
                {
                    int id_hs = (int)Session["id_hsDetail"];
                    if (Session["file"] != null)
                    {
                        cmt.fileCMT = (string)Session["file"];
                    }
                    db.Entry(cmt).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                    Session["chuyenTab"] = 2;
                    return(RedirectToAction("DetailChung/" + id_hs, "HocSinh"));
                }
                return(View(cmt));
            }
            return(RedirectToAction("Index", "Home"));
        }
 public JsonResult themCMT(CMT cmt)
 {
     if (ModelState.IsValid)
     {
         int id_hs = (int)Session["id_hs"];
         db.CMTs.Add(cmt);
         //Tự động add thêm thông tin cmt vào bảng HOCSINH
         HOCSINH hs = db.HOCSINHs.SingleOrDefault(n => n.id == id_hs);
         hs.SoCMT = cmt.SoCMT;
         db.SaveChanges();
         if (xulyLoi.CheckString(hs.TenHS, cmt.HoTen) == false)
         {
             Session["Loi"] = "Họ tên giữa Học sinh và chứng minh thư có sự khác nhau";
         }
         else
         {
             Session["Loi"] = "Đúng";
         }
         return(Json(cmt, JsonRequestBehavior.AllowGet));
     }
     return(Json(cmt, JsonRequestBehavior.AllowGet));
 }
        public JsonResult ChinhSuaLoiQueQuan(List <string> listKey)
        {
            LoiModel  chitietLoi = new LoiModel();
            int       idLoi      = Int32.Parse(listKey[0]);
            string    QueQuanCMT = listKey[1];
            string    QueQuanGKS = listKey[2];
            TABLE_LOI tableLoi   = db.TABLE_LOI.Find(idLoi);
            string    typeLoi    = tableLoi.TypeLOI;

            if (QueQuanCMT != null)
            {
                CMT cmt = db.CMTs.Find(tableLoi.So_CMT);
                cmt.QueQuan         = QueQuanCMT;
                db.Entry(cmt).State = System.Data.Entity.EntityState.Modified;
            }
            if (QueQuanGKS != null)
            {
                GIAYKHAISINH gks = db.GIAYKHAISINHs.Find(tableLoi.id_GKS);
                gks.QueQuan         = QueQuanGKS;
                db.Entry(gks).State = System.Data.Entity.EntityState.Modified;
            }
            db.SaveChanges();
            return(Json(true, JsonRequestBehavior.AllowGet));
        }
Example #26
0
        private Transform GetOrSetCopyBone(Transform root, Transform fromBone)
        {
            Transform result;

            if (this.fromToBoneDic.ContainsKey(fromBone))
            {
                result = this.fromToBoneDic[fromBone];
            }
            else if (fromBone.parent == null)
            {
                result = null;
            }
            else
            {
                BoneRendererAssist component;
                if (this.fromToBoneDic.ContainsKey(fromBone.parent))
                {
                    component = this.fromToBoneDic[fromBone.parent].GetComponent <BoneRendererAssist>();
                    if (this.parentChildDic.ContainsKey(fromBone.name))
                    {
                        string    name       = this.parentChildDic[fromBone.name];
                        Transform transform2 = CMT.SearchObjName(root.transform, name, false);
                        if (transform2)
                        {
                            component = this.GetOrSetCopyBone(root, transform2).GetComponent <BoneRendererAssist>();
                        }
                    }
                }
                else
                {
                    Transform transform3 = this.GetOrSetCopyBone(root, fromBone.parent);
                    if (transform3 == null)
                    {
                        return(null);
                    }
                    component = transform3.GetComponent <BoneRendererAssist>();
                }
                Transform transform4 = new GameObject().transform;
                transform4.name = fromBone.name;
                this.copyBoneList.Add(transform4);
                this.fromToBoneDic.Add(fromBone, transform4);
                this.toFromBoneDic.Add(transform4, fromBone);
                transform4.parent = this.boneRendererRoot;
                CopyTransform copyTransform = transform4.gameObject.AddComponent <CopyTransform>();
                copyTransform.bScl = false;
                copyTransform.SetTarget(this.toFromBoneDic[transform4]);
                BoneRendererAssist boneRendererAssist = transform4.gameObject.AddComponent <BoneRendererAssist>();
                boneRendererAssist.SetSelectable(this.selectable);
                if (component)
                {
                    boneRendererAssist.SetParent(component);
                    if (this.firstChildDic.ContainsKey(transform4.name) && this.firstChildDic[transform4.name] == component.transform.name)
                    {
                        component.SetFirstChild(boneRendererAssist);
                    }
                    else
                    {
                        component.SetChild(boneRendererAssist);
                    }
                }
                if (this.boneDisplay == BoneDisplay.Visible)
                {
                    boneRendererAssist.SetVisible(this.JudgeVisibleBone(boneRendererAssist));
                }
                else
                {
                    boneRendererAssist.SetVisible(false);
                }
                boneRendererAssist.SetColor(Setting.normalBoneColor.GetValue());
                this.braList.Add(boneRendererAssist);
                result = transform4;
            }
            return(result);
        }
Example #27
0
 public CMTTracker(Emgu.CV.Image<Bgr, byte> roi)
 {
     // I HAD TO CHANGE CMT TO PUBLIC FOR THIS TO WORK.
     cmtEngine = new CMT_Tracker.CMT();
     surfEngine = new SURFEngine(roi);
 }
        private static void ApplyObjectDataToObject(ObjectData objectData)
        {
            bool             flag = Setting.targetSelectMode == 0;
            BackUpObjectData backUpObjectData;
            BackUpBoneData   backUpBoneData;

            if (flag)
            {
                backUpObjectData = BackUpData.GetOrAddMaidObjectData(CommonUIData.maid, CommonUIData.slotNo, CommonUIData.obj);
                backUpBoneData   = BackUpData.GetOrAddMaidBoneData(CommonUIData.maid, CommonUIData.slotNo, CommonUIData.obj, CommonUIData.obj.transform);
            }
            else
            {
                backUpObjectData = BackUpData.GetOrAddObjectData(CommonUIData.obj);
                backUpBoneData   = BackUpData.GetOrAddBoneData(CommonUIData.obj, CommonUIData.obj.transform);
            }
            bool flag2 = Setting.targetSelectMode == 0;

            if (flag2)
            {
                bool flag3 = CommonUIData.slotNo != -1;
                if (flag3)
                {
                    bool changedYure = backUpObjectData.changedYure;
                    if (changedYure)
                    {
                        bool flag4 = YureUtil.GetYureState(CommonUIData.maid, CommonUIData.slotNo) != objectData.bYure;
                        if (flag4)
                        {
                            backUpObjectData.changedYure = false;
                            backUpObjectData.bYure       = true;
                            YureUtil.SetYureState(CommonUIData.maid, CommonUIData.slotNo, objectData.bYure);
                        }
                    }
                    else
                    {
                        bool flag5 = YureUtil.GetYureState(CommonUIData.maid, CommonUIData.slotNo) != objectData.bYure;
                        if (flag5)
                        {
                            backUpObjectData.changedYure = true;
                            backUpObjectData.bYure       = YureUtil.GetYureState(CommonUIData.maid, CommonUIData.slotNo);
                            YureUtil.SetYureState(CommonUIData.maid, CommonUIData.slotNo, objectData.bYure);
                        }
                    }
                }
                bool bMaidParts = objectData.bMaidParts;
                if (bMaidParts)
                {
                    bool flag6 = !backUpBoneData.changedPos;
                    if (flag6)
                    {
                        backUpBoneData.position   = CommonUIData.obj.transform.localPosition;
                        backUpBoneData.changedPos = true;
                    }
                    CommonUIData.obj.transform.localPosition = objectData.rootData.position;
                    bool flag7 = !backUpBoneData.changedRot;
                    if (flag7)
                    {
                        backUpBoneData.rotation   = CommonUIData.obj.transform.localRotation;
                        backUpBoneData.changedRot = true;
                    }
                    CommonUIData.obj.transform.localRotation = objectData.rootData.rotation;
                }
            }
            bool flag8 = !backUpBoneData.changedScl;

            if (flag8)
            {
                backUpBoneData.scale      = CommonUIData.obj.transform.localScale;
                backUpBoneData.changedScl = true;
            }
            CommonUIData.obj.transform.localScale = objectData.rootData.scale;
            foreach (ObjectData.TransformData transformData in objectData.transformDataList)
            {
                bool      flag9 = Setting.targetSelectMode == 0 && CommonUIData.slotNo == -1;
                Transform transform;
                if (flag9)
                {
                    transform = CMT.SearchObjName(CommonUIData.obj.transform, transformData.name, true);
                }
                else
                {
                    transform = CMT.SearchObjName(CommonUIData.obj.transform, transformData.name, false);
                }
                bool flag10 = !transform;
                if (!flag10)
                {
                    bool           flag11 = Setting.targetSelectMode == 0;
                    BackUpBoneData backUpBoneData2;
                    if (flag11)
                    {
                        backUpBoneData2 = BackUpData.GetOrAddMaidBoneData(CommonUIData.maid, CommonUIData.slotNo, CommonUIData.obj, transform);
                    }
                    else
                    {
                        backUpBoneData2 = BackUpData.GetOrAddBoneData(CommonUIData.obj, transform);
                    }
                    bool flag12 = !backUpBoneData2.changedPos;
                    if (flag12)
                    {
                        backUpBoneData2.position   = transform.localPosition;
                        backUpBoneData2.changedPos = true;
                    }
                    transform.localPosition = transformData.position;
                    bool flag13 = !backUpBoneData2.changedRot;
                    if (flag13)
                    {
                        backUpBoneData2.rotation   = transform.localRotation;
                        backUpBoneData2.changedRot = true;
                    }
                    transform.localRotation = transformData.rotation;
                    bool flag14 = !backUpBoneData2.changedScl;
                    if (flag14)
                    {
                        backUpBoneData2.scale      = transform.localScale;
                        backUpBoneData2.changedScl = true;
                    }
                    transform.localScale = transformData.scale;
                }
            }
        }
        public static ObjectData GetObjectDataFromObject()
        {
            PresetManager.trsHash = new HashSet <Transform>();
            ObjectData objectData = new ObjectData();

            objectData.version    = "0.1.6";
            objectData.bMaidParts = (Setting.targetSelectMode == 0);
            ObjectData.TransformData transformData = new ObjectData.TransformData();
            transformData.name = CommonUIData.obj.name;
            bool flag = Setting.targetSelectMode == 0;

            if (flag)
            {
                transformData.position = CommonUIData.obj.transform.localPosition;
                transformData.rotation = CommonUIData.obj.transform.localRotation;
            }
            transformData.scale = CommonUIData.obj.transform.localScale;
            objectData.rootData = transformData;
            bool flag2 = Setting.targetSelectMode == 0;

            if (flag2)
            {
                bool flag3 = CommonUIData.slotNo == -1;
                if (flag3)
                {
                    objectData.bYure    = false;
                    objectData.slotName = "base";
                }
                else
                {
                    objectData.bYure    = YureUtil.GetYureState(CommonUIData.maid, CommonUIData.slotNo);
                    objectData.slotName = SlotUtil.GetSlotName(CommonUIData.slotNo);
                }
            }
            else
            {
                objectData.bYure = false;
            }
            bool flag4 = Setting.targetSelectMode == 0 && CommonUIData.slotNo == -1;

            Transform[] array;
            if (flag4)
            {
                SkinnedMeshRenderer componentInChildren = CommonUIData.maid.body0.goSlot[0].obj.GetComponentInChildren <SkinnedMeshRenderer>();
                array = (from bone in componentInChildren.bones
                         where bone != null
                         select CMT.SearchObjName(CommonUIData.obj.transform, bone.name, true) into bone
                         where bone != null
                         select bone).ToArray <Transform>();
            }
            else
            {
                SkinnedMeshRenderer componentInChildren2 = CommonUIData.obj.GetComponentInChildren <SkinnedMeshRenderer>();
                array = (from bone in componentInChildren2.bones
                         where bone != null
                         select bone).ToArray <Transform>();
            }
            foreach (Transform transform in array)
            {
                Transform transform2 = transform;
                while (transform2 != CommonUIData.obj.transform)
                {
                    bool flag5 = !transform2;
                    if (flag5)
                    {
                        Debug.Log("ルートオブジェクト配下にありません:" + transform.name);
                        return(null);
                    }
                    bool flag6 = PresetManager.trsHash.Contains(transform2);
                    if (flag6)
                    {
                        break;
                    }
                    ObjectData.TransformData transformData2 = new ObjectData.TransformData();
                    transformData2.name     = transform2.name;
                    transformData2.scale    = transform2.localScale;
                    transformData2.position = transform2.localPosition;
                    transformData2.rotation = transform2.localRotation;
                    objectData.transformDataList.Add(transformData2);
                    PresetManager.trsHash.Add(transform2);
                    transform2 = transform2.parent;
                }
            }
            return(objectData);
        }
Example #30
0
        // スライダー範囲を拡大
        void WideSlider(Maid maid)
        {
            if (!ExSaveData.GetBool(maid, PluginName, "WIDESLIDER", false))
            {
                return;
            }

            TBody tbody = maid.body0;

            //string[] PropNames = BoneMorph_PropNames;
            if (tbody == null || tbody.bonemorph == null || tbody.bonemorph.bones == null)
            {
                return;
            }
            BoneMorph_ boneMorph_ = tbody.bonemorph;

            // スケール変更するボーンのリスト
            Dictionary <string, Vector3> boneScale = new Dictionary <string, Vector3>();

            // ポジション変更するボーンのリスト
            Dictionary <string, Vector3> bonePosition = new Dictionary <string, Vector3>();

            //この配列に記載があるボーンは頭に影響を与えずにTransformを反映させる。
            //ただしボディに繋がっている中のアレは影響を受ける。
            string[] ignoreHeadBones = new string[] { "Bip01 Spine1a" };

            float eyeAngAngle;
            float eyeAngX;
            float eyeAngY;
            {
                float ra = ExSaveData.GetFloat(maid, PluginName, "EYE_ANG.angle", 0f);
                float rx = ExSaveData.GetFloat(maid, PluginName, "EYE_ANG.x", 0f);
                float ry = ExSaveData.GetFloat(maid, PluginName, "EYE_ANG.y", 0f);

                rx += -9f;
                ry += -17f;

                rx /= 1000f;
                ry /= 1000f;

                eyeAngAngle = ra;
                eyeAngX     = rx;
                eyeAngY     = ry;
            }

            Vector3 thiScl = new Vector3(
                1.0f,
                ExSaveData.GetFloat(maid, PluginName, "THISCL.depth", 1f),
                ExSaveData.GetFloat(maid, PluginName, "THISCL.width", 1f));

            Vector3 thiPosL;
            Vector3 thiPosR;

            {
                float dx = ExSaveData.GetFloat(maid, PluginName, "THIPOS.x", 0f);
                float dz = ExSaveData.GetFloat(maid, PluginName, "THIPOS.z", 0f);
                float dy = 0.0f;
                thiPosL = new Vector3(dy, dz / 1000f, -dx / 1000f);
                thiPosR = new Vector3(dy, dz / 1000f, dx / 1000f);
            }
            bonePosition["Bip01 L Thigh"] = thiPosL;
            bonePosition["Bip01 R Thigh"] = thiPosR;

            Vector3 thi2PosL;
            Vector3 thi2PosR;

            {
                float dx = ExSaveData.GetFloat(maid, PluginName, "THI2POS.x", 0f);
                float dz = ExSaveData.GetFloat(maid, PluginName, "THI2POS.z", 0f);
                float dy = ExSaveData.GetFloat(maid, PluginName, "THI2POS.y", 0f);
                thi2PosL = new Vector3(dy / 1000f, dz / 1000f, -dx / 1000f);
                thi2PosR = new Vector3(dy / 1000f, dz / 1000f, dx / 1000f);
            }
            bonePosition["Bip01 L Thigh_SCL_"] = thi2PosL;
            bonePosition["Bip01 R Thigh_SCL_"] = thi2PosR;

            // 元々足の位置と連動しており、追加するときに整合性を保つため足の位置との和で計算
            Vector3 hipPosL;
            Vector3 hipPosR;

            {
                float dx = ExSaveData.GetFloat(maid, PluginName, "HIPPOS.x", 0f);
                float dy = ExSaveData.GetFloat(maid, PluginName, "HIPPOS.y", 0f);
                float dz = ExSaveData.GetFloat(maid, PluginName, "HIPPOS.z", 0f);
                hipPosL = new Vector3(dy / 1000f, dz / 1000f, -dx / 1000f);
                hipPosR = new Vector3(dy / 1000f, dz / 1000f, dx / 1000f);
            }
            bonePosition["Hip_L"] = thiPosL + hipPosL;
            bonePosition["Hip_R"] = thiPosR + hipPosR;

            Vector3 mtwPosL;
            Vector3 mtwPosR;

            {
                float dx = ExSaveData.GetFloat(maid, PluginName, "MTWPOS.x", 0f);
                float dy = ExSaveData.GetFloat(maid, PluginName, "MTWPOS.y", 0f);
                float dz = ExSaveData.GetFloat(maid, PluginName, "MTWPOS.z", 0f);
                mtwPosL = new Vector3(dx / 10f, dy / 10f, dz / 10f);
                mtwPosR = new Vector3(dx / 10f, dy / 10f, -dz / 10f);
            }
            bonePosition["momotwist_L"] = mtwPosL;
            bonePosition["momotwist_R"] = mtwPosR;

            Vector3 mmnPosL;
            Vector3 mmnPosR;

            {
                float dx = ExSaveData.GetFloat(maid, PluginName, "MMNPOS.x", 0f);
                float dy = ExSaveData.GetFloat(maid, PluginName, "MMNPOS.y", 0f);
                float dz = ExSaveData.GetFloat(maid, PluginName, "MMNPOS.z", 0f);
                mmnPosL = new Vector3(dx / 10f, dy / 10f, dz / 10f);
                mmnPosR = new Vector3(dx / 10f, -dy / 10f, dz / 10f);
            }
            bonePosition["momoniku_L"] = mmnPosL;
            bonePosition["momoniku_R"] = mmnPosR;

            Vector3 skirtPos;

            {
                float dx = ExSaveData.GetFloat(maid, PluginName, "SKTPOS.x", 0f);
                float dy = ExSaveData.GetFloat(maid, PluginName, "SKTPOS.y", 0f);
                float dz = ExSaveData.GetFloat(maid, PluginName, "SKTPOS.z", 0f);
                skirtPos = new Vector3(-dz / 10f, -dy / 10f, dx / 10f);
            }
            bonePosition["Skirt"] = skirtPos;

            Vector3 spinePos;

            {
                float dx = ExSaveData.GetFloat(maid, PluginName, "SPIPOS.x", 0f);
                float dy = ExSaveData.GetFloat(maid, PluginName, "SPIPOS.y", 0f);
                float dz = ExSaveData.GetFloat(maid, PluginName, "SPIPOS.z", 0f);
                spinePos = new Vector3(-dx / 10f, dy / 10f, dz / 10f);
            }
            bonePosition["Bip01 Spine"] = spinePos;

            Vector3 spine0aPos;

            {
                float dx = ExSaveData.GetFloat(maid, PluginName, "S0APOS.x", 0f);
                float dy = ExSaveData.GetFloat(maid, PluginName, "S0APOS.y", 0f);
                float dz = ExSaveData.GetFloat(maid, PluginName, "S0APOS.z", 0f);
                spine0aPos = new Vector3(-dx / 10f, dy / 10f, dz / 10f);
            }
            bonePosition["Bip01 Spine0a"] = spine0aPos;

            Vector3 spine1Pos;

            {
                float dx = ExSaveData.GetFloat(maid, PluginName, "S1POS.x", 0f);
                float dy = ExSaveData.GetFloat(maid, PluginName, "S1POS.y", 0f);
                float dz = ExSaveData.GetFloat(maid, PluginName, "S1POS.z", 0f);
                spine1Pos = new Vector3(-dx / 10f, dy / 10f, dz / 10f);
            }
            bonePosition["Bip01 Spine1"] = spine1Pos;

            Vector3 spine1aPos;

            {
                float dx = ExSaveData.GetFloat(maid, PluginName, "S1APOS.x", 0f);
                float dy = ExSaveData.GetFloat(maid, PluginName, "S1APOS.y", 0f);
                float dz = ExSaveData.GetFloat(maid, PluginName, "S1APOS.z", 0f);
                spine1aPos = new Vector3(-dx / 10f, dy / 10f, dz / 10f);
            }
            bonePosition["Bip01 Spine1a"] = spine1aPos;

            Vector3 neckPos;

            {
                float dx = ExSaveData.GetFloat(maid, PluginName, "NECKPOS.x", 0f);
                float dy = ExSaveData.GetFloat(maid, PluginName, "NECKPOS.y", 0f);
                float dz = ExSaveData.GetFloat(maid, PluginName, "NECKPOS.z", 0f);
                neckPos = new Vector3(-dx / 10f, dy / 10f, dz / 10f);
            }
            bonePosition["Bip01 Neck"] = neckPos;

            Vector3 clvPosL;
            Vector3 clvPosR;

            {
                float dx = ExSaveData.GetFloat(maid, PluginName, "CLVPOS.x", 0f);
                float dz = ExSaveData.GetFloat(maid, PluginName, "CLVPOS.z", 0f);
                float dy = ExSaveData.GetFloat(maid, PluginName, "CLVPOS.y", 0f);
                clvPosL = new Vector3(-dx / 10f, dy / 10f, dz / 10f);
                clvPosR = new Vector3(-dx / 10f, dy / 10f, -dz / 10f);
            }
            bonePosition["Bip01 L Clavicle"] = clvPosL;
            bonePosition["Bip01 R Clavicle"] = clvPosR;

            Vector3 muneSubPosL;
            Vector3 muneSubPosR;

            {
                float dx = ExSaveData.GetFloat(maid, PluginName, "MUNESUBPOS.x", 0f);
                float dz = ExSaveData.GetFloat(maid, PluginName, "MUNESUBPOS.z", 0f);
                float dy = ExSaveData.GetFloat(maid, PluginName, "MUNESUBPOS.y", 0f);
                muneSubPosL = new Vector3(-dy / 10f, dz / 10f, -dx / 10f);
                muneSubPosR = new Vector3(-dy / 10f, -dz / 10f, -dx / 10f);
            }
            bonePosition["Mune_L_sub"] = muneSubPosL;
            bonePosition["Mune_R_sub"] = muneSubPosR;

            Vector3 munePosL;
            Vector3 munePosR;

            {
                float dx = ExSaveData.GetFloat(maid, PluginName, "MUNEPOS.x", 0f);
                float dz = ExSaveData.GetFloat(maid, PluginName, "MUNEPOS.z", 0f);
                float dy = ExSaveData.GetFloat(maid, PluginName, "MUNEPOS.y", 0f);
                munePosL = new Vector3(dz / 10f, -dy / 10f, dx / 10f);
                munePosR = new Vector3(dz / 10f, -dy / 10f, -dx / 10f);
            }
            bonePosition["Mune_L"] = munePosL;
            bonePosition["Mune_R"] = munePosR;

            // スケール変更するボーンをリストに一括登録
            SetBoneScaleFromList(boneScale, maid, boneAndPropNameList);

            // 元々尻はPELSCLに連動していたが単体でも設定できるようにする
            // ただし元との整合性をとるため乗算する
            Vector3 pelScl = new Vector3(
                ExSaveData.GetFloat(maid, PluginName, "PELSCL.height", 1f),
                ExSaveData.GetFloat(maid, PluginName, "PELSCL.depth", 1f),
                ExSaveData.GetFloat(maid, PluginName, "PELSCL.width", 1f));
            Vector3 hipScl = new Vector3(
                ExSaveData.GetFloat(maid, PluginName, "HIPSCL.height", 1f) * pelScl.x,
                ExSaveData.GetFloat(maid, PluginName, "HIPSCL.depth", 1f) * pelScl.y,
                ExSaveData.GetFloat(maid, PluginName, "HIPSCL.width", 1f) * pelScl.z);

            boneScale["Hip_L"] = hipScl;
            boneScale["Hip_R"] = hipScl;

            Transform tEyePosL = null;
            Transform tEyePosR = null;

            float sliderScale = 20f;

            for (int i = boneMorph_.bones.Count - 1; i >= 0; i--)
            {
                BoneMorphLocal boneMorphLocal = boneMorph_.bones[i];
                Vector3        scl            = new Vector3(1f, 1f, 1f);
                Vector3        pos            = boneMorphLocal.pos;
                //for (int j = 0; j < (int)PropNames.Length; j++)
                for (int j = 0; j < BoneMorph.PropNames.Length; j++)
                {
                    float s = 1f;
                    switch (j)
                    {
                    case 0:
                        s = boneMorph_.SCALE_Kubi;
                        break;

                    case 1:
                        s = boneMorph_.SCALE_Ude;
                        break;

                    case 2:
                        s = boneMorph_.SCALE_EyeX;
                        break;

                    case 3:
                        s = boneMorph_.SCALE_EyeY;
                        break;

                    case 4:
                        s = boneMorph_.Postion_EyeX * (0.5f + boneMorph_.Postion_EyeY * 0.5f);
                        break;

                    case 5:
                        s = boneMorph_.Postion_EyeY;
                        break;

                    case 6:
                        s = boneMorph_.SCALE_HeadX;
                        break;

                    case 7:
                        s = boneMorph_.SCALE_HeadY;
                        break;

                    case 8:
                        s = boneMorph_.SCALE_DouPer;
                        if (boneMorphLocal.Kahanshin == 0f)
                        {
                            s = 1f - s;
                        }
                        break;

                    case 9:
                        s = boneMorph_.SCALE_Sintyou;
                        break;

                    case 10:
                        s = boneMorph_.SCALE_Koshi;
                        break;

                    case 11:
                        s = boneMorph_.SCALE_Kata;
                        break;

                    case 12:
                        s = boneMorph_.SCALE_West;
                        break;

                    default:
                        s = 1f;
                        break;
                    }

                    if ((boneMorphLocal.atr & 1L << (j & 63)) != 0L)
                    {
                        Vector3 v0 = boneMorphLocal.vecs_min[j];
                        Vector3 v1 = boneMorphLocal.vecs_max[j];

                        Vector3 n0 = v0 * sliderScale - v1 * (sliderScale - 1f);
                        Vector3 n1 = v1 * sliderScale - v0 * (sliderScale - 1f);
                        float   f  = (s + sliderScale - 1f) * (1f / (sliderScale * 2.0f - 1f));
                        scl = Vector3.Scale(scl, Vector3.Lerp(n0, n1, f));
                    }

                    if ((boneMorphLocal.atr & 1L << (j + 32 & 63)) != 0L)
                    {
                        Vector3 v0 = boneMorphLocal.vecs_min[j + 32];
                        Vector3 v1 = boneMorphLocal.vecs_max[j + 32];

                        Vector3 n0 = v0 * sliderScale - v1 * (sliderScale - 1f);
                        Vector3 n1 = v1 * sliderScale - v0 * (sliderScale - 1f);
                        float   f  = (s + sliderScale - 1f) * (1f / (sliderScale * 2.0f - 1f));
                        pos = Vector3.Scale(pos, Vector3.Lerp(n0, n1, f));
                    }
                }

                Transform linkT = boneMorphLocal.linkT;
                if (linkT == null)
                {
                    continue;
                }

                string name = linkT.name;

                if (name != null && name.Contains("Thigh_SCL_"))
                {
                    boneMorph_.SnityouOutScale = Mathf.Pow(scl.x, 0.9f);
                }

                // リストに登録されているボーンのスケール設定
                if (name != null && boneScale.ContainsKey(name))
                {
                    scl = Vector3.Scale(scl, boneScale[name]);
                }

                // リストに登録されているボーンのポジション設定
                if (name != null && bonePosition.ContainsKey(name))
                {
                    pos += bonePosition[name];
                }

                Transform muneLParent = f_muneLParent.GetValue(tbody) as Transform;
                Transform muneLChild  = f_muneLChild.GetValue(tbody) as Transform;
                Transform muneRParent = f_muneRParent.GetValue(tbody) as Transform;
                Transform muneRChild  = f_muneRChild.GetValue(tbody) as Transform;
                Transform muneLSub    = f_muneLSub.GetValue(tbody) as Transform;
                Transform muneRSub    = f_muneRSub.GetValue(tbody) as Transform;
                if (muneLChild && muneLParent && muneRChild && muneRParent)
                {
                    muneLChild.localPosition  = muneLSub.localPosition;
                    muneLParent.localPosition = muneLSub.localPosition;
                    muneRChild.localPosition  = muneRSub.localPosition;
                    muneRParent.localPosition = muneRSub.localPosition;
                }

                // ignoreHeadBonesに登録されている場合はヒラエルキーを辿って頭のツリーを無視
                if (name != null)
                {
                    if (!(ignoreHeadBones.Contains(name) && CMT.SearchObjObj(maid.body0.m_Bones.transform.Find("Bip01"), linkT)))
                    {
                        linkT.localScale = scl;
                    }
                    linkT.localPosition = pos;
                }

                if (name != null)
                {
                    if (name == "Eyepos_L")
                    {
                        tEyePosL = linkT;
                    }
                    else if (name == "Eyepos_R")
                    {
                        tEyePosR = linkT;
                    }
                }
            }

            // 目のサイズ・角度変更
            // EyeScaleRotate : 目のサイズと角度変更する CM3D.MaidVoicePich.Plugin.cs の追加メソッド
            // http://pastebin.com/DBuN5Sws
            // その1>>923
            // http://jbbs.shitaraba.net/bbs/read.cgi/game/55179/1438196715/923
            if (tEyePosL != null)
            {
                Transform linkT       = tEyePosL;
                Vector3   localCenter = linkT.localPosition + (new Vector3(0f, eyeAngY, eyeAngX));          // ローカル座標系での回転中心位置
                Vector3   worldCenter = linkT.parent.TransformPoint(localCenter);                           // ワールド座標系での回転中心位置
                Vector3   localAxis   = new Vector3(-1f, 0f, 0f);                                           // ローカル座標系での回転軸
                Vector3   worldAxis   = linkT.TransformDirection(localAxis);                                // ワールド座標系での回転軸

                linkT.localRotation = new Quaternion(-0.00560432f, -0.001345155f, 0.06805823f, 0.9976647f); // 初期の回転量
                linkT.RotateAround(worldCenter, worldAxis, eyeAngAngle);
            }
            if (tEyePosR != null)
            {
                Transform linkT       = tEyePosR;
                Vector3   localCenter = linkT.localPosition + (new Vector3(0f, eyeAngY, -eyeAngX));          // ローカル座標系での回転中心位置
                Vector3   worldCenter = linkT.parent.TransformPoint(localCenter);                            // ワールド座標系での回転中心位置
                Vector3   localAxis   = new Vector3(-1f, 0f, 0f);                                            // ローカル座標系での回転軸
                Vector3   worldAxis   = linkT.TransformDirection(localAxis);                                 // ワールド座標系での回転軸

                linkT.localRotation = new Quaternion(0.9976647f, 0.06805764f, -0.001350592f, -0.005603582f); // 初期の回転量
                linkT.RotateAround(worldCenter, worldAxis, -eyeAngAngle);
            }

            // COM3D2追加処理
            // ボーンポジション系
            var listBoneMorphPos = Helper.GetInstanceField(typeof(BoneMorph_), boneMorph_, "m_listBoneMorphPos");
            var ienumPos         = listBoneMorphPos as IEnumerable;

            System.Reflection.Assembly asmPos = System.Reflection.Assembly.GetAssembly(typeof(BoneMorph_));
            Type listBoneMorphPosType         = listBoneMorphPos.GetType();
            Type boneMorphPosType             = asmPos.GetType("BoneMorph_+BoneMorphPos");

            foreach (object o in ienumPos)
            {
                string    strPropName = (string)Helper.GetInstanceField(boneMorphPosType, o, "strPropName");
                Transform trs         = (Transform)Helper.GetInstanceField(boneMorphPosType, o, "trBone");
                Vector3   defPos      = (Vector3)Helper.GetInstanceField(boneMorphPosType, o, "m_vDefPos");
                Vector3   addMin      = (Vector3)Helper.GetInstanceField(boneMorphPosType, o, "m_vAddMin");
                Vector3   addMax      = (Vector3)Helper.GetInstanceField(boneMorphPosType, o, "m_vAddMax");

                if (strPropName == "Nosepos")
                {
                    trs.localPosition = Lerp(addMin, defPos, addMax, (float)boneMorph_.POS_Nose, sliderScale);
                }
                else if (strPropName == "MayuY")
                {
                    trs.localPosition = Lerp(addMin, defPos, addMax, (float)boneMorph_.POS_MayuY, sliderScale);
                }
                else if (strPropName == "EyeBallPosYL" || strPropName == "EyeBallPosYR")
                {
                    trs.localPosition = Lerp(addMin, defPos, addMax, (float)boneMorph_.EyeBallPosY, sliderScale);
                }
                else if (strPropName == "Mayupos_L" || strPropName == "Mayupos_R")
                {
                    Vector3 vector3_1 = Lerp(addMin, defPos, addMax, (float)boneMorph_.POS_MayuY, sliderScale);
                    float   x1        = addMin.x;
                    addMin.x = addMax.x;
                    addMax.x = x1;
                    Vector3 vector3_2 = Lerp(addMin, defPos, addMax, (float)boneMorph_.POS_MayuX, sliderScale);
                    float   x3        = vector3_2.x + vector3_1.x - defPos.x;
                    trs.localPosition = new Vector3(x3, vector3_1.y, vector3_2.z);
                }
            }

            // ボーンスケール系
            var listBoneMorphScl = Helper.GetInstanceField(typeof(BoneMorph_), boneMorph_, "m_listBoneMorphScl");
            var ienumScl         = listBoneMorphScl as IEnumerable;

            System.Reflection.Assembly asmScl = System.Reflection.Assembly.GetAssembly(typeof(BoneMorph_));
            Type listBoneMorphSclType         = listBoneMorphScl.GetType();
            Type boneMorphSclType             = asmScl.GetType("BoneMorph_+BoneMorphScl");

            foreach (object o in ienumScl)
            {
                string    strPropName = (string)Helper.GetInstanceField(boneMorphSclType, o, "strPropName");
                Transform trs         = (Transform)Helper.GetInstanceField(boneMorphSclType, o, "trBone");
                Vector3   defScl      = (Vector3)Helper.GetInstanceField(boneMorphSclType, o, "m_vDefScl");
                Vector3   addMin      = (Vector3)Helper.GetInstanceField(boneMorphSclType, o, "m_vAddMin");
                Vector3   addMax      = (Vector3)Helper.GetInstanceField(boneMorphSclType, o, "m_vAddMax");

                if (strPropName == "Earscl_L" || strPropName == "Earscl_R")
                {
                    trs.localScale = Lerp(addMin, defScl, addMax, (float)boneMorph_.SCALE_Ear, sliderScale);
                }
                else if (strPropName == "Nosescl")
                {
                    trs.localScale = Lerp(addMin, defScl, addMax, (float)boneMorph_.SCALE_Nose, sliderScale);
                }
                else if (strPropName == "EyeBallSclXL" || strPropName == "EyeBallSclXR")
                {
                    Vector3 localScale = trs.localScale;
                    localScale.z   = Lerp(addMin, defScl, addMax, (float)boneMorph_.EyeBallSclX, sliderScale).z;
                    trs.localScale = localScale;
                }
                else if (strPropName == "EyeBallSclYL" || strPropName == "EyeBallSclYR")
                {
                    Vector3 localScale = trs.localScale;
                    localScale.y   = Lerp(addMin, defScl, addMax, (float)boneMorph_.EyeBallSclY, sliderScale).y;
                    trs.localScale = localScale;
                }
            }

            // ボーンローテーション系
            var listBoneMorphRot = Helper.GetInstanceField(typeof(BoneMorph_), boneMorph_, "m_listBoneMorphRot");
            var ienumRot         = listBoneMorphRot as IEnumerable;

            System.Reflection.Assembly asmRot = System.Reflection.Assembly.GetAssembly(typeof(BoneMorph_));
            Type listBoneMorphRotType         = listBoneMorphRot.GetType();
            Type boneMorphRotType             = asmRot.GetType("BoneMorph_+BoneMorphRotatio");

            foreach (object o in ienumRot)
            {
                string     strPropName = (string)Helper.GetInstanceField(boneMorphRotType, o, "strPropName");
                Transform  trs         = (Transform)Helper.GetInstanceField(boneMorphRotType, o, "trBone");
                Quaternion defRot      = (Quaternion)Helper.GetInstanceField(boneMorphRotType, o, "m_vDefRotate");
                Quaternion addMin      = (Quaternion)Helper.GetInstanceField(boneMorphRotType, o, "m_vAddMin");
                Quaternion addMax      = (Quaternion)Helper.GetInstanceField(boneMorphRotType, o, "m_vAddMax");

                if (strPropName == "Earrot_L" || strPropName == "Earrot_R")
                {
                    trs.localRotation = RotLerp(addMin, defRot, addMax, (float)boneMorph_.ROT_Ear, sliderScale);
                }
                else if (strPropName == "Mayurot_L" || strPropName == "Mayurot_R")
                {
                    trs.localRotation = RotLerp(addMin, defRot, addMax, (float)boneMorph_.ROT_Mayu, sliderScale);
                }
            }
        }
        public ActionResult XoaHocSinh(int id)
        {
            //xóa dữ liệu trong bảng học sinh
            HOCSINH hocsinh = db.HOCSINHs.Find(id);

            db.HOCSINHs.Remove(hocsinh);
            TABLE_LOI tble = db.TABLE_LOI.SingleOrDefault(n => n.id_HS == id);

            if (tble != null)
            {
                db.TABLE_LOI.Remove(tble);
            }
            //xóa các dữ liệu liên quan
            string socmt = hocsinh.SoCMT;

            if (socmt != null)
            {
                CMT       cmt   = db.CMTs.Find(socmt);
                TABLE_LOI tble1 = db.TABLE_LOI.SingleOrDefault(n => n.So_CMT == socmt);
                if (tble1 != null)
                {
                    db.TABLE_LOI.Remove(tble1);
                }
                db.CMTs.Remove(cmt);
            }
            int id_gks = hocsinh.id_GKS == null ? 0 :(int)hocsinh.id_GKS;

            if (id_gks != 0)
            {
                GIAYKHAISINH gks   = db.GIAYKHAISINHs.Find(id_gks);
                TABLE_LOI    tble2 = db.TABLE_LOI.SingleOrDefault(n => n.id_GKS == id_gks);
                if (tble2 != null)
                {
                    db.TABLE_LOI.Remove(tble2);
                }
                db.GIAYKHAISINHs.Remove(gks);
            }
            int id_btn = hocsinh.id_BTN == null ? 0 : (int)hocsinh.id_BTN;

            if (id_btn != 0)
            {
                BANGTOTNGHIEP btn   = db.BANGTOTNGHIEPs.Find(id_btn);
                TABLE_LOI     tble3 = db.TABLE_LOI.SingleOrDefault(n => n.id_BTN == id_btn);
                if (tble3 != null)
                {
                    db.TABLE_LOI.Remove(tble3);
                }
                db.BANGTOTNGHIEPs.Remove(btn);
            }
            int id_hb = hocsinh.id_HB == null ? 0 : (int)hocsinh.id_HB;

            if (id_hb != 0)
            {
                HOCBA     hocba = db.HOCBAs.Find(id_hb);
                TABLE_LOI tble4 = db.TABLE_LOI.SingleOrDefault(n => n.id_HB == id_hb);
                if (tble4 != null)
                {
                    db.TABLE_LOI.Remove(tble4);
                }
                db.HOCBAs.Remove(hocba);
            }
            string socmtNGH = hocsinh.id_NgGiamHo;

            if (socmtNGH != null)
            {
                NGUOIGIAMHO nggiamho = db.NGUOIGIAMHOes.Find(socmtNGH);
                db.NGUOIGIAMHOes.Remove(nggiamho);
            }
            db.SaveChanges();
            return(RedirectToAction("Index", "HocSinh"));
        }
        private static XElement GetMaidObjectData(Maid maid, int slotID)
        {
            SceneDataManager.trsHash = new HashSet <Transform>();
            bool       flag  = false;
            bool       flag2 = slotID == -1;
            GameObject gameObject;

            if (flag2)
            {
                TBodySkin tbodySkin = maid.body0.goSlot[0];
                gameObject = maid.body0.m_Bones.gameObject;
            }
            else
            {
                TBodySkin tbodySkin = maid.body0.GetSlot(slotID);
                gameObject = tbodySkin.obj;
            }
            bool     flag3 = !gameObject;
            XElement result;

            if (flag3)
            {
                result = null;
            }
            else
            {
                BackUpSlotData orNullMaidSlotData = BackUpData.GetOrNullMaidSlotData(maid, slotID);
                bool           flag4 = orNullMaidSlotData == null;
                if (flag4)
                {
                    result = null;
                }
                else
                {
                    bool flag5 = !orNullMaidSlotData.objectDataDic.ContainsKey(gameObject);
                    if (flag5)
                    {
                        result = null;
                    }
                    else
                    {
                        BackUpObjectData backUpObjectData = orNullMaidSlotData.objectDataDic[gameObject];
                        XElement         xelement         = new XElement("ObjectData");
                        bool             changedYure      = backUpObjectData.changedYure;
                        if (changedYure)
                        {
                            XElement xelement2 = new XElement("Yure");
                            bool     yureState = YureUtil.GetYureState(maid, slotID);
                            xelement2.Add(yureState);
                            xelement.Add(xelement2);
                            bool flag6 = !yureState;
                            if (flag6)
                            {
                                flag = true;
                            }
                        }
                        bool        flag7 = slotID == -1;
                        Transform   rootBone;
                        Transform[] array;
                        if (flag7)
                        {
                            SkinnedMeshRenderer componentInChildren = maid.body0.goSlot[0].obj.GetComponentInChildren <SkinnedMeshRenderer>();
                            rootBone = maid.body0.m_Bones.transform;
                            array    = (from bone in componentInChildren.bones
                                        where bone != null
                                        select CMT.SearchObjName(rootBone, bone.name, true) into bone
                                        where bone != null
                                        select bone).ToArray <Transform>();
                        }
                        else
                        {
                            rootBone = maid.body0.goSlot[slotID].obj_tr;
                            SkinnedMeshRenderer componentInChildren2 = rootBone.gameObject.GetComponentInChildren <SkinnedMeshRenderer>();
                            array = (from bone in componentInChildren2.bones
                                     where bone != null
                                     select bone).ToArray <Transform>();
                        }
                        foreach (Transform transform in array)
                        {
                            Transform transform2 = transform;
                            while (transform2 != rootBone)
                            {
                                bool flag8 = !transform2;
                                if (flag8)
                                {
                                    Debug.Log("ルートオブジェクト配下にありません:" + transform.name);
                                    return(null);
                                }
                                bool flag9 = SceneDataManager.trsHash.Contains(transform2);
                                if (flag9)
                                {
                                    break;
                                }
                                bool flag10 = flag || BackUpData.GetOrNullMaidBoneData(maid, slotID, gameObject, transform2) != null;
                                if (flag10)
                                {
                                    XElement xelement3 = new XElement("TransformData");
                                    XElement xelement4 = new XElement("Name");
                                    xelement4.Add(transform2.name);
                                    xelement3.Add(xelement4);
                                    xelement3.Add(SceneDataManager.GetVector3Data("Scale", transform2.localScale));
                                    xelement3.Add(SceneDataManager.GetVector3Data("Position", transform2.localPosition));
                                    xelement3.Add(SceneDataManager.GetVector3Data("Rotation", transform2.localEulerAngles));
                                    xelement.Add(xelement3);
                                }
                                SceneDataManager.trsHash.Add(transform2);
                                transform2 = transform2.parent;
                            }
                        }
                        result = xelement;
                    }
                }
            }
            return(result);
        }
        private static void SetMaidObjectData(Maid maid, int slotID, XElement objectXml)
        {
            bool       flag = slotID == -1;
            GameObject gameObject;

            if (flag)
            {
                TBodySkin tbodySkin = maid.body0.goSlot[0];
                gameObject = maid.body0.m_Bones.gameObject;
            }
            else
            {
                TBodySkin tbodySkin = maid.body0.GetSlot(slotID);
                gameObject = tbodySkin.obj;
            }
            XElement xelement = objectXml.Element("Yure");
            bool     flag2    = xelement != null;

            if (flag2)
            {
                bool flag3    = (bool)xelement;
                bool yureAble = YureUtil.GetYureAble(maid, slotID);
                if (yureAble)
                {
                    bool flag4 = YureUtil.GetYureState(maid, slotID) != flag3;
                    if (flag4)
                    {
                        BackUpObjectData orAddMaidObjectData = BackUpData.GetOrAddMaidObjectData(maid, slotID, gameObject);
                        bool             changedYure         = orAddMaidObjectData.changedYure;
                        if (changedYure)
                        {
                            orAddMaidObjectData.changedYure = false;
                            orAddMaidObjectData.bYure       = true;
                        }
                        else
                        {
                            orAddMaidObjectData.changedYure = true;
                            orAddMaidObjectData.bYure       = YureUtil.GetYureState(maid, slotID);
                        }
                        YureUtil.SetYureState(maid, slotID, flag3);
                    }
                }
            }
            IEnumerable <XElement> enumerable = objectXml.Elements("TransformData");
            bool flag5 = enumerable != null;

            if (flag5)
            {
                foreach (XElement xelement2 in enumerable)
                {
                    XElement xelement3 = xelement2.Element("Name");
                    bool     flag6     = xelement3 == null;
                    if (flag6)
                    {
                        break;
                    }
                    bool      flag7 = slotID == -1;
                    Transform transform;
                    if (flag7)
                    {
                        transform = CMT.SearchObjName(gameObject.transform, (string)xelement3, true);
                    }
                    else
                    {
                        transform = CMT.SearchObjName(gameObject.transform, (string)xelement3, false);
                    }
                    bool flag8 = transform == null;
                    if (!flag8)
                    {
                        BackUpBoneData orAddMaidBoneData = BackUpData.GetOrAddMaidBoneData(maid, slotID, gameObject, transform);
                        XElement       xelement4         = xelement2.Element("Scale");
                        bool           flag9             = xelement4 != null;
                        if (flag9)
                        {
                            bool flag10 = !orAddMaidBoneData.changedScl;
                            if (flag10)
                            {
                                orAddMaidBoneData.changedScl = true;
                                orAddMaidBoneData.scale      = transform.localScale;
                            }
                            Vector3 vectorData = SceneDataManager.GetVectorData(xelement4);
                            transform.localScale = vectorData;
                        }
                        XElement xelement5 = xelement2.Element("Position");
                        bool     flag11    = xelement5 != null;
                        if (flag11)
                        {
                            bool flag12 = !orAddMaidBoneData.changedPos;
                            if (flag12)
                            {
                                orAddMaidBoneData.changedPos = true;
                                orAddMaidBoneData.position   = transform.localPosition;
                            }
                            Vector3 vectorData2 = SceneDataManager.GetVectorData(xelement5);
                            transform.localPosition = vectorData2;
                        }
                        XElement xelement6 = xelement2.Element("Rotation");
                        bool     flag13    = xelement6 != null;
                        if (flag13)
                        {
                            bool flag14 = !orAddMaidBoneData.changedRot;
                            if (flag14)
                            {
                                orAddMaidBoneData.changedRot = true;
                                orAddMaidBoneData.rotation   = transform.localRotation;
                            }
                            Vector3 vectorData3 = SceneDataManager.GetVectorData(xelement6);
                            transform.localEulerAngles = vectorData3;
                        }
                    }
                }
            }
        }
 public LoiModel(CMT cmt, GIAYKHAISINH giaykhaisinh)
 {
     this.cmt          = cmt;
     this.giaykhaisinh = giaykhaisinh;
 }
Example #35
-1
 public CMTPoint(double ttm_, CMT cmt_, /*int series_,*/ IObservable<alglib.spline1dinterpolant> fitProvider_)
 {
   TimeToMaturity = ttm_;
   //Series = series_;
   m_parent = cmt_;
   m_disp = fitProvider_.Subscribe(OnNext);
 }