Ejemplo n.º 1
0
        public void ikTargetClicked(Action <Undo> undoListAdd, Func <bool[], bool[]> setIKButtonActive, bool[] boolList, HandleKun posHandle, int currentMaidNo, string UndoFuncName)
        {
            if (trTargetIKTemp != null)
            {
                Debuginfo.Log(LogLabel + "IKTarget:" + trTargetIKTemp.name.ToString());

                if ((int)posHandle.IKmode <= 3)
                {
                    //Undoチェック
                    if (UndoFuncName != "IK:" + (int)posHandle.IKmode + ":" + IKList[(int)posHandle.IKmode].getParentTransform(currentMaidNo).ToString() + ":" + currentMaidNo)
                    {
                        UndoFuncName = "IK:" + (int)posHandle.IKmode + ":" + IKList[(int)posHandle.IKmode].getParentTransform(currentMaidNo).ToString() + ":" + currentMaidNo;
                        //IKでのUndo登録
                        undoListAdd(Undo.createUndoIK(this.doUndoFunc, this.checkIKAttach, this.getIKTransform, setIKButtonActive, boolList, GetMaid(currentMaidNo), currentMaidNo, true, IKList[(int)posHandle.IKmode].getParentTransform(currentMaidNo), IKList[(int)posHandle.IKmode].getIKPosition(currentMaidNo), (int)posHandle.IKmode));
                        //Debuginfo.Log(LogLabel + "Undo::" + UndoFuncName);
                    }

                    IKList[(int)posHandle.IKmode].ikTargetClicked(posHandle, currentMaidNo, trTargetIKTemp);
                }


                if (trTargetIKTemp.name != "Bip01")
                {
                    posHandle.IKTargetAttachedColor(true);
                }
                else
                {
                    posHandle.IKTargetAttachedColor(false);
                }

                bIKTargetGet = false;

                trTargetIKTemp = null;
            }
        }
Ejemplo n.º 2
0
        public void detachIKfromBone(Action <Undo> undoListAdd, Func <bool[], bool[]> setIKButtonActive, bool[] boolList, HandleKun posHandle, Dictionary <string, Transform> trBone, int currentMaidNo, string UndoFuncName)
        {
            //Undoチェック
            if (UndoFuncName != "IKDetach:" + (int)posHandle.IKmode + ":" + IKList[(int)posHandle.IKmode].getParentTransform(currentMaidNo).ToString() + ":" + currentMaidNo)
            {
                UndoFuncName = "IKDetach:" + (int)posHandle.IKmode + ":" + IKList[(int)posHandle.IKmode].getParentTransform(currentMaidNo).ToString() + ":" + currentMaidNo;
                //IKでのUndo登録
                undoListAdd(Undo.createUndoIK(this.doUndoFunc, this.checkIKAttach, this.getIKTransform, setIKButtonActive, boolList, GetMaid(currentMaidNo), currentMaidNo, false, IKList[(int)posHandle.IKmode].getParentTransform(currentMaidNo), IKList[(int)posHandle.IKmode].getIKPosition(currentMaidNo), (int)posHandle.IKmode));
                Debuginfo.Log(LogLabel + UndoFuncName);
            }

            //Vector3 postPosition = ikHandle.Pos;
            //IKターゲットの位置を初期化
            Quaternion temp = posHandle.Rot;

            //posHandle.transform.parent.parent = trBone["Bip01"];
            //posHandle.transform.parent.localPosition = Vector3.zero;

            if (posHandle.IKmode == HandleKun.IKMODE.LeftLeg)
            {
                posHandle.SetParentBone(trBone["Bip01 L Foot"]);
            }
            else if (posHandle.IKmode == HandleKun.IKMODE.RightLeg)
            {
                posHandle.SetParentBone(trBone["Bip01 R Foot"]);
            }
            else if (posHandle.IKmode == HandleKun.IKMODE.LeftArm)
            {
                posHandle.SetParentBone(trBone["Bip01 L Hand"]);
            }
            else if (posHandle.IKmode == HandleKun.IKMODE.RightArm)
            {
                posHandle.SetParentBone(trBone["Bip01 R Hand"]);
            }
            else
            {
                return;
            }

            IKList[(int)posHandle.IKmode].detachIKfromBone(trBone["Bip01"], currentMaidNo);

            //ikHandle.Pos = postPosition;
            posHandle.transform.localPosition = Vector3.zero;
            posHandle.Scale = 0.2f;

            posHandle.Rot = temp;//Quaternion.Euler(-90, 0, 90);
        }
