Пример #1
0
    public void CurePlayerByColor(string color)
    {
        PlayersInfo aux = null;

        foreach (PlayersInfo player in playerList)
        {
            if (player.color.Equals(color))
            {
                aux = player;
                break;
            }
        }

        //Se o player da cor selecionada estiver infectado então cure
        if (!aux.healthStatus)
        {
            foreach (PlayerColor pColor in playersColor)
            {
                if (pColor.colorName.Equals(aux.color))
                {
                    aux.healthStatus = true;
                    aux.player.GetComponentInChildren <Image>().sprite = pColor.healthyImage;
                    break;
                }
            }

            //A checagem é importante para esse decremente e incremento
            HealthyPlayersCount++;
            SickPlayersCount--;
        }
    }
        private void Awake()
        {
            if (Instance == null)
            {
                Instance = this;
            }
            else if (Instance != this)
            {
                Destroy(gameObject);
            }
            DontDestroyOnLoad(Instance);


            GameObject go = GameObject.Find("Players");                                         // Added DKE

            if (go != null)                                                                     // Added DKE
            {                                                                                   // Added DKE
                playersInfo = go.GetComponent <PlayersInfo>();                                  // Added DKE
                if (playersInfo == null)                                                        // Added DKE
                {
                    Debug.LogError("GameManager: No PlayersInfo component in Scene");           // Added DKE
                }
                else
                {
                    WriteString("PlayersInfo found");                                           // Added DKE
                }
            }                                                                                   // Added DKE
            else
            {
                Debug.LogError("GameManager: No Players Object in Scene");                      // Added DKE
            }
            // Add all potential start positions in a list
            startPositions = new List <StartPosition>();                                                                                                         // Added DKE
            SceneManager.GetActiveScene().GetRootGameObjects().ToList().ForEach(g => startPositions.AddRange(g.GetComponentsInChildren <StartPosition>()));      // Added DKE
        }
Пример #3
0
    public void InfectPlayerByColor(string color)
    {
        PlayersInfo aux = null;

        foreach (PlayersInfo player in playerList)
        {
            if (player.color.Equals(color))
            {
                aux = player;
                break;
            }
        }

        //Se o player da cor estiver saudavel então infecte
        if (aux.healthStatus)
        {
            foreach (PlayerColor pColor in playersColor)
            {
                if (pColor.colorName.Equals(aux.color))
                {
                    aux.healthStatus = false;
                    aux.player.GetComponentInChildren <Image>().sprite = pColor.sickImage;
                    break;
                }
            }

            //A checagem é importante para esse decremente e incremento
            HealthyPlayersCount--;
            SickPlayersCount++;
        }
    }
Пример #4
0
    void Awake()
    {
        Physics.IgnoreLayerCollision(LayerMask.NameToLayer(THROWABLE), LayerMask.NameToLayer(THROWABLE), true);

        PlayersInfo.Player one;
        one.gamepad = GamepadInput.GamePad.Index.One;
        one.player  = Players.PlayerOne;

        PlayersInfo.addPlayer(one);

        PlayersInfo.Player two;
        two.gamepad = GamepadInput.GamePad.Index.Two;
        two.player  = Players.PlayerTwo;

        PlayersInfo.addPlayer(two);


        PlayersInfo.Player three;
        three.gamepad = GamepadInput.GamePad.Index.Three;
        three.player  = Players.PlayerThree;

        PlayersInfo.addPlayer(three);

        PlayersInfo.Player four;
        four.gamepad = GamepadInput.GamePad.Index.Four;
        four.player  = Players.PlayerFour;

        PlayersInfo.addPlayer(four);
    }
Пример #5
0
    // Use this for initialization
    void Start()
    {
        GameObject go = new GameObject("Players");

        players = go.AddComponent <PlayersInfo>();

        DontDestroyOnLoad(players);
    }
