Ejemplo n.º 1
0
    public static void Load(string json)
    {
        JsonData data;

        try
        {
            data = JsonMapper.ToObject(json);
        }
        catch
        {
            data = new JsonData();
        }

        for (E_MPGameType gameType = E_MPGameType.DeathMatch; gameType < E_MPGameType.None; ++gameType)
        {
            string       gameTypeName = GameInfo.GetGameTypeName(gameType);
            GameTypeInfo gameInfo     = null;

            if (data.IsObject == true && data.HasValue(gameTypeName) == true)
            {
                JsonData gameData = data[gameTypeName];

                switch (gameType)
                {
                case E_MPGameType.DeathMatch:
                    gameInfo = JsonMapper.ToObject <DeathMatchInfo>(gameData.ToJson());
                    break;

                case E_MPGameType.ZoneControl:
                    gameInfo = JsonMapper.ToObject <ZoneControlInfo>(gameData.ToJson());
                    break;

                default:
                    throw new System.ArgumentOutOfRangeException("GameInfoSettings.Load() - unknown GameType '" + gameType + "'");
                }
            }
            else
            {
                switch (gameType)
                {
                case E_MPGameType.DeathMatch:
                    gameInfo = new DeathMatchInfo();
                    break;

                case E_MPGameType.ZoneControl:
                    gameInfo = new ZoneControlInfo();
                    break;

                default:
                    throw new System.ArgumentOutOfRangeException("GameInfoSettings.Load() - unknown GameType '" + gameType + "'");
                }
            }

#if IGNORE_DESIRED_RANK_TO_PLAY
            gameInfo.MinimalDesiredRankToPlay = 1;
#endif

            m_GameInfos[(int)gameType] = gameInfo;
        }
    }
Ejemplo n.º 2
0
    // PRIVATE METHODS

    void UpdateButtonStates()
    {
        FtueAction.Base      action = Ftue.ActiveAction ?? Ftue.PendingAction;
        PlayerPersistantInfo ppi    = PPIManager.Instance.GetLocalPPI();
        ZoneControlInfo      zcInfo = GameInfoSettings.GetGameInfo <ZoneControlInfo>();
        int maxRank   = PlayerPersistantInfo.MAX_RANK;
        int rank      = ppi != null ? ppi.Rank : 1;
        int minRankZC = zcInfo != null?Mathf.Clamp(zcInfo.MinimalDesiredRankToPlay, 1, maxRank) : 1;

        bool disabled   = !LobbyClient.IsConnected;
        bool highlight  = action != null && action.ShouldBeIngame || action is FtueAction.RankUp ? true : false;
        bool disableDM  = disabled;
        bool tutorialZC = Ftue.IsActionFinished <FtueAction.ZoneControl>() ? false : true;
        bool unlockedZC = rank >= minRankZC ? true : false;

        if (tutorialZC == true && Ftue.IsActionActive <FtueAction.ZoneControl>() == false)
        {
            unlockedZC = false;
        }

        bool highlightDM = unlockedZC == false ? highlight : false;
        bool disableZC   = unlockedZC == true ? disabled : true;
        bool highlightZC = unlockedZC == true ? highlight : false;
        bool showBlurbDM = ppi != null && ppi.IsFirstGameToday(E_MPGameType.DeathMatch) ? true : false;
        bool showBlurbZC = ppi != null && ppi.IsFirstGameToday(E_MPGameType.ZoneControl) ? unlockedZC : false;
        bool showLockZC  = zcInfo != null && unlockedZC == false ? true : false;

        m_ButtonPlayDM.IsDisabled    = disableDM;
        m_ButtonPlayDM.animate       = true;
        m_ButtonPlayDM.isHighlighted = action is FtueAction.DeathMatch || highlightDM ? !disableDM : false;
        ShowWidget(m_PlayDMBlurb, showBlurbDM);

        m_ButtonPlayZC.IsDisabled    = disableZC;
        m_ButtonPlayZC.animate       = true;
        m_ButtonPlayZC.isHighlighted = action is FtueAction.ZoneControl || highlightZC ? !disableZC : false;
        m_PlayZCLock.Show(showLockZC, tutorialZC && rank >= minRankZC ? -1 : minRankZC);
        ShowWidget(m_PlayZCBlurb, showBlurbZC);
    }