コード例 #1
0
    public void FinishSaveProfile()
    {
        Debug.Log("Finishing save!");
        newArmorprofile.ResetArmorValues();

        for (int x = 0; x < CharacterArmor.ARMOR_LOCATIONS; x++)
        {
            newArmorprofile.AssignArmorValue(armorInputFields[x].text, x);
            newArmorprofile.isHard[x] = armorhardnessToggles[x].isOn;
        }

        newArmorprofile.profileName = profileNameInputField.text;

        armorProfileList.Add(newArmorprofile);

        //Serialize this to JSON.
        //string armorProfileJSON = JsonUtility.ToJson(armorProfileList, true);
        string armorProfileJSON = JsonHelper.ToJson(armorProfileList, true);

        File.WriteAllText(filePath, armorProfileJSON);
        ReloadList();
    }
コード例 #2
0
    void GetTargetArmorValues()
    {
        //targetArmor.headArmorVal = System.Int32.Parse(headArmorInputField.text);
        //targetArmor.headIsHard = headHardToggle.enabled;
        //targetArmor.torsoArmorVal = System.Int32.Parse(torsoArmorInputField.text);
        //targetArmor.torsoIsHard = torsoHardToggle.enabled;
        //targetArmor.leftArmArmorVal = System.Int32.Parse(leftArmArmorInputField.text);
        //targetArmor.leftArmIsHard = leftArmHardToggle.enabled;
        //targetArmor.rightArmArmorVal = System.Int32.Parse(rightArmArmorInputField.text);
        //targetArmor.rightArmIsHard = rightArmHardToggle.enabled;
        //targetArmor.leftLegArmorVal = System.Int32.Parse(leftLegArmorInputField.text);
        //targetArmor.leftLegIsHard = leftLegHardToggle.enabled;
        //targetArmor.rightLegArmorVal = System.Int32.Parse(rightLegArmorInputField.text);
        //targetArmor.rightLegIsHard = rightLegHardToggle.enabled;

        for (int x = 0; x < CharacterArmor.ARMOR_LOCATIONS; x++)
        {
            //int armorVal = 0;
            //if (!System.Int32.TryParse(armorInputFields[x].text, out armorVal)) armorVal = 0;
            //targetArmor.armorVal[x] = armorVal;
            targetArmor.AssignArmorValue(armorInputFields[x].text, x);
            targetArmor.isHard[x] = armorhardnessToggles[x].isOn;
        }
    }