Пример #6
0
    //Retornar um player para adicionar na lista do script do modo e remover deste script para nao ocorrer repetição de player, chamado pelos scripts EndlessPlayersList e ChallengerPlayersList
    public PlayersInfo GetPlayer(int number)
    {
        PlayersInfo player = PlayerList[number];

        PlayerList.RemoveAt(number);
        PlayersCount--;
        return(player);
    }
        private void SavePlayers()
        {
            var saveData = new List <Player>();

            PlayersInfo.ToList().ForEach(x => saveData.Add(x));
            _playersInfoManager.FlushContents();
            _playersInfoManager.SavePlayers(saveData);
        }
Пример #8
0
Файл: Peer.cs Проект: kuviman/Q
        void SendPlayersInfo()
        {
            var info = new PlayersInfo();

            foreach (var conn in connections)
            {
                info.players.Add(conn.Key);
            }
            SendToAll(info, DeliveryMethod.Reliable);
        }
Пример #9
0
 public void SignUp(PlayersInfo playersInfo)
 {
     if (playersInfo.Birthday < 1993 && playersInfo.IdentityNo.Length == 1234)
     {
         Console.WriteLine(playersInfo.Name + " " + playersInfo.Surname + " Doğrulama İşlemi Başarılı.Kayıt Olunduz.");
     }
     else
     {
         Console.WriteLine("Malesef Doğrulama Yapılamadı. Kayıt Başarısız");
     }
 }
Пример #10
0
    protected override void DecodeMessage(string topic, byte[] message)
    {
        string msg = System.Text.Encoding.UTF8.GetString(message);

        //Debug.Log("Received: " + msg);
        StoreMessage(msg);
        PlayersInfo players = JsonConvert.DeserializeObject <PlayersInfo>(msg);

        if (players.playerID == 3 && players.action == "g")
        {
            startButton.StartGame();
        }
    }
        private void AddPlayer(string name, string gender, string grade, string pos)
        {
            var player = new Player
            {
                PlayerName = name,
                Gender     = gender,
                Grade      = grade,
                Position   = pos
            };

            PlayersInfo.Add(player);

            //_playersInfoManager.AddPlayer(player);
        }
Пример #12
0
    public static Players[] getStart()
    {
        playersWhoUsedInput.Clear();

        for (int i = 0; i < (int)Players.count; i++)
        {
            if (GamepadInput.GamePad.GetButton(GamepadInput.GamePad.Button.Start, PlayersInfo.getGamepad((Players)i)))
            {
                playersWhoUsedInput.Add((Players)i);
            }
        }

        return(playersWhoUsedInput.ToArray());
    }
Пример #13
0
    //Método para filtrar apenas players em uma única condição de saúde
    public List <PlayersInfo> GetSpecificPlayers(bool healthStatus)
    {
        List <PlayersInfo> specificPlayers = new List <PlayersInfo>();

        foreach (PlayersInfo player in playerList)
        {
            if (player.healthStatus == healthStatus)
            {
                PlayersInfo selectedPlayer = new PlayersInfo(player.name, player.color, player.healthStatus);
                specificPlayers.Add(selectedPlayer);
            }
        }

        return(specificPlayers);
    }
Пример #14
0
    /// <summary>
    /// 接收服务器的创建房间请求返回消息,并更新创建的房间里面的数据
    /// </summary>
    /// <param name="msg">服务器返回的创建的房间消息</param>
    private void CreateRoomHandle(object msg)
    {
        //关闭房间列表
        roomsView.rooms.SetActive(false);
        //显示创建的房间
        roomView.room_boot.SetActive(true);
        //清空信息
        PlayersInfo playersInfo = roomView.room.GetComponent <PlayersInfo>();

        playersInfo.name_Yang.text = "";
        playersInfo.camp_Yang.text = "";
        playersInfo.name_Yin.text  = "";
        playersInfo.camp_Yin.text  = "";
        var         room    = msg as mmopb.createRoom_ack;
        PlayersInfo players = roomView.room.GetComponent <PlayersInfo>();

        players.name_Yang.text = room.nickName;
        if (room.camp == 1)
        {
            players.camp_Yang.text = "阳";
        }
    }