Ejemplo n.º 3
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);
            }
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
#if AsyncAwaitTest
            AsyncAwaitDemo ins = new AsyncAwaitDemo();
            ins.mainThreadFunc1_callLongRunTask_MainThreadWillNotBlockAtThisFunc();
            ins.mainThreaddFunc2_WillNotBlockByFunc1();
            ins.callMethod();
#endif
#if Expression_DEMO
            ExpressionDemo ins = new ExpressionDemo();
            ins.createExpression();
#endif
#if TASK_THREAD_DEMO
            ThreadTaskDemo ins = new ThreadTaskDemo();
            ins.createTask();
#endif
#if LINQTOSQL
            LINQToSQL ins = new LINQToSQL();
            ins.exer2();
#endif
#if LINQTOXML
            LINQToXMLDemo ins = new LINQToXMLDemo();
            ins.orderXML();

            //ins.createTPDefaultRecipeXML();

            //uint index;
            //List<string> options = new List<string>();
            //ins.test("MEAS_TYPE", out index, out options);
            //Console.WriteLine("index: {0}", index);
            //foreach (var item in options)
            //{
            //    Console.WriteLine(item);
            //}
#endif


#if LINQStudy
            var nums = new int[7] {
                0, 1, 2, 3, 4, 5, 6
            };

            var numQuery =
                from num in nums
                where (num % 2) == 0
                select num;

            foreach (var num in numQuery)
            {
                Console.WriteLine("{0}", num);
            }
#elif ReflectionTest
            Rectangle r = new Rectangle(4.5, 7.5);
            r.display();

            Type type = typeof(Rectangle);

            //遍历类特性
            foreach (object attributes in type.GetCustomAttributes(false))
            {
                Debuginfo dbi = (Debuginfo)attributes;
                if (null != dbi)
                {
                    Console.Write("Bug no: {0}\t", dbi.BugNo);
                    Console.Write("Developer: {0}\t", dbi.Developer);
                    Console.Write("Last Reviewed: {0}\t", dbi.LastReview);
                    Console.Write("Remarks: {0}\t", dbi.Message);
                }
                Console.WriteLine();
            }

            //遍历方法特性
            foreach (MethodInfo method in type.GetMethods())
            {
                foreach (Attribute a in method.GetCustomAttributes(true))
                {
                    Debuginfo dbi = (Debuginfo)a;
                    if (null != dbi)
                    {
                        Console.Write("Bug no: {0}, for Method: {1} \t",
                                      dbi.BugNo, method.Name);
                        Console.Write("Developer: {0}\t", dbi.Developer);
                        Console.Write("Last Reviewed: {0}\t",
                                      dbi.LastReview);
                        Console.Write("Remarks: {0}\t", dbi.Message);
                    }
                }
            }
#elif AttributeTest
            ToolKit.FuncA();
            ToolKit.FuncB();
            ToolKit.FuncC();
            ToolKit.FuncD();
            Console.ReadKey();
#elif IndexTest
            IndexerStudy names = new IndexerStudy();
            names[0] = "wang";
            names[1] = "ji";
            names[2] = "chen";
            for (int i = 0; i < IndexerStudy.size; i++)
            {
                Console.WriteLine(names[i]);
            }
#elif DelegateAndEvent
            DelegateAndEventStudyPublisher publisher = new DelegateAndEventStudyPublisher();
            Subscriber scriber = new Subscriber();
            /***** !!! *****/
            publisher.ChangeNum += new DelegateAndEventStudyPublisher.NumManipulationHandler(scriber.printf);
            /***** !!! *****/
            publisher.SetVal(7);
            publisher.SetVal(11);
#elif AnonymousFunction
            x => x + 1;
            x => { return(x + 1); }
#endif
            Console.ReadKey();
        }