Beispiel #1
0
        public async Task StartQuery(string navigator, CObject o, QueryViewMode mode = QueryViewMode.Accordion)
        {
            ViewModels.ProjectData m_ProjectData = Services.XServices.Instance.GetService <ViewModels.ProjectData>();
            m_Layer      = m_ProjectData.SelectedLayer;
            m_Language   = m_ProjectData.SelectedLanguage.LCID;
            m_Mainobject = o;

            m_Navigator = navigator;

            SetNavigator(navigator);
            SetMainObject(o);

            template = new PageTemplate();

            await UpdateQuery(o, m_Language);

            switch (view)
            {
            case QueryViewMode.Accordion:
                await ShowListQuery();

                break;

            case QueryViewMode.List:
                await ShowTableQuery();

                break;
            }
        }
        public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer)
        {
            GCCharDirectImpact Packet = (GCCharDirectImpact)pPacket;

            if (GameProcedure.GetActiveProcedure() == GameProcedure.s_ProcMain)
            {
                CObject pObj = CObjectManager.Instance.FindServerObject(Packet.RecieverID);
                if (pObj != null)
                {
                    _DAMAGE_INFO infoDamage = new _DAMAGE_INFO();
                    infoDamage.m_nSkillID          = Packet.SkillID;
                    infoDamage.m_nTargetID         = (uint)Packet.RecieverID;
                    infoDamage.m_nSenderID         = (uint)Packet.SenderID;
                    infoDamage.m_nSenderLogicCount = Packet.SenderLogicCount;
                    infoDamage.m_nImpactID         = Packet.ImpactID;
                    infoDamage.m_nType             = _DAMAGE_INFO.DAMAGETYPE.TYPE_EFFECT;

                    _LOGIC_EVENT logicEvent = new _LOGIC_EVENT();
                    logicEvent.Init(infoDamage.m_nSenderID, infoDamage.m_nSenderLogicCount, infoDamage);

                    SCommand_Object cmdTemp = new SCommand_Object();
                    cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_LOGIC_EVENT;
                    cmdTemp.SetValue <object>(0, logicEvent);
                    pObj.PushCommand(cmdTemp);
                    pObj.SetMsgTime(GameProcedure.s_pTimeSystem.GetTimeNow());
                }
                LogManager.Log("RECV GCCharDirectImpact");
            }
            return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE);
        }
Beispiel #3
0
    //CKeyHook _oKeyHook_ThighSpread;
    //---------------------------------------------------------------------------	CREATE / DESTROY
    public override void OnStart_DefineLimb()
    {
        _nDrivePos = 0.5f * C_DrivePos;             // Weaken the leg pin drive over default

        //=== Init Bones and Joints ===
        CJointDriver oJointPelvis = _oBody._oActor_Pelvis._oJointExtremity;
        _aJoints.Add(_oJointThighBend 	= CJointDriver.Create(this, oJointPelvis,	    _sSidePrefixL+"ThighBend",      15, 3.0f, -115, 035, 000, 085, 1));	// X = Leg forward (-115) / back (35), Z = Thigh split (85) / together (20)  ###BAD: Super-important thigh split needed same value for thigh together makes no sense!  ###IMPROVE: 2nd joint?
        _aJoints.Add(_oJointThighTwist  = CJointDriver.Create(this, _oJointThighBend,	_sSidePrefixL+"ThighTwist",     20, 2.0f, -000, 000, 075, 000, 1));	// Y = Thigh twist -75 to 75 Ok
        _aJoints.Add(_oJointShin	    = CJointDriver.Create(this, _oJointThighTwist,	_sSidePrefixL+"Shin",	        10, 2.0f, -011, 155, 015, 005, 1));	// X = Knee bent (+155) or backward (-11),  Y = Knee rotate -25 to 10 with compromise at 15, Z = Knee side-to-side -5 to 5
        _aJoints.Add(_oJointFoot	    = CJointDriver.Create(this, _oJointShin,		_sSidePrefixL+"Foot",	        15, 1.0f, -025, 010, 020, 040, 1));	// X = Foot up (-40) and down (+75), inward -25 to +10, twist -35 to 15:			###IMPROVE: FootX not up/down!!  ###IMPROVE: 2 joints?  ###PROBLEM: Foot up down on Z with poor bending along down
        _aJoints.Add(_oJointMetatarsals = CJointDriver.Create(this, _oJointFoot,		_sSidePrefixL+"Metatarsals",	20, 0.5f, -000, 000, 020, 012, 1));	// X = Metatarsals left/right = useless, Y = twist -20 to 20, Z = foot bend -12 to 12
        _aJoints.Add(_oJointExtremity   = CJointDriver.Create(this, _oJointMetatarsals, _sSidePrefixL+"Toe",	        20, 3.0f, -000, 000, 020, 050, 1));	// X = Toes bend backward (-45) to forward (65),  Y = Toe twist -20/20, Z = meaningless   ###IMPROVE: Rotate axe?  ###CHECK: Toe mass??

        _oJointShin._oConfJoint.targetRotation = Quaternion.Euler(-160, 0, 0);		//###WEAK: Set knee default position so it can easily bend (with very week drive)		//###SOON: Proper bending of knee calculations from height

        //=== Init Hotspot ===
        if (_eBodySide == 0)            //###IMPROVE: Rediculously long path... switch to 'search for bone' (would not be as fast tho)
            _oHotSpot = CHotSpot.CreateHotspot(this, _oBody._oBodyBase.FindBone("chestUpper/chestLower/abdomenUpper/abdomenLower/hip/pelvis/lThighBend/lThighTwist/lShin/lFoot/lMetatarsals/lToe"), "Left Leg", true, new Vector3(0, 0, 0));
        else
            _oHotSpot = CHotSpot.CreateHotspot(this, _oBody._oBodyBase.FindBone("chestUpper/chestLower/abdomenUpper/abdomenLower/hip/pelvis/rThighBend/rThighTwist/rShin/rFoot/rMetatarsals/rToe"), "Right Leg", true, new Vector3(0, 0, 0));

        //=== Init CObject ===
        _oObj = new CObject(this, _oBody._oBodyBase._nBodyID, typeof(EActorLeg), "Leg", "Leg" + _sSidePrefixU);
        _oObj.PropGroupBegin("", "", true);
        AddBaseActorProperties();						// The first properties of every CActor subclass are Pinned, pos & rot
        _oObj.PropAdd(EActorLeg.Thigh_Spread,	"Thigh-Spread",		0,	-100,	100,	"");
        _oObj.PropAdd(EActorLeg.Thigh_Rotate,	"Thigh-Rotate",		0,	-100,	100,	"");
        _oObj.FinishInitialization();

        //_oKeyHook_ThighSpread = new CKeyHook(_oObj.PropFind(EActorLeg.Thigh_Spread), KeyCode.F, EKeyHookType.QuickMouseEdit, "Thigh Spread", -1);
    }
Beispiel #4
0
        public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer)
        {
            if (GameProcedure.GetActiveProcedure() == (GameProcedure)GameProcedure.s_ProcMain)
            {
                //LogManager.Log("Receive GCLevelUpResult Packet");
                GCLevelUp levelUp = (GCLevelUp)pPacket;


                CObject pObj = CObjectManager.Instance.FindServerObject((int)levelUp.ObjectID);        //(CObject*)(pObjectManager->FindServerObject( (INT)pPacket->getObjId() ));
                if (pObj == null)
                {
                    return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE);
                }

                //pObj->PushDebugString("LevelUp!");
                //pObj->SetMsgTime(CGameProcedure::s_pTimeSystem->GetTimeNow());

                //if(pObj ==(CObject*) CObjectManager::GetMe()->GetMySelf())
                //{
                //    CGameProcedure::s_pGfxSystem->PushDebugString("LeveUP");
                //    CSoundSystemFMod::_PlayUISoundFunc(66);
                //}

                SCommand_Object cmdTemp = new SCommand_Object();
                cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_LEVEL_UP;
                pObj.PushCommand(cmdTemp);
            }
            return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE);
        }
Beispiel #5
0
        public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer)
        {
            if (GameProcedure.GetActiveProcedure() == (GameProcedure)GameProcedure.s_ProcMain)
            {
                //检查位置是否合法
                //const WORLD_POS* pTargetPos = pPacket->GetCurPos();
                //if(!CWorldManager::GetMe()->GetActiveScene()->IsValidPosition(fVector2(pTargetPos->m_fX, pTargetPos->m_fZ)))
                //{
                //    TDThrow("ERROR POSITION @ GCBusStopMoveHandler target");
                //}

                GCBusStopMove busPacket = pPacket as GCBusStopMove;
                if (busPacket == null)
                {
                    LogManager.LogError("GCBusStopMove 收包错误。");
                    return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_ERROR);
                }
                CObject pBus = CObjectManager.Instance.FindServerObject((int)busPacket.ObjID);
                if (pBus == null)
                {
                    return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE);
                }
                SCommand_Object cmdTemp = new SCommand_Object();
                cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_BUS_STOP_MOVE;
                cmdTemp.SetValue(0, busPacket.PosWorld.m_fX);
                cmdTemp.SetValue(1, -1.0f);
                cmdTemp.SetValue(2, busPacket.PosWorld.m_fZ);
                pBus.PushCommand(cmdTemp);
            }
            return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE);
        }
        public static void GetElements(string fileName)
        {
            try
            {
                // Read document into memory for modification
                PdfDocument document = PdfReader.Open(fileName);

                var          page          = document.Pages[0];
                CObject      content       = ContentReader.ReadContent(page);
                var          extractedText = ExtractText(content);
                FileStream   fs            = new FileStream(Path.GetDirectoryName(fileName) + "\\result_sharp.txt", FileMode.Create);
                StreamWriter sw            = new StreamWriter(fs);
                sw.Write(extractedText);
                sw.Flush();
                sw.Close();

                // Finally we must add the action dictionary to the /OpenAction key of
                // the document's catalog as an indirect value.
                //document.Internals.Catalog.Elements["/OpenAction"] =
                //PdfInternals.GetReference(dict);

                // Using PDFsharp we never deal with object numbers. We simply put the
                // objects together and the PDFsharp framework does the rest.
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Beispiel #7
0
        private void Read(string text)
        {
            for (int i = 0; i < Doc.PageCount; i++)
            {
                var page = Doc.Pages[i];

                try
                {
                    CObject content       = ContentReader.ReadContent(page);
                    var     extractedText = MyExtractText(content);

                    foreach (string item in extractedText)
                    {
                        if (item.ToLower().Contains(text.ToLower()))
                        {
                            Pages.Add(i);
                            break;
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);


                    //MessageBox.Show($"Error on page {i}");
                }
            }

            //lbPages.DataContext = Pages;
        }
        public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer)
        {
            if (GameProcedure.GetActiveProcedure() == (GameProcedure)GameProcedure.s_ProcMain)
            {
                LogManager.Log("Receive GCObjTeleport Packet");
                GCObjTeleport Packet = (GCObjTeleport)pPacket;
                CObject       pObj   = CObjectManager.Instance.FindServerObject(Packet.ObjID);
                if (pObj == null || !(pObj is CObject_Character))
                {
                    return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE);
                }

                //if(!GFX.GfxSystem.Instance.IsValidPosition(Packet.PosWorld.m_fX, Packet.PosWorld.m_fZ))
                // {
                //     LogManager.LogError("ERROR POSITION @ GCCharIdleHandler");
                // }

                SCommand_Object cmdTemp = new SCommand_Object();
                cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_TELEPORT;
                cmdTemp.SetValue <float>(0, Packet.PosWorld.m_fX);
                cmdTemp.SetValue <float>(1, Packet.PosWorld.m_fZ);
                pObj.PushCommand(cmdTemp);

                // 瞬移时,清空寻路节点 [9/2/2011 Sun]
                //CWorldManager::GetMe()->SetPathNodesDirty();

                pObj.SetMsgTime(GameProcedure.s_pTimeSystem.GetTimeNow());
            }
            return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE);
        }
