Beispiel #1
0
    public GameStageModel GetStageModel(int stageNumber)
    {
        int stageIndex = stageNumber - 1;

        if (stageIndex >= CurrentLevelModel.m_Stages.Length)
        {
            PrettyLogger.Log(string.Format("Stage {0} is out of bound at index {1}", stageNumber, stageIndex), LogColor.Red);
            stageIndex = CurrentLevelModel.m_Stages.Length - 1;
        }
        return(CurrentLevelModel.m_Stages[stageIndex]);
    }
Beispiel #2
0
    public GameLevelModel GetLevelModel(int levelNumber)
    {
        int levelIndex = levelNumber - 1;

        if (levelIndex < m_LevelsData.m_Levels.Length)
        {
            return(m_LevelsData.m_Levels[levelIndex]);
        }
        PrettyLogger.Log(string.Format("Level {0} is out of bound at index {1}", levelNumber, levelIndex), LogColor.Red);
        return(m_LevelsData.m_Levels[m_LevelsData.m_Levels.Length - 1]);
    }
        // TODO: make prettyLog work in the situation of loops in the object graph
        /// <summary><inheritDoc/></summary>
        public virtual void PrettyLog(Redwood.RedwoodChannels channels, string description)
        {
            Redwood.StartTrack(description);
            // sort keys by class name
            IList <Type> sortedKeys = new List <Type>(this.KeySet());

            sortedKeys.Sort(IComparer.Comparing(null));
            // log key/value pairs
            foreach (Type key in sortedKeys)
            {
                string keyName = key.GetCanonicalName().Replace("class ", string.Empty);
                object value   = this.Get(key);
                if (PrettyLogger.Dispatchable(value))
                {
                    PrettyLogger.Log(channels, keyName, value);
                }
                else
                {
                    channels.Logf("%s = %s", keyName, value);
                }
            }
            Redwood.EndTrack(description);
        }
Beispiel #4
0
 /// <summary><inheritDoc/></summary>
 public virtual void PrettyLog(Redwood.RedwoodChannels channels, string description)
 {
     PrettyLogger.Log(channels, description, Counters.AsMap(this));
 }
Beispiel #5
0
 /// <summary><inheritDoc/></summary>
 public virtual void PrettyLog(Redwood.RedwoodChannels channels, string description)
 {
     PrettyLogger.Log(channels, description, this.AsList());
 }