Example #1
0
    // ValidPlay verifies that the card chosen can be played on the discard pile
    public bool ValidPlay(CardBartok cb)
    {
        GameMode.Mode gameMode = FindObjectOfType <GameMode>().State;

        // Valid if face and faces are wild.
        if (gameMode == GameMode.Mode.facesWild && cb.rank > 10)
        {
            return(true);
        }

        // It's a valid play if the rank is the same in all modes.
        if (cb.rank == targetCard.rank)
        {
            return(true);
        }

        // It's a valid play if the rank is +/- in +/- mode.
        int absdiff = Mathf.Abs(cb.rank - targetCard.rank);

        if (gameMode == GameMode.Mode.rankPlusMinus && (absdiff == 1 || absdiff == 12))
        {
            return(true);
        }

        // It's a valid play if the suit is the same and game mode is not Match Rank flavor
        if (cb.suit == targetCard.suit && gameMode != GameMode.Mode.matchRank && gameMode != GameMode.Mode.rankPlusMinus)
        {
            return(true);
        }

        // Otherwise, return false
        return(false);
    }
        public static int GetScore(string name, GameType type, GameMode.Mode mode, GameDifficult.Difficult diff)
        {
            JObject jobj;

            if (!UserData.ContainsKey("myBestScore"))
            {
                return(0);
            }
            jobj = (JObject)UserData["myBestScore"];
            if (!jobj.ContainsKey(type.ToString()))
            {
                return(0);
            }
            jobj = (JObject)jobj[type.ToString()];
            if (!jobj.ContainsKey(name))
            {
                return(0);
            }
            jobj = (JObject)jobj[name];
            if (!jobj.ContainsKey(mode.ToString()))
            {
                return(0);
            }
            jobj = (JObject)jobj[mode.ToString()];
            if (!jobj.ContainsKey(diff.ToString()))
            {
                return(0);
            }
            return((int)jobj[diff.ToString()]);
        }
Example #3
0
    private void OnMouseDown()
    {
        GameMode.Mode gm = GameObject.Find("GameManager").GetComponent <GameMode>().gameMode;


        SetToFire();
    }
Example #4
0
 public RoomSettings(string lobbyName, GameMode.Mode gameMode, GameMap.Map map, uint maxPlayers)
 {
     this.lobbyName     = lobbyName;
     lobbyGameMode      = gameMode;
     lobbyMap           = map;
     currentPlayerCount = 0;
     maxPlayerCount     = maxPlayers;
 }
Example #5
0
 /// <summary>
 /// 게임 데이터 초기화
 /// </summary>
 public static void Clear()
 {
     _gameMode      = GameMode.Mode.None;
     _worldFileName = null;
     //_player = new PlayerGroup();
     Player.Clear();
     //_cycle = new Cycle();
     Cycle.Clear();
     //_turn = new Turn();
     Turn.Clear();
 }
    public void SetRoom(string nameInput, int sizeInput, int countInput, int modeInput, int mapInput)
    {
        roomName    = nameInput;
        roomSize    = sizeInput;
        playerCount = countInput;
        roomMode    = GameMode.GetModeByID(modeInput);
        roomMap     = GameMap.GetMapByID(mapInput);

        roomNameDisplay.text = nameInput;
        roomSizeDisplay.text = countInput + "/" + sizeInput;
        roomModeDisplay.text = GameMode.GetNameByID(modeInput);
        roomMapDisplay.text  = GameMap.GetNameByID(mapInput);
    }
Example #7
0
 public GameMode.Mode GetCurrentMode(GameMode.Mode mode, GameDifficult.Difficult diff)
 {
     if (difficult.ContainsKey(mode) && difficult[mode].ContainsKey(diff))
     {
         return(mode);
     }
     else if (difficult.ContainsKey(DJMaxModeMapping(mode)) && difficult[DJMaxModeMapping(mode)].ContainsKey(diff))
     {
         return(DJMaxModeMapping(mode));
     }
     else
     {
         return(GameMode.Mode.None);
     }
 }
        public static bool SetScore(int score, string name, GameType type, GameMode.Mode mode, GameDifficult.Difficult diff)
        {
            if (score == 0)
            {
                return(false);
            }
            JObject jobj;

            if (!UserData.ContainsKey("myBestScore"))
            {
                UserData["myBestScore"] = new JObject();
            }
            jobj = (JObject)UserData["myBestScore"];
            if (!jobj.ContainsKey(type.ToString()))
            {
                jobj[type.ToString()] = new JObject();
            }
            jobj = (JObject)jobj[type.ToString()];
            if (!jobj.ContainsKey(name))
            {
                jobj[name] = new JObject();
            }
            jobj = (JObject)jobj[name];
            if (!jobj.ContainsKey(mode.ToString()))
            {
                jobj[mode.ToString()] = new JObject();
            }
            jobj = (JObject)jobj[mode.ToString()];
            if (!jobj.ContainsKey(diff.ToString()))
            {
                jobj[diff.ToString()] = score;
                return(true);
            }
            var bestScore = (int)jobj[diff.ToString()];

            if (score > bestScore)
            {
                jobj[diff.ToString()] = score;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #9
0
    public void CreateRoom()
    {
        string name = roomNameInput.text;

        GameMode.Mode mode       = GameMode.GetModeByID(roomGameModeInput.value);
        GameMap.Map   map        = GameMap.GetMapByID(roomMapInput.value);
        uint          maxPlayers = (uint)roomMaxPlayerInput.value + 1;

        RoomOptions options = new RoomOptions()
        {
            IsVisible    = true,
            IsOpen       = true,
            EmptyRoomTtl = 3000,
            MaxPlayers   = System.Convert.ToByte(maxPlayers),
            CustomRoomPropertiesForLobby = new string[] { MODE_PROP_KEY, MAP_PROP_KEY },
            CustomRoomProperties         = new ExitGames.Client.Photon.Hashtable {
                { MODE_PROP_KEY, mode }, { MAP_PROP_KEY, map }
            }
        };

        PhotonNetwork.CreateRoom(name, options);
    }
Example #10
0
 public static void SetGameMode(GameMode.Mode __gameMode)
 {
     _gameMode = __gameMode;
 }