Beispiel #9
0
    private void updateAnimDropbox()
    {
        animationSetDropdown.ClearOptions();
        List <DOption> options = new List <DOption>();

        options.Add(new DOption("unarmed", null));
        HashSet <string> done = new HashSet <string>();

        foreach (entry e in db.getEntriesForID(230))
        {
            CObject _250 = db.toObj(e.id, e.key);
            if (_250.hasMember(7))
            {
                string animation = _250.getStringMember(7);
                if (!done.Contains(animation) && !animation.Contains("crossbow") && !animation.Contains("shared"))
                {
                    DOption option = new DOption(animation, e);
                    options.Add(option);
                    done.Add(animation);
                }
            }
        }

        options.Sort((a, b) => string.Compare(a.text, b.text));
        animationSetDropdown.AddOptions(options.Cast <Dropdown.OptionData>().ToList());
    }
Beispiel #10
0
        private CObject CreateObject(SObject obj)
        {
            var  type    = names[obj.typeID];
            Type resType = Type.GetType($"CR2W.Types.W3.{type}");

            if (resType == null)
            {
                throw new UnknownObjectTypeException($"{type} could not be found");
            }

            if (!resType.IsSubclassOf(typeof(CObject)))
            {
                throw new InvalidOperationException($"{type} is not a CObject");
            }

            BaseStream.Seek(obj.offset, SeekOrigin.Begin);

            CObject temp = (CObject)Activator.CreateInstance(resType);

            temp.Flags    = obj.flags;
            temp.Template = obj.template;

            if (obj.parentID > 0)
            {
                objects[obj.parentID - 1].Children.Add(obj.index, temp);
            }

            temp.ParseBytes(this, obj.size);

            return(temp);
        }
Beispiel #11
0
 // Update is called once per frame
 void Update()
 {
     if (c++ == 50)
     {
         CObject obj = Parser.processStreamObject(data);
     }
 }
        public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer)
        {
            GCCharSkillLead Packet = (GCCharSkillLead)pPacket;

            if (GameProcedure.GetActiveProcedure() == GameProcedure.s_ProcMain)
            {
                CObject pObj = CObjectManager.Instance.FindServerObject(Packet.ObjectID);
                if (pObj == null)
                {
                    return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE);
                }

                SCommand_Object cmdTemp = new SCommand_Object();
                cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_MAGIC_CHANNEL;
                cmdTemp.SetValue <int>(0, 0);
                cmdTemp.SetValue <int>(1, Packet.LogicCount);
                cmdTemp.SetValue <short>(2, Packet.SkillDataID);
                cmdTemp.SetValue <int>(3, Packet.TargetID);
                cmdTemp.SetValue <float>(4, Packet.PosTarget.m_fX);
                cmdTemp.SetValue <float>(5, Packet.PosTarget.m_fZ);
                cmdTemp.SetValue <float>(6, Packet.Dir);

                cmdTemp.SetValue <int>(7, Packet.TotalTime);
                pObj.PushCommand(cmdTemp);

                //pObj->PushDebugString("GCCharSkill_Lead");
                pObj.SetMsgTime(GameProcedure.s_pTimeSystem.GetTimeNow());
                LogManager.Log("RECV GCCharSkillLead");
            }
            return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE);
        }
        public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer)
        {
            if (GameProcedure.GetActiveProcedure() == GameProcedure.s_ProcMain)
            {
                GCAbilityAction packet         = pPacket as GCAbilityAction;
                CObjectManager  pObjectManager = CObjectManager.Instance;
                if (pObjectManager == null)
                {
                    return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_ERROR);
                }
                CObject pObj = pObjectManager.FindServerObject((int)packet.ObjectID);
                if (pObj == null)
                {
                    return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE);
                }

                if (packet.BeginOrEnd == (byte)GCAbilityAction.ActionState.ABILITY_BEGIN)
                {
                    SCommand_Object cmdTemp = new SCommand_Object();
                    cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_ABILITY;
                    cmdTemp.SetValue(0, 0);
                    cmdTemp.SetValue <int>(1, packet.LogicCount);
                    cmdTemp.SetValue <short>(2, packet.AbilityID);
                    cmdTemp.SetValue <int>(3, packet.PrescriptionID);
                    cmdTemp.SetValue <uint>(4, packet.TargetID);
                    pObj.PushCommand(cmdTemp);
                }
            }

            return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE);
        }
Beispiel #14
0
        private IEnumerable <String> ExtractText(CObject cObject)
        {
            var textList = new List <String>();

            if (cObject is COperator)
            {
                var cOperator = cObject as COperator;
                if (cOperator.OpCode.Name == OpCodeName.Tj.ToString() ||
                    cOperator.OpCode.Name == OpCodeName.TJ.ToString())
                {
                    foreach (var cOperand in cOperator.Operands)
                    {
                        textList.AddRange(this.ExtractText(cOperand));
                    }
                }
            }
            else if (cObject is CSequence)
            {
                var cSequence = cObject as CSequence;
                foreach (var element in cSequence)
                {
                    textList.AddRange(this.ExtractText(element));
                }
            }
            else if (cObject is CString)
            {
                var cString = cObject as CString;
                textList.Add(cString.Value);
            }
            return(textList);
        }
Beispiel #15
0
        /// <summary>
        /// Convert a rendering mode number to an enum value
        /// </summary>
        public static FontRenderingMode GetRenderingMode(CObject number)
        {
            var mode = (int)PdfUtilities.GetDouble(number);
            FontRenderingMode fontRenderingMode = FontRenderingMode.Unknown;

            switch (mode)
            {
            case 0:
                fontRenderingMode = FontRenderingMode.Fill;
                break;

            case 1:
                fontRenderingMode = FontRenderingMode.Stroke;
                break;

            case 2:
                fontRenderingMode = FontRenderingMode.FillAndStroke;
                break;

            default:
                fontRenderingMode = FontRenderingMode.Fill;
                break;
            }

            return(fontRenderingMode);
        }
Beispiel #16
0
    public CProp(CObject oObject, int nPropEnumOrdinal, string sLabel, float nDefault, float nMin, float nMax, string sDescription, int nPropFlags, Type oTypeChoice)
    {
        _oObject			= oObject;
        _nPropEnumOrdinal	= nPropEnumOrdinal;
        _sLabel				= sLabel;
        _nDefault			= nDefault;
        _nValueLocal		= nDefault;			// Reasonable way to init local value.  (Important for init flow)
        _nMin				= nMin;
        _nMax				= nMax;
        _nMinMaxRange		= _nMax - _nMin;
        _sDescription		= sDescription;
        _nPropFlags			= nPropFlags;
        _oTypeChoice		= oTypeChoice;

        //FieldInfo[] aFieldsEnum = _oObject._oTypeFieldsEnum.GetFields();
        _sNameProp = sLabel;    //###NOW### "###BROKEN";   //= aFieldsEnum[nPropEnumOrdinal + 1].Name;		// For some reason reflection on enums returns '_value' for index zero with the real enum fields starting at index 1

        //if ((_nPropFlags & Local) == 0 && (_nPropFlags & Blender) == 0) {		// We only have a remote property to connect to if we're non-local
        //	int nError_PropConnect = ErosEngine.Object_PropConnect(_oObject._hObject, _nPropEnumOrdinal, _sNameProp);
        //	if (nError_PropConnect != 0)
        //		Debug.LogWarning(string.Format("WARNING: Non-local property '{0}' of id {1} on object '{2}' could not connect with server DLL equivalent.  Property will not function.", _sNameProp, _nPropEnumOrdinal, _oObject._sNameFull));
        //}

        ConnectPropCallback();
        //Debug.Log(string.Format("{0} prop #{1} = '{2}'", _oObject._sNameFull, _nPropEnumOrdinal, _sNameProp));
    }
Beispiel #17
0
 public IEnumerable <string> ExtractTextFromObject(CObject cObject)
 {
     if (cObject is COperator)
     {
         var cOperator = cObject as COperator;
         if (cOperator.OpCode.Name == OpCodeName.Tj.ToString() ||
             cOperator.OpCode.Name == OpCodeName.TJ.ToString())
         {
             foreach (var cOperand in cOperator.Operands)
             {
                 foreach (var txt in ExtractTextFromObject(cOperand))
                 {
                     yield return(txt);
                 }
             }
         }
     }
     else if (cObject is CSequence)
     {
         var cSequence = cObject as CSequence;
         foreach (var element in cSequence)
         {
             foreach (var txt in ExtractTextFromObject(element))
             {
                 yield return(txt);
             }
         }
     }
     else if (cObject is CString)
     {
         var cString = cObject as CString;
         yield return(cString.Value);
     }
 }
Beispiel #18
0
    private void ExtractText(CObject obj, StringBuilder target)
    {
        switch (obj)
        {
        case COperator cOperator:
            ExtractTextFromOperator(cOperator, target);
            return;

        case CSequence sequence:     //CArray, CSequence
            ExtractTextFromEnumable(sequence, target);
            return;

        case CString cString:
            ExtractTextFromString(cString, target);
            return;

        case CInteger _:
        case CComment _:
        case CName _:
        case CNumber _:
            //Do nothing
            return;

        default:
            throw new NotImplementedException(obj.GetType().AssemblyQualifiedName);
        }
    }
Beispiel #19
0
        public async Task <CObject> GetDefaultLanguage(string database, string project, string layer)
        {
            var content = await communicationManager.GetDefaultLanguage(m_Url, database, project, layer, m_Session.Id, serverName);

            if (content == null)
            {
                return(null);
            }
            JObject json = JObject.Parse(content);

            if (json == null)
            {
                return(null);
            }

            CObject o = new CObject();

            o = JsonConvert.DeserializeObject <CObject>(json.ToString());

            if (o.OverlayUID == null)
            {
                o.OverlayUID = layer;
            }

            if (o.ProjectUID == null)
            {
                o.ProjectUID = project;
            }

            return(o);
        }
