Beispiel #1
0
    public void Load(int id)
    {
        Debug.Log("load character " + id);
        parameter        = new SuccessCharaParam();
        parameter.Mana   = new int[Mana.MAX];
        parameter.Skills = new Dictionary <string, int>();
        parameter.Flags  = new Dictionary <string, int>();

        Debug.Log("Load" + id);
        Dictionary <int, SuccessCharaParam> characterList;

        if (PlayerPrefs.HasKey("RegisterCharacterList"))
        {
            characterList = Serialize.Load <Dictionary <int, SuccessCharaParam> >("RegisterCharacterList");
        }
        else
        {
            characterList = new Dictionary <int, SuccessCharaParam>();
        }
        if (characterList.ContainsKey(id))
        {
            parameter = characterList[id];
            Debug.Log("Load Success " + id);
            Debug.Log(parameter.ToString());

            TextManager.I.variables = Serialize.Load <Dictionary <string, int> >("Variable");
        }
        else
        {
            Debug.Log("There is not character data with " + id);
            parameter.maxStamina = parameter.Stamina = 100;             //todo
        }
        Serialize.Save <int>("characterID", parameter.ID);
        SetLifeGauge();
    }
Beispiel #2
0
    public void SetNewData()
    {
        Debug.Log("new data");
        parameter         = new SuccessCharaParam();
        parameter.Mana    = new int[Mana.MAX];
        parameter.Skills  = new Dictionary <string, int>();
        parameter.Flags   = new Dictionary <string, int>();
        parameter.Stamina = parameter.maxStamina = 100;
        parameter.ID      = GetNewCharacterID();

        if (Container.container.ContainsKey("CharaName"))
        {
            parameter.Name = Container.Get <string>("CharaName");
        }
        else
        {
            parameter.Name = "デフォルトくん";
        }
        Debug.Log(parameter.Name);
        foreach (SkillList.Param param in Excel <SkillList> .Item.list)
        {
            int skillLevel = TextManager.I.GetVariable(param.Key);
            if (skillLevel > 0)
            {
                parameter.Skills.Add(param.Key, skillLevel);
                Debug.Log(param.Key + "習得済み" + skillLevel);
            }
        }
        Serialize.Save <int>("characterID", parameter.ID);
        SetLifeGauge();
    }