예제 #1
0
    // Start is called before the first frame update
    void Start()
    {
        collection = StyleCollection.getInstance();

        foreach (var bodyPartAvailable in collection.getAvailableBodyParts())
        {
            var key       = StyleCollection.bodyPartToString(bodyPartAvailable);
            var currentId = PlayerPrefs.GetString(key);
            if (currentId == "")
            {
                currentId = defaultPart;
            }
            m_meshIds[bodyPartAvailable] = currentId;
        }

        loadSprite(Hood, BodyPart.Hood);
        loadSprite(Head, BodyPart.Head);
        loadSprite(Torso, BodyPart.Torso);
        loadSprite(Pelvis, BodyPart.Pelvis);
        loadSprite(leftShoulder, BodyPart.LShoulder);
        loadSprite(rightShoulder, BodyPart.RShoulder);
        loadSprite(leftElbow, BodyPart.LElbow);
        loadSprite(rightElbow, BodyPart.RElbow);
        loadSprite(leftWrist, BodyPart.LWrist);
        loadSprite(rightWrist, BodyPart.RWrist);
        loadSprite(leftLeg, BodyPart.LLeg);
        loadSprite(rightLeg, BodyPart.RLeg);
        loadSprite(leftBoot, BodyPart.LBoot);
        loadSprite(rightBoot, BodyPart.RBoot);
    }
예제 #2
0
 private void OnDestroy()
 {
     foreach (var bodyPartAvailable in collection.getAvailableBodyParts())
     {
         var key             = StyleCollection.bodyPartToString(bodyPartAvailable);
         var spriteMeshDatas = collection.getCustomizerData(bodyPartAvailable);
         var currentId       = spriteMeshDatas.getCurrentMeshId();
         PlayerPrefs.SetString(key, currentId);
     }
     collection.unloadAllAssets();
 }