Beispiel #20
0
    //---------------------------------------------------------------------------	CREATE / DESTROY
    public override void OnStart_DefineLimb()
    {
        //=== Init Bones and Joints ===
        _aJoints.Add(_oJointExtremity	    = CJointDriver.Create(this, null,					"chestUpper",		15,  8, -000,  000,  000,  000, 1));		//### The body's root bone... is kinematic and has no joint to a parent bone so all zeros
        _aJoints.Add(_oJointChestLower      = CJointDriver.Create(this, _oJointExtremity,		"chestLower",		15,  8, -015,  015,  010,  010, 1));
        _aJoints.Add(_oJointAbdomenUpper	= CJointDriver.Create(this, _oJointChestLower,      "abdomenUpper",	    15,  6, -035,  025,  012,  020, 1));
        _aJoints.Add(_oJointAbdomenLower    = CJointDriver.Create(this, _oJointAbdomenUpper,    "abdomenLower",	    15,  6, -040,  025,  024,  020, 1));
        _aJoints.Add(_oJointHip			    = CJointDriver.Create(this, _oJointAbdomenLower,	"hip",			    15,  6, -035,  020,  015,  015, 1));
        //###NOTE: Pelvis bone is in CActorPelvis for extra processing there.

        //###CHECK: Keep? _oJointExtremity._oRigidBody.isKinematic = (CGame.INSTANCE._GameMode == EGameModes.Configure);		//###HACK ###TEMP ####REVA If play no anim just set everything to kinematic... for temp cloth exploration
        //###OBS? _oJointExtremity._oRigidBody.isKinematic = false;				// We need to disable kinematic on bone as we're driving it with our pin!

        //=== Init Hotspot ===
        _oHotSpot = CHotSpot.CreateHotspot(this, transform, "Chest", true, new Vector3(0, 0, 0), C_SizeHotSpot_BodyNodes);
        //_oHotSpot = CHotSpot.CreateHotspot(this, _oBody.FindBone("chestUpper"), "Chest", true, new Vector3(0, 0, 0), C_SizeHotSpot_TorsoNodes);

        //=== Init CObject ===
        _oObj = new CObject(this, _oBody._oBodyBase._nBodyID, typeof(EActorChest), "Chest", "Chest");
        _oObj.PropGroupBegin("", "", true);
        AddBaseActorProperties();						// The first properties of every CActor subclass are Pinned, pos & rot
        _oObj.PropAdd(EActorChest.Torso_LeftRight,	"Torso_LeftRight",	0,	-100,	100,	"");		//###BUG: Have to recalibrate to make new abdoment-centric bones look good.
        _oObj.PropAdd(EActorChest.Torso_UpDown,		"Torso_UpDown",		0,	-100,	100,	"");		//###NOW###: Forced to enter crappy name because of new CProp restrictions with naming!
        _oObj.PropAdd(EActorChest.Torso_Twist,		"Torso_Twist",		0,	-100,	100,	"");
        _oObj.FinishInitialization();
        //###PROBLEM: Base actor adds 'pinned' but chest is always pinned?

        //###CHECK??
        _oObj.PropSet(EActorChest.Pinned, 1);           // Manually set pinned to 1 on torso so body doesn't float in space when no pose is loaded (Weak that we can't set in PropAdd() due to init-time problems)

        if (CGame.INSTANCE.EnableIdlePoseMovement)
            StartCoroutine(Coroutine_ChangeRandomPose());			//###CHECK: When destroyed OK??
    }
Beispiel #21
0
 public override string ToString()
 {
     return("<tracker " +
            "ID=\"" + m_nID + "\" " +
            "UserID=\"" + m_nUserID + "\" " +
            "Name=\"" + String2XML(m_strName) + "\" " +
            "Comment=\"" + String2XML(m_strComment) + "\" " +
            "DeviceType=\"" + String2XML(m_strDeviceType) + "\" " +
            "IconID=\"" + m_nIconID + "\" " +
            "Color=\"" + String2XML(m_strColor) + "\" " +
            "Flags=\"" + String2XML(m_strFlags) + "\" " +
            "Phone=\"" + String2XML(m_strPhone) + "\" " +
            "SleepPeriod=\"" + m_Timeout + "\" " +
            "ParkRadius=\"" + m_ParkRadius + "\" " +
            "MinParkTime=\"" + m_MinParkTime + "\" " +
            "MinIdleTime=\"" + m_MinIdleTime + "\" " +
            "FuelExpense=\"" + CObject.Float2XML(m_fFuelExpensePerKm) + "\" " +
            "FuelExpensePerHr=\"" + CObject.Float2XML(m_fFuelExpensePerHr) + "\" " +
            "MinDrain=\"" + CObject.Float2XML(m_fMinDrain) + "\" " +
            "MinDrainSpeed=\"" + CObject.Float2XML(m_fMinDrainSpeed) + "\" " +
            "MaxSpeed=\"" + m_MaxSpeed + "\" " +
            "AlarmParkTime=\"" + m_AlarmParkTime + "\" " +
            "IMEI=\"" + m_IMEI + "\" " +
            "DaysToStore=\"" + m_nDaysToStore + "\" " +
            "CreateDate=\"" + m_dtCreateDate + "000\" " +
            //"InstallDate=\"" + m_dtInstallDate + "000\" " +
            "StateNumber=\"" + String2XML(m_strStateNumber) + "\" " +
            //"InstallerName=\"" + String2XML(m_strInstallerName) + "\" " +
            "/>");
 }
Beispiel #22
0
        public void setAppearenceSet(long setKey)
        {
            Debug.Log("set appearence set to key:" + setKey, this.gameObject);
            // clear all the previous "clothing"
            clearGearSlot(GearSlot.CAPE);
            clearGearSlot(GearSlot.LEGS);
            clearGearSlot(GearSlot.SHOULDER);
            clearGearSlot(GearSlot.HEAD);
            clearGearSlot(GearSlot.HANDS);
            clearGearSlot(GearSlot.FEET);
            clearGearSlot(GearSlot.TORSO);

            CObject obj      = DBInst.inst.toObj(7638, setKey);
            CObject setParts = obj.getMember(2);

            foreach (CObject part in setParts.members)
            {
                ClothingItem item = new ClothingItem(DBInst.inst, int.Parse(part.convert().ToString()));
                setGearSlotKey(item.allowedSlots.First(), item.key);
            }

            if (state == ClassState.IDLE)
            {
                state = ClassState.UPDATE;
            }
        }
Beispiel #23
0
    string GetPacket(TrackerPacket point, int isResend)
    {
        decimal Alarm = 0;

        point.GetInput("ALARM", out Alarm);
        int timestamp, packettimestamp, servertimestamp;

        packettimestamp = point.m_Time;
        DateTime dt = CTime.GetTime(Convert.ToInt64(packettimestamp));

        servertimestamp = Convert.ToInt32(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
        if (isResend > 0)
        {
            timestamp = servertimestamp;
        }
        else
        {
            timestamp = packettimestamp;
        }

        string str = "{\"deviceId\": \"" + m_Tracker.m_IMEI + "\", " +
                     "\"latitude\": \"" + point.m_fLat + "\", " +
                     "\"longitude\": \"" + point.m_fLng + "\", " +
                     "\"timeStamp\": \"" + timestamp + "\", " +
                     "\"speed\": \"" + CObject.Float2XML(point.m_Speed / 3.6) + "\", " +
                     "\"sos\": \"" + ((Alarm != 0) ? "True": "False") + "\", " +
                     "\"altitude\": \"" + point.m_Alt + "\", " +
                     "\"vehicleNo\": \"" + m_Tracker.m_strName + "\", " +
                     "\"isValid\": \"" + (point.IsFixed(false) ? "True" : "False") + "\", " +
                     "\"packetTimeStamp\": \"" + packettimestamp + "\"," +
                     "\"serverTimeStamp\": \"" + servertimestamp + "\"" +
                     "}";

        return(str);
    }
Beispiel #24
0
 public FunctionDivide(IStat stat, int order, CObject owner, ILambda lambda)
 {
     Stat    = stat;
     Order   = order;
     Owner   = owner;
     _lambda = lambda;
 }
        /// <summary>
        /// 释放当前对象,使用完成注意调用此方法s
        /// </summary>
        public void Dispose()
        {
            lock (this)
            {
                if (!mIsDisposed)
                {
                    mIsDisposed = true;

                    if (!IsInvokeError)
                    {
                        if (Pool != null && !Pool.IsDisplsed)
                        {
                            Pool.Push(this);
                        }
                        else
                        {
                            Pool = null;
                        }
                    }
                    else
                    {
                        Pool = null;
                        try
                        {
                            CObject.Close();
                        }
                        catch
                        {
                        }
                    }
                }
            }
        }
Beispiel #26
0
    public void DestroyObject(CObject obj)
    {
        if (obj == null)
        {
            return;
        }
        //如果是主目标,取消选择
        if (obj == mMainTarget)
        {
            mMainTarget = null;
        }
        if (obj == mNearestTargetOLD)
        {
            mNearestTargetOLD = null;
        }
        mObjects.Remove(obj.ID);
        mServerObjects.Remove(obj.ServerID);

        //如果被ui关心,发出事件并清除
        int id = obj.ID;

        Dictionary <string, OBJECT_BECARED> .Enumerator enumerator = mapCaredObjects.GetEnumerator();
        while (enumerator.MoveNext())
        {
            OBJECT_BECARED careItem = enumerator.Current.Value;
            if (careItem.id == id)
            {
                //产生事件
                List <string> vParam = new List <string>();
                vParam.Add(id.ToString());
                vParam.Add("destroy");

                CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_OBJECT_CARED_EVENT, vParam);

                mapCaredObjects.Remove(enumerator.Current.Key);
                break;
            }
        }

        //删除队列中其他同ID的物体
        enumerator = mapCaredObjects.GetEnumerator();
        while (enumerator.MoveNext())
        {
            OBJECT_BECARED careItem = enumerator.Current.Value;
            if (careItem.id == id)
            {
                mapCaredObjects.Remove(enumerator.Current.Key);
                enumerator = mapCaredObjects.GetEnumerator();
            }
        }



        if (obj.GetParent() != null)
        {
            obj.GetParent().EraseChild(obj);
        }
        obj.Release();
    }
    //激活动作
    public override void                    DoAction()
    {
        //检查冷却是否结束
        if (!CoolDownIsOver())
        {
            return;
        }

        PET_SKILL pSkill = GetPetSkillImpl();

        if (pSkill == null)
        {
            return;
        }

        SDATA_PET pThisOwner = CDataPool.Instance.Pet_GetPet(m_nPetNum);

        if (!CObjectManager.Instance.getPlayerMySelf().GetCharacterData().isFightPet(pThisOwner.GUID))
        {
            GameProcedure.s_pEventSystem.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, "你不能使用未放出宠物的技能");
            return;
        }

        if (GetPetSkillImpl() != null && GetPetSkillImpl().m_pDefine != null)
        {
            //POINT pt = CGameProcedure::s_pInputSystem->MouseGetPos();
            //fVector3 fvMouseHitPlan;
            //CObjectManager::GetMe()->GetMouseOverObject(pt.x, pt.y, fvMouseHitPlan);

            CObject pTargetObj = CObjectManager.Instance.GetMainTarget();

            //根据操作类型
            switch ((ENUM_SELECT_TYPE)GetPetSkillImpl().m_pDefine.m_nSelectType)
            {
            case ENUM_SELECT_TYPE.SELECT_TYPE_NONE:
            case ENUM_SELECT_TYPE.SELECT_TYPE_CHARACTER:
            {
                CDataPool.Instance.Pet_SendUseSkillMessage(GetPetIndex(), (short)GetPetSkillImpl().m_pDefine.m_nID,
                                                           ((pTargetObj != null)?(pTargetObj.ServerID):(MacroDefine.INVALID_ID)), -1, -1);
                //恢复激活Action
                CActionSystem.Instance.SetDefaultAction(GameProcedure.s_pGameInterface.Skill_GetActive());
            }
            break;

            case ENUM_SELECT_TYPE.SELECT_TYPE_POS:
            {
                CActionSystem.Instance.SetDefaultAction(this);
            }
            break;

            case ENUM_SELECT_TYPE.SELECT_TYPE_SELF:
            default:
            {
                throw new Exception("Invalid pet skill select type:" + GetPetSkillImpl().m_pDefine.m_nSelectType);
            }
            break;
            }
        }
    }
