Exemplo n.º 1
0
    public void Save()
    {
        CJVariable cjvariable = null;

        for (int i = 0; i < 18; i++)
        {
            Enums.Event key = (Enums.Event)i;
            if (this.m_Stats.TryGetValue((int)key, out cjvariable))
            {
                switch (cjvariable.GetVariableType())
                {
                case CJVariable.TYPE.String:
                    SaveGame.SaveVal("Stat" + key.ToString(), cjvariable.SValue);
                    break;

                case CJVariable.TYPE.Int:
                    SaveGame.SaveVal("Stat" + key.ToString(), cjvariable.IValue);
                    break;

                case CJVariable.TYPE.Float:
                    SaveGame.SaveVal("Stat" + key.ToString(), cjvariable.FValue);
                    break;

                case CJVariable.TYPE.Bool:
                    SaveGame.SaveVal("Stat" + key.ToString(), cjvariable.BValue);
                    break;
                }
            }
        }
    }
Exemplo n.º 2
0
    public bool StatisticGreater(string stat_name, string level)
    {
        Enums.Event stat_type = (Enums.Event)Enum.Parse(typeof(Enums.Event), stat_name);
        CJVariable  statistic = this.GetStatistic(stat_type);

        if (statistic == null)
        {
            return(false);
        }
        CJVariable.TYPE variableType = statistic.GetVariableType();
        if (variableType != CJVariable.TYPE.Int)
        {
            if (variableType == CJVariable.TYPE.Float)
            {
                float num = 0f;
                if (float.TryParse(level, out num))
                {
                    return(statistic.FValue > num);
                }
            }
        }
        else
        {
            int num2 = 0;
            if (int.TryParse(level, out num2))
            {
                return(statistic.IValue > num2);
            }
        }
        return(false);
    }
Exemplo n.º 3
0
    private void Setup()
    {
        this.m_Content.text = string.Empty;
        for (int i = 0; i < 18; i++)
        {
            Enums.Event stat_type = (Enums.Event)i;
            CJVariable  statistic = StatsManager.Get().GetStatistic(stat_type);
            Text        content   = this.m_Content;
            content.text = content.text + stat_type.ToString() + ": ";
            CJVariable.TYPE variableType = statistic.GetVariableType();
            if (variableType == CJVariable.TYPE.Unknown)
            {
                Text content2 = this.m_Content;
                content2.text += "-\n";
            }
            else
            {
                switch (variableType)
                {
                case CJVariable.TYPE.String:
                {
                    Text content3 = this.m_Content;
                    content3.text += statistic.SValue;
                    break;
                }

                case CJVariable.TYPE.Int:
                {
                    Text content4 = this.m_Content;
                    content4.text += statistic.IValue.ToString();
                    break;
                }

                case CJVariable.TYPE.Float:
                {
                    Text content5 = this.m_Content;
                    content5.text += statistic.FValue.ToString("F1");
                    break;
                }

                case CJVariable.TYPE.Bool:
                {
                    Text content6 = this.m_Content;
                    content6.text += statistic.BValue.ToString();
                    break;
                }
                }
                Text content7 = this.m_Content;
                content7.text += "\n";
            }
        }
    }