示例#1
0
    private void LoadCharacters()
    {
        SelectionManager.Clear();
        // Show list of characters that can be create
        var selectableCharacters = GameInstance.PlayerCharacters.Values.ToList();

        CacheList.Generate(selectableCharacters, (index, character, ui) =>
        {
            var dataId           = character.HashId;
            var characterData    = new PlayerCharacterData();
            characterData.DataId = dataId;
            characterData.SetNewCharacterData(character.title, character.HashId);
            var uiCharacter = ui.GetComponent <UICharacter>();
            uiCharacter.Setup(characterData, dataId);
            // Select trigger when add first entry so deactivate all models is okay beacause first model will active
            var characterModel = characterData.InstantiateModel(characterModelContainer);
            CharacterModels[characterData.dataId] = characterModel;
            characterModel.gameObject.SetActive(false);
            SelectionManager.Add(uiCharacter);
        });
    }