public static void Normals(this GuideObject go, float angle)
 {
     if (go.IsLimb() || go.IsArm())
     {
         FkJointRotater(go).Normals(angle);
     }
 }
 public static void MoveEndZ(this GuideObject go, float dist)
 {
     if (go.IsLimb() || go.IsArm())
     {
         FkJointRotater(go).MoveTo(go.transformTarget.position + new Vector3(0, 0, dist));
     }
 }
 public static void Revolution(this GuideObject go, float angle)
 {
     if (go.IsLimb() || go.IsArm())
     {
         FkJointRotater(go).Revolution(angle);
     }
 }
 public static void Tangent(this GuideObject go, float angle)
 {
     if (go.IsLimb() || go.IsArm())
     {
         FkJointRotater(go).Tangent(angle);
     }
 }
Esempio n. 5
0
        private static void HandleStart(GameSession session, PacketReader packet)
        {
            if (session.FieldPlayer.Value.Guide != null)
            {
                return;
            }

            byte unk = packet.ReadByte();
            int  furnishingItemId  = packet.ReadInt();
            long furnishingItemUid = packet.ReadLong();

            // Add Guide Object
            CoordF startCoord = Block.ClosestBlock(session.FieldPlayer.Coord);

            startCoord.Z += Block.BLOCK_SIZE;
            GuideObject guide = new GuideObject(0, session.Player.CharacterId)
            {
            };
            IFieldObject <GuideObject> fieldGuide = session.FieldManager.RequestFieldObject(guide);

            fieldGuide.Coord     = startCoord;
            session.Player.Guide = fieldGuide;
            session.FieldManager.AddGuide(fieldGuide);

            session.FieldManager.BroadcastPacket(GuideObjectPacket.Add(fieldGuide));
            session.FieldManager.BroadcastPacket(BuildModePacket.Use(session.FieldPlayer, true, furnishingItemId, furnishingItemUid));
        }
 public static void Forward(this GuideObject go, float dist)
 {
     if (go.IsLimb() || go.IsArm())
     {
         FkJointRotater(go).Forward(dist);
     }
 }
Esempio n. 7
0
        public static bool IsNeck(this GuideObject go)
        {
            var name = go.transformTarget.name;

            return(name == "cf_J_Neck" ||
                   name == "cm_J_Neck");
        }
Esempio n. 8
0
        public void MoveObject(ObjectCtrlInfo oci, Vector3 newPos, bool keepY)
        {
            if (keepY)
            {
                newPos.y = oci.guideObject.transformTarget.position.y;
            }
            GuideObject guideObject = oci.guideObject;

            if (guideObject != null)
            {
                Vector3 localPosition = guideObject.transformTarget.localPosition;
                guideObject.transformTarget.position = newPos;
                guideObject.changeAmount.pos         = guideObject.transformTarget.localPosition;
                if (guideObject.enablePos)
                {
                    GuideCommand.EqualsInfo equalsInfo = new GuideCommand.EqualsInfo
                    {
                        dicKey   = guideObject.dicKey,
                        oldValue = localPosition,
                        newValue = guideObject.changeAmount.pos
                    };
                    Singleton <UndoRedoManager> .Instance.Push(new GuideCommand.MoveEqualsCommand(new GuideCommand.EqualsInfo[]
                    {
                        equalsInfo
                    }));
                }
            }
        }
 public static void MoveEnd(this GuideObject go, Vector3 pos)
 {
     if (go.IsLimb() || go.IsArm())
     {
         FkJointRotater(go).MoveTo(pos);
     }
 }
Esempio n. 10
0
 public static void TurnTo(this GuideObject guideObject, Quaternion rot)
 {
     if (guideObject.enableRot)
     {
         guideObject.transformTarget.rotation = rot;
         guideObject.changeAmount.rot         = guideObject.transformTarget.localEulerAngles;
     }
 }
Esempio n. 11
0
 public static void MoveTo(this GuideObject guideObject, Vector3 pos)
 {
     if (guideObject.enablePos)
     {
         guideObject.transformTarget.position = pos;
         guideObject.changeAmount.pos         = guideObject.transformTarget.localPosition;
     }
 }
Esempio n. 12
0
 public static void RotateAround(this GuideObject guideObject, Vector3 point, Vector3 axis, float angle)
 {
     if (guideObject.enableRot)
     {
         guideObject.transformTarget.RotateAround(point, axis, angle);
         guideObject.changeAmount.rot = guideObject.transformTarget.localEulerAngles;
     }
 }
Esempio n. 13
0
 public static void Reset(this GuideObject guideObject)
 {
     if (guideObject.enableRot)
     {
         guideObject.transformTarget.localEulerAngles = Vector3.zero;
         guideObject.changeAmount.rot = guideObject.transformTarget.localEulerAngles;
     }
 }