Beispiel #28
0
        public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer)
        {
            if (GameProcedure.GetActiveProcedure() == (GameProcedure)GameProcedure.s_ProcMain)
            {
                LogManager.Log("Receive GCDetailHealsAndDamages Packet");
                GCDetailHealsAndDamages Packet = (GCDetailHealsAndDamages)pPacket;
                CObject pObj = CObjectManager.Instance.FindServerObject((int)Packet.RecieverID);
                if (pObj != null)
                {
                    _DAMAGE_INFO infoDamage = new _DAMAGE_INFO();
                    infoDamage.m_nSkillID = Packet.SkillID;

                    if (infoDamage.m_nSkillID != MacroDefine.INVALID_ID)
                    {
                        _DBC_SKILL_DATA skillData = CSkillDataMgr.Instance.GetSkillData((uint)infoDamage.m_nSkillID);
                        if (skillData != null)
                        {
                            infoDamage.m_nBulletID = skillData.m_nBulletID;
                        }
                    }

                    infoDamage.m_nTargetID         = (uint)Packet.RecieverID;
                    infoDamage.m_nSenderID         = (uint)Packet.SenderID;
                    infoDamage.m_nSenderLogicCount = Packet.SenderLogicCount;
                    infoDamage.m_nImpactID         = MacroDefine.INVALID_ID;
                    infoDamage.m_nType             = _DAMAGE_INFO.DAMAGETYPE.TYPE_HEAL_AND_DAMAGE;
                    if (Packet.IsHpModificationDirty())
                    {
                        infoDamage.m_bHealthDirty     = true;
                        infoDamage.m_nHealthIncrement = Packet.HPModification;
                    }
                    if (Packet.IsMpModificationDirty())
                    {
                        infoDamage.m_bManaDirty     = true;
                        infoDamage.m_nManaIncrement = Packet.MPModification;
                    }
                    if (Packet.IsRageModificationDirty())
                    {
                        infoDamage.m_bRageDirty     = true;
                        infoDamage.m_nRageIncrement = Packet.RageModification;
                    }
                    if (Packet.IsStrikePointModificationDirty())
                    {
                        infoDamage.m_bStrikePointDirty     = true;
                        infoDamage.m_nStrikePointIncrement = Packet.StrikePointModification;
                    }
                    infoDamage.m_bIsCriticalHit = Packet.CriticalHit;

                    _LOGIC_EVENT logicEvent = new _LOGIC_EVENT();
                    logicEvent.Init((uint)Packet.SenderID, Packet.SenderLogicCount, infoDamage);

                    SCommand_Object cmdTemp = new SCommand_Object();
                    cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_LOGIC_EVENT;
                    cmdTemp.SetValue <object>(0, logicEvent);
                    pObj.PushCommand(cmdTemp);
                }
            }
            return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE);
        }
Beispiel #29
0
 private void OnRefreshEvent(CObject sender, CEvent.RedDot.Refresh e)
 {
     if ((RedDotType)e.redDotType != dotType)
     {
         return;
     }
     ShowDot();
 }
Beispiel #30
0
    public void OnStart()
    {
        _oHotSpot = CHotSpot.CreateHotspot(this, transform, "Pose Root", true, Vector3.zero, 2.0f);

        _oObj = new CObject(this, 0, typeof(EPoseRoot), "Pose Root");
        _oObj.PropGroupBegin("", "", true);
        //###BROKEN: Need to flip load order, not 180!!  _oObj.PropAdd(EPoseRoot.Flipped,	"Flip Pose",		0,	"", CProp.Local | CProp.AsCheckbox);	//###IMPROVE: Add a separation member with key hook.  A height too??
        _oObj.FinishInitialization();
    }
Beispiel #31
0
        /// <summary>
        /// Get integer from integer content type
        /// </summary>
        public static int GetInteger(CObject number)
        {
            if (number is CInteger integer)
            {
                return(integer.Value);
            }

            return(0);
        }
 void OnDestroy()
 {
     if (cobj != null)
     {
         cobj.Destory();
         mRegBroadcastList.Clear();
         cobj = null;
     }
 }
Beispiel #33
0
 public PageDetails(string navigator, CObject o, string language)
 {
     MainObject = o;
     InitializeComponent();
     m_Navigator = navigator;
     obj         = o;
     Device.BeginInvokeOnMainThread(async() => { await UpdateDetails(o, language); });
     StartToolBar();
 }
Beispiel #34
0
        public async void NavigateToObject(CObject obj)
        {
            if (obj != null)
            {
                await this.Navigator.NavigateToChild(obj);
            }

            BtnMoveUp.IsVisible = true;
        }
Beispiel #35
0
    // CActorNode: Simple 'node based' actor without joints to enable user to move / rotate other real actors... Currently used for base and torso
    //###DESIGN: Really keep design based on CActor???  Just needs to move a simple node!
    public override void OnStart_DefineLimb()
    {
        //=== Init Bones and Joints ===
        _oHotSpot = CHotSpot.CreateHotspot(this, transform, transform.name, true, Vector3.zero, C_SizeHotSpot_BodyNodes);		//###DESIGN!!!!: How can user move actors apart that get too close??

        //=== Init CObject ===
        _oObj = new CObject(this, _oBody._oBodyBase._nBodyID, typeof(EActorNode), transform.name, transform.name);	//###DESIGN: Keep???
        _oObj.PropGroupBegin("", "", true);
        AddBaseActorProperties();						// The first properties of every CActor subclass are Pinned, pos & rot
        //###DESIGN? _oObj.PropAdd(EActorNode.Height,	"Height",		0.5f,	0.5f,	1.2f,	"", CProp.Local);		//###DESIGN: Range tuned to standing height
        _oObj.FinishInitialization();
    }
Beispiel #36
0
    public void WriteObject(CObject oObject)
    {
        // Serialize_OBS all CProp properties of this object onto currently opened script recorder onto a 'SetAll()' function

        string sScriptLine = string.Format("SetAll(0, Body.{0}, [", oObject._sNameScriptHandle);		//###DESIGN!!! Sometimes write which body??
        foreach (CProp oProp in oObject._aProps)
            sScriptLine += oProp.PropGet().ToString("F3") + ",";
        sScriptLine = sScriptLine.Substring(0, sScriptLine.Length - 1) + "]);";
        Debug.Log(sScriptLine);
        _oStreamWriterScriptFile.WriteLine(sScriptLine);
        _oStreamWriterScriptFile.Flush();			// Keep?
    }
Beispiel #37
0
        public CRootObject()
            : base(null)
        {
            classname = "CRootObject";
            s_pRoot = this;

            m_szAddUpdate = new ArrayList();
            m_szUpdate = new ArrayList();
            m_szRemoveUpdate = new ArrayList();

            m_pNoFatherList = new CObject(this);
        }
