Exemplo n.º 1
0
    public List <DiscipleDate_Common> discipleList_Common;  //弟子

    public void CreatDiscipleInheritInstantiate(DiscipleInheritDate discipleDate)
    {                                                                                                                                                                      //读取到数据后实例化该弟子
        DiscipleInheritDate disciple = Instantiate(disciplePrefab_Inherit, Vector3.zero, disciplePrefab_Inherit.transform.rotation).GetComponent <DiscipleInheritDate> (); //实例化,用于数据持久化

        disciple.transform.parent = transform;                                                                                                                             //放置该实例化物体到管理物体下
        disciple.Index            = discipleDate.Index;
        disciple.disciple         = discipleDate.disciple;                                                                                                                 //0为不存在 1为存在
        disciple.photo            = discipleDate.photo;                                                                                                                    //头像编号
        disciple.disciplename     = discipleDate.disciplename;                                                                                                             //姓名
        disciple.life             = discipleDate.life;                                                                                                                     //寿命
        disciple.sex            = discipleDate.sex;                                                                                                                        //性别 0女 1男
        disciple.practiceLv     = discipleDate.practiceLv;                                                                                                                 //修炼的等阶
        disciple.weaponsCreatLv = discipleDate.weaponsCreatLv;                                                                                                             //炼器等阶
        disciple.alchemyLv      = discipleDate.alchemyLv;                                                                                                                  //炼药等阶
        disciple.fightingLv     = discipleDate.fightingLv;                                                                                                                 //战斗等阶

        disciple.practiceTalent     = discipleDate.practiceTalent;                                                                                                         //修炼天赋       1-10正常
        disciple.weaponsCreatTalent = discipleDate.weaponsCreatTalent;                                                                                                     //炼器天赋   1-10正常
        disciple.alchemyTalent      = discipleDate.alchemyTalent;                                                                                                          //炼药天赋        1-10正常
        disciple.fightingTalent     = discipleDate.fightingTalent;                                                                                                         //战斗天赋       1-10正常

        disciple.practiceTimes     = discipleDate.practiceTimes;                                                                                                           //嗑药次数
        disciple.weaponsCreatTimes = discipleDate.weaponsCreatTimes;                                                                                                       //炼器次数
        disciple.alchemyTimes      = discipleDate.alchemyTimes;                                                                                                            //炼药次数
        disciple.fightingTimes     = discipleDate.fightingTimes;                                                                                                           //试炼次数
        disciple.name = "Disciple_Inherit" + disciple.Index;
        discipleList_Inherit.Add(disciple);                                                                                                                                //加入列表内
    }
Exemplo n.º 2
0
    private void WriteDiscipleInheritDate()
    {                                                                 //传承弟子
        for (int i = 0; i < 20; i++)
        {                                                             //创造20个数据
            DiscipleInheritDate disciple = new DiscipleInheritDate(); //实例化,用于数据持久化
            disciple.Index          = i;
            disciple.disciple       = 1;                              //0为不存在 1为存在
            disciple.photo          = Random.Range(1, 50);            //头像编号
            disciple.disciplename   = "测试";                           //姓名
            disciple.life           = Random.Range(1, 50);            //寿命
            disciple.sex            = Random.Range(1, 50);            //性别 0女 1男
            disciple.practiceLv     = Random.Range(1, 50);            //修炼的等阶
            disciple.weaponsCreatLv = Random.Range(1, 50);            //炼器等阶
            disciple.alchemyLv      = Random.Range(1, 50);            //炼药等阶
            disciple.fightingLv     = Random.Range(1, 50);            //战斗等阶

            disciple.practiceTalent     = Random.Range(1, 50);        //修炼天赋       1-10正常
            disciple.weaponsCreatTalent = Random.Range(1, 50);        //炼器天赋   1-10正常
            disciple.alchemyTalent      = Random.Range(1, 50);        //炼药天赋        1-10正常
            disciple.fightingTalent     = Random.Range(1, 50);        //战斗天赋       1-10正常

            disciple.practiceTimes     = Random.Range(1, 50);         //嗑药次数
            disciple.weaponsCreatTimes = Random.Range(1, 50);         //炼器次数
            disciple.alchemyTimes      = Random.Range(1, 50);         //炼药次数
            disciple.fightingTimes     = Random.Range(1, 50);         //试炼次数

            saveDate.SaveDiscipleInherit(disciple);
        }
    }