Пример #15
0
    protected override void DecodeMessage(string topic, byte[] message)
    {
        string msg = System.Text.Encoding.UTF8.GetString(message);

        //Debug.Log("Received: " + msg);
        StoreMessage(msg);
        PlayersInfo players = JsonConvert.DeserializeObject <PlayersInfo>(msg);

        if (players.playerID == 1)
        {
            receivedMsg1 = true;
            action1      = players.action;
        }
        if (players.playerID == 2)
        {
            receivedMsg2 = true;
            action2      = players.action;
        }
        if (players.playerID == 3 && players.action == "p" && !EndGame.gameOver) // pause/resume
        {
            Pause.isPaused = !Pause.isPaused;
            pauseObject.PauseGame();
        }
        else if (players.playerID == 3 && players.action == "q") // quit
        {
            SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex - 1);
        }
        else if (players.playerID == 3 && !Pause.isPaused && !EndGame.gameOver) // speech from player 3
        {
            receivedMsg3 = true;
            action3      = players.action;
        }
        else if (players.playerID == 3 && players.action == "r" && EndGame.gameOver)  // restart
        {
            SceneManager.LoadScene("Boxing");
        }
    }
Пример #16
0
    /// <summary>
    /// 进入房间时接收服务器返回的房间玩家信息
    /// </summary>
    /// <param name="msg">服务器返回的房间玩家信息</param>
    private void RoleInfoInRoomHandle(object msg)
    {
        //清空信息
        PlayersInfo playersInfo = roomView.room.GetComponent <PlayersInfo>();

        playersInfo.name_Yang.text = "";
        playersInfo.camp_Yang.text = "";
        playersInfo.name_Yin.text  = "";
        playersInfo.camp_Yin.text  = "";
        var players = msg as mmopb.roleInfoInRoom_bcst;
        Dictionary <Int32, mmopb.p_roleInfoInRoom> playerList = players.roleInfoInRoomList;

        foreach (KeyValuePair <Int32, mmopb.p_roleInfoInRoom> player in playerList)
        {
            if (player.Value.camp == 1)
            {
                playersInfo.name_Yang.text = player.Value.nickName;
                playersInfo.camp_Yang.text = "阳";
            }
            else
            {
                playersInfo.name_Yin.text = player.Value.nickName;
                playersInfo.camp_Yin.text = "阴";
            }

            if (player.Value.isOwner && player.Value.nickName == LocalUser.Instance.User_nickname)
            {
                startGame.SetActive(true);
            }
            else if (!player.Value.isOwner && player.Value.nickName == LocalUser.Instance.User_nickname)
            {
                startGame.SetActive(false);
            }
        }
        LocalUser.Instance.Camp = playerList[LocalUser.Instance.PlayerId].camp;
    }
Пример #17
0
 public static bool getThrowDown(Players player)
 {
     return(GamepadInput.GamePad.GetButtonDown(GamepadInput.GamePad.Button.X, PlayersInfo.getGamepad(player)));
 }
Пример #18
0
 public static bool getSwitchLeft(Players player)
 {
     return(GamepadInput.GamePad.GetButton(GamepadInput.GamePad.Button.LeftShoulder, PlayersInfo.getGamepad(player)));
 }
Пример #19
0
    //==============================================================================================

    public static bool getJump(Players player)
    {
        return(GamepadInput.GamePad.GetButton(GamepadInput.GamePad.Button.A, PlayersInfo.getGamepad(player)));
    }
Пример #20
0
 public static bool getDashUp(Players player)
 {
     return(GamepadInput.GamePad.GetButtonUp(GamepadInput.GamePad.Button.RightShoulder, PlayersInfo.getGamepad(player)));
 }
Пример #21
0
    //==============================================================================================

    public static Vector2 getLeftStick(Players player)
    {
        return(GamepadInput.GamePad.GetAxis(GamepadInput.GamePad.Axis.LeftStick, PlayersInfo.getGamepad(player)));
    }