Beispiel #38
0
    public CBody(CBodyBase oBodyBase)
    {
        //###NOW#11
        _oBodyBase = oBodyBase;
        _oBodyBase._oBody = this;           //###WEAK#13: Convenience early-set of our instance into owning parent.  Needed as some of init code needs to access us from our parent! ###DESIGN!
        _oBodySkinnedMeshGO_HACK = new GameObject("RuntimeBody");       // Create the game object that will contain our important CBody component early (complex init tree needs it!)
        _oBodySkinnedMeshGO_HACK.transform.SetParent(_oBodyBase._oBodyRootGO.transform);
        _bEnabled = true;			// Enabled at creation by defnition.

        //bool bForMorphingOnly = false;  //###JUNK (CGame.INSTANCE._GameMode == EGameModes.MorphNew_TEMP);				//####DEV!!!!
        Debug.Log(string.Format("+ Creating body #{0}", _oBodyBase._nBodyID));

        _oObj = new CObject(this, _oBodyBase._nBodyID, typeof(EBodyDef), "Body");
        _oObj.PropGroupBegin("", "", true);
        //_oObj.PropAdd(EBodyDef.Sex,				"Sex",				typeof(EBodySex), (int)EBodySex.Woman,	"");
        //_oObj.PropAdd(EBodyDef.ClothingTop,		"Top Clothing",		typeof(EBodyClothingTop_HACK), 0, "");		//###HACK!!!!
        //_oObj.PropAdd(EBodyDef.ClothingBottom,	"Bottom Clothing",	typeof(EBodyClothingBottom_HACK), 0, "" + CProp.Hide);	//###BROKEN: Need to switch off v****a soft body!!
        //_oObj.PropAdd(EBodyDef.Hair,			"Hair",				typeof(EBodyHair), 0,	"");
        //_oObj.PropAdd(EBodyDef.BtnUpdateBody,	"Update Body",		0,	"", CProp.AsButton);
        _oObj.PropAdd(EBodyDef.BreastSize,		"Breast Size BROKEN",		1.0f, 0.5f, 2.5f, "");		//###BROKEN#11
        _oObj.FinishInitialization();

        //=== Give some reasonable defaults to use when game loads ===		###TODO: Load these from the user's last used body definitions!		####TEMP ####DESIGN: Load from user pref or file?  NOT IN CODE!!
        //		if (_oBodyBase._nBodyID == 0) {
        //			_oObj.PropSet(EBodyDef.Sex,				(int)EBodySex.Woman);
        //			//_oObj.PropSet(EBodyDef.Sex,				(int)EBodySex.Shemale);
        //			_oObj.PropSet(EBodyDef.Hair, (int)EBodyHair.TiedUp);
        ////			oObj.PropSet(EBodyDef.Hair, (int)EBodyHair.Messy);
        ////			oObj.PropFind(EBodyDef.ClothingTop)._nPropFlags |= CProp.Hide;		//###HACK!!!!
        ////			oObj.PropFind(EBodyDef.BreastSize)._nPropFlags |= -CProp.Hide;
        ////			oObj.PropFind(EBodyDef.Hair)._nPropFlags |= CProp.Hide;
        //		} else {
        //			//_oObj.PropSet(EBodyDef.Sex,				(int)EBodySex.Man);		####REVB
        //			_oObj.PropSet(EBodyDef.Sex,				(int)EBodySex.Shemale);
        //			//oObj.PropSet(EBodyDef.ClothingTop, (int)EBodyClothingTop_HACK.TiedTop);
        //			_oObj.PropSet(EBodyDef.Hair, (int)EBodyHair.TiedUp);
        //			//if (CGame.INSTANCE._bRunningInEditor)		//###TEMP! :)
        //			//	oObj.PropSet(EBodyDef.BreastSize, 1.3f);
        //		}

        //===== DETACHED SOFTBODY PARTS PROCESSING =====
        if (_oBodyBase._eBodySex != EBodySex.Man) {
            //_aSoftBodies.Add(_oBreastL = (CBreastL)CSoftBody.Create(this, typeof(CBreastL), "chestUpper"));        //###DEVNOW
            //_aSoftBodies.Add(_oBreastR = (CBreastR)CSoftBody.Create(this, typeof(CBreastR), "chestUpper"));
        }
        if (_oBodyBase._eBodySex == EBodySex.Woman) {
            //_aSoftBodies.Add(_oVagina = (CVagina)CSoftBody.Create(this, typeof(CVagina), "chest/abdomen/hip"));
        } else {
            //_aSoftBodies.Add(_oPenis = (CPenis)CSoftBody.Create(this, typeof(CPenis), "chest/abdomen/hip"));
        }

        ////####TEMP ####DESIGN ####TEMP ####MOVE
        //_aCloths.Add(CBCloth.Create(this, "MyShirt", "Shirt", "HACK-Cloth-TankTop", "_ClothSkinnedArea_ShoulderTop"));    //_ClothSkinnedArea_Top
        ///_aCloths.Add(CBCloth.Create(this, "MyShirt", "Shirt", "BodySuit", "_ClothSkinnedArea_ShoulderTop"));    //_ClothSkinnedArea_Top
        ////_aCloths.Add(CBCloth.Create(this, "Rough1-Holds"));
        ////_aCloths.Add(CBCloth.Create(this, "Rough2-Spreads"));
        ////_aCloths.Add(CBCloth.Create(this, "BodySuit-Top-Trimmed"));
        ////////////###DEV _aCloths.Add(CBCloth.Create(this, "FullShirt"));

        ////=== Create the various soft-body mesh parts that are dependant on the body sex ===
        ////###IMPROVE!!!! Parse array of Blender-pushed softbody into our parts (instead of pulling like below?)
        //if (_bForMorphingOnly == false) {
        //	if (_eBodySex == EBodySex.Woman || _eBodySex == EBodySex.Shemale) {
        //		_aSoftBodies.Add(_oBreastL = (CBreastBase)CBMesh.Create(null, this, _sNameGameBody, "_Detach_Breasts", "Client", "Unity_GetMesh", "'SkinInfo'", typeof(CBreastBase)));           //###WEAK: Create utility function like before???
        //	}
        //	if (_eBodySex == EBodySex.Shemale || _eBodySex == EBodySex.Man)
        //		_aSoftBodies.Add(_oPenis = (CPenis)CBMesh.Create(null, this, _sNameGameBody, "_Detach_Penis", "Client", "Unity_GetMesh", "'NoSkinInfo'", typeof(CPenis)));
        //	if (_eBodySex == EBodySex.Woman)
        //		_oVagina = new CVagina(this);

        //	//=== Create the important body collider that will repel fluid in the scene ===
        //	_oBodyCol = (CBBodyCol)CBBodyCol.Create(null, this, _sNameGameBody);
        //}

        //=== Obtain the source mesh body for normal extraction ===
        ///_oBodySource = CBMesh.Create(null, this, "oMeshSource", typeof(CBMesh));
        ///_oBodySource.GetComponent<MeshRenderer>().enabled = false;					// This mesh is to pull normals only.  Not visible at runtime!

        //===== MAIN SKINNED BODY PROCESSING =====
        //=== Get the main body skinned mesh (has to be done once all softbody parts have been detached) ===
        _oBodySkinnedMesh = (CBSkin)CBMesh.Create(_oBodySkinnedMeshGO_HACK, _oBodyBase, ".oBody.oMeshBody", typeof(CBSkin)); //###IMPROVE#13: Create blender instance string for our CBody?
        _oBodySkinnedMesh.name = "GametimeBody";
        //_oBodySkinnedMesh.GetComponent<SkinnedMeshRenderer>().enabled = false;

        //=== Create a hotspot at the character's head the user can use to invoke our (important) context menu ===
        //###BROKENN
        //      Transform oHeadT = FindBone("chest/neck/head");         // Our hotspot is located on the forehead of the character.
        //_oHotSpot = CHotSpot.CreateHotspot(this, oHeadT, this._sHumanCharacterName, false, new Vector3(0, 0.09f, 0.03f), 2.0f);     //###IMPROVE: Get these offsets from pre-placed nodes on bone structure??

        ////=== Create the head look controller to look at parts of the other body ===
        //###BROKENN
        //      _oHeadLook = _oBodyRootGO.gameObject.AddComponent<CHeadLook>();			//####DESIGN: Keep for morph mode??
        //_oHeadLook.OnStart(this);

        //=== Instantiate the requested hair and pin as child of the head bone ===
        //###BROKENN
        //EBodyHair eBodyHair = (EBodyHair)_oObj.PropGet(EBodyDef.Hair);
        //if (eBodyHair != EBodyHair.None) {
        //	string sNameHair = "HairW-" + eBodyHair.ToString();         //###HACK!!! W extension!		###HACK!!!! Man support!!
        //	GameObject oHairTemplateGO = Resources.Load("Models/Characters/Woman/Hair/" + sNameHair + "/" + sNameHair, typeof(GameObject)) as GameObject;   // Hair has name of folder and filename the same.	//###HACK: Path to hair, selection control, enumeration, etc
        //	_oHairGO = GameObject.Instantiate(oHairTemplateGO) as GameObject;
        //	Transform oBoneHead = FindBone("chest/neck/head");
        //	_oHairGO.transform.parent = oBoneHead;
        //	_oHairGO.transform.localPosition = Vector3.zero;
        //	_oHairGO.transform.localRotation = Quaternion.identity;
        //	if (_eBodySex == EBodySex.Man) {            //###HACK!!!!!! To reuse messy hair for man!!
        //		_oHairGO.transform.localPosition = new Vector3(0, 0.0f, 0.0f);
        //		_oHairGO.transform.localScale = new Vector3(1.07f, 1.07f, 1.08f);
        //	}
        //}

        Body_InitActors();

        ////=== Setup the keys to handle penis control on non-woman bodies ===
        //if (_eBodySex != EBodySex.Woman) {      //###MOVE?        ###OBS ###F
        //	bool bSelectedBodyOnly = (CGame.INSTANCE._nNumPenisInScene_BROKEN > 1);    // Keys below are active if this body is the selected body ONLY if we have more than one man in the scene
        //	if (_oPenis != null) {
        //		_oKeyHook_PenisBaseUpDown = new CKeyHook(_oPenis._oObjDriver.PropFind(EPenis.BaseUpDown), KeyCode.Q, EKeyHookType.QuickMouseEdit, "Penis up/down", 1, bSelectedBodyOnly);
        //		_oKeyHook_PenisShaftUpDown = new CKeyHook(_oPenis._oObjDriver.PropFind(EPenis.ShaftUpDown), KeyCode.E, EKeyHookType.QuickMouseEdit, "Penis bend up/down", 1, bSelectedBodyOnly);
        //		_oKeyHook_PenisDriveStrengthMax = new CKeyHook(_oPenis._oObjDriver.PropFind(EPenis.DriveStrengthMax), KeyCode.G, EKeyHookType.QuickMouseEdit, "Penis erection", -1, bSelectedBodyOnly);
        //	}
        //}
        _oKeyHook_ChestUpDown = new CKeyHook(_oActor_Chest._oObj.PropFind(EActorChest.Torso_UpDown), KeyCode.T, EKeyHookType.QuickMouseEdit, "Chest forward/back");

        //=== Create the face and its associated morph channels ===
        ///_oFace = (CFace)CBMesh.Create(null, this, "oMeshFace", typeof(CFace));

        //=== Reparent our actor base to the pose root so that user can move / rotate all bodies at once ===
        _oActor_Base.transform.SetParent(CGame.INSTANCE._oPoseRoot.transform);		//###DESIGN#15! Causes problems with regular init/destory of CBody?  Do we really want to keep reparenting for easy full pose movement??>
        _oActor_Base.gameObject.name = _oBodyBase._sBodyPrefix + "_Base";

        //=== Copy references to our actors to our script-friendly CObject variables to provide friendlier access to our scriptable objects ===
        Base    = _oActor_Base._oObj;              // CGamePlay passed us the reference to the right (empty) static object.  We fill it here.
        Chest   = _oActor_Chest._oObj;
        Torso   = _oActor_Torso._oObj;
        Pelvis  = _oActor_Pelvis._oObj;
        ArmL    = _oActor_ArmL._oObj;
        ArmR    = _oActor_ArmR._oObj;
        LegL    = _oActor_LegL._oObj;
        LegR    = _oActor_LegR._oObj;
        Face = null;/// _oFace._oObj;
        ///###BROKEN ###DEVO Penis = (_oPenis == null) ? null : _oPenis._oObjDriver;

        _oScriptPlay = CUtility.FindOrCreateComponent(_oBodyBase._oBodyRootGO.transform, typeof(CScriptPlay)) as CScriptPlay;
        _oScriptPlay.OnStart(this);

        //=== Rotate the 2nd body toward the first and separate slightly loading poses doesn't pile up one on another ===	####MOVE? ####OBS? (Depend on pose?)
        //####PROBLEM: Set separation and don't do in all game modes
        if (_oBodyBase._nBodyID == 0) {
            _oActor_Base.transform.position = new Vector3(0, 0, -CGame.C_BodySeparationAtStart);        //###DESIGN: Don't load base actor instead??  ###BUG Overwrites user setting of base!!!!
        } else {
            _oActor_Base.transform.position = new Vector3(0, 0, CGame.C_BodySeparationAtStart);
            _oActor_Base.transform.rotation = Quaternion.Euler(0, 180, 0);      // Rotate the 2nd body 180 degrees
        }

        ///_oClothEdit_HACK = new CClothEdit(this, "Shirt");

        ///CGame.gBL_SendCmd("CBody", "CBodyBase_GetBodyBase(" + _oBodyBase._nBodyID.ToString() + ").Breasts_ApplyMorph('RESIZE', 'Nipple', 'Center', 'Wide', (1.6, 1.6, 1.6, 0), None)");       //###F ###HACK!!!

        //=== Create the left and right canvases on each side of the body so that panels have a place to be pinned for close-to-body editing ===
        _aUICanvas[0] = CUICanvas.Create(CUtility.FindChild(_oActor_Chest.transform, "_CanvasPin_Left"));        //###HACK
        _aUICanvas[1] = CUICanvas.Create(CUtility.FindChild(_oActor_Chest.transform, "_CanvasPin_Right"));        //###DESIGN: Which pin?  Torso or chest?

        //=== Create the Flex collider in Blender and serialize it to Unity ===
        CGame.gBL_SendCmd("CBody", _oBodyBase._sBlenderInstancePath_CBodyBase + ".oBody.CreateFlexCollider(" + CGame.INSTANCE.nDistFlexColliderShrinkMult + ")");
        _oBodyFlexCollider = (CBSkin)CBMesh.Create(null, _oBodyBase, ".oBody.oMeshFlexCollider", typeof(CBSkin));
        _oBodyFlexCollider.name = "FlexCollider";
        _oBodyFlexCollider.transform.SetParent(_oBodySkinnedMesh.transform);		//###IMPROVE#15: Put this common re-parenting and re-naming in Create!
        _oBodyFlexCollider.gameObject.AddComponent<CFlexSkinnedBody>();
        _oBodyFlexCollider.GetComponent<SkinnedMeshRenderer>().enabled = false;     //###IMPROVE: Move into CFlexSkinnedBody??
        _oBodyFlexCollider.UpdateNormals();			//###NOW#15
    }