Exemplo n.º 3
0
    private void LoadDiscipleInheritDate()
    {                                                                                          //加载弟子数据
        for (int i = 0; i <= 999; i++)
        {                                                                                      //遍历从0-999的编号
            if (PlayerPrefs.HasKey("DiscipleInherit" + i))
            {                                                                                  //如果该key存在数据,则加载
                DiscipleInheritDate newDisciple = new DiscipleInheritDate();                   //new 一个用于储存数据的
                newDisciple.Index          = i;
                newDisciple.disciple       = 1;                                                //0为不存在 1为存在
                newDisciple.photo          = PlayerPrefs.GetInt("DiscipleInheritPhoto" + i);
                newDisciple.disciplename   = PlayerPrefs.GetString("DiscipleInheritName" + i); //姓名
                newDisciple.life           = PlayerPrefs.GetInt("DiscipleInheritLife" + i);
                newDisciple.sex            = PlayerPrefs.GetInt("DiscipleInheritSex" + i);
                newDisciple.practiceLv     = PlayerPrefs.GetInt("DiscipleInheritPracticeLv" + i);
                newDisciple.weaponsCreatLv = PlayerPrefs.GetInt("DiscipleInheritWeaponsCreatLv" + i);         //炼器等阶
                newDisciple.alchemyLv      = PlayerPrefs.GetInt("DiscipleInheritAlchemyLv" + i);              //炼药等阶
                newDisciple.fightingLv     = PlayerPrefs.GetInt("DiscipleInheritFightingLv" + i);             //战斗等阶

                newDisciple.practiceTalent     = PlayerPrefs.GetInt("DiscipleInheritPracticeTalent" + i);     //修炼天赋       1-10正常
                newDisciple.weaponsCreatTalent = PlayerPrefs.GetInt("DiscipleInheritWeaponsCreatTalent" + i); //炼器天赋   1-10正常
                newDisciple.alchemyTalent      = PlayerPrefs.GetInt("DiscipleInheritAlchemyTalent" + i);      //炼药天赋        1-10正常
                newDisciple.fightingTalent     = PlayerPrefs.GetInt("DiscipleInheritFightingTalent" + i);     //战斗天赋       1-10正常

                newDisciple.practiceTimes     = PlayerPrefs.GetInt("DiscipleInheritPracticeTimes" + i);       //嗑药次数
                newDisciple.weaponsCreatTimes = PlayerPrefs.GetInt("DiscipleInheritWeaponsCreatTimes" + i);   //炼器次数
                newDisciple.alchemyTimes      = PlayerPrefs.GetInt("DiscipleInheritAlchemyTimes" + i);        //炼药次数
                newDisciple.fightingTimes     = PlayerPrefs.GetInt("DiscipleInheritFightingTimes" + i);       //试炼次数

                discipleDateManager.CreatDiscipleInheritInstantiate(newDisciple);
            }
        }
    }