Пример #22
0
    // Use this for initialization
    public void Start()
    {
        //邀请显示
        if (InviteInfo.Instance.IsAgreeInvite)
        {
            roomsView.rooms.SetActive(false);
            roomView.room_boot.SetActive(true);
            //清空信息
            PlayersInfo playersInfo = roomView.room.GetComponent <PlayersInfo>();
            playersInfo.name_Yang.text = "";
            playersInfo.camp_Yang.text = "";
            playersInfo.name_Yin.text  = "";
            playersInfo.camp_Yin.text  = "";
            Dictionary <Int32, mmopb.p_roleInfoInRoom> playerList = InviteInfo.Instance.PlayerList;
            foreach (KeyValuePair <Int32, mmopb.p_roleInfoInRoom> player in playerList)
            {
                if (player.Value.camp == 1)
                {
                    playersInfo.name_Yang.text = player.Value.nickName;
                    playersInfo.camp_Yang.text = "阳";
                }
                else
                {
                    playersInfo.name_Yin.text = player.Value.nickName;
                    playersInfo.camp_Yin.text = "阴";
                }
            }
            LocalUser.Instance.Camp           = playerList[LocalUser.Instance.PlayerId].camp;
            InviteInfo.Instance.IsAgreeInvite = false;
        }

        //进入时请求房间列表数据
        var rooms_req = new mmopb.roomList_req();

        ClientNet.Instance.Send(ProtoHelper.EncodeWithName(rooms_req));

        //音量设置
        GameObject  canvas      = GameObject.Find("Canvas");
        AudioSource audioSource = canvas.GetComponent <AudioSource>();

        audioSource.volume = LocalUser.Instance.Voice;
        audioSource.mute   = LocalUser.Instance.IsMute;

        //事件
        UIDispacher.Instance.AddEventListener("Return", OnClickBtnReturn);
        UIDispacher.Instance.AddEventListener("Refresh", OnClickBtnRefresh);
        UIDispacher.Instance.AddEventListener("CreateRoom", OnClickBtnCreateRoom);
        UIDispacher.Instance.AddEventListener("Join", OnClickBtnJoin);
        UIDispacher.Instance.AddEventListener("StartGame", OnClickBtnStartGame);
        UIDispacher.Instance.AddEventListener("QuitRoom", OnClickBtnQuitRoom);
        UIDispacher.Instance.AddEventListener("InviteFriend", OnClickBtnInviteFriend);
        UIDispacher.Instance.AddEventListener("SendMessage", OnClickBtnSendMessage);
        UIDispacher.Instance.AddEventListener("CloseInviteFriends", OnClickBtnCloseInviteFriends);
        UIDispacher.Instance.AddEventListener("ClickInviteTargetFriend", ClickInviteTargetFriend);
        UIDispacher.Instance.AddEventListener("ClickYesNewInvite", ClickYesNewInvite);
        UIDispacher.Instance.AddEventListener("ClickNoNewInvite", ClickNoNewInvite);

        NetDispacher.Instance.AddEventListener("roomList_ack", LoadRoomsHandle);
        NetDispacher.Instance.AddEventListener("createRoom_ack", CreateRoomHandle);
        NetDispacher.Instance.AddEventListener("enterRoom_ack", EnterRoomHandle);
        NetDispacher.Instance.AddEventListener("roleInfoInRoom_bcst", RoleInfoInRoomHandle);
        NetDispacher.Instance.AddEventListener("startBattle_bcst", StartBattle_bcstHandle);
        NetDispacher.Instance.AddEventListener("leaveRoom_ack", LeaveRoomHandle);
        NetDispacher.Instance.AddEventListener("sendMessage_bcst", RevChatMsgHandle);
        NetDispacher.Instance.AddEventListener("friendsList_ack", FriendsListHandle);
        NetDispacher.Instance.AddEventListener("noticeInviteFriend_ecn", RevInviteMsgHandle);
        NetDispacher.Instance.AddEventListener("inviteResult_ack", RevInviteResultHandle);
    }
Пример #23
0
 public void Login(PlayersInfo playersInfo)
 {
     Console.WriteLine(playersInfo.Name + " İsimli  Giriş Yaptı.");
 }
