コード例 #1
0
    public MouthCellViewModel CreateAndSetUpMouthCellViewModel(int mouthIndex)
    {
        MouthCellModel     model = stickerCustomizationPopupModel.GetDataWithIndex(mouthIndex);
        MouthCellViewModel mouthCellViewModel = new MouthCellViewModel(model, cachedResourcesLoader);

        mouthCellViewModel.SelectionIntent.Subscribe(_ => selectedMouthModel.OnNext(model));
        selectedMouthModel.Select(x => x.Id == mouthIndex).Subscribe(mouthCellViewModel.MouthActiveObserver);

        return(mouthCellViewModel);
    }
コード例 #2
0
    private void Awake()
    {
        string mouthsData = Resources.Load <TextAsset>("MouthsData").text;
        StickerCustomizationPopupModel stickerCustomizationPopupModel = JsonUtility.FromJson <StickerCustomizationPopupModel>(mouthsData);

        SetViewModel(new StickerCustomizationPopupViewModel(stickerCustomizationPopupModel, new CachedResourcesLoader(), stickerCustomizationPopupModel.GetDataWithIndex(0).Id));
    }
コード例 #3
0
 public StickerCustomizationPopupViewModel(StickerCustomizationPopupModel stickerCustomizationPopupModel, CachedResourcesLoader cachedResourcesLoader, int selectedMouthId)
 {
     selectedMouthModel = new BehaviorSubject <MouthCellModel>(stickerCustomizationPopupModel.GetDataWithIndex(selectedMouthId));
     this.stickerCustomizationPopupModel = stickerCustomizationPopupModel;
     this.cachedResourcesLoader          = cachedResourcesLoader;
 }