Beispiel #39
0
    public void Start()
    {
        //    StartCoroutine(Coroutine_StartGame());			// Handled by a coroutine so that our 'OnGui' can run to update the 'Please wait' dialog
        //}
        //public IEnumerator Coroutine_StartGame() {		//####OBS: IEnumerator?? //###NOTE: Game is started by iGUICode_Root once it has completely initialized (so as to present the 'Please Wait...' dialog

        Debug.Log("=== CGame.StartGame() ===");
        INSTANCE = this;
        _nTimeAtStart = Time.time;

        //GameObject oGO_HACK = new GameObject("oGO_HACK", typeof(CSoftBody));     //###NOW###
        ////GameObject oGO_HACK = new GameObject("oGO_HACK", typeof(CSoftBodyBase));     //###NOW###
        ////GameObject oGO_HACK = new GameObject("oGO_HACK", typeof(CB));     //###NOW###
        ////GameObject oGO_HACK = new GameObject("oGO_HACK", typeof(CFuckOff));
        ////GameObject oGO_HACK = new GameObject("oGO_HACK", typeof(CJointDriver));
        //return;

        _oFlexSolver = FindObjectOfType<uFlex.FlexSolver>();        //###F
        GameObject oSceneGO = GameObject.Find("SCENE/SceneColliders");
        //if (oSceneGO != null)
        //    s_aColliders_Scene = oSceneGO.GetComponentsInChildren<CCollider_OBS>();

        _bRunningInEditor = true;       //###HACK ####REVA Application.isEditor
        _DemoVersion = (_bRunningInEditor == false);		//###CHECK? If dev has Unity code they are non-demo

        _oCursor = CCursor.Cursor_Create();             //###DESIGN!!!!!: REVISIT!	###CLEANUP!!!!!
        Cursor.visible = Application.isEditor;      // _bRunningInEditor;

        //=== Set rapid-access members to text widgets so we can rapidly update them ===
        _oTextUL = GameObject.Find("/UI/CanvasScreen/UL/Text-UL").GetComponent<Text>();
        _oTextUC = GameObject.Find("/UI/CanvasScreen/UC/Text-UC").GetComponent<Text>();
        _oTextUR = GameObject.Find("/UI/CanvasScreen/UR/Text-UR").GetComponent<Text>();

        //=== Create user-adjustable top-level game options ===
        _oObj = new CObject(this, 0, typeof(EGamePlay), "Erotic9");		//###TEMP!!! Main game name in this low-importance GUI???
        _oObj.PropGroupBegin("", "", true);		//###CLEANUP
        //_oObj.PropAdd(EGamePlay.Pleasure,			"Pleasure",		30,		-100,	100,	"Amount of pleasure experienced by game characters.  Influences 'Arousal' (NOTE: Temporary game mechanism)");	//###BUG with first setting
        //_oObj.PropAdd(EGamePlay.Arousal,			"Arousal",		0,		0,		100,	"Current state of arousal from game characters.  Currently influence penis size.  (NOTE: Temporary game mechanism)");
        //_oObj.PropAdd(EGamePlay.PoseRootPos,		"Pose Root Position",typeof(EPoseRootPos), 0,	"Base location of pose root.  (e.g. on bed, by bedside, etc)");
        //_oObj.PropAdd(EGamePlay.PenisSize,			"Penis Size",	0,		0,		100,	"", CProp.ReadOnly | CProp.Hide);
        //_oObj.PropAdd(EGamePlay.PenisErectionMax,	"Erection",		0,		0,		100,	"", CProp.ReadOnly | CProp.Hide);
        //_oObj.PropAdd(EGamePlay.FluidConfig,		"Fluid Configuration", 0, "Display the properties of the Erotic9 fluid simulator.  (Advanced)", CProp.AsButton);
        _oObj.FinishInitialization();
        _oHotSpot = CHotSpot.CreateHotspot(this, transform, "Game Options", false, new Vector3(0, 0.0f, 0.0f), 1.0f);

        //if (_GameModeAtStartup == EGameModes.None) {
        //    yield break;
        //}

        float nDelayForGuiCatchup = _bRunningInEditor ? 0.2f : 0.01f;		//###HACK? ###TUNE: Adjustable delay to give iGUI time to update 'Game is Loading' message, with some extra time inserted to make Unity editor appear more responsive during game awake time
        ///yield return new WaitForSeconds(nDelayForGuiCatchup);

        //=== Send async call to authentication so it is ready by the time game has initialized ===
        //		WWW oWWW = null;
        //		if (Application.genuine) {		//###CHECK: Has any value against piracy???
        //			if (Application.internetReachability != NetworkReachability.NotReachable) {		//###CHECK!!!
        //				//####BROKEN?! Why store it if we don't use it? string sMachineID = PlayerPrefs.GetString(G.C_PlayerPref_MachineID);
        //				string sMachineID = CGame.GetMachineID();		//###CHECK Can cause problems if switching adaptors frequently?
        //				oWWW = new WWW("http://www.erotic9.net/cgi-bin/CheckUser.py?Action=Authenticate&MachineID=" + sMachineID);
        //			} else {
        //				Debug.LogError("Warning: Could not authenticate because of Internet unreacheability.");
        //			}
        //		} else {
        //			Debug.LogError("Warning: Could not authenticate because of executable image corruption.");
        //		}

        //=== Try to load our dll to extract helpful error message if it fails, then release it ===
        //Debug.Log("INIT: Attempting to load ErosEngine.dll");         //###BROKEN!  WTF No longer works loading 64 bit dll??
        //int hLoadLibResult = LoadLibraryEx("ErosEngine.dll", 0, 2);
        //if (hLoadLibResult > 32)
        //	FreeLibrary(hLoadLibResult);			// Free our dll so Unity can load it its way.  Based on code sample at http://support.microsoft.com/kb/142814
        //else
        //	CUtility.ThrowException("ERROR: Failure to load ErosEngine.dll.  Error code = " + hLoadLibResult);		// App unusable.  Study return code to find out what is wrong.
        //Debug.Log("INIT: Succeeded in loading ErosEngine.dll");

        //####OBS? GameObject oGuiGO = GameObject.Find("iGUI");			//###TODO!!! Update game load status... ###IMPROVE: Async load so OnGUI gets called???  (Big hassle for that!)
        Debug.Log("0. Game Awake"); ///yield return new WaitForSeconds(nDelayForGuiCatchup);
        int n123 = ErosEngine.Utility_Test_Return123_HACK();			// Dummy call just to see if DLL will load with Unity
        if (n123 != 123)
            CUtility.ThrowException("ERROR: Failure to get 123 from ErosEngine.dll call to Utility_Test_Return123_HACK.");
        Debug.Log("INIT: Succeeded in loading ErosEngine.dll");

        //=== Initialize our gBlender direct-memory buffers ===
        Debug.Log("1. Shared Memory Creation.");  //###???  new WaitForSeconds(nDelayForGuiCatchup);
        if (ErosEngine.gBL_Init(CGame.GetFolderPathRuntime()) == false)
            CUtility.ThrowException("ERROR: Could not start gBlender library!  Game unusable.");

        //=== Spawn Blender process ===
        Debug.Log("2. Background Server Start.");  //###???  new WaitForSeconds(nDelayForGuiCatchup);	//###CHECK: Cannot wait long!!
        _hWnd_Unity = (IntPtr)GetActiveWindow();			// Just before we start Blender obtain the HWND of our Unity editor / player window.  We will need this to re-activate our window.  (Starting blender causes it to activate and would require user to alt-tab back to game!!)
        _oProcessBlender = CGame.LaunchProcessBlender("Erotic9.blend");
        if (_oProcessBlender == null)
            CUtility.ThrowException("ERROR: Could not start Blender!  Game unusable.");
        //_nWnd_Blender_HACK = (IntPtr)GetActiveWindow();

        //=== Start Blender (and our gBlender scripts).  Game cannot run without them ===
        Debug.Log("3. Client / Server Handshake.");  //###???  new WaitForSeconds(nDelayForGuiCatchup);
        if (ErosEngine.gBL_HandshakeBlender() == false)
            CUtility.ThrowException("ERROR: Could not handshake with Blender!  Game unusable.");

        SetForegroundWindow(_hWnd_Unity);           // Set our editor / player back into focus (away from just-spawned Blender)

        //=== Set Blender global variables ===
        CGame.gBL_SendCmd("G", "CGlobals.SetFlexParticleSpacing(" + CGame.INSTANCE.particleSpacing.ToString() + ")");         //###TODO: Add others?

        //=== Start PhysX ===
          //      Debug.Log("4. PhysX3 Init.");  //###???  new WaitForSeconds(nDelayForGuiCatchup);
        //ErosEngine.PhysX3_Create();						// *Must* occur before any call to physics library...  So make sure this object is listed with high priority in Unity's "Script Execution Order"

        //Debug.Log("5. PhysX2 Init.");  //###???  new WaitForSeconds(nDelayForGuiCatchup);
        //ErosEngine.PhysX2_Create();						//###IMPROVE!!! Return argument ###NOTROBUST

        //Debug.Log("6. OpenCL Init.");  //###???  new WaitForSeconds(nDelayForGuiCatchup);
        //		if (System.Environment.CommandLine.Contains("-DisableOpenCL") == false)	//###TODO More / better command line processing?		//###SOON ####BROKEN!!!!! OpenCL breaks cloth GPU!
        //			ErosEngine.MCube_Init();		//###IMPROVE: Log message to user!

        SetForegroundWindow(_hWnd_Unity);			//###WEAK: Can get rid of??

        //=== Start misc stuff ===
        Debug.Log("7. CGame globals.");  //###???  new WaitForSeconds(nDelayForGuiCatchup);
        _oSceneMeshesGO = GameObject.Find("SceneMeshes");			// Remember our scene game object so we can hide/show

        _aGuiMessages = new string[(int)EGameGuiMsg.COUNT];
        _ShowFPS = _ShowSysInfo = _bRunningInEditor;

        //###IMPROVE: Disabled until we need to save CPU cycles...  Create upon user demand to record script!
        //_oScriptRecordUserActions = new CScriptRecord(GetPathScript("RecordedScript"), "Automatically-generated Erotic9 Scene Interation Script");

        _oPoseRoot = GameObject.Find("CPoseRoot").GetComponent<CPoseRoot>();
        _oPoseRoot.OnStart();

        //_oFluid = gameObject.AddComponent<CFluid>();
        //_oFluid.OnAwake();

        Application.targetFrameRate = _TargetFrameRate;			//###BUG!!! Why no effect????
        _DefaultJointSpringOld = _DefaultJointSpring;		//###OBS
        _DefaultJointDampingOld = _DefaultJointDamping;

        _oCamTarget = GameObject.Find("CCamTarget").GetComponent<CCamTarget>();		//###WEAK!!!
        _oCamTarget.OnStart();

        Debug.Log("8. Body Assembly.");  //###???  new WaitForSeconds(nDelayForGuiCatchup);		//###WEAK!!!

        //_oFluid.OnStart();								//###CHECK: Keep interleave

        SetGameModeBasicInteractions(true);

        //=== Find the static scene colliders in 'SceneColliders' node and initialize them ===
        //Debug.Log("CGame.StartGame() Registering Static Colliders: " + s_aColliders_Scene.Length);
          //  if (s_aColliders_Scene != null)
            //foreach (CCollider_OBS oColStatic in s_aColliders_Scene)		// Colliders that are marked as static registered themselves to us in their Awake() so we can start and destroy them
               // oColStatic.OnStart();

        //StartCoroutine(Coroutine_Update100ms());
        StartCoroutine(Coroutine_Update500ms());

        _GameIsRunning = true;
        enabled = true;
        Debug.Log("+++ GameIsRunning ++");

        Debug.Log("7. Scene settling time.");  //###???  new WaitForSeconds(2.0f);		//###DESIGN??  ###TUNE??
        ///_oGui.ShowSceneBlanker(false);
        ///_oGui.ShowPanelGameLoad(false);

        //=== Check result of user authentication ===
        /*
        if (oWWW != null) {
            yield return oWWW;
            string sResultAuth = oWWW.text;
            _DemoVersion = sResultAuth.Contains("Result=OK") == false;		//###IMPROVE: Create parse routine and return server errors
            Debug.Log("Auth Results = " + sResultAuth);
            if (_DemoVersion == false)
                Debug.Log("Starting game in non-demo mode.");
        }*/
        //_DemoVersion = false;
        //if (_DemoVersion)
        //	Debug.Log("Starting game in demo mode.");		//###TODO: Temp caption!

        ///		if (_bRunningInEditor == false)
        ///			CUtility.WndPopup_Create(EWndPopupType.LearnToPlay, null, "Online Help", 50, 50);	// Show the help dialog at start... ###BUG: Does not change the combo box at top!

        SetForegroundWindow(_hWnd_Unity);           //###WEAK: Can get rid of??

        //if (CGame.INSTANCE._GameMode == EGameModes.None)        //####TEMP
        //    return;

        //=== Create the body publicly-editable body definitions that can construct and reconstruct CBody instances ===
        //CGame.INSTANCE._nNumPenisInScene_BROKEN = 0;

        //###NOTE: For simplification in pose files we always have two bodies in the scene with man/shemale being body 0 and woman body 1
        //CreateBody(0);
        //      //CreateBody(1);
        _aBodyBases[0] = new CBodyBase(0, EBodySex.Woman);
        //###BROKEN _aBodyBases[0].SelectBody();

        TemporarilyDisablePhysicsCollision();

        ///SetPenisInVagina(false);		// We initialize the penis in v****a state to false so v****a track colliders don't kick in at scene init

        if (CGame.INSTANCE._GameMode == EGameModes.Play)
            ScenePose_Load("Standing", false);          // Load the default scene pose

        //###TODO ##NOW: Init GUI first!!
        //iGUISmartPrefab_WndPopup.WndPopup_Create(new CObject[] { oObj }, "Game Play", 0, 0);		//###TEMP

        //Time.timeScale = 0.05f;		//###REVA ###TEMP   Gives more time for cloth to settle... but fix it some other way (with far stronger params??)

        ChangeGameMode(_GameModeAtStartup);             // Set the initial game mode as statically requested

        Debug.LogFormat("Time at startup end: {0}", Time.time - _nTimeAtStart);
        //ScenePose_Load("Standing", false);          // Load the default scene pose
    }
