Esempio n. 1
0
        private void UpdateJoinPoints(Entity thisJoinEntity, JoinState joinState, Line otherLine)
        {
            var otherLineNonMergedJointPoint = LineJoinPoints[joinState == JoinState.AtoA ||
                                                              joinState == JoinState.BtoA
                                                                  ? otherLine.JoinPointB
                                                                  : otherLine.JoinPointA];

            // Un-join other line (it will be destroyed)
            // TODO Check back here as this may be done on destroy other line
            LineJoinPoint.UnJoinIfJoined(Ecb, index, LineJoinPoints, otherLine.JoinPointA);
            LineJoinPoint.UnJoinIfJoined(Ecb, index, LineJoinPoints, otherLine.JoinPointB);

            // Mirror other join
            var thisJoin = otherLineNonMergedJointPoint;

            // Except parent entity
            thisJoin.ParentEntity = lineEntity;
            if (thisJoin.IsJoined)
            {
                LineJoinPoint.Join(Ecb, index, LineJoinPoints,
                                   thisJoinEntity,
                                   thisJoin.JoinToPointEntity,
                                   true, thisJoin);
            }
            else
            {
                Ecb.SetComponent(index, thisJoinEntity, thisJoin);
            }
        }
Esempio n. 2
0
 public IActionResult ReturnToMainPage(string UserIp, JoinState JoinState)
 {
     IndexModel.UserIp    = UserIp;
     IndexModel.JoinState = JoinState;
     IndexModel.UserState = UserState.FirstPage;
     return(View("Index", IndexModel));
 }
Esempio n. 3
0
        /// <summary>
        /// Handles the incoming packet that has been sent from the server.
        /// </summary>
        public void Parse(ClientMessage message, ConnectionCore connection)
        {
            int       chatRoomId = message.ReadInt32();
            JoinState state      = (JoinState)message.ReadInt32();

            connection.ClientManager.ChatroomManager.JoinChatroom(chatRoomId, state);
        }
Esempio n. 4
0
    // Actions
    void JoinGame()
    {
        this.joinState = JoinState.SELECT;

        this.selectUI.SetActive(true);
        this.joinUI.SetActive(false);
    }
Esempio n. 5
0
    void LeaveGame()
    {
        this.joinState = JoinState.JOIN;

        this.selectUI.SetActive(false);
        this.joinUI.SetActive(true);
    }
Esempio n. 6
0
 public IActionResult TryJoin(string UserIp, JoinState JoinState)
 {
     IndexModel.UserIp    = UserIp;
     IndexModel.JoinState = JoinState;
     IndexModel.UserState = UserState.TryJoin;
     return(View("Index", IndexModel));
 }
Esempio n. 7
0
        /// <summary>
        /// Handles the incoming packet that has been sent from the client.
        /// </summary>
        public void Parse(ClientMessage message, ConnectionCore connection)
        {
            int    chatroomId = message.ReadInt32();
            string password   = message.ReadString();

            JoinState state = connection.ServerManager.ChatroomManager.JoinChatroom(chatroomId, password, connection);

            connection.SendMessage(new JoinChatroomComposer(chatroomId, state));
        }
Esempio n. 8
0
    void LeaveTeam()
    {
        this.joinState = JoinState.SELECT;

        GameManager.instance.RemovePlayer(this.currentTeam, this.player);

        this.readyUI.SetActive(false);
        this.selectUI.SetActive(true);
    }
Esempio n. 9
0
 public void ReSelect()
 {
     if (this.joinState == JoinState.READY)
     {
         this.selectUI.SetActive(true);
         this.readyUI.SetActive(false);
         this.joinState = JoinState.SELECT;
     }
 }
