Ejemplo n.º 1
0
        private void MessageReceiver_FMD_S_JOINED_MISSION(ClientConnection client, AllegianceInterop.FMD_S_JOINED_MISSION message)
        {
            Log("MessageReceiver_FMD_S_JOINED_MISSION");

            if (message.shipID == _shipID)
            {
                //// wait for target side to become active before joining.
                //Task.Run(() =>
                //{
                //    if (ClientConnection.GetCore() == null || ClientConnection.GetCore().GetSide(SideIndex) == null || ClientConnection.GetCore().GetSide(SideIndex).GetActiveF() == false)
                //    {
                //        Log($"\tWaiting 30 seconds for side {SideIndex} to become ready.");

                //        for (int i = 0; i < 30 * 100; i++)
                //        {
                //            if (ClientConnection.GetCore().GetSide(SideIndex).GetActiveF() == true)
                //                break;

                //            Thread.Sleep(100);
                //        }

                //        Log($"\tDone waiting, side {SideIndex} current ActiveF status is {ClientConnection.GetCore().GetSide(SideIndex).GetActiveF()}");
                //    }

                //    Log("\tSending side join (POSIITON) request.");
                //    AllegianceInterop.FMD_C_POSITIONREQ positionReq = new AllegianceInterop.FMD_C_POSITIONREQ(SideIndex);
                //    client.SendMessageServer(positionReq);

                //});

                Log("\tSending side join (POSIITON) request.");
                AllegianceInterop.FMD_C_POSITIONREQ positionReq = new AllegianceInterop.FMD_C_POSITIONREQ(SideIndex);
                client.SendMessageServer(positionReq);
            }
        }
Ejemplo n.º 2
0
 private void MessageReceiver_FMD_S_JOINED_MISSION(ClientConnection client, AllegianceInterop.FMD_S_JOINED_MISSION message)
 {
     if (message.shipID == _shipID)
     {
         AllegianceInterop.FMD_C_POSITIONREQ positionReq = new AllegianceInterop.FMD_C_POSITIONREQ(SideIndex);
         client.SendMessageServer(positionReq);
     }
 }
Ejemplo n.º 3
0
        private void MessageReceiver_FMD_CS_QUIT_SIDE(ClientConnection client, AllegianceInterop.FMD_CS_QUIT_SIDE message)
        {
            if (String.IsNullOrWhiteSpace(message.szMessageParam) == false && message.shipID == _shipID)
            {
                Log($"Player was removed from side: {message.szMessageParam}, moving back to sideIndex: {SideIndex}.");

                AllegianceInterop.FMD_C_POSITIONREQ joinSide = new AllegianceInterop.FMD_C_POSITIONREQ(SideIndex);
                client.SendMessageServer(joinSide);
            }
        }
Ejemplo n.º 4
0
        private void MessageReceiver_FMD_S_JOIN_SIDE(ClientConnection client, AllegianceInterop.FMD_S_JOIN_SIDE message)
        {
            AllegianceInterop.FMD_S_PLAYERINFO playerInfo;
            if (_shipID == message.shipID)
            {
                Log($"Player joined side {message.sideID}");

                //playerInfo.iSide = message.sideID;

                if (message.sideID != SideIndex)
                {
                    AllegianceInterop.FMD_C_POSITIONREQ positionRequest = new AllegianceInterop.FMD_C_POSITIONREQ(SideIndex);
                    client.SendMessageServer(positionRequest);
                }
                else
                {
                    if (IsCommander == true)
                    {
                        AllegianceInterop.FMD_CS_SET_TEAM_LEADER setTeamLeader = new AllegianceInterop.FMD_CS_SET_TEAM_LEADER(message.sideID, message.shipID);
                        client.SendMessageServer(setTeamLeader);
                    }

                    if (IsGameController == true)
                    {
                        AllegianceInterop.FMD_CS_SET_MISSION_OWNER setMissionOwner = new AllegianceInterop.FMD_CS_SET_MISSION_OWNER(message.sideID, message.shipID);
                        client.SendMessageServer(setMissionOwner);
                    }
                }
            }

            //if (_playerInfoByShipID.ContainsKey(message.shipID) == true)
            //{
            //    // If we receive an update for our player, and our player is the game controller and was not already on the team they are joining, then reset the game parameters.
            //    //if (_isGameController == true && _playerInfoByShipID[message.shipID].CharacterName == _playerName && _playerInfoByShipID[message.shipID].iSide != message.sideID && message.sideID >= 0)
            //    //    ResetGameParameters(client);

            //    _playerInfoByShipID[message.shipID].iSide = message.sideID;
            //}
        }