Esempio n. 14
0
 private static void Record(GuideObject selectObject)
 {
     if (selectObject.enableRot)
     {
         _lastRots.Add(selectObject.dicKey, selectObject.changeAmount.rot);
         _lastTargets.Add(selectObject.dicKey, selectObject);
     }
 }
Esempio n. 15
0
 public static void Rotate(this GuideObject guideObject, float z, float y, float x)
 {
     if (guideObject.enableRot)
     {
         guideObject.transformTarget.Rotate(z, y, x, Space.Self);
         guideObject.changeAmount.rot = guideObject.transformTarget.localEulerAngles;
     }
 }
Esempio n. 16
0
        private static void HandlePrepareFishing(GameSession session, PacketReader packet)
        {
            long       fishingRodUid = packet.ReadLong();
            MasteryExp masteryExp    = session.Player.Levels.MasteryExp.FirstOrDefault(x => x.Type == MasteryType.Fishing);

            if (masteryExp == null) // add mastery to list
            {
                masteryExp = new MasteryExp(MasteryType.Fishing);
                session.Player.Levels.MasteryExp.Add(masteryExp);
            }

            if (!FishingSpotMetadataStorage.CanFish(session.Player.MapId, masteryExp.CurrentExp))
            {
                session.Send(FishingPacket.Notice((short)FishingNotice.MasteryTooLowForMap));
                return;
            }

            if (!session.Player.Inventory.Items.ContainsKey(fishingRodUid))
            {
                session.Send(FishingPacket.Notice((short)FishingNotice.InvalidFishingRod));
                return;
            }

            Item fishingRod = session.Player.Inventory.Items[fishingRodUid];
            FishingRodMetadata rodMetadata = FishingRodMetadataStorage.GetMetadata(fishingRod.Function.Id);

            if (rodMetadata.MasteryLimit < masteryExp.CurrentExp)
            {
                session.Send(FishingPacket.Notice((short)FishingNotice.MasteryTooLowForRod));
            }

            int    direction  = Direction.GetClosestDirection(session.FieldPlayer.Rotation);
            CoordF startCoord = Block.ClosestBlock(session.FieldPlayer.Coord);

            List <MapBlock> fishingBlocks = CollectFishingBlocks(startCoord, direction, session.Player.MapId);

            if (fishingBlocks.Count == 0)
            {
                session.Send(FishingPacket.Notice((short)FishingNotice.CanOnlyFishNearWater));
                return;
            }
            session.Player.FishingRod = fishingRod;

            // Adding GuideObject
            CoordF guideBlock = GetObjectBlock(fishingBlocks, session.FieldPlayer.Coord);

            guideBlock.Z += Block.BLOCK_SIZE; // sits on top of the block
            GuideObject guide = new GuideObject(1, session.Player.CharacterId);
            IFieldObject <GuideObject> fieldGuide = session.FieldManager.RequestFieldObject(guide);

            fieldGuide.Coord     = guideBlock;
            session.Player.Guide = fieldGuide;
            session.FieldManager.AddGuide(fieldGuide);

            session.Send(FishingPacket.LoadFishTiles(fishingBlocks, rodMetadata.ReduceTime));
            session.FieldManager.BroadcastPacket(GuideObjectPacket.Add(fieldGuide));
            session.Send(FishingPacket.PrepareFishing(fishingRodUid));
        }
Esempio n. 17
0
        public static bool IsFoot(this GuideObject go)
        {
            var name = go.transformTarget.name;

            return(name == "cf_J_Foot01_L" ||
                   name == "cf_J_Foot01_R" ||
                   name == "cm_J_Foot01_L" ||
                   name == "cm_J_Foot01_R");
        }
Esempio n. 18
0
        public static bool IsShoulder(this GuideObject go)
        {
            var name = go.transformTarget.name;

            return(name == "cf_J_Shoulder_L" ||
                   name == "cm_J_Shoulder_L" ||
                   name == "cf_J_Shoulder_R" ||
                   name == "cm_J_Shoulder_R");
        }
Esempio n. 19
0
        public static bool IsHand(this GuideObject go)
        {
            var name = go.transformTarget.name;

            return(name == "cf_J_Hand_L" ||
                   name == "cf_J_Hand_R" ||
                   name == "cm_J_Hand_L" ||
                   name == "cm_J_Hand_R");
        }
Esempio n. 20
0
        public static bool IsLeg(this GuideObject go)
        {
            var name = go.transformTarget.name;

            return(name == "cf_J_LegUp00_L" ||
                   name == "cf_J_LegUp00_R" ||
                   name == "cm_J_LegUp00_L" ||
                   name == "cm_J_LegUp00_R");
        }