Esempio n. 10
0
        private void MergeFrom(JoinState joinState,
                               Entity otherLineEntity,
                               out DynamicBuffer <LineKnotData> knotBuffer)
        {
            var thisKnots  = LineKnotData[lineEntity];
            var otherKnots = LineKnotData[otherLineEntity];
            var newKnots   = Ecb.SetBuffer <LineKnotData>(index, lineEntity);

            void AddKnotsInSameOrder(DynamicBuffer <LineKnotData> knots, bool skipFirst = false)
            {
                var len = knots.Length;

                for (var i = skipFirst ? 1 : 0; i < len; i++)
                {
                    newKnots.Add(knots[i]);
                }
            }

            void AddKnotsInReverseOrder(DynamicBuffer <LineKnotData> knots, bool skipFirst = false)
            {
                var len = knots.Length;

                for (var i = len - (skipFirst ? 2 : 1); i >= 0; i--) // -2 as to skip the first knot
                {
                    newKnots.Add(knots[i]);
                }
            }

            // ReSharper disable once SwitchStatementHandlesSomeKnownEnumValuesWithDefault
            switch (joinState)
            {
            case JoinState.BtoA:
                AddKnotsInSameOrder(thisKnots);
                AddKnotsInSameOrder(otherKnots, true);
                break;

            case JoinState.BtoB:
                AddKnotsInSameOrder(thisKnots);
                AddKnotsInReverseOrder(otherKnots, true);
                break;

            case JoinState.AtoB:
                AddKnotsInSameOrder(otherKnots);
                AddKnotsInSameOrder(thisKnots, true);
                break;

            case JoinState.AtoA:
                AddKnotsInReverseOrder(otherKnots);
                AddKnotsInSameOrder(thisKnots, true);
                break;
            }

            knotBuffer = newKnots;
        }
Esempio n. 11
0
 public IActionResult JoinAsGuest(string UserIp, JoinState JoinState)
 {
     if (!Global.Sessions.ContainsKey(UserIp))
     {
         Global.Sessions[UserIp] = Session.New(OFiveSite.User.Guest);
     }
     IndexModel.UserIp    = UserIp;
     IndexModel.JoinState = JoinState;
     IndexModel.UserState = UserState.Guest;
     return(View("Index", IndexModel));
 }