Пример #24
0
 public void DeleteAccount(PlayersInfo playersInfo)
 {
     Console.WriteLine(playersInfo.Name + " İsimli Kullanıcı Silindi.");
 }
Пример #25
0
 public static async Task <Team> GetTeams(this PlayersInfo info) => await Rest.Get <Team>(info.Links.Team.Href);
Пример #26
0
 public void GameBuy(PlayersInfo player, Game game, Campaign campaign)
 {
     Console.WriteLine(player.Name + " Adlı oyuncu " + game.GameName + " Adlı oyunu " + campaign.CampaignName + " kampayasında satın aldı");
 }
Пример #27
0
 public static bool getStartUp(Players player)
 {
     return(GamepadInput.GamePad.GetButtonUp(GamepadInput.GamePad.Button.Start, PlayersInfo.getGamepad(player)));
 }
Пример #28
0
        public List<Dictionary<string, string>> ReadPlayersInfoInGame(Guid gameId, PlayersInfo playersInfo)
        {
            TableInform table;
            DbConnection connection;
            List<Dictionary<string, string>> resultedList;

            connection = TableInform.Connection;
            resultedList = new List<Dictionary<string, string>>();
            table = new TableInform(TablesNames.PlayerInGames.ToString());

            var rows = table.Table.AsEnumerable().Where(r => r.Field<Guid>("gameId") == gameId && r.Field<bool>(playersInfo.ToString()) == true).Select(r => r.Field<Guid>("PlayerId")).ToList();
            resultedList = ReadByIds(TablesNames.Players, rows);
            return resultedList;
        }
Пример #29
0
 public void UpdateAccaount(PlayersInfo playersInfo)
 {
     Console.WriteLine(playersInfo.Name + " İsimli Kullanıcı güncelleme işlemi yaptı.");
 }
Пример #30
0
 public void GameGiveBack(PlayersInfo player, Game game)
 {
     Console.WriteLine(player.Name + " Adlı oyuncu" + game.GameName + " adlı oyunu iade etti");
 }
Пример #31
0
        static void Main(string[] args)
        {
            PlayersInfo player1 = new PlayersInfo()
            {
                Name = "Cem", Surname = "Eröksüz", Birthday = 1993, IdentityNo = "123456789", Password = "******"
            };
            PlayersInfo player2 = new PlayersInfo()
            {
                Name = "Engin", Surname = "Demiroğ", Birthday = 1985, IdentityNo = "987654321", Password = "******"
            };
            PlayersInfo player3 = new PlayersInfo()
            {
                Name = "Can", Surname = "Baran", Birthday = 1998, IdentityNo = "963258741", Password = "******"
            };

            PlayerManager playerManager = new PlayerManager();

            playerManager.SignUp(player1);
            playerManager.SignUp(player3);
            playerManager.Login(player1);

            Game game1 = new Game()
            {
                GameName = "CS:GO", GamePrice = 75
            };
            Game game2 = new Game()
            {
                GameName = "GTA", GamePrice = 180
            };
            Game game3 = new Game()
            {
                GameName = "NFS", GamePrice = 278
            };

            Campaign winter = new Campaign()
            {
                CampaignName = "Winter", CampaignType = "%25"
            };
            Campaign summer = new Campaign()
            {
                CampaignName = "Summer", CampaignType = "%35"
            };
            Campaign legend = new Campaign()
            {
                CampaignName = "LegendNovember", CampaignType = "%15"
            };


            GameManager gameManager = new GameManager();

            gameManager.GameBuy(player1, game2, winter);
            gameManager.GameBuy(player2, game1, legend);

            playerManager.DeleteAccount(player3);



            List <PlayersInfo> players = new List <PlayersInfo>();

            players.Add(player1);
            players.Add(player2);
            players.Add(player3);
            players.Reverse();



            List <Game> games = new List <Game>();

            games.Add(game1);
            games.Add(game2);
            games.Add(game3);



            List <Campaign> campaigns = new List <Campaign>();

            campaigns.Add(winter);
            campaigns.Add(summer);
            campaigns.Add(legend);
        }