Beispiel #1
0
    void OnPressLevelUpBtn()
    {
        if (namakemonoData.No == 0)
        {
            OnPressPlayerLevelup();
            return;
        }

        int apple = SaveData.GetInt(SaveDataKeys.possessedPoint);

        if (apple < namakemonoData.GetNextNeededApple())
        {
            //所持金が足りない
            return;
        }

        //お金消費
        apple -= namakemonoData.GetNextNeededApple();

        //レベルあげる
        List <NamakemonoData> ndList = SaveData.GetList(SaveDataKeys.possessedNamakemonoList, InitialValues.POSSESSED_NAMAKEMONO_LIST);

        foreach (NamakemonoData nd in ndList)
        {
            if (nd.No == namakemonoData.No)
            {
                nd.level       = nd.level + 1;
                namakemonoData = nd;
            }
        }

        //保存
        SaveData.SetInt(SaveDataKeys.possessedPoint, apple);
        SaveData.SetList(SaveDataKeys.possessedNamakemonoList, ndList);
        SaveData.Save();

        //更新
        SetUp(namakemonoData);
        updateDataManager.GetComponent <UpdateDataManager>().UpdatePossessedNamakemonoList(ndList);
        updateDataManager.GetComponent <UpdateDataManager>().UpdatePossessedPoint(apple);
    }
Beispiel #2
0
 //画像などのセットアップを行う
 public void SetUp(NamakemonoData nd)
 {
     namakemonoData = nd;
     if (nd.No == 0)
     {
         PlayerSetup();
         return;
     }
     imgIcon.GetComponent <Image>().sprite         = Resources.Load <Sprite>("Image/Monster/" + nd.No.ToString());
     txtName.GetComponent <Text>().text            = nd.name + ((nd.plus == 0)?"":" +" + nd.plus.ToString());
     txtLevel.GetComponent <Text>().text           = nd.level.ToString();
     txtNextNeededApple.GetComponent <Text>().text = nd.GetNextNeededApple().ToString();
     txtAttack.GetComponent <Text>().text          = "ATK:" + nd.GetAttackPower().ToString();
 }