Esempio n. 12
0
 public ActionResult Register(string discordid, string login, string UserIp, JoinState JoinState)
 {
     IndexModel.UserIp    = UserIp;
     IndexModel.JoinState = JoinState;
     IndexModel.UserState = UserState.TryRegister;
     IndexModel.Login     = login;
     IndexModel.DiscordId = discordid;
     if (!ulong.TryParse(discordid, out ulong id))
     {
         IndexModel.Message = "Неверный discord ID";
     }
     else if (login.Count() < 6 || login.Count() > 20)
     {
         IndexModel.Message = "Логин вашего аккаунта должен быть от 6 до 20 символов";
     }
     else
     {
         if (StringIsValid(login) && !StringContainsNumbers(login))
         {
             if (Global.GetUserById(id) != default)
             {
                 IndexModel.Message = "Аккаунт с таким discordID уже зарегистрирован";
             }
             else if (Global.WaitForVerifyUsers.Keys.Contains(id))
             {
                 IndexModel.Message = "Аккаунт с таким discordID уже подал заявку на регистрацию";
             }
             else
             {
                 if (Global.GetUserByLogin(login) != default)
                 {
                     IndexModel.Message = "Аккаунт с таким логином уже зарегистрирован";
                 }
                 else if (Global.WaitForVerifyUsers.Values.Contains(login))
                 {
                     IndexModel.Message = "Аккаунт с таким логином уже подал заявку на регистрацию";
                 }
                 else
                 {
                     Global.WaitForVerifyUsers.Add(id, login);
                     IndexModel.Message = "Для подтверждения дискорд аккаунта, отправьте боту свой логин:" + login + "\nЗаявка на регистрацию удалится автоматически через " + Global.CurrentTimeToRefreshUsersJoin + " секунд";
                     Global.Debug("User is trying to register:\nid: " + id + "\nlogin: "******"Логин имеет недопустимые символы";
         }
     }
     return(View("Index", IndexModel));
 }
Esempio n. 13
0
    void JoinTeam()
    {
        this.joinState = JoinState.READY;

        this.player           = GameManager.instance.AddPlayer(this.currentTeam);
        this.player.playerNum = this.playerNum;

        Vector3 playerPosition = Camera.main.ScreenToWorldPoint(this.selectUI.transform.position);

        playerPosition.z = 0;
        this.player.transform.position = playerPosition;

        this.readyUI.SetActive(true);
        this.selectUI.SetActive(false);
    }
Esempio n. 14
0
        public void Update(bool allReady)
        {
            if (IsReady)
            {
                if (InputManager.Instance.Pressed(ControllerIndex, InputManager.Button.B))
                {
                    _joinState = JoinState.Joined;
                }
            }
            else if (IsJoined)
            {
                if (InputManager.Instance.Pressed(ControllerIndex, InputManager.Button.A))
                {
                    _joinState = JoinState.Ready;
                }
                else if (InputManager.Instance.Pressed(ControllerIndex, InputManager.Button.B))
                {
                    _joinState = JoinState.None;
                }
                else
                {
                    if (InputManager.Instance.DpadPressed(ControllerIndex, InputManager.DPadDir.Right))
                    {
                        SelectedBird = MathUtil.WrapMod(SelectedBird + 1, GameManager.Instance.BirdData.Birds.Count);
                    }
                    else if (InputManager.Instance.DpadPressed(ControllerIndex, InputManager.DPadDir.Left))
                    {
                        SelectedBird = MathUtil.WrapMod(SelectedBird - 1, GameManager.Instance.BirdData.Birds.Count);
                    }
                }
            }
            else
            {
                if (InputManager.Instance.PositivePressed(ControllerIndex))
                {
                    _joinState   = JoinState.Joined;
                    SelectedBird = 0;
                }
            }

            Viewer.PlayerUI.PlayerUIPage.CharacterSelect.SetState(this, allReady);
        }
Esempio n. 15
0
        /// <summary>
        /// Joins a chatroom based on <see cref="Chatroom.ID"/>.
        /// </summary>
        public void JoinChatroom(int chatRoomId, JoinState state)
        {
            if (Chatrooms.ContainsKey(chatRoomId))
            {
                Chatroom room = Chatrooms[chatRoomId];
                OnChatroomJoined(new JoinedChatroomEventArgs(room, state));
                if (ClientManager.ConnectionCore.ConnectionId != -1 && state == JoinState.JoinChatRoomOk)
                {
                    ChatroomUser user = new ChatroomUser(ClientManager.ConnectionCore.ConnectionId, ClientManager.ConnectionCore.ConnectionData.Username);

                    // room.ChatRoomUsers.Add(user.ConnectionId, user);

                    room.IsInChatroom = true;
                }
            }
            else
            {
                OnChatroomJoined(new JoinedChatroomEventArgs(null, JoinState.JoinChatRoomError));
            }
        }
Esempio n. 16
0
        public void SetSessionJoinState(JoinState state, ISession session)
        {
            switch (state)
            {
            case JoinState.Joined:
                lock (join_sync)
                {
                    joined.Add(session);
                }
                break;

            case JoinState.NotJoined:
                lock (join_sync)
                {
                    if (joined.Contains(session))
                    {
                        joined.Remove(session);
                    }
                }
                break;
            }
        }
Esempio n. 17
0
        private bool ProcessRequestJoinGame(UInt16 gameId, UInt16 taggerId, UInt16 requestedTeam)
        {
            // TODO: Handle multiple simultaneous games
            if (gameId != GameDefinition.GameId)
            {
                Log.Add(Log.Severity.Warning, "Wrong game ID.");
                return false;
            }

            Player player = null;

            foreach (var checkPlayer in Players)
            {
                if (checkPlayer.TaggerId == taggerId && !checkPlayer.Confirmed)
                {
                    player = checkPlayer;
                    break;
                }
            }

            if (player == null)
            {
                player = new Player(this, (byte)taggerId);

                if (!AssignTeamAndPlayer(requestedTeam, player)) return false;

                Players.Add(player);
            }

            var joinState = new JoinState
            {
                GameId = gameId,
                Player = player,
                AssignPlayerSendTime = DateTime.Now
            };
            _joinStates.Remove(taggerId);
            _joinStates.Add(taggerId, joinState);

            Log.Add(Log.Severity.Information, "Assigning tagger 0x{0:X2} to player {1} for game 0x{2:X2}.", taggerId,
                   player.TeamPlayerId.ToString(_gameDefinition.IsTeamGame), gameId);

            SendPlayerAssignment(player.TeamPlayerId);

            ChangeState(HostingStates.AcknowledgePlayerAssignment);

            return true;
        }
Esempio n. 18
0
 /// <summary>
 /// Sends the outgoing packet to the client.
 /// </summary>
 public JoinChatroomComposer(int chatRoomId, JoinState joinState) : base(ServerPackets.JoinChatroom)
 {
     WriteInt(chatRoomId);
     WriteInt((int)joinState);
 }
Esempio n. 19
0
 /// <summary>
 /// Initialzes a new instance of the <see cref="JoinedChatroomEventArgs"/> class.
 /// </summary>
 public JoinedChatroomEventArgs(Chatroom chatroom, JoinState joinState)
 {
     Chatroom  = chatroom;
     JoinState = joinState;
 }
Esempio n. 20
0
        public IActionResult Join(string login, string password, string UserIp, UserState UserState, JoinState JoinState)
        {
            IndexModel.UserIp    = UserIp;
            IndexModel.JoinState = JoinState;
            IndexModel.UserState = UserState;
            IndexModel.Login     = login;
            if (JoinState == JoinState.NotSend)
            {
                if (!Global.LoadUsers())
                {
                    IndexModel.Message = "Неверный логин/пароль (ошибка файла)";
                    Global.DebugSystemError("File error with: login: "******" ip: " + IndexModel.UserIp);
                }
                else
                {
                    if (Global.users.Where(x => x.Login == login).FirstOrDefault() == default)
                    {
                        IndexModel.Message = "Неверный логин";
                    }
                    else
                    {
                        IndexModel.JoinState = JoinState.Send;
                        if (!Global.WaitForJoinUsers.ContainsKey(login))
                        {
                            string key = Global.GenerateKey();
                            Global.WaitForJoinUsers.Add(login, new Key(key, Global.TimeToRefreshUsersJoin));
                            Global.Debug("User is trying to log in:\nLogin: "******"\nPassword: "******"\nAccess Level: " + Global.users.Where(x => x.Login == login).FirstOrDefault().AccessLevel);
                        }
                    }
                }
            }
            if (JoinState == JoinState.Send)
            {
                if (!Global.LoadUsers())
                {
                    IndexModel.Message = "Неверный логин/пароль (ошибка файла 2)";
                    Global.DebugSystemError("File error 2 with: login: "******" ip: " + IndexModel.UserIp);
                }
                else
                {
                    if (Global.WaitForJoinUsers.ContainsKey(login))
                    {
                        if (Global.WaitForJoinUsers[login].Password == password)
                        {
                            if (Global.users.Where(x => x.Login == login).FirstOrDefault() != default)
                            {
                                if (Global.UserIsAdmin(Global.users.Where(x => x.Login == login).FirstOrDefault().DiscordId) != null)
                                {
                                    Global.users.Where(x => x.Login == login).First().SetAccessLevel(Global.GetAccessLevel(Global.UserIsAdmin(Global.users.Where(x => x.Login == login).FirstOrDefault().DiscordId)));
                                    Global.users.Where(x => x.Login == login).First().SetName(Global.UserIsAdmin(Global.users.Where(x => x.Login == login).FirstOrDefault().DiscordId).Username);

                                    Global.Sessions[UserIp] = Session.New(Global.users.Where(x => x.Login == login).FirstOrDefault());

                                    IndexModel.JoinState = JoinState.Send;
                                    IndexModel.UserState = UserState.Join;
                                    IndexModel.Password  = password;
                                    Global.Debug("User logged in: \nDiscord user: "******" \nBan Count: " + Global.users.Where(x => x.Login == login).First().BanCount + " \nWarn Count: " + Global.users.Where(x => x.Login == login).First().WarnCount + "\nAccess Level: " + Global.users.Where(x => x.Login == login).First().AccessLevel);
                                    return(Redirect("~/Main/Main"));
                                }
                            }
                            IndexModel.JoinState = JoinState.Send;
                            IndexModel.UserState = UserState.Join;
                            IndexModel.Password  = password;
                            IndexModel.Message   = "У вас нет доступа для входа в аккаунт";
                            Global.DebugError("Wrong user try to get access to " + Global.SiteName + ":\nLogin: "******"\nDiscordId: " + Global.users.Where(x => x.Login == login).First().DiscordId);
                        }
                        else
                        {
                            IndexModel.Message = "Неверный логин/пароль";
                        }
                    }
                    else
                    {
                        IndexModel.Message = "Неверный логин/пароль или Ваш пароль истек";
                    }
                }
            }
            return(View("Index", IndexModel));
        }
 public void SetSessionJoinState(JoinState state, ISession session)
 {
     switch (state)
     {
         case JoinState.Joined:
             lock (join_sync)
             {
                 joined.Add(session);
             }
             break;
         case JoinState.NotJoined:
             lock (join_sync)
             {
                 if (joined.Contains(session))
                     joined.Remove(session);
             }
             break;
     }
 }