Beispiel #40
0
    //---------------------------------------------------------------------------	INIT
    public override void OnDeserializeFromBlender()
    {
        base.OnDeserializeFromBlender();
        transform.SetParent(_oBodyBase._oBody._oBodySkinnedMeshGO_HACK.transform);			// Parent to our body's main skinned mesh	###WEAK#14: Crappy circumvent way of obtaining node we need early in init!

        _sNameSoftBody = GetType().Name.Substring(1);                            // Obtain the name of our detached body part ('Breasts', 'Penis', 'V****a') from a substring of our class name.  Must match Blender!!  ###WEAK?
        _sBlenderInstancePath_CSoftBody = ".oBody.aSoftBodies['" + _sNameSoftBody + "']";                          // Simplify access to Blender CSoftBody instance
        _sBlenderInstancePath_CSoftBody_FullyQualfied = _oBodyBase._sBlenderInstancePath_CBodyBase + _sBlenderInstancePath_CSoftBody; // Simplify access to fully-qualified Blender CSoftBody instance (from CBody instance)
        _oBoneAnchor = _oBodyBase._oBody._oBodyBase.FindBone(_sNameBoneAnchor_HACK);

        //=== Set bounds to infinite so our dynamically-created mesh never has to recalculate bounds ===
        _oMeshNow.bounds = CGame._oBoundsInfinite;          //####IMPROVE: This can hurt performance ####OPT!!
        _oMeshNow.MarkDynamic();        // Docs say "Call this before assigning vertices to get better performance when continually updating mesh"

        //=== Create the managing object and related hotspot ===
        _oObj = new CObject(this, 0, typeof(EFlexSoftBody), "SoftBody " + gameObject.name);        //###IMPROVE: Name of soft body to GUI
        _oObj.PropGroupBegin("", "", true);
        _oObj.PropAdd(EFlexSoftBody.Volume,         "Volume",       1.0f, 0.6f, 1.6f, "");
        _oObj.PropAdd(EFlexSoftBody.Stiffness,      "Stiffness",    1.0f, 0.001f, 1.0f, "");       //###IMPROVE: Log scale!
        _oObj.PropAdd(EFlexSoftBody.SoftBodyMass,   "Mass",         1.0f, 0.0001f, 1000.0f, "");
        _oObj.FinishInitialization();
        if (GetType() != typeof(CBreastR))          //###HACK!: Right breast doesn't get hotspot (left breast gets it and manually broadcasts to right one)
            _oHotSpot = CHotSpot.CreateHotspot(this, _oBoneAnchor, "SoftBody", false, new Vector3(0, 0.10f, 0.08f));     //###IMPROVE!!! Position offset that makes sense for that piece of clothing (from center of its verts?)
    }
Beispiel #41
0
 public void _RegUpdate(CObject obj)
 {
     m_szRemoveUpdate.Remove(obj);
     m_szAddUpdate.Remove(obj);
     m_szAddUpdate.Add(obj);
 }
Beispiel #42
0
 public void _DelUpdate(CObject obj)
 {
     m_szRemoveUpdate.Remove(obj);
     m_szRemoveUpdate.Add(obj);
 }
Beispiel #43
0
    //---------------------------------------------------------------------------	CREATE / DESTROY
    public override void OnStart_DefineLimb()
    {
        _nDrivePos = 0.1f * C_DrivePos;				// Weaken the hand drive so hand doesn't fly from pin to pin		//###TUNE
        //_memVecRayHitInfo = new CMemAlloc<Vector3>(2);

        //=== Init Bones and Joints ===
        CJointDriver oJointChestUpper = _oBody._oActor_Chest._oJointExtremity;
        _aJoints.Add(_oJointCollar	        = CJointDriver.Create(this, oJointChestUpper,	    _sSidePrefixL+"Collar",	        30, 2.5f, -010,  050,  030,  021, 1));		// X = Collar Up/Down OK, Z has 17 back and 25 forward (avg looks ok)
        _aJoints.Add(_oJointShoulderBend    = CJointDriver.Create(this, _oJointCollar,		    _sSidePrefixL+"ShldrBend",	    15, 2.0f, -085,  035,  000,  110, 1));		// X = Shoulder Up/Down OK, Z = Back goes to -40, Forward to 110!!!  (###IMPROVE: Another joint?)
        _aJoints.Add(_oJointShoulderTwist   = CJointDriver.Create(this, _oJointShoulderBend,    _sSidePrefixL+"ShldrTwist",	    20, 1.5f, -000,  000,  080,  000, 1));		// Y = Shoulder twist goes from -95 to 80 so max.  ###PROBLEM: Shimmer in high rotation!
        _aJoints.Add(_oJointForearmBend	    = CJointDriver.Create(this, _oJointShoulderTwist,	_sSidePrefixL+"ForearmBend",	10, 1.5f, -020,  135,  000,  000, 1));		// X = Elbow bend from -20 to 135. ok.
        _aJoints.Add(_oJointForearmTwist    = CJointDriver.Create(this, _oJointForearmBend,	    _sSidePrefixL+"ForearmTwist",	20, 1.0f, -000,  000,  080,  000, 1));		// Y = Forearm twist from -90 to 80 so max.		###IMPROVE: Could rotate the axes on the twists so we use XL/XH
        _aJoints.Add(_oJointExtremity       = CJointDriver.Create(this, _oJointForearmTwist,	_sSidePrefixL+"Hand",			10, 0.5f, -070,  080,  010,  029, 1));		// X = Hand -down(-70) / +up (+80), Y = Hand twist +/-10, Z = Hand side-to-side -28 to +30

        //ConfigFingerRoot(1, "Index");			// Thumb is handled below		###DESIGN!!! Fingers in Unity PhysX is just a no-go because of extremely poor latency... what to do?????
        //ConfigFingerRoot(2, "Mid");
        //ConfigFingerRoot(3, "Ring");			//??? ###HACK!! Disabled man's carpal1&2 in 3dsMax so we can use same code as women's!
        //ConfigFingerRoot(4, "Pinky");

        //CJointDriver oJointFingerBoneParent = _oJointExtremity;
        //oJointFingerBoneParent = ConfigFingerBone(oJointFingerBoneParent, 0, 0, "Thumb", 005f, -030f,  005f,  025f);
        //oJointFingerBoneParent = ConfigFingerBone(oJointFingerBoneParent, 0, 1, "Thumb", 010f, -015f,  000f,  000f);
        //oJointFingerBoneParent = ConfigFingerBone(oJointFingerBoneParent, 0, 2, "Thumb", 010f, -015f,  000f,  000f);

        //=== Init Hotspot ===
        if (_eBodySide == 0)
            _oHotSpot = CHotSpot.CreateHotspot(this, _oBody._oBodyBase.FindBone("chestUpper/lCollar/lShldrBend/lShldrTwist/lForearmBend/lForearmTwist/lHand"), "Left Hand", true, new Vector3(0, 0, 0));
        else
            _oHotSpot = CHotSpot.CreateHotspot(this, _oBody._oBodyBase.FindBone("chestUpper/rCollar/rShldrBend/rShldrTwist/rForearmBend/rForearmTwist/rHand"), "Right Hand", true, new Vector3(0, 0, 0));

        //=== Init CObject ===
        _oObj = new CObject(this, _oBody._oBodyBase._nBodyID, typeof(EActorArm), "Arm", "Arm" + _sSidePrefixU);
        _oObj.PropGroupBegin("", "", true);
        AddBaseActorProperties();						// The first properties of every CActor subclass are Pinned, pos & rot
        //_oObj.PropAdd(EActorArm.HandTarget,			"HandTarget",			typeof(EHandTargets), (int)EHandTargets.ManualPosition, "");
        _oObj.PropAdd(EActorArm.Hand_UpDown,		"Hand-UpDown",			0,	-100,	100, "");
        _oObj.PropAdd(EActorArm.Hand_LeftRight,		"Hand-LeftRight",		0,	-100,	100, "");
        _oObj.PropAdd(EActorArm.Hand_Twist,			"Hand-Twist",			0,	-100,	100, "");
        //_oObj.PropAdd(EActorArm.Fingers_Close,		"Fingers-Close",		0,	-100,	100, "", CProp.Hide);		//###BROKEN
        //_oObj.PropAdd(EActorArm.Fingers_Spread,		"Fingers-Spread",		0,	-100,	100, "", CProp.Hide);
        //_oObj.PropAdd(EActorArm.Fingers_ThumbPose,	"Fingers-ThumbPose",	typeof(EThumbPose), (int)EThumbPose.AlongsideFingers, "", CProp.Hide);
        //_oObj.PropAdd(EActorArm.UserControl,		"User Control",			0,		0,		1, "");
        _oObj.FinishInitialization();

        _oHandTarget_RaycastPin = CActorArm.FindHandTarget(_oBody, EHandTargets.RaycastPin, _eBodySide == EBodySide.Right);	// Find the raycast pin hand target as we use it heavily and it is reparented
    }