Exemplo n.º 4
0
    //***********传承弟子类0~999

    /*
     * DiscipleInherit+0~999 int类型 0为不存在 1为存在
     * DiscipleInheritName+0~999 姓名  string类型 为该弟子的名字
     * DiscipleInheritPhoto+0~999 int类型 为该弟子的头像
     * DiscipleInheritLife+0~999 int类型 寿命
     * DiscipleInheritSex+0~999 int类型 性别 0女 1男
     * DiscipleInheritPracticeLv+0~999 int类型      修炼的等阶
     * DiscipleInheritWeaponsCreatLv+0~999 int类型   炼器等阶
     * DiscipleInheritAlchemyLv+0~999 int类型     炼药等阶
     * DiscipleInheritFightingLv+0~999 int类型    战斗等阶
     * DiscipleInheritPracticeTalent+0~999 int类型  修炼天赋
     * DiscipleInheritWeaponsCreatTalent+0~999 int类型    炼器天赋   1-10正常
     * DiscipleInheritAlchemyTalent+0~999 int类型        炼药天赋        1-10正常
     * DiscipleInheritFightingTalent+0~999 int类型      战斗天赋       1-10正常
     * DiscipleInheritPracticeTimes+0~999 int类型       嗑药次数
     * DiscipleInheritWeaponsCreatTimes+0~999 int类型    炼器次数
     * DiscipleInheritAlchemyTimes+0~999 int类型          炼药次数
     * DiscipleInheritFightingTimes+0~999 int类型             试炼次数
     */

    public void SaveDiscipleInherit(DiscipleInheritDate discipleDate)
    {                                                                                        //保存弟子数据
        if (discipleDate.disciple == 0)
        {                                                                                    //说明不存在需要清空数据
            PlayerPrefs.DeleteKey("DiscipleInherit" + discipleDate.Index);                   //清除数据
            PlayerPrefs.DeleteKey("DiscipleInheritName" + discipleDate.Index);               //清除数据
            PlayerPrefs.DeleteKey("DiscipleInheritPhoto" + discipleDate.Index);              //清除数据
            PlayerPrefs.DeleteKey("DiscipleInheritLife" + discipleDate.Index);               //清除数据
            PlayerPrefs.DeleteKey("DiscipleInheritSex" + discipleDate.Index);                //清除数据
            PlayerPrefs.DeleteKey("DiscipleInheritPracticeLv" + discipleDate.Index);         //清除数据
            PlayerPrefs.DeleteKey("DiscipleInheritWeaponsCreatLv" + discipleDate.Index);     //清除数据
            PlayerPrefs.DeleteKey("DiscipleInheritAlchemyLv" + discipleDate.Index);          //清除数据
            PlayerPrefs.DeleteKey("DiscipleInheritFightingLv" + discipleDate.Index);         //清除数据
            PlayerPrefs.DeleteKey("DiscipleInheritPracticeTalent" + discipleDate.Index);     //清除数据
            PlayerPrefs.DeleteKey("DiscipleInheritWeaponsCreatTalent" + discipleDate.Index); //清除数据
            PlayerPrefs.DeleteKey("DiscipleInheritAlchemyTalent" + discipleDate.Index);      //清除数据
            PlayerPrefs.DeleteKey("DiscipleInheritFightingTalent" + discipleDate.Index);     //清除数据
            PlayerPrefs.DeleteKey("DiscipleInheritPracticeTimes" + discipleDate.Index);      //清除数据
            PlayerPrefs.DeleteKey("DiscipleInheritWeaponsCreatTimes" + discipleDate.Index);  //清除数据
            PlayerPrefs.DeleteKey("DiscipleInheritAlchemyTimes" + discipleDate.Index);       //清除数据
            PlayerPrefs.DeleteKey("DiscipleInheritFightingTimes" + discipleDate.Index);      //清除数据
        }
        else
        {
            PlayerPrefs.SetInt("DiscipleInherit" + discipleDate.Index, 1);                                 //保存弟子存在标志位
            PlayerPrefs.SetString("DiscipleInheritName" + discipleDate.Index, discipleDate.disciplename);  //
            PlayerPrefs.SetInt("DiscipleInheritPhoto" + discipleDate.Index, discipleDate.photo);           //
            PlayerPrefs.SetInt("DiscipleInheritLife" + discipleDate.Index, discipleDate.life);             //
            PlayerPrefs.SetInt("DiscipleInheritSex" + discipleDate.Index, discipleDate.sex);               //

            PlayerPrefs.SetInt("DiscipleInheritPracticeLv" + discipleDate.Index, discipleDate.practiceLv); //
            PlayerPrefs.SetInt("DiscipleInheritWeaponsCreatLv" + discipleDate.Index, discipleDate.weaponsCreatLv);
            PlayerPrefs.SetInt("DiscipleInheritAlchemyLv" + discipleDate.Index, discipleDate.alchemyLv);
            PlayerPrefs.SetInt("DiscipleInheritFightingLv" + discipleDate.Index, discipleDate.fightingLv);

            PlayerPrefs.SetInt("DiscipleInheritPracticeTalent" + discipleDate.Index, discipleDate.practiceTalent);
            PlayerPrefs.SetInt("DiscipleInheritWeaponsCreatTalent" + discipleDate.Index, discipleDate.weaponsCreatTalent);
            PlayerPrefs.SetInt("DiscipleInheritAlchemyTalent" + discipleDate.Index, discipleDate.alchemyTalent);
            PlayerPrefs.SetInt("DiscipleInheritFightingTalent" + discipleDate.Index, discipleDate.fightingTalent);

            PlayerPrefs.SetInt("DiscipleInheritPracticeTimes" + discipleDate.Index, discipleDate.practiceTimes);
            PlayerPrefs.SetInt("DiscipleInheritWeaponsCreatTimes" + discipleDate.Index, discipleDate.weaponsCreatTimes);
            PlayerPrefs.SetInt("DiscipleInheritAlchemyTimes" + discipleDate.Index, discipleDate.alchemyTimes);
            PlayerPrefs.SetInt("DiscipleInheritFightingTimes" + discipleDate.Index, discipleDate.fightingTimes);
        }
    }
Exemplo n.º 5
0
 public void DeletDiscipleInheritDate(DiscipleInheritDate discipleDate)
 {                                               //弟子死亡后清空弟子储存数据
     discipleDate.disciple = 0;
     saveDate.SaveDiscipleInherit(discipleDate); //保存
 }