Esempio n. 21
0
 public Quaternion GetFKBoneTargetRotation(GuideObject bone)
 {
     OCIChar.BoneInfo info;
     if (this._target.fkObjects.TryGetValue(bone.transformTarget.gameObject, out info) == false || !this._target.fkEnabled || info.active == false)
     {
         return(Quaternion.identity);
     }
     return(info.guideObject.transformTarget.localRotation);
 }
Esempio n. 22
0
        private FkBone CreateBone(Transform transform)
        {
            if (!Context.DicGuideObject().ContainsKey(transform))
            {
//                Tracer.Log("Not Contains", transform);
                return(null);
            }
            GuideObject go = Context.DicGuideObject()[transform];

            return(new FkBone(go, this));
        }
Esempio n. 23
0
        private void OnScaleReleased(MonoBehaviour marker)
        {
            MoveableGUIObject component   = marker.GetComponent <MoveableGUIObject>();
            GuideObject       guideObject = component.guideObject;
            GuideScale        guideScale  = component.guideScale;

            if (guideObject.enableScale && guideScale)
            {
                marker.transform.localPosition = CalcScaleHandleDefaultPos(guideScale);
            }
        }
Esempio n. 24
0
        public GuideObject GetTargetObject()
        {
            GuideObject guideObject = GuideObjectManager.Instance.operationTarget;

            if (guideObject == null)
            {
                guideObject = GuideObjectManager.Instance.selectObject;
            }

            return(guideObject);
        }
Esempio n. 25
0
 public static bool IsLimb(this GuideObject go)
 {
     if (go == null)
     {
         return(false);
     }
     if (go.enablePos)
     {
         return(false);
     }
     return(go.IsHand() || go.IsFoot());
 }
        public static void Forward(this GuideObject go, float dist)
        {
            if (!go.IsLimb())
            {
                return;
            }
            var rotater = FkCharaMgr.BuildFkJointRotater(go);

            if (rotater == null)
            {
                return;
            }
            rotater.Forward(dist);
        }
            private static bool GuideObject_LateUpdate(GuideObject __instance, ref GameObject[] ___roots)
            {
                if (IsStudio)
                {
                    return(true);
                }

                if (__instance.parent && __instance.nonconnect)
                {
                    Traverse.Create(__instance).Method("CalcPosition").GetValue();
                    Traverse.Create(__instance).Method("CalcRotation").GetValue();
                }
                __instance.transform.position = __instance.transformTarget.position;
                __instance.transform.rotation = __instance.transformTarget.rotation;
                switch (__instance.mode)
                {
                case GuideObject.Mode.Local:
                    //Added null check
                    if (___roots[0] != null)
                    {
                        ___roots[0].transform.eulerAngles = __instance.parent ? __instance.parent.eulerAngles : Vector3.zero;
                    }
                    break;

                case GuideObject.Mode.LocalIK:
                    //Added null check
                    if (___roots[0] != null)
                    {
                        ___roots[0].transform.localEulerAngles = Vector3.zero;
                    }
                    break;

                case GuideObject.Mode.World:
                    //Added null check
                    if (___roots[0] != null)
                    {
                        ___roots[0].transform.eulerAngles = Vector3.zero;
                    }
                    break;
                }
                if (__instance.calcScale)
                {
                    Vector3 localScale = __instance.transformTarget.localScale;
                    Vector3 lossyScale = __instance.transformTarget.lossyScale;
                    Vector3 vector     = __instance.enableScale ? __instance.changeAmount.scale : Vector3.one;
                    __instance.transformTarget.localScale = new Vector3(localScale.x / lossyScale.x * vector.x, localScale.y / lossyScale.y * vector.y, localScale.z / lossyScale.z * vector.z);
                }

                return(false);
            }
Esempio n. 28
0
        private void ApplyFingerFKIfNeeded(GuideObject guideObject)
        {
            new List <Transform>();
            List <GuideObject> list = new List <GuideObject>();

            if (IsFinger(guideObject.transformTarget))
            {
                list.Add(guideObject);
            }
            foreach (GuideObject guideObject2 in list)
            {
                guideObject2.transformTarget.localEulerAngles = guideObject2.changeAmount.rot;
            }
        }
        public static void Normals(this GuideObject go, float angle)
        {
            if (!go.IsLimb())
            {
                return;
            }
            var rotater = FkCharaMgr.BuildFkJointRotater(go);

            if (rotater == null)
            {
                return;
            }
            rotater.Normals(angle);
        }
Esempio n. 30
0
        void processGuideObject(GameObject obj)
        {
            GuideObject go = obj.GetComponent <GuideObject>();

            if (go != null)
            {
                if (go._name == "")
                {
                    return;
                }

                processGuideEvent("ui_click", go._name);
                //resumeScript();
            }
        }