Beispiel #44
0
    //---------------------------------------------------------------------------	CREATE / DESTROY
    public override void OnStart_DefineLimb()
    {
        //###CHECK _aJoints.Add(_oJointExtremity = CJointDriver.Create(this, _oBody._oActor_Chest._oJointHip, "sex", 1.0f, 1.0f, -0f, 0, -0f, 0f, -0f, 0f));
        _aJoints.Add(_oJointExtremity = CJointDriver.Create(this, _oBody._oActor_Chest._oJointHip,	"pelvis", 15, 8, -025,  025,  010,  015, 1));

        _oHotSpot = CHotSpot.CreateHotspot(this, transform, "Pelvis", true, new Vector3(0, 0, 0), C_SizeHotSpot_BodyNodes);

        _oObj = new CObject(this, _oBody._oBodyBase._nBodyID, typeof(EActorPelvis), "Pelvis", "Pelvis");
        _oObj.PropGroupBegin("", "", true);
        AddBaseActorProperties();						// The first properties of every CActor subclass are Pinned, pos & rot
        _oObj.FinishInitialization();
        _oObj.PropSet(EActorPelvis.Pinned, 1);			// Manually set pinned to 1 on chest so body doesn't float in space when no pose is loaded (Weak that we can't set in PropAdd() due to init-time problems)
    }
Beispiel #45
0
 //---------------------------------------------------------------------------	CREATION HELPERS
 public void WndPopup_Create(CUICanvas oCanvas, CObject[] aObjects, float nX = -1, float nY = -1)
 {
     // Create a popup window capable of end-user editing of the public properties of this object.
     CUtility.WndPopup_Create(oCanvas, EWndPopupType.PropertyEditor, aObjects, _sNameHotspot, nX, nY);
 }
Beispiel #46
0
    public override void OnDeserializeFromBlender()
    {
        base.OnDeserializeFromBlender();

        _sBlenderInstancePath_CCloth = CBCloth.s_sNameClothSrc_HACK;

        //=== Create the skinned-portion of the cloth.  It will be responsible for driving Flex particles that heavily influence their corresponding particles in fully-simulated cloth mesh ===
        _oBSkinBaked_SkinnedPortion = (CBSkinBaked)CBSkinBaked.Create(null, _oBodyBase, "." + _sBlenderInstancePath_CCloth + ".oMeshClothSkinned", typeof(CBSkinBaked));    //###WEAK#13!!! F*****g dot!!
        _oBSkinBaked_SkinnedPortion.transform.SetParent(transform);
        _oBSkinBaked_SkinnedPortion._oSkinMeshRendNow.enabled = false;          // Skinned portion invisible to the user.  Only used to guide simulated portion

        //=== Receive the aMapPinnedParticles array Blender created to map the skinned verts to their pertinent simulated ones ===
        List<ushort> aMapPinnedParticles = CByteArray.GetArray_USHORT("'CBody'", _oBodyBase._sBlenderInstancePath_CBodyBase + "." + _sBlenderInstancePath_CCloth + ".aMapPinnedParticles.Unity_GetBytes()");

        //=== Create the simulated part of the cloth ===
        MeshFilter oMeshFilter = GetComponent<MeshFilter>();
        MeshRenderer oMeshRend = GetComponent<MeshRenderer>();
        //oMeshRend.sharedMaterial = Resources.Load("Materials/BasicColors/TransWhite25") as Material;        //####SOON? Get mats!  ###F
        oMeshRend.sharedMaterial = Resources.Load("Materials/Test-2Sided") as Material;        //####SOON? Get mats!  ###F
        _oBSkinBaked_SkinnedPortion._oSkinMeshRendNow.sharedMaterial = oMeshRend.sharedMaterial;        // Skinned part has same material
        _oMeshNow = oMeshFilter.sharedMesh;
        _oMeshNow.MarkDynamic();                // Docs say "Call this before assigning vertices to get better performance when continually updating mesh"

        //=== Create the 'cloth at startup' mesh.  It won't get simulated and is used to reset simulated cloth to its startup position ===
        _oBMeshClothAtStartup = CBMesh.Create(null, _oBodyBase, "." + _sBlenderInstancePath_CCloth + ".oMeshClothSimulated", typeof(CBMesh));
        _oBMeshClothAtStartup.transform.SetParent(_oBodyBase.FindBone("chestUpper"));      // Reparent this 'backup' mesh to the chest bone so it rotates and moves with the body
        _oBMeshClothAtStartup.GetComponent<MeshRenderer>().enabled = false;
        //_oBMeshClothAtStartup.gameObject.SetActive(false);      // De activate it so it takes no cycle.  It merely exists for backup purposes

        //=== Create the Flex object for our simulated part ===
        CFlex.CreateFlexObject(gameObject, _oMeshNow, _oMeshNow, uFlex.FlexBodyType.Cloth, uFlex.FlexInteractionType.None, CGame.INSTANCE.nMassCloth, Color.yellow);
        uFlex.FlexProcessor oFlexProc = CUtility.FindOrCreateComponent(gameObject, typeof(uFlex.FlexProcessor)) as uFlex.FlexProcessor;
        oFlexProc._oFlexProcessor = this;
        _oFlexParticles = GetComponent<uFlex.FlexParticles>();
        _oFlexSprings   = GetComponent<uFlex.FlexSprings>();

        //=== Create the managing object and related hotspot ===
        _oObj = new CObject(this, 0, typeof(EFlexCloth), "Cloth " + gameObject.name);        //###IMPROVE: Name of soft body to GUI
        _oObj.PropGroupBegin("", "", true);
        _oObj.PropAdd(EFlexCloth.Tightness,     "Tightness",    1.0f, 0.01f, 2.5f, "");
        _oObj.PropAdd(EFlexCloth.Length,        "Length",       1.0f, 0.50f, 1.10f, "");
        _oObj.PropAdd(EFlexCloth.ClothMass,     "Mass",         1.0f, 0.0001f, 1000.0f, "");
        _oObj.FinishInitialization();
        _oWatchBone = _oBodyBase.FindBone("chestUpper");            //####HACK ####DESIGN: Assumes this cloth is a top!
        _oHotSpot = CHotSpot.CreateHotspot(this, _oWatchBone, "Clothing", false, new Vector3(0, 0.22f, 0.04f));     //###IMPROVE!!! Position offset that makes sense for that piece of clothing (from center of its verts?)

        //=== Backup the startup cloth arrays so we can adjust in a non-destructive way ===
        _aSpringRestLengthsBAK = new float[_oFlexSprings.m_springsCount];
        System.Array.Copy(_oFlexSprings.m_springRestLengths, _aSpringRestLengthsBAK, _oFlexSprings.m_springsCount);

        //=== Create the Flex-to-skinned-mesh component responsible to guide selected Flex particles to skinned-mesh positions ===
        _oPinnedParticles = CUtility.FindOrCreateComponent(gameObject, typeof(CPinnedParticles)) as CPinnedParticles;
        _oPinnedParticles.Initialize(ref aMapPinnedParticles, _oBSkinBaked_SkinnedPortion);
    }
Beispiel #47
0
	//Color col1F = CUtility.Color_HSVtoRGB(135, 20, 213); Color32 col1 = new Color32((byte)(255 * col1F.r), (byte)(255 * col1F.g), (byte)(255 * col1F.b), 0);		//###BUG Conversion not working... negative numbers, WTF???
	//Color col2F = CUtility.Color_HSVtoRGB(02, 20, 213); Color32 col2 = new Color32((byte)(255 * col2F.r), (byte)(255 * col2F.g), (byte)(255 * col2F.b), 0);

   // public static Color Color_HSVtoRGB(float h, float s, float v) {		//###LEARN: From http://www.cs.rit.edu/~ncs/color/t_convert.html		
   //     Color calcColour = new Color( 1, 1, 1, 1 );
       
   //     int i = 0;
   //     float f = 0;
   //     float p = 0;
   //     float q = 0;
   //     float t = 0;
       
   //     if ( s == 0 ) {		// achromatic (grey)
   //         calcColour.r = v;
   //         calcColour.g = v;
   //         calcColour.b = v;
   //         return calcColour;
   //     }
       
   //     h /= 60;
   //     i = Mathf.FloorToInt( h );
   //     f = h - i;
   //     p = v * ( 1 - s );
   //     q = v * ( 1 - ( s * f ) );
   //     t = v * ( 1 - ( s * ( 1 - f ) ) );
     
   //     switch( i ) {
   //         case 0 :
   //             calcColour.r = v;
   //             calcColour.g = t;
   //             calcColour.b = p;
			//break;
           
   //         case 1 :
   //             calcColour.r = q;
   //             calcColour.g = v;
   //             calcColour.b = p;
   //         break;
           
   //         case 2 :
   //             calcColour.r = p;
   //             calcColour.g = v;
   //             calcColour.b = t;
   //         break;
           
   //         case 3 :
   //             calcColour.r = p;
   //             calcColour.g = q;
   //             calcColour.b = v;
   //         break;
           
   //         case 4 :
   //             calcColour.r = t;
   //             calcColour.g = p;
   //             calcColour.b = v;
   //         break;
           
   //         default :
   //             calcColour.r = v;
   //             calcColour.g = p;
   //             calcColour.b = q;
   //         break;
   //     }
       
   //     return calcColour;
   // }
     
   // public static Vector3 Color_RGBtoHSV(float r, float g, float b) {
   //     Vector3 calcColour = new Vector3( 0, 1, 0 ); // H, S, V
       
   //     float min = 0;
   //     float max = 0;
   //     float delta = 0;
       
   //     min = Mathf.Min( r, g, b );
   //     max = Mathf.Max( r, g, b );
   //     calcColour.z = max; // V
       
   //     delta = max - min;
       
   //     if ( max != 0 ) {
   //         calcColour.y = delta / max; // S
   //     } else {
   //         calcColour.y = 0; // S		// r = g = b = 0
   //         calcColour.x = -1; // H
   //         return calcColour;
   //     }
       
   //     if ( r == max )
   //         calcColour.x = ( g - b ) / delta; // H
   //     else if ( g == max )
   //         calcColour.x = 2 + ( ( b - r ) / delta ); // H
   //     else
   //         calcColour.x = 4 + ( ( r - g ) / delta ); // H
       
   //     calcColour.x *= 60; // H
   //     if ( calcColour.x < 0 )
   //         calcColour.x += 360;
   //     return calcColour;
   // }
    #endregion
	
    #region === UI ===
    public static void WndPopup_Create(CUICanvas oCanvas, EWndPopupType eWndPopupType, CObject[] aObjects, string sNamePopup, float nX = -1, float nY = -1) {
        //=== Construct the dialog's content dependent on what type of dialog it is ===
        CUIPanel oPanel = CUIPanel.Create(oCanvas);           //####DESIGN!  ####SOON ####CLEANUP?
        int nRows = 0;
        int nPropGrps = 0;
        foreach (CObject oObj in aObjects) {
            foreach (CPropGroup oPropGrp in oObj._aPropGroups) {   //###BUG!: Inserts one extra!  Why??
                oPropGrp._oUIPanel = oPanel;                    //####IMPROVE ####MOVE??
                //////////oPropGrp.CreateWidget(oListBoxContent);
                foreach (int nPropID in oPropGrp._aPropIDs) {
                    CProp oProp = oObj.PropFind(nPropID);
                    nRows += oProp.CreateWidget(oPropGrp);
                }
                nPropGrps++;
            }
        }
        //oCanvas.transform.position = CGame.INSTANCE._oCursor.transform.position;
        //oCanvas.transform.rotation = Camera.main.transform.rotation;
    }